continuous-improvement 3.11.0 → 3.12.3

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 (110) hide show
  1. package/.claude-plugin/marketplace.json +3 -3
  2. package/CHANGELOG.md +34 -0
  3. package/LICENSE +21 -21
  4. package/QUICKSTART.md +1 -1
  5. package/README.md +16 -15
  6. package/SKILL.md +1 -1
  7. package/bin/analyze.sh +161 -161
  8. package/bin/backfill.mjs +19 -19
  9. package/bin/check-doc-runtime-claims.mjs +0 -0
  10. package/bin/check-docs-substrings.mjs +0 -0
  11. package/bin/check-everything-mirror.mjs +0 -0
  12. package/bin/check-routing-targets.mjs +0 -0
  13. package/bin/check-scripts-citation-drift.mjs +0 -0
  14. package/bin/check-skill-count.mjs +0 -0
  15. package/bin/check-skill-law-tag.mjs +0 -0
  16. package/bin/check-skill-mirror.mjs +0 -0
  17. package/bin/check-skill-tiers.mjs +0 -0
  18. package/bin/check-test-imports-only.mjs +0 -0
  19. package/bin/check-third-party-shape.mjs +0 -0
  20. package/bin/check-tool-count.mjs +129 -0
  21. package/bin/companion-preference-status.mjs +0 -0
  22. package/bin/gateguard-clear.mjs +0 -0
  23. package/bin/generate-plugin-manifests.mjs +1 -0
  24. package/bin/harvest-friction.mjs +1 -1
  25. package/bin/hook-stats.mjs +21 -21
  26. package/bin/install.mjs +3 -2
  27. package/bin/lint-transcript.mjs +0 -0
  28. package/bin/mcp-server.mjs +1 -1
  29. package/bin/observe.mjs +0 -0
  30. package/bin/pre-commit-block-strays.sh +0 -0
  31. package/bin/refresh-third-party.mjs +0 -0
  32. package/bin/unified-cli.mjs +0 -0
  33. package/commands/continuous-improvement.md +115 -115
  34. package/commands/dashboard.md +56 -56
  35. package/commands/harvest.md +1 -1
  36. package/commands/seven-laws.md +16 -16
  37. package/commands/superpowers.md +1 -1
  38. package/commands/workspace-surface-audit.md +77 -77
  39. package/hooks/companion-preference.mjs +0 -0
  40. package/hooks/gateguard.mjs +22 -10
  41. package/hooks/goal-drift-stop.mjs +0 -0
  42. package/hooks/observe.sh +0 -0
  43. package/hooks/recall-briefing.mjs +167 -0
  44. package/hooks/route-prompt.mjs +0 -0
  45. package/hooks/session.sh +106 -106
  46. package/hooks/three-section-close.mjs +0 -0
  47. package/instinct-packs/go.json +58 -58
  48. package/instinct-packs/meta.json +16 -16
  49. package/instinct-packs/python.json +58 -58
  50. package/instinct-packs/react.json +58 -58
  51. package/lib/cli-anything.mjs +0 -0
  52. package/lib/compound-engineering.mjs +0 -0
  53. package/lib/gateguard-state.mjs +0 -0
  54. package/lib/goal-drift-gate.mjs +0 -0
  55. package/lib/goal-state.mjs +8 -8
  56. package/lib/observe-event.mjs +0 -0
  57. package/lib/plugin-metadata.mjs +12 -7
  58. package/lib/pm-marketplace.mjs +0 -0
  59. package/lib/pm-skills.mjs +0 -0
  60. package/lib/recall-briefing.mjs +57 -0
  61. package/lib/recall-index.mjs +2 -2
  62. package/lib/resolve-home-dir.mjs +0 -0
  63. package/lib/skill-distill.mjs +0 -0
  64. package/lib/skill-tiers.mjs +0 -0
  65. package/lib/unified-plugin.mjs +0 -0
  66. package/llms.txt +2 -2
  67. package/package.json +4 -3
  68. package/plugins/beginner.json +3 -3
  69. package/plugins/continuous-improvement/.claude-plugin/marketplace.json +2 -2
  70. package/plugins/continuous-improvement/.claude-plugin/plugin.json +2 -2
  71. package/plugins/continuous-improvement/LICENSE +21 -21
  72. package/plugins/continuous-improvement/agents/README.md +3 -3
  73. package/plugins/continuous-improvement/bin/backfill.mjs +19 -19
  74. package/plugins/continuous-improvement/bin/gateguard-clear.mjs +0 -0
  75. package/plugins/continuous-improvement/bin/mcp-server.mjs +1 -1
  76. package/plugins/continuous-improvement/bin/observe.mjs +0 -0
  77. package/plugins/continuous-improvement/commands/continuous-improvement.md +115 -115
  78. package/plugins/continuous-improvement/commands/dashboard.md +56 -56
  79. package/plugins/continuous-improvement/commands/harvest.md +1 -1
  80. package/plugins/continuous-improvement/commands/seven-laws.md +16 -16
  81. package/plugins/continuous-improvement/commands/superpowers.md +1 -1
  82. package/plugins/continuous-improvement/commands/workspace-surface-audit.md +77 -77
  83. package/plugins/continuous-improvement/hooks/companion-preference.mjs +0 -0
  84. package/plugins/continuous-improvement/hooks/gateguard.mjs +22 -10
  85. package/plugins/continuous-improvement/hooks/goal-drift-stop.mjs +0 -0
  86. package/plugins/continuous-improvement/hooks/hooks.json +6 -1
  87. package/plugins/continuous-improvement/hooks/observe.sh +0 -0
  88. package/plugins/continuous-improvement/hooks/recall-briefing.mjs +167 -0
  89. package/plugins/continuous-improvement/hooks/route-prompt.mjs +0 -0
  90. package/plugins/continuous-improvement/hooks/session.sh +106 -106
  91. package/plugins/continuous-improvement/hooks/three-section-close.mjs +0 -0
  92. package/plugins/continuous-improvement/instinct-packs/go.json +58 -58
  93. package/plugins/continuous-improvement/instinct-packs/meta.json +16 -16
  94. package/plugins/continuous-improvement/instinct-packs/python.json +58 -58
  95. package/plugins/continuous-improvement/instinct-packs/react.json +58 -58
  96. package/plugins/continuous-improvement/lib/gateguard-state.mjs +0 -0
  97. package/plugins/continuous-improvement/lib/goal-drift-gate.mjs +0 -0
  98. package/plugins/continuous-improvement/lib/goal-state.mjs +8 -8
  99. package/plugins/continuous-improvement/lib/observe-event.mjs +0 -0
  100. package/plugins/continuous-improvement/lib/plugin-metadata.mjs +12 -7
  101. package/plugins/continuous-improvement/lib/recall-briefing.mjs +57 -0
  102. package/plugins/continuous-improvement/lib/recall-index.mjs +2 -2
  103. package/plugins/continuous-improvement/lib/resolve-home-dir.mjs +0 -0
  104. package/plugins/continuous-improvement/lib/skill-distill.mjs +0 -0
  105. package/plugins/continuous-improvement/skills/continuous-improvement/SKILL.md +1 -1
  106. package/plugins/continuous-improvement/skills/superpowers/SKILL.md +1 -1
  107. package/plugins/continuous-improvement/skills/tdd-workflow/SKILL.md +411 -411
  108. package/plugins/expert.json +2 -2
  109. package/skills/superpowers.md +1 -1
  110. package/skills/tdd-workflow.md +411 -411
@@ -0,0 +1,129 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Tool Count Check
4
+ *
5
+ * Docs and source comments claim the size of the MCP tool surface
6
+ * ("N tools"). Those numbers drift every time a tool is added without the
7
+ * claim being bumped — exactly what the 2026-06-07 post-merge audit (PR #203)
8
+ * found: docs/skills.md said "12 tools" and src/bin/mcp-server.mts said
9
+ * "beginner (3 tools)" while the catalog had grown to 18 expert / 4 beginner,
10
+ * and `verify:all` stayed green because no invariant covered those strings.
11
+ *
12
+ * Source of truth: the GENERATED, committed manifests
13
+ * - plugins/expert.json tools[].length (expert mode = all tools)
14
+ * - plugins/beginner.json tools[].length (beginner mode)
15
+ * Both are generated from src/lib/plugin-metadata.mts by `npm run build` and
16
+ * pinned against drift by `verify:generated`, so they are the honest count.
17
+ *
18
+ * Each ASSERTION names a file, a capture regex around its tool-count claim, and
19
+ * which mode's count the captured integer must equal. Precise per-claim regexes
20
+ * avoid false positives on historical CHANGELOG or vendored "N tools" strings.
21
+ * The installer banner is intentionally NOT listed: PR #203 made it derive the
22
+ * count from getToolNames("expert") at runtime, so it can never drift.
23
+ *
24
+ * Usage:
25
+ * node bin/check-tool-count.mjs # Check the current repo
26
+ * node bin/check-tool-count.mjs <repo-root> # Check a specific repo root
27
+ *
28
+ * Exit codes:
29
+ * 0 — every claim matches the manifest count
30
+ * 1 — at least one claim is stale or missing
31
+ */
32
+ import { readFileSync } from "node:fs";
33
+ import { join } from "node:path";
34
+ import { argv, cwd, exit } from "node:process";
35
+ const MANIFEST = {
36
+ expert: "plugins/expert.json",
37
+ beginner: "plugins/beginner.json",
38
+ };
39
+ const ASSERTIONS = [
40
+ {
41
+ file: "docs/skills.md",
42
+ pattern: /MCP server \((\d+) tools\)/,
43
+ mode: "expert",
44
+ label: "expert MCP tool count",
45
+ },
46
+ {
47
+ file: "README.md",
48
+ pattern: /MCP tools \((\d+) of them/,
49
+ mode: "expert",
50
+ label: "expert MCP tool count (README)",
51
+ },
52
+ {
53
+ file: "QUICKSTART.md",
54
+ pattern: /MCP tools \((\d+) of them/,
55
+ mode: "expert",
56
+ label: "expert MCP tool count (QUICKSTART)",
57
+ },
58
+ {
59
+ file: "src/bin/mcp-server.mts",
60
+ pattern: /beginner \((\d+) tools\)/,
61
+ mode: "beginner",
62
+ label: "beginner mode tool count",
63
+ },
64
+ ];
65
+ export function countTools(repoRoot, mode) {
66
+ const raw = readFileSync(join(repoRoot, MANIFEST[mode]), "utf8");
67
+ const parsed = JSON.parse(raw);
68
+ if (!Array.isArray(parsed.tools)) {
69
+ throw new Error(`${MANIFEST[mode]} has no "tools" array`);
70
+ }
71
+ return parsed.tools.length;
72
+ }
73
+ function checkAssertion(repoRoot, a, expected) {
74
+ let content;
75
+ try {
76
+ content = readFileSync(join(repoRoot, a.file), "utf8");
77
+ }
78
+ catch {
79
+ return { file: a.file, label: a.label, reason: "missing", expected };
80
+ }
81
+ const m = content.match(a.pattern);
82
+ if (!m)
83
+ return { file: a.file, label: a.label, reason: "missing", expected };
84
+ if (Number(m[1]) === expected)
85
+ return null;
86
+ return { file: a.file, label: a.label, reason: "stale", found: m[0], expected };
87
+ }
88
+ export function checkToolCount(repoRoot) {
89
+ const counts = {
90
+ expert: countTools(repoRoot, "expert"),
91
+ beginner: countTools(repoRoot, "beginner"),
92
+ };
93
+ const violations = [];
94
+ for (const a of ASSERTIONS) {
95
+ const v = checkAssertion(repoRoot, a, counts[a.mode]);
96
+ if (v)
97
+ violations.push(v);
98
+ }
99
+ return { violations, counts };
100
+ }
101
+ function main() {
102
+ const repoRoot = argv[2] ?? cwd();
103
+ const { violations, counts } = checkToolCount(repoRoot);
104
+ if (violations.length === 0) {
105
+ console.log(`OK tool-count: all ${ASSERTIONS.length} claim(s) match the generated manifests ` +
106
+ `(expert=${counts.expert}, beginner=${counts.beginner}).`);
107
+ exit(0);
108
+ }
109
+ console.error(`FAIL tool-count: ${violations.length} claim(s) do not match the generated tool manifests ` +
110
+ `(expert=${counts.expert}, beginner=${counts.beginner}).`);
111
+ console.error("");
112
+ for (const v of violations) {
113
+ if (v.reason === "stale") {
114
+ console.error(` ${v.file} — ${v.label}: states "${v.found}", expected ${v.expected}`);
115
+ }
116
+ else {
117
+ console.error(` ${v.file} — ${v.label}: no matching tool-count claim found (expected ${v.expected})`);
118
+ }
119
+ }
120
+ console.error("");
121
+ console.error("Fix: bump the claim to match plugins/{expert,beginner}.json tools[].length, or add the");
122
+ console.error("tool to BEGINNER_TOOL_ENTRIES/EXPERT_TOOL_ENTRIES in src/lib/plugin-metadata.mts and");
123
+ console.error("re-run `npm run build` to regenerate the manifests.");
124
+ exit(1);
125
+ }
126
+ const invokedDirectly = argv[1] !== undefined && import.meta.url.endsWith(argv[1].replace(/\\/g, "/"));
127
+ if (invokedDirectly || argv[1]?.endsWith("check-tool-count.mjs")) {
128
+ main();
129
+ }
File without changes
File without changes
@@ -153,6 +153,7 @@ async function writePluginBundle() {
153
153
  copyFileTo(join(REPO_ROOT, "lib", "goal-state.mjs"), join(PLUGIN_BUNDLE_DIR, "lib", "goal-state.mjs")),
154
154
  copyFileTo(join(REPO_ROOT, "lib", "goal-drift-gate.mjs"), join(PLUGIN_BUNDLE_DIR, "lib", "goal-drift-gate.mjs")),
155
155
  copyFileTo(join(REPO_ROOT, "lib", "recall-index.mjs"), join(PLUGIN_BUNDLE_DIR, "lib", "recall-index.mjs")),
156
+ copyFileTo(join(REPO_ROOT, "lib", "recall-briefing.mjs"), join(PLUGIN_BUNDLE_DIR, "lib", "recall-briefing.mjs")),
156
157
  copyFileTo(join(REPO_ROOT, "lib", "skill-distill.mjs"), join(PLUGIN_BUNDLE_DIR, "lib", "skill-distill.mjs")),
157
158
  copyFileTo(join(REPO_ROOT, "LICENSE"), join(PLUGIN_BUNDLE_DIR, "LICENSE")),
158
159
  writePluginBundleReadme(),
@@ -248,7 +248,7 @@ function main() {
248
248
  console.log(" the Node observer is not on PATH — never tool_complete with output_summary,");
249
249
  console.log(" which is what the classifier needs.");
250
250
  console.log(" Install jq (winget install jqlang.jq | brew install jq | apt install jq)");
251
- console.log(" OR ensure hooks/bin/observe.mjs is reachable from the hook script.");
251
+ console.log(" OR ensure instincts/bin/observe.mjs is reachable from the hook script.");
252
252
  }
253
253
  else if (result.thinSchemaRows > 0 && result.classifiedRows === 0) {
254
254
  console.log("");
@@ -46,27 +46,27 @@ import { platform } from "node:os";
46
46
  import { join } from "node:path";
47
47
  import { argv, cwd, exit, stderr, stdout } from "node:process";
48
48
  import { resolveHomeDir } from "../lib/resolve-home-dir.mjs";
49
- const USAGE = `Usage: node bin/hook-stats.mjs [options]
50
-
51
- Reads JSONL telemetry from <HOME>/.claude/hook-telemetry/*.jsonl and
52
- prints per-hook aggregate counts over a recent time window.
53
-
54
- Options:
55
- --hours=<n> Time window in hours (default: 24)
56
- --hash=<hash> Only read this single <hash>.jsonl file
57
- (default: sha256 of the current working directory,
58
- normalized to forward slashes and lowercased on
59
- Windows, then first 12 hex chars)
60
- --telemetry-dir=<path> Override telemetry dir
61
- (default: <HOME>/.claude/hook-telemetry)
62
- --help Show this help and exit 0
63
-
64
- Output:
65
- One line per hook: "<hook> last <hours>h: pass=<n> block=<n>
66
- skip-short=<n> total=<n> avg-duration=<X>ms".
67
- If there are no records in the window: "no records in last <hours>h".
68
-
69
- The reader is parse-tolerant: malformed JSONL lines are skipped silently.
49
+ const USAGE = `Usage: node bin/hook-stats.mjs [options]
50
+
51
+ Reads JSONL telemetry from <HOME>/.claude/hook-telemetry/*.jsonl and
52
+ prints per-hook aggregate counts over a recent time window.
53
+
54
+ Options:
55
+ --hours=<n> Time window in hours (default: 24)
56
+ --hash=<hash> Only read this single <hash>.jsonl file
57
+ (default: sha256 of the current working directory,
58
+ normalized to forward slashes and lowercased on
59
+ Windows, then first 12 hex chars)
60
+ --telemetry-dir=<path> Override telemetry dir
61
+ (default: <HOME>/.claude/hook-telemetry)
62
+ --help Show this help and exit 0
63
+
64
+ Output:
65
+ One line per hook: "<hook> last <hours>h: pass=<n> block=<n>
66
+ skip-short=<n> total=<n> avg-duration=<X>ms".
67
+ If there are no records in the window: "no records in last <hours>h".
68
+
69
+ The reader is parse-tolerant: malformed JSONL lines are skipped silently.
70
70
  `;
71
71
  function parseArgs(rawArgs) {
72
72
  const opts = {
package/bin/install.mjs CHANGED
@@ -14,6 +14,7 @@ import { homedir } from "node:os";
14
14
  import { dirname, join } from "node:path";
15
15
  import { fileURLToPath } from "node:url";
16
16
  import { createHash } from "node:crypto";
17
+ import { getToolNames } from "../lib/plugin-metadata.mjs";
17
18
  const __filename = fileURLToPath(import.meta.url);
18
19
  const __dirname = dirname(__filename);
19
20
  const SKILL_SOURCE = join(__dirname, "..", "SKILL.md");
@@ -556,7 +557,7 @@ console.log("Installing to Claude Code...\n");
556
557
  const installed = installSkill() ? 1 : 0;
557
558
  const modeInfo = {
558
559
  beginner: "Hooks are capturing silently. System auto-levels as you use it.",
559
- expert: "Full plugin active: hooks + MCP server + session hooks. 12 tools available.",
560
+ expert: `Full plugin active: hooks + MCP server + session hooks. ${getToolNames("expert").length} tools available.`,
560
561
  };
561
562
  const packIndex = rawArgs.indexOf("--pack");
562
563
  if (packIndex !== -1 && rawArgs[packIndex + 1]) {
@@ -617,6 +618,6 @@ Next steps:
617
618
  3. If a task needs persistent planning, run: /planning-with-files
618
619
  4. After your first task, run: /continuous-improvement
619
620
  5. Try: /discipline for quick reference, /dashboard for instinct health
620
- ${INSTALL_MODE === "expert" ? "\nMCP tools available: ci_status, ci_instincts, ci_reflect, ci_reinforce,\n ci_create_instinct, ci_observations, ci_export, ci_import, ci_plan_init,\n ci_plan_status, ci_dashboard, ci_load_pack" : ""}
621
+ ${INSTALL_MODE === "expert" ? `\nMCP tools available (${getToolNames("expert").length}): ${getToolNames("expert").join(", ")}` : ""}
621
622
  Available instinct packs: npx continuous-improvement install --pack react|python|go|meta
622
623
  `);
File without changes
@@ -3,7 +3,7 @@
3
3
  * continuous-improvement MCP Server
4
4
  *
5
5
  * Exposes instincts, observations, and reflection as MCP tools + resources.
6
- * Two modes: beginner (3 tools) and expert (all tools).
6
+ * Two modes: beginner (4 tools) and expert (all tools).
7
7
  *
8
8
  * Usage:
9
9
  * node bin/mcp-server.mjs # default: beginner mode
package/bin/observe.mjs CHANGED
File without changes
File without changes
File without changes
File without changes
@@ -1,115 +1,115 @@
1
- ---
2
- name: continuous-improvement
3
- description: "Reflect on the current session, analyze observations for patterns, and show instinct status. Runs on-demand to save tokens."
4
- ---
5
-
6
- # /continuous-improvement
7
-
8
- Run this when you want to reflect and learn — not every session. Three steps in order.
9
-
10
- ## Step 1: Reflect
11
-
12
- Generate a reflection for this session based on what happened:
13
-
14
- ```
15
- ## Reflection — [Date]
16
- - What worked:
17
- - What failed:
18
- - What I'd do differently:
19
- - Rule to add:
20
- - Iteration — Next best recommendations (ranked, top 3):
21
- 1. <primary — strongest next move>
22
- 2. <alternative — different angle>
23
- 3. <alternative — smaller/larger scope>
24
- ```
25
-
26
- If there's a "Rule to add", create an instinct YAML file with 0.6 starting confidence in the project's instinct directory.
27
-
28
- The "Iteration — Next best recommendations" field is the Law 6 handoff. List the **top 3 ranked** core-development moves — what to build, fix, refactor, or investigate next so the feature/system advances. Item #1 is the strongest; #2 and #3 are alternatives the user can pivot to. NOT git steps (commit, push, PR), NOT verification re-runs, NOT deploy actions — those belong in the end-of-run summary.
29
-
30
- Format per item: `<verb> <object at path:line> (<why, one clause grounded in current context>)`.
31
-
32
- Rules: always exactly 3 distinct directions, not padding. If fewer real moves exist, fill remaining slots with `None — goal met from this angle.` If the goal is fully met across all angles, write `1. None — goal met, stop.` and omit #2 and #3.
33
-
34
- ## Step 2: Analyze Observations
35
-
36
- Check `~/.claude/instincts/` for the current project (detect via git root → SHA-256 first 12 chars).
37
-
38
- Look at `~/.claude/instincts/<hash>/observations.jsonl`. If 20+ lines exist:
39
-
40
- 1. Read the last 500 lines
41
- 2. Read existing instinct `*.yaml` files (project + global)
42
- 3. Detect patterns:
43
- - User corrections → "don't do X" instincts
44
- - Error→fix sequences → "when X fails, try Y"
45
- - Repeated workflows (3+ times) → "for X, do A→B→C"
46
- - Tool preferences → "use tool Y for task X"
47
- 4. Create/update instinct YAML files
48
- 5. Be conservative: only create instincts for 3+ observations of the same pattern
49
-
50
- If fewer than 20 observations, skip analysis and note the count.
51
-
52
- ### Multi-Agent Analysis (500+ observations)
53
-
54
- When observation backlog is large, parallelize:
55
- - **Agent 1:** User corrections + error→fix patterns
56
- - **Agent 2:** Repeated workflows + tool preferences
57
- - **Agent 3:** Cross-reference existing instincts for updates
58
-
59
- Merge results and deduplicate before writing YAML files.
60
-
61
- ## Step 3: Show Status
62
-
63
- Display all instincts for the current project + global:
64
-
65
- ```
66
- === continuous-improvement ===
67
-
68
- ## Level: [CAPTURE | ANALYZE | SUGGEST | AUTO-APPLY]
69
-
70
- ## Session Reflection
71
- - What worked: [from this session]
72
- - What failed: [from this session]
73
- - What I'd do differently: [from this session]
74
- - Rule to add: [captured as instinct]
75
- - Iteration — Next best recommendations (ranked, top 3):
76
- 1. [primary core-development move]
77
- 2. [alternative angle]
78
- 3. [alternative scope]
79
-
80
- ## Learning
81
- NEW [instinct-id] [domain] [confidence] (from reflection)
82
- ↑ [instinct-id] [domain] [old]→[new] (+N observations)
83
-
84
- ## Instincts — [project-name] ([hash])
85
- ● [0.85] instinct-id domain auto-apply
86
- ◐ [0.60] instinct-id domain suggest
87
- ○ [0.35] instinct-id domain silent
88
-
89
- ## Instincts — global
90
- ● [0.90] instinct-id domain auto-apply
91
-
92
- ## Next
93
- - Keep working — hooks capture automatically
94
- - System auto-levels as instincts gain confidence
95
- ```
96
-
97
- If no instincts or observations exist yet, explain this is expected — the system is in CAPTURE level and will create instincts after 20+ observations accumulate.
98
-
99
- ## Subcommands
100
-
101
- ### `/continuous-improvement weekly`
102
-
103
- Set up a weekly analysis schedule:
104
- 1. Create a cron/loop schedule that runs `/continuous-improvement analyze` every 7 days
105
- 2. Confirm the schedule to the user
106
- 3. Show next scheduled run date
107
-
108
- ### `/continuous-improvement always-on`
109
-
110
- Toggle always-on mode for the current project:
111
- 1. Find project hash
112
- 2. Create/update `~/.claude/instincts/<hash>/config.yaml` with `always_on: true|false`
113
- 3. Confirm the change
114
-
115
- **Default is off** — observations accumulate silently, analysis only runs when you ask.
1
+ ---
2
+ name: continuous-improvement
3
+ description: "Reflect on the current session, analyze observations for patterns, and show instinct status. Runs on-demand to save tokens."
4
+ ---
5
+
6
+ # /continuous-improvement
7
+
8
+ Run this when you want to reflect and learn — not every session. Three steps in order.
9
+
10
+ ## Step 1: Reflect
11
+
12
+ Generate a reflection for this session based on what happened:
13
+
14
+ ```
15
+ ## Reflection — [Date]
16
+ - What worked:
17
+ - What failed:
18
+ - What I'd do differently:
19
+ - Rule to add:
20
+ - Iteration — Next best recommendations (ranked, top 3):
21
+ 1. <primary — strongest next move>
22
+ 2. <alternative — different angle>
23
+ 3. <alternative — smaller/larger scope>
24
+ ```
25
+
26
+ If there's a "Rule to add", create an instinct YAML file with 0.6 starting confidence in the project's instinct directory.
27
+
28
+ The "Iteration — Next best recommendations" field is the Law 6 handoff. List the **top 3 ranked** core-development moves — what to build, fix, refactor, or investigate next so the feature/system advances. Item #1 is the strongest; #2 and #3 are alternatives the user can pivot to. NOT git steps (commit, push, PR), NOT verification re-runs, NOT deploy actions — those belong in the end-of-run summary.
29
+
30
+ Format per item: `<verb> <object at path:line> (<why, one clause grounded in current context>)`.
31
+
32
+ Rules: always exactly 3 distinct directions, not padding. If fewer real moves exist, fill remaining slots with `None — goal met from this angle.` If the goal is fully met across all angles, write `1. None — goal met, stop.` and omit #2 and #3.
33
+
34
+ ## Step 2: Analyze Observations
35
+
36
+ Check `~/.claude/instincts/` for the current project (detect via git root → SHA-256 first 12 chars).
37
+
38
+ Look at `~/.claude/instincts/<hash>/observations.jsonl`. If 20+ lines exist:
39
+
40
+ 1. Read the last 500 lines
41
+ 2. Read existing instinct `*.yaml` files (project + global)
42
+ 3. Detect patterns:
43
+ - User corrections → "don't do X" instincts
44
+ - Error→fix sequences → "when X fails, try Y"
45
+ - Repeated workflows (3+ times) → "for X, do A→B→C"
46
+ - Tool preferences → "use tool Y for task X"
47
+ 4. Create/update instinct YAML files
48
+ 5. Be conservative: only create instincts for 3+ observations of the same pattern
49
+
50
+ If fewer than 20 observations, skip analysis and note the count.
51
+
52
+ ### Multi-Agent Analysis (500+ observations)
53
+
54
+ When observation backlog is large, parallelize:
55
+ - **Agent 1:** User corrections + error→fix patterns
56
+ - **Agent 2:** Repeated workflows + tool preferences
57
+ - **Agent 3:** Cross-reference existing instincts for updates
58
+
59
+ Merge results and deduplicate before writing YAML files.
60
+
61
+ ## Step 3: Show Status
62
+
63
+ Display all instincts for the current project + global:
64
+
65
+ ```
66
+ === continuous-improvement ===
67
+
68
+ ## Level: [CAPTURE | ANALYZE | SUGGEST | AUTO-APPLY]
69
+
70
+ ## Session Reflection
71
+ - What worked: [from this session]
72
+ - What failed: [from this session]
73
+ - What I'd do differently: [from this session]
74
+ - Rule to add: [captured as instinct]
75
+ - Iteration — Next best recommendations (ranked, top 3):
76
+ 1. [primary core-development move]
77
+ 2. [alternative angle]
78
+ 3. [alternative scope]
79
+
80
+ ## Learning
81
+ NEW [instinct-id] [domain] [confidence] (from reflection)
82
+ ↑ [instinct-id] [domain] [old]→[new] (+N observations)
83
+
84
+ ## Instincts — [project-name] ([hash])
85
+ ● [0.85] instinct-id domain auto-apply
86
+ ◐ [0.60] instinct-id domain suggest
87
+ ○ [0.35] instinct-id domain silent
88
+
89
+ ## Instincts — global
90
+ ● [0.90] instinct-id domain auto-apply
91
+
92
+ ## Next
93
+ - Keep working — hooks capture automatically
94
+ - System auto-levels as instincts gain confidence
95
+ ```
96
+
97
+ If no instincts or observations exist yet, explain this is expected — the system is in CAPTURE level and will create instincts after 20+ observations accumulate.
98
+
99
+ ## Subcommands
100
+
101
+ ### `/continuous-improvement weekly`
102
+
103
+ Set up a weekly analysis schedule:
104
+ 1. Create a cron/loop schedule that runs `/continuous-improvement analyze` every 7 days
105
+ 2. Confirm the schedule to the user
106
+ 3. Show next scheduled run date
107
+
108
+ ### `/continuous-improvement always-on`
109
+
110
+ Toggle always-on mode for the current project:
111
+ 1. Find project hash
112
+ 2. Create/update `~/.claude/instincts/<hash>/config.yaml` with `always_on: true|false`
113
+ 3. Confirm the change
114
+
115
+ **Default is off** — observations accumulate silently, analysis only runs when you ask.
@@ -1,56 +1,56 @@
1
- ---
2
- name: dashboard
3
- description: Visual dashboard showing instinct health, observation stats, and learning progress
4
- ---
5
-
6
- # Instinct Dashboard
7
-
8
- Generate a visual dashboard for this project's continuous-improvement status.
9
-
10
- ## Instructions
11
-
12
- 1. **Find project hash:** Run `git rev-parse --show-toplevel 2>/dev/null`, then SHA-256 first 12 chars
13
- 2. **Read observations:** Count lines in `~/.claude/instincts/<hash>/observations.jsonl`
14
- 3. **Read instincts:** Load all `*.yaml` files from project dir + `global/`
15
- 4. **Read instinct packs:** Check if any packs from `instinct-packs/` have been loaded
16
-
17
- ## Display Format
18
-
19
- ```
20
- ╔══════════════════════════════════════════════════════════════╗
21
- ║ continuous-improvement Dashboard ║
22
- ╠══════════════════════════════════════════════════════════════╣
23
- ║ ║
24
- ║ Project: <name> Level: <CAPTURE|ANALYZE|...> ║
25
- ║ Sessions: ~<obs/10> Mode: <beginner|expert> ║
26
- ║ ║
27
- ║ ┌─ Observations ────────────────────────────────────────┐ ║
28
- ║ │ Total: <n> Unprocessed: <n> Last: <date> │ ║
29
- ║ └───────────────────────────────────────────────────────┘ ║
30
- ║ ║
31
- ║ ┌─ Instincts ───────────────────────────────────────────┐ ║
32
- ║ │ Total: <n> │ ║
33
- ║ │ ████████░░ Auto-apply (0.7+): <n> │ ║
34
- ║ │ █████░░░░░ Suggest (0.5-0.69): <n> │ ║
35
- ║ │ ██░░░░░░░░ Silent (< 0.5): <n> │ ║
36
- ║ │ Global: <n> Project: <n> │ ║
37
- ║ └───────────────────────────────────────────────────────┘ ║
38
- ║ ║
39
- ║ ┌─ Top Instincts ───────────────────────────────────────┐ ║
40
- ║ │ <list top 5 instincts by confidence with bars> │ ║
41
- ║ └───────────────────────────────────────────────────────┘ ║
42
- ║ ║
43
- ║ ┌─ Health ──────────────────────────────────────────────┐ ║
44
- ║ │ Stale (30+ days): <n> Decaying: <n> │ ║
45
- ║ │ Recently reinforced: <n> │ ║
46
- ║ └───────────────────────────────────────────────────────┘ ║
47
- ║ ║
48
- ╚══════════════════════════════════════════════════════════════╝
49
- ```
50
-
51
- ## After Display
52
-
53
- - If stale instincts > 0: suggest reviewing them
54
- - If unprocessed observations > 20: suggest running analysis
55
- - If no instincts exist: explain the auto-leveling timeline
56
- - Show available instinct packs that haven't been loaded yet
1
+ ---
2
+ name: dashboard
3
+ description: Visual dashboard showing instinct health, observation stats, and learning progress
4
+ ---
5
+
6
+ # Instinct Dashboard
7
+
8
+ Generate a visual dashboard for this project's continuous-improvement status.
9
+
10
+ ## Instructions
11
+
12
+ 1. **Find project hash:** Run `git rev-parse --show-toplevel 2>/dev/null`, then SHA-256 first 12 chars
13
+ 2. **Read observations:** Count lines in `~/.claude/instincts/<hash>/observations.jsonl`
14
+ 3. **Read instincts:** Load all `*.yaml` files from project dir + `global/`
15
+ 4. **Read instinct packs:** Check if any packs from `instinct-packs/` have been loaded
16
+
17
+ ## Display Format
18
+
19
+ ```
20
+ ╔══════════════════════════════════════════════════════════════╗
21
+ ║ continuous-improvement Dashboard ║
22
+ ╠══════════════════════════════════════════════════════════════╣
23
+ ║ ║
24
+ ║ Project: <name> Level: <CAPTURE|ANALYZE|...> ║
25
+ ║ Sessions: ~<obs/10> Mode: <beginner|expert> ║
26
+ ║ ║
27
+ ║ ┌─ Observations ────────────────────────────────────────┐ ║
28
+ ║ │ Total: <n> Unprocessed: <n> Last: <date> │ ║
29
+ ║ └───────────────────────────────────────────────────────┘ ║
30
+ ║ ║
31
+ ║ ┌─ Instincts ───────────────────────────────────────────┐ ║
32
+ ║ │ Total: <n> │ ║
33
+ ║ │ ████████░░ Auto-apply (0.7+): <n> │ ║
34
+ ║ │ █████░░░░░ Suggest (0.5-0.69): <n> │ ║
35
+ ║ │ ██░░░░░░░░ Silent (< 0.5): <n> │ ║
36
+ ║ │ Global: <n> Project: <n> │ ║
37
+ ║ └───────────────────────────────────────────────────────┘ ║
38
+ ║ ║
39
+ ║ ┌─ Top Instincts ───────────────────────────────────────┐ ║
40
+ ║ │ <list top 5 instincts by confidence with bars> │ ║
41
+ ║ └───────────────────────────────────────────────────────┘ ║
42
+ ║ ║
43
+ ║ ┌─ Health ──────────────────────────────────────────────┐ ║
44
+ ║ │ Stale (30+ days): <n> Decaying: <n> │ ║
45
+ ║ │ Recently reinforced: <n> │ ║
46
+ ║ └───────────────────────────────────────────────────────┘ ║
47
+ ║ ║
48
+ ╚══════════════════════════════════════════════════════════════╝
49
+ ```
50
+
51
+ ## After Display
52
+
53
+ - If stale instincts > 0: suggest reviewing them
54
+ - If unprocessed observations > 20: suggest running analysis
55
+ - If no instincts exist: explain the auto-leveling timeline
56
+ - Show available instinct packs that haven't been loaded yet
@@ -65,7 +65,7 @@ Appended 12 instinct(s) to /Users/.../instincts/0af156594b39/instincts.jsonl
65
65
  If `tool_complete rows: 0`, the bash-fallback hook is active (no jq AND the Node observer is not on PATH) and only emits `tool_start` events. Two remediation paths:
66
66
 
67
67
  - **Install jq** — `winget install jqlang.jq` (Windows), `brew install jq` (macOS), `apt install jq` (Linux).
68
- - **Wire the Node observer** — ensure `hooks/bin/observe.mjs` is reachable from the active hook script.
68
+ - **Wire the Node observer** — ensure the installed observer shim `instincts/bin/observe.mjs` (copied from `bin/observe.mjs`) sits beside the active hook script.
69
69
 
70
70
  Both are documented in the WARNING the classifier prints on a thin-schema host.
71
71
 
@@ -1,16 +1,16 @@
1
- ---
2
- name: seven-laws
3
- description: "Brand-aligned alias for /continuous-improvement. Reflect on the current session, analyze observations for patterns, and show instinct status under the 7 Laws of AI Agent Discipline."
4
- ---
5
-
6
- # /seven-laws
7
-
8
- Brand-aligned alias for [`/continuous-improvement`](continuous-improvement.md). Both commands run the exact same three-step workflow under the 7 Laws of AI Agent Discipline:
9
-
10
- 1. **Reflect** (Law 5) — generate a reflection block for this session.
11
- 2. **Analyze** (Law 7) — process pending observations into instincts.
12
- 3. **Status** — show all instincts for the project + global with confidence and current level.
13
-
14
- Run the workflow defined in [`continuous-improvement.md`](continuous-improvement.md). Subcommands `weekly` and `always-on` work identically.
15
-
16
- `/continuous-improvement` remains supported indefinitely for backward compatibility. Prefer `/seven-laws` going forward — it matches the brand and the SKILL.md spec.
1
+ ---
2
+ name: seven-laws
3
+ description: "Brand-aligned alias for /continuous-improvement. Reflect on the current session, analyze observations for patterns, and show instinct status under the 7 Laws of AI Agent Discipline."
4
+ ---
5
+
6
+ # /seven-laws
7
+
8
+ Brand-aligned alias for [`/continuous-improvement`](continuous-improvement.md). Both commands run the exact same three-step workflow under the 7 Laws of AI Agent Discipline:
9
+
10
+ 1. **Reflect** (Law 5) — generate a reflection block for this session.
11
+ 2. **Analyze** (Law 7) — process pending observations into instincts.
12
+ 3. **Status** — show all instincts for the project + global with confidence and current level.
13
+
14
+ Run the workflow defined in [`continuous-improvement.md`](continuous-improvement.md). Subcommands `weekly` and `always-on` work identically.
15
+
16
+ `/continuous-improvement` remains supported indefinitely for backward compatibility. Prefer `/seven-laws` going forward — it matches the brand and the SKILL.md spec.