create-claude-cabinet 0.23.0 → 0.24.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/lib/cli.js CHANGED
@@ -348,7 +348,18 @@ const MODULES = {
348
348
  name: 'Session Loop (orient + debrief)',
349
349
  description: 'The briefing cycle. Claude starts each session informed, ends by preparing the next briefing.',
350
350
  mandatory: true,
351
- templates: ['skills/orient', 'skills/orient-quick', 'skills/debrief', 'skills/debrief-quick', 'skills/debrief/phases/upstream-feedback.md', 'skills/menu'],
351
+ templates: [
352
+ 'skills/orient',
353
+ 'skills/orient-quick',
354
+ 'skills/debrief',
355
+ 'skills/debrief-quick',
356
+ // Instruction phases — always ship, overriding the default skip-phases rule in copy.js
357
+ 'skills/debrief/phases/audit-pattern-capture.md',
358
+ 'skills/debrief/phases/methodology-capture.md',
359
+ 'skills/debrief/phases/record-lessons.md',
360
+ 'skills/debrief/phases/upstream-feedback.md',
361
+ 'skills/menu',
362
+ ],
352
363
  },
353
364
  'hooks': {
354
365
  name: 'Git Guardrails + Telemetry',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-claude-cabinet",
3
- "version": "0.23.0",
3
+ "version": "0.24.0",
4
4
  "description": "Claude Cabinet — opinionated process scaffolding for Claude Code projects",
5
5
  "bin": {
6
6
  "create-claude-cabinet": "bin/create-claude-cabinet.js"
@@ -306,27 +306,24 @@ Don't silently bundle unrelated changes.
306
306
 
307
307
  ### 9. Record Lessons (core)
308
308
 
309
- Read `phases/record-lessons.md` for how to capture what was learned.
310
- This is the second irreducible purpose of debrief — the first is
311
- closing work, this is ensuring the next session is smarter than this
312
- one.
313
-
314
- **Default (absent/empty):** At minimum ask: did this session reveal
315
- anything that future sessions need to know? A new pattern, a gotcha,
316
- a process gap, a user preference? Lessons are perishable — capture
317
- them now while context is fresh.
318
-
319
- **Omega-only:** If `~/.claude-cabinet/omega-venv/bin/python3` and
320
- `scripts/cabinet-memory-adapter.py` both exist, write lessons to omega
321
- never to flat markdown. A guard hook enforces this. Use the adapter:
322
-
323
- ```bash
324
- echo '{"text": "the lesson", "type": "lesson"}' | \
325
- ~/.claude-cabinet/omega-venv/bin/python3 scripts/cabinet-memory-adapter.py store
326
- ```
327
-
328
- Types: `decision`, `lesson`, `preference`, `constraint`, `pattern`.
329
- Flat markdown memory is the fallback only when omega is unavailable.
309
+ Read `phases/record-lessons.md` for how to route session outputs to
310
+ their real homes. This is the second irreducible purpose of debrief —
311
+ the first is closing work, this is ensuring the next session is smarter
312
+ than this one.
313
+
314
+ **The phase file teaches a routing discipline:** every output has
315
+ exactly one home with a forcing function omega `decision`/`lesson`/
316
+ `constraint`/`preference` memory, inline in CLAUDE.md or a briefing
317
+ (for load-bearing project facts), a pib-db deferred action (for
318
+ conditional revisits), or the upstream-feedback phase (for CC-applicable
319
+ friction). Loose `.md` files written next to the code they describe
320
+ are explicitly an **anti-pattern** they rot silently when the code
321
+ changes. Hybrid observations (part project, part CC) must be split.
322
+
323
+ **Default (absent/empty):** Follow the routing tree in the phase file.
324
+ Ask the user only when routing is genuinely ambiguous — not as a
325
+ catch-all "what did we learn?" prompt, which tends to produce vague
326
+ lessons that don't get recorded anywhere useful.
330
327
 
331
328
  **Omega broken:** If the memory module is installed (check `.ccrc.json`
332
329
  for `"memory": true`) but the venv or adapter is missing, surface this
@@ -485,7 +482,7 @@ Read `phases/report.md` for how to present the debrief summary.
485
482
  | `auto-maintenance.md` | Skip | Recurring session-end tasks |
486
483
  | `update-state.md` | Default: check system-status.md | What state files to update |
487
484
  | `health-checks.md` | Skip | Session-end health checks |
488
- | `record-lessons.md` | Default: ask what was learned | How to capture learnings |
485
+ | `record-lessons.md` | Default: route outputs per the decision tree | How to route session outputs to omega / CLAUDE.md / pib-db triggers / upstream |
489
486
  | `audit-pattern-capture.md` | **Instruction: always runs** | Detect recurring audit findings, write to patterns-project.md |
490
487
  | `methodology-capture.md` | **Instruction: always runs** | Detect methodology-level work; capture reasoning chain + narrative to `.claude/methodology/` |
491
488
  | `upstream-feedback.md` | **Instruction: always runs** | Surface CC friction to source repo |
@@ -1,94 +1,173 @@
1
- # Record Lessons — Capture What Was Learned
1
+ # Record Lessons — Route Session Outputs to Their Real Homes
2
2
 
3
- Define how to capture lessons from the session so future sessions are
4
- smarter. This is the second irreducible purpose of debrief without it,
5
- the system does work but doesn't learn from it.
3
+ This is debrief's second irreducible purpose: make sure the next session
4
+ is smarter than this one. Without it, the system does work but doesn't
5
+ learn from it.
6
6
 
7
- When this file is absent or empty, the default behavior is: ask whether
8
- the session revealed anything future sessions need to know. To explicitly
9
- skip lesson recording, write only `skip: true`.
7
+ Lessons are perishable. A lesson captured while context is fresh is
8
+ worth ten captured from memory next week.
10
9
 
11
- Lessons are perishable. A lesson captured while context is fresh is worth
12
- ten captured from memory next week. This is why recording happens during
13
- debrief, not "sometime later."
10
+ ## The Routing Principle
14
11
 
15
- ## Where to Record Omega Primary
12
+ Every session output has **exactly one primary home**. The home must
13
+ have a forcing function — something that keeps the content accurate
14
+ when the code it describes changes. Loose `.md` files next to code
15
+ are the wrong home: they rot silently because nothing invalidates
16
+ them when the system evolves.
16
17
 
17
- Check whether omega memory is available:
18
- - `~/.claude-cabinet/omega-venv/bin/python3` exists AND
19
- - `scripts/cabinet-memory-adapter.py` exists
18
+ **Each output has one home. Don't double-store.** A decision stored
19
+ in omega doesn't also need a `.md` file. A constraint documented in
20
+ CLAUDE.md doesn't also need an omega entry "for backup." Duplication
21
+ just creates two things to keep in sync.
20
22
 
21
- **When omega is available — use it. No exceptions.** Write lessons to
22
- omega via the adapter. Never write to flat markdown memory files when
23
- omega is available a guard hook will block the attempt.
23
+ ## Routing Decision Tree
24
+
25
+ For each thing you'd want future sessions to know, pick the single
26
+ best home:
27
+
28
+ ### Decisions — "we chose X over Y because Z"
29
+
30
+ Architectural choices, tradeoff resolutions, accepted gaps, rejected
31
+ alternatives.
32
+
33
+ **Primary home:** omega `decision` memory. Omega has contradiction
34
+ detection — when a later decision supersedes this one, the old entry
35
+ can be marked `status=superseded` instead of silently rotting.
24
36
 
25
37
  ```bash
26
- echo '{"text": "the lesson", "type": "lesson", "tags": ["tag1"]}' | \
38
+ echo '{"text": "the decision + why", "type": "decision"}' | \
27
39
  ~/.claude-cabinet/omega-venv/bin/python3 scripts/cabinet-memory-adapter.py store
28
40
  ```
29
41
 
30
- Memory types to use:
31
- - `decision` architectural choices, tradeoff resolutions
32
- - `lesson` gotchas, discoveries, things that surprised
33
- - `preference` user corrections, style choices, workflow preferences
34
- - `constraint`limitations discovered, prerequisites found
35
- - `pattern` — conventions established, recurring solutions
36
-
37
- **When omega is NOT available:** Only then use flat markdown memory
38
- (auto-memory in `~/.claude/projects/` memory directory). Check omega
39
- availability first — don't assume it's unavailable without checking.
40
-
41
- ## What to Look For
42
-
43
- Review the session and ask:
44
- - Did we learn something future sessions need to know?
45
- - A new pattern established
46
- - A gotcha discovered
47
- - A process gap identified
48
- - A user preference revealed
49
- - Is this the second or third time something came up? If the same kind
50
- of problem keeps recurring, the lesson is "create a prevention mechanism"
51
- not just "remember this."
52
- - Did the session's work contradict any existing recorded knowledge?
53
- If so, update or remove the stale record (in omega: use `query` to
54
- find it, then note the contradiction in the new memory).
55
-
56
- ## What NOT to Record
57
- - Code patterns derivable by reading current files
58
- - Git history (use git log)
59
- - Debugging solutions (the fix is in the code)
60
- - Anything already in CLAUDE.md files
61
- - Ephemeral task details only relevant to this session
42
+ **Also add to CLAUDE.md** only if the decision is load-bearing enough
43
+ that *every* session needs to know it at startup (not just sessions
44
+ that touch the relevant code). Examples: "auth is per-user via FastAPI
45
+ Users (no shared passwords)" is load-bearing. "We rejected a specific
46
+ library option after evaluation" is not omega is enough.
62
47
 
63
- ## After Storing Link and Check
48
+ ### Project constraints / conventions / gotchas
64
49
 
65
- After storing each memory, omega auto-relates it to similar existing
66
- memories. Surface this to the user:
50
+ Environmental quirks, dev-workflow requirements, "this project has a
51
+ weird setup" facts.
67
52
 
68
- ```bash
69
- ~/.claude-cabinet/omega-venv/bin/python3 -c "
70
- from omega import find_similar_memories
71
- result = find_similar_memories('THE_NEW_MEMORY_ID')
72
- print(result)
73
- "
53
+ **Primary home:** inline in `CLAUDE.md` or the project briefing. These
54
+ files get edited when the code changes — the forcing function is that
55
+ they're load-bearing for every session, so staleness surfaces fast.
56
+
57
+ Use omega `constraint` type only for cross-project patterns (e.g.,
58
+ "in any project with nested package.json..."). Project-specific
59
+ constraints belong inline.
60
+
61
+ ### Conditional revisits — "do X later when Y happens"
62
+
63
+ "If we ever get multiple concurrent users, add a token blocklist."
64
+ "When curl becomes annoying, build a /settings UI."
65
+
66
+ **Primary home:** pib-db deferred action with `trigger_condition`.
67
+
68
+ ```
69
+ pib_create_action text="..." status="deferred" trigger_condition="..."
74
70
  ```
75
71
 
76
- If the new memory is similar to existing ones, mention it:
77
- "This connects to your earlier memory about [topic]."
72
+ Orient's deferred-check phase re-evaluates these every session. If the
73
+ condition has fired, the user gets asked; if it's obsolete, it gets
74
+ marked so. No silent rot.
75
+
76
+ ### CC upstream friction embedded in a project observation
77
+
78
+ Sometimes a project-scoped observation contains a CC-applicable piece:
79
+ "in this project auth tests are hard, AND cabinet-qa should flag this
80
+ pattern in any auth work." That's two things, not one.
81
+
82
+ **Split it.** Route the project piece to its home (omega / CLAUDE.md /
83
+ trigger). Route the CC piece to the upstream-feedback phase (step 11)
84
+ where it will be drafted and delivered. Don't bury the upstream piece
85
+ inside a project decision doc — it will never find its way home.
86
+
87
+ ### Lessons, gotchas, discoveries (not decisions, not constraints)
88
+
89
+ "We learned that X behaves differently from docs." "This pattern
90
+ works." "The CI was green but prod failed because…"
91
+
92
+ **Primary home:** omega `lesson` memory. Same forcing function as
93
+ decisions — superseded lessons can be marked and surfaced.
94
+
95
+ ### User preferences
96
+
97
+ Style choices, workflow preferences, corrections the user made.
98
+
99
+ **Primary home:** omega `preference` memory.
78
100
 
79
- Also check for contradictions if the new memory conflicts with an
80
- existing one, ask the user which is correct:
101
+ ## The Anti-Pattern: Loose Project-Scoped .md Files
102
+
103
+ **Do not write `feedback-project-*.md`, `decision-*.md`, or similar
104
+ loose .md files as the primary record of a session output.** This
105
+ pattern has been observed to rot — in one audited case, 4 of 5 such
106
+ files went stale within 7 days because the underlying code changed
107
+ and the files had no forcing function to catch it.
108
+
109
+ If you are tempted to write a loose .md file:
110
+ - Is it a decision? → omega `decision`
111
+ - Is it a constraint everyone needs? → CLAUDE.md / briefing
112
+ - Is it a conditional revisit? → pib-db deferred trigger
113
+ - Is it CC upstream friction? → upstream-feedback phase
114
+ - None of the above? → it probably doesn't need recording at all
115
+
116
+ ## Before Writing — Contradiction Check
117
+
118
+ For each memory you're about to write, query omega for existing
119
+ entries on the same topic:
120
+
121
+ ```bash
122
+ ~/.claude-cabinet/omega-venv/bin/omega query "topic keywords" --limit 5
123
+ ```
124
+
125
+ If an existing entry contradicts or is superseded by the new one,
126
+ mark the old one:
81
127
 
82
128
  ```bash
83
- ~/.claude-cabinet/omega-venv/bin/python3 -c "
84
- from omega import SQLiteStore
85
- s = SQLiteStore()
86
- edges = s.get_edges_by_type('contradicts')
87
- for e in edges: print(f\"{e['source_id']} <-> {e['target_id']} ({e['weight']:.2f})\")
88
- "
129
+ ~/.claude-cabinet/omega-venv/bin/omega update <old-id> --status superseded
130
+ ```
131
+
132
+ This is the forcing function that turns omega into a living record
133
+ instead of another pile of rotting notes.
134
+
135
+ ## When Omega Is Not Available
136
+
137
+ If `~/.claude-cabinet/omega-venv/bin/python3` is missing AND the
138
+ memory module is not installed (check `.ccrc.json`), fall back to
139
+ flat markdown memory in `~/.claude/projects/...`. But recognize
140
+ this fallback has the same rot problem — prefer CLAUDE.md for
141
+ anything load-bearing and pib-db triggers for anything conditional.
142
+
143
+ If the memory module IS installed but omega is broken, surface this
144
+ in the debrief report:
145
+
146
+ > **⚠ Memory module is installed but omega is not working.**
147
+ > Decisions/lessons from this session were saved to flat markdown
148
+ > instead. Run `npx create-claude-cabinet` to rebuild the omega venv.
149
+
150
+ ## What NOT to Record — Anywhere
151
+
152
+ - Code patterns derivable by reading current files
153
+ - Git history (use `git log`)
154
+ - Debugging solutions (the fix is already in the code; the commit
155
+ message has the context)
156
+ - Anything already in CLAUDE.md files
157
+ - Ephemeral task details only relevant to this session
158
+ - "We made progress on X" session summaries — that's what git is for
159
+
160
+ ## Report What Was Routed
161
+
162
+ Tell the user what went where so they can audit the routing:
163
+
164
+ ```
165
+ Routed this session:
166
+ - 1 decision → omega mem-xxxxx (JWT revocation tradeoff)
167
+ - 1 constraint → article-rewriter/CLAUDE.md (tsc must run from frontend)
168
+ - 1 deferred trigger → pib-db act:xxxxxxxx (add blocklist if multi-user)
169
+ - 1 upstream piece → CC feedback outbox (cabinet-qa testability)
89
170
  ```
90
171
 
91
- ## Report What Was Recorded
92
- Tell the user what memories were created or updated so they know what
93
- the system will remember next time. Include the count, types, and any
94
- new connections discovered in the knowledge graph.
172
+ This is also how you catch routing errors: if everything ended up in
173
+ omega, the routing discipline didn't actually run.
@@ -163,29 +163,37 @@ anything else.
163
163
 
164
164
  ### Feedback pipeline check
165
165
 
166
- 1. **Flush outbox.** Read `~/.claude/cc-feedback-outbox.json`:
167
- ```bash
168
- cat ~/.claude/cc-feedback-outbox.json 2>/dev/null || echo '[]'
169
- ```
170
- If items exist with `"delivered": false`:
171
- - If this is the CC source repo (check `package.json` name is
172
- `create-claude-cabinet`): copy items to `feedback/` directory
173
- as individual .md files, mark as delivered in the outbox.
174
- - If this is a consuming project with `~/.claude/cc-registry.json`:
175
- read the CC source path from registry and copy items to that
176
- path's `feedback/` directory.
166
+ 1. **Flush outbox.** Read `~/.claude/cc-feedback-outbox.json`. Determine
167
+ destination: if this is the CC source repo (`package.json` name is
168
+ `create-claude-cabinet`), destination is `./feedback/`; otherwise
169
+ read CC source path from `~/.claude/cc-registry.json` and use its
170
+ `feedback/`. For each item with `"delivered": false`:
171
+
172
+ - **Compute destination filename** from `{date}-{slug(title)}-{seq}.md`.
173
+ - **Skip-if-exists check:** before writing, look for any file in the
174
+ destination `feedback/` OR `feedback/resolved/` whose name contains
175
+ the slugified title. If found, the item was already delivered (or
176
+ already resolved) by a prior session — do not rewrite. Mark the
177
+ item handled and move on.
178
+ - Otherwise write the item's `body` to the destination.
179
+ - After processing all items, atomically rewrite the outbox: write
180
+ `~/.claude/cc-feedback-outbox.json.tmp`, then rename. On a fully
181
+ successful pass, reset to `[]` — don't accumulate delivered
182
+ markers. If some items failed, keep only the failed ones.
177
183
  - Error handling: wrap JSON.parse in try/catch. If the outbox is
178
- malformed, log warning and reset to `[]`. Write atomically: write
179
- to `~/.claude/cc-feedback-outbox.json.tmp`, then rename over
180
- the original. On successful flush, reset to `[]` — don't
181
- accumulate delivered markers.
182
-
183
- 2. **Scan wrong-write locations.** Check these paths for CC-scoped
184
- feedback that got written to the wrong place:
185
- - `.claude/memory/feedback/*.md`
186
- - `.claude/feedback/*.md`
187
- If found: "Found N feedback files in [path] that may be CC
188
- upstream feedback written to the wrong location. Move to outbox?"
184
+ malformed, log warning and reset to `[]`.
185
+
186
+ 2. **Scan wrong-write locations.** Check `.claude/memory/feedback/*.md`
187
+ and `.claude/feedback/*.md` for files that may be CC upstream
188
+ feedback misfiled. **Exclude project-scoped files** — skip any file
189
+ whose name starts with `feedback-project-` or whose frontmatter
190
+ contains `scope: project-specific`. Those are intentionally
191
+ project-scoped decisions/constraints, not CC upstream feedback; they
192
+ belong in omega memory (decision/constraint types), CLAUDE.md, or a
193
+ pib-db deferred trigger not in the outbox.
194
+ If remaining candidates found: "Found N feedback files in [path]
195
+ that may be CC upstream feedback written to the wrong location.
196
+ Move to outbox?"
189
197
 
190
198
  ### 2. Sync Data (core)
191
199