create-claude-cabinet 0.25.4 → 0.27.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 (50) hide show
  1. package/README.md +46 -5
  2. package/lib/cli.js +64 -29
  3. package/lib/metadata.js +22 -1
  4. package/lib/migrate-from-omega.js +681 -0
  5. package/lib/migrate-memory-cmd.js +653 -0
  6. package/lib/migration-snapshot.js +241 -0
  7. package/lib/project-context.js +103 -0
  8. package/lib/settings-merge.js +82 -51
  9. package/lib/verify-setup.js +4 -3
  10. package/package.json +4 -1
  11. package/templates/README.md +4 -3
  12. package/templates/cabinet/cross-project-rules-README.md +131 -0
  13. package/templates/cabinet/subagent-memory.md +90 -0
  14. package/templates/hooks/memory-index-guard.sh +70 -0
  15. package/templates/rules/memory-capture.md +64 -54
  16. package/templates/skills/cabinet-anthropic-insider/SKILL.md +7 -6
  17. package/templates/skills/cabinet-anti-confirmation/SKILL.md +1 -0
  18. package/templates/skills/cabinet-cc-health/SKILL.md +42 -39
  19. package/templates/skills/cabinet-goal-alignment/SKILL.md +1 -0
  20. package/templates/skills/cabinet-historian/SKILL.md +64 -121
  21. package/templates/skills/cabinet-record-keeper/SKILL.md +1 -0
  22. package/templates/skills/cabinet-technical-debt/SKILL.md +1 -0
  23. package/templates/skills/cabinet-vision/SKILL.md +1 -0
  24. package/templates/skills/cc-remember/SKILL.md +101 -0
  25. package/templates/skills/cc-upgrade/SKILL.md +34 -20
  26. package/templates/skills/cc-upgrade/phases/omega-migration-detect.md +134 -0
  27. package/templates/skills/debrief/SKILL.md +50 -28
  28. package/templates/skills/debrief/phases/record-lessons.md +56 -52
  29. package/templates/skills/memory/SKILL.md +85 -151
  30. package/templates/skills/onboard/phases/detect-state.md +1 -1
  31. package/templates/skills/onboard/phases/interview.md +33 -0
  32. package/templates/skills/orient/SKILL.md +20 -38
  33. package/templates/skills/orient/phases/auto-maintenance.md +14 -54
  34. package/templates/skills/orient/phases/context.md +20 -20
  35. package/templates/skills/validate/phases/validators.md +11 -0
  36. package/templates/skills/verify/SKILL.md +32 -7
  37. package/templates/skills/verify/install.sh +160 -19
  38. package/templates/skills/verify/phases/calibrate.md +79 -6
  39. package/templates/skills/verify/phases/discover.md +34 -3
  40. package/templates/skills/verify/phases/generate.md +31 -0
  41. package/templates/skills/verify/phases/recipes.md +113 -0
  42. package/templates/skills/verify/phases/scenario-template.md +49 -17
  43. package/templates/verify-runtime/package.json +1 -1
  44. package/templates/verify-runtime/src/baseline-steps.ts +135 -0
  45. package/templates/verify-runtime/src/index.ts +14 -0
  46. package/lib/omega-setup.js +0 -266
  47. package/templates/hooks/domain-memories.sh +0 -65
  48. package/templates/hooks/omega-memory-guard.sh +0 -77
  49. package/templates/scripts/cabinet-memory-adapter.py +0 -367
  50. package/templates/scripts/migrate-memory-to-omega.py +0 -124
package/README.md CHANGED
@@ -131,6 +131,32 @@ hooks — things that keep going wrong become things that can't go wrong.
131
131
  - **`/cc-upgrade`** — when Claude Cabinet publishes updates, this skill
132
132
  runs the installer for the mechanical parts and walks you through
133
133
  what changed conversationally. Intelligence is the merge strategy.
134
+ - **`/cc-feedback`** — file friction with CC itself mid-session
135
+ without waiting for debrief. When a skill, phase, or convention
136
+ causes pain, this captures the detail and queues it for upstream
137
+ delivery to the Claude Cabinet repo.
138
+
139
+ ### Verify (opt-in, off by default)
140
+
141
+ Walkthrough verification harness — Cucumber `.feature` files describing
142
+ user journeys, Playwright running them, and human-in-the-loop verdict
143
+ pauses (Pass / Issue / Skip / Needs-info) at checks that need subjective
144
+ judgment. Replaces flat AC checklists with re-runnable scenarios you can
145
+ read months later.
146
+
147
+ - **`/verify`** — run the suite
148
+ - **`/verify learn`** — bootstrap from a cold start. Claude scans
149
+ routes, memory, git, and the live UI; proposes scenarios; calibrates
150
+ with you; then generates `.feature` files and step stubs
151
+ - **`/verify update "I changed X"`** — keep scenarios in sync as the
152
+ product evolves
153
+ - **`/verify backfill <fid>`** — attach a Verify Plan to a pending
154
+ action's notes
155
+
156
+ Enable with `--modules verify` (existing installs merge, nothing else
157
+ disturbed). Runtime lives at `~/.claude-cabinet/verify/<version>/` and
158
+ ships an opinionated `cabinet-verify` npm package built from de[sic]ify's
159
+ e2e harness.
134
160
 
135
161
  ## Your Workflow
136
162
 
@@ -158,14 +184,29 @@ that override default behavior for any skill. Write content in a phase
158
184
  file to customize it, write `skip: true` to disable it, or leave it
159
185
  absent to use the default. No config files, no YAML, no DSL.
160
186
 
187
+ ## Adding Modules to an Existing Install
188
+
189
+ Some modules (like `verify` and `memory`) are opt-in. To add one
190
+ without touching anything else in your install:
191
+
192
+ ```
193
+ npx create-claude-cabinet --modules verify --yes
194
+ ```
195
+
196
+ The `--modules` flag **merges** with your existing install — it adds
197
+ the listed modules to what's already there, it doesn't replace your
198
+ module set. Safe to run on a mature project without losing
199
+ customization. You can pass multiple modules: `--modules verify,memory`.
200
+
161
201
  ## CLI Options
162
202
 
163
203
  ```
164
- npx create-claude-cabinet # Interactive walkthrough
165
- npx create-claude-cabinet my-project # Install in ./my-project/
166
- npx create-claude-cabinet --yes # Accept all defaults
167
- npx create-claude-cabinet --yes --no-db # All defaults, skip database
168
- npx create-claude-cabinet --dry-run # Preview without writing files
204
+ npx create-claude-cabinet # Interactive walkthrough
205
+ npx create-claude-cabinet my-project # Install in ./my-project/
206
+ npx create-claude-cabinet --yes # Accept all defaults
207
+ npx create-claude-cabinet --yes --no-db # All defaults, skip database
208
+ npx create-claude-cabinet --dry-run # Preview without writing files
209
+ npx create-claude-cabinet --modules verify --yes # Add an opt-in module (merges, doesn't replace)
169
210
  ```
170
211
 
171
212
  ## What Gets Installed
package/lib/cli.js CHANGED
@@ -4,10 +4,9 @@ const fs = require('fs');
4
4
  const os = require('os');
5
5
  const crypto = require('crypto');
6
6
  const { copyTemplates } = require('./copy');
7
- const { mergeSettings } = require('./settings-merge');
7
+ const { mergeSettings, healUserSettings } = require('./settings-merge');
8
8
  const { create: createMetadata, read: readMetadata } = require('./metadata');
9
9
  const { setupDb } = require('./db-setup');
10
- const { setupOmega } = require('./omega-setup');
11
10
  const { setupVerifyRuntime } = require('./verify-setup');
12
11
  const { reset } = require('./reset');
13
12
 
@@ -443,15 +442,6 @@ const MODULES = {
443
442
  lean: false,
444
443
  templates: ['skills/validate', 'scripts/skill-validator.sh'],
445
444
  },
446
- 'memory': {
447
- name: 'Semantic Memory (omega)',
448
- description: 'Rich session memory via omega-memory. Captures decisions, reasoning chains, and lessons between sessions. Requires Python 3.11+.',
449
- mandatory: false,
450
- default: true,
451
- lean: false,
452
- needsOmega: true,
453
- templates: ['skills/memory', 'scripts/cabinet-memory-adapter.py', 'scripts/migrate-memory-to-omega.py', 'rules/memory-capture.md', 'hooks/omega-memory-guard.sh'],
454
- },
455
445
  'verify': {
456
446
  name: 'Verification Harness (Cucumber + Playwright)',
457
447
  description: 'Walkthrough verification with human-in-the-loop verdict pauses. Replaces flat AC lists with re-runnable user-journey scenarios. Includes /verify skeleton skill + cabinet-verify npm runtime + opt-in integration phases for /plan, /execute, /debrief.',
@@ -529,6 +519,8 @@ function parseArgs(argv) {
529
519
  else if (arg === '--help' || arg === '-h') flags.help = true;
530
520
  else if (arg === '--reset') flags.reset = true;
531
521
  else if (arg === '--force') flags.force = true;
522
+ else if (arg === '--migrate-memory') flags.migrateMemory = true;
523
+ else if (arg === '--unmigrate-memory') flags.unmigrateMemory = true;
532
524
  else if (arg === '--modules' && i + 1 < args.length) {
533
525
  flags.modules = args[++i].split(',').map(s => s.trim()).filter(Boolean);
534
526
  }
@@ -546,11 +538,17 @@ function printHelp() {
546
538
  --yes, -y Accept all defaults, no prompts
547
539
  --lean Install core modules only (no work-tracking, compliance, validate)
548
540
  --no-db Skip work tracking database setup
549
- --modules <keys> Comma-separated module keys to install (e.g., 'verify,memory').
541
+ --modules <keys> Comma-separated module keys to install (e.g., 'verify').
550
542
  Mandatory modules are always included.
551
543
  --dry-run Show what would be copied without writing
552
544
  --reset Remove Claude Cabinet files (uses manifest for safety)
553
- --force With --reset: remove even customized files
545
+ --force With --reset: remove even customized files;
546
+ with --migrate-memory: override already-migrated guard
547
+ --migrate-memory One-time migration off omega-memory (v0.27.0+).
548
+ Exports omega memories to built-in memory layout, then
549
+ disables omega hooks/MCP. Idempotent — safe to re-run.
550
+ Pair with --dry-run to preview.
551
+ --unmigrate-memory Roll back --migrate-memory using its backup dir.
554
552
  --help, -h Show this help
555
553
 
556
554
  Examples:
@@ -579,6 +577,48 @@ async function run() {
579
577
  return;
580
578
  }
581
579
 
580
+ if (flags.migrateMemory) {
581
+ const { migrateMemoryCmd } = require('./migrate-memory-cmd');
582
+ const projectDir = path.resolve(flags.targetDir);
583
+ console.log('');
584
+ console.log(` 🔄 Omega → built-in memory migration${flags.dryRun ? ' [dry-run]' : ''}`);
585
+ console.log('');
586
+ const result = await migrateMemoryCmd({
587
+ cwd: projectDir,
588
+ dryRun: flags.dryRun,
589
+ force: flags.force,
590
+ });
591
+ console.log('');
592
+ if (result.skipped) {
593
+ console.log(` ${result.message || result.reason}`);
594
+ } else if (flags.dryRun) {
595
+ console.log(` Dry run complete. ${result.steps.length} step(s) would execute.`);
596
+ } else {
597
+ console.log(` ✓ Migration complete.`);
598
+ console.log(` Backup: ${result.backupDir}`);
599
+ console.log(` State: ${result.state.state} (recorded in .ccrc.json.migrated_from_omega)`);
600
+ console.log(` Rollback: npx create-claude-cabinet --unmigrate-memory`);
601
+ }
602
+ console.log('');
603
+ return;
604
+ }
605
+
606
+ if (flags.unmigrateMemory) {
607
+ const { unmigrateMemoryCmd } = require('./migrate-memory-cmd');
608
+ const projectDir = path.resolve(flags.targetDir);
609
+ console.log('');
610
+ console.log(` ↩️ Rolling back omega → built-in migration${flags.dryRun ? ' [dry-run]' : ''}`);
611
+ console.log('');
612
+ const result = await unmigrateMemoryCmd({ cwd: projectDir, dryRun: flags.dryRun });
613
+ if (!result.ok) {
614
+ console.error(` ✗ ${result.message}`);
615
+ process.exit(1);
616
+ }
617
+ console.log(` ${result.message}`);
618
+ console.log('');
619
+ return;
620
+ }
621
+
582
622
  console.log('');
583
623
  console.log(' 🗄️ Claude Cabinet v' + VERSION);
584
624
  console.log(' A cabinet of experts for your Claude Code project');
@@ -978,11 +1018,20 @@ async function run() {
978
1018
 
979
1019
  // --- Merge hooks into settings.json ---
980
1020
  if (selectedModules.includes('hooks') && !flags.dryRun) {
981
- const includeMemory = selectedModules.includes('memory');
982
- const settingsPath = mergeSettings(projectDir, { includeDb, includeMemory });
1021
+ const settingsPath = mergeSettings(projectDir, { includeDb });
983
1022
  console.log(` ⚙️ Merged hooks into ${path.relative(projectDir, settingsPath)}`);
984
1023
  }
985
1024
 
1025
+ // --- Heal user-level ~/.claude/settings.json ---
1026
+ // Strip CC hook entries with project-relative paths that fire (and fail) in
1027
+ // every project including non-CC ones. Idempotent; no-op for clean configs.
1028
+ if (!flags.dryRun) {
1029
+ const removed = healUserSettings();
1030
+ if (removed > 0) {
1031
+ console.log(` 🧹 Removed ${removed} stale CC hook entr${removed === 1 ? 'y' : 'ies'} from ~/.claude/settings.json`);
1032
+ }
1033
+ }
1034
+
986
1035
  // --- Merge pib-db MCP server into .mcp.json ---
987
1036
  if (selectedModules.includes('work-tracking') && !flags.dryRun) {
988
1037
  try {
@@ -1015,20 +1064,6 @@ async function run() {
1015
1064
  }
1016
1065
  }
1017
1066
 
1018
- // --- Set up omega memory ---
1019
- const needsOmega = selectedModules.some(m => MODULES[m].needsOmega);
1020
- if (needsOmega && !flags.dryRun) {
1021
- try {
1022
- console.log('');
1023
- const omegaResults = setupOmega();
1024
- for (const r of omegaResults) console.log(` 🧠 ${r}`);
1025
- } catch (err) {
1026
- console.log(` ⚠ Omega memory setup skipped: ${err.message}`);
1027
- console.log(' Memory module will be inactive until Python 3.11+ is available.');
1028
- console.log(' Re-run the installer after installing Python to enable it.');
1029
- }
1030
- }
1031
-
1032
1067
  // --- Run module postInstall hooks ---
1033
1068
  // Modules with a `postInstall` field dispatch to a matching setup
1034
1069
  // function after templates are copied. Currently only 'verify-setup'
package/lib/metadata.js CHANGED
@@ -22,8 +22,29 @@ function write(projectDir, data) {
22
22
  fs.writeFileSync(file, JSON.stringify(data, null, 2) + '\n');
23
23
  }
24
24
 
25
+ /**
26
+ * Shallow-merge `partial` into the existing .ccrc.json and write back.
27
+ * Preserves any unknown top-level keys (e.g., `migrated_from_omega`)
28
+ * that this codepath doesn't know about — critical for cross-codepath
29
+ * fields written by other tools like --migrate-memory.
30
+ *
31
+ * Returns the merged result.
32
+ */
33
+ function merge(projectDir, partial) {
34
+ const existing = read(projectDir) || {};
35
+ const data = { ...existing, ...partial };
36
+ write(projectDir, data);
37
+ return data;
38
+ }
39
+
25
40
  function create(projectDir, { modules, skipped, version, manifest = {} }) {
41
+ // Read existing first so unknown top-level keys (e.g.
42
+ // `migrated_from_omega` set by --migrate-memory) survive the
43
+ // install/upgrade rewrite. Only the install-specific fields below
44
+ // are reset on each create() call.
45
+ const existing = read(projectDir) || {};
26
46
  const data = {
47
+ ...existing,
27
48
  version,
28
49
  installedAt: new Date().toISOString(),
29
50
  upstreamPackage: 'create-claude-cabinet',
@@ -43,4 +64,4 @@ function create(projectDir, { modules, skipped, version, manifest = {} }) {
43
64
  return data;
44
65
  }
45
66
 
46
- module.exports = { read, write, create, metadataPath, METADATA_FILE };
67
+ module.exports = { read, write, merge, create, metadataPath, METADATA_FILE };