mustard-claude 3.1.3 → 3.1.4

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/README.md CHANGED
@@ -1,451 +1,451 @@
1
- <p align="center">
2
- <img src="assets/logo.svg" width="120" alt="Mustard">
3
- </p>
4
-
5
- <h1 align="center">Mustard</h1>
6
-
7
- <p align="center">
8
- <em>The perfect sauce for your Claude Code</em>
9
- </p>
10
-
11
- <p align="center">
12
- <a href="https://www.npmjs.com/package/mustard-claude"><img src="https://img.shields.io/npm/v/mustard-claude?style=for-the-badge&color=yellow&label=npm" alt="npm"></a>
13
- <img src="https://img.shields.io/badge/node-%3E%3D18-green?style=for-the-badge&logo=node.js" alt="Node">
14
- <img src="https://img.shields.io/badge/license-MIT-blue?style=for-the-badge" alt="License">
15
- </p>
16
-
17
- <p align="center">
18
- <img src="https://img.shields.io/badge/Claude_Code-Ready-blueviolet?style=flat-square&logo=anthropic" alt="Claude Code">
19
- <img src="https://img.shields.io/badge/Monorepo-supported-green?style=flat-square" alt="Monorepo">
20
- <img src="https://img.shields.io/badge/Single_Repo-supported-green?style=flat-square" alt="Single Repo">
21
- </p>
22
-
23
- ---
24
-
25
- ## What is Mustard?
26
-
27
- Mustard sets up a `.claude/` folder that turns Claude Code into a structured development pipeline:
28
-
29
- - **15 pipeline skills** — feature, bugfix, scan, resume, approve, complete, git, maint, task, knowledge, skill, status, scan-format, agent-prompt template, stats
30
- - **14 enforcement hooks** — bash safety, file guard, registry validation, guard verification, auto-format, pre-compact, session cleanup, subagent tracking, RTK rewrite, session memory, review gate, metrics tracker, MCP budget, session knowledge
31
- - **6 bundled skills** — design-craft, react-best-practices, senior-architect, skill-creator, commit-workflow, pipeline-execution
32
- - **10 utility scripts** — subproject detection, entity registry sync, statusline, memory persistence, diff context, knowledge base, metrics collection, security scan, pipeline verification
33
- - **Token economy** — auto-installs [RTK](https://github.com/rtk-ai/rtk) to reduce token consumption by 60-90% on CLI outputs
34
- - **Hook profiles** — minimal/standard/strict profiles via `_lib/hook-env.js`, env-based hook disabling
35
- - **Cursor IDE adapter** (experimental) — `mustard init --cursor` installs a Cursor-compatible hook adapter
36
- - **Monorepo + single repo** — works with any project structure
37
-
38
- ## Quick Start
39
-
40
- ```bash
41
- # Install globally
42
- npm install -g mustard-claude
43
-
44
- # Initialize your project
45
- cd my-project
46
- mustard init
47
-
48
- # Open Claude Code and run /scan
49
- ```
50
-
51
- That's it. After `/scan`, use `/feature`, `/bugfix`, `/task` to work through structured pipelines.
52
-
53
- ## Installation
54
-
55
- ### Prerequisites
56
-
57
- - **Node.js** >= 18.0.0
58
- - **Claude Code** CLI or IDE extension
59
- - **RTK** (auto-installed) — [Rust Token Killer](https://github.com/rtk-ai/rtk) for token economy
60
-
61
- ### Option 1: Global Install (recommended)
62
-
63
- ```bash
64
- npm install -g mustard-claude
65
- ```
66
-
67
- After install, the `mustard` command is available globally:
68
-
69
- ```bash
70
- mustard init
71
- mustard update
72
- mustard auto-update
73
- ```
74
-
75
- ### Option 2: Run Without Installing
76
-
77
- ```bash
78
- npx mustard-claude init
79
- npx mustard-claude update
80
- npx mustard-claude auto-update
81
- ```
82
-
83
- ### Verify Installation
84
-
85
- ```bash
86
- mustard --version
87
- ```
88
-
89
- ## How It Works
90
-
91
- 1. `mustard init` copies the `.claude/` structure into your project
92
- 2. RTK is auto-installed for token economy (60-90% savings on CLI outputs)
93
- 3. Inside Claude Code, run `/scan` to analyze your codebase
94
- 4. `/scan` generates guards, recipes, patterns, agents, and skills specific to your project
95
- 5. Use `/feature`, `/bugfix`, `/task` to work through structured pipelines
96
-
97
- The CLI is a **one-time setup tool**. All intelligence lives in the skills and hooks inside `.claude/`.
98
-
99
- ## CLI Commands
100
-
101
- | Command | Description |
102
- |---------|-------------|
103
- | `mustard init` | Copy `.claude/` structure into current project |
104
- | `mustard update` | Update core files (preserves user customizations) |
105
- | `mustard auto-update` | Check npm for newer version and install |
106
- | `mustard add <template>` | Install a community template |
107
- | `mustard review --pr <N>` | Review a pull request (local or CI mode) |
108
- | `mustard --version` | Show installed version |
109
- | `mustard --help` | Show help |
110
-
111
- ### `mustard init`
112
-
113
- | Option | Description |
114
- |--------|-------------|
115
- | `-f, --force` | Overwrite existing `.claude/` without backup |
116
- | `-y, --yes` | Skip confirmation prompts (merge mode: skip existing files) |
117
- | `--cursor` | Install Cursor IDE adapter at `.cursor/hooks/adapter.js` |
118
-
119
- **Behavior:**
120
- - If `.claude/` doesn't exist → copies all templates
121
- - If `.claude/` exists → asks: backup & overwrite, merge (skip existing), or cancel
122
- - Merge mode preserves all existing files and only adds new ones
123
- - Auto-installs RTK if not present (silent, never blocks on failure)
124
-
125
- ### `mustard update`
126
-
127
- | Option | Description |
128
- |--------|-------------|
129
- | `-f, --force` | Skip backup and confirmation |
130
-
131
- **Recreates** (from latest templates):
132
- - `commands/mustard/` — pipeline skills
133
- - `hooks/` — enforcement hooks
134
- - `skills/` — bundled skills
135
- - `scripts/` — sync scripts
136
- - `settings.json` — hook configuration
137
-
138
- **Preserves** (user customizations):
139
- - `CLAUDE.md` — orchestrator rules (populated by `/scan`)
140
- - `pipeline-config.md` — agent dispatch config (populated by `/scan`)
141
- - `entity-registry.json` — entity map (populated by sync-registry)
142
- - `commands/*.md` — user commands outside `mustard/`
143
- - `docs/`, `agent-memory/`, `spec/`, `plans/`
144
-
145
- ### `mustard auto-update`
146
-
147
- | Option | Description |
148
- |--------|-------------|
149
- | `--check-only` | Only check for updates, do not install |
150
- | `-y, --yes` | Skip confirmation prompts |
151
-
152
- ### `mustard add`
153
-
154
- | Option | Description |
155
- |--------|-------------|
156
- | `-f, --force` | Overwrite existing files |
157
-
158
- **Sources:**
159
- - GitHub: `github.com/mustard-templates/{name}`
160
- - npm: `mustard-template-{name}`
161
-
162
- **Usage:**
163
- ```bash
164
- mustard add template:dotnet-clean-arch
165
- mustard add template:nextjs-app-router
166
- ```
167
-
168
- ### `mustard review`
169
-
170
- | Option | Description |
171
- |--------|-------------|
172
- | `--pr <number>` | PR number to review (required) |
173
- | `--ci` | CI mode: post as PR comment, exit 1 on critical issues |
174
-
175
- **Requirements:** `gh` (GitHub CLI) and `claude` CLI must be installed.
176
-
177
- **Usage:**
178
- ```bash
179
- # Interactive review
180
- mustard review --pr 42
181
-
182
- # CI mode (for GitHub Actions)
183
- mustard review --ci --pr 42
184
- ```
185
-
186
- ## What Gets Installed
187
-
188
- ```
189
- .claude/
190
- ├── CLAUDE.md # Orchestrator rules (template)
191
- ├── pipeline-config.md # Agent dispatch config (template)
192
- ├── settings.json # Hooks + permissions + statusline
193
- ├── entity-registry.json # Empty skeleton (populated by /scan)
194
- ├── commands/mustard/ # Pipeline skills
195
- │ ├── feature/SKILL.md # /feature — feature pipeline
196
- │ ├── bugfix/SKILL.md # /bugfix — bug fix pipeline
197
- │ ├── approve/SKILL.md # /approve — approve spec
198
- │ ├── complete/SKILL.md # /complete — finalize pipeline
199
- │ ├── resume/SKILL.md # /resume — resume pipeline
200
- │ ├── scan/SKILL.md # /scan — analyze codebase
201
- │ ├── scan-format/SKILL.md # /scan agent format rules
202
- │ ├── git/SKILL.md # /git — commit, push, merge, deploy
203
- │ ├── maint/SKILL.md # /maint — deps, validate, sync
204
- │ ├── task/SKILL.md # /task — delegated analysis/review
205
- │ ├── knowledge/SKILL.md # /knowledge — notes, audit, reports
206
- │ ├── skill/SKILL.md # /skill — manage skills
207
- │ ├── status/SKILL.md # /status — project status
208
- │ ├── stats/SKILL.md # /stats — pipeline metrics
209
- │ └── templates/agent-prompt/SKILL.md # Agent prompt template
210
- ├── hooks/ # Enforcement hooks
211
- │ ├── _lib/hook-env.js # Shared runtime controls (profiles, env overrides)
212
- │ ├── rtk-rewrite.js # Rewrites Bash commands through RTK
213
- │ ├── bash-safety.js # Blocks dangerous commands
214
- │ ├── file-guard.js # Blocks sensitive file access
215
- │ ├── enforce-registry.js # Blocks pipeline if no registry
216
- │ ├── guard-verify.js # Validates architectural rules
217
- │ ├── auto-format.js # Auto-formats on write
218
- │ ├── pre-compact.js # Saves state before compaction
219
- │ ├── session-cleanup.js # Cleans up on session end
220
- │ ├── subagent-tracker.js # Tracks agent lifecycle
221
- │ ├── session-memory.js # Injects persistent memory on session start
222
- │ ├── review-gate.js # Pre-commit validation (fail-open)
223
- │ ├── metrics-tracker.js # Tracks pipeline API calls and retries
224
- │ ├── mcp-budget.js # Warns about excessive MCP tool counts
225
- │ ├── session-knowledge.js # Extracts patterns from session before cleanup
226
- │ └── __tests__/hooks.test.js # Hook tests
227
- ├── scripts/
228
- │ ├── sync-detect.js # Detects subprojects + roles
229
- │ ├── sync-registry.js # Generates entity-registry.json
230
- │ ├── statusline.js # Claude Code statusline
231
- │ ├── memory-persist.js # Persists decisions/lessons across sessions
232
- │ ├── memory-write.js # Writes agent memory entries
233
- │ ├── diff-context.js # Generates git diff summary for agents
234
- │ ├── knowledge-update.js # Updates project knowledge base
235
- │ ├── metrics-collect.js # Collects and displays pipeline metrics
236
- │ ├── security-scan.js # Scans for secrets and security misconfigs
237
- │ └── verify-pipeline.js # Runs build/test verification for pipeline
238
- ├── memory/ # Persistent memory (auto-created)
239
- │ ├── decisions.json # Decisions across pipelines
240
- │ └── lessons.json # Lessons learned
241
- ├── knowledge.json # Evolutionary knowledge base
242
- ├── metrics/ # Pipeline metrics archive
243
- ├── adapters/cursor/ # Cursor IDE adapter (experimental)
244
- │ ├── README.md # Setup and usage guide
245
- │ └── adapter.js # Translates Cursor ↔ Claude Code hook protocol
246
- └── skills/ # Bundled skills
247
- ├── design-craft/ # UI design methodology
248
- ├── react-best-practices/ # React/Next.js optimization (40+ rules)
249
- ├── senior-architect/ # System architecture patterns
250
- ├── skill-creator/ # Create and optimize skills
251
- ├── commit-workflow/ # Git commit strategy
252
- └── pipeline-execution/ # Pipeline orchestration
253
- ```
254
-
255
- ## Pipeline Commands (inside Claude Code)
256
-
257
- ### Core Pipeline
258
-
259
- | Command | Description |
260
- |---------|-------------|
261
- | `/scan` | Analyze codebase — generates guards, recipes, agents, skills |
262
- | `/feature <name>` | Start feature pipeline (ANALYZE → PLAN → EXECUTE → CLOSE) |
263
- | `/bugfix <error>` | Autonomous bug fix (diagnose → fix → validate) |
264
- | `/approve` | Approve spec for implementation |
265
- | `/resume` | Resume interrupted pipeline |
266
- | `/complete` | Finalize or cancel pipeline |
267
- | `/stats` | Show pipeline metrics and token savings |
268
-
269
- ### Operations
270
-
271
- | Command | Description |
272
- |---------|-------------|
273
- | `/git <action>` | commit, push, merge, deploy (handles monorepo; `/git merge main` cascades from any branch) |
274
- | `/maint <action>` | deps, validate, sync |
275
- | `/status` | Git + pipeline + build + registry status |
276
-
277
- ### Analysis & Delegation
278
-
279
- | Command | Description |
280
- |---------|-------------|
281
- | `/task analyze <scope>` | Code exploration (Explore agent) |
282
- | `/task audit <domain> <scope>` | Quality audit (copy, design, a11y, i18n, api-contract) |
283
- | `/task compare <criteria>` | Cross-subproject comparison |
284
- | `/task review <scope>` | Code review (SOLID, security, perf) |
285
- | `/task refactor <scope>` | Plan + approve + implement refactoring |
286
- | `/task docs <scope>` | Documentation generation |
287
-
288
- ### Knowledge
289
-
290
- | Command | Description |
291
- |---------|-------------|
292
- | `/knowledge notes [target]` | Manage project observations |
293
- | `/knowledge audit` | Audit memory for duplicates |
294
- | `/knowledge report daily/weekly` | Progress reports from git data |
295
-
296
- ### Skills
297
-
298
- | Command | Description |
299
- |---------|-------------|
300
- | `/skill list` | List installed skills |
301
- | `/skill install <source>` | Install from local path or GitHub |
302
- | `/skill create <name>` | Create new skill via skill-creator |
303
- | `/skill optimize <name>` | Optimize skill triggering |
304
-
305
- ## How `/scan` Works
306
-
307
- `/scan` is the most important command. It runs inside Claude Code and:
308
-
309
- 1. **Detects subprojects** — reads git submodules or scans for `CLAUDE.md` files
310
- 2. **Incremental detection** — compares source hashes to skip unchanged subprojects
311
- 3. **Launches analysis agents** — one per subproject, in parallel
312
- 4. **Generates per-subproject**:
313
- - `{subproject}/CLAUDE.md` — stack, commands, guards
314
- - `{subproject}/.claude/commands/` — guards, recipes, patterns, modules
315
- - `{subproject}/.claude/skills/` — granular pattern skills
316
- - `.claude/agents/{subproject}-impl.md` — implementation agent
317
- - `.claude/agents/{subproject}-explorer.md` — read-only explorer
318
- 5. **Updates root files** — `CLAUDE.md`, `pipeline-config.md`, `entity-registry.json`
319
-
320
- After `/scan`, the pipeline commands (`/feature`, `/bugfix`) have full context to dispatch specialized agents.
321
-
322
- ## Pipeline Flow
323
-
324
- ```
325
- /feature <name>
326
-
327
-
328
- ANALYZE — read registry + pipeline-config, determine layers
329
-
330
-
331
- PLAN — create spec with tasks per agent (Light: inline, Full: /approve)
332
-
333
-
334
- EXECUTE — dispatch agents per wave (DB+Backend ∥, Frontend after or parallel if safe)
335
-
336
-
337
- REVIEW — mandatory review per subproject (SOLID, patterns, i18n, ...)
338
-
339
-
340
- CLOSE — sync registry, move spec, cleanup state
341
- ```
342
-
343
- **Light scope** (≤5 files, known pattern): ANALYZE → EXECUTE → CLOSE in one session.
344
- **Full scope** (3+ layers, new entity): ANALYZE → PLAN → `/approve` → new session → `/resume` → CLOSE.
345
-
346
- ## Token Economy
347
-
348
- Mustard integrates [RTK (Rust Token Killer)](https://github.com/rtk-ai/rtk) as core infrastructure to reduce token consumption:
349
-
350
- - **Auto-install** — `mustard init` and `mustard update` install RTK silently if not present
351
- - **Transparent hook** — a `PreToolUse` hook rewrites every Bash command through `rtk`, compressing output before it reaches Claude's context
352
- - **Fail-open** — if RTK is not available, the hook passes through with zero impact
353
- - **Statusline** — real-time token savings displayed in the Claude Code status bar
354
- - **Pipeline report** — `/complete` shows total tokens saved at the end of each pipeline
355
-
356
- | Command Type | Token Savings |
357
- |-------------|--------------|
358
- | `git status/diff/log` | 75-80% |
359
- | `npm test` / `cargo test` | 90-99% |
360
- | `git add/commit/push` | 92% |
361
- | Build output | 80-90% |
362
- | `ls` / `tree` / `grep` | 80% |
363
-
364
- RTK only applies to Bash tool calls. Claude Code's built-in tools (Read, Grep, Glob) are already optimized and bypass the hook.
365
-
366
- ## Persistent Memory
367
-
368
- Mustard maintains lightweight persistent memory across sessions:
369
-
370
- - **Decisions** — architectural and implementation decisions are saved to `.claude/memory/decisions.json`
371
- - **Lessons** — what went wrong and the correction applied, saved to `.claude/memory/lessons.json`
372
- - **Knowledge base** — patterns, conventions, and entities discovered across pipelines, saved to `.claude/knowledge.json`
373
-
374
- Memory is automatically:
375
- - **Injected** into each new session and every dispatched agent
376
- - **Capped** at 50 entries (memory) / 200 entries (knowledge) — oldest pruned
377
- - **Never cleaned** by session cleanup — persists until manually removed
378
-
379
- This gives 80% of the benefit of a database-backed system with zero infrastructure.
380
-
381
- ## CI Integration
382
-
383
- Review PRs automatically in your CI pipeline:
384
-
385
- ```bash
386
- # In GitHub Actions
387
- mustard review --ci --pr ${{ github.event.pull_request.number }}
388
- ```
389
-
390
- CI mode:
391
- - Fetches PR diff via `gh pr diff`
392
- - Runs Claude review with project guards and rules
393
- - Posts review as PR comment
394
- - Exits with code 1 if CRITICAL issues found (fails the build)
395
-
396
- Requires `gh` and `claude` CLI in the CI environment.
397
-
398
- ## Supported Projects
399
-
400
- Mustard is **framework-agnostic**. The CLI just copies templates. `/scan` handles detection:
401
-
402
- | Type | Examples |
403
- |------|---------|
404
- | **Backend** | .NET, Node.js (Express/Fastify), Python (FastAPI/Django), Go, Rust, Java |
405
- | **Frontend** | React, Next.js, Vue, Nuxt, Svelte, Angular |
406
- | **Mobile** | Flutter/Dart |
407
- | **Database** | Drizzle, Prisma, EF Core, TypeORM |
408
- | **Monorepo** | Any combination of the above |
409
- | **Single repo** | Any single project |
410
-
411
- ## Updating
412
-
413
- ### Update Mustard CLI
414
-
415
- ```bash
416
- # Check if there's a new version
417
- mustard auto-update --check-only
418
-
419
- # Update to latest
420
- mustard auto-update
421
-
422
- # Or manually
423
- npm install -g mustard-claude@latest
424
- ```
425
-
426
- ### Update Project Templates
427
-
428
- After updating the CLI, update your project's `.claude/` files:
429
-
430
- ```bash
431
- cd my-project
432
- mustard update
433
- ```
434
-
435
- This recreates core files (hooks, skills, scripts, commands) while preserving your customizations.
436
-
437
- ## Development
438
-
439
- ```bash
440
- git clone https://github.com/rubensrpj/mustard.git
441
- cd mustard
442
- npm install
443
- npm run build
444
-
445
- # Test locally
446
- node bin/mustard.js init
447
- ```
448
-
449
- ## License
450
-
451
- MIT
1
+ <p align="center">
2
+ <img src="assets/logo.svg" width="120" alt="Mustard">
3
+ </p>
4
+
5
+ <h1 align="center">Mustard</h1>
6
+
7
+ <p align="center">
8
+ <em>The perfect sauce for your Claude Code</em>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://www.npmjs.com/package/mustard-claude"><img src="https://img.shields.io/npm/v/mustard-claude?style=for-the-badge&color=yellow&label=npm" alt="npm"></a>
13
+ <img src="https://img.shields.io/badge/node-%3E%3D18-green?style=for-the-badge&logo=node.js" alt="Node">
14
+ <img src="https://img.shields.io/badge/license-MIT-blue?style=for-the-badge" alt="License">
15
+ </p>
16
+
17
+ <p align="center">
18
+ <img src="https://img.shields.io/badge/Claude_Code-Ready-blueviolet?style=flat-square&logo=anthropic" alt="Claude Code">
19
+ <img src="https://img.shields.io/badge/Monorepo-supported-green?style=flat-square" alt="Monorepo">
20
+ <img src="https://img.shields.io/badge/Single_Repo-supported-green?style=flat-square" alt="Single Repo">
21
+ </p>
22
+
23
+ ---
24
+
25
+ ## What is Mustard?
26
+
27
+ Mustard sets up a `.claude/` folder that turns Claude Code into a structured development pipeline:
28
+
29
+ - **15 pipeline skills** — feature, bugfix, scan, resume, approve, complete, git, maint, task, knowledge, skill, status, scan-format, agent-prompt template, stats
30
+ - **14 enforcement hooks** — bash safety, file guard, registry validation, guard verification, auto-format, pre-compact, session cleanup, subagent tracking, RTK rewrite, session memory, review gate, metrics tracker, MCP budget, session knowledge
31
+ - **6 bundled skills** — design-craft, react-best-practices, senior-architect, skill-creator, commit-workflow, pipeline-execution
32
+ - **10 utility scripts** — subproject detection, entity registry sync, statusline, memory persistence, diff context, knowledge base, metrics collection, security scan, pipeline verification
33
+ - **Token economy** — auto-installs [RTK](https://github.com/rtk-ai/rtk) to reduce token consumption by 60-90% on CLI outputs
34
+ - **Hook profiles** — minimal/standard/strict profiles via `_lib/hook-env.js`, env-based hook disabling
35
+ - **Cursor IDE adapter** (experimental) — `mustard init --cursor` installs a Cursor-compatible hook adapter
36
+ - **Monorepo + single repo** — works with any project structure
37
+
38
+ ## Quick Start
39
+
40
+ ```bash
41
+ # Install globally
42
+ npm install -g mustard-claude
43
+
44
+ # Initialize your project
45
+ cd my-project
46
+ mustard init
47
+
48
+ # Open Claude Code and run /scan
49
+ ```
50
+
51
+ That's it. After `/scan`, use `/feature`, `/bugfix`, `/task` to work through structured pipelines.
52
+
53
+ ## Installation
54
+
55
+ ### Prerequisites
56
+
57
+ - **Node.js** >= 18.0.0
58
+ - **Claude Code** CLI or IDE extension
59
+ - **RTK** (auto-installed) — [Rust Token Killer](https://github.com/rtk-ai/rtk) for token economy
60
+
61
+ ### Option 1: Global Install (recommended)
62
+
63
+ ```bash
64
+ npm install -g mustard-claude
65
+ ```
66
+
67
+ After install, the `mustard` command is available globally:
68
+
69
+ ```bash
70
+ mustard init
71
+ mustard update
72
+ mustard auto-update
73
+ ```
74
+
75
+ ### Option 2: Run Without Installing
76
+
77
+ ```bash
78
+ npx mustard-claude init
79
+ npx mustard-claude update
80
+ npx mustard-claude auto-update
81
+ ```
82
+
83
+ ### Verify Installation
84
+
85
+ ```bash
86
+ mustard --version
87
+ ```
88
+
89
+ ## How It Works
90
+
91
+ 1. `mustard init` copies the `.claude/` structure into your project
92
+ 2. RTK is auto-installed for token economy (60-90% savings on CLI outputs)
93
+ 3. Inside Claude Code, run `/scan` to analyze your codebase
94
+ 4. `/scan` generates guards, recipes, patterns, agents, and skills specific to your project
95
+ 5. Use `/feature`, `/bugfix`, `/task` to work through structured pipelines
96
+
97
+ The CLI is a **one-time setup tool**. All intelligence lives in the skills and hooks inside `.claude/`.
98
+
99
+ ## CLI Commands
100
+
101
+ | Command | Description |
102
+ |---------|-------------|
103
+ | `mustard init` | Copy `.claude/` structure into current project |
104
+ | `mustard update` | Update core files (preserves user customizations) |
105
+ | `mustard auto-update` | Check npm for newer version and install |
106
+ | `mustard add <template>` | Install a community template |
107
+ | `mustard review --pr <N>` | Review a pull request (local or CI mode) |
108
+ | `mustard --version` | Show installed version |
109
+ | `mustard --help` | Show help |
110
+
111
+ ### `mustard init`
112
+
113
+ | Option | Description |
114
+ |--------|-------------|
115
+ | `-f, --force` | Overwrite existing `.claude/` without backup |
116
+ | `-y, --yes` | Skip confirmation prompts (merge mode: skip existing files) |
117
+ | `--cursor` | Install Cursor IDE adapter at `.cursor/hooks/adapter.js` |
118
+
119
+ **Behavior:**
120
+ - If `.claude/` doesn't exist → copies all templates
121
+ - If `.claude/` exists → asks: backup & overwrite, merge (skip existing), or cancel
122
+ - Merge mode preserves all existing files and only adds new ones
123
+ - Auto-installs RTK if not present (silent, never blocks on failure)
124
+
125
+ ### `mustard update`
126
+
127
+ | Option | Description |
128
+ |--------|-------------|
129
+ | `-f, --force` | Skip backup and confirmation |
130
+
131
+ **Recreates** (from latest templates):
132
+ - `commands/mustard/` — pipeline skills
133
+ - `hooks/` — enforcement hooks
134
+ - `skills/` — bundled skills
135
+ - `scripts/` — sync scripts
136
+ - `settings.json` — hook configuration
137
+
138
+ **Preserves** (user customizations):
139
+ - `CLAUDE.md` — orchestrator rules (populated by `/scan`)
140
+ - `pipeline-config.md` — agent dispatch config (populated by `/scan`)
141
+ - `entity-registry.json` — entity map (populated by sync-registry)
142
+ - `commands/*.md` — user commands outside `mustard/`
143
+ - `docs/`, `agent-memory/`, `spec/`, `plans/`
144
+
145
+ ### `mustard auto-update`
146
+
147
+ | Option | Description |
148
+ |--------|-------------|
149
+ | `--check-only` | Only check for updates, do not install |
150
+ | `-y, --yes` | Skip confirmation prompts |
151
+
152
+ ### `mustard add`
153
+
154
+ | Option | Description |
155
+ |--------|-------------|
156
+ | `-f, --force` | Overwrite existing files |
157
+
158
+ **Sources:**
159
+ - GitHub: `github.com/mustard-templates/{name}`
160
+ - npm: `mustard-template-{name}`
161
+
162
+ **Usage:**
163
+ ```bash
164
+ mustard add template:dotnet-clean-arch
165
+ mustard add template:nextjs-app-router
166
+ ```
167
+
168
+ ### `mustard review`
169
+
170
+ | Option | Description |
171
+ |--------|-------------|
172
+ | `--pr <number>` | PR number to review (required) |
173
+ | `--ci` | CI mode: post as PR comment, exit 1 on critical issues |
174
+
175
+ **Requirements:** `gh` (GitHub CLI) and `claude` CLI must be installed.
176
+
177
+ **Usage:**
178
+ ```bash
179
+ # Interactive review
180
+ mustard review --pr 42
181
+
182
+ # CI mode (for GitHub Actions)
183
+ mustard review --ci --pr 42
184
+ ```
185
+
186
+ ## What Gets Installed
187
+
188
+ ```
189
+ .claude/
190
+ ├── CLAUDE.md # Orchestrator rules (template)
191
+ ├── pipeline-config.md # Agent dispatch config (template)
192
+ ├── settings.json # Hooks + permissions + statusline
193
+ ├── entity-registry.json # Empty skeleton (populated by /scan)
194
+ ├── commands/mustard/ # Pipeline skills
195
+ │ ├── feature/SKILL.md # /feature — feature pipeline
196
+ │ ├── bugfix/SKILL.md # /bugfix — bug fix pipeline
197
+ │ ├── approve/SKILL.md # /approve — approve spec
198
+ │ ├── complete/SKILL.md # /complete — finalize pipeline
199
+ │ ├── resume/SKILL.md # /resume — resume pipeline
200
+ │ ├── scan/SKILL.md # /scan — analyze codebase
201
+ │ ├── scan-format/SKILL.md # /scan agent format rules
202
+ │ ├── git/SKILL.md # /git — commit, push, merge, deploy
203
+ │ ├── maint/SKILL.md # /maint — deps, validate, sync
204
+ │ ├── task/SKILL.md # /task — delegated analysis/review
205
+ │ ├── knowledge/SKILL.md # /knowledge — notes, audit, reports
206
+ │ ├── skill/SKILL.md # /skill — manage skills
207
+ │ ├── status/SKILL.md # /status — project status
208
+ │ ├── stats/SKILL.md # /stats — pipeline metrics
209
+ │ └── templates/agent-prompt/SKILL.md # Agent prompt template
210
+ ├── hooks/ # Enforcement hooks
211
+ │ ├── _lib/hook-env.js # Shared runtime controls (profiles, env overrides)
212
+ │ ├── rtk-rewrite.js # Rewrites Bash commands through RTK
213
+ │ ├── bash-safety.js # Blocks dangerous commands
214
+ │ ├── file-guard.js # Blocks sensitive file access
215
+ │ ├── enforce-registry.js # Blocks pipeline if no registry
216
+ │ ├── guard-verify.js # Validates architectural rules
217
+ │ ├── auto-format.js # Auto-formats on write
218
+ │ ├── pre-compact.js # Saves state before compaction
219
+ │ ├── session-cleanup.js # Cleans up on session end
220
+ │ ├── subagent-tracker.js # Tracks agent lifecycle
221
+ │ ├── session-memory.js # Injects persistent memory on session start
222
+ │ ├── review-gate.js # Pre-commit validation (fail-open)
223
+ │ ├── metrics-tracker.js # Tracks pipeline API calls and retries
224
+ │ ├── mcp-budget.js # Warns about excessive MCP tool counts
225
+ │ ├── session-knowledge.js # Extracts patterns from session before cleanup
226
+ │ └── __tests__/hooks.test.js # Hook tests
227
+ ├── scripts/
228
+ │ ├── sync-detect.js # Detects subprojects + roles
229
+ │ ├── sync-registry.js # Generates entity-registry.json
230
+ │ ├── statusline.js # Claude Code statusline
231
+ │ ├── memory-persist.js # Persists decisions/lessons across sessions
232
+ │ ├── memory-write.js # Writes agent memory entries
233
+ │ ├── diff-context.js # Generates git diff summary for agents
234
+ │ ├── knowledge-update.js # Updates project knowledge base
235
+ │ ├── metrics-collect.js # Collects and displays pipeline metrics
236
+ │ ├── security-scan.js # Scans for secrets and security misconfigs
237
+ │ └── verify-pipeline.js # Runs build/test verification for pipeline
238
+ ├── memory/ # Persistent memory (auto-created)
239
+ │ ├── decisions.json # Decisions across pipelines
240
+ │ └── lessons.json # Lessons learned
241
+ ├── knowledge.json # Evolutionary knowledge base
242
+ ├── metrics/ # Pipeline metrics archive
243
+ ├── adapters/cursor/ # Cursor IDE adapter (experimental)
244
+ │ ├── README.md # Setup and usage guide
245
+ │ └── adapter.js # Translates Cursor ↔ Claude Code hook protocol
246
+ └── skills/ # Bundled skills
247
+ ├── design-craft/ # UI design methodology
248
+ ├── react-best-practices/ # React/Next.js optimization (40+ rules)
249
+ ├── senior-architect/ # System architecture patterns
250
+ ├── skill-creator/ # Create and optimize skills
251
+ ├── commit-workflow/ # Git commit strategy
252
+ └── pipeline-execution/ # Pipeline orchestration
253
+ ```
254
+
255
+ ## Pipeline Commands (inside Claude Code)
256
+
257
+ ### Core Pipeline
258
+
259
+ | Command | Description |
260
+ |---------|-------------|
261
+ | `/scan` | Analyze codebase — generates guards, recipes, agents, skills |
262
+ | `/feature <name>` | Start feature pipeline (ANALYZE → PLAN → EXECUTE → CLOSE) |
263
+ | `/bugfix <error>` | Autonomous bug fix (diagnose → fix → validate) |
264
+ | `/approve` | Approve spec for implementation |
265
+ | `/resume` | Resume interrupted pipeline |
266
+ | `/complete` | Finalize or cancel pipeline |
267
+ | `/stats` | Show pipeline metrics and token savings |
268
+
269
+ ### Operations
270
+
271
+ | Command | Description |
272
+ |---------|-------------|
273
+ | `/git <action>` | commit, push, merge, deploy (handles monorepo; `/git merge main` cascades from any branch) |
274
+ | `/maint <action>` | deps, validate, sync |
275
+ | `/status` | Git + pipeline + build + registry status |
276
+
277
+ ### Analysis & Delegation
278
+
279
+ | Command | Description |
280
+ |---------|-------------|
281
+ | `/task analyze <scope>` | Code exploration (Explore agent) |
282
+ | `/task audit <domain> <scope>` | Quality audit (copy, design, a11y, i18n, api-contract) |
283
+ | `/task compare <criteria>` | Cross-subproject comparison |
284
+ | `/task review <scope>` | Code review (SOLID, security, perf) |
285
+ | `/task refactor <scope>` | Plan + approve + implement refactoring |
286
+ | `/task docs <scope>` | Documentation generation |
287
+
288
+ ### Knowledge
289
+
290
+ | Command | Description |
291
+ |---------|-------------|
292
+ | `/knowledge notes [target]` | Manage project observations |
293
+ | `/knowledge audit` | Audit memory for duplicates |
294
+ | `/knowledge report daily/weekly` | Progress reports from git data |
295
+
296
+ ### Skills
297
+
298
+ | Command | Description |
299
+ |---------|-------------|
300
+ | `/skill list` | List installed skills |
301
+ | `/skill install <source>` | Install from local path or GitHub |
302
+ | `/skill create <name>` | Create new skill via skill-creator |
303
+ | `/skill optimize <name>` | Optimize skill triggering |
304
+
305
+ ## How `/scan` Works
306
+
307
+ `/scan` is the most important command. It runs inside Claude Code and:
308
+
309
+ 1. **Detects subprojects** — reads git submodules or scans for `CLAUDE.md` files
310
+ 2. **Incremental detection** — compares source hashes to skip unchanged subprojects
311
+ 3. **Launches analysis agents** — one per subproject, in parallel
312
+ 4. **Generates per-subproject**:
313
+ - `{subproject}/CLAUDE.md` — stack, commands, guards
314
+ - `{subproject}/.claude/commands/` — guards, recipes, patterns, modules
315
+ - `{subproject}/.claude/skills/` — granular pattern skills
316
+ - `.claude/agents/{subproject}-impl.md` — implementation agent
317
+ - `.claude/agents/{subproject}-explorer.md` — read-only explorer
318
+ 5. **Updates root files** — `CLAUDE.md`, `pipeline-config.md`, `entity-registry.json`
319
+
320
+ After `/scan`, the pipeline commands (`/feature`, `/bugfix`) have full context to dispatch specialized agents.
321
+
322
+ ## Pipeline Flow
323
+
324
+ ```
325
+ /feature <name>
326
+
327
+
328
+ ANALYZE — read registry + pipeline-config, determine layers
329
+
330
+
331
+ PLAN — create spec with tasks per agent (Light: inline, Full: /approve)
332
+
333
+
334
+ EXECUTE — dispatch agents per wave (DB+Backend ∥, Frontend after or parallel if safe)
335
+
336
+
337
+ REVIEW — mandatory review per subproject (SOLID, patterns, i18n, ...)
338
+
339
+
340
+ CLOSE — sync registry, move spec, cleanup state
341
+ ```
342
+
343
+ **Light scope** (≤5 files, known pattern): ANALYZE → EXECUTE → CLOSE in one session.
344
+ **Full scope** (3+ layers, new entity): ANALYZE → PLAN → `/approve` → new session → `/resume` → CLOSE.
345
+
346
+ ## Token Economy
347
+
348
+ Mustard integrates [RTK (Rust Token Killer)](https://github.com/rtk-ai/rtk) as core infrastructure to reduce token consumption:
349
+
350
+ - **Auto-install** — `mustard init` and `mustard update` install RTK silently if not present
351
+ - **Transparent hook** — a `PreToolUse` hook rewrites every Bash command through `rtk`, compressing output before it reaches Claude's context
352
+ - **Fail-open** — if RTK is not available, the hook passes through with zero impact
353
+ - **Statusline** — real-time token savings displayed in the Claude Code status bar
354
+ - **Pipeline report** — `/complete` shows total tokens saved at the end of each pipeline
355
+
356
+ | Command Type | Token Savings |
357
+ |-------------|--------------|
358
+ | `git status/diff/log` | 75-80% |
359
+ | `npm test` / `cargo test` | 90-99% |
360
+ | `git add/commit/push` | 92% |
361
+ | Build output | 80-90% |
362
+ | `ls` / `tree` / `grep` | 80% |
363
+
364
+ RTK only applies to Bash tool calls. Claude Code's built-in tools (Read, Grep, Glob) are already optimized and bypass the hook.
365
+
366
+ ## Persistent Memory
367
+
368
+ Mustard maintains lightweight persistent memory across sessions:
369
+
370
+ - **Decisions** — architectural and implementation decisions are saved to `.claude/memory/decisions.json`
371
+ - **Lessons** — what went wrong and the correction applied, saved to `.claude/memory/lessons.json`
372
+ - **Knowledge base** — patterns, conventions, and entities discovered across pipelines, saved to `.claude/knowledge.json`
373
+
374
+ Memory is automatically:
375
+ - **Injected** into each new session and every dispatched agent
376
+ - **Capped** at 50 entries (memory) / 200 entries (knowledge) — oldest pruned
377
+ - **Never cleaned** by session cleanup — persists until manually removed
378
+
379
+ This gives 80% of the benefit of a database-backed system with zero infrastructure.
380
+
381
+ ## CI Integration
382
+
383
+ Review PRs automatically in your CI pipeline:
384
+
385
+ ```bash
386
+ # In GitHub Actions
387
+ mustard review --ci --pr ${{ github.event.pull_request.number }}
388
+ ```
389
+
390
+ CI mode:
391
+ - Fetches PR diff via `gh pr diff`
392
+ - Runs Claude review with project guards and rules
393
+ - Posts review as PR comment
394
+ - Exits with code 1 if CRITICAL issues found (fails the build)
395
+
396
+ Requires `gh` and `claude` CLI in the CI environment.
397
+
398
+ ## Supported Projects
399
+
400
+ Mustard is **framework-agnostic**. The CLI just copies templates. `/scan` handles detection:
401
+
402
+ | Type | Examples |
403
+ |------|---------|
404
+ | **Backend** | .NET, Node.js (Express/Fastify), Python (FastAPI/Django), Go, Rust, Java |
405
+ | **Frontend** | React, Next.js, Vue, Nuxt, Svelte, Angular |
406
+ | **Mobile** | Flutter/Dart |
407
+ | **Database** | Drizzle, Prisma, EF Core, TypeORM |
408
+ | **Monorepo** | Any combination of the above |
409
+ | **Single repo** | Any single project |
410
+
411
+ ## Updating
412
+
413
+ ### Update Mustard CLI
414
+
415
+ ```bash
416
+ # Check if there's a new version
417
+ mustard auto-update --check-only
418
+
419
+ # Update to latest
420
+ mustard auto-update
421
+
422
+ # Or manually
423
+ npm install -g mustard-claude@latest
424
+ ```
425
+
426
+ ### Update Project Templates
427
+
428
+ After updating the CLI, update your project's `.claude/` files:
429
+
430
+ ```bash
431
+ cd my-project
432
+ mustard update
433
+ ```
434
+
435
+ This recreates core files (hooks, skills, scripts, commands) while preserving your customizations.
436
+
437
+ ## Development
438
+
439
+ ```bash
440
+ git clone https://github.com/rubensrpj/mustard.git
441
+ cd mustard
442
+ npm install
443
+ npm run build
444
+
445
+ # Test locally
446
+ node bin/mustard.js init
447
+ ```
448
+
449
+ ## License
450
+
451
+ MIT