Match the prompt: the write-docs and research-docs commands are given only when step 5 listed docs, and the output path is asked only for research-docs topics. Refs: #255 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
224 lines
10 KiB
Markdown
224 lines
10 KiB
Markdown
# plan plugin — outline
|
||
|
||
Status: outline, refined in a first grilling round, with a bare-bones MVP built (see "What ships
|
||
today"). This is the maintainer's intent for the plugin.
|
||
|
||
The plugin is set up on its own, separate from `delivery`, and is meant to grow on its own first.
|
||
How the two connect is deliberately left open (see "Open for later").
|
||
|
||
## Purpose
|
||
|
||
Cover picking up a new ticket or idea and turning it into a spec and a ticket breakdown that
|
||
agents further down the chain (planning or implementation) can act on with the least extra
|
||
context gathering.
|
||
|
||
The goal is to optimise:
|
||
|
||
- the ticket creation process;
|
||
- context management and agent instructions for downstream agents, including the context and
|
||
instructions written into issues;
|
||
- reuse of the context that already exists (repo, tracker, docs) and of online sources.
|
||
|
||
## Sources to consult
|
||
|
||
- **The repo and its context**: current practices, rules, functionality, patterns and
|
||
conventions.
|
||
- **The internet and other sources**: tools, documentation, best practices, examples and
|
||
standards.
|
||
|
||
## Tracks
|
||
|
||
The work takes one of three tracks:
|
||
|
||
- **Spec and tickets**: a spec issue in the tracker, broken down into tickets.
|
||
- **Ticket(s) only**: one or more tickets with no spec.
|
||
- **Wayfinder**: work too large for one agent session, or with decisions that cannot be settled
|
||
yet.
|
||
|
||
The plugin recommends a track, with its reason, after the initial grilling (step 2). For the first
|
||
two tracks the user confirms it at agreement (step 6), because the plan can change the size of the
|
||
work. Wayfinder is different: it is confirmed right after step 2. `/plan` then gives the user a
|
||
copyable `/wayfinder` command (hand-invoked) carrying the intent and the grilling answers, and
|
||
stops. Steps 3-10 are skipped.
|
||
|
||
## Interaction flow
|
||
|
||
0. **Entry.** There are three ways in, and all of them continue at step 1:
|
||
- an existing ticket;
|
||
- a new idea, as free text;
|
||
- a ticket picked through `/next`.
|
||
1. **Gate.** A cheap check before any grilling: is it a duplicate of an open issue or PR, is it
|
||
already done, does it contradict an ADR, or is it outside the repo's scope (`docs/VISION.md`)?
|
||
If any of these is true, stop.
|
||
2. **Initial grilling**, only if required, to explore the ticket's or idea's intention. It uses
|
||
`grilling`, plus `domain-modeling` to challenge terms only. GLOSSARY.md and the ADRs are not
|
||
edited during grilling: candidates are collected and written in step 7. This equals
|
||
`grill-with-docs` minus the writing during grilling (`grill-me` and `grill-with-docs` are
|
||
hand-invoked wrappers). It ends with a recommended track.
|
||
3. **Research** in the repo and online, scoped to the recommended track. Researchers flag when
|
||
lasting reference docs for an external tool or library are needed. Nothing is written in this
|
||
step.
|
||
4. **Deep validation.** Check that the work is feasible and fits the repo as it is now. If it does
|
||
not, go back to grilling (step 2) or stop.
|
||
5. **Offer a plan** with options, considerations, recommendations, impact, expected results and
|
||
the track. `codebase-design` is used only when the options change module or interface shape.
|
||
The plan also lists the repo docs needed for downstream context.
|
||
6. **Agreement.** The user agrees and confirms the track, or the flow goes back to grilling or
|
||
research.
|
||
7. **Record decisions.** Open a docs PR that updates AGENTS.md, GLOSSARY.md, the ADRs and any
|
||
other relevant docs with what was decided. The spec links to it, so tickets point at decisions
|
||
that are already written down rather than pending. After `plan-recorder` opens the docs PR,
|
||
if step 5 listed docs, `/plan` gives copyable `/write-docs` and `/research-docs` commands,
|
||
only the ones that apply, for the user to run on the docs branch and push to the same PR. When
|
||
`research-docs` topics were listed, `/plan` first asks the user for its output path. Both need
|
||
the user in the loop, so they cannot run inside a subagent.
|
||
8. **Write the spec** as an issue in the tracker (Gitea included). This step runs on the spec and
|
||
tickets track only. The spec issue never carries `Status/Ready for Agent`; `/plan` strips the
|
||
one `/to-spec` sets.
|
||
9. **Propose a breakdown** into tickets. If the breakdown shows a gap in the spec, go back to
|
||
step 8.
|
||
10. **Approval and filing.** One explicit approval covers the whole batch. The plugin files the
|
||
tickets and sets `Status/Ready for Agent` on the ones that carry acceptance criteria. A
|
||
ticket without acceptance criteria is never set ready. `gitea-labels-milestones` resolves the
|
||
label IDs for the Ready-for-Agent strip. On the spec track it also creates the
|
||
`Spec: <title>` milestone, and `gitea-issues` assigns the filed tickets to it.
|
||
|
||
Every command `/plan` asks the user to run is presented as a copyable code block.
|
||
|
||
### Loops
|
||
|
||
The flow is a loop, not a straight line. The named loop-backs are:
|
||
|
||
- research → grilling (step 3 or 4 back to 2);
|
||
- disagreement → grilling or research (step 6 back to 2 or 3);
|
||
- breakdown → spec (step 9 back to 8).
|
||
|
||
Wayfinder is an early exit rather than a loop: it ends the flow after step 2.
|
||
|
||
After two loops on the same point, the plugin asks whether to park the idea instead of
|
||
circling.
|
||
|
||
### Sequence diagram
|
||
|
||
```mermaid
|
||
sequenceDiagram
|
||
autonumber
|
||
actor U as User
|
||
participant P as plan (orchestrator)
|
||
participant R as Repo<br/>(AGENTS.md, ADRs, VISION, code)
|
||
participant W as Web / docs
|
||
participant T as Tracker (Gitea)
|
||
|
||
%% Step 0 — Entry
|
||
alt existing ticket
|
||
U->>P: ticket #N
|
||
P->>T: read issue
|
||
else new idea
|
||
U->>P: free text
|
||
else via /next
|
||
U->>P: /next [metric]
|
||
P->>T: rank open issues
|
||
P-->>U: ranked list
|
||
U->>P: pick one
|
||
end
|
||
|
||
%% Step 1 — Gate
|
||
P->>T: duplicate open issue/PR? already done?
|
||
P->>R: contradicts an ADR? outside VISION scope?
|
||
opt any gate hit
|
||
P-->>U: stop, with reason
|
||
end
|
||
|
||
%% Steps 2–6 — the discovery loop
|
||
loop until agreed (after 2 loops on one point, offer to park)
|
||
opt intent unclear
|
||
P->>U: grilling questions (step 2)
|
||
U-->>P: answers
|
||
end
|
||
P-->>U: recommended track + reason
|
||
opt track = wayfinder (confirmed here, not at step 6)
|
||
U->>P: confirm wayfinder
|
||
P-->>U: copyable /wayfinder command (intent + grilling answers)
|
||
Note over P,U: stop, steps 3-10 skipped
|
||
end
|
||
|
||
par Research (step 3), scoped to track
|
||
P->>R: practices, patterns, conventions
|
||
and
|
||
P->>W: tools, docs, standards, examples
|
||
end
|
||
|
||
P->>R: deep validation: feasible, fits repo now? (step 4)
|
||
alt doesn't fit
|
||
P-->>U: back to grilling, or stop
|
||
else fits
|
||
P-->>U: plan: options, impact, results, track (step 5)
|
||
alt user agrees and confirms track (step 6)
|
||
U->>P: agree + track
|
||
else disagreement
|
||
U->>P: back to grilling or research
|
||
end
|
||
end
|
||
end
|
||
|
||
%% Step 7 — Record decisions
|
||
P->>T: open docs PR (AGENTS.md, GLOSSARY, ADRs)
|
||
P-->>U: copyable /write-docs and /research-docs commands
|
||
U->>T: run on the docs branch, push to the same PR
|
||
|
||
%% Steps 8–9 — Spec and breakdown
|
||
loop until breakdown shows no spec gap
|
||
opt track = spec + tickets
|
||
P->>T: write/update spec issue, link docs PR (step 8)
|
||
end
|
||
P-->>U: proposed ticket breakdown (step 9)
|
||
end
|
||
|
||
%% Step 10 — Approval and filing
|
||
U->>P: one approval for the whole batch
|
||
opt track = spec + tickets
|
||
P->>T: create milestone "Spec: <title>"
|
||
end
|
||
P->>T: file tickets (assigned to the milestone on the spec track)
|
||
P->>T: set Status/Ready for Agent<br/>(only tickets with acceptance criteria)
|
||
P-->>U: links to spec, tickets, docs PR
|
||
```
|
||
|
||
## What ships today
|
||
|
||
- `.apm/prompts/next.prompt.md`: the `/next` command. It ranks open issues by a metric, lets the
|
||
user pick one, validates it and presents a plan. It is read-only. Building happens through
|
||
`/ship`.
|
||
- `.apm/prompts/ship.prompt.md`: the `/ship` command. It executes the plan in context with
|
||
subagents: implement, review with a clean context, push, open a PR, watch CI. **This is
|
||
temporary.** Implementation does not belong in this plugin long term. It ships here so `/next`
|
||
has a working handoff until implementation has a home.
|
||
|
||
- `.apm/prompts/plan.prompt.md`: the `/plan` command, the MVP orchestrator for steps 0–10. It
|
||
dispatches the agents below and wires in existing skills at the step where each fits: `grilling`
|
||
with `domain-modeling` (no edits during grilling) and `plan-track` in step 2, including the
|
||
wayfinder early exit; `codebase-design` in step 5; and `gitea-labels-milestones` and
|
||
`gitea-issues` in steps 8–10 for the Ready-for-Agent strip and the `Spec:` milestone with ticket
|
||
assignment. Hand-invoked commands (`/wayfinder`, `/to-spec`, `/to-tickets`) and user-run ones
|
||
(`/write-docs`, `/research-docs`) are given to the user as copyable code blocks, and the user
|
||
running them is the approval.
|
||
- `.apm/agents/`: `plan-gate` (step 1), `plan-researcher` (step 3), `plan-validator` (step 4),
|
||
read-only (the researcher may write only to the scratchpad), and `plan-recorder` (step 7, the docs PR).
|
||
- `.apm/skills/plan-track/`: the track criteria for all three tracks, `wayfinder` included.
|
||
|
||
All of these are minimal stubs, to be built out. The prompt and agents route to `gitea-issues`,
|
||
`gitea-labels-milestones`, `gitea-prs`, `git-commits` and `agentsmd-author`, which `plan` does not
|
||
declare as dependencies: it assumes the `gitea`, `git` and `core` packages are installed.
|
||
`research-docs` and `write-docs` both ship in `plan`. `write-docs` moved from `bin` in `plan`
|
||
0.5.0 (`bin` 4.0.0 to 5.0.0).
|
||
|
||
## Open for later
|
||
|
||
- How plan hands off to `delivery`, and how the two plugins relate. Today `delivery` says only a
|
||
human sets `Status/Ready for Agent`, while plan may set it (step 10). When the two meet, one
|
||
of those rules has to change.
|
||
- Templates for the spec and tickets. Plan will own them.
|
||
- Where research output goes: folded into the spec, or kept as findings files.
|
||
- Whether the tracker issue carries the session's state, so planning can be resumed across
|
||
sessions.
|