continuous-improvement 3.17.0 → 3.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/README.md +165 -99
  3. package/bin/audit-actions.mjs +433 -0
  4. package/bin/check-command-count.mjs +114 -0
  5. package/bin/generate-plugin-manifests.mjs +1 -0
  6. package/bin/portfolio-health.mjs +298 -0
  7. package/commands/reconcile.md +34 -7
  8. package/hooks/gateguard.mjs +137 -3
  9. package/hooks/typecheck-stop.mjs +117 -0
  10. package/lib/gateguard-state.mjs +5 -1
  11. package/lib/plugin-metadata.mjs +10 -2
  12. package/lib/typecheck-gate.mjs +62 -0
  13. package/package.json +12 -6
  14. package/plugins/beginner.json +1 -1
  15. package/plugins/continuous-improvement/.claude-plugin/marketplace.json +1 -1
  16. package/plugins/continuous-improvement/.claude-plugin/plugin.json +1 -1
  17. package/plugins/continuous-improvement/commands/reconcile.md +34 -7
  18. package/plugins/continuous-improvement/hooks/gateguard.mjs +137 -3
  19. package/plugins/continuous-improvement/hooks/hooks.json +6 -1
  20. package/plugins/continuous-improvement/hooks/typecheck-stop.mjs +117 -0
  21. package/plugins/continuous-improvement/lib/gateguard-state.mjs +5 -1
  22. package/plugins/continuous-improvement/lib/plugin-metadata.mjs +10 -2
  23. package/plugins/continuous-improvement/lib/typecheck-gate.mjs +62 -0
  24. package/plugins/continuous-improvement/skills/README.md +1 -1
  25. package/plugins/continuous-improvement/skills/gateguard/SKILL.md +10 -0
  26. package/plugins/continuous-improvement/skills/reconcile/SKILL.md +52 -4
  27. package/plugins/expert.json +1 -1
  28. package/skills/gateguard.md +10 -0
  29. package/skills/reconcile.md +52 -4
  30. package/templates/actions_security_checklist.md +39 -0
  31. package/templates/experiment_template.md +38 -0
  32. package/templates/portfolio_event.schema.json +69 -0
  33. package/templates/release_receipt_template.md +37 -0
@@ -8,7 +8,7 @@
8
8
  {
9
9
  "name": "continuous-improvement",
10
10
  "description": "The persistent-memory and runtime-discipline layer for Claude Code. It remembers the corrections you already gave, grounds every edit in real facts before it lands, and — through the Mulahazah engine — turns each fix into a reusable instinct, so a lesson learned once is applied automatically next time with no re-teaching. Built on the 7 Laws of AI Agent Discipline (research, plan, verify, reflect, learn) and shipped as 27 bundled skills, instinct-aware hooks, an MCP toolset for recall and reflection, and a GitHub Action transcript linter that feeds real work history back into sharper instincts.",
11
- "version": "3.17.0",
11
+ "version": "3.19.0",
12
12
  "source": "./plugins/continuous-improvement",
13
13
  "author": {
14
14
  "name": "naimkatiman"
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- <!-- README landing-page structure rationale: docs/plans/2026-05-14-readme-landing-rewrite.md -->
1
+ <!-- README landing-page structure rationale: docs/plans/2026-06-28-readme-progressive-disclosure.md (supersedes docs/plans/2026-05-14-readme-landing-rewrite.md) -->
2
2
 
3
3
  <p align="center">
4
4
  <img src="assets/combined.gif" alt="Before vs After — The 7 Laws of AI Agent Discipline" width="700" />
@@ -15,17 +15,30 @@
15
15
  </p>
16
16
 
17
17
  <p align="center">
18
- <a href="https://www.npmjs.com/package/continuous-improvement"><img src="https://img.shields.io/npm/v/continuous-improvement" alt="npm"></a>
18
+ <a href="https://www.npmjs.com/package/continuous-improvement"><img src="https://img.shields.io/npm/v/continuous-improvement" alt="npm version"></a>
19
+ <a href="https://www.npmjs.com/package/continuous-improvement"><img src="https://img.shields.io/npm/dm/continuous-improvement" alt="npm downloads"></a>
19
20
  <a href="https://docs.anthropic.com/en/docs/claude-code"><img src="https://img.shields.io/badge/Claude%20Code-skill-blueviolet" alt="Claude Code"></a>
20
21
  <a href="https://github.com/marketplace/actions/ai-agent-discipline-linter"><img src="https://img.shields.io/badge/GitHub%20Action-marketplace-blue" alt="GitHub Action"></a>
21
22
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" alt="license"></a>
22
- <a href="test/"><img src="https://img.shields.io/badge/tests-passing-brightgreen" alt="tests"></a>
23
23
  </p>
24
24
 
25
25
  <p align="center">
26
26
  <b>New here?</b> → <a href="QUICKSTART.md">QUICKSTART.md</a> (2 minutes) · <a href="https://continuous-improvement.dev">continuous-improvement.dev</a>
27
27
  </p>
28
28
 
29
+ ## Quick start
30
+
31
+ Inside Claude Code — two commands, no Node, no bash:
32
+
33
+ ```bash
34
+ /plugin marketplace add naimkatiman/continuous-improvement
35
+ /plugin install continuous-improvement@continuous-improvement
36
+ ```
37
+
38
+ **If you don't know which to pick, use Beginner.** That is the install above — enough for ~90% of users. Want the MCP server, observation hooks, and instinct packs too? See [Expert install](#install) below.
39
+
40
+ Verify it is live: run `/discipline` in Claude Code and you should see the 7 Laws card. (Commands load on session start — if it is not recognized, restart Claude Code once.)
41
+
29
42
  > **What this is *not*:** a prompt template, a `CLAUDE.md`, or a vibes-based reminder. It is a runtime hook (`hooks/gateguard.mjs`) plus a bundled skill set that makes the agent ground every change in real facts — it physically blocks `Edit` / `Write` / destructive `Bash` until the investigation is done, so edits land on understanding instead of guesses.
30
43
 
31
44
  ---
@@ -38,11 +51,13 @@ Claude Code is powerful but leaves intelligence on the table: it edits before re
38
51
  2. **During work** — bundled skills enforce planning, one-thing-at-a-time execution, TDD ([`tdd-workflow`](skills/tdd-workflow.md)), and a six-phase verification ladder ([`verification-loop`](skills/verification-loop.md)) before "done".
39
52
  3. **After work** — `/seven-laws` reflection plus the Mulahazah instinct engine capture lessons, and the opt-in [`recall-briefing`](hooks/recall-briefing.mjs) hook resurfaces the most relevant past fix on the next related prompt, so the same mistake does not repeat next session.
40
53
 
41
- Beginner install is two slash commands inside Claude Code (no Node, no bash). Expert install adds MCP tools, observation hooks, instinct packs, and a GitHub Action transcript linter for CI.
42
-
43
54
  ---
44
55
 
45
- ## Before and after
56
+ ## See it in action
57
+
58
+ <p align="center">
59
+ <img src="assets/gateguard-demo.png" alt="gateguard blocks an unresearched Edit until the investigation is on the table" width="820" />
60
+ </p>
46
61
 
47
62
  Without Continuous Improvement, "fix the login redirect bug" looks like this:
48
63
 
@@ -56,59 +71,38 @@ Same agent. Same model. Different intelligence.
56
71
 
57
72
  ---
58
73
 
59
- ## Who this is for
60
-
61
- Use this if you:
62
-
63
- - ship from real repositories with real consequences
64
- - have been bitten by an agent that edits before understanding
65
- - want tests, builds, or healthchecks to pass before "done"
66
- - want lessons from yesterday to survive into today
67
-
68
- Skip it if you:
69
-
70
- - only do one-off prompts (no edits, no commits)
71
- - do not use Claude Code
72
- - dislike *any* friction before agent edits
73
- - want a prompt template, not a runtime gate
74
-
75
- (The runtime gate is `hooks/gateguard.mjs`; full mechanics in [How enforcement works](#how-enforcement-works) below.)
76
-
77
- ---
74
+ ## The 7 Laws
78
75
 
79
- ## The problem this solves
76
+ | # | Law | What it gives the agent |
77
+ |---|-----|----------------------|
78
+ | 1 | **Research Before Executing** | builds on what already exists instead of reinventing it |
79
+ | 2 | **Plan Is Sacred** | lands effort on the goal with success defined up front |
80
+ | 3 | **One Thing at a Time** | ships each change on a known-good base |
81
+ | 4 | **Verify Before Reporting** | backs every "done" with evidence you can trust |
82
+ | 5 | **Reflect After Sessions** | turns each session into a captured lesson |
83
+ | 6 | **Iterate One Change** | keeps debugging isolated and the signal clean |
84
+ | 7 | **Learn From Every Session** | compounds knowledge so next week's agent is sharper |
80
85
 
81
- You have used Claude Code (or any agentic coding tool) long enough to recognize the failure pattern. Matt Pocock's [Skills For Real Engineers](https://github.com/mattpocock/skills) names four root failure modes that account for nearly every "the agent didn't help" complaint; the 7 Laws of AI Agent Discipline catch those four at the tool-call boundary plus a fifth that only shows up across sessions.
86
+ ```
87
+ Research -> Plan -> Execute (one thing) -> Verify -> Reflect -> Learn -> Iterate
88
+ ```
82
89
 
83
- | # | Failure mode | What you see | Which Law fires | What enforces it |
84
- |---|---|---|---|---|
85
- | 1 | **Misalignment** | The agent doesn't do what you want — invents requirements, reinvents helpers that already exist, or builds the wrong thing before anyone challenged the idea | Law 1 (Research) | [`roast`](skills/roast.md), [`grill-me`](skills/grill-me.md), [`grill-with-docs`](skills/grill-with-docs.md), [`gateguard`](skills/gateguard.md), [`workspace-surface-audit`](skills/workspace-surface-audit.md) |
86
- | 2 | **No shared language** | The agent uses 20 words where 1 would do; jargon decoded fresh every session; variable names drift from domain terms | Law 2 (Plan), Law 7 (Learn) | [`grill-with-docs`](skills/grill-with-docs.md) (writes & maintains `CONTEXT.md`), [`token-budget-advisor`](skills/token-budget-advisor.md), [`strategic-compact`](skills/strategic-compact.md) |
87
- | 3 | **No feedback loop** | The code doesn't work — agent claims "done" without running build, tests, or healthcheck | Law 4 (Verify) | [`tdd-workflow`](skills/tdd-workflow.md), [`verification-loop`](skills/verification-loop.md), [`deploy-receipt`](skills/deploy-receipt.md) |
88
- | 4 | **Design rot** | Ball-of-mud accelerates — agent bundles three concerns into one PR, stacks untested changes, ignores prior architectural decisions | Law 2 (Plan), Law 3 (One Thing) | [`superpowers:writing-plans`](https://github.com/obra/superpowers/blob/main/skills/writing-plans/SKILL.md), [`safety-guard`](skills/safety-guard.md), [`worktree-safety`](skills/worktree-safety.md), [`wild-risa-balance`](skills/wild-risa-balance.md) |
89
- | 5 | **Forgotten lessons** | Next session starts from zero — prior corrections, decisions, instincts are lost; the same mistake repeats next week | Law 5 (Reflect), Law 7 (Learn) | [`handoff`](skills/handoff.md), Mulahazah instinct engine |
90
+ <p align="center">
91
+ <img src="assets/diagram-7-laws-loop.jpg" alt="The 7 Laws of AI Agent Discipline — circular workflow loop" width="820" />
92
+ </p>
90
93
 
91
- Three of those alignment + reflection skills (`grill-me`, `grill-with-docs`, `handoff`) are MIT-licensed ports from mattpocock/skills; the rest are continuous-improvement-native. Every failure mode has at least one runtime hook or model-side skill that catches it before it lands in the diff.
94
+ Full spec, reflection-block format, and anti-examples: [SKILL.md](SKILL.md). Full Law-to-tool alignment matrix: [CONTRIBUTING.md § Law Coverage Matrix](CONTRIBUTING.md#law-coverage-matrix).
92
95
 
93
96
  ---
94
97
 
95
98
  ## Install
96
99
 
97
- **If you don't know which to pick, use Beginner.** It is enough for ~90% of users and adds no Node or bash dependency.
98
-
99
- ### Beginner — inside Claude Code, two commands (plus one optional companion)
100
-
101
- You get the 7 Laws skill, the hooks that enforce it, and the slash commands. Nothing else to install.
102
-
103
- ```bash
104
- # Inside Claude Code (no shell needed)
105
- /plugin marketplace add naimkatiman/continuous-improvement
106
- /plugin install continuous-improvement@continuous-improvement
107
- ```
100
+ **Beginner (recommended)** is the two-command [Quick start](#quick-start) above the 7 Laws skill, the hooks that enforce it, and the slash commands. Nothing else to install.
108
101
 
109
- The doubled name is correct: it reads as `<plugin>@<marketplace>`.
102
+ <details>
103
+ <summary><b>Optional companion — the <code>/superpowers</code> dispatcher (recommended)</b></summary>
110
104
 
111
- **Optional companion (recommended).** The `/superpowers` dispatcher routes per-task to specialist skills (`writing-plans`, `test-driven-development`, `using-git-worktrees`, `dispatching-parallel-agents`, `finishing-a-development-branch`, etc.) shipped by Obra's `superpowers` plugin, which is vendored into this same marketplace as a pinned-SHA snapshot. Install it with one extra line:
105
+ The `/superpowers` dispatcher routes per-task to specialist skills (`writing-plans`, `test-driven-development`, `using-git-worktrees`, `dispatching-parallel-agents`, `finishing-a-development-branch`, etc.) shipped by Obra's `superpowers` plugin, which is vendored into this same marketplace as a pinned-SHA snapshot. Install it with one extra line:
112
106
 
113
107
  ```bash
114
108
  /plugin install superpowers@continuous-improvement
@@ -116,9 +110,6 @@ The doubled name is correct: it reads as `<plugin>@<marketplace>`.
116
110
 
117
111
  Without the companion the dispatcher still works — every routing target has a concrete inline fallback — but specialist quality is fallback-quality, not dedicated-skill-quality.
118
112
 
119
- Verify: run `/discipline` in Claude Code — you should see the 7 Laws card.
120
- If the command is not recognized, restart your Claude Code session first; the marketplace did pick the plugin up but commands load on session start.
121
-
122
113
  **Second-stage verify (proves the runtime gate is firing — i.e. `hooks/gateguard.mjs` is invoked — not just docs claiming it).** Ask Claude to write a throwaway file with no research first:
123
114
 
124
115
  ```
@@ -127,7 +118,10 @@ Edit a new file scratch.txt and put the word "hello" in it. Don't research anyth
127
118
 
128
119
  You should see Claude **blocked** by the bundled `gateguard` PreToolUse hook (`hooks/gateguard.mjs`) with a fact-list reason. That block is the proof the hook is wired and enforcing. If Claude writes the file with no pause, the hook did not load — see Troubleshooting below. (To also verify observation hooks, run `/dashboard` and confirm a non-zero `Total` under `Observations`.)
129
120
 
130
- ### How enforcement works
121
+ </details>
122
+
123
+ <details>
124
+ <summary><b>How enforcement works (two layers: runtime hooks + model-side skills)</b></summary>
131
125
 
132
126
  The 7 Laws are enforced at **two layers**:
133
127
 
@@ -136,7 +130,10 @@ The 7 Laws are enforced at **two layers**:
136
130
 
137
131
  V1 honest limitations: the runtime gate is honor-system once the agent flips `_gateguard_facts_presented: true` (the hook can't verify the investigation actually happened); the state file is deletable and parallel hook invocations can race. Documented in `src/hooks/gateguard.mts` and `src/lib/gateguard-state.mts` headers.
138
132
 
139
- ### Expert — adds MCP server, observation hooks, and instinct packs
133
+ </details>
134
+
135
+ <details>
136
+ <summary><b>Expert install — MCP server, observation hooks, and instinct packs</b></summary>
140
137
 
141
138
  Pick this if you want the MCP tools (19 of them, including `ci_plan_init` / `ci_plan_status` for `task_plan.md`-style planning), the session hooks that feed Mulahazah, and starter packs.
142
139
 
@@ -151,7 +148,10 @@ npx continuous-improvement install --pack react # optional: react | python | g
151
148
  Verify: run `/dashboard` in Claude Code — you should see instinct health and observation count.
152
149
  Update later with `/plugin marketplace update continuous-improvement` or by re-running the npx command. When you run the npx installer, it makes one throttled, fail-open read of the public npm registry and prints a one-line notice if a newer version is published (no telemetry — nothing about you is sent). Silence it with `CLAUDE_CI_UPDATE_CHECK=off`.
153
150
 
154
- ### Troubleshooting install
151
+ </details>
152
+
153
+ <details>
154
+ <summary><b>Troubleshooting install</b></summary>
155
155
 
156
156
  Three failures account for nearly every install support thread. Try them in order:
157
157
 
@@ -163,7 +163,10 @@ Three failures account for nearly every install support thread. Try them in orde
163
163
 
164
164
  If none of those apply, paste the output of `npx continuous-improvement install` into a GitHub issue — that surface logs every step.
165
165
 
166
- ### Operator modes
166
+ </details>
167
+
168
+ <details>
169
+ <summary><b>Operator modes (env vars that change hook behavior)</b></summary>
167
170
 
168
171
  The framework has documented operator-level modes that change hook behavior without rebuilding the plugin. These are first-class — set them once in your shell rc and they persist across sessions.
169
172
 
@@ -171,10 +174,14 @@ The framework has documented operator-level modes that change hook behavior with
171
174
  |---|---|---|
172
175
  | `CLAUDE_THREE_SECTION_CLOSE_DISABLED=1` | `three-section-close.mjs` short-circuits before any enforcement or telemetry. Use when end-of-turn reflection should run as internal thinking rather than visible "What has been done / What is next / Recommendation" sections. Public default unchanged — the rule still fires for everyone else. | bash/zsh: `export CLAUDE_THREE_SECTION_CLOSE_DISABLED=1` in `~/.bashrc` / `~/.zshrc`. PowerShell: `$env:CLAUDE_THREE_SECTION_CLOSE_DISABLED=1` (session) or `[Environment]::SetEnvironmentVariable('CLAUDE_THREE_SECTION_CLOSE_DISABLED','1','User')` (persistent). |
173
176
  | `CLAUDE_GOAL_DRIFT_GATE` | `goal-drift-stop.mjs` (a `Stop` hook) scores each turn's activity against the `## Goal` in `task_plan.md` and acts on drift. `warn` (default) prints a one-line stderr notice and never blocks; `block` re-prompts a substantive wrap-up that has drifted off-goal so the goal gates the close; `off` disables it. Reads the same observation feed as Mulahazah; fails open on any error. | bash/zsh: `export CLAUDE_GOAL_DRIFT_GATE=block` in `~/.bashrc` / `~/.zshrc`. PowerShell: `$env:CLAUDE_GOAL_DRIFT_GATE='block'` (session) or `[Environment]::SetEnvironmentVariable('CLAUDE_GOAL_DRIFT_GATE','block','User')` (persistent). |
177
+ | `CLAUDE_TYPECHECK_GATE` | `hooks/typecheck-stop.mjs` (a `Stop` hook) runs the project typecheck (the `typecheck` npm script, else a local `tsc --noEmit`) on changed TS files at turn end and feeds a failure back to the model. `off` (default) is a no-op — the global advisory `typecheck-changed.sh` stays the default layer; `warn` prints a one-line stderr notice; `block` re-prompts with the tsc output so a headless/autonomous `-p` loop fixes its own type errors before ending the turn. Skips non-TS repos and turns where no TS file changed; fails open on any error or timeout. | bash/zsh: `export CLAUDE_TYPECHECK_GATE=block` in `~/.bashrc` / `~/.zshrc`. PowerShell: `$env:CLAUDE_TYPECHECK_GATE='block'` (session) or `[Environment]::SetEnvironmentVariable('CLAUDE_TYPECHECK_GATE','block','User')` (persistent). |
174
178
  | `CLAUDE_RECALL_BRIEFING=1` | `hooks/recall-briefing.mjs` (a UserPromptSubmit hook) makes episodic memory proactive: on the first substantive prompt of a session it searches this project's past observations (BM25) and injects a one-time `<system-reminder>` with the most relevant prior activity, so the agent reuses a past fix instead of re-deriving it. Opt-in and default off; it is an amplifier, never a gate — it cannot block a prompt and fails open. The `ci_recall` MCP tool stays available for explicit, deeper searches. | bash/zsh: `export CLAUDE_RECALL_BRIEFING=1` in `~/.bashrc` / `~/.zshrc`. PowerShell: `$env:CLAUDE_RECALL_BRIEFING=1` (session) or `[Environment]::SetEnvironmentVariable('CLAUDE_RECALL_BRIEFING','1','User')` (persistent). |
175
179
  | `CLAUDE_WORKFLOW_DISTILL_NUDGE=on` | `hooks/workflow-distill.mjs` (a `Stop` hook) closes the orchestration-to-memory loop: when a native Workflow run's output then passed a verify in the same session, it prints a one-line stderr nudge to run the `ci_distill_from_workflow` MCP tool, so an expensive multi-agent run leaves a durable Mulahazah draft instinct instead of evaporating. `on` enables it; default (unset or any other value) is off. Opt-in amplifier, never a gate — it cannot block the Stop, dedupes per run, and fails open. | bash/zsh: `export CLAUDE_WORKFLOW_DISTILL_NUDGE=on` in `~/.bashrc` / `~/.zshrc`. PowerShell: `$env:CLAUDE_WORKFLOW_DISTILL_NUDGE='on'` (session) or `[Environment]::SetEnvironmentVariable('CLAUDE_WORKFLOW_DISTILL_NUDGE','on','User')` (persistent). |
176
180
 
177
- ### Works with other agents
181
+ </details>
182
+
183
+ <details>
184
+ <summary><b>Works with other agents (Gemini, Codex, Cursor, Windsurf, Zed, Aider, Copilot)</b></summary>
178
185
 
179
186
  Claude Code gets the full install (hooks, MCP server, instinct learning). Every other agent platform can still run the 7 Laws as a rules file — one flag writes the skill text into the file that platform reads, at your project root:
180
187
 
@@ -194,43 +201,75 @@ npx continuous-improvement install --target gemini,codex
194
201
 
195
202
  Shared files (`GEMINI.md`, `AGENTS.md`, `.rules`, `CONVENTIONS.md`, `copilot-instructions.md`) are merged through a managed marker block — your existing content is preserved and reinstalls are idempotent. Targets can be combined freely (`--target claude,gemini,codex` runs the full Claude Code install plus the rules files).
196
203
 
204
+ </details>
205
+
197
206
  ---
198
207
 
199
- ## The 7 Laws
208
+ ## Who this is for
200
209
 
201
- | # | Law | What it gives the agent |
202
- |---|-----|----------------------|
203
- | 1 | **Research Before Executing** | builds on what already exists instead of reinventing it |
204
- | 2 | **Plan Is Sacred** | lands effort on the goal with success defined up front |
205
- | 3 | **One Thing at a Time** | ships each change on a known-good base |
206
- | 4 | **Verify Before Reporting** | backs every "done" with evidence you can trust |
207
- | 5 | **Reflect After Sessions** | turns each session into a captured lesson |
208
- | 6 | **Iterate One Change** | keeps debugging isolated and the signal clean |
209
- | 7 | **Learn From Every Session** | compounds knowledge so next week's agent is sharper |
210
+ <details>
211
+ <summary><b>Use it if you ship from real repos — skip it if you only do one-off prompts</b></summary>
210
212
 
211
- ```
212
- Research -> Plan -> Execute (one thing) -> Verify -> Reflect -> Learn -> Iterate
213
- ```
213
+ Use this if you:
214
214
 
215
- <p align="center">
216
- <img src="assets/diagram-7-laws-loop.jpg" alt="The 7 Laws of AI Agent Discipline circular workflow loop" width="820" />
217
- </p>
215
+ - ship from real repositories with real consequences
216
+ - have been bitten by an agent that edits before understanding
217
+ - want tests, builds, or healthchecks to pass before "done"
218
+ - want lessons from yesterday to survive into today
218
219
 
219
- Full spec, reflection-block format, and anti-examples: [SKILL.md](SKILL.md). Full Law-to-tool alignment matrix: [CONTRIBUTING.md § Law Coverage Matrix](CONTRIBUTING.md#law-coverage-matrix).
220
+ Skip it if you:
221
+
222
+ - only do one-off prompts (no edits, no commits)
223
+ - do not use Claude Code
224
+ - dislike *any* friction before agent edits
225
+ - want a prompt template, not a runtime gate
226
+
227
+ (The runtime gate is `hooks/gateguard.mjs`; full mechanics in [How enforcement works](#install) above.)
228
+
229
+ </details>
230
+
231
+ ---
232
+
233
+ ## The problem this solves
234
+
235
+ <details>
236
+ <summary><b>Five failure modes every agentic-coding user hits — and which Law catches each</b></summary>
237
+
238
+ You have used Claude Code (or any agentic coding tool) long enough to recognize the failure pattern. Matt Pocock's [Skills For Real Engineers](https://github.com/mattpocock/skills) names four root failure modes that account for nearly every "the agent didn't help" complaint; the 7 Laws of AI Agent Discipline catch those four at the tool-call boundary plus a fifth that only shows up across sessions.
239
+
240
+ | # | Failure mode | What you see | Which Law fires | What enforces it |
241
+ |---|---|---|---|---|
242
+ | 1 | **Misalignment** | The agent doesn't do what you want — invents requirements, reinvents helpers that already exist, or builds the wrong thing before anyone challenged the idea | Law 1 (Research) | [`roast`](skills/roast.md), [`grill-me`](skills/grill-me.md), [`grill-with-docs`](skills/grill-with-docs.md), [`gateguard`](skills/gateguard.md), [`workspace-surface-audit`](skills/workspace-surface-audit.md) |
243
+ | 2 | **No shared language** | The agent uses 20 words where 1 would do; jargon decoded fresh every session; variable names drift from domain terms | Law 2 (Plan), Law 7 (Learn) | [`grill-with-docs`](skills/grill-with-docs.md) (writes & maintains `CONTEXT.md`), [`token-budget-advisor`](skills/token-budget-advisor.md), [`strategic-compact`](skills/strategic-compact.md) |
244
+ | 3 | **No feedback loop** | The code doesn't work — agent claims "done" without running build, tests, or healthcheck | Law 4 (Verify) | [`tdd-workflow`](skills/tdd-workflow.md), [`verification-loop`](skills/verification-loop.md), [`deploy-receipt`](skills/deploy-receipt.md) |
245
+ | 4 | **Design rot** | Ball-of-mud accelerates — agent bundles three concerns into one PR, stacks untested changes, ignores prior architectural decisions | Law 2 (Plan), Law 3 (One Thing) | [`superpowers:writing-plans`](https://github.com/obra/superpowers/blob/main/skills/writing-plans/SKILL.md), [`safety-guard`](skills/safety-guard.md), [`worktree-safety`](skills/worktree-safety.md), [`wild-risa-balance`](skills/wild-risa-balance.md) |
246
+ | 5 | **Forgotten lessons** | Next session starts from zero — prior corrections, decisions, instincts are lost; the same mistake repeats next week | Law 5 (Reflect), Law 7 (Learn) | [`handoff`](skills/handoff.md), Mulahazah instinct engine |
247
+
248
+ Three of those alignment + reflection skills (`grill-me`, `grill-with-docs`, `handoff`) are MIT-licensed ports from mattpocock/skills; the rest are continuous-improvement-native. Every failure mode has at least one runtime hook or model-side skill that catches it before it lands in the diff.
249
+
250
+ </details>
220
251
 
221
252
  ---
222
253
 
223
254
  ## Mulahazah: auto-leveling learning
224
255
 
256
+ <details>
257
+ <summary><b>How instincts form, level up, and decay — you configure nothing</b></summary>
258
+
225
259
  Hooks capture every tool call. After ~20 observations Claude analyzes patterns and creates **instincts** with confidence scores: silent below 0.5, suggested at 0.5–0.69, auto-applied at 0.7+. Corrections drop confidence by 0.1; unused instincts decay. Project-scoped; promoted to global after seen across 2+ projects. You configure nothing.
226
260
 
227
261
  <p align="center">
228
262
  <img src="assets/diagram-mulahazah-learning.jpg" alt="Mulahazah pipeline" width="820" />
229
263
  </p>
230
264
 
265
+ </details>
266
+
231
267
  ---
232
268
 
233
- ## Slash Commands
269
+ ## Slash commands
270
+
271
+ <details>
272
+ <summary><b>All 28 commands (Beginner gets every one)</b></summary>
234
273
 
235
274
  `/seven-laws` is the canonical reflect-and-learn command. `/continuous-improvement` is kept as an alias for backward compatibility — both run the same workflow.
236
275
 
@@ -240,22 +279,34 @@ Hooks capture every tool call. After ~20 observations Claude analyzes patterns a
240
279
  /proceed-with-the-recommendation Walk any agent's recommendation list top-to-bottom
241
280
  /superpowers Law activator — route the task to the right specialist
242
281
  /workspace-surface-audit Audit repo + MCP + env, recommend high-value skills
243
- /planning-with-files Create task_plan.md, findings.md, progress.md
282
+ /roast 5-persona adversarial council — GO / RESHAPE / KILL on an idea
244
283
  /grill-me Interview-mode alignment (one question at a time)
245
284
  /grill-with-docs Grill-me with persistent outcomes — updates CONTEXT.md + ADRs inline
285
+ /intent-driven-development Scope an ambiguous change into verifiable acceptance criteria
286
+ /planning-with-files Create task_plan.md, findings.md, progress.md
287
+ /goal-check Score recent activity against the task_plan.md goal (drift detector)
288
+ /reconcile Establish git ground truth before any mutation; verify a push landed
289
+ /audit Audit recent commits for real defects, confirm each before fixing
290
+ /ship Single-defect fast path — reconcile, TDD fix, verify, one PR
291
+ /production-readiness-review Parallel readiness gate — severity-ranked punch-list (reports only)
246
292
  /handoff End-of-session compaction into mktemp brief for the next agent
293
+ /recall BM25 search over past observations — "have I hit this before?"
247
294
  /discipline Quick reference card of the 7 Laws
295
+ /model-forward Restate the model-forward stance — go with the model, not against it
248
296
  /verify-install One-shot post-install check — commands, gateguard, observe
249
297
  /dashboard Visual instinct health dashboard
250
298
  /companion-preference Inspect companion-preference hook telemetry
251
299
  /ralph Autonomous PRD story-by-story loop
252
300
  /learn-eval Capture session patterns into new skills (needs observation history)
253
301
  /harvest Extract reusable patterns from session friction (needs observation history)
302
+ /distill Distill repeated successful sequences into draft instincts (needs observation history)
254
303
  /release-train Coordinate a multi-PR release sequence
255
304
  /swarm Fan-out coordination across parallel sub-agents
256
305
  ```
257
306
 
258
- All 18 ship in the marketplace bundle. The Beginner install gets all of them — with one caveat: `/learn-eval` and `/harvest` only produce useful output once Mulahazah has accumulated observation history (~20 observations), so running them on day 1 returns an empty result, not a broken command. `/swarm` and `/release-train` are orchestration commands aimed at larger multi-agent or multi-PR work. In Expert (`npx`) mode, the installer mirrors the full set into `~/.claude/commands/` and additionally exposes the planning workflow through the MCP tools `ci_plan_init` (initialize `task_plan.md`, `findings.md`, `progress.md` in the project root) and `ci_plan_status` (summarize their current contents).
307
+ All 28 ship in the marketplace bundle. The Beginner install gets all of them — with one caveat: `/learn-eval`, `/harvest`, and `/distill` only produce useful output once Mulahazah has accumulated observation history (~20 observations), so running them on day 1 returns an empty result, not a broken command. `/swarm` and `/release-train` are orchestration commands aimed at larger multi-agent or multi-PR work. In Expert (`npx`) mode, the installer mirrors the full set into `~/.claude/commands/` and additionally exposes the planning workflow through the MCP tools `ci_plan_init` (initialize `task_plan.md`, `findings.md`, `progress.md` in the project root) and `ci_plan_status` (summarize their current contents).
308
+
309
+ </details>
259
310
 
260
311
  ---
261
312
 
@@ -280,17 +331,48 @@ Catches writes without prior research (Law 1), too many edits without verificati
280
331
 
281
332
  ---
282
333
 
283
- ## Uninstall
334
+ ## Portfolio spine
335
+
336
+ Two standalone commands turn a multi-repo portfolio into scored, auditable evidence. Both are offline: they read local files only, no network.
337
+
338
+ **`ci-audit-actions`** — static GitHub Actions security scan. Flags missing/over-broad `permissions:`, unpinned actions, missing job timeouts, missing concurrency, untrusted event text interpolated into `run:`, and dangerous triggers combined with secrets. Writes a markdown report; `--strict` exits 1 on high-severity findings.
284
339
 
285
340
  ```bash
286
- npx continuous-improvement install --uninstall
341
+ npx -p continuous-improvement ci-audit-actions --repo . --out reports/actions-security.md --strict
287
342
  ```
288
343
 
289
- Removes skill, hooks, commands, MCP server. Learned instincts in `~/.claude/instincts/` are preserved delete manually for a clean slate.
344
+ **`ci-portfolio-health`** — scores every repo in a `portfolio/repos.json` registry 0-100 from local proof signals (CI presence, release receipts, experiment records, commit freshness, high-severity audit findings) and writes a worst-first table with a named next action per repo.
345
+
346
+ ```bash
347
+ npx -p continuous-improvement ci-portfolio-health --config portfolio/repos.json --out reports/portfolio-health.md
348
+ ```
349
+
350
+ Proof-format templates ship in [templates/](templates/): `release_receipt_template.md`, `experiment_template.md`, `actions_security_checklist.md`, and `portfolio_event.schema.json`.
290
351
 
291
352
  ---
292
353
 
293
- ## The Brand Stack
354
+ ## More
355
+
356
+ - [QUICKSTART.md](QUICKSTART.md) — 2-minute setup
357
+ - [SKILL.md](SKILL.md) — full 7 Laws spec
358
+ - [docs/skills.md](docs/skills.md) — full 27-skill catalog
359
+ - [examples/](examples/) — bug fix, feature build, refactor walkthroughs
360
+ - [templates/insights-claude-md.md](templates/insights-claude-md.md) — paste-in CLAUDE.md blocks for verification discipline, environment notes, think-before-acting, and git/deploy workflow (sourced from the 28-day usage report)
361
+ - [CONTRIBUTING.md](CONTRIBUTING.md) — architecture, repo internals, adding a new skill
362
+ - [SECURITY.md](SECURITY.md)
363
+
364
+ <details>
365
+ <summary><b>Uninstall · the brand stack · in the wild</b></summary>
366
+
367
+ ### Uninstall
368
+
369
+ ```bash
370
+ npx continuous-improvement install --uninstall
371
+ ```
372
+
373
+ Removes skill, hooks, commands, MCP server. Learned instincts in `~/.claude/instincts/` are preserved — delete manually for a clean slate.
374
+
375
+ ### The brand stack
294
376
 
295
377
  One product, three names. Use the one that fits the audience:
296
378
 
@@ -302,28 +384,12 @@ One product, three names. Use the one that fits the audience:
302
384
 
303
385
  Every skill description leads with `Enforces Law N (...)` so the discipline tag shows up the moment the skill is loaded; the lint `verify:skill-law-tag` blocks any skill that drops the tag.
304
386
 
305
- ---
306
-
307
- ## In the wild
387
+ ### In the wild
308
388
 
309
389
  Workflows from this repo, applied to real open-source contributions:
310
390
 
311
- ### pm-skills (product-on-purpose, Apache 2.0)
312
-
313
- [F-07 discover-market-sizing](https://github.com/product-on-purpose/pm-skills/pull/141) - new domain skill in the Discover phase covering TAM/SAM/SOM market sizing for the [pm-skills](https://github.com/product-on-purpose/pm-skills) library.
391
+ **pm-skills (product-on-purpose, Apache 2.0)** — [F-07 discover-market-sizing](https://github.com/product-on-purpose/pm-skills/pull/141), a new domain skill in the Discover phase covering TAM/SAM/SOM market sizing for the [pm-skills](https://github.com/product-on-purpose/pm-skills) library. Authored end-to-end with `/superpowers` and `/proceed-with-the-recommendation`: surface audit before any code, brainstorm gate with WILD/RISA framing, branch isolation off the upstream fork, single-skill PR scope per the upstream maintainer's curated-contributions model, count cascade across 23 docs files, and 9 local validators green before push.
314
392
 
315
- Authored end-to-end with `/superpowers` and `/proceed-with-the-recommendation`: surface audit before any code, brainstorm gate with WILD/RISA framing, branch isolation off the upstream fork, single-skill PR scope per the upstream maintainer's curated-contributions model, count cascade across 23 docs files, and 9 local validators green before push (`lint-skills-frontmatter`, `validate-agents-md`, `validate-commands`, `check-count-consistency`, `check-nav-completeness`, `check-generated-content-untouched`, `check-generated-freshness`, `validate-meeting-skills-family`, `validate-plugin-install`).
316
-
317
- ---
318
-
319
- ## More
320
-
321
- - [QUICKSTART.md](QUICKSTART.md) — 2-minute setup
322
- - [SKILL.md](SKILL.md) — full 7 Laws spec
323
- - [docs/skills.md](docs/skills.md) — full 27-skill catalog
324
- - [examples/](examples/) — bug fix, feature build, refactor walkthroughs
325
- - [templates/insights-claude-md.md](templates/insights-claude-md.md) — paste-in CLAUDE.md blocks for verification discipline, environment notes, think-before-acting, and git/deploy workflow (sourced from the 28-day usage report)
326
- - [CONTRIBUTING.md](CONTRIBUTING.md) — architecture, repo internals, adding a new skill
327
- - [SECURITY.md](SECURITY.md)
393
+ </details>
328
394
 
329
395
  MIT.