continuous-improvement 3.0.0 → 3.1.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,25 @@ All notable changes to this skill are documented here.
4
4
 
5
5
  ---
6
6
 
7
+ ## [3.0.0] — 2026-04-06
8
+
9
+ ### Added
10
+ - **MCP server** (`bin/mcp-server.mjs`) — zero-dependency JSON-RPC stdio server exposing instincts as MCP tools and resources. Works with Claude Code, Claude Desktop, Cursor, Zed, Windsurf, VS Code.
11
+ - **Beginner / Expert modes** — `--mode beginner` (default, 3 tools) vs `--mode expert` (8 tools with import/export, observation viewer, manual instinct creation, confidence tuning)
12
+ - **MCP-only mode** — `--mode mcp` for editors that support MCP but not Claude Code hooks
13
+ - **Plugin manifests** — `plugins/beginner.json` and `plugins/expert.json` describe available tools per mode
14
+ - **Session hooks** (`hooks/session.sh`) — SessionStart loads instincts and shows status; SessionEnd reminds to reflect
15
+ - **Import/export tools** — `ci_export` and `ci_import` for sharing instincts as JSON between team members
16
+ - **34-test suite** — added MCP server tests (beginner + expert mode) and plugin config validation. Up from 20 tests.
17
+ - **Multi-editor MCP support** — installer patches both `settings.json` and `claude_desktop_config.json`
18
+
19
+ ### Changed
20
+ - **Installer upgraded** — `--mode` flag replaces single-mode install. Supports `beginner`, `expert`, `mcp`
21
+ - **Uninstaller upgraded** — cleans up MCP server config, session hooks, and desktop config
22
+ - **Version bump** to 3.0.0 — breaking change: new install modes and MCP server architecture
23
+
24
+ ---
25
+
7
26
  ## [2.3.0] — 2026-04-06
8
27
 
9
28
  ### Changed
package/README.md CHANGED
@@ -11,8 +11,11 @@
11
11
  <p align="center">
12
12
  <a href="https://www.npmjs.com/package/continuous-improvement"><img src="https://img.shields.io/npm/v/continuous-improvement" alt="npm"></a>
13
13
  <a href="https://www.npmjs.com/package/continuous-improvement"><img src="https://img.shields.io/npm/dm/continuous-improvement" alt="downloads"></a>
14
+ <a href="https://github.com/naimkatiman/continuous-improvement/stargazers"><img src="https://img.shields.io/github/stars/naimkatiman/continuous-improvement?style=social" alt="stars"></a>
15
+ <a href="https://github.com/naimkatiman/continuous-improvement/network/members"><img src="https://img.shields.io/github/forks/naimkatiman/continuous-improvement?style=social" alt="forks"></a>
16
+ <a href="https://github.com/naimkatiman/continuous-improvement/graphs/contributors"><img src="https://img.shields.io/github/contributors/naimkatiman/continuous-improvement" alt="contributors"></a>
14
17
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" alt="license"></a>
15
- <a href="test/"><img src="https://img.shields.io/badge/tests-20%20passing-brightgreen" alt="tests"></a>
18
+ <a href="test/"><img src="https://img.shields.io/badge/tests-104%20passing-brightgreen" alt="tests"></a>
16
19
  </p>
17
20
 
18
21
  <p align="center">
@@ -20,6 +23,12 @@
20
23
  <a href="https://cursor.sh"><img src="https://img.shields.io/badge/Cursor-compatible-blue" alt="Cursor"></a>
21
24
  <a href="https://openai.com/codex"><img src="https://img.shields.io/badge/Codex-compatible-blue" alt="Codex"></a>
22
25
  <a href="https://ai.google.dev/gemini-api/docs/gemini-cli"><img src="https://img.shields.io/badge/Gemini%20CLI-compatible-blue" alt="Gemini CLI"></a>
26
+ <a href="https://github.com/naimkatiman/continuous-improvement/actions"><img src="https://img.shields.io/github/actions/workflow/status/naimkatiman/continuous-improvement/ci.yml?label=CI" alt="CI"></a>
27
+ </p>
28
+
29
+ <p align="center">
30
+ <a href="docs/README.zh-CN.md">简体中文</a> |
31
+ <a href="docs/README.ja.md">日本語</a>
23
32
  </p>
24
33
 
25
34
  ---
@@ -102,7 +111,7 @@ npx continuous-improvement install
102
111
 
103
112
  That's it. For Claude Code, this installs:
104
113
  - Observation hooks (captures every tool call, <50ms, jq optional)
105
- - `/continuous-improvement` command
114
+ - `/continuous-improvement`, `/discipline`, and `/dashboard` commands
106
115
  - Auto-leveling instinct system
107
116
 
108
117
  ### Expert — full power with MCP server
@@ -112,7 +121,7 @@ npx continuous-improvement install --mode expert
112
121
  ```
113
122
 
114
123
  Everything in beginner plus:
115
- - **MCP server** with 8 tools (instinct management, import/export, observation viewer)
124
+ - **MCP server** with 10 tools (instinct management, import/export, dashboard, instinct packs)
116
125
  - **Session hooks** (auto-load instincts at start, remind to reflect at end)
117
126
  - Works with Claude Code, Claude Desktop, and any MCP client
118
127
 
@@ -124,6 +133,14 @@ npx continuous-improvement install --mode mcp
124
133
 
125
134
  Registers the MCP server without hooks — for Cursor, Zed, Windsurf, VS Code, or any editor that supports MCP.
126
135
 
136
+ ### Load a starter instinct pack
137
+
138
+ ```bash
139
+ npx continuous-improvement install --pack react # React/Next.js instincts
140
+ npx continuous-improvement install --pack python # Python best practices
141
+ npx continuous-improvement install --pack go # Go idioms
142
+ ```
143
+
127
144
  ### Install to a specific target
128
145
 
129
146
  ```bash
@@ -195,14 +212,110 @@ Install: Hooks start capturing silently. You notice nothing.
195
212
  4. **Self-correcting** — user corrections drop confidence by 0.1. Unused instincts decay. Wrong behaviors fade out.
196
213
  5. **Project-scoped** — instincts are per-project by default, promoted to global when seen across 2+ projects
197
214
 
215
+ ### Starter Instinct Packs
216
+
217
+ Jump-start your instincts with pre-built packs for popular stacks:
218
+
219
+ ```bash
220
+ npx continuous-improvement install --pack react # 8 React/Next.js instincts
221
+ npx continuous-improvement install --pack python # 8 Python instincts
222
+ npx continuous-improvement install --pack go # 8 Go instincts
223
+ ```
224
+
225
+ Or in expert mode: use the `ci_load_pack` tool to load packs at any time.
226
+
198
227
  ### Check what your agent has learned
199
228
 
200
229
  ```
201
- /continuous-improvement
230
+ /continuous-improvement # Reflect, analyze, show status
231
+ /discipline # Quick reference card of the 7 Laws
232
+ /dashboard # Visual instinct health dashboard
233
+ ```
234
+
235
+ ---
236
+
237
+ ## GitHub Action: Agent Transcript Linter
238
+
239
+ Lint your AI agent's behavior in CI/CD. The only GitHub Action that checks if your agent followed disciplined workflows.
240
+
241
+ ```yaml
242
+ - uses: naimkatiman/continuous-improvement@v3
243
+ with:
244
+ transcript-path: agent-log.jsonl
245
+ strict: true # Fail build on law violations
246
+ ```
247
+
248
+ The linter analyzes tool call patterns and detects:
249
+ - **Law 1 violations** — writes without prior research
250
+ - **Law 3 violations** — too many consecutive edits without verification
251
+ - **Law 4 violations** — code changes without running tests/builds
252
+ - **Law 6 violations** — too many files modified at once
253
+
254
+ Output includes a discipline score (0-100) and detailed violation report.
255
+
256
+ ```bash
257
+ # Run locally
258
+ node bin/lint-transcript.mjs observations.jsonl
259
+ cat transcript.jsonl | node bin/lint-transcript.mjs --stdin --json
202
260
  ```
203
261
 
204
262
  ---
205
263
 
264
+ ## Plugin Architecture
265
+
266
+ continuous-improvement ships as a **plugin** with three layers. Pick what you need:
267
+
268
+ ### Layer 1: Skill Only (any LLM)
269
+ Paste SKILL.md into your system prompt. Your agent follows the 7 Laws. No tools, no hooks, no server.
270
+
271
+ ### Layer 2: Hooks (Claude Code)
272
+ `npx continuous-improvement install` — installs hooks that silently capture every tool call. The instinct system grows automatically. Zero config.
273
+
274
+ ### Layer 3: MCP Server (any MCP client)
275
+ `npx continuous-improvement install --mode expert` — a full MCP server that any editor can connect to.
276
+
277
+ ### Beginner vs Expert
278
+
279
+ | Feature | Beginner (default) | Expert |
280
+ |---------|-------------------|--------|
281
+ | Observation hooks | Yes | Yes |
282
+ | `/continuous-improvement` command | Yes | Yes |
283
+ | `/discipline` quick reference | Yes | Yes |
284
+ | `/dashboard` visual dashboard | Yes | Yes |
285
+ | Auto-leveling instincts | Yes | Yes |
286
+ | `ci_status` tool | - | Yes |
287
+ | `ci_instincts` tool | - | Yes |
288
+ | `ci_reflect` tool | - | Yes |
289
+ | `ci_reinforce` tool | - | Yes |
290
+ | `ci_create_instinct` tool | - | Yes |
291
+ | `ci_observations` tool | - | Yes |
292
+ | `ci_export` / `ci_import` | - | Yes |
293
+ | `ci_dashboard` tool | - | Yes |
294
+ | `ci_load_pack` tool | - | Yes |
295
+ | Session start/end hooks | - | Yes |
296
+ | MCP server | - | Yes |
297
+
298
+ **Beginner** is the right choice for 90% of users. It just works — install and forget. The system quietly learns from your sessions.
299
+
300
+ **Expert** adds the MCP server for programmatic access, manual instinct management, import/export for team sharing, visual dashboard, and instinct packs.
301
+
302
+ ### MCP Tools Reference
303
+
304
+ | Tool | Description |
305
+ |------|-------------|
306
+ | `ci_status` | Current level, instinct count, observation count |
307
+ | `ci_instincts` | List learned instincts with confidence levels |
308
+ | `ci_reflect` | Generate structured session reflection |
309
+ | `ci_reinforce` | Accept/reject instinct suggestions (expert) |
310
+ | `ci_create_instinct` | Manually create instincts (expert) |
311
+ | `ci_observations` | View raw tool call observations (expert) |
312
+ | `ci_export` | Export instincts as JSON (expert) |
313
+ | `ci_import` | Import instincts from JSON (expert) |
314
+ | `ci_dashboard` | Visual dashboard with confidence distribution (expert) |
315
+ | `ci_load_pack` | Load starter instinct packs (expert) |
316
+
317
+ ---
318
+
206
319
  ## Real-World Examples
207
320
 
208
321
  See the [`examples/`](examples/) directory for detailed walkthroughs:
@@ -219,22 +332,49 @@ Each example shows the same task done with and without the 7 laws, highlighting
219
332
 
220
333
  ```
221
334
  continuous-improvement/
222
- ├── SKILL.md # The 7 Laws + instinct behavior
223
- ├── commands/continuous-improvement.md # /continuous-improvement command
224
- ├── hooks/observe.sh # Observation hook (pure bash, <50ms)
225
- ├── bin/install.mjs # CLI installer
226
- ├── test/ # 20 tests (node --test)
227
- ├── examples/ # Real-world before/after scenarios
228
- ├── QUICKSTART.md # First-use guide
335
+ ├── SKILL.md # The 7 Laws + instinct behavior
336
+ ├── bin/
337
+ ├── install.mjs # CLI installer (--mode beginner|expert|mcp)
338
+ ├── mcp-server.mjs # MCP server (zero dependencies)
339
+ │ └── lint-transcript.mjs # Agent transcript linter (GitHub Action)
340
+ ├── hooks/
341
+ ├── observe.sh # Observation hook (pure bash, <50ms)
342
+ │ └── session.sh # Session start/end hook (expert mode)
343
+ ├── plugins/
344
+ │ ├── beginner.json # Plugin manifest: 3 tools
345
+ │ └── expert.json # Plugin manifest: 10 tools
346
+ ├── commands/
347
+ │ ├── continuous-improvement.md # /continuous-improvement command
348
+ │ ├── discipline.md # /discipline quick reference
349
+ │ └── dashboard.md # /dashboard visual display
350
+ ├── instinct-packs/
351
+ │ ├── react.json # React/Next.js starter instincts
352
+ │ ├── python.json # Python starter instincts
353
+ │ └── go.json # Go starter instincts
354
+ ├── test/ # 104 tests (node --test)
355
+ ├── examples/ # Real-world before/after scenarios
356
+ ├── docs/ # Translations (zh-CN, ja)
357
+ ├── .github/
358
+ │ ├── workflows/ci.yml # CI pipeline (Node 18/20/22)
359
+ │ └── ISSUE_TEMPLATE/ # Bug report + feature request templates
360
+ ├── action.yml # GitHub Action definition
361
+ ├── llms.txt # LLM-friendly project description
362
+ ├── CONTRIBUTING.md
363
+ ├── CODE_OF_CONDUCT.md
364
+ ├── SECURITY.md
365
+ ├── QUICKSTART.md
229
366
  ├── CHANGELOG.md
230
367
  └── package.json
231
368
  ```
232
369
 
233
- ### What gets installed where (Claude Code)
370
+ ### What gets installed where
234
371
 
372
+ **Beginner mode** (default):
235
373
  ```
236
374
  ~/.claude/skills/continuous-improvement/SKILL.md # The skill
237
375
  ~/.claude/commands/continuous-improvement.md # The command
376
+ ~/.claude/commands/discipline.md # Quick reference
377
+ ~/.claude/commands/dashboard.md # Dashboard
238
378
  ~/.claude/instincts/
239
379
  ├── observe.sh # Hook script
240
380
  ├── global/ # Global instincts (*.yaml)
@@ -244,6 +384,12 @@ continuous-improvement/
244
384
  └── *.yaml # Project instincts
245
385
  ```
246
386
 
387
+ **Expert mode** adds:
388
+ ```
389
+ ~/.claude/instincts/session.sh # Session hooks
390
+ ~/.claude/settings.json # + MCP server + session hooks
391
+ ```
392
+
247
393
  ---
248
394
 
249
395
  ## Uninstall
@@ -252,7 +398,7 @@ continuous-improvement/
252
398
  npx continuous-improvement install --uninstall
253
399
  ```
254
400
 
255
- Removes the skill, hooks, and command. Your learned instincts in `~/.claude/instincts/` are preserved — delete that directory manually if you want a clean slate.
401
+ Removes the skill, hooks, and commands. Your learned instincts in `~/.claude/instincts/` are preserved — delete that directory manually if you want a clean slate.
256
402
 
257
403
  ---
258
404
 
@@ -260,8 +406,11 @@ Removes the skill, hooks, and command. Your learned instincts in `~/.claude/inst
260
406
 
261
407
  | Tool | Support |
262
408
  |------|---------|
263
- | **Claude Code** | Full — skill + hooks + auto-leveling instincts |
264
- | **Cursor** | Skill only (paste SKILL.md into rules) |
409
+ | **Claude Code** | Full — skill + hooks + MCP server + auto-leveling instincts |
410
+ | **Claude Desktop** | MCP server (expert/mcp mode) |
411
+ | **Cursor** | MCP server (mcp mode) or skill only (paste SKILL.md into rules) |
412
+ | **Zed / Windsurf** | MCP server (mcp mode) |
413
+ | **VS Code** | MCP server (mcp mode) with Copilot MCP support |
265
414
  | **Codex** | Skill only |
266
415
  | **Gemini CLI** | Skill only |
267
416
  | **OpenClaw** | Skill only |
@@ -286,33 +435,62 @@ If your agent says any of these, it's skipping a law:
286
435
  ### Phase 1: Foundation -- DONE
287
436
 
288
437
  - [x] Published to public npm (`npx continuous-improvement install` works)
289
- - [x] 20-test suite (installer, hook, SKILL.md validation)
438
+ - [x] 104-test suite (installer, hook, MCP server, linter, packs, community files)
290
439
  - [x] Before/after examples in README + `examples/` directory
291
440
  - [x] Gemini CLI support
292
441
  - [x] Platform badges and improved npm metadata
293
442
  - [ ] **Submit to [awesome-agent-skills](https://github.com/VoltAgent/awesome-agent-skills)** (14K stars)
294
443
 
295
- ### Phase 2: Content & Proof (In Progress)
444
+ ### Phase 2: Plugin Architecture -- DONE
445
+
446
+ - [x] **MCP server** — 10 tools (beginner: 3, expert: 7 more) with zero dependencies
447
+ - [x] **Beginner / Expert separation** — simple defaults, power when you need it
448
+ - [x] **Plugin manifests** — `plugins/beginner.json` and `plugins/expert.json`
449
+ - [x] **Session hooks** — auto-load instincts at session start, remind to reflect at end
450
+ - [x] **`--mode` flag** — `beginner` | `expert` | `mcp` installation modes
451
+ - [x] **Import/export** — share instincts as JSON between team members
452
+ - [x] **Multi-editor MCP support** — Claude Desktop, Cursor, Zed, Windsurf, VS Code
453
+
454
+ ### Phase 2.5: Visibility & Ecosystem -- DONE
455
+
456
+ - [x] **GitHub Action** — lint agent transcripts for law compliance (`action.yml`)
457
+ - [x] **Starter instinct packs** — React, Python, Go (pre-built instincts)
458
+ - [x] **`/discipline` command** — quick reference card of the 7 Laws
459
+ - [x] **`/dashboard` command** — visual instinct health dashboard
460
+ - [x] **Community files** — CONTRIBUTING.md, CODE_OF_CONDUCT.md, SECURITY.md
461
+ - [x] **llms.txt** — LLM-friendly project description for discoverability
462
+ - [x] **CI pipeline** — GitHub Actions testing on Node 18/20/22
463
+ - [x] **Issue templates** — bug report + feature request
464
+ - [x] **Translations** — Chinese (简体中文) and Japanese (日本語)
465
+
466
+ ### Phase 3: Content & Proof
296
467
 
297
468
  - [ ] **2-min demo video** — side-by-side agent with/without discipline. Post to X + YouTube.
298
469
  - [ ] **"Why your AI agent keeps lying about being done"** — X thread / blog post
299
470
  - [ ] **"Law of the Week" X series** — 7 weeks of content breaking down each law
300
471
 
301
- ### Phase 3: Ecosystem Integration
472
+ ### Phase 4: Ecosystem Growth
302
473
 
303
- - [ ] **MCP server** — expose instinct status + law compliance as MCP tools
304
- - [ ] **GitHub Action** — lint agent transcripts for law compliance
305
474
  - [ ] **VS Code extension** — sidebar showing instinct confidence levels
306
- - [ ] **Aider / Windsurf / Zed** support
475
+ - [ ] **More instinct packs** TypeScript, Rust, Java, Django, Laravel
476
+ - [ ] **Instinct marketplace** — share learned instincts across teams
307
477
 
308
- ### Phase 4: Community
478
+ ### Phase 5: Community
309
479
 
310
- - [ ] **Instinct marketplace** — share learned instincts across teams
311
- - [ ] **Quick-start instinct packs** — pre-built instincts for React, Python, Go, etc.
312
480
  - [ ] **Conference talk on Mulahazah** — the auto-leveling system is genuinely novel
481
+ - [ ] **Leaderboard / badges** — "100 sessions" achievement system
482
+ - [ ] **Custom domain** — landing page with interactive demo
313
483
 
314
484
  ---
315
485
 
486
+ ## Contributing
487
+
488
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines. Issues and PRs welcome.
489
+
490
+ ## Security
491
+
492
+ See [SECURITY.md](SECURITY.md) for the security policy and how to report vulnerabilities.
493
+
316
494
  ## License
317
495
 
318
496
  MIT
package/action.yml ADDED
@@ -0,0 +1,33 @@
1
+ name: 'AI Agent Discipline Linter'
2
+ description: 'Lint AI agent transcripts for compliance with the 7 Laws of AI Agent Discipline'
3
+ author: 'naimkatiman'
4
+
5
+ branding:
6
+ icon: 'check-circle'
7
+ color: 'green'
8
+
9
+ inputs:
10
+ transcript-path:
11
+ description: 'Path to the agent transcript file (JSONL format)'
12
+ required: false
13
+ default: ''
14
+ observations-path:
15
+ description: 'Path to observations.jsonl from a CI session'
16
+ required: false
17
+ default: ''
18
+ strict:
19
+ description: 'Fail the check if any law violations are detected'
20
+ required: false
21
+ default: 'false'
22
+
23
+ outputs:
24
+ violations:
25
+ description: 'Number of law violations found'
26
+ score:
27
+ description: 'Discipline score (0-100)'
28
+ report:
29
+ description: 'Markdown-formatted report'
30
+
31
+ runs:
32
+ using: 'node20'
33
+ main: 'bin/lint-transcript.mjs'
package/bin/install.mjs CHANGED
@@ -23,10 +23,12 @@ import {
23
23
  writeFileSync,
24
24
  rmSync,
25
25
  chmodSync,
26
+ readdirSync,
26
27
  } from "node:fs";
27
28
  import { join, dirname } from "node:path";
28
29
  import { homedir } from "node:os";
29
30
  import { fileURLToPath } from "node:url";
31
+ import { execSync } from "node:child_process";
30
32
 
31
33
  const __filename = fileURLToPath(import.meta.url);
32
34
  const __dirname = dirname(__filename);
@@ -133,14 +135,17 @@ function setupMulahazah() {
133
135
  }
134
136
  }
135
137
 
136
- // 4. Copy /continuous-improvement command
138
+ // 4. Copy all commands
137
139
  const commandsDir = join(home, ".claude", "commands");
138
140
  mkdirSync(commandsDir, { recursive: true });
139
- const cmdSrc = join(REPO_ROOT, "commands", "continuous-improvement.md");
140
- const cmdDest = join(commandsDir, "continuous-improvement.md");
141
- if (existsSync(cmdSrc)) {
142
- copyFileSync(cmdSrc, cmdDest);
143
- console.log(` ✓ /continuous-improvement command → ${cmdDest}`);
141
+ const commandFiles = ["continuous-improvement.md", "discipline.md", "dashboard.md"];
142
+ for (const cmdFile of commandFiles) {
143
+ const cmdSrc = join(REPO_ROOT, "commands", cmdFile);
144
+ const cmdDest = join(commandsDir, cmdFile);
145
+ if (existsSync(cmdSrc)) {
146
+ copyFileSync(cmdSrc, cmdDest);
147
+ console.log(` ✓ /${cmdFile.replace(".md", "")} command → ${cmdDest}`);
148
+ }
144
149
  }
145
150
 
146
151
  // 5. Patch ~/.claude/settings.json with hooks
@@ -301,14 +306,16 @@ function uninstallAll() {
301
306
  }
302
307
  }
303
308
 
304
- // 2. Remove /continuous-improvement command
305
- const cmdFile = join(home, ".claude", "commands", "continuous-improvement.md");
306
- if (existsSync(cmdFile)) {
307
- try {
308
- rmSync(cmdFile);
309
- console.log(` ✓ Removed /continuous-improvement command`);
310
- } catch (err) {
311
- console.error(` ✗ Command file: ${err.message}`);
309
+ // 2. Remove all commands
310
+ for (const cmdName of ["continuous-improvement.md", "discipline.md", "dashboard.md"]) {
311
+ const cmdFile = join(home, ".claude", "commands", cmdName);
312
+ if (existsSync(cmdFile)) {
313
+ try {
314
+ rmSync(cmdFile);
315
+ console.log(` ✓ Removed /${cmdName.replace(".md", "")} command`);
316
+ } catch (err) {
317
+ console.error(` ✗ ${cmdName}: ${err.message}`);
318
+ }
312
319
  }
313
320
  }
314
321
 
@@ -442,7 +449,7 @@ if (args.includes("--uninstall")) {
442
449
  }
443
450
 
444
451
  console.log(`
445
- continuous-improvement v3.0 (mode: ${INSTALL_MODE})
452
+ continuous-improvement v3.1 (mode: ${INSTALL_MODE})
446
453
  Research → Plan → Execute → Verify → Reflect → Learn → Iterate
447
454
  `);
448
455
 
@@ -485,6 +492,58 @@ const modeInfo = {
485
492
  mcp: "MCP server registered. Connect from any MCP-compatible editor.",
486
493
  };
487
494
 
495
+ // Handle --pack flag
496
+ const packIdx = _args.indexOf("--pack");
497
+ if (packIdx !== -1 && _args[packIdx + 1]) {
498
+ const packName = _args[packIdx + 1];
499
+ const packPath = join(REPO_ROOT, "instinct-packs", `${packName}.json`);
500
+ if (existsSync(packPath)) {
501
+ const project = getProjectHashSync();
502
+ const targetDir = join(homedir(), ".claude", "instincts", project.hash);
503
+ mkdirSync(targetDir, { recursive: true });
504
+
505
+ const instincts = JSON.parse(readFileSync(packPath, "utf8"));
506
+ let loaded = 0;
507
+ for (const inst of instincts) {
508
+ const instPath = join(targetDir, `${inst.id}.yaml`);
509
+ if (!existsSync(instPath)) {
510
+ const yaml = [
511
+ `id: ${inst.id}`,
512
+ `trigger: "${inst.trigger}"`,
513
+ `confidence: ${inst.confidence}`,
514
+ `domain: ${inst.domain || "workflow"}`,
515
+ `source: pack-${packName}`,
516
+ `scope: project`,
517
+ `project_id: ${project.hash}`,
518
+ `created: "${new Date().toISOString().split("T")[0]}"`,
519
+ `last_seen: "${new Date().toISOString().split("T")[0]}"`,
520
+ `observation_count: 0`,
521
+ "---",
522
+ inst.body,
523
+ ].join("\n");
524
+ writeFileSync(instPath, yaml + "\n");
525
+ loaded++;
526
+ }
527
+ }
528
+ console.log(` ✓ Loaded ${loaded}/${instincts.length} instincts from ${packName} pack`);
529
+ } else {
530
+ const available = readdirSync(join(REPO_ROOT, "instinct-packs"))
531
+ .filter((f) => f.endsWith(".json"))
532
+ .map((f) => f.replace(".json", ""));
533
+ console.error(` ✗ Unknown pack: ${packName}. Available: ${available.join(", ")}`);
534
+ }
535
+ }
536
+
537
+ function getProjectHashSync() {
538
+ try {
539
+ const root = execSync("git rev-parse --show-toplevel 2>/dev/null", { encoding: "utf8" }).trim();
540
+ const hash = execSync(`printf '%s' "${root}" | sha256sum | cut -c1-12`, { encoding: "utf8", shell: "/bin/bash" }).trim();
541
+ return { root, hash };
542
+ } catch {
543
+ return { root: "global", hash: "global" };
544
+ }
545
+ }
546
+
488
547
  console.log(`
489
548
  ${installed > 0 ? "Done." : "Failed."} Installed to ${installed}/${targets.length} target(s).
490
549
  ${hasClaude ? `\n${modeInfo[INSTALL_MODE] || modeInfo.beginner}` : ""}
@@ -492,6 +551,8 @@ Next steps:
492
551
  1. Start a new Claude Code session
493
552
  2. Say: "Use the continuous-improvement framework to [your task]"
494
553
  3. After your first task, run: /continuous-improvement
495
- ${INSTALL_MODE === "expert" ? "\nMCP tools available: ci_status, ci_instincts, ci_reflect, ci_reinforce,\n ci_create_instinct, ci_observations, ci_export, ci_import" : ""}
554
+ 4. Try: /discipline for quick reference, /dashboard for instinct health
555
+ ${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_dashboard, ci_load_pack" : ""}
496
556
  ${INSTALL_MODE === "mcp" ? "\nMCP tools available: ci_status, ci_instincts, ci_reflect" : ""}
557
+ Available instinct packs: npx continuous-improvement install --pack react|python|go
497
558
  `);