@baldurpan/create-ai-workflow 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +165 -0
  3. package/dist/agents-block.js +70 -0
  4. package/dist/bin.js +14 -0
  5. package/dist/check/markdown.js +47 -0
  6. package/dist/check/parse.js +113 -0
  7. package/dist/check/rules.js +245 -0
  8. package/dist/cli.js +109 -0
  9. package/dist/commands/check.js +41 -0
  10. package/dist/commands/install.js +76 -0
  11. package/dist/commands/standards-add.js +145 -0
  12. package/dist/commands/update.js +214 -0
  13. package/dist/layout.js +115 -0
  14. package/dist/log.js +20 -0
  15. package/dist/manifest.js +53 -0
  16. package/dist/paths.js +41 -0
  17. package/package.json +37 -0
  18. package/templates/blocks/agents-block.md +30 -0
  19. package/templates/claude/agents/planner.agent.md +60 -0
  20. package/templates/claude/agents/reviewer.agent.md +77 -0
  21. package/templates/context/README.md +81 -0
  22. package/templates/context/plan-template.md +69 -0
  23. package/templates/context/plan-template.notes.md +55 -0
  24. package/templates/context/roles/coder.md +76 -0
  25. package/templates/context/workflow.md +143 -0
  26. package/templates/skills/feature-close/SKILL.md +102 -0
  27. package/templates/skills/feature-implement/SKILL.md +142 -0
  28. package/templates/skills/feature-plan/SKILL.md +138 -0
  29. package/templates/skills/feature-status/SKILL.md +86 -0
  30. package/templates/skills/onboard/SKILL.md +122 -0
  31. package/templates/skills/orchestrate/SKILL.md +92 -0
  32. package/templates/skills/roadmap/SKILL.md +97 -0
  33. package/templates/standards/.source +8 -0
  34. package/templates/standards/README.md +104 -0
  35. package/templates/standards/architecture/api-design.md +212 -0
  36. package/templates/standards/architecture/dependency-boundaries.md +104 -0
  37. package/templates/standards/architecture/feature-driven.md +102 -0
  38. package/templates/standards/architecture/folder-structure.md +108 -0
  39. package/templates/standards/architecture/monorepos.md +107 -0
  40. package/templates/standards/architecture/refactoring.md +97 -0
  41. package/templates/standards/architecture/shared-code.md +81 -0
  42. package/templates/standards/docs/PHP-SPEC.md +1195 -0
  43. package/templates/standards/docs/SPEC.md +540 -0
  44. package/templates/standards/examples/bad/data-fetching.tsx +52 -0
  45. package/templates/standards/examples/bad/derived-state.tsx +60 -0
  46. package/templates/standards/examples/bad/feature-component.tsx +80 -0
  47. package/templates/standards/examples/bad/prop-drilling.tsx +70 -0
  48. package/templates/standards/examples/good/data-fetching.tsx +53 -0
  49. package/templates/standards/examples/good/derived-state.tsx +52 -0
  50. package/templates/standards/examples/good/feature-component.tsx +141 -0
  51. package/templates/standards/examples/good/invoice.schema.ts +20 -0
  52. package/templates/standards/examples/good/prop-drilling.tsx +83 -0
  53. package/templates/standards/philosophy/ai-agent-behavior.md +93 -0
  54. package/templates/standards/philosophy/core-principles.md +49 -0
  55. package/templates/standards/philosophy/incremental-abstraction.md +56 -0
  56. package/templates/standards/philosophy/maintainability.md +66 -0
  57. package/templates/standards/philosophy/readability.md +87 -0
  58. package/templates/standards/php/README.md +62 -0
  59. package/templates/standards/php/anti-patterns.md +259 -0
  60. package/templates/standards/php/architecture.md +241 -0
  61. package/templates/standards/php/frameworks.md +197 -0
  62. package/templates/standards/php/rules.md +205 -0
  63. package/templates/standards/php/security.md +190 -0
  64. package/templates/standards/php/testing.md +139 -0
  65. package/templates/standards/php/tooling.md +245 -0
  66. package/templates/standards/react/accessibility.md +130 -0
  67. package/templates/standards/react/anti-patterns.md +187 -0
  68. package/templates/standards/react/component-design.md +139 -0
  69. package/templates/standards/react/error-boundaries.md +195 -0
  70. package/templates/standards/react/forms.md +147 -0
  71. package/templates/standards/react/hooks.md +88 -0
  72. package/templates/standards/react/memoization.md +87 -0
  73. package/templates/standards/react/state-management.md +123 -0
  74. package/templates/standards/react/testing.md +118 -0
  75. package/templates/standards/react/use-effect.md +110 -0
  76. package/templates/standards/security/api-security.md +136 -0
  77. package/templates/standards/security/auth.md +112 -0
  78. package/templates/standards/security/secrets.md +105 -0
  79. package/templates/standards/security/validation.md +89 -0
  80. package/templates/standards/templates/.editorconfig +16 -0
  81. package/templates/standards/templates/.nvmrc +1 -0
  82. package/templates/standards/templates/AGENTS.md +46 -0
  83. package/templates/standards/templates/CLAUDE.md +3 -0
  84. package/templates/standards/templates/_dot_gitignore +50 -0
  85. package/templates/standards/templates/biome.json +53 -0
  86. package/templates/standards/templates/eslint.config.js +61 -0
  87. package/templates/standards/templates/project-readme.md +76 -0
  88. package/templates/standards/templates/pull-request-template.md +46 -0
  89. package/templates/standards/templates/tsconfig.json +35 -0
  90. package/templates/standards/tooling/biome.md +92 -0
  91. package/templates/standards/tooling/ci.md +128 -0
  92. package/templates/standards/tooling/dates.md +194 -0
  93. package/templates/standards/tooling/dependencies.md +90 -0
  94. package/templates/standards/tooling/nx.md +113 -0
  95. package/templates/standards/tooling/observability.md +183 -0
  96. package/templates/standards/tooling/prisma.md +152 -0
  97. package/templates/standards/tooling/shadcn.md +115 -0
  98. package/templates/standards/tooling/tailwind.md +135 -0
  99. package/templates/standards/tooling/tanstack-query.md +214 -0
  100. package/templates/standards/tooling/tanstack-router.md +365 -0
  101. package/templates/standards/tooling/tanstack.md +31 -0
  102. package/templates/standards/tooling/vite.md +135 -0
  103. package/templates/standards/typescript/anti-patterns.md +107 -0
  104. package/templates/standards/typescript/error-handling.md +216 -0
  105. package/templates/standards/typescript/naming.md +78 -0
  106. package/templates/standards/typescript/rules.md +159 -0
  107. package/templates/standards/typescript/tsconfig/base.json +32 -0
  108. package/templates/standards/typescript/tsconfig/nextjs.json +12 -0
  109. package/templates/standards/typescript/tsconfig/react.json +9 -0
  110. package/templates/standards/typescript/validation.md +104 -0
  111. package/templates/stubs/executors.md +49 -0
  112. package/templates/stubs/findings.md +40 -0
  113. package/templates/stubs/history.md +13 -0
  114. package/templates/stubs/roadmap.md +29 -0
  115. package/templates/stubs/stack.md +35 -0
  116. package/templates/stubs/verify.md +48 -0
@@ -0,0 +1,76 @@
1
+ # Coder
2
+
3
+ You implement one task, exactly as briefed. You do not choose what to build and you do not decide when it
4
+ is finished — two gates do that.
5
+
6
+ Consult current documentation for any language, framework or library you touch. Your training data is
7
+ older than the ecosystem you are working in, even for technology you know well. Verify, then cite what you
8
+ verified.
9
+
10
+ ## What you receive
11
+
12
+ - A **plan** — the scope, the files, the acceptance criteria, and the review checklist the reviewer will
13
+ use.
14
+ - Paths to the project's standards. **Read them yourself**; they are files in this repository, not
15
+ something that has to be pasted into your brief.
16
+ - On a loopback: your prior implementation and the validator's verbatim feedback.
17
+
18
+ ## What happens to your output
19
+
20
+ Two gates, in order:
21
+
22
+ 1. **Verification** — the project's real lint, typecheck, build and test commands, listed in
23
+ `context/verify.md`. That file is the only place those commands are written down. Read it if you want to
24
+ run them yourself before declaring the task done; never assume what they are.
25
+ 2. **Review** — your implementation read against the plan's review checklist and the project's standards.
26
+
27
+ Before you declare a task done, walk through both: *will verification pass?* — fix anything you can already
28
+ see will fail. *What will the reviewer flag?* — fix the obvious ones.
29
+
30
+ ## Loopback rules
31
+
32
+ When you are re-invoked with validator feedback:
33
+
34
+ - **Address only the failing items.** No exceptions.
35
+ - **Do not refactor passing code**, even if you would structure it differently now.
36
+ - **Do not expand scope.** No features, comments or improvements the validator did not ask for.
37
+ - Reply with a focused summary that maps each fix to the specific feedback item it resolves.
38
+
39
+ This is what makes the loop converge instead of spin.
40
+
41
+ ## Output contract
42
+
43
+ Every task output includes:
44
+
45
+ - **Summary** — one to three sentences on what you did.
46
+ - **Files** — every file created or modified, with a brief per-file description.
47
+ - **Acceptance criteria coverage** — for each criterion in the plan, the implementation detail covering it.
48
+ - **Notes for testing** — fixtures, edge cases and setup details that are not obvious from the diff.
49
+ - **Notes for the reviewer** — deviations from the plan with justification, and any decision worth
50
+ flagging.
51
+
52
+ This structure is what lets the gates do their jobs without guessing what you intended.
53
+
54
+ ## Coding principles
55
+
56
+ 1. **Structure** — a consistent, predictable layout. Group code by feature; keep shared utilities minimal;
57
+ make entry points obvious. Before scaffolding several files, identify the shared structure first and use
58
+ the framework's own composition patterns for it. Duplication that requires the same fix in several
59
+ places is a smell, not a pattern.
60
+ 2. **Architecture** — prefer flat, explicit code over abstraction and deep hierarchy. Avoid clever
61
+ patterns, metaprogramming and unnecessary indirection. Minimise coupling.
62
+ 3. **Functions and modules** — keep control flow linear. Small-to-medium functions, shallow nesting, state
63
+ passed explicitly rather than reached for.
64
+ 4. **Naming and comments** — descriptive but simple names. Comment to record invariants, assumptions and
65
+ external requirements; not to narrate the code.
66
+ 5. **Errors and logging** — make errors explicit and informative. Log at boundaries, with structure.
67
+ 6. **Regenerability** — write so that any single file can be rewritten from scratch without breaking the
68
+ system. Prefer declarative configuration.
69
+ 7. **Platform** — use platform conventions directly and simply, without wrapping them.
70
+ 8. **Modifications** — when extending or refactoring, follow the patterns already in the file.
71
+ 9. **Quality** — favour deterministic, testable behaviour. Keep tests focused on observable behaviour.
72
+
73
+ ## Diagnose before fixing
74
+
75
+ When something fails, identify the root cause and say what it is before applying a fix. A fix applied to a
76
+ symptom you have not explained is a guess, and it will be reviewed as one.
@@ -0,0 +1,143 @@
1
+ # The planning workflow
2
+
3
+ Three tiers. Every boundary between them is crossed by an **explicit command, never as a side-effect** of
4
+ running something else.
5
+
6
+ ```
7
+ /roadmap "idea" ──▶ pending Tier 1 — the backlog
8
+ │ context/roadmap.md, with notes in context/drafts/
9
+ /feature-plan [--activate] writes context/plans/<NAME>-PLAN.md, then STOPS
10
+
11
+ a plan exists Tier 2 — one plan, with a phase status ledger
12
+
13
+ /feature-implement activates, then runs phases: plan → code → verify → review
14
+
15
+ /feature-close ──▶ context/archive/ + a context/history.md row
16
+ ```
17
+
18
+ | Transition | Command |
19
+ |---|---|
20
+ | Tier 1 → a plan | `/feature-plan` |
21
+ | a plan → being worked, then phase by phase | `/feature-implement` |
22
+ | Tier 2 → retired | `/feature-close` |
23
+ | no tier crossed | `/orchestrate` — one ad-hoc gated change; `/feature-status` — read-only |
24
+
25
+ **Every command finds its own starting point.** Nothing has to be looked up first, and `/feature-status` is
26
+ never a prerequisite for anything.
27
+
28
+ ## The commands
29
+
30
+ | Command | Owns | Writes |
31
+ |---|---|---|
32
+ | `/roadmap` | Tier 1 contents | `roadmap.md`, and `drafts/` when material is supplied |
33
+ | `/feature-plan` | Tier 1 → a plan document | `plans/<NAME>-PLAN.md`; the `active` marker only with `--activate` |
34
+ | `/feature-implement` | activation, and the phases within a plan | the plan's ledger, `findings.md`, the code |
35
+ | `/feature-status` | nothing — read-only | — |
36
+ | `/feature-close` | Tier 2 → retired | `history.md`, `archive/`, the reference sweep |
37
+ | `/orchestrate` | one ad-hoc gated change | the code, and `findings.md` |
38
+ | `/onboard` | the project-owned stubs | `verify.md`, `executors.md`, `stack.md` |
39
+
40
+ ## One source of truth per fact
41
+
42
+ | To know | Read |
43
+ |---|---|
44
+ | whether a feature is being worked | the `pending` / `active` marker in its `roadmap.md` heading |
45
+ | whether a feature has a plan | whether its **Doc** field points into `plans/` |
46
+ | where a phase stands | that plan's own status ledger |
47
+ | what a retired feature's outcome was | its `history.md` row |
48
+
49
+ **"Planned" is not a status.** It is the observation that a document exists in `plans/`. The marker answers
50
+ *is it being worked*; the **Doc** path answers *does it have a plan*. The two are orthogonal, so neither can
51
+ go stale against the other.
52
+
53
+ | Marker | **Doc** points at | Means |
54
+ |---|---|---|
55
+ | `pending` | nothing, or `drafts/` | an idea |
56
+ | `pending` | `plans/` | planned, not being worked |
57
+ | `active` | `plans/` | being worked |
58
+
59
+ **The two status vocabularies stay distinct.** The word alone tells you which tier you are looking at:
60
+
61
+ | Tier | Lives in | Values |
62
+ |---|---|---|
63
+ | Feature | `roadmap.md`, in the entry heading | `pending`, `active` |
64
+ | Phase | the plan's ledger, Status column | `not started`, `in progress`, `blocked`, `done` |
65
+
66
+ They are not synonyms. Spell them exactly as written — `not started` is two words, never `not-started`.
67
+
68
+ ## The standing rules
69
+
70
+ Every command below cites these rather than restating them. Two independently-worded copies of one rule is
71
+ the drift this design exists to prevent.
72
+
73
+ ### One active feature
74
+
75
+ > **At most one roadmap entry is `active`. Any command that sets the marker checks this first.**
76
+
77
+ `/feature-plan --activate` and `/feature-implement` both check it. Planning is *not* activation — several
78
+ features may hold plans at once, and that is what makes planning ahead possible.
79
+
80
+ ### Feature or task?
81
+
82
+ > **If you would want a `history.md` row for it, it is a feature — use the roadmap flow.
83
+ > If you would not, it is a task — use `/orchestrate`.**
84
+
85
+ `/orchestrate` is the ad-hoc escape hatch, not the way to skip planning. It refuses anything larger than a
86
+ commit-sized unit and anything an existing roadmap entry already covers.
87
+
88
+ ### Never transcribe a credential
89
+
90
+ > **A DSN, token or key is described and pointed at the secret store, never copied into a tracked file.**
91
+
92
+ Write `$SENTRY_DSN`-style placeholders and name where the real value lives. The sharp cases are `/roadmap`
93
+ capturing supplied material, `/feature-plan` carrying a draft's specifics forward, and `/onboard`, which
94
+ collects shell commands.
95
+
96
+ ### The ledger is read fresh, every time
97
+
98
+ Nothing is cached, parsed by a script, or generated. Hand-editing a ledger row changes the answer
99
+ immediately, with no regeneration step. `check` validates shape and answers no workflow question — delete
100
+ it and every answer here is unchanged.
101
+
102
+ ### Commands live in one file
103
+
104
+ `verify.md` is the only file in this project that names a verification command — not a skill, not an agent
105
+ prompt, not a role file. A hardcoded stack rots the moment the project changes shape, and a second copy
106
+ rots faster.
107
+
108
+ ## Phase status
109
+
110
+ Inside a plan, phase status lives in that document's status ledger **and nowhere else**. Not in a separate
111
+ file, not in a TODO list, not in a commit message.
112
+
113
+ To pick the next phase: take the **lowest-numbered phase that is not `done` and whose `Depends on` entries
114
+ are all `done`.** State which one you picked before starting. If it is already `in progress`, read its Note
115
+ and resume — do not restart it.
116
+
117
+ `done` means committed and verified, and whoever finishes a phase updates its row in the same commit.
118
+
119
+ If the ledger's claim disagrees with the repo — a phase marked `done` whose files do not exist, or the
120
+ reverse — **stop and say so.** Never silently re-do or skip a phase on a stale ledger.
121
+
122
+ ## The gates
123
+
124
+ Any command that lands code runs two gates, in order.
125
+
126
+ **Gate 1 — verification.** Read [`verify.md`](verify.md) and run its sections in order: Lint → Typecheck →
127
+ Build → Test. Never carry a copy of those commands and never invent one. A missing section is skipped, never
128
+ faked. Exit 0 is the verdict regardless of what any summary text claims. If `verify.md` does not exist, stop
129
+ and say so.
130
+
131
+ **Gate 2 — review.** Dispatch per [`executors.md`](executors.md). Every verdict needs concrete evidence —
132
+ file paths, command output — and every blocking finding needs a `P0`–`P3` severity. A `FAIL` is written to
133
+ [`findings.md`](findings.md) **first**, then looped back. Cap: two loops, then write a finding and escalate.
134
+ Escalating is not a substitute for recording: the conversation ends, the file does not.
135
+
136
+ ## Findings
137
+
138
+ [`findings.md`](findings.md) holds defects that outlive the session that found them. **An open `P0` or `P1`
139
+ tied to a phase blocks that phase from being marked `done`**, and blocks `/feature-close` on its feature.
140
+
141
+ A finding closes when the gate that raised it re-passes, citing that run. There is no "fixed but unverified"
142
+ state. Closed findings leave the file entirely — at `/feature-close` for a feature's findings, and at the
143
+ start of the next `/orchestrate` for ad-hoc ones. That file must not grow for the life of the project.
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: feature-close
3
+ description: "Retire a finished or abandoned feature — write its context/history.md row, git mv its document to context/archive/, and sweep every reference to its old path for review. Explicit invocation only — run this when the user types /feature-close. Do NOT match on 'we're done with X', 'close this out', or general wrap-up requests."
4
+ ---
5
+
6
+ # /feature-close
7
+
8
+ Owns the **Tier 2 → retired** transition. Nothing else in this workflow archives a plan —
9
+ `/feature-implement` detects that a feature is finished and *names* this command; it never does the work.
10
+
11
+ Read [`context/workflow.md`](../../../context/workflow.md) for the tier model.
12
+
13
+ ## Usage
14
+
15
+ ```
16
+ /feature-close # retire the active feature as shipped
17
+ /feature-close "<name>" # retire a named feature as shipped
18
+ /feature-close "<name>" --dropped "<why>" # retire one that will not be built
19
+ ```
20
+
21
+ **Resolving the target:** with no argument, the entry marked `active`. With a name, resolve it against
22
+ `context/roadmap.md` — **any entry holding a plan is a valid target**, not just an active one. An abandoned
23
+ plan is a droppable state.
24
+
25
+ ## Mode 1 — `shipped`
26
+
27
+ ### Refuse first
28
+
29
+ Check both before touching anything, and refuse if either fails:
30
+
31
+ 1. **Every phase in the ledger is `done`.** If not, list the ones that are not, and stop. Do not offer to
32
+ mark them.
33
+ 2. **No open `P0` or `P1` in `context/findings.md` is tied to this feature.** If there is, quote it and
34
+ stop.
35
+
36
+ A refusal here is the workflow working, not a problem to route around. If the user overrides after being
37
+ told, say plainly what is being overridden, then proceed.
38
+
39
+ ### Then, as one reviewed change
40
+
41
+ 1. **Move the entry into history.** Remove it from `context/roadmap.md` entirely, and append one row to
42
+ `context/history.md`: date, name, outcome `shipped`, a one-line why, and a link into `context/archive/`.
43
+ One line. That file **indexes** depth, it does not duplicate it — the reasoning stays in the archived
44
+ plan.
45
+ 2. **`git mv` the plan** from `context/plans/` to `context/archive/`. Use `git mv`, not `mv` — the file's
46
+ history is the record of how the feature was actually built.
47
+ 3. **Rewrite the document's header to point at the history row.** In the moved document, replace
48
+ whatever the header claimed before with:
49
+
50
+ ```markdown
51
+ Retired — its outcome and date are in [`../history.md`](../history.md).
52
+ ```
53
+
54
+ Add a note if its §-references are cited from source comments. **Do not stamp the outcome and date
55
+ into the document.** `history.md` owns them, and a copy in the header is a second place to maintain.
56
+ Replacing the old header is what stops a stale status surviving the move.
57
+ 4. **Sweep every reference to its old path**, and **show the sweep for review before committing.**
58
+
59
+ ### The sweep
60
+
61
+ Plan documents get cited by path from root-level entry points, from other `context/` files, from skills,
62
+ and from inside `context/standards/`. An unattended `git mv` breaks all of them silently.
63
+
64
+ ```bash
65
+ grep -rn "<old-path>\|<OLD-FILENAME>" --include='*.md' . | grep -v node_modules
66
+ ```
67
+
68
+ - **Rewrite links, minding depth.** `context/plans/` and `context/archive/` are the same distance from the
69
+ root, so a `../../` link *inside* the moved document still resolves — but a link *to* it from elsewhere
70
+ changes. Verify, don't assume.
71
+ - **Leave §-number citations alone.** Source comments cite plan sections without a path
72
+ (`// SMART-CROP-PLAN.md §7.3`). Those survive the move untouched and must not be "helpfully" rewritten
73
+ into paths that will rot.
74
+ - **Show the full list of edits before committing.** That review is why this is an explicit command rather
75
+ than a side-effect.
76
+
77
+ ### Finally
78
+
79
+ Move every **closed** finding tied to this feature out of `context/findings.md` and into the archived plan's
80
+ own log. `findings.md` must not grow for the life of the project.
81
+
82
+ ## Mode 2 — `--dropped`
83
+
84
+ For an entry that will not be built. **There is no ledger check in this mode** — unfinished phases are
85
+ expected.
86
+
87
+ 1. Append a `context/history.md` row with outcome `dropped` (or `superseded by <name>`) and **the reason
88
+ the user gave**, verbatim in substance, not softened. That row is what stops the idea being re-proposed,
89
+ so a vague reason makes it worthless.
90
+ 2. Remove the entry from `context/roadmap.md`.
91
+ 3. **If the entry never had a document, stop here.** If it had one — a draft in `context/drafts/` or a plan
92
+ in `context/plans/` — `git mv` it to `context/archive/`, repoint its header at the `history.md` row (no
93
+ stamped outcome, same rule as Mode 1), and sweep.
94
+
95
+ ## Rules
96
+
97
+ - **Never delete a plan document.** Archiving keeps the reasoning; deleting throws away the record of a
98
+ decision someone will otherwise re-litigate.
99
+ - **Never leave `roadmap.md` and `history.md` inconsistent.** An entry is in exactly one of them.
100
+ - **Never commit the sweep unreviewed.**
101
+ - **Never mark a phase `done` to get past the refusal.** If phases are unfinished, the feature is
102
+ unfinished.
@@ -0,0 +1,142 @@
1
+ ---
2
+ name: feature-implement
3
+ description: "Activate a planned feature in context/roadmap.md and run the next phase of its plan through implementation, verification and review, updating that plan's status ledger. Explicit invocation only — run this when the user types /feature-implement. Do NOT match on 'implement X', 'build this', 'let's code it', or any general request to write code."
4
+ ---
5
+
6
+ # /feature-implement
7
+
8
+ Owns the transition from *has a plan* to *being worked*, **and** the phases within it. One invocation runs
9
+ **one phase**: pick it, do it, gate it, close out its ledger row.
10
+
11
+ Read [`context/workflow.md`](../../../context/workflow.md) for the tier model, the one-active-feature rule
12
+ and the gate contract. This skill cites those rather than restating them.
13
+
14
+ ## Usage
15
+
16
+ ```
17
+ /feature-implement # resolve or choose a feature, then run the next phase
18
+ /feature-implement "<name>" # a named feature
19
+ ```
20
+
21
+ ## 1. Resolve the feature
22
+
23
+ Read `context/roadmap.md`.
24
+
25
+ - **One entry is `active`** → that is the feature. Skip to step 3.
26
+ - **None active** → rank the entries whose **Doc** points into `context/plans/` and **ask which to
27
+ activate**, using your runtime's question mechanism if it has one. Rank by: open questions resolved →
28
+ dependencies shipped (a `history.md` row under it) → smaller first.
29
+ - **No entry has a plan** → say so and name `/feature-plan`. Do not plan one here.
30
+ - **A name was given** → resolve it against `roadmap.md`. It must have a plan; if it does not, name
31
+ `/feature-plan`.
32
+
33
+ **Never execute anything out of `context/drafts/`.** A draft has no ledger and is not a plan, however
34
+ detailed it looks.
35
+
36
+ ## 2. The approval checkpoint — before setting the marker
37
+
38
+ This is the step that used to be structural: `/feature-plan` stopped and you typed a second command. It is
39
+ explicit here now, or it is lost.
40
+
41
+ 1. **Surface the plan's §8 Open questions and require an acknowledgement.** Do not proceed on silence.
42
+ 2. **Re-check that the files the plan cites still exist.** A plan drafted a month ago against a
43
+ since-changed tree is a state that can now exist and could not before. Name anything that has moved.
44
+ 3. **Check the one-active-feature rule** in [`context/workflow.md`](../../../context/workflow.md). If
45
+ another entry holds the slot, stop and name it.
46
+ 4. Set the marker to `active`. One token, one place — do not move the entry, add a section, or write a
47
+ summary line anywhere.
48
+
49
+ ## 3. Pick the phase
50
+
51
+ Read the plan's status ledger. Take the **lowest-numbered phase that is not `done` and whose `Depends on`
52
+ entries are all `done`.**
53
+
54
+ **State which phase you picked, and why, in one line, before doing anything else.**
55
+
56
+ If it is already `in progress`, **read its Note and resume from there — do not restart it.**
57
+
58
+ ## 4. Check `context/findings.md`
59
+
60
+ An open `P0` or `P1` tied to this phase **is** the work. Fix it before starting anything new.
61
+
62
+ ## 5. Stop on disagreement
63
+
64
+ If the ledger's claim contradicts the repo — a phase marked `done` whose **Files:** do not exist, or work
65
+ plainly in the tree under a phase marked `not started` — **say so and stop.** Never silently re-do or skip
66
+ a phase on a stale ledger.
67
+
68
+ ## 6. Do the work
69
+
70
+ Read the phase's §6.2 sub-section: its scope, its **Files:**, and what `done` means for it.
71
+
72
+ Delegate to a coder per [`context/executors.md`](../../../context/executors.md) if one is configured;
73
+ otherwise implement in-host. The coder's system prompt is
74
+ [`context/roles/coder.md`](../../../context/roles/coder.md).
75
+
76
+ The brief **cites paths, it does not paste files.** Point at `context/standards/README.md` and say to load
77
+ per its conditional table; point at `context/stack.md` and the phase's own section. Anything that can read
78
+ this repository can open them, and a brief that inlines them is a brief that goes stale.
79
+
80
+ Describe **what** needs to happen, never **how** to code it. Scope each delegated task to specific files.
81
+
82
+ ## 7. Gate 1 — verification
83
+
84
+ Per the gate contract in [`context/workflow.md`](../../../context/workflow.md): read
85
+ [`context/verify.md`](../../../context/verify.md) and run its sections in order — Lint → Typecheck → Build →
86
+ Test.
87
+
88
+ **Never carry a copy of these commands here and never invent one.** A missing section is skipped and said
89
+ so, never faked. Exit 0 is the verdict regardless of summary text. If `verify.md` does not exist or has no
90
+ filled-in section, stop and say so. Docs-only changes run Lint plus a read of the diff.
91
+
92
+ A failure is the verdict — go to step 9 with the failing output verbatim as the feedback.
93
+
94
+ ## 8. Gate 2 — review
95
+
96
+ Dispatch per [`context/executors.md`](../../../context/executors.md). With no independent reviewer
97
+ configured, review the diff yourself against the plan's review expectations and the standards — weaker, and
98
+ **say which one you ran.**
99
+
100
+ Require concrete evidence — file paths, command output — for every verdict, and a `P0`–`P3` severity on
101
+ every blocking finding.
102
+
103
+ - `PASS` or `PASS WITH NOTES` → the phase's work is done; go to step 10.
104
+ - `FAIL` → **write it to [`context/findings.md`](../../../context/findings.md) first, then** go to step 9.
105
+
106
+ **Write the finding before the loopback, not after it.** A verdict that lives only in this session's
107
+ transcript evaporates when the conversation ends — including a `P0` the cap never got to.
108
+
109
+ ## 9. Loopback
110
+
111
+ Cap: **two loops per gate, per phase.**
112
+
113
+ Under the cap: re-brief with the prior implementation and the validator's feedback **verbatim — do not
114
+ summarise or paraphrase it** — plus the instruction to address only the failing items, refactor nothing
115
+ that passes, and expand no scope. Then re-run the same gate.
116
+
117
+ At the cap: **write a finding** (`P1` for a Gate 1 cap-out — a phase whose verification cannot pass is
118
+ blocked by definition), then escalate to the user with the current state and the last feedback.
119
+ **Escalating is not a substitute for recording.**
120
+
121
+ ## 10. Close out the ledger row
122
+
123
+ In the same commit as the work:
124
+
125
+ - **All of the phase's scope landed and both gates passed** → `done`.
126
+ - **Some landed** → stays `in progress`, Note rewritten to name exactly what remains.
127
+ - **A gate hit its cap, or something external blocks it** → `blocked`, with the blocker in the Note.
128
+
129
+ **Never mark `done` on a coder's self-report** — the gate output is the evidence. **Refuse `done` while an
130
+ open `P0` or `P1` is tied to this phase**; leave it `in progress` and name the finding.
131
+
132
+ ## 11. Report
133
+
134
+ - What changed, and which files.
135
+ - Gate 1 output, and Gate 2's verdict.
136
+ - Loopback counts, if any.
137
+ - Findings written or closed, by id.
138
+ - The phase's new ledger status, and which phase is next.
139
+
140
+ **When every phase is `done`, say so and name `/feature-close`.** Do not move files, stamp headers or sweep
141
+ references — that is a tier boundary, and crossing it is an explicit command the user runs, not a
142
+ side-effect of the last phase finishing.
@@ -0,0 +1,138 @@
1
+ ---
2
+ name: feature-plan
3
+ description: "Promote one item from the Tier-1 backlog in context/roadmap.md into a Tier-2 plan document under context/plans/, then stop without implementing. Explicit invocation only — run this when the user types /feature-plan. Do NOT match on 'plan out X', 'how should we build X', or any general planning or design request."
4
+ ---
5
+
6
+ # /feature-plan
7
+
8
+ Turns one roadmap entry into a plan document, then **stops**. It never implements anything and never marks
9
+ a phase `done` — every phase in a new plan is `not started`.
10
+
11
+ **Planning is not activation.** Several features may hold plans at once; there is no "a feature is already
12
+ active" refusal here. That is what makes planning ahead possible. Activation is `--activate` or
13
+ `/feature-implement`, and both are subject to the one-active-feature rule in
14
+ [`context/workflow.md`](../../../context/workflow.md).
15
+
16
+ ## Usage
17
+
18
+ ```
19
+ /feature-plan # rank the pending entries and ask which to plan
20
+ /feature-plan "<name>" # plan a named entry
21
+ /feature-plan "<name>" --activate # plan it, and mark it active
22
+ ```
23
+
24
+ **Nothing needs to be looked up first.** This command resolves its own starting point.
25
+
26
+ ## Steps
27
+
28
+ ### 1. Pick the entry
29
+
30
+ Read `context/roadmap.md`.
31
+
32
+ **With a name:** take that entry. If none matches, say which names exist and stop.
33
+
34
+ **With no argument:** rank the `pending` entries and **ask which to plan**, using your runtime's question
35
+ mechanism if it has one, or a plain numbered question if it does not. Writing a plan is a commitment and
36
+ takes real work to produce; silently taking the top entry makes that decision on the user's behalf, badly,
37
+ whenever the backlog order is stale.
38
+
39
+ **Ranking**, in priority order:
40
+
41
+ 1. **Has a draft** — the entry's **Doc** names a document in `context/drafts/`. Half-researched is better
42
+ and cheaper. This dominates: an entry with real notes beats a one-line entry almost regardless.
43
+ 2. **Unblocked by what just shipped** — it builds on something with a `context/history.md` row, so the
44
+ ground under it is settled rather than hypothetical.
45
+ 3. **Smaller first** — `small`, then `medium`, then `large`. A plan that can be executed beats one that
46
+ gets admired.
47
+ 4. **Backlog order** — ties break by position in the file.
48
+
49
+ Offer the top four, **best first**, each with a one-line reason drawn from the ranking — say *why* it is
50
+ ranked there, not just what it is. Leave room for the user to name something else.
51
+
52
+ Special cases, where asking is noise rather than help:
53
+
54
+ - **Exactly one `pending` entry** — state it and proceed. A one-option question is not a choice.
55
+ - **No `pending` entries** — say the backlog is empty and name `/roadmap "some idea"`. Do not invent one.
56
+
57
+ **State which entry you picked and why, in one line, before doing anything else.**
58
+
59
+ ### 2. Already planned? Start a conversation, not a refusal
60
+
61
+ If the entry's **Doc** already points into `context/plans/`, say so, show the plan, and ask whether to
62
+ iterate on it.
63
+
64
+ - **Every phase `not started`** → iterate freely.
65
+ - **Any phase `in progress`, `blocked` or `done`** → **warn first, and get an answer before writing.**
66
+ Rewriting a plan under work that already happened is the "ledger disagrees with the repo" hazard arriving
67
+ by a new route. Name which phases have moved.
68
+
69
+ ### 3. Decide the document
70
+
71
+ The plan ends up at `context/plans/<NAME>-PLAN.md`, where `<NAME>` is the entry's kebab-case name
72
+ upper-cased.
73
+
74
+ - **If the entry's **Doc** names a draft in `context/drafts/`**, `git mv` it to that path and build the
75
+ plan on top of its content. Use `git mv`, not `mv`. Do not create a second file and do not leave the
76
+ draft behind — a draft and a plan for the same feature is two documents disagreeing about one thing.
77
+ - **Otherwise** copy `context/plan-template.md` to that path. Copy it verbatim; it is a bare skeleton with
78
+ nothing to strip. [`context/plan-template.notes.md`](../../../context/plan-template.notes.md) says what
79
+ goes in each section.
80
+
81
+ **The draft is the most valuable input you have** — material the user gathered deliberately, often from
82
+ somewhere you cannot reach. Carry its specifics forward; do not summarise them away, and do not silently
83
+ drop a fact because you could not verify it. Mark it as an open question instead.
84
+
85
+ ### 4. Research and draft
86
+
87
+ Delegate the research and the draft to a planner subagent **if your runtime provides one**; otherwise do it
88
+ inline. Either way the brief is the same, and the output contract is the template's section list, not a
89
+ planner's own default shape:
90
+
91
+ - The roadmap entry verbatim, and the full content of its draft if there was one.
92
+ - **The full section list from `context/plan-template.md`, stated as required output**, in order, with the
93
+ ledger's exact column set. A general-purpose planner will otherwise emit implementation-steps-and-
94
+ acceptance-criteria — a per-phase artifact, not a plan — and you will throw it away.
95
+ - Pointers to `context/stack.md`, `context/standards/README.md` (load per its conditional table) and
96
+ `context/verify.md`. Cite the paths; do not paste the files in. Anything reading this repo can open them.
97
+ - **Cite file paths and command output for every claim about the current codebase.** Anything unverified is
98
+ an open question, not an assertion.
99
+ - Phases are **commit-sized units with checkable outcomes**, each with a real `Depends on` value and a
100
+ **Files:** line naming every path it touches. That line is what makes reconciliation a check rather than
101
+ a judgement call.
102
+
103
+ ### 5. Write the document
104
+
105
+ Fill in the template's shape. Then:
106
+
107
+ - Date it and point its header at the roadmap entry.
108
+ - **No `**Status:**` header.** Feature status lives in `roadmap.md`, phase status in the ledger. A document
109
+ that claims its own status is a copy that goes stale.
110
+ - Fill in **§8 Open questions** honestly. An honest gap is worth more than an invented decision.
111
+ - Every phase is `not started`.
112
+
113
+ ### 6. Update the roadmap entry
114
+
115
+ Repoint the entry's **Doc** field at the new `plans/` path. If you `git mv`d a draft, that same edit is
116
+ what fixes the now-dead `drafts/` link, so do it together.
117
+
118
+ **Leave the marker alone unless `--activate` was given.** `pending` with a `plans/` document is the correct
119
+ state for a planned-but-not-started feature.
120
+
121
+ **With `--activate`:** check the one-active-feature rule in
122
+ [`context/workflow.md`](../../../context/workflow.md) first. If another entry holds the slot, **write the
123
+ plan, skip the activation, and name the feature that holds it.** The plan is valuable and harmless on its
124
+ own; discarding it over a marker would undo the point of the split.
125
+
126
+ ### 7. Report and stop
127
+
128
+ State the document path, the phase count, and the open questions. Then say plainly that **what you produced
129
+ is a reviewable skeleton plus open questions, not a finished plan of record** — the value is the structure
130
+ and the research. Name the next step: the user reviews and edits the plan, and `/feature-implement` runs it
131
+ once they are satisfied.
132
+
133
+ ## Rules
134
+
135
+ - **Never implement anything.** Not "just the first phase", not "a quick scaffold".
136
+ - **Never mark a phase `done`**, and never mark a phase anything other than `not started`.
137
+ - **Never write outside `context/`.** No source files, no config.
138
+ - Do not fold the draft's content into `context/roadmap.md`. Tier 1 stays high-level.