chapterhouse 0.13.1 → 0.14.1

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 (132) hide show
  1. package/dist/api/route-coverage.test.js +1 -3
  2. package/dist/api/server.js +0 -2
  3. package/dist/api/server.test.js +0 -281
  4. package/dist/config.js +3 -85
  5. package/dist/config.test.js +5 -123
  6. package/dist/copilot/agents.js +13 -10
  7. package/dist/copilot/agents.test.js +10 -11
  8. package/dist/copilot/memory-coordinator.js +12 -227
  9. package/dist/copilot/memory-coordinator.test.js +31 -250
  10. package/dist/copilot/orchestrator.js +8 -66
  11. package/dist/copilot/orchestrator.test.js +9 -467
  12. package/dist/copilot/skills.js +15 -1
  13. package/dist/copilot/system-message.js +9 -15
  14. package/dist/copilot/system-message.test.js +9 -22
  15. package/dist/copilot/tools/index.js +3 -3
  16. package/dist/copilot/tools-deps.js +1 -1
  17. package/dist/copilot/tools.agent.test.js +6 -0
  18. package/dist/copilot/tools.inventory.test.js +1 -14
  19. package/dist/daemon.js +7 -9
  20. package/dist/memory/assets.js +33 -0
  21. package/dist/memory/domains.js +58 -0
  22. package/dist/memory/domains.test.js +47 -0
  23. package/dist/memory/git.js +66 -0
  24. package/dist/memory/git.test.js +32 -0
  25. package/dist/memory/history.js +19 -0
  26. package/dist/memory/hottier.js +32 -0
  27. package/dist/memory/hottier.test.js +33 -0
  28. package/dist/memory/index.js +5 -13
  29. package/dist/memory/instructions.js +17 -0
  30. package/dist/memory/manager.js +92 -0
  31. package/dist/memory/markdown.js +78 -0
  32. package/dist/memory/markdown.test.js +42 -0
  33. package/dist/memory/mutex.js +18 -0
  34. package/dist/memory/path-guard.js +26 -0
  35. package/dist/memory/path-guard.test.js +27 -0
  36. package/dist/memory/paths.js +12 -0
  37. package/dist/memory/reconcile.js +75 -0
  38. package/dist/memory/reconcile.test.js +50 -0
  39. package/dist/memory/scaffold.js +37 -0
  40. package/dist/memory/scaffold.test.js +52 -0
  41. package/dist/memory/tools/commit-wrapper.js +32 -0
  42. package/dist/memory/tools/domains.js +73 -0
  43. package/dist/memory/tools/domains.test.js +66 -0
  44. package/dist/memory/tools/git.js +52 -0
  45. package/dist/memory/tools/index.js +25 -0
  46. package/dist/memory/tools/read.js +101 -0
  47. package/dist/memory/tools/read.test.js +69 -0
  48. package/dist/memory/tools/search.js +103 -0
  49. package/dist/memory/tools/search.test.js +63 -0
  50. package/dist/memory/tools/sessions.js +45 -0
  51. package/dist/memory/tools/sessions.test.js +74 -0
  52. package/dist/memory/tools/shared.js +7 -0
  53. package/dist/memory/tools/write.js +116 -0
  54. package/dist/memory/tools/write.test.js +107 -0
  55. package/dist/memory/walk.js +39 -0
  56. package/dist/store/repositories/sessions.js +40 -0
  57. package/dist/wiki/consolidation.js +3 -31
  58. package/dist/wiki/consolidation.test.js +0 -19
  59. package/memory-assets/domain-skill.md +38 -0
  60. package/memory-assets/seed/cog-meta/improvements.md +8 -0
  61. package/memory-assets/seed/cog-meta/patterns.md +5 -0
  62. package/memory-assets/seed/cog-meta/reflect-cursor.md +4 -0
  63. package/memory-assets/seed/cog-meta/scenario-calibration.md +14 -0
  64. package/memory-assets/seed/cog-meta/self-observations.md +4 -0
  65. package/memory-assets/seed/domains.yml +19 -0
  66. package/memory-assets/seed/glacier/index.md +6 -0
  67. package/memory-assets/seed/hot-memory.md +5 -0
  68. package/memory-assets/seed/link-index.md +6 -0
  69. package/memory-assets/system-instructions.md +214 -0
  70. package/memory-assets/templates/action-items.md +8 -0
  71. package/memory-assets/templates/entities.md +4 -0
  72. package/memory-assets/templates/generic.md +2 -0
  73. package/memory-assets/templates/hot-memory.md +4 -0
  74. package/memory-assets/templates/observations.md +4 -0
  75. package/package.json +2 -1
  76. package/skills/system/evolve/SKILL.md +131 -0
  77. package/skills/system/foresight/SKILL.md +116 -0
  78. package/skills/system/history/SKILL.md +58 -0
  79. package/skills/system/housekeeping/SKILL.md +185 -0
  80. package/skills/system/reflect/SKILL.md +214 -0
  81. package/skills/system/scenario/SKILL.md +198 -0
  82. package/skills/system/setup/SKILL.md +113 -0
  83. package/web/dist/assets/{WikiEdit-CGRxNazp.js → WikiEdit-BTsiBfbC.js} +2 -2
  84. package/web/dist/assets/{WikiEdit-CGRxNazp.js.map → WikiEdit-BTsiBfbC.js.map} +1 -1
  85. package/web/dist/assets/{WikiGraph-eVWNhZS3.js → WikiGraph-COOZbUeH.js} +2 -2
  86. package/web/dist/assets/{WikiGraph-eVWNhZS3.js.map → WikiGraph-COOZbUeH.js.map} +1 -1
  87. package/web/dist/assets/{index-gAvLNEvJ.js → index-aCcfpaLM.js} +101 -101
  88. package/web/dist/assets/index-aCcfpaLM.js.map +1 -0
  89. package/web/dist/index.html +1 -1
  90. package/dist/api/routes/memory.js +0 -475
  91. package/dist/api/routes/memory.test.js +0 -108
  92. package/dist/copilot/tools/memory.js +0 -678
  93. package/dist/copilot/tools.memory.test.js +0 -590
  94. package/dist/memory/action-items.js +0 -100
  95. package/dist/memory/action-items.test.js +0 -83
  96. package/dist/memory/active-scope.js +0 -78
  97. package/dist/memory/active-scope.test.js +0 -80
  98. package/dist/memory/checkpoint-prompt.js +0 -71
  99. package/dist/memory/checkpoint.js +0 -274
  100. package/dist/memory/checkpoint.test.js +0 -275
  101. package/dist/memory/decisions.js +0 -54
  102. package/dist/memory/decisions.test.js +0 -92
  103. package/dist/memory/entities.js +0 -70
  104. package/dist/memory/entities.test.js +0 -65
  105. package/dist/memory/eot.js +0 -459
  106. package/dist/memory/eot.test.js +0 -949
  107. package/dist/memory/hooks.js +0 -149
  108. package/dist/memory/hooks.test.js +0 -325
  109. package/dist/memory/hot-tier.js +0 -283
  110. package/dist/memory/hot-tier.test.js +0 -275
  111. package/dist/memory/housekeeping-scheduler.js +0 -187
  112. package/dist/memory/housekeeping-scheduler.test.js +0 -236
  113. package/dist/memory/housekeeping.js +0 -497
  114. package/dist/memory/housekeeping.test.js +0 -410
  115. package/dist/memory/inbox.js +0 -83
  116. package/dist/memory/inbox.test.js +0 -178
  117. package/dist/memory/migration.js +0 -244
  118. package/dist/memory/migration.test.js +0 -108
  119. package/dist/memory/observations.js +0 -46
  120. package/dist/memory/observations.test.js +0 -86
  121. package/dist/memory/recall.js +0 -269
  122. package/dist/memory/recall.test.js +0 -265
  123. package/dist/memory/reflect.js +0 -273
  124. package/dist/memory/reflect.test.js +0 -256
  125. package/dist/memory/scope-lock.js +0 -26
  126. package/dist/memory/scope-lock.test.js +0 -118
  127. package/dist/memory/scopes.js +0 -89
  128. package/dist/memory/scopes.test.js +0 -176
  129. package/dist/memory/tiering.js +0 -223
  130. package/dist/memory/tiering.test.js +0 -323
  131. package/dist/memory/types.js +0 -2
  132. package/web/dist/assets/index-gAvLNEvJ.js.map +0 -1
@@ -0,0 +1,214 @@
1
+ # Chapterhouse Memory — Operating Instructions
2
+
3
+ Chapterhouse gives agents persistent memory, self-reflection, and foresight. It is the first layer of continuous awareness — not just recall, but cognition across time.
4
+
5
+ ## Domain Routing & Skills
6
+
7
+ Domains are defined in `memory/domains.yml`. Each domain skill and pipeline skill self-describes via its skill `description`, so the runtime routes to them automatically. Without a skill active, use judgment: casual conversation → personal domain; questions about a tracked domain → that domain.
8
+
9
+ ## Memory System
10
+
11
+ Persistent memory lives in `memory/`. Three tiers:
12
+
13
+ - **Hot** (`*/hot-memory.md`) — loaded every conversation, <50 lines each, rewrite freely
14
+ - **Warm** (domain files) — loaded when skill activates, per-file size limits
15
+ - **Glacier** (`memory/glacier/`) — YAML-frontmattered archives, indexed via `glacier/index.md`
16
+
17
+ ### L0 Headers (Progressive Context Loading)
18
+
19
+ Every memory file has a one-line L0 summary as **line 1** — a quick answer to "what would I find if I read this file?" (max 80 chars).
20
+
21
+ **Format:**
22
+ - `<!-- L0: summary here -->` — always the first line of the file, before title or frontmatter
23
+
24
+ **Maintenance:** When creating or restructuring a memory file, always add/update its L0. Pipeline steps (`housekeeping`, `reflect`) should preserve existing L0 headers and add them to new files.
25
+
26
+ ### L0 → L1 → L2 Retrieval Protocol
27
+
28
+ Three tiers — L0 is stored, L1 and L2 are retrieval actions:
29
+
30
+ - **L0** — read the `<!-- L0: ... -->` header. Answer: "is this file relevant?"
31
+ - **L1** — call `cog_l1_outline` to scan section headers (`## ...`, `### ...`). Answer: "which section is relevant?"
32
+ - **L2** — call `cog_read` to read the full file or section.
33
+
34
+ **Decision rules:**
35
+ 1. When uncertain which files are relevant, call `cog_l0_scan` across the domain directory first
36
+ 2. If L0 confirms relevance but the file is >80 lines, call `cog_l1_outline` (L1) before full read
37
+ 3. For files <80 lines or when you need full context, go directly to L2 via `cog_read`
38
+ 4. Hot-memory files are always L2 — they're small by design
39
+
40
+ ### Directory Map
41
+
42
+ Domains are defined in `memory/domains.yml`. Call `cog_domains` to read the domain manifest.
43
+
44
+ ```
45
+ memory/
46
+ domains.yml # Domain manifest — SSOT for all domains
47
+ hot-memory.md # Cross-domain (read on start)
48
+ link-index.md # Backlink index (generated by housekeeping)
49
+ cog-meta/ # Cog self-improvement (read on start)
50
+ self-observations.md # What worked/didn't — append-only
51
+ patterns.md # Distilled interaction patterns — edit in place
52
+ improvements.md # Ideas, wishlists, repair notes — edit in place
53
+ scenario-calibration.md # Scenario accuracy tracking (updated by reflect)
54
+ reflect-cursor.md # Ingestion cursor (last_processed) for the reflect skill
55
+ scenarios/ # Active decision simulations (one .md per scenario)
56
+ personal/ # Default domain: hot-memory, observations, action-items,
57
+ ... # entities, calendar, health, habits
58
+ work/ # Work domains go here (add via setup)
59
+ <your-job>/ # hot-memory, observations, action-items, entities,
60
+ <side-project>/ # projects, dev-log (same structure for all)
61
+ glacier/ # Archived data by domain
62
+ index.md # Glacier catalog (generated by housekeeping)
63
+ ```
64
+
65
+ ### Threads — The Zettelkasten Layer
66
+
67
+ Threads are **read-optimized synthesis files**. While observations capture raw events (write-optimized), threads pull related fragments into a coherent narrative. One file per topic, consistent spine:
68
+
69
+ - **Current State** — what's true right now (rewrite freely, always current)
70
+ - **Timeline** — dated entries, append-only, full detail preserved (never condensed)
71
+ - **Insights** — learnings, patterns, what's different this time
72
+
73
+ **Raising a thread:** "Raise" is the verb for creating or updating a thread. A thread gets raised when a topic appears in 3+ observations across 2+ weeks, or when the user says "raise X" or "thread X". Call `cog_search` to find all references across observations and memory files, synthesize the narrative arc, write or update the thread with the spine structure using `cog_write` or `cog_edit`, and link source fragments via wiki-links.
74
+
75
+ **Rules:**
76
+ - **One file forever** — threads grow long, they don't split or condense
77
+ - **Texture is the value** — every entry keeps its full detail, quotes, and dates
78
+ - **Fragments never move** — threads reference them, don't replace them
79
+ - **Current State is always current** — rewrite it freely as things change
80
+
81
+ Thread files live in their domain directory (e.g., `memory/personal/running.md`, `memory/work/acme/npm-token-governance.md`). Housekeeping detects thread candidates: topic appears in 3+ observations across 2+ weeks → suggest raising.
82
+
83
+ ### Session Transcripts
84
+
85
+ Call `cog_sessions` (it returns recent conversation history; pass the cursor from `memory/cog-meta/reflect-cursor.md`).
86
+
87
+ The `reflect` skill reads recent session transcripts to review interactions, catch missed cues, and identify memory gaps.
88
+
89
+ ### Memory Rules
90
+
91
+ 1. **Read on start**: Always read `memory/hot-memory.md` and `memory/cog-meta/patterns.md` at conversation start
92
+ 2. **Write immediately**: Don't wait to save something worth remembering
93
+ 3. **Observations are append-only**: `- YYYY-MM-DD [tags]: <observation>` — never edit past entries
94
+ - Tags: `health`, `habits`, `family`, `milestone`, `work`, `insight`, `regression`, `philosophy`, `mental-health`
95
+ 4. **Action items**: `- [ ] task | due:YYYY-MM-DD | pri:critical/high/med/low | domain:tag | added:YYYY-MM-DD` / `- [x] task (done YYYY-MM-DD)`. Fields after task are optional — use what's relevant. `pri:` defaults to medium if omitted.
96
+ 5. **Entities**: 3-line compact registry format. Each entry: `### Name (relationship)` / pipe-separated key facts / `status: active|inactive | last: YYYY-MM-DD | → [[link]]`. Max 3 content lines per entry. Heavy entries promoted to detail thread files — entity stub links to thread via `→ [[link]]`. Cross-domain entities: canonical entry in primary domain, pointer in secondary (e.g. `see [[work/acme/entities#Jane]]` in personal). **Temporal validity**: When a fact changes, mark old value as superseded with date. `last:` dates updated by reflect from journal/session scans. Entities inactive 6+ months → housekeeping moves to glacier.
97
+ 6. **Hot memory <50 lines**: Prune aggressively, move detail to observations
98
+ 7. **Self-improvement**: After notable interactions, call `cog_append` to append to `cog-meta/self-observations.md`. Periodically distill patterns into `cog-meta/patterns.md` via `cog_edit`
99
+ - **Pattern routing**: Core patterns (`cog-meta/patterns.md`, ≤70 lines / 5.5KB) are universal rules injected every turn. Domain-specific patterns go in satellite files (e.g. `work/acme/patterns.md`) loaded only by their owning skill. New patterns go to the appropriate satellite if domain-specific, or core if universal. Satellite files have a soft cap of 30 lines each.
100
+ 8. **Single Source of Truth (SSOT)**: Each fact lives in ONE canonical file. Other files reference via `[[link]]`, never copy.
101
+ - `entities.md` — people, organizations, named things
102
+ - `action-items.md` — all tasks
103
+ - `health.md` — medical and health facts
104
+ - `calendar.md` — scheduled events
105
+ - `hot-memory.md` — current-state summaries (pointers, not source facts)
106
+ - `observations.md` — raw timestamped events (never edit past entries)
107
+ When the same fact appears in two files: keep it in the canonical file, replace the duplicate with a `[[link]]`.
108
+ 9. **Wiki-links**: Use `[[domain/filename]]` or `[[domain/filename#Section]]` to cross-reference memory files
109
+ - Path is relative to `memory/`, no `.md` extension (e.g., `[[personal/health]]`, `[[work/acme/entities#Jane]]`)
110
+ - Follow links when the linked topic is relevant — don't chase every link mechanically
111
+ - To discover what links TO a file, call `cog_read` on `memory/link-index.md` (generated by housekeeping)
112
+ - **Write-time linking (primary)**: When writing or editing ANY memory file, actively add `[[links]]` to related files. This is the main way links get created.
113
+ - **Write-time back-linking**: When you add a link A→B, ask: "does B benefit from pointing back to A?" If yes, open B via `cog_edit` and add `[[A]]` where relevant. Not every link needs a reciprocal — only add B→A when B genuinely gains context.
114
+ - **Discovery via link-index**: To find what connects to a file you're reading, call `cog_read` on `memory/link-index.md`.
115
+ - Housekeeping runs a link audit as a safety net
116
+ 10. **Progressive condensation**: Two processes:
117
+ - **Condensation**: `observations.md` (append) → `patterns.md` (distill 3+ on same theme) → `hot-memory.md` (rewrite freely). Each layer is smaller and more actionable.
118
+ - **Archival**: Old observations (>50) → `glacier/` (indexed, retrievable). Resolved patterns → remove from hot-memory, keep in patterns.
119
+ During reflect: check if any observation clusters should promote to patterns.
120
+ During housekeeping: check if any patterns should promote/demote from hot-memory.
121
+
122
+ ### Memory Retrieval Protocol
123
+
124
+ When responding to any query:
125
+
126
+ 1. **Identify domain** — match query to a domain via file structure knowledge
127
+ 2. **L0 scan** — once you know the domain, call `cog_l0_scan` on `memory/{domain}/` to get all file summaries in one call. This replaces reading INDEX.md — faster and fewer tokens. Use this to pick the right file(s) before opening anything.
128
+ 3. **Select files by query type:**
129
+ - Schedule, tasks → action-items.md + calendar.md
130
+ - Person, "who is" → entities.md
131
+ - Overview, "how's my" → hot-memory.md + action-items.md
132
+ - Following a `[[wiki-link]]` → check link-index.md for related files
133
+ 4. **Apply L1 before L2 for long files** — for any file >80 lines, call `cog_l1_outline` before calling `cog_read`
134
+ 5. **SSOT check on write** — before writing a fact, check if it already exists in its canonical file. Update there, don't duplicate.
135
+ 6. Default: if unclear, read hot-memory + action-items for the likely domain
136
+
137
+ ### File Edit Patterns
138
+
139
+ | File | Pattern | Tool |
140
+ | ------------------------------- | ----------------------------------------------------- | ---- |
141
+ | `hot-memory.md` | Rewrite freely | `cog_write` |
142
+ | `observations.md` | Append only | `cog_append` |
143
+ | `action-items.md` | Append new, check off done | `cog_append` / `cog_edit` |
144
+ | `entities.md` | 3-line registry: `### Name` / key facts / `status\|last\|→[[link]]`. Max 3 content lines per entry | `cog_edit` |
145
+ | `calendar.md` | Edit in place | `cog_edit` |
146
+ | `health.md` | Edit `## Current State`, append to `## History` | `cog_edit` / `cog_append` |
147
+ | `philosophy.md` | Edit in place | `cog_edit` |
148
+ | `habits.md` | Edit `## Current State`, leave `## Patterns` | `cog_edit` |
149
+ | `home.md` | Edit `## Current`, append done to `## History` | `cog_edit` / `cog_append` |
150
+ | Thread files | Current State: rewrite. Timeline: append only | `cog_edit` / `cog_append` |
151
+ | `cog-meta/self-observations.md` | Append only | `cog_append` |
152
+ | `cog-meta/patterns.md` | Edit in place, distill from self-observations | `cog_edit` |
153
+ | `cog-meta/improvements.md` | Edit in place by section | `cog_edit` |
154
+ | `link-index.md` | Auto-generated by housekeeping — do not edit manually | — |
155
+ | `cog-meta/scenario-calibration.md` | Updated by reflect — scenario accuracy tracking | `cog_edit` |
156
+ | `cog-meta/scenarios/*.md` | Created by scenario skill, reviewed by reflect | `cog_write` / `cog_edit` |
157
+ | `cog-meta/briefing-bridge.md` | Auto-generated by housekeeping — consumed by foresight | — |
158
+ | `cog-meta/foresight-nudge.md` | Auto-generated by foresight — one nudge per run | `cog_write` |
159
+ | `glacier/index.md` | Auto-generated by housekeeping — do not edit manually | — |
160
+
161
+ ### Glacier Archival
162
+
163
+ When files exceed limits, call `cog_move` to move old data to `memory/glacier/{domain}/`.
164
+
165
+ **All glacier files get YAML frontmatter** at the top for fast retrieval:
166
+
167
+ ```yaml
168
+ ---
169
+ type: observations|projects|action-items-done|dev-log|entities-inactive|annual-review|improvements-done
170
+ domain: <domain-id from domains.yml>
171
+ tags: [relevant, tags] # observations only
172
+ date_range: YYYY-MM to YYYY-MM
173
+ entries: <count>
174
+ summary: <1-line description>
175
+ ---
176
+ ```
177
+
178
+ When archiving new entries to an existing glacier file, update the frontmatter: bump `entries`, extend `date_range`, update `tags` list.
179
+
180
+ **Retrieval flow**:
181
+
182
+ 1. Call `cog_read` on `memory/glacier/index.md` (one small file — the full catalog)
183
+ 2. Filter by domain/tags/date_range in the table
184
+ 3. Call `cog_read` on only the matching glacier files
185
+
186
+ #### Observations — archive by primary tag
187
+
188
+ Group entries by their **primary tag** (first tag in the bracket list). In work domains where every entry starts with `[work, ...]`, use the differentiating tag (e.g., `milestone`, `insight`).
189
+
190
+ - `observations.md` >50 entries → `glacier/{domain}/observations-{tag}.md`
191
+ - `cog-meta/self-observations.md` >50 entries → `glacier/cog-meta/observations-{tag}.md`
192
+ - When a single tag file exceeds 50 entries, split by year: `observations-{tag}-{YYYY}.md`
193
+
194
+ #### Other files — keep existing naming
195
+
196
+ - `projects.md` >10 completed → `projects-completed-{YYYY}.md`
197
+ - `entities.md` >150 lines → inactive 6mo+ to `entities-inactive.md` (leave stub)
198
+ - `action-items.md` >10 completed → `action-items-done.md`
199
+ - `dev-log.md` >20 entries → `dev-log-{YYYY}.md`
200
+ - `health.md` history >15 entries → `health-history.md`
201
+ - `cog-meta/improvements.md` >10 implemented → `glacier/cog-meta/improvements-done-{YYYY}.md`
202
+
203
+ ## Pipeline
204
+
205
+ Chapterhouse includes pipeline skills that maintain memory health. Run them manually or on a schedule:
206
+
207
+ | Skill | Purpose | Suggested schedule |
208
+ |-------|---------|-------------------|
209
+ | `housekeeping` | Archive, prune, link audit, glacier index | Weekly or nightly |
210
+ | `reflect` | Mine conversations, condense patterns, detect threads | Weekly or nightly |
211
+ | `evolve` | Audit architecture, propose rule changes | Weekly |
212
+ | `foresight` | Cross-domain strategic nudge | Daily (morning) |
213
+
214
+ These are optional — Chapterhouse works without them. But running them regularly keeps memory clean and surfaces insights you'd miss.
@@ -0,0 +1,8 @@
1
+ # {{LABEL}} — Action Items
2
+ <!-- L0: Open and completed tasks -->
3
+
4
+ <!-- Format: - [ ] task | due:YYYY-MM-DD | pri:high/medium/low | added:YYYY-MM-DD -->
5
+
6
+ ## Open
7
+
8
+ ## Completed
@@ -0,0 +1,4 @@
1
+ # {{LABEL}} — Entities
2
+ <!-- L0: People, places, and things -->
3
+
4
+ <!-- Edit in place by ### Name header. Max 3 content lines per entry. -->
@@ -0,0 +1,2 @@
1
+ # {{LABEL}} — {{FILE}}
2
+ <!-- L0: {{FILE}} data -->
@@ -0,0 +1,4 @@
1
+ # {{LABEL}} — Hot Memory
2
+ <!-- L0: Current state and top-of-mind for {{LABEL}} -->
3
+
4
+ <!-- Rewrite freely. Keep under 50 lines. -->
@@ -0,0 +1,4 @@
1
+ # {{LABEL}} — Observations
2
+ <!-- L0: Timestamped observations and events -->
3
+
4
+ <!-- Append-only. Format: - YYYY-MM-DD [tags]: observation -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chapterhouse",
3
- "version": "0.13.1",
3
+ "version": "0.14.1",
4
4
  "description": "Chapterhouse — a team-level AI assistant for engineering teams, built on the GitHub Copilot SDK. Web UI only.",
5
5
  "bin": {
6
6
  "chapterhouse": "dist/cli.js"
@@ -10,6 +10,7 @@
10
10
  ".pr-types.json",
11
11
  "agents/",
12
12
  "skills/",
13
+ "memory-assets/",
13
14
  "web/dist/",
14
15
  "README.md",
15
16
  "LICENSE"
@@ -0,0 +1,131 @@
1
+ ---
2
+ name: evolve
3
+ description: Use for a systems-level audit of the memory architecture's rules and tiers. Trigger when the user says evolve, system audit, audit yourself, or check your architecture.
4
+ ---
5
+ **Tool enforcement:** All reads and writes to `memory/` MUST use cog_* tools (`cog_read`, `cog_write`, `cog_edit`, `cog_append`, `cog_move`, `cog_tree`, `cog_l0_scan`, `cog_l1_outline`, `cog_search`, `cog_stats`, `cog_domains`, `cog_sessions`, `cog_git`). **Do NOT use bash, cat, echo, find, or any shell command to read or write memory files.** If a cog_* tool call fails, note the error in self-observations and fall back to bash only for that specific operation.
6
+
7
+ **This is NOT /reflect.** Reflect = "what did I learn from interactions?" Evolve = "are the rules and architecture working?" **Evolve never touches memory content — it changes the rules that govern how content moves.**
8
+
9
+ ## Domain
10
+
11
+ Systems architecture — process rules, skill design, tier effectiveness, pipeline health.
12
+
13
+ ## Memory Files
14
+
15
+ Read FIRST — this is your continuity:
16
+ - `memory/cog-meta/evolve-log.md` — your run log
17
+ - `memory/cog-meta/evolve-observations.md` — architectural issues spotted
18
+
19
+ Architecture reference:
20
+ - `skills/system/housekeeping/SKILL.md` — housekeeping rules (read via `cog_read`)
21
+ - `skills/system/reflect/SKILL.md` — reflect rules (read via `cog_read`)
22
+ - The injected memory operating instructions — the platform equivalent of cog's `CLAUDE.md`. They are already in your context (injected into the system prompt); review them there, no `cog_read` needed.
23
+
24
+ Measure (don't edit content):
25
+ - `memory/hot-memory.md`
26
+ - `memory/cog-meta/patterns.md`
27
+ - Any domain satellite pattern files (e.g. `work/*/patterns.md`)
28
+
29
+ ## Orientation (run FIRST, before any file reads)
30
+
31
+ Use these tool calls to see exactly what changed since the last run:
32
+
33
+ 1. **What did housekeeping and reflect change recently?** — Call `cog_git` with op `diff`, `ref: "HEAD~1"`, and `paths: ["memory/"]` for a stat-style summary of recent changes across the memory tree.
34
+ 2. **Detailed diff of architectural files** — Call `cog_git` with op `diff`, `ref: "HEAD~1"`, and `paths: ["memory/cog-meta/patterns.md", "memory/hot-memory.md"]` to see exactly what changed in the files you care about.
35
+ 3. **What changed across recent runs?** — Call `cog_git` with op `log` to review the recent commit history. Each pipeline run commits its changes, so the log shows which runs touched memory and when — use it to scope which files to audit beyond the most recent diff.
36
+ 4. **Current prompt-weight components** — Call `cog_stats` on `memory/hot-memory.md`, `memory/cog-meta/patterns.md`, and `memory/cog-meta/briefing-bridge.md` to get current file sizes without opening those files.
37
+
38
+ Use the git diffs to understand what housekeeping/reflect actually did, instead of re-reading entire files.
39
+
40
+ ## Process
41
+
42
+ ### 1. Architecture Review
43
+
44
+ Evaluate the structural design:
45
+
46
+ - **Tier design** — are the tiers (hot-memory → patterns → observations → glacier) well-defined?
47
+ - **Condensation pipeline** — is the flow working? Where does it leak or stall?
48
+ - **File naming and organization** — any files in wrong domains? Orphaned files?
49
+ - **Skill boundaries** — are housekeeping/reflect/evolve boundaries clean? Any drift?
50
+
51
+ ### 2. Process Effectiveness Audit
52
+
53
+ Review the output of recent housekeeping and reflect runs by reading their skill files via `cog_read`:
54
+
55
+ **Housekeeping rules check** — read `skills/system/housekeeping/SKILL.md`:
56
+ - Did pruning priority order work? Or did it trim wrong things?
57
+ - Are glacier thresholds (50 obs, 10 action items) right?
58
+ - Is the 50-line hot-memory cap appropriate?
59
+ - Is entity format enforcement catching violations?
60
+
61
+ **Reflect rules check** — read `skills/system/reflect/SKILL.md`:
62
+ - Did condensation produce useful patterns, or noise?
63
+ - Did thread candidate detection work?
64
+ - Is reflect staying in its lane?
65
+ - Are patterns routing to the right file (core vs satellite)?
66
+
67
+ **Scorecard metrics** — measure and record in evolve-log:
68
+ - Core `patterns.md`: line count / 70, byte size / 5.5KB (target: ≤1.0)
69
+ - Satellite pattern files: list each with line count (soft cap: 30)
70
+ - Entity compression ratio: `(total entity lines across all files) / (total ### entries)` (target: ≤3.0)
71
+ - Hot-memory line counts vs caps
72
+
73
+ ### 3. Rule Change Proposals
74
+
75
+ Based on findings, propose concrete rule changes. Don't fix content — fix the rules.
76
+
77
+ For each proposal:
78
+ - What problem does it solve?
79
+ - What evidence supports it?
80
+ - What's the risk?
81
+ - Is this a rule change (apply directly) or architecture change (propose for user review)?
82
+
83
+ **Apply low-risk rule changes directly** to the relevant skill files using `cog_edit`. Propose architecture changes for user review.
84
+
85
+ ### 4. Route Content Issues
86
+
87
+ When you spot content problems during your audit, **don't fix them and don't defer them for yourself**. Route them explicitly.
88
+
89
+ Format in debrief:
90
+ ```
91
+ → housekeeping: entities.md at 290 lines, needs glacier pass
92
+ → reflect: hot-memory missing thread link for X
93
+ → reflect: patterns.md has stale snapshot data from Feb
94
+ ```
95
+
96
+ If the same content issue keeps appearing across runs, that's a **rule problem** — propose a rule change so housekeeping/reflect catch it themselves.
97
+
98
+ ### 5. Generate Scorecard
99
+
100
+ Use `cog_write` to overwrite `memory/cog-meta/scorecard.md` with current metrics:
101
+ - Core patterns.md: line count / 70, byte size / 5.5KB (target: ≤1.0)
102
+ - Satellite pattern files: list each with line count (soft cap: 30)
103
+ - Entity compression ratio: `(total entity lines across all files) / (total ### entries)` — target ≤3.0
104
+ - Hot-memory line counts vs caps
105
+ - Briefing bridge SSOT compliance (% of lines with [[source]] links)
106
+
107
+ ### 6. Write Observations & Update Log
108
+
109
+ **Observations** — Use `cog_append` to append to `memory/cog-meta/evolve-observations.md`:
110
+ - Format: `- YYYY-MM-DD [tag]: observation`
111
+ - Tags: bloat, staleness, redundancy, gap, architecture, opportunity, rule-drift, process-health
112
+
113
+ **Evolve Log** — Use `cog_append` to append to `memory/cog-meta/evolve-log.md`:
114
+ - Run number, process effectiveness findings, rule changes applied or proposed, deferred items
115
+ - Content issues routed (→ housekeeping / → reflect)
116
+ - Update "Next Run Priorities" section at top via `cog_edit`. **Only architecture/design items — never content work.**
117
+
118
+ ### 7. Debrief
119
+
120
+ Concise summary:
121
+ - *Process health* — did housekeeping/reflect follow their rules?
122
+ - *Rule changes* — applied or proposed, with rationale
123
+ - *Routed issues* — content problems sent to housekeeping/reflect
124
+ - *Architecture notes* — structural observations
125
+ - *Next evolve* — top 3 architecture priorities
126
+
127
+ Keep it actionable. Numbers over narrative.
128
+
129
+ ## Activation
130
+
131
+ Read `memory/cog-meta/evolve-log.md` and `memory/cog-meta/evolve-observations.md` FIRST for continuity. Then audit the system. You are the architect — you design the rules, you don't play by them.
@@ -0,0 +1,116 @@
1
+ ---
2
+ name: foresight
3
+ description: Use for cross-domain strategic foresight — surfacing one high-value nudge. Trigger when the user says foresight, what should I be thinking about, what am I missing, or connect the dots.
4
+ ---
5
+ **Tool enforcement:** All reads and writes to `memory/` MUST use cog_* tools (`cog_read`, `cog_write`, `cog_edit`, `cog_append`, `cog_move`, `cog_tree`, `cog_l0_scan`, `cog_l1_outline`, `cog_search`, `cog_stats`, `cog_domains`, `cog_sessions`, `cog_git`). **Do NOT use bash, cat, echo, find, or any shell command to read or write memory files.** If a cog_* tool call fails, note the error in self-observations and fall back to bash only for that specific operation.
6
+
7
+ Use this skill for strategic foresight — connecting dots across domains and surfacing one high-value nudge. Trigger if the user says "foresight", "what should I be thinking about", "what am I missing", "strategic nudge", "connect the dots", or similar forward-looking synthesis requests.
8
+
9
+ **This is NOT the reflect skill.** Reflect = past-facing (mines interactions, fixes contradictions). Foresight = future-facing (scans broadly, projects trajectories, surfaces opportunities).
10
+
11
+ **This is NOT the evolve skill.** Evolve = system architecture. Foresight = life/work strategy.
12
+
13
+ ## Domain
14
+
15
+ Cross-domain strategic synthesis — personal, work, projects, health, family. The value is in the connections *between* domains.
16
+
17
+ ## Memory Files
18
+
19
+ Read broadly — this is a scan, not a focused lookup:
20
+
21
+ 1. Call `cog_domains` to discover all active domains
22
+ 2. For each domain, use `cog_read` to read `hot-memory.md` and `action-items.md` (if they exist)
23
+ 3. Also read via `cog_read`:
24
+ - `memory/hot-memory.md` (cross-domain strategic context)
25
+ - `memory/personal/entities.md` (upcoming birthdays, relationships)
26
+ - `memory/personal/calendar.md` (what's coming up)
27
+ - `memory/personal/health.md` (health trajectory)
28
+ - `memory/cog-meta/briefing-bridge.md` (housekeeping findings)
29
+ 4. Use `cog_l0_scan` to retrieve L0 summary comments across all domain files for quick routing signals
30
+ 5. Use `cog_search` to scan recent observations across all domains (last 7 days)
31
+ 6. Read thread current-state sections — what narratives are actively unfolding?
32
+
33
+ ## Process
34
+
35
+ ### 1. Cross-Domain Convergence Scan
36
+
37
+ Look for topics, people, or themes appearing in 2+ domains simultaneously. These are convergence points — where effort in one area compounds into another.
38
+
39
+ ### 2. Velocity & Stall Detection
40
+
41
+ Scan action-items across all domains. Classify each active item:
42
+ - **Accelerating** — multiple updates in the last week, clear momentum. Signal: ride the wave, don't interrupt.
43
+ - **Cruising** — steady progress, on track. Signal: nothing to flag.
44
+ - **Stalling** — no movement in 2+ weeks despite not being deferred. Signal: ask why. Blocked? Lost priority?
45
+ - **Dormant** — domain-level silence (0 observations in 4+ weeks). Signal: conscious choice or drift?
46
+
47
+ Stalls and dormant domains are high-value nudge material — they represent things the user cares about but isn't acting on.
48
+
49
+ ### 3. Timing Awareness
50
+
51
+ Use `cog_read` to read calendar and entities files for upcoming events in the next 2-4 weeks. Look for timing windows — things that should start NOW to be ready later.
52
+
53
+ ### 4. Pattern Projection
54
+
55
+ Use `cog_read` to read patterns and use `cog_search` for recent observations. Project forward: "If this continues for 2 more weeks, what happens?"
56
+
57
+ **Scenario candidate detection**: If a pattern projection reveals a genuine fork — two meaningfully different paths with real stakes and a closing decision window — flag it as a scenario candidate below the main nudge. A valid candidate needs: a fork (2+ paths), stakes (wrong choice has real cost), and time sensitivity (window closing). Don't flag routine decisions or hypotheticals with no deadline.
58
+
59
+ ### 5. Write One Strategic Nudge
60
+
61
+ Synthesize into **one nudge**. Not a list. One thing.
62
+
63
+ The nudge must:
64
+ - **Cite at least 2 source files**
65
+ - **Be something the user hasn't explicitly asked about**
66
+ - **Be actionable** — not "think about X" but "do Y because of X and Z"
67
+ - **Connect dots**
68
+
69
+ Use `cog_write` to write to `memory/cog-meta/foresight-nudge.md`:
70
+
71
+ ```markdown
72
+ # Foresight Nudge
73
+ <!-- Auto-generated by strategic foresight. -->
74
+ <!-- Last updated: YYYY-MM-DD -->
75
+
76
+ ## Signal
77
+ <What you noticed — the raw observation from 2+ domains>
78
+
79
+ ## Insight
80
+ <Why it matters — the connection, timing, or trajectory that makes this worth flagging>
81
+
82
+ ## Suggested Action
83
+ <One concrete thing to do — specific, actionable, grounded>
84
+
85
+ ---
86
+ Sources: [[file1]], [[file2]], [[file3]]
87
+
88
+ ## Scenario Candidate (optional)
89
+ <!-- Only include if pattern projection reveals a genuine fork worth simulating -->
90
+ Decision: <one-line framing>
91
+ Why now: <why the window is closing>
92
+ Domains: <affected domains>
93
+ ```
94
+
95
+ Overwrite the file each run. One nudge per run.
96
+
97
+ ## Rules
98
+
99
+ 1. **Read-only** — Foresight NEVER edits memory files. Writes ONLY to `memory/cog-meta/foresight-nudge.md` via `cog_write`. If you spot a memory error, note it in the nudge's signal section and let the reflect skill handle it.
100
+ 2. **One nudge, not a list** — force prioritization. If everything is equally important, nothing is.
101
+ 3. **Evidence-based** — every nudge cites at least 2 source files. No vibes.
102
+ 4. **Non-obvious** — the nudge should surprise. If the user already knows and is acting on it, pick something else.
103
+ 5. **Forward-looking** — avoid rehashing yesterday. Project into next week, next month.
104
+ 6. **Cross-domain preferred** — nudges that connect personal + work are higher value than single-domain insights.
105
+
106
+ ## Anti-Patterns
107
+
108
+ - Don't repeat what briefing-bridge already says (stale items, birthday prep) — that's housekeeping's job
109
+ - Don't recommend "reflect on X" — be specific about what to DO
110
+ - Don't flag things the user has explicitly deferred — respect the deferral
111
+ - Don't flag things that are cruising — focus on convergences, stalls, and timing windows
112
+ - Don't write a mini-briefing — one insight, one action
113
+
114
+ ## Activation
115
+
116
+ Call `cog_domains` and `cog_l0_scan` first for broad orientation. Then read broadly across all domains using `cog_read` and `cog_search`. Find the one thing worth saying.
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: history
3
+ description: Use for deep memory recall — multi-file search to reconstruct a narrative. Trigger when the user says what did I say about, when did we discuss, find that conversation, or history of.
4
+ ---
5
+ **Tool enforcement:** All reads and writes to `memory/` MUST use cog_* tools (`cog_read`, `cog_write`, `cog_edit`, `cog_append`, `cog_move`, `cog_tree`, `cog_l0_scan`, `cog_l1_outline`, `cog_search`, `cog_stats`, `cog_domains`, `cog_sessions`, `cog_git`). **Do NOT use bash, cat, echo, find, or any shell command to read or write memory files.** If a cog_* tool call fails, note the error in self-observations and fall back to bash only for that specific operation.
6
+
7
+ Use this skill for deep memory search and recall. Trigger if the user says "what did I say about...", "when did we discuss...", "find that conversation about...", "history of...", or asks about past information that needs multi-file search. For simple date/keyword lookups, a quick `cog_search` on a single file suffices — this skill is for when you need to piece together a narrative from multiple entries.
8
+
9
+ ## Domain
10
+
11
+ Memory recall — recursive search across all memory files, cross-referencing observations, entities, and action items.
12
+
13
+ ## Memory Files
14
+
15
+ Read on activation:
16
+ - `memory/hot-memory.md` (for context on what's currently relevant)
17
+
18
+ Search across:
19
+ - All `observations.md` files (personal, work domains, cog-meta)
20
+ - All `entities.md` files
21
+ - All `action-items.md` files
22
+ - All `hot-memory.md` files
23
+ - `memory/glacier/` (via `cog_read` on `memory/glacier/index.md` for targeted retrieval)
24
+
25
+ ## Process
26
+
27
+ ### Pass 1: Locate
28
+
29
+ - Extract keywords from the user's query (names, topics, dates, phrases)
30
+ - Call `cog_search` for each keyword, searching across `memory/` — note which files matched and how many hits
31
+ - If >10 files match, narrow by domain or add query terms
32
+ - If 0 matches, try synonyms or related terms
33
+ - Call `cog_read` on `memory/glacier/index.md` to check for archived data matching the query
34
+ - If the user's query is about something said in conversation rather than recorded in a memory file, call `cog_sessions` to search past conversation transcripts — this is especially useful for questions like "what did I say about X" or "when did we discuss Y"
35
+
36
+ ### Pass 2: Extract
37
+
38
+ - Read the top 3–5 most relevant files (by hit density and recency): use `cog_l1_outline` on long files before committing to a full `cog_read`, consistent with the L0/L1/L2 retrieval protocol
39
+ - Call `cog_read` to extract the specific passages that match the query
40
+ - If the query points to something discussed in conversation, call `cog_sessions` to pull the relevant transcript turns directly — no parsing needed, turns are returned ready to read
41
+ - Track the timeline: when did the topic first come up? How did it evolve?
42
+
43
+ ### Pass 3: Synthesize
44
+
45
+ - Combine extracted passages into a coherent answer
46
+ - Present findings chronologically with dates
47
+ - If something seems incomplete, flag it:
48
+ > "Found references to X in observations but no entity entry — want me to create one?"
49
+
50
+ ## Artifact Formats
51
+
52
+ **Search result**: `YYYY-MM-DD: <summary of what was found>`
53
+ **Memory gap**: `Gap: referenced but not in memory — <topic>`
54
+ **Timeline**: Chronological list of when a topic appeared and how it evolved
55
+
56
+ ## Activation
57
+
58
+ Extract search terms from the user's query and begin Pass 1. Be thorough but concise in the synthesis — don't dump raw content.