chapterhouse 0.14.0 → 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.
@@ -55,8 +55,16 @@ export class MemoryManager {
55
55
  log.error("git not found on PATH — the memory system requires git; memory is disabled for this run");
56
56
  return;
57
57
  }
58
- await scaffold(this.paths);
59
- this.ready = true;
58
+ try {
59
+ await scaffold(this.paths);
60
+ this.ready = true;
61
+ }
62
+ catch (err) {
63
+ // A scaffold failure (missing bundled assets, filesystem error) must not
64
+ // crash the daemon — disable memory for this run and keep serving.
65
+ this.disabled = true;
66
+ log.error({ err }, "memory scaffold failed — memory is disabled for this run");
67
+ }
60
68
  }
61
69
  /** The always-loaded hot-tier block, or "" when memory is unavailable. */
62
70
  hotTier() {
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: {{ID}}
3
+ description: Use when the conversation involves {{LABEL}}. Triggers — {{TRIGGER_LINE}}. Do not use for topics belonging to other domains.
4
+ ---
5
+
6
+ # {{LABEL}}
7
+
8
+ Use this skill when the user discusses {{LABEL}} topics.
9
+
10
+ ## Memory Files
11
+
12
+ Always read on activation:
13
+ - `memory/{{PATH}}/hot-memory.md` (via `cog_read`)
14
+
15
+ Then load additional files per the memory retrieval protocol based on the query:
16
+ - Status/task query → `memory/{{PATH}}/action-items.md`
17
+ - Entity/people query → `memory/{{PATH}}/entities.md`
18
+ - Update/observation → the target file only
19
+ - Complex query → hot-memory first, then drill into referenced files
20
+
21
+ Available warm files: {{FILES}}
22
+
23
+ To find files without opening them, run `cog_l0_scan` scoped to `{{PATH}}`.
24
+ Historical data: `cog_read` on `memory/glacier/index.md`, filter by domain `{{ID}}`.
25
+
26
+ ## Routing
27
+
28
+ When the user shares information or asks to save something, write with the
29
+ `cog_*` tools:
30
+ - Task/todo → `memory/{{PATH}}/action-items.md`
31
+ - Person/entity → `memory/{{PATH}}/entities.md`
32
+ - Update/log → `memory/{{PATH}}/observations.md`
33
+ - Status/overview → `memory/{{PATH}}/hot-memory.md`
34
+
35
+ ## Activation
36
+
37
+ Read the hot-memory file, classify the query, load the minimum files needed,
38
+ and respond.
@@ -0,0 +1,8 @@
1
+ <!-- L0: Feature ideas, wishlists, and repair notes -->
2
+ # Improvements
3
+
4
+ <!-- Edit in place by section. -->
5
+
6
+ ## Ideas
7
+
8
+ ## Implemented
@@ -0,0 +1,5 @@
1
+ <!-- L0: Distilled interaction and workflow rules from experience -->
2
+ # Learned Patterns
3
+
4
+ <!-- Edit in place. Distill self-observations into actionable, timeless rules. -->
5
+ <!-- HARD LIMIT: 70 lines / 5.5KB. Domain-specific patterns go in satellite files. -->
@@ -0,0 +1,4 @@
1
+ <!-- L0: Ingestion cursor for the reflect skill over session history -->
2
+ # Reflect Cursor
3
+
4
+ last_processed: never
@@ -0,0 +1,14 @@
1
+ <!-- L0: Prediction accuracy tracker for decision scenarios -->
2
+ # Scenario Calibration
3
+
4
+ <!-- Updated by the reflect skill when scenarios resolve. -->
5
+
6
+ ## Resolved Scenarios
7
+
8
+ | Scenario | Created | Resolved | Predicted Branch | Actual Branch | Accuracy | Lesson |
9
+ |----------|---------|----------|-----------------|---------------|----------|--------|
10
+
11
+ ## Metrics
12
+
13
+ - Total resolved: 0
14
+ - Accuracy rate: —
@@ -0,0 +1,4 @@
1
+ <!-- L0: What worked and didn't in interactions — append-only -->
2
+ # Self-Observations
3
+
4
+ <!-- Append-only. Format: - YYYY-MM-DD [tag]: observation -->
@@ -0,0 +1,19 @@
1
+ # Chapterhouse Domain Manifest
2
+ # Single source of truth for all memory domains.
3
+ # Add domains with the setup skill, or edit this file directly — Chapterhouse
4
+ # reconciles directories and skill files from it on every startup.
5
+
6
+ domains:
7
+ - id: personal
8
+ path: personal
9
+ type: personal
10
+ label: "Family, health, calendar, day-to-day"
11
+ triggers: [family, health, kids, calendar, personal, home, car, finance]
12
+ files: [hot-memory, action-items, entities, observations, habits, health, calendar]
13
+
14
+ - id: cog-meta
15
+ path: cog-meta
16
+ type: system
17
+ label: "Memory self-knowledge, pipeline health, architecture"
18
+ triggers: [meta, evolve, pipeline, memory system, architecture]
19
+ files: [self-observations, patterns, improvements, scenario-calibration, reflect-cursor]
@@ -0,0 +1,6 @@
1
+ # Glacier Index
2
+ <!-- Auto-generated by the housekeeping skill. Do not edit. -->
3
+ <!-- Last updated: — -->
4
+
5
+ | File | Domain | Type | Tags | Date Range | Entries | Summary |
6
+ |------|--------|------|------|------------|---------|---------|
@@ -0,0 +1,5 @@
1
+ <!-- L0: Cross-domain strategic context — identity, active priorities -->
2
+ # Hot Memory
3
+
4
+ <!-- Rewrite freely. Keep under 50 lines. -->
5
+ <!-- Use the setup skill to populate this with your domains and priorities. -->
@@ -0,0 +1,6 @@
1
+ # Memory Link Index
2
+ <!-- Auto-generated by the housekeeping skill. Do not edit. -->
3
+ <!-- Last updated: — -->
4
+
5
+ | Target | Linked from |
6
+ |--------|-------------|
@@ -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.14.0",
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"