agora.plan.handoff
Agora handoff — mechanical PROJECT_STATE.md assembly (integration run 2.4).
Run 2’s evidence (findings F18’’ + Part 11) split the handoff document into two kinds of section:
FACT sections — Identity, Capability inventory, Verification record, File map — are mechanically DERIVABLE from the workspace + the flow’s gate commands. Emitting them from a model is both a reliability risk (the reasoning-vs-action emission gap at document scale) and a correctness risk (hallucinated file maps / signatures). They are generated here, true-by-construction.
PROSE sections — Architecture & invariants, Conventions, Extension points, How to run / test — carry judgement a model writes at README scale (T9.2).
write_project_state() reads the model’s prose file, extracts the FACT
sections, and assembles PROJECT_STATE.md deterministically in the eight
mandatory headers’ canonical order. Everything here is pure over its inputs
(workspace tree, gate commands, prose text) so it is unit-testable against a real
workspace fixture and re-runnable in any future phase-0 re-validation.
- Findings this module carries (the machine-consumable-handoff doctrine):
F18‴ — why FACT is mechanical: the open-ended reflective ask (“write the 8-section doc”) hit the termination-before-emission floor, so the split is a task-design dodge, not a prompt trick.
F20 / F20b — the Verification record serializes COMPLETE re-runnable
run_checkspecs (cmd + stdin + expectation, not bare argv), round-trippable viaparse_verification_run_checks(); assembler writes are utf-8-pinned. The record must derive from the PRODUCING flow’s FULL gate set (the v2.1 C3 completeness fix — a coverage regression test guards it).F21 — prose micro-asks must CITE code/spec anchors, not invent conventions (a fact-check caught an invented rule); enforced by task design, not here.
F24 — reuse is not revalidation: at re-handoff a reused prose section goes stale exactly where the delta touched its subject, so each is staleness-screened against the change rather than carried forward because its file is unchanged.
Module Attributes
Fence tag for a serialized, re-runnable run_check in the Verification record (F20). |
|
The eight mandatory headers, in order, tagged by source. |
|
The four headers the model must supply, one per micro-task (run 2.5). |
|
The four headers assembled mechanically. |
|
T9.2a-d). |
|
Body used when a prose section's micro-task human-fallbacked (its file is absent). |
Functions
|
Interleave FACT and PROSE sections into the eight-header canonical order. |
|
Generate the four FACT section bodies from the workspace tree + the flow's gate CHECKS (full run_check specs, not bare argv — F20). |
|
Split a prose markdown document into |
Inverse of |
|
|
Top-level function/class signatures (with annotations) from Python source. |
|
Read the four prose micro-task body files from |
|
Assemble |
- agora.plan.handoff.SECTION_PLAN: tuple[tuple[str, str], ...] = (('## Identity', 'fact'), ('## Architecture & invariants', 'prose'), ('## Capability inventory', 'fact'), ('## Verification record', 'fact'), ('## File map', 'fact'), ('## Conventions', 'prose'), ('## Extension points', 'prose'), ('## How to run / test', 'prose'))
The eight mandatory headers, in order, tagged by source. FACT headers are generated here; PROSE headers are lifted from the model’s prose file.
- agora.plan.handoff.PROSE_HEADERS: tuple[str, ...] = ('## Architecture & invariants', '## Conventions', '## Extension points', '## How to run / test')
The four headers the model must supply, one per micro-task (run 2.5).
- agora.plan.handoff.FACT_HEADERS: tuple[str, ...] = ('## Identity', '## Capability inventory', '## Verification record', '## File map')
The four headers assembled mechanically.
- agora.plan.handoff.PROSE_FILE_MAP: dict[str, str] = {'## Architecture & invariants': 'architecture.md', '## Conventions': 'conventions.md', '## Extension points': 'extension_points.md', '## How to run / test': 'how_to_run.md'}
T9.2a-d).
- Type:
Prose header -> the micro-task body file under
prose/(run 2.5
- agora.plan.handoff.HUMAN_FALLBACK_BODY = '_(human)_ — section pending human authorship (micro-task derailed).'
Body used when a prose section’s micro-task human-fallbacked (its file is absent). Marked so the fact-check can tell model prose from human-pending.
- agora.plan.handoff.RUN_CHECK_FENCE = 'run_check'
Fence tag for a serialized, re-runnable run_check in the Verification record (F20). A phase-0 re-validator (or the round-trip test) parses these back into run_check predicate args and executes them — cmd + stdin + expectation intact.
- agora.plan.handoff.python_signatures(source)[source]
Top-level function/class signatures (with annotations) from Python source.
Class methods are indented under their class. A syntax error yields
[]— the extractor degrades to “file present, no signatures” rather than raising.
- agora.plan.handoff.extract_fact_sections(workspace, gate_checks)[source]
Generate the four FACT section bodies from the workspace tree + the flow’s gate CHECKS (full run_check specs, not bare argv — F20). Keys are the FACT headers in
FACT_HEADERS.
- agora.plan.handoff.parse_prose_sections(text)[source]
Split a prose markdown document into
{"## Header": body}by ``## `` headers (case- and whitespace-sensitive so headers match the mandatory set).
- agora.plan.handoff.read_prose_sections(prose_dir)[source]
Read the four prose micro-task body files from
prose_dirinto{"## Header": body}. A missing or empty file (its micro-task human-fallbacked) yields the(human)placeholder so the assembled document stays structurally complete and the gap is visibly marked.
- agora.plan.handoff.parse_verification_run_checks(text)[source]
Inverse of
_verification_record(): extract the run_check arg dicts from a Verification-record body’s fenced blocks. A phase-0 re-validator feeds each straight intobuild_predicate("run_check", spec).
- agora.plan.handoff.assemble(fact_sections, prose_sections)[source]
Interleave FACT and PROSE sections into the eight-header canonical order. Every mandatory header is emitted even if its body is empty (a missing prose section yields a placeholder, so the structural gate reds loudly rather than silently dropping a header).
- agora.plan.handoff.write_project_state(workspace, gate_checks, prose_dir, out_path)[source]
Assemble
PROJECT_STATE.md= mechanical FACT + the four PROSE micro-task files (prose_dir) and write it toout_pathas UTF-8 (F20b). Returns the assembled text. Pure/deterministic given the workspace tree, gate checks, and prose files; a missing prose file becomes a marked(human)placeholder.