Skip to main content

Module handoff

Module handoff 

Source
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§

FillReading
The fill reading a handoff fired on.
GroundTruth 🔒
The ground truth’s sections plus the cycle they end.
HandoffSeat 🔒
The seat a brief is written for.
HeldPrompt 🔒
A prompt held because the seat was swapping its occupant.
PendingBrief 🔒
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.
ShippedSkill
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.
SuccessorWatch 🔒
The handoff a session arrived by, while its first turns are measured.
SwapRequest 🔒
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.
SkillInstall
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_prompt recognizes forge’s own judgment prompt by this prefix, so whatever procedure the turn runs, it opens here. The prefix is_machine_prompt matches, 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 label reads 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 path is 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 - 1 with 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, or None when 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 None when the transcript read answered nothing.
sweep_candidates 🔒
The files inside one skill’s directory that are forge’s to remove: the {file}.tmp one of its own files leaves when a write failed, or a name the skill retires.
tail 🔒
The last cap entries.
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.