@kiwidata/grimoire 0.1.3 → 0.1.5
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/AGENTS.md +56 -4
- package/README.md +107 -59
- package/dist/cli/index.js +7 -7
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/check.js +1 -1
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/configure.d.ts +3 -0
- package/dist/commands/configure.d.ts.map +1 -0
- package/dist/commands/configure.js +19 -0
- package/dist/commands/configure.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +2 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/core/check.d.ts.map +1 -1
- package/dist/core/check.js +165 -111
- package/dist/core/check.js.map +1 -1
- package/dist/core/ci.d.ts.map +1 -1
- package/dist/core/ci.js +50 -69
- package/dist/core/ci.js.map +1 -1
- package/dist/core/configure.d.ts +14 -0
- package/dist/core/configure.d.ts.map +1 -0
- package/dist/core/configure.js +434 -0
- package/dist/core/configure.js.map +1 -0
- package/dist/core/detect.d.ts.map +1 -1
- package/dist/core/detect.js +153 -26
- package/dist/core/detect.js.map +1 -1
- package/dist/core/diff.d.ts.map +1 -1
- package/dist/core/diff.js +62 -93
- package/dist/core/diff.js.map +1 -1
- package/dist/core/doc-style.d.ts +0 -4
- package/dist/core/doc-style.d.ts.map +1 -1
- package/dist/core/doc-style.js +103 -22
- package/dist/core/doc-style.js.map +1 -1
- package/dist/core/docs.js +202 -170
- package/dist/core/docs.js.map +1 -1
- package/dist/core/health.d.ts +6 -0
- package/dist/core/health.d.ts.map +1 -1
- package/dist/core/health.js +133 -96
- package/dist/core/health.js.map +1 -1
- package/dist/core/hooks.d.ts +0 -3
- package/dist/core/hooks.d.ts.map +1 -1
- package/dist/core/hooks.js +11 -16
- package/dist/core/hooks.js.map +1 -1
- package/dist/core/init.d.ts +2 -0
- package/dist/core/init.d.ts.map +1 -1
- package/dist/core/init.js +230 -406
- package/dist/core/init.js.map +1 -1
- package/dist/core/list.d.ts.map +1 -1
- package/dist/core/list.js +55 -65
- package/dist/core/list.js.map +1 -1
- package/dist/core/risk-register.d.ts +17 -0
- package/dist/core/risk-register.d.ts.map +1 -0
- package/dist/core/risk-register.js +73 -0
- package/dist/core/risk-register.js.map +1 -0
- package/dist/core/shared-setup.d.ts +0 -40
- package/dist/core/shared-setup.d.ts.map +1 -1
- package/dist/core/shared-setup.js +92 -56
- package/dist/core/shared-setup.js.map +1 -1
- package/dist/core/status.d.ts.map +1 -1
- package/dist/core/status.js +42 -52
- package/dist/core/status.js.map +1 -1
- package/dist/core/test-quality.d.ts +0 -8
- package/dist/core/test-quality.d.ts.map +1 -1
- package/dist/core/test-quality.js +24 -30
- package/dist/core/test-quality.js.map +1 -1
- package/dist/core/trace.d.ts.map +1 -1
- package/dist/core/trace.js +67 -75
- package/dist/core/trace.js.map +1 -1
- package/dist/core/update.d.ts.map +1 -1
- package/dist/core/update.js +61 -11
- package/dist/core/update.js.map +1 -1
- package/dist/core/validate.d.ts +1 -4
- package/dist/core/validate.d.ts.map +1 -1
- package/dist/core/validate.js +126 -148
- package/dist/core/validate.js.map +1 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -3
- package/dist/index.js.map +1 -1
- package/dist/utils/config.d.ts +15 -5
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +63 -42
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/fs.d.ts +0 -12
- package/dist/utils/fs.d.ts.map +1 -1
- package/dist/utils/fs.js +0 -12
- package/dist/utils/fs.js.map +1 -1
- package/dist/utils/paths.d.ts +0 -6
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +0 -6
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/spawn.d.ts +0 -3
- package/dist/utils/spawn.d.ts.map +1 -1
- package/dist/utils/spawn.js +0 -3
- package/dist/utils/spawn.js.map +1 -1
- package/package.json +1 -1
- package/skills/grimoire-apply/SKILL.md +89 -25
- package/skills/grimoire-audit/SKILL.md +21 -1
- package/skills/grimoire-bug/SKILL.md +48 -9
- package/skills/grimoire-commit/SKILL.md +3 -2
- package/skills/grimoire-design/SKILL.md +259 -0
- package/skills/grimoire-design-consult/SKILL.md +200 -0
- package/skills/grimoire-discover/SKILL.md +139 -109
- package/skills/grimoire-draft/SKILL.md +131 -15
- package/skills/grimoire-plan/SKILL.md +119 -46
- package/skills/grimoire-pr/SKILL.md +7 -10
- package/skills/grimoire-pr-review/SKILL.md +46 -115
- package/skills/grimoire-precommit-review/SKILL.md +205 -0
- package/skills/grimoire-refactor/SKILL.md +6 -6
- package/skills/grimoire-review/SKILL.md +95 -156
- package/skills/grimoire-verify/SKILL.md +40 -7
- package/skills/grimoire-vuln-remediate/SKILL.md +107 -0
- package/skills/grimoire-vuln-triage/SKILL.md +109 -0
- package/skills/references/adversarial-personas.md +225 -0
- package/skills/references/brand-tokens-format.md +186 -0
- package/skills/references/code-quality.md +172 -0
- package/skills/references/container-scan-triage.md +102 -0
- package/skills/references/dependency-vuln-triage.md +236 -0
- package/skills/references/design-heuristics.md +138 -0
- package/skills/references/design-input-formats.md +190 -0
- package/skills/references/pattern-guard.md +180 -0
- package/skills/references/principles.md +82 -0
- package/skills/references/refactor-scan-categories.md +154 -2
- package/skills/references/review-personas.md +406 -0
- package/skills/references/security-compliance.md +22 -1
- package/skills/references/testing-contracts.md +1 -1
- package/skills/references/visual-fidelity.md +206 -0
- package/templates/accepted-risks.yml +47 -0
- package/templates/brand-tokens-example.json +13 -0
- package/templates/brand-voice-example.md +22 -0
- package/templates/constraints.md +25 -0
- package/templates/design-tool-setup-stub.md +59 -0
- package/dist/commands/archive.d.ts +0 -3
- package/dist/commands/archive.d.ts.map +0 -1
- package/dist/commands/archive.js +0 -22
- package/dist/commands/archive.js.map +0 -1
- package/dist/commands/log.d.ts +0 -3
- package/dist/commands/log.d.ts.map +0 -1
- package/dist/commands/log.js +0 -15
- package/dist/commands/log.js.map +0 -1
- package/dist/commands/map.d.ts +0 -3
- package/dist/commands/map.d.ts.map +0 -1
- package/dist/commands/map.js +0 -17
- package/dist/commands/map.js.map +0 -1
- package/dist/core/archive.d.ts +0 -9
- package/dist/core/archive.d.ts.map +0 -1
- package/dist/core/archive.js +0 -92
- package/dist/core/archive.js.map +0 -1
- package/dist/core/log.d.ts +0 -8
- package/dist/core/log.d.ts.map +0 -1
- package/dist/core/log.js +0 -150
- package/dist/core/log.js.map +0 -1
- package/dist/core/map.d.ts +0 -9
- package/dist/core/map.d.ts.map +0 -1
- package/dist/core/map.js +0 -302
- package/dist/core/map.js.map +0 -1
- package/templates/dupignore +0 -93
- package/templates/mapignore +0 -58
- package/templates/mapkeys +0 -65
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: grimoire-discover
|
|
3
|
-
description: Generate area docs and data schema
|
|
3
|
+
description: Generate intent-focused area docs and data schema by querying the codebase graph. Use when initializing grimoire on an existing project or when an area's intent/boundaries have changed.
|
|
4
4
|
compatibility: Designed for Claude Code (or similar products)
|
|
5
5
|
metadata:
|
|
6
6
|
author: kiwi-data
|
|
@@ -9,13 +9,15 @@ metadata:
|
|
|
9
9
|
|
|
10
10
|
# grimoire-discover
|
|
11
11
|
|
|
12
|
-
Generate a
|
|
12
|
+
Generate **intent-focused** area docs and a data schema in `.grimoire/docs/`. Area docs capture what the graph can't know — an area's *purpose, boundaries, and conventions* — and point at the codebase-memory-mcp graph for everything structural (symbols, key files, call graphs, reusable code). The graph is the live source of structure; discover does not freeze it into a doc that drifts.
|
|
13
13
|
|
|
14
14
|
## Triggers
|
|
15
|
-
- User wants to document
|
|
16
|
-
- User asks about coding standards
|
|
17
|
-
- User
|
|
18
|
-
- Loose match: "discover", "
|
|
15
|
+
- User wants to document an area's purpose, boundaries, or conventions
|
|
16
|
+
- User asks about coding standards or where new code of a type should go
|
|
17
|
+
- User is onboarding an existing project to grimoire
|
|
18
|
+
- Loose match: "discover", "standards", "conventions", "boundaries", "onboard codebase"
|
|
19
|
+
|
|
20
|
+
Note: "find existing utilities", "what calls what", "codebase layout/structure" are **graph** queries, not discover — use codebase-memory-mcp (`search_graph`, `get_architecture`, `trace_path`) directly.
|
|
19
21
|
|
|
20
22
|
## Routing
|
|
21
23
|
- Want to document existing behavior as Gherkin features → `grimoire-audit`
|
|
@@ -24,84 +26,63 @@ Generate a structured project map in `.grimoire/docs/` from a codebase snapshot.
|
|
|
24
26
|
|
|
25
27
|
## Prerequisites
|
|
26
28
|
|
|
27
|
-
**
|
|
28
|
-
|
|
29
|
-
If `.snapshot.json` doesn't exist or is stale, tell the user to run `grimoire map` (or `grimoire map --refresh` to diff against existing docs).
|
|
30
|
-
|
|
31
|
-
**Symbol intelligence (recommended):** If `codebase-memory-mcp` is available as an MCP server, use its graph tools (`search_graph`, `get_architecture`, `query_graph`) to query symbols, call graphs, and architecture instead of reading source files manually. This provides AST-parsed symbols across 66 languages, call-path tracing, and dead code detection — far more accurate than regex extraction.
|
|
29
|
+
**The codebase graph is the structure source.** `codebase-memory-mcp` should be indexed for this project — discover reads directory layout, symbols, key files, and call graphs from it (`get_architecture`, `search_graph`, `trace_path`), not from a filesystem snapshot. There is no `grimoire map` step and no `.snapshot.json` (both retired).
|
|
32
30
|
|
|
33
|
-
If `codebase-memory-mcp` is not
|
|
31
|
+
If `codebase-memory-mcp` is not indexed, run `index_repository` first. Only if the graph is genuinely unavailable, fall back to reading source files directly to identify boundaries and conventions.
|
|
34
32
|
|
|
35
33
|
## What It Produces
|
|
36
34
|
|
|
37
35
|
`.grimoire/docs/` with:
|
|
38
|
-
- **`index.yml`** —
|
|
39
|
-
- **Area docs** — one markdown file per area
|
|
40
|
-
- Purpose
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
- Naming conventions and patterns in use
|
|
36
|
+
- **`index.yml`** — registry of documented areas (descriptions + directory mappings) and the functional-story map that groups capabilities in the OVERVIEW
|
|
37
|
+
- **Area docs** — one markdown file per significant area, **intent only**:
|
|
38
|
+
- Purpose of the area
|
|
39
|
+
- Boundaries (what belongs here, what doesn't, where related code lives)
|
|
40
|
+
- Conventions (naming + structural patterns, with example file references)
|
|
44
41
|
- Where new code of this type should go
|
|
45
|
-
- Example references (point to specific files as exemplars, don't duplicate code)
|
|
46
|
-
|
|
47
|
-
## Workflow
|
|
48
42
|
|
|
49
|
-
|
|
50
|
-
Read `.grimoire/docs/.snapshot.json`. This gives you:
|
|
51
|
-
- **directories** — every directory with file counts, extensions, key files, and subdirectories
|
|
52
|
-
- **keyFiles** — significant files (entry points, configs, route files, etc.) with their detected type
|
|
53
|
-
- **undocumented** — directories not yet covered by existing docs (only present on `--refresh`)
|
|
54
|
-
- **removed** — directories that have docs but no longer exist (only present on `--refresh`)
|
|
43
|
+
Area docs do NOT contain Key Files, a reusable-code inventory, or duplicate listings — those are structure, and the graph regenerates them live on demand (and would drift if frozen here). When a reader needs symbols or reuse candidates, they query the graph, not the doc.
|
|
55
44
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
If the snapshot includes a `duplicates` section (from `grimoire map --duplicates`), use it to populate "Known Duplicates" sections in area docs. This tells the plan skill where code is already duplicated so it can consolidate rather than add more.
|
|
45
|
+
## Workflow
|
|
59
46
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
- `
|
|
63
|
-
- `
|
|
64
|
-
- `
|
|
47
|
+
### 1. Load the Graph
|
|
48
|
+
Query `codebase-memory-mcp` to understand the codebase live:
|
|
49
|
+
- `get_architecture` — high-level module/dependency overview and directory layout (your roadmap of WHERE the areas are)
|
|
50
|
+
- `search_graph` — symbols (functions, classes, types) in a directory, with signatures
|
|
51
|
+
- `trace_path` — how modules connect (inbound/outbound calls)
|
|
52
|
+
- `query_graph` — specific relationships (e.g., `MATCH (f:Function)-[:CALLS]->(g) WHERE f.file STARTS WITH 'src/api/' RETURN f.name, g.name`)
|
|
65
53
|
|
|
66
|
-
|
|
54
|
+
The graph gives AST-accurate structure across many languages. You use it to *understand* each area so you can write its intent doc — you do NOT copy its output into the doc (that's what regenerating live avoids).
|
|
67
55
|
|
|
68
56
|
### 2. Determine Scope
|
|
69
|
-
Ask the user what to document:
|
|
70
|
-
- **Full scan** — document all areas
|
|
57
|
+
Ask the user what to document (or accept the scope passed in by a calling skill):
|
|
58
|
+
- **Full scan** — document all significant areas (default for first run); use `get_architecture` to enumerate them
|
|
71
59
|
- **Area scan** — document specific directories (e.g., "just the API layer")
|
|
72
|
-
- **
|
|
60
|
+
- **Targeted refresh** — a list of directories is passed in (e.g. from `grimoire-plan`'s staleness gate). Regenerate only those area docs and update their `last_updated` entries in `index.yml`. Fast-path for when an area's *intent* changed; does not touch areas outside the passed list.
|
|
73
61
|
|
|
74
|
-
Check `.grimoire/docs/index.yml` if it exists — don't redo work unless refreshing.
|
|
62
|
+
Check `.grimoire/docs/index.yml` if it exists — don't redo work unless refreshing. Remember discover runs when **intent** changes (new area, shifted boundary), not on every code change — structure is always live from the graph.
|
|
75
63
|
|
|
76
64
|
### 3. Analyze Each Area
|
|
77
|
-
For each
|
|
78
|
-
|
|
79
|
-
**From the
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
-
|
|
86
|
-
-
|
|
87
|
-
-
|
|
88
|
-
-
|
|
89
|
-
|
|
90
|
-
**From reading the code (your job — or to supplement the graph):**
|
|
91
|
-
- What the module/area is responsible for
|
|
92
|
-
- Reusable functions, classes, utilities that other code should import
|
|
93
|
-
- Naming conventions and structural patterns
|
|
94
|
-
- Where new code of this type should be created
|
|
95
|
-
- Import relationships with other areas
|
|
96
|
-
- **Data models and schemas** in or owned by this area (see Data Layer below)
|
|
65
|
+
For each area, use the graph to understand it, then distill the **intent** a reader can't get from the graph:
|
|
66
|
+
|
|
67
|
+
**From the graph (read, don't transcribe):**
|
|
68
|
+
- Symbols, signatures, call relationships, dead code — context for understanding what the area does
|
|
69
|
+
- Cross-area import/HTTP links — informs the Boundaries section
|
|
70
|
+
|
|
71
|
+
**What you write down (the graph can't infer this):**
|
|
72
|
+
- What the area is *responsible for* (Purpose)
|
|
73
|
+
- What belongs here vs. where related code lives (Boundaries)
|
|
74
|
+
- Naming and structural conventions in use, with an exemplar file reference
|
|
75
|
+
- Where new code of this type should go
|
|
76
|
+
- **Data models and schemas** owned by this area (see Data Layer below)
|
|
97
77
|
|
|
98
78
|
### 4. Generate Area Docs
|
|
99
79
|
For each significant area, create a doc file in `.grimoire/docs/`.
|
|
100
80
|
|
|
101
|
-
**Area doc format:**
|
|
81
|
+
**Area doc format (intent only — no structure tables):**
|
|
102
82
|
|
|
103
83
|
```markdown
|
|
104
84
|
# <Area Name>
|
|
85
|
+
> Last updated: YYYY-MM-DD
|
|
105
86
|
|
|
106
87
|
## Purpose
|
|
107
88
|
<1-2 sentences: what this area of the codebase is responsible for>
|
|
@@ -109,41 +90,28 @@ For each significant area, create a doc file in `.grimoire/docs/`.
|
|
|
109
90
|
## Boundaries
|
|
110
91
|
<What belongs here and what doesn't. Where related code lives instead.>
|
|
111
92
|
|
|
112
|
-
##
|
|
113
|
-
|
|
114
|
-
|------|---------------|
|
|
115
|
-
| `path/to/file.py` | <what it does> |
|
|
116
|
-
| `path/to/other.py` | <what it does> |
|
|
117
|
-
|
|
118
|
-
## Reusable Code
|
|
119
|
-
Utilities and helpers in this area that MUST be reused (not re-implemented):
|
|
120
|
-
|
|
121
|
-
| Function/Class | Location | What It Does |
|
|
122
|
-
|----------------|----------|-------------|
|
|
123
|
-
| `format_currency()` | `utils/formatters.py:42` | Formats decimal as currency string |
|
|
124
|
-
| `BaseAPIView` | `api/base.py:15` | Base view with auth, pagination, error handling |
|
|
125
|
-
|
|
126
|
-
## Patterns
|
|
127
|
-
<How things are done in this area. Reference specific files as exemplars.>
|
|
93
|
+
## Conventions
|
|
94
|
+
<How things are done in this area. Reference specific files as exemplars — don't list every file.>
|
|
128
95
|
|
|
129
96
|
### Naming
|
|
130
|
-
- <naming convention with example>
|
|
97
|
+
- <naming convention with one example file>
|
|
131
98
|
|
|
132
99
|
### Structure
|
|
133
|
-
- <structural pattern with
|
|
100
|
+
- <structural pattern with one exemplar file>
|
|
134
101
|
|
|
135
102
|
## Where New Code Goes
|
|
136
103
|
- New <type> → `path/to/directory/`
|
|
137
104
|
- New <type> → `path/to/other/`
|
|
138
105
|
|
|
139
|
-
##
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
| `views.py:42-68` ↔ `api/views.py:15-41` | 26 | Request validation logic |
|
|
106
|
+
## Structure (live)
|
|
107
|
+
For key files, symbols, reusable utilities, call graphs, and duplicates in this area,
|
|
108
|
+
query the graph — it is always current:
|
|
109
|
+
- `get_architecture(area="<dir>")` · `search_graph(qn_pattern="<dir>.*")`
|
|
110
|
+
- duplicates: `grimoire health` (config-driven `duplicates` metric)
|
|
145
111
|
```
|
|
146
112
|
|
|
113
|
+
Do not hand-list files, functions, or "reusable code" — that's the graph's job, and a frozen copy drifts. The single pointer above replaces the old Key Files / Reusable Code / Known Duplicates tables.
|
|
114
|
+
|
|
147
115
|
### 5. Generate Data Schema
|
|
148
116
|
|
|
149
117
|
Scan the codebase for data models, ORM definitions, migration files, and schema declarations. Produce `.grimoire/docs/data/schema.yml` documenting the current data layer.
|
|
@@ -174,6 +142,66 @@ Scan the codebase for data models, ORM definitions, migration files, and schema
|
|
|
174
142
|
|
|
175
143
|
If `.grimoire/docs/data/` already exists, update it rather than regenerating. Diff against existing schema.yml to flag new models or removed fields.
|
|
176
144
|
|
|
145
|
+
### 5.5 Component Inventory (optional)
|
|
146
|
+
|
|
147
|
+
Scan the codebase for an existing UI component library, then produce `.grimoire/docs/components.md` documenting reusable components. This inventory lets `grimoire-design` reuse what exists instead of generating duplicate components.
|
|
148
|
+
|
|
149
|
+
**Detection — component library:**
|
|
150
|
+
|
|
151
|
+
| Signal | What it tells you |
|
|
152
|
+
|--------|------------------|
|
|
153
|
+
| `components.json` | shadcn/ui — components live under the configured `aliases.components` path (typically `components/ui/`) |
|
|
154
|
+
| `tailwind.config.{js,ts}` | Tailwind project — utility-first; components are project-local |
|
|
155
|
+
| `package.json` deps: `@mui/material` | Material UI — components imported from `@mui/material/*` |
|
|
156
|
+
| `package.json` deps: `@chakra-ui/react` | Chakra UI — components imported from `@chakra-ui/react` |
|
|
157
|
+
| `package.json` deps: `@mantine/core` (or any `mantine` package) | Mantine |
|
|
158
|
+
| `package.json` deps: `@radix-ui/*` | Radix primitives — usually wrapped by shadcn or project components |
|
|
159
|
+
|
|
160
|
+
**Detection — Storybook:**
|
|
161
|
+
|
|
162
|
+
| Signal | What it tells you |
|
|
163
|
+
|--------|------------------|
|
|
164
|
+
| `.storybook/main.{ts,js}` | Storybook configured — stories define canonical component variants |
|
|
165
|
+
| `*.stories.{ts,tsx,jsx,js}` | Story files — each story is a documented component variant |
|
|
166
|
+
|
|
167
|
+
**Skip condition:** If no library signal and no story files are found, emit a single-line note ("No UI component signals detected — skipping component inventory.") and continue to §6. Do not create `components.md`.
|
|
168
|
+
|
|
169
|
+
**Workflow:**
|
|
170
|
+
1. Detect the library (or libraries) using the signals above
|
|
171
|
+
2. Locate component source files — for shadcn, walk `components/ui/`; for project-local components, look under `src/components/`, `app/components/`, or wherever the convention places them
|
|
172
|
+
3. For each component file, extract: name, file path, exported variants (e.g., `variant="primary|secondary"`), and notable props (especially required ones)
|
|
173
|
+
4. If Storybook is present, walk `*.stories.*` files to harvest the canonical variant list per component — stories are the source of truth for which variants exist
|
|
174
|
+
5. Write `.grimoire/docs/components.md` listing each component with file path, variants, and key props
|
|
175
|
+
|
|
176
|
+
**`components.md` format:**
|
|
177
|
+
|
|
178
|
+
```markdown
|
|
179
|
+
# Component Inventory
|
|
180
|
+
> Last updated: YYYY-MM-DD
|
|
181
|
+
> Library: <shadcn | MUI | Chakra | Mantine | project-local | mixed>
|
|
182
|
+
|
|
183
|
+
## Components
|
|
184
|
+
|
|
185
|
+
| Component | Location | Variants | Key Props | Notes |
|
|
186
|
+
|-----------|----------|----------|-----------|-------|
|
|
187
|
+
| `Button` | `components/ui/button.tsx` | `default`, `destructive`, `outline`, `ghost`, `link` | `variant`, `size`, `asChild` | Wraps Radix Slot when `asChild` |
|
|
188
|
+
| `Dialog` | `components/ui/dialog.tsx` | — | `open`, `onOpenChange` | Compound: `Dialog`, `DialogTrigger`, `DialogContent` |
|
|
189
|
+
|
|
190
|
+
## Stories
|
|
191
|
+
<Only if Storybook detected. List story files and the variants they document.>
|
|
192
|
+
|
|
193
|
+
| Story File | Component | Documented Variants |
|
|
194
|
+
|------------|-----------|---------------------|
|
|
195
|
+
| `Button.stories.tsx` | `Button` | Primary, Secondary, Destructive, Loading |
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**Rules:**
|
|
199
|
+
- Document what exists in code, not what should exist. If the project has both shadcn and ad-hoc components, list both and note the inconsistency.
|
|
200
|
+
- Point to source files; do not duplicate component code into the doc.
|
|
201
|
+
- Variants come from prop unions in the type signature OR from the canonical Storybook stories — prefer Storybook when present.
|
|
202
|
+
- Only list components meant for reuse. Skip one-off page-level components (e.g., `LoginPage`) unless they're imported elsewhere.
|
|
203
|
+
- If `.grimoire/docs/components.md` already exists, update it — diff against existing entries to flag new or removed components.
|
|
204
|
+
|
|
177
205
|
### 6. Generate Project Context
|
|
178
206
|
|
|
179
207
|
Scan the codebase for deployment and infrastructure artifacts, then populate `.grimoire/docs/context.yml`. This file captures the project's ecosystem — how it's deployed, what services it talks to, and what infrastructure it depends on. If `context.yml` doesn't exist, copy it from the template first (`grimoire init` creates it, but this handles projects initialized before this feature).
|
|
@@ -229,9 +257,22 @@ areas:
|
|
|
229
257
|
path: .grimoire/docs/utils.md
|
|
230
258
|
directory: src/utils
|
|
231
259
|
description: Shared utilities, helpers, formatters
|
|
260
|
+
|
|
261
|
+
# Functional stories — how capabilities group for a human reader.
|
|
262
|
+
# `grimoire docs` uses this to group the OVERVIEW's Capabilities section.
|
|
263
|
+
# `features` lists feature-file basenames (no .feature extension).
|
|
264
|
+
stories:
|
|
265
|
+
chat-qa:
|
|
266
|
+
title: Chat & Q&A
|
|
267
|
+
features: [ai-chat, a2ui-integration, search]
|
|
268
|
+
extraction:
|
|
269
|
+
title: Document extraction
|
|
270
|
+
features: [document-pipeline, bbd-validation-rules]
|
|
232
271
|
```
|
|
233
272
|
|
|
234
|
-
The `directory` field links each doc back to the source directory —
|
|
273
|
+
The `directory` field links each doc back to the source directory — it's how a targeted refresh maps a changed directory to the area doc that describes it.
|
|
274
|
+
|
|
275
|
+
**Generate the `stories:` map.** Walk `features/`, then group the feature files by *functional story* — the user-facing capability area they serve, not the source directory. Propose the grouping to the user and let them rename/merge stories before writing. A feature not yet assigned to a story falls back to its feature-directory group in the OVERVIEW, so partial maps are fine. `stories` is the one place that grouping lives (DRY) — `grimoire docs` reads it, nothing else defines it.
|
|
235
276
|
|
|
236
277
|
### Freshness Tracking
|
|
237
278
|
|
|
@@ -262,36 +303,25 @@ areas:
|
|
|
262
303
|
### 8. Present Summary
|
|
263
304
|
After generating, show the user:
|
|
264
305
|
- How many areas documented
|
|
265
|
-
-
|
|
266
|
-
- Any areas that seem under-organized or have pattern inconsistencies
|
|
306
|
+
- Any areas whose boundaries seem unclear or whose conventions are inconsistent
|
|
267
307
|
- Suggest which area docs are most critical for the plan skill to read
|
|
268
308
|
|
|
269
|
-
## Config Files
|
|
270
|
-
|
|
271
|
-
Users can customize what gets scanned by editing files in `.grimoire/`:
|
|
272
|
-
|
|
273
|
-
- **`.grimoire/mapignore`** — directories/patterns to skip during scanning (like .gitignore). Edit to exclude vendor code, generated files, etc.
|
|
274
|
-
- **`.grimoire/mapkeys`** — key file definitions (format: `filename = type`). Edit to add project-specific indicators like `factories.py = test-factories` or `signals.py = django-signals`.
|
|
275
|
-
|
|
276
|
-
These are read by `grimoire map` and affect the snapshot this skill consumes.
|
|
277
|
-
|
|
278
309
|
## Integration with Other Skills
|
|
279
310
|
|
|
280
|
-
- The **plan** skill
|
|
281
|
-
- The **verify** skill can check new code against documented
|
|
311
|
+
- The **plan** skill reads `.grimoire/docs/` for Purpose/Boundaries/Conventions before generating tasks, and queries the **graph** for symbols and reusable utilities
|
|
312
|
+
- The **verify** skill can check new code against documented conventions
|
|
282
313
|
- The **audit** skill can trigger a discover pass as part of onboarding
|
|
283
|
-
-
|
|
314
|
+
- The **design** skill reads `.grimoire/docs/components.md` first to avoid generating duplicate components
|
|
315
|
+
- The **plan** skill gates on staleness for level 3-4 changes (when an area's *intent* doc lags its directory) and directs the user to run a targeted refresh before planning
|
|
284
316
|
|
|
285
317
|
## Important
|
|
286
|
-
- **Start from the
|
|
287
|
-
- **
|
|
288
|
-
- **Document what IS, not what should be.** This
|
|
289
|
-
- **Point, don't copy.** Reference
|
|
290
|
-
- **
|
|
291
|
-
- **
|
|
292
|
-
- **
|
|
293
|
-
- **Don't document the obvious.** Skip areas that are self-explanatory from file names alone. Focus on areas where an LLM would make mistakes.
|
|
294
|
-
- **Update, don't accumulate.** When refreshing, replace stale docs rather than appending. The docs should reflect the current codebase, not its history.
|
|
318
|
+
- **Start from the graph.** Use `get_architecture` to enumerate areas and `search_graph`/`trace_path` to understand each one. Read source files only to pin down intent the graph can't express.
|
|
319
|
+
- **Intent only — never transcribe structure.** Do not write Key Files lists, reusable-code inventories, or symbol tables into area docs. Those are derivable from the graph and would drift. The doc captures purpose, boundaries, and conventions; the doc points at the graph for everything else (DRY — one home per fact).
|
|
320
|
+
- **Document what IS, not what should be.** This describes the actual codebase, not aspirational standards. If the code is inconsistent, note it — don't paper over it.
|
|
321
|
+
- **Point, don't copy.** Reference one exemplar file per convention. Don't duplicate code into the docs.
|
|
322
|
+
- **Keep docs lean.** Each area doc should be scannable in 30 seconds. If it's too long, it's probably transcribing structure — cut it back to intent.
|
|
323
|
+
- **Don't document the obvious.** Skip areas self-explanatory from file names. Focus on areas where intent or boundaries are non-obvious.
|
|
324
|
+
- **Update, don't accumulate.** When refreshing, replace stale docs rather than appending.
|
|
295
325
|
|
|
296
326
|
## Done
|
|
297
327
|
When area docs, schema, context, and index are generated, the workflow is complete. Suggest `grimoire-audit` to document existing features and decisions as Gherkin specs and ADRs.
|
|
@@ -21,21 +21,37 @@ Draft or update Gherkin features and MADR architecture decisions collaboratively
|
|
|
21
21
|
- Bug report ("something is broken") → `grimoire-bug` or `grimoire-bug-report`
|
|
22
22
|
- Pure refactoring (no behavior change) → no grimoire artifact needed. Suggest an ADR only if architecturally significant.
|
|
23
23
|
- Config, deps, formatting → not grimoire territory. Just do it.
|
|
24
|
-
- If unclear
|
|
24
|
+
- If unclear, apply the jurisdiction table + admission test in step 1. Do NOT default to drafting a feature — default to finding the fact's correct home, and ask one clarifying question if the test is inconclusive.
|
|
25
25
|
|
|
26
26
|
## Workflow
|
|
27
27
|
|
|
28
|
-
### 1. Qualify the Request
|
|
29
|
-
Before doing anything, determine what kind of change this is:
|
|
28
|
+
### 1. Qualify the Request — Jurisdiction
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
- **Architectural** (trade-off, choice, structural) → draft MADR decision record
|
|
33
|
-
- **Both** → draft features AND decision records
|
|
34
|
-
- **Bug fix** → STOP. Tell the user: "The feature file already describes the correct behavior. Let's just fix the code."
|
|
35
|
-
- **Refactoring** → STOP. No behavior change = no grimoire artifact. Suggest an ADR only if it's a significant architectural shift.
|
|
36
|
-
- **Config/deps/formatting** → STOP. Not grimoire territory.
|
|
30
|
+
Before doing anything, route the change to the **one** artifact type that owns it. Each fact has exactly one home (see `../references/principles.md` — one right way, DRY). **The default is NOT "draft a feature."** The default is: figure out which home this fact belongs in.
|
|
37
31
|
|
|
38
|
-
|
|
32
|
+
| What the change is | Home | Not |
|
|
33
|
+
|--------------------|------|-----|
|
|
34
|
+
| **Actor-observable behavior** — an external actor does something and observes a result | `.feature` (Gherkin) | — |
|
|
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. | — |
|
|
42
|
+
|
|
43
|
+
#### The feature-file admission test
|
|
44
|
+
|
|
45
|
+
A scenario may be written **only if it passes all four gates.** If it fails any, it is not a feature — route it to the home above.
|
|
46
|
+
|
|
47
|
+
1. **External actor** — a user, operator, or external system does the thing. "As a developer, I want structured logs" / "the system retries" → fails. The actor is internal → it's a constraint or a decision, not a feature.
|
|
48
|
+
2. **Observable** — the actor can see the outcome without reading code or logs. "logs are scrubbed of PII", "request completes in <200ms" → fails (not observable by an actor) → constraint.
|
|
49
|
+
3. **Domain language** — the scenario uses domain nouns, zero implementation detail. If a step names a library, log level, function, table, or framework (`loguru`, `INFO`, `bcrypt`, `users` table) → fails → it's leaking implementation; rewrite declaratively or move to a constraint/MADR.
|
|
50
|
+
4. **Survives reimplementation** — if the internals were rewritten from scratch, would the scenario still read the same? If it would change, it's pinned to implementation → not a feature.
|
|
51
|
+
|
|
52
|
+
Common slop this catches (all belong in `constraints.md`, not `.feature`): "PII is scrubbed from logs", "all endpoints require auth", "responses are gzipped", "errors are logged with a trace id". These are invariants, not behaviors.
|
|
53
|
+
|
|
54
|
+
If unclear after applying the test, ask the user one clarifying question to route correctly. **Do not guess the routing and proceed.** A wrong routing wastes both your context and the user's time — one question costs less.
|
|
39
55
|
|
|
40
56
|
### 2. Score Complexity
|
|
41
57
|
|
|
@@ -63,7 +79,20 @@ Before designing, research what already exists. Do not ask the user to research
|
|
|
63
79
|
|
|
64
80
|
Follow the methodology in `../references/build-vs-buy.md`. Present findings to the user and wait for agreement before proceeding.
|
|
65
81
|
|
|
82
|
+
### 4.0 Design Input Check
|
|
83
|
+
|
|
84
|
+
Before interviewing, check whether design artifacts already exist for this change. If so, the interview is grounded in real components and states rather than imagined ones.
|
|
85
|
+
|
|
86
|
+
- **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 artifacts now. Treat them as authoritative for component shape, states, and visual tokens — do not re-query Figma.
|
|
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.
|
|
89
|
+
|
|
90
|
+
When design input is consumed (either path), carry the extracted component list, states, and any token references into the elicitation in step 4 — these become concrete anchors for the questions you ask the user, replacing generic prompts.
|
|
91
|
+
|
|
66
92
|
### 4. Elicit Requirements
|
|
93
|
+
|
|
94
|
+
**Interview, don't assume.** The most common drafting failure is filling in gaps with plausible-sounding guesses. Every unstated detail is either (a) something the user has an opinion on and you must ask, or (b) something project conventions answer unambiguously. Never a third option where you invent.
|
|
95
|
+
|
|
67
96
|
Now that you know whether you're building, adopting, or going hybrid, surface the requirements the user hasn't specified.
|
|
68
97
|
|
|
69
98
|
- **Level 1**: Skip this step.
|
|
@@ -74,6 +103,24 @@ The build-vs-buy outcome shapes which questions matter:
|
|
|
74
103
|
- **Building custom**: Full elicitation — business rules, edge cases, data contracts, security, NFRs.
|
|
75
104
|
- **Hybrid**: Elicit deeply for custom parts. For adopted parts, focus on integration boundaries.
|
|
76
105
|
|
|
106
|
+
#### Interview protocol
|
|
107
|
+
|
|
108
|
+
1. **Outcome & Non-goals first.** Always ask these two before any persona questions — they set scope. Restate the answers back to the user before continuing.
|
|
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.
|
|
115
|
+
|
|
116
|
+
#### Open-question discipline
|
|
117
|
+
|
|
118
|
+
After the interview, list every open question that wasn't answered. These become:
|
|
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.
|
|
121
|
+
|
|
122
|
+
Never silently fill in an open question. Either ask, defer to a non-goal, or record the inference.
|
|
123
|
+
|
|
77
124
|
Present a Requirements Summary (template in the reference) and wait for user confirmation before proceeding.
|
|
78
125
|
|
|
79
126
|
### 5. Check Existing State
|
|
@@ -82,15 +129,56 @@ Present a Requirements Summary (template in the reference) and wait for user con
|
|
|
82
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)
|
|
83
130
|
- Check `.grimoire/changes/` for any in-progress changes that might overlap
|
|
84
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.
|
|
85
133
|
|
|
86
134
|
### 6. Scaffold the Change
|
|
87
135
|
- Choose a `change-id`: kebab-case, verb-led (`add-`, `update-`, `remove-`)
|
|
88
|
-
-
|
|
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.
|
|
89
138
|
|
|
90
139
|
### 7. Draft Artifacts
|
|
91
140
|
**For behavioral changes:**
|
|
92
|
-
|
|
93
|
-
|
|
141
|
+
|
|
142
|
+
Before writing any `.feature` file, triage existing files. **The default is always extend. New files are the exception and require explicit justification.**
|
|
143
|
+
|
|
144
|
+
**Step 1 — List existing feature files (required, not skippable)**
|
|
145
|
+
|
|
146
|
+
Read `features/` recursively. Print a table before doing anything else:
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
Existing feature files:
|
|
150
|
+
features/auth/login.feature — "User Login"
|
|
151
|
+
features/auth/registration.feature — "User Registration"
|
|
152
|
+
features/billing/invoices.feature — "Invoice Management"
|
|
153
|
+
...
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
If `features/` is empty or doesn't exist, skip to step 3.
|
|
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:
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
Scenario triage:
|
|
164
|
+
"Admin resets a user's password" → extend features/auth/login.feature (same actor domain: auth)
|
|
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)
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Do not proceed to writing until this table is complete. If unsure about a match, default to extend.
|
|
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.
|
|
177
|
+
|
|
178
|
+
Signals a scenario belongs in an existing file: same actor, same domain object, same entry point, same HTTP resource or screen.
|
|
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.
|
|
180
|
+
|
|
181
|
+
- Every scenario must have passed the **admission test** in step 1. If you catch yourself writing a step that names a library/log-level/table, stop — that fact belongs in `constraints.md`, not here.
|
|
94
182
|
- Follow Gherkin best practices:
|
|
95
183
|
- Feature title + user story (As a / I want / So that)
|
|
96
184
|
- Background for shared preconditions
|
|
@@ -98,13 +186,36 @@ Present a Requirements Summary (template in the reference) and wait for user con
|
|
|
98
186
|
- Given/When/Then — describe WHAT, never HOW
|
|
99
187
|
- No implementation details in feature files
|
|
100
188
|
|
|
189
|
+
**When design data was provided (step 4.0):**
|
|
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).
|
|
193
|
+
|
|
194
|
+
**Brand-tokens grounding:**
|
|
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
|
+
|
|
101
202
|
**Security tags on scenarios:**
|
|
102
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.
|
|
103
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
|
+
|
|
104
214
|
**For architecture decisions:**
|
|
105
|
-
- Write MADR record
|
|
215
|
+
- Write the MADR record directly into the live `.grimoire/decisions/` with the next sequential number (`NNNN-title.md`)
|
|
106
216
|
- Use the template from `.grimoire/decisions/template.md` or the AGENTS.md format
|
|
107
217
|
- Include considered options, decision drivers, and consequences
|
|
218
|
+
- Draft status `proposed`; `grimoire-apply` flips it to `accepted` at finalize
|
|
108
219
|
|
|
109
220
|
**For changes that touch data:**
|
|
110
221
|
- Check `.grimoire/docs/data/schema.yml` for the current data schema (if it exists)
|
|
@@ -189,12 +300,17 @@ This is the contract. Downstream skills (plan, review, verify) use it to generat
|
|
|
189
300
|
- Every Feature has a user story
|
|
190
301
|
- Every Scenario has at least Given + When + Then
|
|
191
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).
|
|
192
305
|
|
|
193
306
|
## Important
|
|
194
307
|
- ONE change at a time. Don't combine unrelated changes.
|
|
195
|
-
- Features describe behavior, not implementation
|
|
308
|
+
- **Features describe actor-observable behavior, not implementation, and not invariants.** If a scenario has no external actor, isn't observable, or names a library/log-level/table, it is not a feature — it's a constraint (→ `constraints.md`) or a decision (→ MADR). This is the #1 source of feature-file slop.
|
|
309
|
+
- **One fact, one home** (`../references/principles.md`). A capability lives in one `.feature`; a control lives in one constraint row; a decision lives in one MADR. Never the same fact in two places.
|
|
310
|
+
- Artifacts are edited **live on the branch** — never copied into `.grimoire/changes/`. git diff is the staging area.
|
|
196
311
|
- The manifest is lightweight glue — don't over-document. Just enough to capture why.
|
|
197
312
|
- Always check if a capability/feature already exists before creating a new one.
|
|
313
|
+
- **Figma access token is read from `FIGMA_ACCESS_TOKEN` env var by the MCP server.** Never log the token, never write it to config, never include it in `manifest.md`, `consult.md`, `figma-snapshot.json`, or any other artifact. The MCP server handles authentication transparently — grimoire-draft never needs to see the token value.
|
|
198
314
|
|
|
199
315
|
## Done
|
|
200
316
|
When the user approves the draft, the workflow is complete. Present the change directory path and suggest next steps:
|