$plan - Issue-Ready Decomposition
Quick ref: turn a goal or research artifact into .agents/plans/*.md,
optional bd issues, dependency waves, file ownership, and validation checks.
Execute this workflow. Do not only describe it. Keep planning separate from
implementation. A finished plan should let $crank, $implement, or a future
Codex session execute without chat-only context.
Inputs And Flags
Given $plan <goal> [--auto]:
| Flag |
Purpose |
--auto |
Skip the human approval gate for $rpi and other autonomous chains |
--fast-path |
Force the minimal 1-2 issue plan shape |
--deep |
Force symbol-level/deep plan detail |
--skip-symbol-check |
Skip symbol verification for greenfield plans |
--skip-audit-gate |
Skip baseline audit gate for docs-only plans |
If bd is unavailable, still write the markdown plan in .agents/plans/.
Discovery Boundary
Use the Skill Ports and Adapters
vocabulary for the boundary from Discovery into Plan:
| Boundary piece |
Plan contract |
| Inbound port |
plan_slices from BDD intent, bead, research artifact, or execution packet |
| Outbound ports |
persist_issue, verify_symbols, retrieve_context, seed_execution_packet |
| Driving adapter |
$plan skill invocation |
| Driven adapters |
bd, rg, .agents/findings, .agents/plans, execution-packet writer |
| Context packet |
slice plan, file dependency matrix, acceptance criteria, test levels |
| Guard adapter |
stale-scope verification, symbol verification, wave-validity check |
Feature: Plan converts dense intent into executable slices
Scenario: Plan consumes Discovery output
Given Discovery provides density fields and artifact links
When Plan receives the `plan_slices` port request
Then each slice has acceptance criteria, write scope, test levels, and ownership
And no slice depends on raw Discovery chat context
Workflow
- Pre-flight stale bead scope. If the input is a bead ID and the work is
full-complexity, older than 7 days, or inherited from another session, run
ao beads verify <bead-id> before decomposition. Do not plan against stale
citations without revalidation.
- Set up artifacts. Create
.agents/plans/ and locate prior research,
handoffs, findings, planning rules, and relevant .agents/ history.
- Load prevention context. Prefer
.agents/planning-rules/*.md; fall back
to .agents/findings/registry.jsonl. Treat active findings as hard
planning context. Record applied finding IDs in the plan with an
Applied findings: line, even when the value is none.
- Recommend a strategic duel when warranted. If the plan spans more than
one execution session and has at least one contested operator-default
decision, recommend the dueling-idea-wizards route
(
$council --mode=debate --focus=ideas) before decomposition. Keep it
advisory, not mandatory. Skip it for single-session or non-contested plans.
Evidence from the 2026-05-17 Mt Olympus run: roughly 22 min wall-clock,
3/5 operator defaults flipped, and one already-shipped adapter bug surfaced.
- Explore only as needed. If prior research does not provide enough file
and symbol detail, inspect the codebase or dispatch a bounded explorer.
Demand file inventory, symbol names, reuse points with
file:line, test
locations, and package/import relationships.
- Baseline audit. Mechanically count the current state before making
quantitative claims: files, sections, LOC, tests, fixtures, schemas, and
any SKILL.md files near size limits. Record commands and results.
- Choose detail level. Minimal for 1-2 simple issues, Standard for 3-6
issues, Deep for 7+ issues, broad refactors, or
--deep.
- Decompose into issues. Each issue needs title, file ownership,
dependencies, acceptance criteria, test levels, and at least one mechanical
conformance check (
files_exist, content_check, command, tests, or
lint). Feature, bug, and product-facing behavior issues also need a
fenced gherkin block or a link to the upstream intent issue scenario.
Non-trivial plans and bead bodies should include the hexagon: boundary
block: inbound port, bounded context, adapters, context packet, and done
state.
- Compute waves. Group independent issues by dependency. Serialize or
merge same-file writes. Include generated artifacts, docs, schemas, fixtures,
Codex companions, manifests, and hash markers in ownership.
Generated Artifact Companion Scope is mandatory: list every touched file,
including tests, docs, schemas, fixtures, runtime copies, parity manifests, hash markers,
and generated Codex artifacts. If skill behavior or runtime UX
changes, include
bash scripts/refresh-codex-artifacts.sh --scope worktree
in verification.
- Write the plan. Use
.agents/plans/YYYY-MM-DD-<goal-slug>.md and the
template in references/plan-document-template.md.
- Create tracking tasks. Prefer bd issues with validation blocks and
dependency edges. If bd is missing, leave the markdown plan as the durable
handoff.
- Approval gate. Skip only with
--auto; otherwise ask whether to
proceed, revise, or return to research.
Required Plan Sections
Every non-trivial plan must include:
- context and applied findings
- files to modify
- boundaries and non-goals
- baseline audit evidence
- issue list with acceptance criteria and validation
- execution order/waves
- file dependency matrix
- file-conflict matrix
- cross-wave shared file registry when applicable
- planning rules compliance
- verification commands
- next steps
Read references/plan-document-template.md
for the canonical shape.
Codex Guardrails
- Keep WHAT and HOW distinct; do not implement while planning.
- Prefer concrete file paths, symbol names, and validation commands over long
narrative.
- Treat Codex companion files as part of the same issue when skill behavior or
runtime UX changes.
- If a plan changes a schema with
additionalProperties: false, put schema work
before consumers in an earlier wave.
- If an acceptance criterion cannot be checked mechanically, mark it
underspecified before handing it to execution.
Examples
User says: $plan "add rate limiting"
Produce a plan with file inventory, issues, validation, and wave order.
User says: $plan --auto ".agents/research/auth.md"
Use the research as input, write the plan, create tracking tasks when possible,
and skip the approval gate.
Read references/examples.md for full examples.
Troubleshooting
| Problem |
Response |
| bd is missing |
Write the markdown plan and note that issue creation was skipped |
| Prior research is thin |
Explore enough to produce file and symbol evidence |
| Same file appears in parallel issues |
Serialize or merge those issues before handoff |
| Baseline audit is missing |
Mark the plan incomplete unless --skip-audit-gate is justified |
Reference Documents
- references/complexity-estimation.md
- references/decomposition.md
- references/detail-templates.md
- references/examples.md
- references/implementation-detail.md
- references/plan-document-template.md
- references/plan-mutations.md
- references/plan-to-beads-workflow.md
- references/planning-rules.md
- references/pre-decomposition.md
- references/sdd-patterns.md
- references/task-creation.md
- references/templates.md
- references/wave-matrices.md
1---2name: plan-153description: Decompose goals into issue plans.4---5
6# $plan - Issue-Ready Decomposition
7
8> Quick ref: turn a goal or research artifact into `.agents/plans/*.md`,
9optional bd issues, dependency waves, file ownership, and validation checks.
10
11**Execute this workflow. Do not only describe it.** Keep planning separate from
12implementation. A finished plan should let `$crank`, `$implement`, or a future
13Codex session execute without chat-only context.
14
15## Inputs And Flags
16
17Given `$plan <goal> [--auto]`:
18
19| Flag | Purpose |
20|------|---------|
21| `--auto` | Skip the human approval gate for `$rpi` and other autonomous chains |
22| `--fast-path` | Force the minimal 1-2 issue plan shape |
23| `--deep` | Force symbol-level/deep plan detail |
24| `--skip-symbol-check` | Skip symbol verification for greenfield plans |
25| `--skip-audit-gate` | Skip baseline audit gate for docs-only plans |
26
27If bd is unavailable, still write the markdown plan in `.agents/plans/`.
28
29## Discovery Boundary
30
31Use the [Skill Ports and Adapters](../../docs/contracts/skill-ports-and-adapters.md)
32vocabulary for the boundary from Discovery into Plan:
33
34| Boundary piece | Plan contract |
35|---|---|
36| Inbound port | `plan_slices` from BDD intent, bead, research artifact, or execution packet |
37| Outbound ports | `persist_issue`, `verify_symbols`, `retrieve_context`, `seed_execution_packet` |
38| Driving adapter | `$plan` skill invocation |
39| Driven adapters | bd, `rg`, `.agents/findings`, `.agents/plans`, execution-packet writer |
40| Context packet | slice plan, file dependency matrix, acceptance criteria, test levels |
41| Guard adapter | stale-scope verification, symbol verification, wave-validity check |
42
43```gherkin
44Feature: Plan converts dense intent into executable slices
45 Scenario: Plan consumes Discovery output
46 Given Discovery provides density fields and artifact links
47 When Plan receives the `plan_slices` port request
48 Then each slice has acceptance criteria, write scope, test levels, and ownership
49 And no slice depends on raw Discovery chat context
50```
51
52## Workflow
53
541. **Pre-flight stale bead scope.** If the input is a bead ID and the work is
55 full-complexity, older than 7 days, or inherited from another session, run
56 `ao beads verify <bead-id>` before decomposition. Do not plan against stale
57 citations without revalidation.
582. **Set up artifacts.** Create `.agents/plans/` and locate prior research,
59 handoffs, findings, planning rules, and relevant `.agents/` history.
603. **Load prevention context.** Prefer `.agents/planning-rules/*.md`; fall back
61 to `.agents/findings/registry.jsonl`. Treat active findings as hard
62 planning context. Record applied finding IDs in the plan with an
63 `Applied findings:` line, even when the value is `none`.
644. **Recommend a strategic duel when warranted.** If the plan spans more than
65 one execution session and has at least one contested operator-default
66 decision, recommend the dueling-idea-wizards route
67 (`$council --mode=debate --focus=ideas`) before decomposition. Keep it
68 advisory, not mandatory. Skip it for single-session or non-contested plans.
69 Evidence from the 2026-05-17 Mt Olympus run: roughly 22 min wall-clock,
70 3/5 operator defaults flipped, and one already-shipped adapter bug surfaced.
715. **Explore only as needed.** If prior research does not provide enough file
72 and symbol detail, inspect the codebase or dispatch a bounded explorer.
73 Demand file inventory, symbol names, reuse points with `file:line`, test
74 locations, and package/import relationships.
756. **Baseline audit.** Mechanically count the current state before making
76 quantitative claims: files, sections, LOC, tests, fixtures, schemas, and
77 any SKILL.md files near size limits. Record commands and results.
787. **Choose detail level.** Minimal for 1-2 simple issues, Standard for 3-6
79 issues, Deep for 7+ issues, broad refactors, or `--deep`.
808. **Decompose into issues.** Each issue needs title, file ownership,
81 dependencies, acceptance criteria, test levels, and at least one mechanical
82 conformance check (`files_exist`, `content_check`, `command`, `tests`, or
83 `lint`). Feature, bug, and product-facing behavior issues also need a
84 fenced `gherkin` block or a link to the upstream intent issue scenario.
85 Non-trivial plans and bead bodies should include the `hexagon:` boundary
86 block: inbound port, bounded context, adapters, context packet, and done
87 state.
889. **Compute waves.** Group independent issues by dependency. Serialize or
89 merge same-file writes. Include generated artifacts, docs, schemas, fixtures,
90 Codex companions, manifests, and hash markers in ownership.
91 Generated Artifact Companion Scope is mandatory: list every touched file,
92 including tests, docs, schemas, fixtures, runtime copies, parity manifests, hash markers,
93 and generated Codex artifacts. If skill behavior or runtime UX
94 changes, include `bash scripts/refresh-codex-artifacts.sh --scope worktree`
95 in verification.
9610. **Write the plan.** Use `.agents/plans/YYYY-MM-DD-<goal-slug>.md` and the
97 template in [references/plan-document-template.md](references/plan-document-template.md).
9811. **Create tracking tasks.** Prefer bd issues with validation blocks and
99 dependency edges. If bd is missing, leave the markdown plan as the durable
100 handoff.
10112. **Approval gate.** Skip only with `--auto`; otherwise ask whether to
102 proceed, revise, or return to research.
103
104## Required Plan Sections
105
106Every non-trivial plan must include:
107
108- context and applied findings
109- files to modify
110- boundaries and non-goals
111- baseline audit evidence
112- issue list with acceptance criteria and validation
113- execution order/waves
114- file dependency matrix
115- file-conflict matrix
116- cross-wave shared file registry when applicable
117- planning rules compliance
118- verification commands
119- next steps
120
121Read [references/plan-document-template.md](references/plan-document-template.md)
122for the canonical shape.
123
124## Codex Guardrails
125
126- Keep WHAT and HOW distinct; do not implement while planning.
127- Prefer concrete file paths, symbol names, and validation commands over long
128 narrative.
129- Treat Codex companion files as part of the same issue when skill behavior or
130 runtime UX changes.
131- If a plan changes a schema with `additionalProperties: false`, put schema work
132 before consumers in an earlier wave.
133- If an acceptance criterion cannot be checked mechanically, mark it
134 underspecified before handing it to execution.
135
136## Examples
137
138**User says:** `$plan "add rate limiting"`
139Produce a plan with file inventory, issues, validation, and wave order.
140
141**User says:** `$plan --auto ".agents/research/auth.md"`
142Use the research as input, write the plan, create tracking tasks when possible,
143and skip the approval gate.
144
145Read [references/examples.md](references/examples.md) for full examples.
146
147## Troubleshooting
148
149| Problem | Response |
150|---------|----------|
151| bd is missing | Write the markdown plan and note that issue creation was skipped |
152| Prior research is thin | Explore enough to produce file and symbol evidence |
153| Same file appears in parallel issues | Serialize or merge those issues before handoff |
154| Baseline audit is missing | Mark the plan incomplete unless `--skip-audit-gate` is justified |
155
156## Reference Documents
157
158- [references/complexity-estimation.md](references/complexity-estimation.md)
159- [references/decomposition.md](references/decomposition.md)
160- [references/detail-templates.md](references/detail-templates.md)
161- [references/examples.md](references/examples.md)
162- [references/implementation-detail.md](references/implementation-detail.md)
163- [references/plan-document-template.md](references/plan-document-template.md)
164- [references/plan-mutations.md](references/plan-mutations.md)
165- [references/plan-to-beads-workflow.md](references/plan-to-beads-workflow.md)
166- [references/planning-rules.md](references/planning-rules.md)
167- [references/pre-decomposition.md](references/pre-decomposition.md)
168- [references/sdd-patterns.md](references/sdd-patterns.md)
169- [references/task-creation.md](references/task-creation.md)
170- [references/templates.md](references/templates.md)
171- [references/wave-matrices.md](references/wave-matrices.md)