# Plan Task ## Variables ### prompt {{prompt}} ### previous_envelope {{previous_envelope}} ### context_handoff_dir {{context_handoff_dir}} ## Task Plan the work described in `prompt`. 1. Write the full plan to `/plan.md` — this is the copy the builder reads. 2. Copy that file into the repo under `specs/`: - **List `specs/` before you pick the name.** A session that plans more than once reuses its ``, so the obvious name may already be taken. - Base name: `specs/_.md`, where `` is the session directory name inside `context_handoff_dir` (`.../sessions//context_handoff`) and `` is two to four kebab-case words naming the work. - If a file with that name already exists, use `specs/__v2.md`, then `_v3`, and so on until the name is free. **Never overwrite an existing spec** — the earlier plan is the record of what was asked for then. - **Copy it, do not retype it.** One bash call does the whole step: `mkdir -p specs && cp "/plan.md" "specs/_.md"` Writing the plan a second time through `write` re-emits every line you already wrote, which costs the whole document again in output tokens and lets the two copies drift. 3. Emit your `Report` JSON, declaring BOTH paths in `artifacts`. ## Report Respond with ONLY valid JSON matching `PlanOutput` — no prose before or after: ```json { "status": "success", "summary": "", "artifacts": ["/plan.md", "specs/_.md"], "commit_message": "", "notes_for_next_agent": "" } ``` Both `artifacts` entries are the paths you ACTUALLY wrote, `_v2` suffix and all. Gates open these files — a name you meant to use fails them.