Expand description
The handoff brief: forge’s own ground truth, and the handing-over session’s judgment.
The ground truth is derived at swap time from the transcript, git and the board, so every path, command and number in it is read rather than remembered. The judgment is the old session’s reply to forge’s own prompt, captured before the swap while its context still holds the work.
Re-exports§
use std::path::Path;🔒use std::path::PathBuf;🔒use std::sync::Arc;🔒use std::time::SystemTime;🔒use forge_agent::client::SessionLaunchSettings;🔒use forge_primitives::ContentBlock;🔒use forge_primitives::HandoffBrief;🔒use forge_primitives::HandoffCycle;🔒use forge_primitives::HandoffGitState;🔒use forge_primitives::HandoffReason;🔒use forge_primitives::HandoffRecord;🔒use forge_primitives::HandoffSection;🔒use forge_primitives::Message;🔒use forge_primitives::Task;🔒use forge_primitives::TaskStatus;🔒use crate::SessionSlot;🔒use crate::protocol::Command;🔒use crate::protocol::NoticeSeverity;🔒use crate::protocol::SessionUpdate;🔒
Structs§
- Fill
Reading - The fill reading a handoff fired on.
- Ground
Truth 🔒 - The ground truth’s sections plus the cycle they end.
- Handoff
Seat 🔒 - The seat a brief is written for.
- Held
Prompt 🔒 - A prompt held because the seat was swapping its occupant.
- Pending
Brief 🔒 - What a swap left for the occupant that continues: the text it is given, and the record the seat draws. Held until that occupant connects.
- Shipped
Skill - One skill forge ships: its name, every file that lands in
<config_dir>/skills/<name>/, and the files a previous version installed that the current asset no longer carries. - Successor
Watch 🔒 - The handoff a session arrived by, while its first turns are measured.
- Swap
Request 🔒 - One handoff, decided and ready to run.
Enums§
- Role 🔒
- What the seat is, so the brief can say which charter it belongs to without repeating a charter the launch already carries.
- Skill
Install - How an install left a skill on disk.
Constants§
- DIRTY_
CAP 🔒 - FILE_
CAP 🔒 - How many files and dirty paths the brief names. Past this it starts re-summarising the session, which is the failure it exists to avoid.
- HANDOFF_
FILES 🔒 - JUDGMENT_
BODY 🔒 - What the turn is told to do: run the skill, then exit through the tool.
- JUDGMENT_
CAP 🔒 - The judgment half’s ceiling: room for the 400-word note the prompt asks for, with its pointer lines, and no more.
- JUDGMENT_
CONTRACT 🔒 - Forge’s output contract for the note the exit call carries.
- JUDGMENT_
DEADLINE 🔒 - How long a handoff waits for its judgment prompt to start.
- MACHINE_
PREFIX 🔒 - The prompt’s opening.
is_machine_promptrecognizes forge’s own judgment prompt by this prefix, so whatever procedure the turn runs, it opens here. The prefixis_machine_promptmatches, shared so the prompt and the matcher cannot drift apart. - READ_
SET_ 🔒CAP - The predecessor’s read set the successor is measured against is bounded: a record is not a transcript, and the count only needs the files the two sessions plausibly meet in.
- SHIPPED_
SKILLS 🔒 - Every skill forge installs at boot.
- SKILL 🔒
- The handoff skill forge ships and installs into the config dir.
- SUCCESSOR_
TURNS 🔒 - How many of the successor’s turns are measured.
- WIZARD_
FILES 🔒 - WIZARD_
SKILL 🔒 - The wizard skill’s procedure, and the bash library its stages ride.
- WIZARD_
TEMPLATE 🔒
Functions§
- assemble 🔒
- The deterministic half, pure over its inputs: what the tests drive.
- assistant_
text 🔒 - The plain text of an assistant turn’s blocks, when it holds any.
- board_
section 🔒 - brief_
text 🔒 - The brief as the successor receives it.
- cap_
judgment 🔒 - Keep the whole half under its ceiling. A cut is stated - the brief never silently loses the tail of what the old session wrote.
- cycle 🔒
- The cycle a handoff ends: one request per assistant row that carries a usage block, one turn per real user prompt, and the prompt tokens the model read.
- fact 🔒
- files_
section 🔒 - first_
and_ 🔒newest - The first entry plus the newest
cap - 1, and how many that leaves out. - ground_
truth 🔒 - Build the brief’s first half. The transcript read blocks, so it runs off the actor; the git probe waits on child processes and stays async.
- heading_
label 🔒 - Whether
labelreads as a heading rather than the front of a sentence. A marked line may be a longer title; a bare one has to be short and title-shaped. - install_
skill - Install one shipped skill into
skill_dir. - is_
machine_ 🔒prompt - Whether a user row is forge’s own prompt rather than a person’s or a peer’s.
- is_
memory_ 🔒path - Whether
pathis inside one of the memory directories. - judgment_
heading 🔒 - The heading a line opens, and its body when the line carries one.
- judgment_
opening 🔒 - The opening, built from the matcher’s prefix so the two cannot drift.
- judgment_
prompt 🔒 - The judgment prompt the turn runs: forge’s own words, the skill it names, and the output contract for the note the exit call carries.
- link_
kind 🔒 - list_
line 🔒 - A list line: everything when it fits, and when it does not, the first
entry plus the newest
cap - 1with the omission stated. - live_
work_ 🔒sections - What is still running when the seat hands over: live sub-agents, background tasks, monitors and the process tree.
- memory_
roots 🔒 - The directories the handoff’s own memory writes land in: the project’s memory dir, and the environment’s own where the cross-project notes live.
- mint_
session_ 🔒id - A fresh session id, deliberately NOT recorded against a slot’s row.
- missing_
note 🔒 - The judgment half when no exit note arrived. Never the turn’s prose dressed as the note: the successor is told the note is missing and where the session’s own account lives.
- named 🔒
- ordered_
marker 🔒 - The text after a leading
1./1)marker, orNonewhen there is none. - parse_
judgment 🔒 - Parse the handing-over session’s reply into the judgment half.
- parses_
as_ 🔒note - Whether a reply is a note. Nothing is prescribed about its shape, so any
reply with content is one; an empty reply or a headings-only shell is
not, and the caller answers that with
missing_note. - read_
set 🔒 - Every path the session read, in transcript order, deduped and capped.
- record_
section 🔒 - remove_
all 🔒 - render_
sections 🔒 - role_
section 🔒 - seat_
sections 🔒 - The seat’s facts, one section per label: the brief draws a table, and a fact carried inside another section’s value has no row of its own.
- shipped_
skills - The skills forge installs at boot.
- skill_
dir - The directory one shipped skill installs into:
<config_dir>/skills/<name>/. - skill_
path - The file a skill’s procedure lands in:
<config_dir>/skills/<name>/SKILL.md. - states_
a_ 🔒correction - Whether a user prompt reads as a correction of what came before.
- status_
name 🔒 - strip_
emphasis 🔒 - The label’s own closing
**, and only that literal pair. - successor_
counts 🔒 - How the successor’s first turns went, from its own transcript.
- successor_
measurement 🔒 - The counts, or
Nonewhen the transcript read answered nothing. - sweep_
candidates 🔒 - The files inside one skill’s directory that are forge’s to remove: the
{file}.tmpone of its own files leaves when a write failed, or a name the skill retires. - tail 🔒
- The last
capentries. - text_of 🔒
- The plain text of a block list, when it holds any.
- tool_
uses 🔒 - Every tool call’s id, name and input, in transcript order.
- transcript_
path 🔒 - Where a session’s transcript lives: the project directory the run’s cwd hashes to, then the id.
- user_
prompt_ 🔒count - How many real user prompts the transcript holds. A synthetic row is the harness speaking, a row with no text is a tool result, and a machine prompt is forge’s own words.