Skip to main content

Module plan

Module plan 

Source
Expand description

magi plan: the interview that turns an idea into a task file worth competing.

A competition is only as good as its task statement. A vague task buys three vague candidates and a coin-toss tally, and the operator finds that out forty minutes and several dollars later. So this module sits in front of crate::queue: an agent interviews the operator about the idea, writes a full task file, and magi files that file rather than the one-liner the operator would otherwise have typed.

§magi does not host the conversation

There is no chat loop in here and there must not be one. The operator already has claude, opencode and agy, each with years of work in its own terminal UI - streaming, editing, file pickers, permission prompts. A conversation reimplemented over captured pipes would be worse than all three, and it is not what magi is for.

What magi does instead is narrow and mechanical:

  1. Write a briefing - the idea, the repository, and TASK_FILE_SPEC - to a file, telling the agent to interview the operator and write its task file to a named output path.
  2. Spawn the agent with stdin, stdout and stderr inherited, so the operator is talking to that CLI directly, in its own UI, with no magi in the middle. Nothing is captured and there is no timeout: a human deciding what to build takes as long as it takes.
  3. When the agent exits, read the output path, check it with review_draft, and file it.

§The draft is never thrown away

The output path is under crate::run::home/drafts from the start, not a temporary file, and nothing in this module deletes it. A twenty-minute interview that ends in a validation failure must leave the operator holding the draft, named in the error message, so the fix is an edit and magi task add --file rather than a second interview. That is the single most important behaviour here, and [vet] is the only place that can break it.

Structs§

Opts
What magi plan was asked to do.

Constants§

SHORT_DRAFT
The problem review_draft reports for a draft that is merely suspiciously short.
TASK_FILE_SPEC
The task-file shape the leader is asked to produce.

Functions§

installed
Can this agent’s CLI actually be run on this machine?
pick
Choose the agent that will conduct the interview.
plan
Interview the operator, then file the resulting task.
review_draft
Is this draft usable as a magi task?