@kiwidata/grimoire 0.1.5 → 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.
- package/.claude-plugin/plugin.json +2 -2
- package/AGENTS.md +21 -25
- package/LICENSE +36 -0
- package/README.md +12 -4
- package/dist/cli/index.js +2 -41
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/program.d.ts +4 -0
- package/dist/cli/program.d.ts.map +1 -0
- package/dist/cli/program.js +47 -0
- package/dist/cli/program.js.map +1 -0
- package/dist/commands/comment-lint.d.ts +3 -0
- package/dist/commands/comment-lint.d.ts.map +1 -0
- package/dist/commands/comment-lint.js +14 -0
- package/dist/commands/comment-lint.js.map +1 -0
- package/dist/commands/configure.d.ts.map +1 -1
- package/dist/commands/configure.js +2 -1
- package/dist/commands/configure.js.map +1 -1
- package/dist/core/branch-check.d.ts.map +1 -1
- package/dist/core/branch-check.js +2 -16
- package/dist/core/branch-check.js.map +1 -1
- package/dist/core/check.d.ts.map +1 -1
- package/dist/core/check.js +4 -11
- package/dist/core/check.js.map +1 -1
- package/dist/core/ci.d.ts.map +1 -1
- package/dist/core/ci.js +2 -2
- package/dist/core/ci.js.map +1 -1
- package/dist/core/comment-lint.d.ts +18 -0
- package/dist/core/comment-lint.d.ts.map +1 -0
- package/dist/core/comment-lint.js +215 -0
- package/dist/core/comment-lint.js.map +1 -0
- package/dist/core/doc-style.d.ts +1 -0
- package/dist/core/doc-style.d.ts.map +1 -1
- package/dist/core/doc-style.js +1 -1
- package/dist/core/doc-style.js.map +1 -1
- package/dist/core/docs.d.ts.map +1 -1
- package/dist/core/docs.js +4 -11
- package/dist/core/docs.js.map +1 -1
- package/dist/core/health.d.ts.map +1 -1
- package/dist/core/health.js +4 -6
- package/dist/core/health.js.map +1 -1
- package/dist/core/hooks.d.ts.map +1 -1
- package/dist/core/hooks.js +44 -41
- package/dist/core/hooks.js.map +1 -1
- package/dist/core/init.js +1 -0
- package/dist/core/init.js.map +1 -1
- package/dist/core/list.d.ts.map +1 -1
- package/dist/core/list.js +6 -9
- package/dist/core/list.js.map +1 -1
- package/dist/core/pr.d.ts.map +1 -1
- package/dist/core/pr.js +0 -8
- package/dist/core/pr.js.map +1 -1
- package/dist/core/status.d.ts.map +1 -1
- package/dist/core/status.js +5 -5
- package/dist/core/status.js.map +1 -1
- package/dist/core/update.d.ts.map +1 -1
- package/dist/core/update.js +23 -10
- package/dist/core/update.js.map +1 -1
- package/dist/core/validate.js +1 -1
- package/dist/core/validate.js.map +1 -1
- package/dist/utils/config.d.ts +2 -0
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +4 -0
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/frontmatter.d.ts +6 -0
- package/dist/utils/frontmatter.d.ts.map +1 -0
- package/dist/utils/frontmatter.js +13 -0
- package/dist/utils/frontmatter.js.map +1 -0
- package/dist/utils/paths.d.ts +1 -1
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +5 -4
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/stdin.d.ts +3 -0
- package/dist/utils/stdin.d.ts.map +1 -0
- package/dist/utils/stdin.js +13 -0
- package/dist/utils/stdin.js.map +1 -0
- package/package.json +24 -3
- package/skills/grimoire-apply/SKILL.md +8 -1
- package/skills/grimoire-audit/SKILL.md +4 -1
- package/skills/grimoire-bug/SKILL.md +7 -3
- package/skills/grimoire-draft/SKILL.md +145 -211
- package/skills/grimoire-plan/SKILL.md +4 -28
- package/skills/grimoire-pr-review/SKILL.md +1 -0
- package/skills/grimoire-refactor/SKILL.md +1 -1
- package/skills/grimoire-review/SKILL.md +1 -1
- package/skills/grimoire-verify/SKILL.md +12 -0
- package/skills/references/artifact-map.md +45 -0
- package/skills/references/review-personas.md +9 -3
- package/skills/references/test-baseline.md +55 -0
- package/templates/draft.md +108 -0
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: grimoire-draft
|
|
3
|
-
description:
|
|
3
|
+
description: Design a change collaboratively on one living draft.md, then project it into Gherkin features, constraints, and MADR decisions. Use when the user describes new functionality, requirements, or architecture choices.
|
|
4
4
|
compatibility: Designed for Claude Code (or similar products)
|
|
5
5
|
metadata:
|
|
6
6
|
author: kiwi-data
|
|
7
|
-
version: "0.
|
|
7
|
+
version: "0.2"
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# grimoire-draft
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Design a change on **one living document** (`draft.md`), iterating with the user, then
|
|
13
|
+
**project** the agreed design into its durable homes (features, constraints, decisions).
|
|
14
|
+
|
|
15
|
+
The core idea: spread-out artifacts hinder the thinking. So you do all the designing in a
|
|
16
|
+
single coherent doc — diagram/sketch, a decision ledger, pseudo-code, an open-question
|
|
17
|
+
ledger — and only fragment it into separate homes **after agreement**. `draft.md` is
|
|
18
|
+
ephemeral: retained as reference through the pipeline, deleted when `grimoire-apply` clears
|
|
19
|
+
the change folder. Git history preserves it.
|
|
13
20
|
|
|
14
21
|
## Triggers
|
|
15
22
|
- User describes new functionality, behavior changes, or feature requests
|
|
@@ -17,240 +24,184 @@ Draft or update Gherkin features and MADR architecture decisions collaboratively
|
|
|
17
24
|
- User describes a technology choice, architecture decision, or trade-off
|
|
18
25
|
- Loose match: contains "feature", "requirement", "spec", "decision", "grimoire" with "create", "draft", "plan", "start", "new"
|
|
19
26
|
|
|
20
|
-
## Routing
|
|
27
|
+
## Routing (coarse — up front)
|
|
28
|
+
|
|
29
|
+
Decide only whether to design at all, and in which skill. The **fine** routing (which fact
|
|
30
|
+
becomes a feature vs. a constraint vs. a decision) happens later, at projection (step 7).
|
|
31
|
+
|
|
21
32
|
- Bug report ("something is broken") → `grimoire-bug` or `grimoire-bug-report`
|
|
22
33
|
- Pure refactoring (no behavior change) → no grimoire artifact needed. Suggest an ADR only if architecturally significant.
|
|
23
34
|
- Config, deps, formatting → not grimoire territory. Just do it.
|
|
24
|
-
-
|
|
35
|
+
- Otherwise → design it here. If genuinely unclear whether this is a grimoire change, ask one clarifying question rather than guessing.
|
|
25
36
|
|
|
26
37
|
## Workflow
|
|
27
38
|
|
|
28
|
-
### 1. Qualify the Request — Jurisdiction
|
|
39
|
+
### 1. Qualify the Request — Jurisdiction (coarse)
|
|
29
40
|
|
|
30
|
-
|
|
41
|
+
Confirm this is a change worth designing, and which skill owns it (table above). You do
|
|
42
|
+
**not** need to assign each fact to a home yet — during design everything lives in one
|
|
43
|
+
`draft.md`; per-fact routing is a projection concern (step 7, D13).
|
|
31
44
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
| **Constraint** — security control, NFR, performance budget, observability/logging guarantee, compliance rule | `.grimoire/docs/constraints.md` (assertion + rationale + how-verified) | NOT a `.feature` |
|
|
36
|
-
| **Architecture decision** — a trade-off or structural choice | MADR in `.grimoire/decisions/` | NOT a `.feature` |
|
|
37
|
-
| **Data model / external API contract** | data schema | NOT a `.feature` |
|
|
38
|
-
| **Both behavior + decision** | features AND a MADR | — |
|
|
39
|
-
| **Bug fix** | STOP → `grimoire-bug`. "The spec already describes correct behavior; just fix the code." | — |
|
|
40
|
-
| **Refactoring** (no behavior change) | STOP. No artifact. Suggest an ADR only if architecturally significant. | — |
|
|
41
|
-
| **Config / deps / formatting** | STOP. Not grimoire territory. | — |
|
|
45
|
+
The one up-front question that matters: **is this a behavior/feature/architecture change**
|
|
46
|
+
(→ design it here), or a bug / pure refactor / config tweak (→ route away, per the table)?
|
|
47
|
+
If unclear, ask one question. Do not default to "draft a feature".
|
|
42
48
|
|
|
43
|
-
|
|
49
|
+
### 2. Triviality Gate
|
|
44
50
|
|
|
45
|
-
|
|
51
|
+
Complexity is an **output** of design, not an input — you cannot score it honestly before
|
|
52
|
+
the design exists. Up front, make only one binary call:
|
|
46
53
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
- **Trivial** — config, typo, copy change, single-file fix, dependency bump. Skip the
|
|
55
|
+
`draft.md` loop: make the change directly, record a minimal `manifest.md` (Why + file
|
|
56
|
+
list), done.
|
|
57
|
+
- **Non-trivial** — anything else. Build a `draft.md` and design the change (steps 3–8).
|
|
51
58
|
|
|
52
|
-
|
|
59
|
+
The full **complexity level (1–4)** is scored at **projection** (step 7), once the design
|
|
60
|
+
is settled, and written to `manifest.md` — not before (a premature number biases the design
|
|
61
|
+
to fit it). During design, use the table below only as a rough guide for how deep to
|
|
62
|
+
research and elicit; depth grows with the change, it is not pre-allocated.
|
|
53
63
|
|
|
54
|
-
|
|
64
|
+
| Level | Label | Signals | Drives (recorded at projection) |
|
|
65
|
+
|-------|-------|---------|---------------------------------|
|
|
66
|
+
| 1 | Trivial | Config, typo, copy, single-file fix | handled by the gate above — no `draft.md` |
|
|
67
|
+
| 2 | Simple | Single capability, ≤3 files, no architecture/data changes | Plan: coarser tasks · Review: Senior Engineer only |
|
|
68
|
+
| 3 | Moderate | Multiple capabilities, architecture decisions, data/dep changes | Plan: fine-grained · Review: all relevant personas · manifest carries Assumptions + Pre-Mortem |
|
|
69
|
+
| 4 | Complex | Cross-cutting, multiple services, security-sensitive, new infra | Plan: fine-grained · Review: all personas mandatory (`grimoire-review` not optional) · Assumptions + Pre-Mortem |
|
|
55
70
|
|
|
56
|
-
|
|
71
|
+
If unsure between two levels at projection, pick the higher. The user can override ("treat this as complex").
|
|
57
72
|
|
|
58
|
-
|
|
73
|
+
### 3. Research Existing Solutions
|
|
59
74
|
|
|
60
|
-
|
|
61
|
-
|-------|-------|---------|----------|
|
|
62
|
-
| 1 | **Trivial** | Config, typo, copy change, single-file fix | Skip research (step 3). Minimal manifest (Why + Feature/Decision list only). No Pre-Mortem. |
|
|
63
|
-
| 2 | **Simple** | Single capability, ≤3 files, no architecture decisions, no data changes | Light research (step 3 — check built-ins and first-party only). Standard manifest. |
|
|
64
|
-
| 3 | **Moderate** | Multiple capabilities, architecture decisions, data model changes, new dependencies | Full research (step 3). Full manifest with Assumptions and Pre-Mortem. |
|
|
65
|
-
| 4 | **Complex** | Cross-cutting concerns, multiple services/systems, security-sensitive, new infrastructure | Full research (step 3). Full manifest. Mandatory `grimoire-review` after plan (not optional). |
|
|
75
|
+
Before designing, research what already exists. Do not ask the user to research — do it yourself.
|
|
66
76
|
|
|
67
|
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
77
|
+
- Trivial changes never reach this step (handled by the gate).
|
|
78
|
+
- Otherwise research **proportional to scope**: a single first-party capability needs only a
|
|
79
|
+
built-ins / first-party check; architecture decisions, new dependencies, or cross-cutting
|
|
80
|
+
concerns need full research across all categories.
|
|
70
81
|
|
|
71
|
-
|
|
82
|
+
Follow the methodology in `../references/build-vs-buy.md`. The findings feed the `draft.md`
|
|
83
|
+
**Why** (and, for an adopt/build/hybrid call, the manifest **Prior Art** at projection).
|
|
84
|
+
Present findings to the user and get agreement on direction before designing deeply.
|
|
72
85
|
|
|
73
|
-
###
|
|
74
|
-
Before designing, research what already exists. Do not ask the user to research — do it yourself.
|
|
86
|
+
### 4. Design Input Check
|
|
75
87
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
88
|
+
Check whether design artifacts already exist for this change, so the design is grounded in
|
|
89
|
+
real components and states rather than imagined ones. Consumed output anchors the `draft.md`
|
|
90
|
+
**At a glance** section.
|
|
79
91
|
|
|
80
|
-
|
|
92
|
+
- **Existing design output**: If `.grimoire/changes/<change-id>/designs/` is already populated (a prior `grimoire-design` run produced `problem.md`, `variants.md`, `variant-{n}.html`, or `figma-snapshot.json`), read those now. Treat them as authoritative for component shape, states, and visual tokens — do not re-query Figma. The visual + component/state material becomes the **At a glance** anchor and seeds the behavioral **Sketches**.
|
|
93
|
+
- **Figma MCP available, no design folder**: If `project.design_tool.mcp` is configured and `designs/` is absent, ask: "Figma file URL or node ID? (or skip)". On a URL or node reference, query the Figma MCP for frame data and cache the response at `.grimoire/changes/<change-id>/designs/figma-snapshot.json` per `../references/design-input-formats.md` §1 Cache. On "skip" or empty input, continue.
|
|
94
|
+
- **No MCP and no design folder**: skip this step silently.
|
|
81
95
|
|
|
82
|
-
###
|
|
96
|
+
### 5. Scaffold & Map Existing State
|
|
83
97
|
|
|
84
|
-
|
|
98
|
+
- Choose a `change-id`: kebab-case, verb-led (`add-`, `update-`, `remove-`).
|
|
99
|
+
- Ensure you're on a feature branch for this change (`grimoire-branch-guard` usually created it). The branch is where `draft.md` and, later, the projected artifacts are edited live.
|
|
100
|
+
- Create `.grimoire/changes/<change-id>/draft.md` from `templates/draft.md`, setting `kind: greenfield | refactor`.
|
|
85
101
|
|
|
86
|
-
|
|
87
|
-
- **Figma MCP available, no design folder**: If `project.design_tool.mcp` is configured and `designs/` is absent, ask: "Figma file URL or node ID? (or skip)". On a URL or node reference, query the Figma MCP for frame data and cache the response at `.grimoire/changes/<change-id>/designs/figma-snapshot.json` per `../references/design-input-formats.md` §1 Cache. On "skip" or empty input, continue to standard elicitation.
|
|
88
|
-
- **No MCP and no design folder**: skip this step silently. Fall back to the standard interview elicitation in step 4 below.
|
|
102
|
+
Then map what already exists so the design isn't blind:
|
|
89
103
|
|
|
90
|
-
|
|
104
|
+
- Read `features/` for the current behavioral baseline, `.grimoire/decisions/` for existing decisions, `.grimoire/docs/context.yml` for the deployment environment and sibling services. Check `.grimoire/changes/` for in-progress changes that overlap — flag conflicts. See `../references/artifact-map.md` for reading discipline.
|
|
105
|
+
- **For `kind: refactor` — build the Current state section (required).** Map how the touched system works **today**, with `file:line` breadcrumbs, into `draft.md` → *Current state*, followed by a severity-ranked Gaps/drift list. **Mandate the codebase graph**: if the repo isn't indexed, run `index_repository` first, then use `search_graph` / `trace_path` / `get_code_snippet` for qualified names, callers, and call chains. This map is the load-bearing grounding for a refactor — you cannot redesign what you haven't located.
|
|
106
|
+
- If `.grimoire/changes/<change-id>/consult.md` exists (from `grimoire-design-consult`), parse `## Inferred assumptions` and `## Inferred givens` and carry them into the `draft.md` design: assumptions → *Decided/Open* (each becomes an Open row, or a Decided row if the consult resolved it); givens → context for the *Decisions* ledger. The H2 headers `## Inferred assumptions` and `## Inferred givens` are load-bearing — they are the exact section names `grimoire-design-consult` writes; do not paraphrase, retitle, or fuzzy-match. **Open questions from `consult.md` are NOT copied** — they remain in `consult.md` as designer follow-up items.
|
|
91
107
|
|
|
92
|
-
###
|
|
108
|
+
### 6. Design the Change — the loop (the interview happens HERE)
|
|
93
109
|
|
|
94
|
-
|
|
110
|
+
This single loop replaces what used to be separate "elicit requirements", "draft", and
|
|
111
|
+
"collaborate" steps. **Interviewing IS iterating on `draft.md`.** There is no gather-then-
|
|
112
|
+
transcribe split — requirements surface, get questioned, and resolve inside the doc.
|
|
95
113
|
|
|
96
|
-
|
|
114
|
+
Iterate with the user, directly on `draft.md`:
|
|
97
115
|
|
|
98
|
-
|
|
99
|
-
|
|
116
|
+
```
|
|
117
|
+
loop:
|
|
118
|
+
propose → decisions into the Decisions ledger; shapes into Sketches; a diagram/sketch into At a glance
|
|
119
|
+
question → unknowns become rows under Open (use ../references/elicitation-personas.md as lenses)
|
|
120
|
+
user reacts → answers / edits the doc
|
|
121
|
+
resolve → strike the Open row IN PLACE: `RESOLVED: <answer> (Dn)` — never delete it
|
|
122
|
+
until Decided is stable AND Open is empty-or-deferred.
|
|
123
|
+
```
|
|
100
124
|
|
|
101
|
-
|
|
102
|
-
- **Adopting**: Focus on integration — how it fits, what config is needed. Skip deep business-rule elicitation.
|
|
103
|
-
- **Building custom**: Full elicitation — business rules, edge cases, data contracts, security, NFRs.
|
|
104
|
-
- **Hybrid**: Elicit deeply for custom parts. For adopted parts, focus on integration boundaries.
|
|
125
|
+
Discipline for the loop:
|
|
105
126
|
|
|
106
|
-
|
|
127
|
+
1. **Outcome & Non-goals first.** Pin these (into *Why*) before anything else — they set scope. Restate them back to the user.
|
|
128
|
+
2. **Batch questions, then wait.** Ask 3–5 at a time, grouped by concern, as Open rows. Stop. Wait. Do not propose decisions past an unanswered batch.
|
|
129
|
+
3. **Ask the question; don't pre-answer it.** "Should locked accounts get an email?" — not "I'll assume locked accounts get an email." The pre-answered form lets the user nod through assumptions they'd otherwise correct.
|
|
130
|
+
4. **One question per real ambiguity, not a checklist dump.** Ask the few that matter for *this* change.
|
|
131
|
+
5. **Disambiguate immediately.** If an answer is vague ("handle errors gracefully"), ask the specific follow-up and record the concrete answer. Never leave a vague answer in the ledger.
|
|
132
|
+
6. **Capture, don't extrapolate.** "Out of scope for now" → record as a non-goal and stop. Don't design a scenario "just in case".
|
|
133
|
+
7. **When the user delegates** ("just write something reasonable"), record it explicitly as an Open→RESOLVED row: "Defaulting to <choice> per user delegation — flag in review if wrong." The assumption stays visible.
|
|
134
|
+
8. **Sort facts by kind as they emerge.** An invariant (security control, NFR, performance budget, observability guarantee) is not a behavior — capture it in the *Constraints* section, not as a behavioral sketch. Apply the rough behaviour-vs-invariant test as you design (does an external actor observe it without reading code/logs?) so projection's admission test (step 7) gets clean input instead of slop to reroute. The fine fact-to-home routing still happens at projection; this just keeps the design honest while you think.
|
|
107
135
|
|
|
108
|
-
|
|
109
|
-
2. **Batch questions, then wait.** Ask 3-5 questions at a time, grouped by persona. Stop. Wait for the user's reply. Do not draft scenarios until the batch is answered.
|
|
110
|
-
3. **Ask the question; don't pre-answer it.** "Should locked accounts get an email?" — not "I'll assume locked accounts get an email, let me know if not." The pre-answered form lets the user nod through assumptions they'd otherwise correct.
|
|
111
|
-
4. **One question per ambiguity, not a checklist dump.** If the user said "users can reset password", do not ask 12 generic questions. Ask the 3 that matter for *this* feature.
|
|
112
|
-
5. **Disambiguate immediately.** If the user's answer is vague ("yeah, handle errors gracefully"), ask the specific follow-up ("for invalid tokens, do we redirect to login with a flash message, return a 400, or something else?"). Never leave a vague answer in the spec.
|
|
113
|
-
6. **Capture, don't extrapolate.** If the user explicitly says "out of scope for now", note it as a non-goal and stop. Don't draft a scenario "just in case".
|
|
114
|
-
7. **When the user pushes back on a question** ("just write something reasonable"), record their delegation explicitly: "Defaulting to <choice> per user delegation — flag in review if wrong." This makes the assumption visible later.
|
|
136
|
+
**Never silently fill an open question.** Either ask it (as an *Open* row), defer it to a non-goal, or record the inference explicitly in *Decided*. The *Decided/Open* ledger IS the requirements summary — before declaring the design done, walk it back to the user so they see every call and every guess.
|
|
115
137
|
|
|
116
|
-
|
|
138
|
+
**Nothing is written to `features/`, `.grimoire/docs/constraints.md`, or `.grimoire/decisions/` during this loop.** Everything lives in `draft.md`. The design is "done" when *Decided* is stable and *Open* is empty-or-deferred — and the user agrees.
|
|
117
139
|
|
|
118
|
-
|
|
119
|
-
- **Manifest Assumptions** (level 3-4) — each open question becomes an unvalidated assumption with the reading you chose.
|
|
120
|
-
- **Open questions in the Requirements Summary** — explicitly listed so the user sees what you guessed.
|
|
140
|
+
Do NOT proceed to projection without explicit user approval of the design.
|
|
121
141
|
|
|
122
|
-
|
|
142
|
+
### 7. Projection — generate the homes from draft.md
|
|
123
143
|
|
|
124
|
-
|
|
144
|
+
Once the user agrees the design is settled, project `draft.md` into its durable homes. This
|
|
145
|
+
is where the **fine routing** happens (each fact → its one home) and where the admission
|
|
146
|
+
test + principles gate run. Artifacts are written **live in their real locations** on the
|
|
147
|
+
branch — `git diff` is the staging area; there is no copy-into-the-change-folder.
|
|
125
148
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
- Read `.grimoire/decisions/` to understand existing architecture decisions
|
|
129
|
-
- Read `.grimoire/docs/context.yml` (if it exists) to understand the deployment environment, related services, and infrastructure — this tells you what's available (caches, queues, sibling services) and what constraints apply (deployment target, environments)
|
|
130
|
-
- Check `.grimoire/changes/` for any in-progress changes that might overlap
|
|
131
|
-
- If there's a conflict with an active change, flag it
|
|
132
|
-
- If `.grimoire/changes/<change-id>/consult.md` exists (from a prior `grimoire-design-consult` run), parse the `## Inferred assumptions` and `## Inferred givens` sections verbatim. Copy the contents of `## Inferred assumptions` into the manifest's Assumptions section, and copy `## Inferred givens` into a new Givens section at the same heading level (Givens applies to level 3-4 only — skip for level 1-2). The H2 headers `## Inferred assumptions` and `## Inferred givens` are load-bearing — they are the exact section names `grimoire-design-consult` writes; do not paraphrase, retitle, or fuzzy-match. Open questions from `consult.md` are NOT copied — they remain in `consult.md` as designer follow-up items.
|
|
149
|
+
First, **score the complexity level (1–4)** now that the design is settled, and write it to
|
|
150
|
+
`manifest.md` frontmatter as `complexity: <1-4>`.
|
|
133
151
|
|
|
134
|
-
|
|
135
|
-
- Choose a `change-id`: kebab-case, verb-led (`add-`, `update-`, `remove-`)
|
|
136
|
-
- Ensure you're on a feature branch for this change (`grimoire-branch-guard` usually created it). The branch is where all artifacts are edited live.
|
|
137
|
-
- Create `.grimoire/changes/<change-id>/` — this folder holds **only ephemeral process scaffolding**: `manifest.md` (and later `tasks.md`). It does NOT hold copies of features, decisions, or constraints — those are edited live in their real locations and tracked by `git diff`. The folder is deleted at finalize; the branch + PR + git log are the durable record.
|
|
152
|
+
Then project each kind of fact:
|
|
138
153
|
|
|
139
|
-
|
|
140
|
-
**For behavioral changes:**
|
|
154
|
+
**Behaviors → `features/*.feature`.** For each behavioral fact in the design:
|
|
141
155
|
|
|
142
|
-
|
|
156
|
+
*The feature-file admission test* — a scenario may be written **only if it passes all four gates**; if it fails any, it is a constraint or a decision, not a feature:
|
|
157
|
+
1. **External actor** — a user, operator, or external system does the thing. Internal actor → constraint/decision.
|
|
158
|
+
2. **Observable** — the actor sees the outcome without reading code or logs. "<200ms", "logs scrubbed of PII" → fails → constraint.
|
|
159
|
+
3. **Domain language** — domain nouns, zero implementation detail. Names a library/log-level/table (`loguru`, `INFO`, `bcrypt`, `users` table) → fails → leaking implementation.
|
|
160
|
+
4. **Survives reimplementation** — rewrite the internals from scratch; would the scenario still read the same? If it would change, it's pinned to implementation → not a feature.
|
|
143
161
|
|
|
144
|
-
|
|
162
|
+
Common slop this catches (all → `constraints.md`): "PII is scrubbed from logs", "all endpoints require auth", "responses are gzipped", "errors logged with a trace id".
|
|
145
163
|
|
|
146
|
-
|
|
164
|
+
*Extend vs. new — default is always extend; new files are the exception and require justification.* List existing feature files first (**required, not skippable** — do not write any scenario until this triage table is complete):
|
|
147
165
|
|
|
148
166
|
```
|
|
149
167
|
Existing feature files:
|
|
150
168
|
features/auth/login.feature — "User Login"
|
|
151
|
-
features/auth/registration.feature — "User Registration"
|
|
152
169
|
features/billing/invoices.feature — "Invoice Management"
|
|
153
|
-
...
|
|
154
170
|
```
|
|
155
171
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
**Step 2 — Match each proposed scenario to an existing file**
|
|
159
|
-
|
|
160
|
-
For each scenario you intend to draft, explicitly decide: extend or new? Show the decision:
|
|
172
|
+
For each scenario, decide extend-or-new and show it:
|
|
161
173
|
|
|
162
174
|
```
|
|
163
|
-
|
|
164
|
-
"
|
|
165
|
-
"User exports invoices as CSV" → extend features/billing/invoices.feature (same resource)
|
|
166
|
-
"User configures SSO provider" → NEW (no existing file owns SSO configuration)
|
|
175
|
+
"Admin resets a user's password" → extend features/auth/login.feature (same actor domain: auth)
|
|
176
|
+
"User configures SSO provider" → NEW (no existing file owns SSO configuration)
|
|
167
177
|
```
|
|
168
178
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
**Step 3 — Execute (edit live on the branch)**
|
|
172
|
-
|
|
173
|
-
Artifacts are edited **directly in their real locations** on the feature branch. The branch is the isolation; `git diff` is the staging area. There is no copy into `.grimoire/changes/` and no promote step (see `../references/principles.md` — don't reinvent git).
|
|
174
|
-
|
|
175
|
-
- **Extend:** add scenarios directly to the live `features/<same-relative-path>` file.
|
|
176
|
-
- **New file (requires justification):** state which existing files were considered and why none fit. Then create `features/<capability>/<name>.feature` directly.
|
|
179
|
+
Signals to extend: same actor, same domain object, same entry point, same HTTP resource or screen. Signals genuinely new: new actor type with no existing file, entirely new domain object, or the existing Feature title would need "and" to cover both. If unsure, extend. A new file requires stating which files were considered and why none fit.
|
|
177
180
|
|
|
178
|
-
|
|
179
|
-
Signals a genuinely new file: new actor type with no existing file, entirely new domain object, or existing file's Feature title would need "and" to cover both.
|
|
181
|
+
Then write Gherkin (Feature title + user story; Background for shared preconditions; one scenario per behavior; Given/When/Then describing WHAT, never HOW). Apply security tags per `../references/security-compliance.md` (only when there's a security surface; compliance tags only when `project.compliance` is set). When design input grounded the scenarios (step 4): use brand-token **names** not hex values when `.grimoire/brand/tokens.json` applies; prefer existing component names when `.grimoire/docs/components.md` exists, and flag any net-new component ("new component required — confirm before plan stage").
|
|
180
182
|
|
|
181
|
-
|
|
182
|
-
- Follow Gherkin best practices:
|
|
183
|
-
- Feature title + user story (As a / I want / So that)
|
|
184
|
-
- Background for shared preconditions
|
|
185
|
-
- One scenario per behavior
|
|
186
|
-
- Given/When/Then — describe WHAT, never HOW
|
|
187
|
-
- No implementation details in feature files
|
|
183
|
+
**Constraints → `.grimoire/docs/constraints.md`.** Every invariant that failed the admission test (it's a security control / NFR / observability / compliance rule, not an actor-observable behavior) becomes one row: **assertion · rationale · how-verified · links**. The assertion is a flat statement ("Log output never contains PII or secrets"), not Given/When/Then. `how-verified` names the test that proves it (a `unit-invariant` the plan stage will create) — never a Gherkin scenario. If it stems from a decision, link the MADR; don't restate it. Create the file from `templates/constraints.md` if absent.
|
|
188
184
|
|
|
189
|
-
**
|
|
190
|
-
- If a Figma snapshot or `grimoire-design` output is available, propose Gherkin scenarios per (component × state) grounded in those artifacts. Walk the component list and the enumerated states; emit one Scenario per pair.
|
|
191
|
-
- Present the proposed scenarios for user review before writing to `.feature` files — accept all / accept some / edit / reject any. Rejected scenarios are not written.
|
|
192
|
-
- If `grimoire-design` already produced user-accepted scenarios under `.grimoire/changes/<change-id>/designs/scenarios.feature`, do NOT re-propose them; write the accepted ones live into `features/` (applying the admission test) and only fill gaps (e.g., new components not yet covered).
|
|
185
|
+
**Decisions → `.grimoire/decisions/NNNN-*.md`.** Project each Decisions-ledger entry, applying the **novelty gate**: a MADR is for a decision with a real, project-specific trade-off between viable alternatives — not for industry-default tooling picks or ecosystem-forced conventions. Ask: *would a competent engineer on this stack make a different choice, and need our reasoning to understand ours?* If no, skip it. Obvious tooling/convention picks fold into the existing `Tooling and convention baseline` ADR (one line: choice → why), not a new sequential record. Genuine trade-offs get the next sequential number, status `proposed` (`grimoire-apply` flips to `accepted` at finalize), using `.grimoire/decisions/template.md`.
|
|
193
186
|
|
|
194
|
-
**
|
|
195
|
-
- When Figma variables map to tokens that also appear in `.grimoire/brand/tokens.json`, scenarios referencing visual properties must use token names, not hex values. Example: write `Then the submit button uses color.primary` not `Then the submit button is #0066ff`.
|
|
196
|
-
- Hardcoded hex values in scenarios drift silently when tokens change. Token names stay correct across re-skins.
|
|
197
|
-
|
|
198
|
-
**Component-library awareness:**
|
|
199
|
-
- When `.grimoire/docs/components.md` exists, prefer references to existing components by name in scenarios (e.g., `Then a Button with variant="primary" is rendered` over `Then a blue button appears`).
|
|
200
|
-
- Flag net-new components explicitly: emit "new component required — confirm before plan stage" alongside any scenario that introduces a component not listed in `components.md`. The plan stage will then decide whether to add it to the inventory or reuse an existing variant.
|
|
201
|
-
|
|
202
|
-
**Security tags on scenarios:**
|
|
203
|
-
Apply Gherkin tags per `../references/security-compliance.md` (section "Security Tags"). Tags drive stricter checks in plan, review, and verify stages. Apply compliance-specific tags only when `project.compliance` is configured. If no compliance frameworks and no security surface, don't add tags.
|
|
204
|
-
|
|
205
|
-
**For constraints (security / NFR / observability / compliance):**
|
|
206
|
-
|
|
207
|
-
Anything that failed the feature admission test because it's an invariant rather than an actor-observable behavior goes here — **not** into a `.feature`.
|
|
208
|
-
|
|
209
|
-
- Append to the live `.grimoire/docs/constraints.md` (create it from `templates/constraints.md` if absent).
|
|
210
|
-
- One row per constraint: **assertion · rationale · how-verified · links**. The assertion is a flat statement of what must always hold ("Log output never contains PII or secrets"), not a Given/When/Then.
|
|
211
|
-
- `how-verified` names the test that proves it (a `unit-invariant` test the plan stage will create) — never a Gherkin scenario.
|
|
212
|
-
- If the constraint stems from a decision, link the MADR; don't restate the decision (DRY).
|
|
213
|
-
|
|
214
|
-
**For architecture decisions:**
|
|
215
|
-
- Write the MADR record directly into the live `.grimoire/decisions/` with the next sequential number (`NNNN-title.md`)
|
|
216
|
-
- Use the template from `.grimoire/decisions/template.md` or the AGENTS.md format
|
|
217
|
-
- Include considered options, decision drivers, and consequences
|
|
218
|
-
- Draft status `proposed`; `grimoire-apply` flips it to `accepted` at finalize
|
|
219
|
-
|
|
220
|
-
**For changes that touch data:**
|
|
221
|
-
- Check `.grimoire/docs/data/schema.yml` for the current data schema (if it exists)
|
|
222
|
-
- If the change adds, modifies, or removes data models, fields, indexes, or external API integrations, write a `data.yml` in `.grimoire/changes/<change-id>/` showing the proposed schema changes
|
|
223
|
-
- Use the same YAML format as `schema.yml` but only include what's changing — new models, added/removed fields, new external API integrations
|
|
224
|
-
- Mark changes clearly with `action:` on each entry:
|
|
187
|
+
**Data changes → `.grimoire/changes/<change-id>/data.yml`.** If the change adds/modifies/removes data models, fields, indexes, or external API integrations, write `data.yml` (same YAML shape as `schema.yml`, only what's changing, `action:` on each entry):
|
|
225
188
|
|
|
226
189
|
```yaml
|
|
227
190
|
# Proposed data changes for: add-user-profiles
|
|
228
|
-
|
|
229
191
|
users:
|
|
230
192
|
action: modify
|
|
231
193
|
source: src/models/user.py
|
|
232
194
|
fields:
|
|
233
|
-
avatar_url:
|
|
234
|
-
|
|
235
|
-
type: varchar
|
|
236
|
-
nullable: true
|
|
237
|
-
legacy_name: # removing a field
|
|
238
|
-
action: remove
|
|
239
|
-
|
|
195
|
+
avatar_url: { action: add, type: varchar, nullable: true }
|
|
196
|
+
legacy_name: { action: remove }
|
|
240
197
|
profiles:
|
|
241
|
-
action: add
|
|
198
|
+
action: add
|
|
242
199
|
type: collection
|
|
243
200
|
fields:
|
|
244
201
|
user_id: { type: objectId, ref: users }
|
|
245
202
|
bio: { type: string, max_length: 500 }
|
|
246
|
-
social_links:
|
|
247
|
-
type: array
|
|
248
|
-
items:
|
|
249
|
-
platform: { type: string }
|
|
250
|
-
url: { type: string }
|
|
251
|
-
|
|
252
203
|
github_api:
|
|
253
|
-
action: add
|
|
204
|
+
action: add
|
|
254
205
|
type: external_api
|
|
255
206
|
provider: GitHub
|
|
256
207
|
schema_ref: https://docs.github.com/en/rest
|
|
@@ -259,60 +210,43 @@ github_api:
|
|
|
259
210
|
get_user:
|
|
260
211
|
method: GET
|
|
261
212
|
path: /users/{username}
|
|
262
|
-
request:
|
|
263
|
-
headers:
|
|
264
|
-
|
|
265
|
-
response: # document what you expect back
|
|
213
|
+
request:
|
|
214
|
+
headers: { Authorization: "Bearer {token}" }
|
|
215
|
+
response:
|
|
266
216
|
login: { type: string, required: true }
|
|
267
217
|
avatar_url: { type: string, required: true }
|
|
268
218
|
name: { type: string, nullable: true }
|
|
269
|
-
error_response:
|
|
219
|
+
error_response:
|
|
270
220
|
message: { type: string }
|
|
271
221
|
status: { type: integer }
|
|
272
222
|
```
|
|
273
223
|
|
|
274
|
-
**Contract documentation is mandatory for external APIs.** Every endpoint
|
|
275
|
-
|
|
276
|
-
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
-
|
|
285
|
-
-
|
|
286
|
-
- **
|
|
287
|
-
- **Level 3-4**: Include an **Assumptions** section: list what must be true for this change to succeed. For each assumption, note whether there is evidence or it is unvalidated. Unvalidated assumptions on the critical path should be flagged to the user.
|
|
288
|
-
- **Level 3-4**: Include a **Pre-Mortem** section: imagine this change has failed or caused a production incident 6 months from now — what went wrong? List 2-5 plausible failure modes with mitigations or "accepted" if the risk is acknowledged.
|
|
289
|
-
- The manifest must include a **Prior Art** section summarizing the research from step 3: what was found, what was evaluated, and why the chosen direction (adopt, build, or hybrid) was selected. If the decision was to build, include what's being borrowed from existing implementations. This section is consumed by the plan and review stages — without it, reviewers can't validate the build-vs-buy decision.
|
|
290
|
-
|
|
291
|
-
### 8. Collaborate
|
|
292
|
-
- Present the draft to the user
|
|
293
|
-
- Iterate based on feedback
|
|
294
|
-
- Do NOT proceed to plan stage without user approval
|
|
295
|
-
|
|
296
|
-
### 9. Validate
|
|
297
|
-
- Verify `.feature` files have valid Gherkin syntax
|
|
298
|
-
- Verify MADR records have valid YAML frontmatter (status, date)
|
|
299
|
-
- Verify manifest is complete and accurate
|
|
300
|
-
- Every Feature has a user story
|
|
301
|
-
- Every Scenario has at least Given + When + Then
|
|
302
|
-
- No implementation details leaked into features
|
|
303
|
-
- **Re-run the admission test on every scenario you wrote** (step 1): external actor, observable, domain language, survives reimplementation. Any scenario that now fails is slop — move it to `constraints.md` or a MADR before proceeding.
|
|
304
|
-
- **Principles gate** (`../references/principles.md`): no fact written to two homes (DRY), no second way to do an existing thing (one right way), no reinvented wheel (don't reinvent), no artifact created past the stated scope (KISS).
|
|
224
|
+
**Contract documentation is mandatory for external APIs.** Every endpoint must document `request` (what you send), `response` (fields you read, `required: true` for those your code depends on), and `error_response` (the error shape you handle). Downstream skills generate contract tests from this. If you don't know the exact shape, reference `schema_ref` and document the subset your client uses — that subset is the contract. No data impact → skip `data.yml` entirely.
|
|
225
|
+
|
|
226
|
+
**Manifest (`manifest.md`).** Generate it from `draft.md` as the durable plan-input glue: `complexity` (just scored), Why + Non-goals, the artifact list (added/modified/removed features, decisions, constraints), and a **Prior Art** section summarizing step 3's research (what was found/evaluated, why adopt/build/hybrid; if building, what's borrowed). **Level 3–4** also carry **Assumptions** (what must be true; mark evidence vs. unvalidated; flag unvalidated ones on the critical path) and a **Pre-Mortem** (2–5 plausible failure modes 6 months out, with mitigations or "accepted"). These come straight from the `draft.md` Decided/Open and Cut sections.
|
|
227
|
+
|
|
228
|
+
**Do NOT delete `draft.md`.** Retain it read-only as the agreed reference through plan → … → apply. `grimoire-apply` removes it with the change folder at finalize.
|
|
229
|
+
|
|
230
|
+
### 8. Validate (at projection)
|
|
231
|
+
|
|
232
|
+
- `.feature` files have valid Gherkin; every Feature has a user story; every Scenario has at least Given + When + Then.
|
|
233
|
+
- MADR records have valid YAML frontmatter (status, date).
|
|
234
|
+
- Manifest is complete and accurate; `complexity` is set.
|
|
235
|
+
- **Re-run the admission test on every scenario you wrote**: external actor, observable, domain language, survives reimplementation. Any scenario that now fails is slop — move it to `constraints.md` or a MADR.
|
|
236
|
+
- **Principles gate** (`../references/principles.md`): no fact written to two homes (DRY), no second way to do an existing thing (one right way), no reinvented wheel, no artifact created past the stated scope (KISS). Note: `draft.md` co-existing with the homes is **not** a DRY violation — it is the (soon-deleted) source the homes were projected from, not a parallel authority.
|
|
305
237
|
|
|
306
238
|
## Important
|
|
307
239
|
- ONE change at a time. Don't combine unrelated changes.
|
|
308
|
-
-
|
|
309
|
-
- **
|
|
310
|
-
-
|
|
311
|
-
-
|
|
312
|
-
-
|
|
313
|
-
- **Figma access token is read from `FIGMA_ACCESS_TOKEN`
|
|
240
|
+
- **`draft.md` is the only surface you design on.** Features, constraints, MADRs, and the manifest are **generated from it** at projection — never authored by hand in parallel during design.
|
|
241
|
+
- **Features describe actor-observable behavior, not implementation, and not invariants.** No external actor, not observable, or names a library/log-level/table → it's a constraint (→ `constraints.md`) or a decision (→ MADR). This is the #1 source of feature-file slop.
|
|
242
|
+
- **One fact, one home** (`../references/principles.md`). A capability lives in one `.feature`; a control in one constraint row; a decision in one MADR. Never the same fact in two homes (at rest).
|
|
243
|
+
- Decisions live in **one inline ledger** in `draft.md` while designing; they project to separate MADRs only at step 7. This is how coupled decisions stay legible during the thinking.
|
|
244
|
+
- Artifacts (post-projection) are edited **live on the branch** — never copied into `.grimoire/changes/`. `git diff` is the staging area.
|
|
245
|
+
- **Figma access token is read from `FIGMA_ACCESS_TOKEN` by the MCP server.** Never log it, never write it to config or any artifact (`manifest.md`, `consult.md`, `figma-snapshot.json`, `draft.md`). The MCP handles auth transparently.
|
|
314
246
|
|
|
315
247
|
## Done
|
|
316
|
-
When the user approves the
|
|
248
|
+
When the user approves the design and it has been projected, the workflow is complete.
|
|
249
|
+
`draft.md` remains as reference until `grimoire-apply` clears it. Present the change
|
|
250
|
+
directory path and suggest next steps:
|
|
317
251
|
- `grimoire-plan` to generate implementation tasks
|
|
318
|
-
- Or further iteration if the user wants changes
|
|
252
|
+
- Or further iteration on `draft.md` if the user wants changes
|
|
@@ -63,14 +63,11 @@ These are gates, not aspirations — a task that adds a duplicate home or a rein
|
|
|
63
63
|
|
|
64
64
|
### 2. Read All Artifacts
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
Read the change's artifacts following `../references/artifact-map.md` — it defines what each file is, the grimoire-docs-first / graph-for-structure discipline, and the staleness gate. Plan-specific reading on top of that:
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
- `
|
|
70
|
-
-
|
|
71
|
-
- All decision records for this change (edited live in `.grimoire/decisions/`), **including Cost of Ownership sections**
|
|
72
|
-
- `.grimoire/docs/constraints.md` — any constraints (security/NFR/observability) this change adds or touches. These produce `unit-invariant` tasks, not scenarios.
|
|
73
|
-
- The current baseline (`features/`, `.grimoire/decisions/`) via `git diff main` to see exactly what this change adds vs. what already existed
|
|
68
|
+
- `.grimoire/docs/constraints.md` — any constraints (security/NFR/observability) this change touches. These produce `unit-invariant` tasks, not scenarios.
|
|
69
|
+
- The current baseline (`features/`, `.grimoire/decisions/`) via `git diff main` — exactly what this change adds vs. what already existed.
|
|
70
|
+
- Existing duplication in areas you're touching — `search_graph` for similar functions, or `grimoire health` (its `duplicates` metric) — so tasks consolidate rather than clone.
|
|
74
71
|
|
|
75
72
|
**Validate the build-vs-buy decision:**
|
|
76
73
|
- Check that `manifest.md` has a **Prior Art** section documenting what existing solutions were researched. If it's missing or empty, **stop and tell the user** — planning without a build-vs-buy analysis produces plans that ignore cheaper alternatives.
|
|
@@ -78,27 +75,6 @@ These are gates, not aspirations — a task that adds a duplicate home or a rein
|
|
|
78
75
|
- If the decision was to **build custom**, verify the manifest documents (1) what existing tools were considered, (2) the specific requirements they don't meet, and (3) what design patterns are being borrowed from prior art.
|
|
79
76
|
- If the decision was **hybrid** (adopt for part, build for part), ensure the boundary between adopted and custom code is clear in the tasks.
|
|
80
77
|
|
|
81
|
-
**Read from grimoire docs (these replace codebase exploration):**
|
|
82
|
-
- **`.grimoire/docs/<area>.md`** for each area the change touches — these contain Purpose, Boundaries, Conventions (naming/structure), and "Where New Code Goes" guidance. For key files, exact symbols, reusable utilities (function names, file paths, line numbers), and call graphs, **query the graph** — `search_graph` / `get_code_snippet` / `get_architecture`. Area docs give you intent and placement; the graph gives you the live structure to write exact file paths and reuse existing code.
|
|
83
|
-
- **`.grimoire/docs/data/schema.yml`** — the full data model: every table/collection, field types, relationships, indexes, and external API contracts with `source:` pointers to ORM code. Read this instead of reading individual model files.
|
|
84
|
-
- **`.grimoire/docs/context.yml`** — the project's deployment environment, related services, infrastructure dependencies, CI/CD pipelines, and observability setup. Read this to understand deployment constraints (e.g., Lambda means no long-running processes, Kubernetes means you may need health check endpoints), cross-service boundaries (e.g., auth is handled by a sibling service, not this project), and infrastructure available at runtime (e.g., Redis is available for caching, RabbitMQ for async tasks).
|
|
85
|
-
- Existing duplication in areas you're touching — query codebase-memory-mcp (`search_graph` for similar functions) or run `grimoire health` (its config-driven `duplicates` metric) so tasks consolidate rather than add more clones.
|
|
86
|
-
|
|
87
|
-
**Read proposed data changes:**
|
|
88
|
-
- **`data.yml`** if present — proposed schema changes need migration and model tasks
|
|
89
|
-
|
|
90
|
-
**Staleness gate:** For each area doc loaded, check its `last_updated` date against `git log -1 --format=%ci <directory>`. If any doc is older than the most recent commit to its directory, it's stale — the file paths, utility names, and patterns it describes may no longer be accurate.
|
|
91
|
-
|
|
92
|
-
- **Level 1-2:** Warn ("Area doc for `<area>` is behind recent commits — its boundaries/conventions may be wrong; rely on the graph for structure") and proceed. Note inferred paths with `<!-- inferred: area doc may be stale -->`.
|
|
93
|
-
- **Level 3-4:** Treat as a blocker. Do not generate tasks until the user refreshes stale docs via `grimoire-discover` targeted refresh. Planning with stale docs at this complexity produces wrong file paths and misses recent utilities — the cost of re-planning outweighs the cost of refreshing first.
|
|
94
|
-
|
|
95
|
-
**Read specific source files only when:**
|
|
96
|
-
- Area docs don't exist yet (tell the user to run `/grimoire:discover` first — planning without area docs produces worse tasks)
|
|
97
|
-
- Area docs exist but you need to verify a specific implementation detail (e.g., exact function signature, exact import path)
|
|
98
|
-
- You need to read existing step definitions to understand the test setup
|
|
99
|
-
|
|
100
|
-
**Do NOT read the entire codebase** for "context." The plan skill's job is to produce tasks with specific file paths and specific assertions. Area docs + data schema give you this. Reading dozens of source files wastes context window and doesn't produce better plans.
|
|
101
|
-
|
|
102
78
|
### 3. Check Specification Completeness
|
|
103
79
|
|
|
104
80
|
Before generating tasks, evaluate whether the specifications are detailed enough to plan against. Underspecified requirements produce vague tasks, which produce wrong code.
|
|
@@ -71,6 +71,7 @@ If present:
|
|
|
71
71
|
If no `Change:` trailer exists, that's itself a finding for a grimoire-managed repo: flag as **suggestion** ("commits missing audit trailer — `grimoire trace` won't find this PR") unless the project clearly doesn't use grimoire.
|
|
72
72
|
|
|
73
73
|
### 4. Gather Project Context
|
|
74
|
+
See `../references/artifact-map.md` for what each artifact is and the grimoire-docs-first / staleness discipline.
|
|
74
75
|
- `.grimoire/config.yaml` — language, tools, `commit_style`, `comment_style`, `project.compliance`, `dep_audit`
|
|
75
76
|
- `.grimoire/docs/context.yml` — deployment environment, related services
|
|
76
77
|
- `.grimoire/docs/data/schema.yml` — current data baseline
|
|
@@ -209,7 +209,7 @@ For each item the user approves to fix:
|
|
|
209
209
|
4. Hand off to `/grimoire:plan` for task generation, then `/grimoire:apply` for implementation
|
|
210
210
|
|
|
211
211
|
**Refactoring-specific guidance for the plan/apply stages:**
|
|
212
|
-
- **
|
|
212
|
+
- **Capture a baseline first, then keep it.** Apply records which tests were already failing at change start (`baseline.md`, see `../references/test-baseline.md`). For a refactor this is the whole safety net: "passing" means *no new failures vs the baseline*, not "zero failures." A test red before you started is pre-existing and accepted; a test you turn red is the refactor breaking behavior — and that means it's not a refactoring. Diff against the baseline after each incremental move.
|
|
213
213
|
- **Prefer incremental moves over big-bang rewrites.** Move one function at a time, run tests after each move.
|
|
214
214
|
- **Add tests before refactoring if test debt is part of the item.** You need a safety net before restructuring.
|
|
215
215
|
- **Update imports incrementally.** When moving code to a new module, re-export from the old location first, then update consumers, then remove the re-export.
|
|
@@ -42,7 +42,7 @@ This step is optional. The user can skip it by saying "skip review" or "go strai
|
|
|
42
42
|
- If only one, confirm it
|
|
43
43
|
|
|
44
44
|
### 2. Gather Context
|
|
45
|
-
Read all artifacts for the change:
|
|
45
|
+
Read all artifacts for the change — see `../references/artifact-map.md` for what each is and the grimoire-docs-first / staleness discipline:
|
|
46
46
|
- `manifest.md` — change summary, scope, **and Prior Art section** (build-vs-buy rationale)
|
|
47
47
|
- All `.feature` files — behavioral specifications
|
|
48
48
|
- All decision records — architectural choices
|