Expand description
The headless design-deliberation stage between magi plan’s interview and
the task file it files.
crate::graph’s judge / vote / deliberate machinery only runs when more
than one candidate survives - and [graph] candidates defaults to 1 now
(see crate::config::Graph::candidates’s doc for the cost numbers
behind that default), so on an ordinary task none of that machinery ever
fires any more. Diversity did not stop paying for itself; it moved. A
design sketch is a few paragraphs an agent can write without touching the
repository, where a full implementation is a hundred-plus-turn tool loop
that re-reads the codebase on every turn - so three sketches, gathered
once between the interview and the file, cost a fraction of a third
implementation and buy back the same disagreement the judges used to
surface, on every task rather than only the ones run with --candidates.
Three independent, read-only advisors ([gather]) each propose one
design. The planner seat ([roles] planner) then reads all three and
prompt::synthesizes them into the task file’s ## Context and
## Change, naming which advisor’s idea it kept where - it is told, in so
many words, not to pick a winner. Nothing here talks to the operator: the
interview already did that, and turning this stage into three more
conversations would be exactly the cost this module exists to avoid.
§Disposability narrows the blast radius, it does not forbid writing
allow_write: false alone is not a guarantee: opencode has no read-only
mode at all, and Claude’s --disallowed-tools stops its edit tools but not
a rm or a redirect run through its Bash tool. That is the existing,
accepted risk model for every read-only seat in this codebase - judge and
reviewer seats in crate::graph carry exactly the same weak guarantee,
and get away with it because their cwd is already a worktree the run
treats as disposable. This stage runs before any run exists, so it was
pointed at the operator’s own checkout until [checkout_worktrees] gave
every advisor seat, and the planner’s synthesis, a git worktree add --detach checkout at HEAD of their own, thrown away when run
returns - the same protection judges and reviewers already had, closing
the one gap unique to this stage rather than inventing a stronger
guarantee nothing else here provides.
What this buys: a relative-path write from a seat that ignores its
instructions lands in that seat’s own disposable checkout, not in the
operator’s repository and not in another seat’s. What it does not buy: an
absolute-path write, or an edit to the shared .git metadata a linked
worktree does not copy (its own config extension aside), can still reach
outside the checkout - the same as it always could for a judge or a
reviewer. Closing that would mean sandboxing the process itself (a
container, a chroot, an OS-level read-only mount), which no seat of any
kind in this codebase has today; adding one is a different, much larger
change than a design-deliberation stage, not something this module can
give an advisor seat on its own.
§The draft survives every failure short of success
run never writes to draft until it holds a complete, synthesized
replacement. Every early return - an advisor roster that produced nothing
usable, a planner seat that crashed or answered with no fenced task
block - leaves the interview’s own draft exactly as the leader wrote it,
and the error names its path, the same contract [crate::plan::vet]
keeps for a validation failure. The raw advisor records are written to
disk unconditionally, before that check even runs, so a total failure
still leaves something for the operator to read.
Structs§
- Advice
- The whole deliberation: one record per advisor seat, written to
<id>.advisors.jsonnext to the draft so the operator can read every seat’s reasoning - including a seat that failed - not only whichever parts synthesis kept. - Advisor
Record - One advisor seat’s outcome, kept even on failure so a synthesis that only
had two of three proposals to work with is not a mystery later - see
run’s doc.
Functions§
- run
- Run the design-deliberation stage: gather independent proposals, write the
raw record, synthesize them under the planner seat, and overwrite
draftwith the result.