continuous-improvement 3.1.0 → 3.8.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 (126) hide show
  1. package/.claude-plugin/marketplace.json +78 -0
  2. package/CHANGELOG.md +191 -0
  3. package/LICENSE +21 -21
  4. package/QUICKSTART.md +101 -81
  5. package/README.md +207 -359
  6. package/SKILL.md +87 -9
  7. package/action.yml +33 -33
  8. package/bin/analyze.sh +161 -153
  9. package/bin/backfill.mjs +172 -0
  10. package/bin/check-docs-substrings.mjs +333 -0
  11. package/bin/check-everything-mirror.mjs +145 -0
  12. package/bin/check-routing-targets.mjs +151 -0
  13. package/bin/check-skill-law-tag.mjs +128 -0
  14. package/bin/check-skill-mirror.mjs +119 -0
  15. package/bin/check-skill-tiers.mjs +116 -0
  16. package/bin/check-third-party-shape.mjs +202 -0
  17. package/bin/generate-plugin-manifests.mjs +169 -0
  18. package/bin/harvest-friction.mjs +279 -0
  19. package/bin/hook-stats.mjs +258 -0
  20. package/bin/install.mjs +417 -516
  21. package/bin/lint-transcript.mjs +182 -210
  22. package/bin/mcp-server.mjs +840 -617
  23. package/bin/observe.mjs +148 -0
  24. package/bin/pre-commit-block-strays.sh +49 -0
  25. package/bin/refresh-third-party.mjs +416 -0
  26. package/bin/unified-cli.mjs +533 -0
  27. package/commands/continuous-improvement.md +115 -74
  28. package/commands/dashboard.md +56 -56
  29. package/commands/discipline.md +51 -37
  30. package/commands/harvest.md +76 -0
  31. package/commands/learn-eval.md +117 -0
  32. package/commands/planning-with-files.md +66 -0
  33. package/commands/proceed-with-the-recommendation.md +62 -0
  34. package/commands/ralph.md +103 -0
  35. package/commands/release-train.md +81 -0
  36. package/commands/seven-laws.md +16 -0
  37. package/commands/superpowers.md +153 -0
  38. package/commands/swarm.md +101 -0
  39. package/commands/workspace-surface-audit.md +77 -0
  40. package/hooks/observe.sh +172 -134
  41. package/hooks/session.sh +106 -106
  42. package/hooks/three-section-close.mjs +181 -0
  43. package/instinct-packs/go.json +58 -58
  44. package/instinct-packs/meta.json +16 -0
  45. package/instinct-packs/python.json +58 -58
  46. package/instinct-packs/react.json +58 -58
  47. package/lib/cli-anything.mjs +401 -0
  48. package/lib/compound-engineering.mjs +831 -0
  49. package/lib/observe-event.mjs +128 -0
  50. package/lib/plugin-metadata.mjs +432 -0
  51. package/lib/pm-marketplace.mjs +61 -0
  52. package/lib/pm-skills.mjs +1274 -0
  53. package/lib/resolve-home-dir.mjs +43 -0
  54. package/lib/skill-tiers.mjs +137 -0
  55. package/lib/unified-plugin.mjs +924 -0
  56. package/llms.txt +68 -43
  57. package/package.json +28 -19
  58. package/plugins/beginner.json +17 -6
  59. package/plugins/continuous-improvement/.claude-plugin/marketplace.json +20 -0
  60. package/plugins/continuous-improvement/.claude-plugin/plugin.json +26 -0
  61. package/plugins/continuous-improvement/LICENSE +21 -0
  62. package/plugins/continuous-improvement/README.md +56 -0
  63. package/plugins/continuous-improvement/bin/backfill.mjs +172 -0
  64. package/plugins/continuous-improvement/bin/mcp-server.mjs +886 -0
  65. package/plugins/continuous-improvement/bin/observe.mjs +148 -0
  66. package/plugins/continuous-improvement/commands/continuous-improvement.md +115 -0
  67. package/plugins/continuous-improvement/commands/dashboard.md +56 -0
  68. package/plugins/continuous-improvement/commands/discipline.md +51 -0
  69. package/plugins/continuous-improvement/commands/harvest.md +76 -0
  70. package/plugins/continuous-improvement/commands/learn-eval.md +117 -0
  71. package/plugins/continuous-improvement/commands/planning-with-files.md +66 -0
  72. package/plugins/continuous-improvement/commands/proceed-with-the-recommendation.md +62 -0
  73. package/plugins/continuous-improvement/commands/ralph.md +103 -0
  74. package/plugins/continuous-improvement/commands/release-train.md +81 -0
  75. package/plugins/continuous-improvement/commands/seven-laws.md +16 -0
  76. package/plugins/continuous-improvement/commands/superpowers.md +153 -0
  77. package/plugins/continuous-improvement/commands/swarm.md +101 -0
  78. package/plugins/continuous-improvement/commands/workspace-surface-audit.md +77 -0
  79. package/plugins/continuous-improvement/hooks/hooks.json +60 -0
  80. package/plugins/continuous-improvement/hooks/observe.sh +172 -0
  81. package/plugins/continuous-improvement/hooks/session.sh +106 -0
  82. package/plugins/continuous-improvement/hooks/three-section-close.mjs +181 -0
  83. package/plugins/continuous-improvement/instinct-packs/go.json +58 -0
  84. package/plugins/continuous-improvement/instinct-packs/meta.json +16 -0
  85. package/plugins/continuous-improvement/instinct-packs/python.json +58 -0
  86. package/plugins/continuous-improvement/instinct-packs/react.json +58 -0
  87. package/plugins/continuous-improvement/lib/observe-event.mjs +128 -0
  88. package/plugins/continuous-improvement/lib/plugin-metadata.mjs +432 -0
  89. package/plugins/continuous-improvement/lib/resolve-home-dir.mjs +43 -0
  90. package/plugins/continuous-improvement/skills/README.md +34 -0
  91. package/plugins/continuous-improvement/skills/continuous-improvement/SKILL.md +249 -0
  92. package/plugins/continuous-improvement/skills/deploy-receipt/SKILL.md +131 -0
  93. package/plugins/continuous-improvement/skills/gateguard/SKILL.md +155 -0
  94. package/plugins/continuous-improvement/skills/para-memory-files/SKILL.md +108 -0
  95. package/plugins/continuous-improvement/skills/proceed-with-the-recommendation/SKILL.md +454 -0
  96. package/plugins/continuous-improvement/skills/ralph/SKILL.md +221 -0
  97. package/plugins/continuous-improvement/skills/safety-guard/SKILL.md +76 -0
  98. package/plugins/continuous-improvement/skills/strategic-compact/SKILL.md +104 -0
  99. package/plugins/continuous-improvement/skills/superpowers/SKILL.md +212 -0
  100. package/plugins/continuous-improvement/skills/tdd-workflow/SKILL.md +411 -0
  101. package/plugins/continuous-improvement/skills/token-budget-advisor/SKILL.md +136 -0
  102. package/plugins/continuous-improvement/skills/verification-loop/SKILL.md +192 -0
  103. package/plugins/continuous-improvement/skills/wild-risa-balance/SKILL.md +191 -0
  104. package/plugins/continuous-improvement/skills/workspace-surface-audit/SKILL.md +147 -0
  105. package/plugins/continuous-improvement/templates/planning-with-files/findings.md +8 -0
  106. package/plugins/continuous-improvement/templates/planning-with-files/progress.md +7 -0
  107. package/plugins/continuous-improvement/templates/planning-with-files/task_plan.md +23 -0
  108. package/plugins/expert.json +26 -5
  109. package/skills/README.md +79 -0
  110. package/skills/deploy-receipt.md +131 -0
  111. package/skills/gateguard.md +155 -0
  112. package/skills/para-memory-files.md +108 -0
  113. package/skills/proceed-with-the-recommendation.md +454 -0
  114. package/skills/ralph.md +221 -0
  115. package/skills/safety-guard.md +76 -0
  116. package/skills/strategic-compact.md +104 -0
  117. package/skills/superpowers.md +212 -0
  118. package/skills/tdd-workflow.md +411 -0
  119. package/skills/token-budget-advisor.md +136 -0
  120. package/skills/verification-loop.md +192 -0
  121. package/skills/wild-risa-balance.md +191 -0
  122. package/skills/workspace-surface-audit.md +147 -0
  123. package/templates/planning-with-files/findings.md +8 -0
  124. package/templates/planning-with-files/progress.md +7 -0
  125. package/templates/planning-with-files/task_plan.md +23 -0
  126. package/templates/verify-ladder.example.json +47 -0
package/llms.txt CHANGED
@@ -1,43 +1,68 @@
1
- # continuous-improvement
2
-
3
- > The 7 Laws of AI Agent Discipline — stop your agent from skipping steps, guessing, and declaring "done" without verifying.
4
-
5
- ## What This Is
6
-
7
- A discipline framework for AI coding agents. It teaches agents structured thinking through 7 laws and builds behavioral instincts over time via the Mulahazah learning system.
8
-
9
- ## Install
10
-
11
- ```bash
12
- npx continuous-improvement install
13
- ```
14
-
15
- ## The 7 Laws
16
-
17
- 1. Research Before Executing — search before writing
18
- 2. Plan Is Sacred — state WILL/WILL NOT/VERIFY before acting
19
- 3. One Thing at a Time — complete and verify one task before the next
20
- 4. Verify Before Reporting — "done" requires actual proof
21
- 5. Reflect After Sessions — capture what worked and what failed
22
- 6. Iterate One Change — one change, verify, then next
23
- 7. Learn From Every Session — patterns become instincts
24
-
25
- ## Key Concepts
26
-
27
- - **Mulahazah** auto-leveling learning system that captures tool usage patterns
28
- - **Instincts** — YAML-based behavioral rules with confidence scoring (0.0-0.9)
29
- - **Auto-leveling** — CAPTURE → ANALYZE → SUGGEST → AUTO-APPLY (no config needed)
30
- - **Project-scoped** — instincts are per-project, promoted to global when seen in 2+ projects
31
-
32
- ## Works With
33
-
34
- - Claude Code (full support: skill + hooks + MCP server)
35
- - Cursor, Zed, Windsurf, VS Code (MCP server)
36
- - Codex, Gemini CLI, OpenClaw (skill only)
37
- - Any LLM (paste SKILL.md into system prompt)
38
-
39
- ## Links
40
-
41
- - GitHub: https://github.com/naimkatiman/continuous-improvement
42
- - npm: https://www.npmjs.com/package/continuous-improvement
43
- - Skill file: https://raw.githubusercontent.com/naimkatiman/continuous-improvement/main/SKILL.md
1
+ # continuous-improvement
2
+
3
+ > Stops Claude Code from skipping research, claiming 'done' without verifying, and repeating yesterday's mistakes. The 7 Laws of AI Agent Discipline — 13 enforcement skills, gating hooks, and the Mulahazah auto-leveling instinct engine.
4
+
5
+ ## What This Is
6
+
7
+ A discipline framework for AI coding agents. It enforces seven laws research, plan, execute one thing at a time, verify, reflect, iterate, learn — and builds behavioral instincts over time via the Mulahazah learning system, so the same correction does not have to be given twice.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npx continuous-improvement install
13
+ ```
14
+
15
+ ## The 7 Laws
16
+
17
+ 1. Research Before Executing — search before writing
18
+ 2. Plan Is Sacred — state WILL/WILL NOT/VERIFY before acting
19
+ 3. One Thing at a Time — complete and verify one task before the next
20
+ 4. Verify Before Reporting — "done" requires actual proof
21
+ 5. Reflect After Sessions — capture what worked, what failed, and the top-3 next moves
22
+ 6. Iterate One Change — one change, verify, then next
23
+ 7. Learn From Every Session — patterns become instincts
24
+
25
+ ## Reflection Block (Law 5 -> Law 6 Handoff)
26
+
27
+ Each reflection ends with a ranked top-3 of concrete core-development next moves:
28
+
29
+ ```
30
+ ## Reflection
31
+ - What worked:
32
+ - What failed:
33
+ - What I'd do differently:
34
+ - Rule to add:
35
+ - Iteration Next best recommendations (ranked, top 3):
36
+ 1. <primary>
37
+ 2. <alternative different angle>
38
+ 3. <alternative — smaller/larger scope>
39
+ ```
40
+
41
+ The Iteration field is build/fix/refactor/investigate moves only — not git steps, not verification re-runs, not deploy actions. Format per item: `<verb> <object at path:line> (<why>)`. Full spec in SKILL.md.
42
+
43
+ ## Key Concepts
44
+
45
+ - **Mulahazah** — auto-leveling learning system that captures tool usage patterns
46
+ - **Instincts** — YAML-based behavioral rules with confidence scoring (0.0-0.9)
47
+ - **Auto-leveling** — CAPTURE → ANALYZE → SUGGEST → AUTO-APPLY (no config needed)
48
+ - **Project-scoped** — instincts are per-project, promoted to global when seen in 2+ projects
49
+ - **Planning-With-Files** — opt-in project-root memory files: `task_plan.md`, `findings.md`, `progress.md`
50
+
51
+ ## Optional Planning Workflow
52
+
53
+ When a task needs persistent file-based planning, use the `planning-with-files` workflow to create:
54
+ - `task_plan.md` — phases, status, decisions, errors
55
+ - `findings.md` — research notes and sources
56
+ - `progress.md` — session log and verification notes
57
+
58
+ This workflow is explicit and opt-in. Files are created in the git root when available, otherwise the current working directory.
59
+
60
+ ## Works With
61
+
62
+ - Claude Code (full support: skill + hooks + MCP server + slash commands + auto-leveling instincts)
63
+
64
+ ## Links
65
+
66
+ - GitHub: https://github.com/naimkatiman/continuous-improvement
67
+ - npm: https://www.npmjs.com/package/continuous-improvement
68
+ - Skill file: https://raw.githubusercontent.com/naimkatiman/continuous-improvement/main/SKILL.md
package/package.json CHANGED
@@ -1,32 +1,20 @@
1
1
  {
2
2
  "name": "continuous-improvement",
3
- "version": "3.1.0",
4
- "description": "The 7 Laws of AI Agent Discipline — stop your agent from skipping steps, guessing, and declaring 'done' without verifying. Auto-leveling instinct learning with MCP server, GitHub Action transcript linter, and starter instinct packs for Claude Code, Cursor, Codex, Gemini CLI.",
3
+ "version": "3.8.0",
4
+ "description": "Stops Claude Code from skipping research, claiming 'done' without verifying, and repeating yesterday's mistakes. The 7 Laws of AI Agent Discipline — 13 enforcement skills, gating hooks, the Mulahazah auto-leveling instinct engine, and a GitHub Action transcript linter. Beginner: one /plugin install command. Expert: adds MCP tools and session hooks.",
5
5
  "keywords": [
6
6
  "claude-code",
7
7
  "claude-code-skill",
8
8
  "ai-agent",
9
9
  "agent-skill",
10
- "codex",
11
- "cursor",
12
- "gemini-cli",
13
10
  "ai-discipline",
14
- "workflow",
15
- "productivity",
16
11
  "mulahazah",
17
12
  "instinct",
18
- "learning",
19
13
  "hooks",
20
- "continuous-improvement",
21
14
  "mcp",
22
15
  "mcp-server",
23
- "plugin",
24
16
  "github-action",
25
- "transcript-linter",
26
- "agent-discipline",
27
- "developer-tools",
28
- "anthropic",
29
- "llm"
17
+ "transcript-linter"
30
18
  ],
31
19
  "author": "naimkatiman",
32
20
  "license": "MIT",
@@ -40,13 +28,27 @@
40
28
  },
41
29
  "bin": {
42
30
  "continuous-improvement": "bin/install.mjs",
43
- "ci-lint-transcript": "bin/lint-transcript.mjs"
31
+ "ci-lint-transcript": "bin/lint-transcript.mjs",
32
+ "ci": "bin/unified-cli.mjs"
44
33
  },
45
34
  "scripts": {
46
- "test": "node --test test/*.test.mjs",
47
- "lint": "node bin/lint-transcript.mjs --help"
35
+ "build": "tsc -p tsconfig.json && node bin/generate-plugin-manifests.mjs",
36
+ "typecheck": "tsc -p tsconfig.json --noEmit",
37
+ "clean": "node -e \"const fs=require('node:fs'); for (const dir of ['bin','test','lib']) { if (!fs.existsSync(dir)) continue; for (const file of fs.readdirSync(dir)) { if (file.endsWith('.mjs')) fs.rmSync(dir + '/' + file, { force: true }); } }\"",
38
+ "hooks:stats": "node bin/hook-stats.mjs",
39
+ "test": "npm run build && node --test test/*.test.mjs",
40
+ "lint": "node bin/lint-transcript.mjs --help",
41
+ "verify:generated": "npm run build && git diff --exit-code -- .claude-plugin bin test lib plugins",
42
+ "verify:skill-mirror": "node bin/check-skill-mirror.mjs",
43
+ "verify:skill-tiers": "node bin/check-skill-tiers.mjs",
44
+ "verify:skill-law-tag": "node bin/check-skill-law-tag.mjs",
45
+ "verify:docs-substrings": "node bin/check-docs-substrings.mjs",
46
+ "verify:everything-mirror": "node bin/check-everything-mirror.mjs",
47
+ "verify:routing-targets": "node bin/check-routing-targets.mjs",
48
+ "verify:all": "npm run verify:skill-mirror && npm run verify:skill-tiers && npm run verify:skill-law-tag && npm run verify:docs-substrings && npm run verify:everything-mirror && npm run verify:routing-targets && npm run typecheck"
48
49
  },
49
50
  "files": [
51
+ ".claude-plugin/",
50
52
  "SKILL.md",
51
53
  "QUICKSTART.md",
52
54
  "CHANGELOG.md",
@@ -54,10 +56,17 @@
54
56
  "llms.txt",
55
57
  "action.yml",
56
58
  "bin/",
59
+ "lib/",
57
60
  "hooks/",
58
61
  "commands/",
62
+ "skills/",
63
+ "templates/",
59
64
  "plugins/",
60
65
  "instinct-packs/"
61
66
  ],
62
- "type": "module"
67
+ "type": "module",
68
+ "devDependencies": {
69
+ "@types/node": "^24.6.0",
70
+ "typescript": "^5.9.3"
71
+ }
63
72
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "continuous-improvement",
3
- "version": "3.1.0",
3
+ "version": "3.8.0",
4
4
  "mode": "beginner",
5
- "description": "3 simple tools: check status, view instincts, reflect on sessions. No config needed.",
5
+ "description": "Beginner mode: see what your agent learned, list its instincts, and request a session reflection. Bundles four discipline skills (gateguard, para-memory-files, tdd-workflow, verification-loop) so research, memory, tests, and verification happen by default.",
6
6
  "tools": [
7
7
  {
8
8
  "name": "ci_status",
@@ -22,7 +22,11 @@
22
22
  "mcpServers": {
23
23
  "continuous-improvement": {
24
24
  "command": "node",
25
- "args": ["<install-path>/bin/mcp-server.mjs", "--mode", "beginner"]
25
+ "args": [
26
+ "<install-path>/bin/mcp-server.mjs",
27
+ "--mode",
28
+ "beginner"
29
+ ]
26
30
  }
27
31
  }
28
32
  },
@@ -30,13 +34,20 @@
30
34
  "mcpServers": {
31
35
  "continuous-improvement": {
32
36
  "command": "node",
33
- "args": ["<install-path>/bin/mcp-server.mjs", "--mode", "beginner"]
37
+ "args": [
38
+ "<install-path>/bin/mcp-server.mjs",
39
+ "--mode",
40
+ "beginner"
41
+ ]
34
42
  }
35
43
  }
36
44
  }
37
45
  },
38
46
  "hooks": {
39
- "included": ["PreToolUse", "PostToolUse"],
40
- "description": "Silently captures every tool call as observations. <50ms, never blocks."
47
+ "included": [
48
+ "PreToolUse",
49
+ "PostToolUse"
50
+ ],
51
+ "description": "Silently captures every tool call as observations. Lightweight and non-blocking."
41
52
  }
42
53
  }
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "continuous-improvement-dev",
3
+ "description": "Development marketplace for the Continuous Improvement Claude Code plugin.",
4
+ "owner": {
5
+ "name": "naimkatiman"
6
+ },
7
+ "plugins": [
8
+ {
9
+ "name": "continuous-improvement",
10
+ "description": "Stops Claude Code from skipping research, claiming 'done' without verifying, and repeating yesterday's mistakes. The 7 Laws of AI Agent Discipline — 13 enforcement skills, gating hooks, and the Mulahazah auto-leveling instinct engine.",
11
+ "version": "3.8.0",
12
+ "source": "./",
13
+ "author": {
14
+ "name": "naimkatiman"
15
+ },
16
+ "category": "productivity",
17
+ "homepage": "https://github.com/naimkatiman/continuous-improvement"
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "continuous-improvement",
3
+ "version": "3.8.0",
4
+ "description": "Stops Claude Code from skipping research, claiming 'done' without verifying, and repeating yesterday's mistakes. The 7 Laws of AI Agent Discipline — 13 enforcement skills, gating hooks, and the Mulahazah auto-leveling instinct engine.",
5
+ "author": {
6
+ "name": "naimkatiman",
7
+ "url": "https://github.com/naimkatiman"
8
+ },
9
+ "homepage": "https://github.com/naimkatiman/continuous-improvement#readme",
10
+ "repository": "https://github.com/naimkatiman/continuous-improvement",
11
+ "license": "MIT",
12
+ "keywords": [
13
+ "claude-code",
14
+ "claude-code-skill",
15
+ "ai-agent",
16
+ "agent-skill",
17
+ "ai-discipline",
18
+ "mulahazah",
19
+ "instinct",
20
+ "hooks",
21
+ "mcp",
22
+ "mcp-server",
23
+ "github-action",
24
+ "transcript-linter"
25
+ ]
26
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Naim Katiman
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,56 @@
1
+ # Continuous Improvement Plugin Bundle (Claude Code)
2
+
3
+ This directory is generated by `npm run build`.
4
+ Do not edit files here manually; edit the source files in the repo root and rebuild.
5
+
6
+ Included surfaces:
7
+ - `.claude-plugin/plugin.json`
8
+ - `.claude-plugin/marketplace.json`
9
+ - `skills/`
10
+ - `commands/`
11
+ - `hooks/`
12
+ - `bin/mcp-server.mjs`
13
+ - `bin/observe.mjs`
14
+ - `bin/backfill.mjs`
15
+ - `lib/plugin-metadata.mjs`
16
+ - `lib/observe-event.mjs`
17
+ - `instinct-packs/`
18
+ - `templates/planning-with-files/`
19
+
20
+ ## Required vs Optional companions
21
+
22
+ The `proceed-with-the-recommendation` skill (bundled here) routes each
23
+ recommendation it walks to a specialist skill. Some specialists ship in
24
+ this bundle; the rest live in external plugins. Every external routing
25
+ target has a concretely-worded inline fallback in the orchestrator skill,
26
+ so the plugin works on a clean install with no other plugins present —
27
+ the trade-off is fallback quality vs dedicated-skill quality.
28
+
29
+ **Bundled with this plugin (no extra install needed):**
30
+
31
+ - `continuous-improvement` — core 7 Laws skill
32
+ - `proceed-with-the-recommendation` — the orchestrator itself
33
+ - `ralph` — autonomous PRD-scale loop
34
+ - `tdd-workflow` — RED/GREEN/REFACTOR + 80% coverage gate
35
+ - `workspace-surface-audit` — environment + capability audit
36
+ - Tier-1/Tier-2 enforcement skills (`gateguard`, `verification-loop`,
37
+ `para-memory-files`, `safety-guard`, `token-budget-advisor`,
38
+ `strategic-compact`, `wild-risa-balance`)
39
+
40
+ **Optional companions the orchestrator routes to (install separately if
41
+ you want the dedicated skill instead of the inline fallback):**
42
+
43
+ | Source plugin | Routing targets | Notes |
44
+ |---|---|---|
45
+ | `obra/superpowers` | `superpowers:brainstorming`, `:writing-plans`, `:systematic-debugging`, `:test-driven-development`, `:requesting-code-review`, `:verification-before-completion`, `:dispatching-parallel-agents`, `:finishing-a-development-branch`, `simplify`, `schedule`, `loop`, `update-config` | Largest external surface; covers planning, debugging, parallel dispatch, branch-finish |
46
+ | Claude Code host (Anthropic built-in) | `security-review` | Ships with the host CLI itself, not a separate plugin install |
47
+ | `code-review` plugin | `code-review` | Diff walk + severity tagging |
48
+ | `documentation-lookup` agent / `context7` MCP | `documentation-lookup` | Library docs lookup with citations |
49
+ | `frontend-design` plugin | `frontend-design:frontend-design` | Distinctive UI generation |
50
+ | `commit-commands` plugin | `commit-commands:commit`, `:commit-push-pr` | Conventional-commit + push-PR helpers |
51
+
52
+ Full per-target audit (license status, bundled flag, inline fallback,
53
+ risk-if-absent) lives in `docs/audits/2026-05-06-routing-target-gap.md`.
54
+ Per-target inline fallbacks are spelled out in the orchestrator skill at
55
+ `skills/proceed-with-the-recommendation/SKILL.md` § "Routing Table
56
+ (with Inline Fallbacks)".
@@ -0,0 +1,172 @@
1
+ #!/usr/bin/env node
2
+ // backfill.mts — Tag legacy thin-schema observation rows for skip-clean
3
+ // consumption by the analysis pass.
4
+ //
5
+ // Walks ~/.claude/instincts/<hash>/observations.jsonl files and writes a
6
+ // `schema: "thin" | "rich"` field on every row that doesn't already have one.
7
+ // Per the plan doc: this is a flag-pass, not a content-recovery — the original
8
+ // thin rows lack the input we'd need to fabricate richer fields. Tagging lets
9
+ // the analysis pass cleanly skip thin rows and surface a "X% of observations
10
+ // were thin" stat to operators so they understand why their auto-instinct
11
+ // pipeline historically produced nothing.
12
+ //
13
+ // Output:
14
+ // - <home>/.claude/instincts/<hash>/observations.jsonl (rewritten in place
15
+ // with schema field appended; original preserved as .bak)
16
+ // - <home>/.claude/instincts/backfill-summary.json (per-project digest)
17
+ //
18
+ // Flags:
19
+ // --dry-run Read everything, write nothing; print counts to stdout.
20
+ //
21
+ // Idempotent: re-running on already-tagged rows is a no-op.
22
+ // Exit code: always 0. Failures land on stderr only.
23
+ import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, statSync, writeFileSync } from "node:fs";
24
+ import { homedir } from "node:os";
25
+ import { basename, join } from "node:path";
26
+ const args = process.argv.slice(2);
27
+ const DRY_RUN = args.includes("--dry-run");
28
+ const HELP = args.includes("--help") || args.includes("-h");
29
+ if (HELP) {
30
+ console.log(`
31
+ backfill — Tag legacy thin-schema observation rows.
32
+
33
+ Usage:
34
+ npx continuous-improvement backfill Tag rows in place
35
+ npx continuous-improvement backfill --dry-run Report counts, write nothing
36
+
37
+ What it does:
38
+ Walks ~/.claude/instincts/<hash>/observations.jsonl files and adds a
39
+ schema field ("thin" or "rich") to every row that lacks one. Thin rows
40
+ came from the legacy bash fallback (jq missing) and have no input_summary;
41
+ rich rows came from the Node observer and have full tool_input.command /
42
+ Edit.file_path / etc.
43
+
44
+ Output:
45
+ - observations.jsonl rewritten in place (original kept as .bak)
46
+ - backfill-summary.json with per-project counts
47
+
48
+ Idempotent. Always exits 0 — failures go to stderr only.
49
+ `);
50
+ process.exit(0);
51
+ }
52
+ main();
53
+ function main() {
54
+ try {
55
+ runBackfill();
56
+ }
57
+ catch (error) {
58
+ process.stderr.write(`[backfill] ${error instanceof Error ? error.message : String(error)}\n`);
59
+ }
60
+ process.exit(0);
61
+ }
62
+ function runBackfill() {
63
+ const home = process.env.HOME || process.env.USERPROFILE || homedir();
64
+ const instinctsDir = join(home, ".claude", "instincts");
65
+ if (!existsSync(instinctsDir)) {
66
+ if (!DRY_RUN)
67
+ mkdirSync(instinctsDir, { recursive: true });
68
+ return;
69
+ }
70
+ const projectDirs = listProjectDirs(instinctsDir);
71
+ const summary = {
72
+ total: 0,
73
+ thin: 0,
74
+ rich: 0,
75
+ projects: {},
76
+ generated_at: new Date().toISOString(),
77
+ };
78
+ for (const dir of projectDirs) {
79
+ const obsFile = join(dir, "observations.jsonl");
80
+ if (!existsSync(obsFile))
81
+ continue;
82
+ const projectId = basename(dir);
83
+ const stat = { total: 0, thin: 0, rich: 0 };
84
+ const newLines = [];
85
+ const corruptLines = [];
86
+ let mutated = false;
87
+ const raw = readFileSync(obsFile, "utf8");
88
+ for (const line of raw.split("\n")) {
89
+ const trimmed = line.trim();
90
+ if (trimmed.length === 0)
91
+ continue;
92
+ let row;
93
+ try {
94
+ row = JSON.parse(trimmed);
95
+ }
96
+ catch {
97
+ process.stderr.write(`[backfill] skipped corrupt row in ${projectId}: ${trimmed.slice(0, 80)}\n`);
98
+ // Drop from main file but preserve in observations.corrupt.jsonl
99
+ // so the operator never silently loses data.
100
+ corruptLines.push(trimmed);
101
+ mutated = true;
102
+ continue;
103
+ }
104
+ stat.total++;
105
+ summary.total++;
106
+ const previousSchema = row.schema;
107
+ const isRich = typeof row.input_summary === "string" && row.input_summary.length > 0;
108
+ const newSchema = isRich ? "rich" : "thin";
109
+ if (previousSchema !== newSchema) {
110
+ row.schema = newSchema;
111
+ mutated = true;
112
+ }
113
+ if (newSchema === "thin") {
114
+ stat.thin++;
115
+ summary.thin++;
116
+ }
117
+ else {
118
+ stat.rich++;
119
+ summary.rich++;
120
+ }
121
+ newLines.push(JSON.stringify(row));
122
+ }
123
+ summary.projects[projectId] = stat;
124
+ if (mutated && !DRY_RUN) {
125
+ // Atomic-ish write: backup → write → keep .bak for one cycle.
126
+ const backup = obsFile + ".bak";
127
+ renameSync(obsFile, backup);
128
+ writeFileSync(obsFile, newLines.join("\n") + "\n", "utf8");
129
+ if (corruptLines.length > 0) {
130
+ // Quarantine corrupt rows so operator data is never silently lost.
131
+ const corruptFile = join(dir, "observations.corrupt.jsonl");
132
+ const existing = existsSync(corruptFile) ? readFileSync(corruptFile, "utf8") : "";
133
+ writeFileSync(corruptFile, existing + corruptLines.join("\n") + "\n", "utf8");
134
+ }
135
+ }
136
+ }
137
+ if (DRY_RUN) {
138
+ process.stdout.write(formatReport(summary, true));
139
+ return;
140
+ }
141
+ const summaryPath = join(instinctsDir, "backfill-summary.json");
142
+ writeFileSync(summaryPath, JSON.stringify(summary, null, 2) + "\n", "utf8");
143
+ process.stdout.write(formatReport(summary, false));
144
+ }
145
+ function listProjectDirs(instinctsDir) {
146
+ // Real project-hash dirs are sha256[:12] (hex). Test fixtures use 12-char
147
+ // alpha labels (g/h/i are not hex but make tests readable). Both are
148
+ // matched here; the broader pattern is harmless because real instincts/
149
+ // sub-dirs only ever contain hex hashes plus 'global' / loose dotfiles.
150
+ return readdirSync(instinctsDir)
151
+ .filter((name) => /^[0-9a-z]{12}$/.test(name))
152
+ .map((name) => join(instinctsDir, name))
153
+ .filter((dir) => {
154
+ try {
155
+ return statSync(dir).isDirectory();
156
+ }
157
+ catch {
158
+ return false;
159
+ }
160
+ });
161
+ }
162
+ function formatReport(summary, isDryRun) {
163
+ const projects = Object.keys(summary.projects);
164
+ const lines = [
165
+ isDryRun ? "[backfill --dry-run] would tag the following:" : "[backfill] tagged:",
166
+ ` total rows: ${summary.total}`,
167
+ ` thin rows: ${summary.thin}`,
168
+ ` rich rows: ${summary.rich}`,
169
+ ` projects: ${projects.length}`,
170
+ ];
171
+ return lines.join("\n") + "\n";
172
+ }