mustard-claude 3.1.6 → 3.1.8
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/package.json +1 -1
- package/templates/CLAUDE.md +1 -1
- package/templates/commands/mustard/approve/SKILL.md +2 -2
- package/templates/commands/mustard/bugfix/SKILL.md +2 -2
- package/templates/commands/mustard/complete/SKILL.md +5 -2
- package/templates/commands/mustard/feature/SKILL.md +69 -9
- package/templates/commands/mustard/knowledge/SKILL.md +1 -1
- package/templates/commands/mustard/maint/SKILL.md +68 -68
- package/templates/commands/mustard/metrics/SKILL.md +33 -0
- package/templates/commands/mustard/resume/SKILL.md +11 -7
- package/templates/commands/mustard/review/SKILL.md +113 -102
- package/templates/commands/mustard/scan/SKILL.md +2 -2
- package/templates/commands/mustard/scan-format/SKILL.md +1 -1
- package/templates/hooks/__tests__/integration.test.js +316 -0
- package/templates/hooks/context-budget.js +142 -14
- package/templates/hooks/pre-compact.js +34 -0
- package/templates/hooks/session-knowledge-inc.js +6 -0
- package/templates/hooks/spec-hygiene.js +113 -0
- package/templates/scripts/_metrics-write.js +27 -0
- package/templates/scripts/analyze-validation.js +98 -0
- package/templates/scripts/metrics-report.js +70 -0
- package/templates/settings.json +11 -0
- package/templates/skills/pipeline-execution/SKILL.md +1 -1
- package/templates/.claude/commands/guards.md +0 -76
- package/templates/.claude/commands/notes.md +0 -22
- package/templates/.claude/commands/patterns.md +0 -173
- package/templates/.claude/commands/recipes.md +0 -91
- package/templates/.claude/commands/stack.md +0 -86
- package/templates/.claude/skills/templates-command-authoring/SKILL.md +0 -88
- package/templates/.claude/skills/templates-command-authoring/references/examples.md +0 -83
- package/templates/.claude/skills/templates-hook-protocol/SKILL.md +0 -73
- package/templates/.claude/skills/templates-hook-protocol/references/examples.md +0 -74
- package/templates/.claude/skills/templates-settings-wiring/SKILL.md +0 -75
- package/templates/.claude/skills/templates-settings-wiring/references/examples.md +0 -59
- package/templates/.claude/skills/templates-skill-authoring/SKILL.md +0 -97
- package/templates/.claude/skills/templates-skill-authoring/references/examples.md +0 -69
- package/templates/.claude/skills/templates-sync-detect/SKILL.md +0 -62
- package/templates/.claude/skills/templates-sync-detect/references/examples.md +0 -55
package/package.json
CHANGED
package/templates/CLAUDE.md
CHANGED
|
@@ -87,4 +87,4 @@ RTK (Rust Token Killer) is integrated as core infrastructure. A PreToolUse hook
|
|
|
87
87
|
- If RTK is not installed, the hook silently passes through (zero impact)
|
|
88
88
|
|
|
89
89
|
## Full Reference
|
|
90
|
-
Rules, pipeline, naming:
|
|
90
|
+
Rules, pipeline, naming: `.claude/pipeline-config.md`
|
|
@@ -18,7 +18,7 @@ Approves the active spec and prepares the implementation phase. Does NOT execute
|
|
|
18
18
|
1. **Step 0: AUTO-SYNC (MANDATORY)** — Run via Bash tool BEFORE any other action:
|
|
19
19
|
- `node .claude/scripts/sync-registry.js`
|
|
20
20
|
- Do NOT proceed to step 2 without running this command
|
|
21
|
-
2. **Read**
|
|
21
|
+
2. **Read** `.claude/pipeline-config.md` — agents, model selection
|
|
22
22
|
3. Locate active spec in `.claude/spec/active/`
|
|
23
23
|
4. **Spec Checkpoint — update spec header:**
|
|
24
24
|
- `### Status: approved`
|
|
@@ -29,7 +29,7 @@ Approves the active spec and prepares the implementation phase. Does NOT execute
|
|
|
29
29
|
- Parse Tasks from spec to extract tasks per agent (DB, Backend, Frontend, etc.)
|
|
30
30
|
- Create `.claude/.pipeline-states/` directory if it doesn't exist
|
|
31
31
|
- Write state file with `specName`, `status: "approved"`, `phaseName: "PLAN"`, `tasks` with names and agents, `model`, `updatedAt`
|
|
32
|
-
6. **Model selection** — read `Model Selection` from
|
|
32
|
+
6. **Model selection** — read `Model Selection` from `.claude/pipeline-config.md` and record `"model"` field in state:
|
|
33
33
|
- Count total estimated files in spec
|
|
34
34
|
- Apply rule: ≤5 files/known patterns → `"model": "sonnet"`, 5+ files/new patterns → `"model": "opus"`
|
|
35
35
|
7. **Task Tracking — create TaskCreate for each agent:**
|
|
@@ -87,7 +87,7 @@ Rules:
|
|
|
87
87
|
### EXECUTE (fix + validate)
|
|
88
88
|
|
|
89
89
|
Every agent prompt dispatched in Fast Path MUST include:
|
|
90
|
-
`Return format cap: ≤50 lines. Apply compact Return Format from pipeline-config.md strictly.`
|
|
90
|
+
`Return format cap: ≤50 lines. Apply compact Return Format from .claude/pipeline-config.md strictly.`
|
|
91
91
|
|
|
92
92
|
Dispatch bugfix agent with:
|
|
93
93
|
- Root cause from ANALYZE
|
|
@@ -110,7 +110,7 @@ After the bugfix agent returns, check for an escalation status before closing:
|
|
|
110
110
|
- `PARTIAL` — agent fixed some but not all reported issues; resume from the last incomplete fix step (max 2 retries)
|
|
111
111
|
- `DEFERRED` — agent intentionally left a related issue unfixed with justification; confirm with user before closing
|
|
112
112
|
|
|
113
|
-
See
|
|
113
|
+
See `.claude/pipeline-config.md` Escalation Statuses for the full status table.
|
|
114
114
|
|
|
115
115
|
#### Retry Compact Advisory
|
|
116
116
|
If an agent fails and requires >2 retry attempts during EXECUTE:
|
|
@@ -11,7 +11,7 @@ Finalizes the current pipeline, either completing or canceling.
|
|
|
11
11
|
## Verification Gate (MANDATORY)
|
|
12
12
|
|
|
13
13
|
1. **Review completed**: Check pipeline state — review agent MUST have run and returned APPROVED. If not → dispatch review first (see resume.md step 19)
|
|
14
|
-
2. **Build passes**: run build command for each affected subproject (from pipeline-config.md)
|
|
14
|
+
2. **Build passes**: run build command for each affected subproject (from .claude/pipeline-config.md)
|
|
15
15
|
3. **Changes match spec**: each `[x]` corresponds to a real file
|
|
16
16
|
4. **Zero CRITICAL issues**: review report shows zero CRITICAL violations (SOLID, design system, patterns, i18n, integration)
|
|
17
17
|
5. **No regressions**: existing features still work
|
|
@@ -32,6 +32,8 @@ node .claude/scripts/verify-pipeline.js "$PROJECT_DIR"
|
|
|
32
32
|
|
|
33
33
|
If ANY gate fails: do NOT mark complete → report what failed + suggest fix. If review wasn't run → run it now before completing.
|
|
34
34
|
|
|
35
|
+
Re-reviews always dispatch with `model: "sonnet"` (see `review/SKILL.md § Model Selection`).
|
|
36
|
+
|
|
35
37
|
#### Surface Accumulated Concerns
|
|
36
38
|
|
|
37
39
|
Before finalizing, scan the active spec for any `## Concerns` section written during EXECUTE:
|
|
@@ -41,7 +43,7 @@ Before finalizing, scan the active spec for any `## Concerns` section written du
|
|
|
41
43
|
- If all concerns are `CONCERN` or `DEFERRED` (non-blocking): note them and proceed
|
|
42
44
|
- This step is a read-only scan — do NOT alter or dismiss concerns during CLOSE
|
|
43
45
|
|
|
44
|
-
See
|
|
46
|
+
See `.claude/pipeline-config.md` Escalation Statuses for concern classification rules.
|
|
45
47
|
|
|
46
48
|
## Action
|
|
47
49
|
|
|
@@ -54,6 +56,7 @@ See `pipeline-config.md` Escalation Statuses for concern classification rules.
|
|
|
54
56
|
- Mark all remaining `[ ]` as `[x]`
|
|
55
57
|
4. **Entity Registry — update if needed:**
|
|
56
58
|
- `node .claude/scripts/sync-registry.js`
|
|
59
|
+
- **Schema-aware refresh (conditional):** If the spec's `## Files` section touched any file matching `*.schema.ts`, `*.entity.ts`, `*.prisma`, `*DbContext*.cs`, or `schema.rs`, run `rtk node .claude/scripts/sync-registry.js` to refresh `entity-registry.json`. If sync-registry fails (non-zero exit or script missing), log a warning and continue with close — this step is non-blocking.
|
|
57
60
|
5. **Move spec** from `.claude/spec/active/` to `.claude/spec/completed/`
|
|
58
61
|
6. **Pipeline State — cleanup:**
|
|
59
62
|
- Extract `spec-name` from the spec directory (e.g. `2026-02-26-linked-services-card`)
|
|
@@ -53,7 +53,7 @@ Prepend the following to EVERY subagent prompt dispatched during the pipeline:
|
|
|
53
53
|
|
|
54
54
|
If the diff file is empty or missing, skip the Git State header entirely. Never dispatch an agent without attempting interpolation.
|
|
55
55
|
|
|
56
|
-
1. Read
|
|
56
|
+
1. Read `.claude/pipeline-config.md` — agents, wave transitions, model selection
|
|
57
57
|
2. Read `entity-registry.json` via Grep for the specific entity name (e.g. `"Contract":`) — NEVER read the full JSON. Entity found? infer layers. Not found? all layers.
|
|
58
58
|
3. Determine layers from signals:
|
|
59
59
|
|
|
@@ -104,6 +104,12 @@ After ANALYZE completes, if the analysis required heavy exploration (>8 file rea
|
|
|
104
104
|
- Suggest to user: _"Analysis complete. Context is heavy — consider `/compact` before we proceed to implementation, then `/resume`."_
|
|
105
105
|
- This is advisory only — proceed immediately if user declines or ignores.
|
|
106
106
|
|
|
107
|
+
### End of ANALYZE — Validation
|
|
108
|
+
|
|
109
|
+
Run: `rtk node .claude/scripts/analyze-validation.js --spec .claude/spec/active/{specName}/spec.md`
|
|
110
|
+
If output `ok: false`, append each `issues[]` entry to the spec under `## Concerns` (non-blocking).
|
|
111
|
+
Continue to PLAN regardless.
|
|
112
|
+
|
|
107
113
|
### PLAN Phase
|
|
108
114
|
|
|
109
115
|
#### Full Scope
|
|
@@ -161,18 +167,70 @@ Rules:
|
|
|
161
167
|
- Be specific: prefer exact files over broad directories when the change is known
|
|
162
168
|
- Out-of-boundary edits during EXECUTE will surface a `[BOUNDARY WARNING]` from guard-verify — treat as a signal to re-evaluate, not an error to suppress
|
|
163
169
|
|
|
170
|
+
### Pre-EXECUTE Existence Gate (Full scope only)
|
|
171
|
+
|
|
172
|
+
**Skip conditions**: Light scope OR `## Files` section lists more than 8 files (cost-benefit inverts — Haiku 10-tool-use cap will not cover).
|
|
173
|
+
|
|
174
|
+
Before dispatching implementation agents, run 1 Haiku explorer to verify the work is still needed.
|
|
175
|
+
|
|
176
|
+
**Pre-check (free, zero LLM tokens)**: Before dispatching Haiku, run:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
rtk git diff --stat HEAD -- <files listed in `## Files` of spec>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Skip rules based on pre-check output:
|
|
183
|
+
- **Empty output** (no changes) → skip gate entirely, proceed to EXECUTE normally (nothing to verify)
|
|
184
|
+
- **<10 total insertions/deletions** → skip gate entirely, proceed to EXECUTE normally (trivial changes, verification not worth the overhead)
|
|
185
|
+
- **≥10 insertions/deletions** → proceed with Haiku dispatch below
|
|
186
|
+
|
|
187
|
+
**Dispatch:**
|
|
188
|
+
|
|
189
|
+
```javascript
|
|
190
|
+
Task({
|
|
191
|
+
subagent_type: "Explore",
|
|
192
|
+
model: "haiku",
|
|
193
|
+
description: "Pre-EXECUTE existence check",
|
|
194
|
+
prompt: `# EXISTENCE CHECK
|
|
195
|
+
Read .claude/spec/active/{specName}/spec.md sections: "## Files" and "## Checklist".
|
|
196
|
+
|
|
197
|
+
For EACH checklist task (task-level, NOT file-level):
|
|
198
|
+
1. Extract 1-3 concrete identifiers from the task text — function names, component names, file path fragments, string literals.
|
|
199
|
+
Example: task "Add LogoutButton component with handleLogout handler" → identifiers: ["LogoutButton", "handleLogout"].
|
|
200
|
+
2. Identify target files for the task from "## Files" (match by extension, name hint, or task context).
|
|
201
|
+
3. Grep each target file for the identifiers.
|
|
202
|
+
4. Verdict for this task:
|
|
203
|
+
- ALL target files contain a MAJORITY of identifiers → all_present=yes
|
|
204
|
+
- SOME do, SOME do not → all_present=partial
|
|
205
|
+
- NONE do → all_present=no
|
|
206
|
+
|
|
207
|
+
Return a markdown table:
|
|
208
|
+
| task | target_files | all_present | evidence |
|
|
209
|
+
|------|--------------|-------------|----------|
|
|
210
|
+
| <task text> | <comma-sep files> | yes/partial/no | <identifier:line or "none"> |
|
|
211
|
+
|
|
212
|
+
Return ≤20 lines total. Self-cap: ≤10 tool uses (the tool-use budget is the true limit, not the task count).`
|
|
213
|
+
})
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**Decision after return (orchestrator inspects the returned table):**
|
|
217
|
+
|
|
218
|
+
- **All tasks `all_present=no`** → Gate is transparent. Proceed to EXECUTE normally.
|
|
219
|
+
- **Mixed** (any combination that is NOT all-no AND NOT all-yes — includes all-partial, yes+no, partial+no, yes+partial, yes+partial+no) → Edit the spec: mark `[x]` on tasks where `all_present=yes`. Leave `[ ]` on `partial` and `no` (both require re-dispatch). Re-dispatch EXECUTE only for tasks still `[ ]`. Keep the original scope (Light/Full). Do NOT invent a new "PARTIAL" state.
|
|
220
|
+
- **All tasks `all_present=yes`** → **MANDATORY user surface** via `AskUserQuestion`: _"Pre-EXECUTE Existence Gate detected all N tasks already implemented. Evidence: {inline table}. Choose: (a) Close as already-implemented, (b) Force EXECUTE anyway (the gate may be wrong), (c) Abort pipeline."_ Never silently skip EXECUTE.
|
|
221
|
+
|
|
164
222
|
### EXECUTE Phase (Light scope — same session)
|
|
165
223
|
|
|
166
224
|
When user chooses "Approve and implement now":
|
|
167
225
|
1. Update spec: `Status: implementing`, `Phase: EXECUTE`
|
|
168
226
|
Every agent prompt dispatched in Light scope MUST include:
|
|
169
|
-
`Return format cap: ≤50 lines. Apply compact Return Format from pipeline-config.md strictly.`
|
|
227
|
+
`Return format cap: ≤50 lines. Apply compact Return Format from .claude/pipeline-config.md strictly.`
|
|
170
228
|
2. Update pipeline state: `status: "implementing"`, `phase: 3`
|
|
171
|
-
3. Read
|
|
229
|
+
3. Read `.claude/pipeline-config.md` for agent config. For `entity-registry.json`: Grep for specific entity block only
|
|
172
230
|
4. Match recipes by title via Grep on `{subproject}/.claude/commands/recipes.md` — do NOT read full file. Extract recipe number + pattern refs
|
|
173
231
|
5. Identify relevant skills for `{recommended_skills}`: list skill names most relevant to the task (e.g., `api-endpoint-wiring, api-dto-validation`). Agents use these as hints — Claude natively decides which to load based on descriptions
|
|
174
|
-
6. Dispatch agents (wave rules: DB+Backend parallel, Frontend after Backend UNLESS spec marks task as `(parallel-safe)` — see
|
|
175
|
-
7. Wave transitions between waves (from
|
|
232
|
+
6. Dispatch agents (wave rules: DB+Backend parallel, Frontend after Backend UNLESS spec marks task as `(parallel-safe)` — see `.claude/pipeline-config.md` Parallel Rules). Agent prompt includes `{recommended_skills}` as skill hints — agents read SKILL.md of relevant skills before implementing
|
|
233
|
+
7. Wave transitions between waves (from `.claude/pipeline-config.md`)
|
|
176
234
|
8. On return: validate (build/type-check), update spec `[ ]` → `[x]` (line-by-line edits, NEVER copy entire spec blocks as old_string)
|
|
177
235
|
8b. **Agent Memory:** After agents return and spec is updated, write agent memory: `node .claude/scripts/memory-write.js --json '{"agent_type":"{type}","wave":{N},"pipeline":"{spec-name}","summary":"{what agent did}","details":{...}}'` — one per agent. Skip if single-wave pipeline (no downstream agents to benefit).
|
|
178
236
|
|
|
@@ -186,9 +244,11 @@ After each agent returns, check the return value for an escalation status before
|
|
|
186
244
|
- `PARTIAL` — apply Granular Retry Protocol from the last completed step; do NOT restart from step 1
|
|
187
245
|
- `DEFERRED` — note in spec with agent justification; ask user if the deferred item is load-bearing before closing
|
|
188
246
|
|
|
189
|
-
If two or more agents in the same wave return `CONCERN`, surface all concerns together before starting the next wave. See
|
|
247
|
+
If two or more agents in the same wave return `CONCERN`, surface all concerns together before starting the next wave. See `.claude/pipeline-config.md` Escalation Statuses and Diagnostic Failure Routing for the full status table.
|
|
248
|
+
|
|
249
|
+
9. **REVIEW** — dispatch review agent for each affected subproject (reads guards + relevant skills, runs 7-category checklist: SOLID, Design System, Patterns, i18n, Integration, Build, Elegance). REJECTED → fix + re-review (max 2 loops).
|
|
190
250
|
|
|
191
|
-
|
|
251
|
+
Re-reviews always dispatch with `model: "sonnet"` (see `review/SKILL.md § Model Selection`).
|
|
192
252
|
10. All passed + APPROVED → CLOSE flow inline (sync registry, move spec, cleanup state)
|
|
193
253
|
11. Failed → max 2 retries, then STOP + report
|
|
194
254
|
|
|
@@ -208,13 +268,13 @@ Progress: `[v] ANALYZE [>] PLAN [ ] EXECUTE [ ] CLOSE`
|
|
|
208
268
|
Scope tag: `[LIGHT]` or `[FULL]` after progress line.
|
|
209
269
|
|
|
210
270
|
## Rules
|
|
211
|
-
- This command is self-contained — reads
|
|
271
|
+
- This command is self-contained — reads `.claude/pipeline-config.md` directly
|
|
212
272
|
- NEVER implement code in Full scope — only PLAN. EXECUTE via `/approve` + `/resume`
|
|
213
273
|
- NEVER launch Explore agent when entity already exists in registry — read 2-3 files directly
|
|
214
274
|
- NEVER read additional files after Explore agent returns — its output is final
|
|
215
275
|
- NEVER exceed 5 file reads in ANALYZE phase (registry + pipeline-config are free)
|
|
216
276
|
- Light scope + user chose "implement now" → proceed to EXECUTE inline
|
|
217
|
-
- ALWAYS read
|
|
277
|
+
- ALWAYS read `.claude/pipeline-config.md` for agent/wave/model info
|
|
218
278
|
- ALWAYS create pipeline state at PLAN phase
|
|
219
279
|
- ALWAYS record `scope` in spec header AND pipeline state
|
|
220
280
|
- ALWAYS go straight to PLAN once you understand the change — more reads ≠ better spec
|
|
@@ -103,7 +103,7 @@ Manages persistent project observations injected into agent context during pipel
|
|
|
103
103
|
| (no argument) | — | Lists all notes files |
|
|
104
104
|
| `{subproject}` | `{subproject}/.claude/commands/notes.md` | Subproject agent context |
|
|
105
105
|
|
|
106
|
-
**Monorepo**: discover targets from
|
|
106
|
+
**Monorepo**: discover targets from `.claude/pipeline-config.md` Agents table or Glob `*/.claude/commands/notes.md`.
|
|
107
107
|
**Single repo**: target is root → `.claude/commands/notes.md`.
|
|
108
108
|
|
|
109
109
|
### Flow — List (`/knowledge notes`)
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
# /maint - Maintenance Utilities
|
|
2
|
-
|
|
3
|
-
> Dependencies, build validation, and registry sync.
|
|
4
|
-
|
|
5
|
-
## Trigger
|
|
6
|
-
|
|
7
|
-
`/maint <action>`
|
|
8
|
-
|
|
9
|
-
## Actions
|
|
10
|
-
|
|
11
|
-
| Action | Description |
|
|
12
|
-
|--------|-------------|
|
|
13
|
-
| `deps` | Install dependencies for all projects |
|
|
14
|
-
| `validate` | Run build and type-check validations |
|
|
15
|
-
| `sync` | Update entity-registry.json from code |
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## deps
|
|
20
|
-
|
|
21
|
-
Installs dependencies. Monorepo: runs in all subprojects. Single repo: runs in root.
|
|
22
|
-
|
|
23
|
-
### Flow
|
|
24
|
-
|
|
25
|
-
1. Read
|
|
26
|
-
2. For each subproject (or root if single repo), run the restore/install command from `## Commands` in `{subproject}/CLAUDE.md`
|
|
27
|
-
3. Run all in parallel
|
|
28
|
-
|
|
29
|
-
**Single repo**: read root `CLAUDE.md` → `## Commands` → run the install/restore command.
|
|
30
|
-
|
|
31
|
-
---
|
|
32
|
-
|
|
33
|
-
## validate
|
|
34
|
-
|
|
35
|
-
Runs build and type-check validations.
|
|
36
|
-
|
|
37
|
-
### Flow
|
|
38
|
-
|
|
39
|
-
1. Read
|
|
40
|
-
2. For each subproject (or root if single repo), run the build/type-check command from `{subproject}/CLAUDE.md` → `## Commands`
|
|
41
|
-
3. Run all in parallel
|
|
42
|
-
|
|
43
|
-
### Result
|
|
44
|
-
|
|
45
|
-
- **Success** — project compiles and passes type-check
|
|
46
|
-
- **Failure** — lists errors found
|
|
47
|
-
|
|
48
|
-
**Single repo**: read root `CLAUDE.md` → `## Commands` → run the build command.
|
|
49
|
-
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
## sync
|
|
53
|
-
|
|
54
|
-
Scans the project and updates `.claude/entity-registry.json`.
|
|
55
|
-
|
|
56
|
-
### Flow
|
|
57
|
-
|
|
58
|
-
1. `node .claude/scripts/sync-registry.js`
|
|
59
|
-
2. If script not found, scan manually:
|
|
60
|
-
- Search database schemas (EF Core `DbSet<T>`, Drizzle `pgTable()`, Prisma `model`, etc.)
|
|
61
|
-
- Build entity map with relationships
|
|
62
|
-
- Update `.claude/entity-registry.json`
|
|
63
|
-
|
|
64
|
-
### When to Use
|
|
65
|
-
|
|
66
|
-
- After creating new entity
|
|
67
|
-
- After importing existing code
|
|
68
|
-
- To sync after manual changes
|
|
1
|
+
# /maint - Maintenance Utilities
|
|
2
|
+
|
|
3
|
+
> Dependencies, build validation, and registry sync.
|
|
4
|
+
|
|
5
|
+
## Trigger
|
|
6
|
+
|
|
7
|
+
`/maint <action>`
|
|
8
|
+
|
|
9
|
+
## Actions
|
|
10
|
+
|
|
11
|
+
| Action | Description |
|
|
12
|
+
|--------|-------------|
|
|
13
|
+
| `deps` | Install dependencies for all projects |
|
|
14
|
+
| `validate` | Run build and type-check validations |
|
|
15
|
+
| `sync` | Update entity-registry.json from code |
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## deps
|
|
20
|
+
|
|
21
|
+
Installs dependencies. Monorepo: runs in all subprojects. Single repo: runs in root.
|
|
22
|
+
|
|
23
|
+
### Flow
|
|
24
|
+
|
|
25
|
+
1. Read `.claude/pipeline-config.md` → extract `Agents` table for subproject paths and install commands
|
|
26
|
+
2. For each subproject (or root if single repo), run the restore/install command from `## Commands` in `{subproject}/CLAUDE.md`
|
|
27
|
+
3. Run all in parallel
|
|
28
|
+
|
|
29
|
+
**Single repo**: read root `CLAUDE.md` → `## Commands` → run the install/restore command.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## validate
|
|
34
|
+
|
|
35
|
+
Runs build and type-check validations.
|
|
36
|
+
|
|
37
|
+
### Flow
|
|
38
|
+
|
|
39
|
+
1. Read `.claude/pipeline-config.md` → extract `Agents` table for validate/build commands
|
|
40
|
+
2. For each subproject (or root if single repo), run the build/type-check command from `{subproject}/CLAUDE.md` → `## Commands`
|
|
41
|
+
3. Run all in parallel
|
|
42
|
+
|
|
43
|
+
### Result
|
|
44
|
+
|
|
45
|
+
- **Success** — project compiles and passes type-check
|
|
46
|
+
- **Failure** — lists errors found
|
|
47
|
+
|
|
48
|
+
**Single repo**: read root `CLAUDE.md` → `## Commands` → run the build command.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## sync
|
|
53
|
+
|
|
54
|
+
Scans the project and updates `.claude/entity-registry.json`.
|
|
55
|
+
|
|
56
|
+
### Flow
|
|
57
|
+
|
|
58
|
+
1. `node .claude/scripts/sync-registry.js`
|
|
59
|
+
2. If script not found, scan manually:
|
|
60
|
+
- Search database schemas (EF Core `DbSet<T>`, Drizzle `pgTable()`, Prisma `model`, etc.)
|
|
61
|
+
- Build entity map with relationships
|
|
62
|
+
- Update `.claude/entity-registry.json`
|
|
63
|
+
|
|
64
|
+
### When to Use
|
|
65
|
+
|
|
66
|
+
- After creating new entity
|
|
67
|
+
- After importing existing code
|
|
68
|
+
- To sync after manual changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mustard:metrics
|
|
3
|
+
description: Show enforcement metrics report — hook hit rates, budget distributions, gate activity. Metrics are recorded automatically; just run this to see them.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /mustard:metrics - Show Metrics Report
|
|
7
|
+
|
|
8
|
+
## Trigger
|
|
9
|
+
`/mustard:metrics [--since <ISO date>] [--event <type>]`
|
|
10
|
+
|
|
11
|
+
## What it does
|
|
12
|
+
Runs `.claude/scripts/metrics-report.js` and shows the aggregated report.
|
|
13
|
+
|
|
14
|
+
Metrics are recorded **automatically** by enforcement hooks on every Task dispatch — no activation needed. Just run this command whenever you want to see the current state.
|
|
15
|
+
|
|
16
|
+
## Action
|
|
17
|
+
1. Run `rtk node .claude/scripts/metrics-report.js $ARGS` (pass through any flags)
|
|
18
|
+
2. Display output verbatim
|
|
19
|
+
|
|
20
|
+
## Optional flags
|
|
21
|
+
- `--since <ISO date>` — filter events after this date
|
|
22
|
+
- `--event <type>` — filter to one event type (e.g. `budget-check`)
|
|
23
|
+
|
|
24
|
+
## Examples
|
|
25
|
+
- `/mustard:metrics` — full report since beginning
|
|
26
|
+
- `/mustard:metrics --since 2026-04-09` — only recent events
|
|
27
|
+
- `/mustard:metrics --event budget-check` — only budget-check events
|
|
28
|
+
|
|
29
|
+
## Notes
|
|
30
|
+
- Metrics live in `.claude/.metrics/*.jsonl` (gitignored, runtime state)
|
|
31
|
+
- Logs auto-rotate at 10MB
|
|
32
|
+
- To reset: delete files in `.claude/.metrics/` manually
|
|
33
|
+
- Advanced: override mode via `CONTEXT_BUDGET_MODE` env var (`strict`|`warn`|`observe`). Default is `strict`.
|
|
@@ -87,7 +87,7 @@ Before the normal detect-and-confirm flow, scan the newest pipeline state for a
|
|
|
87
87
|
### Diff Context (automatic)
|
|
88
88
|
Run `node .claude/scripts/diff-context.js` to capture the current git state. Include the output in the agent prompt as `{diff_context}` so agents know what has already changed.
|
|
89
89
|
|
|
90
|
-
7. **Read**
|
|
90
|
+
7. **Read** `.claude/pipeline-config.md`. For `entity-registry.json`: use Grep to extract ONLY the relevant entity block (e.g. `"Contract":`), NEVER read the full JSON
|
|
91
91
|
9. **Update spec header:** `Status: implementing`, `Phase: EXECUTE`, `Checkpoint: {ISO now}`
|
|
92
92
|
10. **Update/create pipeline state:** `status: "implementing"`, `phaseName: "EXECUTE"`, `specName`
|
|
93
93
|
11. **TaskCreate** — 1 per pending agent (skip completed)
|
|
@@ -97,9 +97,13 @@ Run `node .claude/scripts/diff-context.js` to capture the current git state. Inc
|
|
|
97
97
|
**CRITICAL: Main context IS the Pipeline Runner. NEVER delegate to intermediate Task agent.**
|
|
98
98
|
|
|
99
99
|
12. **Match recipe by name only:** Grep `{subproject}/.claude/commands/recipes.md` for recipe title matching the task type — do NOT read the full recipes file. Extract only: recipe number, pattern refs, reference modules
|
|
100
|
-
|
|
100
|
+
12b. **Pre-EXECUTE Existence Gate**: Same gate as `feature/SKILL.md § Pre-EXECUTE Existence Gate`. Invoke identically (Full scope only, `## Files` ≤ 8). On retry/resume, the gate naturally handles idempotence: tasks already `[x]` from a prior run are treated as Mixed — the Haiku confirms they stay done and the orchestrator only re-dispatches what remains `[ ]`.
|
|
101
|
+
|
|
102
|
+
**Pre-check (same as `feature/SKILL.md § Pre-EXECUTE Existence Gate`):** Before dispatching Haiku, run `rtk git diff --stat HEAD -- <files listed in spec's ## Files>`. Skip gate entirely if output is empty (no changes) or total insertions/deletions <10. Only proceed with Haiku dispatch if ≥10 lines changed.
|
|
103
|
+
|
|
104
|
+
13. **Plan waves:** `Depends on: none` → Wave 1; dependencies → later. DB+Backend parallel. Frontend after Backend UNLESS all parallel override conditions met (see `.claude/pipeline-config.md` Parallel Rules). Review agents: ALWAYS dispatch in single parallel message. Skip completed tasks.
|
|
101
105
|
14. **Build agent prompts using template** (`.claude/commands/mustard/templates/agent-prompt/SKILL.md`):
|
|
102
|
-
- Read template once, then fill placeholders per agent using
|
|
106
|
+
- Read template once, then fill placeholders per agent using `.claude/pipeline-config.md` data:
|
|
103
107
|
- `{subproject}` → from Agents table (Subproject column)
|
|
104
108
|
- `{reference_files}` → 2-3 files from matched recipe
|
|
105
109
|
- `{guards_summary}` → key guards from `{subproject}/CLAUDE.md`
|
|
@@ -108,12 +112,12 @@ Run `node .claude/scripts/diff-context.js` to capture the current git state. Inc
|
|
|
108
112
|
- `{validate_command}`, `{build_command}` → from Agents table in config
|
|
109
113
|
- `{retry_context}` → empty on first dispatch (see Step 4 for retries)
|
|
110
114
|
- `{task_steps}` → checkboxed steps from spec
|
|
111
|
-
- `{recommended_skills}` → from Skill Recommendations in
|
|
115
|
+
- `{recommended_skills}` → from Skill Recommendations in `.claude/pipeline-config.md`:
|
|
112
116
|
1. Glob `{subproject}/.claude/skills/` for generated pattern skills
|
|
113
117
|
2. Add foundation skills matching the role (ui→design-craft+react-best-practices, mobile→design-craft)
|
|
114
118
|
3. Format as bullet list: `- {skill-name}`
|
|
115
119
|
|
|
116
|
-
16. **Wave transitions** — between waves, execute transitions from
|
|
120
|
+
16. **Wave transitions** — between waves, execute transitions from `.claude/pipeline-config.md`:
|
|
117
121
|
- After Wave 1 (api/database/library) completes, before Wave 2 (ui):
|
|
118
122
|
- Execute each command listed in the matching `Wave Transitions` section
|
|
119
123
|
- Wait for transitions to complete before dispatching next wave
|
|
@@ -136,7 +140,7 @@ After each agent returns, check the return value for an escalation status before
|
|
|
136
140
|
- `PARTIAL` — apply Granular Retry Protocol from the last completed step; do NOT restart from step 1
|
|
137
141
|
- `DEFERRED` — note in spec with agent justification; ask user if the deferred item is load-bearing before closing
|
|
138
142
|
|
|
139
|
-
If two or more agents in the same wave return `CONCERN`, surface all concerns together before dispatching the next wave. See
|
|
143
|
+
If two or more agents in the same wave return `CONCERN`, surface all concerns together before dispatching the next wave. See `.claude/pipeline-config.md` Escalation Statuses and Diagnostic Failure Routing for the full status table.
|
|
140
144
|
|
|
141
145
|
### Step 4: Validate, Review & Complete
|
|
142
146
|
|
|
@@ -206,6 +210,6 @@ This eliminates decision fatigue on resume. The user can always override, but th
|
|
|
206
210
|
- Wave dispatch: ALL agents in same wave in a SINGLE message
|
|
207
211
|
- Each sub-agent reads its own `{subproject}/CLAUDE.md` + auto-loads relevant skills (orchestrator does NOT read them)
|
|
208
212
|
- Update pipeline state + spec checkboxes at each transition
|
|
209
|
-
- ALWAYS read
|
|
213
|
+
- ALWAYS read `.claude/pipeline-config.md` for agent/wave/model config — NEVER hardcode project-specific values
|
|
210
214
|
- ALWAYS use agent-prompt template — NEVER build prompts from scratch
|
|
211
215
|
- ALWAYS execute wave transitions between waves
|