agent-working-memory 0.4.1 → 0.4.2

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/README.md CHANGED
@@ -1,177 +1,205 @@
1
1
  # AgentWorkingMemory (AWM)
2
2
 
3
- **Cognitive memory for AI agents — so they stop forgetting everything between conversations.**
3
+ **Persistent working memory for AI agents.**
4
4
 
5
- If you've used Claude, ChatGPT, or any AI coding assistant for more than a day, you've hit the wall: it forgets. Every new conversation starts from zero. You re-explain your project, your stack, your preferences, your decisions over and over. Long conversations go circular as the AI loses context from earlier in the same chat. It's like working with the smartest person in the world who gets amnesia at the end of every shift.
5
+ AWM helps agents retain important project knowledge across conversations and sessions. Instead of storing everything and retrieving by similarity alone, it filters for salience, builds associative links between related memories, and periodically consolidates useful knowledge while letting noise fade.
6
6
 
7
- AWM fixes that. It gives AI agents a persistent, self-organizing memory that works like a sharp senior developer's brain not a search engine. It decides what's worth remembering (77% of noise filtered at write time), connects related knowledge through associative links that strengthen with use, and periodically consolidates memories the way your brain does during sleep: reinforcing important patterns, building cross-topic shortcuts, and letting unused noise fade away. The result is an AI that remembers your architecture decisions from three weeks ago, surfaces relevant context without being asked, and doesn't waste your time re-learning things it already knew.
7
+ Use it through Claude Code via MCP or as a local HTTP service for custom agents. Everything runs locally: SQLite + ONNX models + Node.js. No cloud, no API keys.
8
8
 
9
- ## How It's Different
9
+ ### Without AWM
10
+ - Agent forgets earlier architecture decision
11
+ - Suggests Redux after project standardized on Zustand
12
+ - Repeats discussion already settled three days ago
13
+ - Every new conversation starts from scratch
10
14
 
11
- Most "memory for AI" projects are glorified vector databases — they embed everything, retrieve by cosine similarity, and dump results into the prompt. That's a search engine, not memory. AWM is fundamentally different:
15
+ ### With AWM
16
+ - Recalls prior state-management decision and rationale
17
+ - Surfaces related implementation patterns from past sessions
18
+ - Continues work without re-asking for context
19
+ - Gets more consistent the longer you use it
12
20
 
13
- | Feature | Typical RAG/Vector Store | AWM |
14
- |---------|------------------------|-----|
15
- | **What gets stored** | Everything | Only salient events (novelty + salience scoring filters 77% of noise at write time) |
16
- | **Retrieval** | Single-signal cosine similarity | 10-phase pipeline: BM25 + vectors + cross-encoder reranking + graph walk + temporal decay |
17
- | **Connections** | None | Hebbian associative edges that strengthen when memories are co-retrieved |
18
- | **Over time** | Grows forever, gets noisier | Sleep cycle consolidation: strengthens clusters, prunes noise, builds cross-topic bridges |
19
- | **Forgetting** | Manual cleanup or TTL | Cognitive forgetting: unretrieved memories fade, confirmed knowledge persists for months |
20
- | **Feedback** | None | Explicit useful/not-useful signals tune confidence, affecting retrieval rank and forgetting resistance |
21
- | **Self-correction** | Delete and re-insert | Retraction system: wrong memories get invalidated, corrections link back, confidence penalties propagate |
21
+ ---
22
22
 
23
- AWM is modeled on established cognitive science — ACT-R activation decay, Hebbian learning, complementary learning systems, and hippocampal memory staging. It's not a database with a prompt wrapper; it's a cognitive architecture that gets better the more you use it.
23
+ ## Quick Start
24
24
 
25
- ## Benchmarks
25
+ **Node.js 20+** required — check with `node --version`.
26
26
 
27
- | Eval | Score | What it tests |
28
- |------|-------|---------------|
29
- | Edge Cases | **100% (34/34)** | 9 failure modes: hub toxicity, flashbulb distortion, narcissistic interference, identity collision, contradiction preservation, bridge overshoot, noise forgetting benefit |
30
- | Stress Test | **92.3% (48/52)** | 500 memories, 100 sleep cycles, catastrophic forgetting, adversarial spam, recovery |
31
- | A/B Test | **AWM 100% vs Baseline 83%** | 100 project events, 24 recall questions |
32
- | Self-Test | **97.4% EXCELLENT** | 31 pipeline component checks |
33
- | Workday | **86.7% GOOD** | 43 memories across 4 simulated work sessions |
34
- | Real-World | **93.1% EXCELLENT** | 300 code chunks from a 71K-line production monorepo |
35
- | Token Savings | **64.5% savings** | Memory-guided context vs full conversation history |
27
+ ```bash
28
+ npm install -g agent-working-memory
29
+ awm setup --global
30
+ ```
36
31
 
37
- ## Quick StartClaude Code (Recommended)
32
+ Restart Claude Code. That's it 13 memory tools appear automatically.
38
33
 
39
- The fastest way to use AWM. Two commands, works in every project.
34
+ First conversation will be ~30 seconds slower while ML models download (~124MB, cached locally). After that, everything runs on your machine.
40
35
 
41
- ### Prerequisites
36
+ > For isolated memory per folder, see [Separate Memory Pools](#separate-memory-pools). For team onboarding, see [docs/quickstart.md](docs/quickstart.md).
42
37
 
43
- **Node.js 20+** — download from [nodejs.org](https://nodejs.org) if needed. Check with `node --version`.
38
+ ---
44
39
 
45
- ### Install
40
+ ## Who this is for
46
41
 
47
- ```bash
48
- npm install -g agent-working-memory
49
- ```
42
+ - **Long-running coding agents** that need cross-session project knowledge
43
+ - **Multi-agent workflows** where specialized agents share a common memory
44
+ - **Local-first setups** where cloud memory is not acceptable
45
+ - **Teams using Claude Code** who want persistent context without manual notes
50
46
 
51
- ### Setup (Global one brain for all projects)
47
+ ## What this is not
52
48
 
53
- ```bash
54
- awm setup --global
55
- ```
49
+ - Not a chatbot UI
50
+ - Not a hosted SaaS
51
+ - Not a generic vector database
52
+ - Not a replacement for your source of truth (code, docs, tickets)
53
+
54
+ ---
56
55
 
57
- This writes `~/.mcp.json` so Claude Code picks up AWM everywhere. One unified memory across all your work.
56
+ ## Why it's different
58
57
 
59
- **Restart Claude Code** to load the MCP server. The first conversation will download three small ML models (~124MB, cached locally). After that, everything runs on your machine — no API keys, no cloud calls.
58
+ Most "memory for AI" projects are vector databases with a retrieval wrapper. AWM goes further:
60
59
 
61
- ### Setup (Per-project)
60
+ | | Typical RAG / Vector Store | AWM |
61
+ |---|---|---|
62
+ | **Storage** | Everything | Only novel, salient events (77% filtered at write time) |
63
+ | **Retrieval** | Cosine similarity | 10-phase pipeline: BM25 + vectors + reranking + graph walk + decay |
64
+ | **Connections** | None | Hebbian edges that strengthen when memories co-activate |
65
+ | **Over time** | Grows forever, gets noisier | Consolidation: strengthens clusters, prunes noise, builds bridges |
66
+ | **Forgetting** | Manual cleanup | Cognitive forgetting: unused memories fade, confirmed knowledge persists |
67
+ | **Feedback** | None | Useful/not-useful signals tune confidence and retrieval rank |
68
+ | **Correction** | Delete and re-insert | Retraction: wrong memories invalidated, corrections linked, penalties propagate |
62
69
 
63
- If you prefer isolated memory per project instead:
70
+ The design is based on cognitive science — ACT-R activation decay, Hebbian learning, complementary learning systems, and synaptic homeostasis — rather than ad-hoc heuristics. See [How It Works](#how-it-works) for details.
64
71
 
65
- ```bash
66
- cd your-project
67
- awm setup
68
- ```
72
+ ---
73
+
74
+ ## Benchmarks
75
+
76
+ | Eval | Score | What it tests |
77
+ |------|-------|---------------|
78
+ | Edge Cases | **100% (34/34)** | 9 failure modes: hub toxicity, flashbulb distortion, narcissistic interference, identity collision, noise forgetting benefit |
79
+ | Stress Test | **92.3% (48/52)** | 500 memories, 100 sleep cycles, catastrophic forgetting, adversarial spam |
80
+ | A/B Test | **AWM 100% vs Baseline 83%** | 100 project events, 24 recall questions |
81
+ | Self-Test | **97.4%** | 31 pipeline component checks |
82
+ | Workday | **86.7%** | 43 memories across 4 simulated work sessions |
83
+ | Real-World | **93.1%** | 300 code chunks from a 71K-line production monorepo |
84
+ | Token Savings | **64.5% savings** | Memory-guided context vs full conversation history |
69
85
 
70
- This creates `.mcp.json` in the current directory and appends workflow instructions to `CLAUDE.md`. Use `--agent-id my-project` to customize the agent identifier.
86
+ All evals are reproducible: `npm run test:self`, `npm run test:edge`, `npm run test:stress`, etc. See [Testing & Evaluation](#testing--evaluation) for full details.
71
87
 
72
- ### What Claude gets
88
+ ---
73
89
 
74
- After restarting Claude Code, 13 memory tools appear automatically:
90
+ ## Features
75
91
 
76
- | Tool | What it does |
77
- |------|-------------|
78
- | `memory_write` | Store a memory with salience metadata |
92
+ ### Memory Tools (13)
93
+
94
+ | Tool | Purpose |
95
+ |------|---------|
96
+ | `memory_write` | Store a memory (salience filter decides disposition) |
79
97
  | `memory_recall` | Retrieve relevant memories by context |
80
- | `memory_feedback` | Tell AWM if a memory was useful or not |
81
- | `memory_retract` | Mark a wrong memory as invalid |
82
- | `memory_stats` | View memory health metrics |
98
+ | `memory_feedback` | Report whether a recalled memory was useful |
99
+ | `memory_retract` | Invalidate a wrong memory with optional correction |
100
+ | `memory_stats` | View memory health metrics and activity |
83
101
  | `memory_checkpoint` | Save execution state (survives context compaction) |
84
- | `memory_restore` | Recover state + relevant context at conversation start |
102
+ | `memory_restore` | Recover state + relevant context at session start |
85
103
  | `memory_task_add` | Create a prioritized task |
86
104
  | `memory_task_update` | Change task status/priority |
87
105
  | `memory_task_list` | List tasks by status |
88
106
  | `memory_task_next` | Get the highest-priority actionable task |
89
107
  | `memory_task_begin` | Start a task — auto-checkpoints and recalls context |
90
108
  | `memory_task_end` | End a task — writes summary and checkpoints |
91
- You don't need to tell Claude to "use memory." Once connected, Claude will automatically write important decisions, recall relevant context, and learn from feedback. Over time, it builds up knowledge that persists across every conversation.
92
109
 
93
110
  ### Separate Memory Pools
94
111
 
95
- By default, `awm setup --global` creates one shared memory pool. If you want isolated memory per folder (e.g., work vs personal projects), place a `.mcp.json` in each parent folder with a different `AWM_AGENT_ID`:
112
+ By default, all projects share one memory pool. For isolated pools per folder, place a `.mcp.json` in each parent folder with a different `AWM_AGENT_ID`:
96
113
 
97
114
  ```
98
115
  C:\Users\you\work\.mcp.json → AWM_AGENT_ID: "work"
99
116
  C:\Users\you\personal\.mcp.json → AWM_AGENT_ID: "personal"
100
117
  ```
101
118
 
102
- Claude Code uses the closest `.mcp.json` ancestor. Same database file — isolation is by agent ID. Use different `AWM_HOOK_PORT` values if running multiple sessions simultaneously.
119
+ Claude Code uses the closest `.mcp.json` ancestor. Same database, isolation by agent ID.
103
120
 
104
121
  ### Incognito Mode
105
122
 
106
- Run Claude Code without AWM recording anything:
107
-
108
123
  ```bash
109
124
  AWM_INCOGNITO=1 claude
110
125
  ```
111
126
 
112
- When `AWM_INCOGNITO=1` is set, AWM registers zero tools — Claude won't see any `memory_*` tools. All other tools, MCP servers, and skills work normally. No database is opened, nothing is recorded.
127
+ Registers zero tools — Claude doesn't see memory at all. All other tools and MCP servers work normally.
113
128
 
114
129
  ### Auto-Checkpoint Hooks
115
130
 
116
- AWM includes Claude Code hooks that auto-save your working state:
131
+ Installed by `awm setup --global`:
117
132
 
118
- - **Stop** — reminds Claude to save learnings after each response (async, no delay)
119
- - **PreCompact** — auto-checkpoints before context window compression
120
- - **SessionEnd** — auto-checkpoints and runs full consolidation on graceful exit
121
-
122
- These are installed automatically by `awm setup --global`. See [docs/team-setup-guide.md](docs/team-setup-guide.md) for manual hook configuration.
133
+ - **Stop** — reminds Claude to write/recall after each response
134
+ - **PreCompact** — auto-checkpoints before context compression
135
+ - **SessionEnd** — auto-checkpoints and consolidates on close
136
+ - **15-min timer** — silent auto-checkpoint while session is active
123
137
 
124
138
  ### Activity Log
125
139
 
126
- AWM writes a real-time activity log so you can see exactly what's happening:
127
-
128
140
  ```bash
129
141
  tail -f "$(npm root -g)/agent-working-memory/data/awm.log"
130
142
  ```
131
143
 
132
- Each event is one line: `timestamp | agentId | event | detail`. You'll see writes, recalls, checkpoints, consolidation cycles, and hook events.
144
+ Real-time: writes, recalls, checkpoints, consolidation, hook events.
133
145
 
134
- ### Optional: Add workflow instructions to CLAUDE.md
146
+ ### Activity Stats
135
147
 
136
- For per-project setups, `awm setup` does this automatically. For global setups, add this to any project's `CLAUDE.md` where you want explicit memory guidance:
137
-
138
- ```markdown
139
- ## Memory (AWM)
140
- You have persistent memory via the agent-working-memory MCP server.
141
- - At conversation start: call memory_restore to recover previous context
142
- - When you learn something important: call memory_write
143
- - When you need past context: call memory_recall
144
- - Before long operations: call memory_checkpoint to save your state
145
- - After using a recalled memory: call memory_feedback (useful/not-useful)
148
+ ```bash
149
+ curl http://127.0.0.1:8401/stats
146
150
  ```
147
151
 
152
+ Returns daily counts: `{"writes": 8, "recalls": 9, "hooks": 3, "total": 25}`
153
+
148
154
  ---
149
155
 
150
- ## HTTP API (Alternative)
156
+ ## Memory Invocation Strategy
151
157
 
152
- If you want to use AWM outside of Claude Code (custom agents, scripts, etc.), you can run the HTTP server directly.
158
+ AWM combines deterministic hooks for guaranteed memory operations at lifecycle transitions with agent-directed usage during active work.
153
159
 
154
- ### From npm
160
+ ### Deterministic triggers (always happen)
155
161
 
156
- ```bash
157
- npm install -g agent-working-memory
158
- awm serve
159
- ```
162
+ | Event | Action |
163
+ |-------|--------|
164
+ | Session start | `memory_restore` — recover state + recall context |
165
+ | Pre-compaction | Auto-checkpoint via hook sidecar |
166
+ | Session end | Auto-checkpoint + full consolidation |
167
+ | Every 15 min | Silent auto-checkpoint (if active) |
168
+ | Task start | `memory_task_begin` — checkpoint + recall |
169
+ | Task end | `memory_task_end` — summary + checkpoint |
160
170
 
161
- ### From source
171
+ ### Agent-directed triggers (when these situations occur)
162
172
 
163
- ```bash
164
- git clone https://github.com/CompleteIdeas/agent-working-memory.git
165
- cd agent-working-memory
166
- npm install
167
- npx tsx src/index.ts
168
- ```
173
+ **Write memory when:**
174
+ - A project decision is made or changed
175
+ - A root cause is discovered
176
+ - A reusable implementation pattern is established
177
+ - A preference, constraint, or requirement is clarified
178
+ - A prior assumption is found to be wrong
179
+
180
+ **Recall memory when:**
181
+ - Starting work on a new task or subsystem
182
+ - Re-entering code you haven't touched recently
183
+ - After context compaction
184
+ - After a failed attempt (check if there's prior knowledge)
185
+ - Before refactoring or making architectural changes
186
+
187
+ **Retract when:**
188
+ - A stored memory turns out to be wrong or outdated
189
+
190
+ **Feedback when:**
191
+ - A recalled memory was used (useful) or irrelevant (not useful)
169
192
 
170
- **The first time you run this, it downloads three small ML models (~124MB total).** These are cached locally in a `models/` folder. No API keys, no cloud calls. Everything runs on your machine.
193
+ ---
171
194
 
172
- Once you see `AWM server listening on port 8400`, the server is ready.
195
+ ## HTTP API
173
196
 
174
- ### Try it
197
+ For custom agents, scripts, or non-Claude-Code workflows:
198
+
199
+ ```bash
200
+ awm serve # From npm install
201
+ npx tsx src/index.ts # From source
202
+ ```
175
203
 
176
204
  Write a memory:
177
205
 
@@ -188,7 +216,7 @@ curl -X POST http://localhost:8400/memory/write \
188
216
  }'
189
217
  ```
190
218
 
191
- Recall it:
219
+ Recall:
192
220
 
193
221
  ```bash
194
222
  curl -X POST http://localhost:8400/memory/activate \
@@ -199,60 +227,31 @@ curl -X POST http://localhost:8400/memory/activate \
199
227
  }'
200
228
  ```
201
229
 
202
- ### Configuration
203
-
204
- - **Change the port:** `awm serve --port 3000` or `AWM_PORT=3000`
205
- - **Custom database:** `AWM_DB_PATH=/path/to/memory.db`
206
- - **API key auth:** Set `AWM_API_KEY=your-secret` in `.env` — requests need `Authorization: Bearer your-secret` or `x-api-key: your-secret`
207
- - **Run tests:** `npx vitest run` (68 tests)
208
- - **Run eval suite:** `npm run test:self`
209
- - **Data is a single file:** `data/memory.db` (SQLite). Back it up, move it, delete it to start fresh.
210
- - **Models cached locally:** First run downloads to `models/`. No network after that.
211
-
212
230
  ---
213
231
 
214
- ## Docker (Quick Alternative)
215
-
216
- If you'd rather not install Node.js locally:
217
-
218
- ```bash
219
- docker build -t awm .
220
- docker run -p 8400:8400 -v awm-data:/data -v awm-models:/models awm
221
- ```
222
-
223
- This gives you the HTTP server on port 8400. The `-v` flags persist your database and models across container restarts. For MCP integration with Docker, point your `.mcp.json` to the HTTP API instead of the MCP script.
224
-
225
232
  ## How It Works
226
233
 
227
234
  ### The Memory Lifecycle
228
235
 
229
- 1. **Write** — Agent sends an observation, decision, or event. Salience scoring evaluates surprise, causal depth, and resolution effort. High-salience memories go active immediately; borderline ones enter a staging buffer; noise is discarded.
236
+ 1. **Write** — Salience scoring evaluates novelty, surprise, causal depth, and effort. High-salience memories go active; borderline ones enter staging; noise is discarded.
230
237
 
231
- 2. **Connect** — Each memory gets a vector embedding (MiniLM-L6-v2, 384d). Temporal edges link it to recent memories in the same session. Hebbian edges form between memories that are retrieved together — the more often they co-activate, the stronger the link.
238
+ 2. **Connect** — Vector embedding (MiniLM-L6-v2, 384d). Temporal edges link to recent memories. Hebbian edges form between co-retrieved memories.
232
239
 
233
- 3. **Retrieve** — The 10-phase activation pipeline combines keyword search (BM25), semantic search (cosine similarity), cross-encoder reranking, temporal decay (ACT-R), associative graph walks, and confidence gating. It returns the most relevant memories with explanations of why each scored the way it did.
240
+ 3. **Retrieve** — 10-phase pipeline: BM25 + semantic search + cross-encoder reranking + temporal decay (ACT-R) + graph walks + confidence gating.
234
241
 
235
- 4. **Consolidate** — A periodic "sleep cycle" runs 7 phases modeled on how the brain processes memories during sleep:
236
- - **Replay** — Find clusters of semantically similar memories
237
- - **Strengthen** — Reinforce edges within clusters (access-weighted)
238
- - **Bridge** — Create cross-cluster shortcuts between related topics
239
- - **Decay** — Weaken unused edges (confidence-modulated half-life)
240
- - **Homeostasis** — Normalize outgoing edge weights to prevent hub explosion
241
- - **Forget** — Archive unretrieved, weakly-connected memories (age-gated, access-scaled)
242
- - **Prune redundancy** — Archive semantically duplicate low-quality memories
243
- - **Sweep staging** — Promote staging memories that resonate with active ones
242
+ 4. **Consolidate** — 7-phase sleep cycle: replay clusters, strengthen edges, bridge cross-topic, decay unused, normalize hubs, forget noise, sweep staging.
244
243
 
245
- 5. **Feedback** — Agents report whether recalled memories were useful. Positive feedback raises confidence (improving retrieval rank and forgetting resistance); negative feedback lowers it.
244
+ 5. **Feedback** — Useful/not-useful signals adjust confidence, affecting retrieval rank and forgetting resistance.
246
245
 
247
- ### Cognitive Model
246
+ ### Cognitive Foundations
248
247
 
249
- AWM is built on established cognitive science, not ad-hoc heuristics:
248
+ - **ACT-R activation decay** (Anderson 1993) — memories decay with time, strengthen with use
249
+ - **Hebbian learning** — co-retrieved memories form stronger associative edges
250
+ - **Complementary Learning Systems** — fast capture (salience + staging) + slow consolidation (sleep cycle)
251
+ - **Synaptic homeostasis** — edge weight normalization prevents hub domination
252
+ - **Forgetting as feature** — noise removal improves signal-to-noise for connected memories
250
253
 
251
- - **ACT-R base-level activation** (Anderson 1993) — memories decay with time but strengthen with use. Confidence modulates the decay exponent: confirmed knowledge decays slower.
252
- - **Hebbian learning** — "neurons that fire together wire together." Co-retrieved memories form stronger associative edges, enabling graph-based spreading activation.
253
- - **Complementary Learning Systems** — fast capture (salience filter + staging) combined with slow consolidation (sleep cycle). Mirrors hippocampal-neocortical memory transfer.
254
- - **Synaptic homeostasis** — total connection weight per memory is normalized to prevent any single "hub" from dominating retrieval. Similar to how the brain downscales synaptic strength during sleep.
255
- - **Forgetting as feature** — noise removal improves signal-to-noise ratio for connected memories. Unretrieved noise gets pruned; confirmed knowledge gets stronger. In benchmarks, aggressive forgetting improves quality recall from 3/5 to 5/5.
254
+ ---
256
255
 
257
256
  ## Architecture
258
257
 
@@ -274,70 +273,39 @@ src/
274
273
  retraction.ts - Negative memory / corrections
275
274
  eviction.ts - Capacity enforcement
276
275
  hooks/
277
- sidecar.ts - Hook HTTP server (auto-checkpoint from Claude Code hooks)
276
+ sidecar.ts - Hook HTTP server (auto-checkpoint, stats, timer)
278
277
  storage/
279
278
  sqlite.ts - SQLite + FTS5 persistence layer
280
279
  api/
281
280
  routes.ts - HTTP endpoints (memory + task + system)
282
- mcp.ts - MCP server (13 tools for Claude Code, incognito support)
281
+ mcp.ts - MCP server (13 tools, incognito support)
283
282
  cli.ts - CLI (setup, serve, hook config)
284
283
  index.ts - HTTP server entry point
285
284
  ```
286
285
 
287
- ## Task Management
288
-
289
- Tasks are first-class memory objects with status and priority tracking:
290
-
291
- ```bash
292
- # Create a task
293
- curl -X POST http://localhost:8400/task/create \
294
- -H "Content-Type: application/json" \
295
- -d '{
296
- "agentId": "my-agent",
297
- "concept": "Fix login redirect bug",
298
- "content": "Users get 404 after OAuth callback",
299
- "priority": "urgent"
300
- }'
301
-
302
- # Get next actionable task
303
- curl http://localhost:8400/task/next/my-agent
304
- ```
305
-
306
- Priority levels: `urgent` > `high` > `medium` > `low`. Tasks can be blocked by other tasks and automatically unblock when dependencies complete.
286
+ ---
307
287
 
308
288
  ## Testing & Evaluation
309
289
 
310
- AWM has been through extensive testing — unit tests, integration tests, and multiple evaluation suites that simulate realistic use. Every component of the cognitive pipeline has been validated both in isolation and under real-world-like conditions.
311
-
312
- ### Unit Tests (no server needed)
290
+ ### Unit Tests
313
291
 
314
292
  ```bash
315
- npx vitest run # 68 tests — salience scoring, decay curves, Hebbian learning, novelty filtering, etc.
293
+ npx vitest run # 68 tests
316
294
  ```
317
295
 
318
- ### Eval Suites (start the server first: `npx tsx src/index.ts`)
296
+ ### Eval Suites
319
297
 
320
298
  | Command | What it tests | Score |
321
299
  |---------|--------------|-------|
322
- | `npm run test:self` | 31 pipeline component checks — embedding quality, BM25 recall, reranker ordering, decay curves, confidence gating, Hebbian strengthening, graph walks, staging promotion | **97.4% EXCELLENT** |
323
- | `npm run test:edge` | 9 adversarial failure modes context collapse (100 routine vs 5 rare), mega-hub toxicity (50-link hub node), flashbulb distortion (high-emotion memory overwriting facts), narcissistic interference (30 self-referential claims vs 4 facts), identity collision (same name, different people), contradiction trapping, bridge overshoot, noise forgetting benefit | **100% (34/34)** |
324
- | `npm run test:stress` | 500 memories, 100 sleep cycles, catastrophic forgetting resistance, adversarial spam injection (200 noise memories), long-term knowledge recovery after 50 days of neglect | **92.3% (48/52)** |
325
- | `npm run test:workday` | Simulates a coding assistant's workday — 43 memories across 4 projects (Express, React, CI/CD, PostgreSQL), then 14 recall challenges testing knowledge transfer, context switching, cross-cutting queries, and noise rejection | **86.7% GOOD** |
326
- | `npm run test:ab` | Head-to-head comparison: AWM's full pipeline vs a keyword-only baseline, 100 project events, 24 recall questions | **AWM 100% vs Baseline 83%** |
327
- | `npm run test:tokens` | Measures token savings — how much prompt context AWM saves vs dumping full conversation history | **64.5% savings** |
328
- | `npm run test:realworld` | Ingests 300 code chunks from a 71K-line production monorepo (EquiHub/SportsManagement), tests domain knowledge recall, architecture questions, and noise rejection | **93.1% EXCELLENT** |
329
- | `npm run test:sleep` | Targeted sleep cycle consolidation test | — |
330
- | `npm run test:locomo` | Academic benchmark (LoCoMo dataset) — multi-hop conversational memory | — |
331
-
332
- ### What the Edge Cases Prove
333
-
334
- The edge case suite is particularly important because it tests the failure modes that kill other memory systems:
335
-
336
- - **Context Collapse** — Can AWM find 5 rare but important memories buried under 100 routine ones? (Yes — salience scoring and feedback bonuses keep confirmed knowledge afloat.)
337
- - **Mega-Hub Toxicity** — If one memory has 50 connections, does it hijack every query? (No — synaptic homeostasis normalizes edge weights.)
338
- - **Flashbulb Distortion** — Does a high-emotion memory overwrite the actual facts? (No — retraction system and confidence scoring keep specifics intact.)
339
- - **Narcissistic Interference** — Can 30 self-referential "I am amazing" claims drown out 4 real facts? (No — redundancy pruning archives the clones, feedback bonuses elevate confirmed knowledge.)
340
- - **Noise Forgetting Benefit** — Does forgetting 150 noise memories hurt the 5 quality ones? (Opposite — recall stays 5/5 because forgetting *improves* signal-to-noise ratio for connected memories.)
300
+ | `npm run test:self` | 31 pipeline checks: embeddings, BM25, reranker, decay, confidence, Hebbian, graph walks, staging | **97.4%** |
301
+ | `npm run test:edge` | 9 adversarial failure modes: context collapse, hub toxicity, flashbulb distortion, narcissistic interference, identity collision, contradiction, bridge overshoot, noise benefit | **100%** |
302
+ | `npm run test:stress` | 500 memories, 100 sleep cycles, catastrophic forgetting, adversarial spam, recovery | **92.3%** |
303
+ | `npm run test:workday` | 43 memories across 4 projects, 14 recall challenges | **86.7%** |
304
+ | `npm run test:ab` | AWM vs keyword baseline, 100 events, 24 questions | **AWM 100% vs 83%** |
305
+ | `npm run test:tokens` | Token savings vs full conversation history | **64.5%** |
306
+ | `npm run test:realworld` | 300 chunks from 71K-line monorepo, 16 challenges | **93.1%** |
307
+
308
+ ---
341
309
 
342
310
  ## Environment Variables
343
311
 
@@ -345,13 +313,13 @@ The edge case suite is particularly important because it tests the failure modes
345
313
  |----------|---------|---------|
346
314
  | `AWM_PORT` | `8400` | HTTP server port |
347
315
  | `AWM_DB_PATH` | `memory.db` | SQLite database path |
348
- | `AWM_AGENT_ID` | `claude-code` | Default agent ID (MCP) |
316
+ | `AWM_AGENT_ID` | `claude-code` | Agent ID (memory namespace) |
349
317
  | `AWM_EMBED_MODEL` | `Xenova/all-MiniLM-L6-v2` | Embedding model |
350
318
  | `AWM_EMBED_DIMS` | `384` | Embedding dimensions |
351
319
  | `AWM_RERANKER_MODEL` | `Xenova/ms-marco-MiniLM-L-6-v2` | Reranker model |
352
- | `AWM_HOOK_PORT` | `8401` | Hook sidecar HTTP port |
353
- | `AWM_HOOK_SECRET` | *(none)* | Bearer token for hook sidecar auth |
354
- | `AWM_INCOGNITO` | *(unset)* | Set to `1` to disable all memory tools |
320
+ | `AWM_HOOK_PORT` | `8401` | Hook sidecar port |
321
+ | `AWM_HOOK_SECRET` | *(none)* | Bearer token for hook auth |
322
+ | `AWM_INCOGNITO` | *(unset)* | Set to `1` to disable all tools |
355
323
 
356
324
  ## Tech Stack
357
325
 
@@ -365,7 +333,7 @@ The edge case suite is particularly important because it tests the failure modes
365
333
  | Tests | Vitest 4 |
366
334
  | Validation | Zod 4 |
367
335
 
368
- All three ML models (embedding, reranker, query expander) run locally via ONNX no OpenAI, no Anthropic API, no external calls for retrieval. The entire system is a single SQLite file + a Node.js process.
336
+ All three ML models run locally via ONNX. No external API calls for retrieval. The entire system is a single SQLite file + a Node.js process.
369
337
 
370
338
  ## License
371
339
 
package/dist/cli.js CHANGED
@@ -170,15 +170,32 @@ function setup() {
170
170
 
171
171
  ## Memory (AWM)
172
172
  You have persistent memory via the agent-working-memory MCP server.
173
- - At conversation start: ALWAYS call memory_restore to recover previous context
174
- - When you learn something important: call memory_write PROACTIVELY — do not wait to be asked
175
- - When you need past context: call memory_recall (use the "query" parameter)
176
- - Before long operations: ALWAYS call memory_task_begin to checkpoint and recall context
177
- - When finishing a task: call memory_task_end with a summary of what was accomplished
173
+
174
+ ### Lifecycle (always do these)
175
+ - Session start: call memory_restore to recover previous context
176
+ - Starting a task: call memory_task_begin (checkpoints + recalls relevant memories)
177
+ - Finishing a task: call memory_task_end with a summary
178
+ - Auto-checkpoint: hooks handle compaction, session end, and 15-min timer (no action needed)
179
+
180
+ ### Write memory when:
181
+ - A project decision is made or changed
182
+ - A root cause is discovered after debugging
183
+ - A reusable implementation pattern is established
184
+ - A user preference, constraint, or requirement is clarified
185
+ - A prior assumption is found to be wrong
186
+ - A significant piece of work is completed
187
+
188
+ ### Recall memory when:
189
+ - Starting work on a new task or subsystem
190
+ - Re-entering code you haven't touched recently
191
+ - After a failed attempt — check if there's prior knowledge
192
+ - Before refactoring or making architectural changes
193
+ - When a topic comes up that you might have prior context on
194
+
195
+ ### Also:
178
196
  - After using a recalled memory: call memory_feedback (useful/not-useful)
179
- - To retract incorrect info: call memory_retract
180
- - To manage tasks: call memory_task_add, memory_task_update, memory_task_list, memory_task_next
181
- - Auto-checkpoint: hooks auto-save on context compaction and session end (no action needed)
197
+ - To correct wrong info: call memory_retract
198
+ - To track work items: memory_task_add, memory_task_update, memory_task_list, memory_task_next
182
199
  `;
183
200
  // For global: write to ~/.claude/CLAUDE.md (loaded by Claude Code in every session)
184
201
  // For project: write to ./CLAUDE.md in the current directory
@@ -228,22 +245,32 @@ You have persistent memory via the agent-working-memory MCP server.
228
245
  if (!settings.hooks)
229
246
  settings.hooks = {};
230
247
  const hookUrl = `http://127.0.0.1:${hookPort}/hooks/checkpoint`;
248
+ // Stop — remind Claude to write/recall/switch tasks after each response
249
+ settings.hooks.Stop = [{
250
+ matcher: '',
251
+ hooks: [{
252
+ type: 'command',
253
+ command: 'echo "MEMORY: (1) Did you learn anything new? Call memory_write. (2) Are you about to work on a topic you might have prior knowledge about? Call memory_recall. (3) Switching tasks? Call memory_task_begin."',
254
+ timeout: 5,
255
+ async: true,
256
+ }],
257
+ }];
231
258
  // PreCompact — auto-checkpoint before context compaction
232
259
  settings.hooks.PreCompact = [{
233
260
  matcher: '',
234
261
  hooks: [{
235
262
  type: 'command',
236
- command: `curl -sf -X POST ${hookUrl} -H "Content-Type: application/json" -H "Authorization: Bearer ${hookSecret}" -d "{\\"hook_event_name\\":\\"PreCompact\\"}" --max-time 5`,
237
- timeout: 10,
263
+ command: `curl -sf -X POST ${hookUrl} -H "Content-Type: application/json" -H "Authorization: Bearer ${hookSecret}" -d "{\\"hook_event_name\\":\\"PreCompact\\"}" --max-time 2`,
264
+ timeout: 3,
238
265
  }],
239
266
  }];
240
- // SessionEnd — auto-checkpoint on session close
267
+ // SessionEnd — auto-checkpoint on session close (fast timeout to avoid cancellation)
241
268
  settings.hooks.SessionEnd = [{
242
269
  matcher: '',
243
270
  hooks: [{
244
271
  type: 'command',
245
- command: `curl -sf -X POST ${hookUrl} -H "Content-Type: application/json" -H "Authorization: Bearer ${hookSecret}" -d "{\\"hook_event_name\\":\\"SessionEnd\\"}" --max-time 5`,
246
- timeout: 10,
272
+ command: `curl -sf -X POST ${hookUrl} -H "Content-Type: application/json" -H "Authorization: Bearer ${hookSecret}" -d "{\\"hook_event_name\\":\\"SessionEnd\\"}" --max-time 2`,
273
+ timeout: 3,
247
274
  }],
248
275
  }];
249
276
  // Ensure settings directory exists
@@ -252,7 +279,7 @@ You have persistent memory via the agent-working-memory MCP server.
252
279
  mkdirSync(settingsDir, { recursive: true });
253
280
  }
254
281
  writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n');
255
- hookAction = ` Hooks: PreCompact + SessionEnd → auto-checkpoint (port ${hookPort})`;
282
+ hookAction = ` Hooks: Stop (memory reminder) + PreCompact + SessionEnd → auto-checkpoint (port ${hookPort})`;
256
283
  }
257
284
  const scope = isGlobal ? 'globally (all projects)' : cwd;
258
285
  console.log(`
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAA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,UAAU,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"sidecar.d.ts","sourceRoot":"","sources":["../../src/hooks/sidecar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIxD,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,WAAW,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3D;AAwGD,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG;IAAE,KAAK,EAAE,MAAM,IAAI,CAAA;CAAE,CA6HrE"}
1
+ {"version":3,"file":"sidecar.d.ts","sourceRoot":"","sources":["../../src/hooks/sidecar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIxD,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,WAAW,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3D;AA0GD,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG;IAAE,KAAK,EAAE,MAAM,IAAI,CAAA;CAAE,CAwJrE"}
@@ -96,6 +96,7 @@ function json(res, status, body) {
96
96
  res.writeHead(status, { 'Content-Type': 'application/json' });
97
97
  res.end(JSON.stringify(body));
98
98
  }
99
+ const AUTO_CHECKPOINT_INTERVAL_MS = 15 * 60_000; // 15 minutes
99
100
  export function startSidecar(deps) {
100
101
  const { store, agentId, secret, port, onConsolidate } = deps;
101
102
  const server = createServer(async (req, res) => {
@@ -211,8 +212,34 @@ export function startSidecar(deps) {
211
212
  console.error('AWM hook sidecar error:', err.message);
212
213
  }
213
214
  });
215
+ // --- Silent auto-checkpoint every 15 minutes ---
216
+ const autoCheckpointTimer = setInterval(() => {
217
+ try {
218
+ const checkpoint = store.getCheckpoint(agentId);
219
+ if (!checkpoint)
220
+ return; // No state to save yet
221
+ // Only checkpoint if there's been activity since last auto-checkpoint
222
+ const lastActivity = checkpoint.auto.lastActivityAt?.getTime() ?? 0;
223
+ const sinceActivity = Date.now() - lastActivity;
224
+ if (sinceActivity > AUTO_CHECKPOINT_INTERVAL_MS)
225
+ return; // Idle — skip
226
+ const state = {
227
+ currentTask: checkpoint.executionState?.currentTask ?? 'Active session (auto-checkpoint)',
228
+ decisions: checkpoint.executionState?.decisions ?? [],
229
+ activeFiles: checkpoint.executionState?.activeFiles ?? [],
230
+ nextSteps: checkpoint.executionState?.nextSteps ?? [],
231
+ relatedMemoryIds: checkpoint.executionState?.relatedMemoryIds ?? [],
232
+ notes: `Auto-checkpoint (15min timer). Last activity: ${Math.round(sinceActivity / 60_000)}min ago.`,
233
+ episodeId: checkpoint.executionState?.episodeId ?? null,
234
+ };
235
+ store.saveCheckpoint(agentId, state);
236
+ log(agentId, 'hook:timer', `auto-checkpoint (${Math.round(sinceActivity / 60_000)}min since activity)`);
237
+ }
238
+ catch { /* timer failure is non-fatal */ }
239
+ }, AUTO_CHECKPOINT_INTERVAL_MS);
214
240
  return {
215
241
  close: () => {
242
+ clearInterval(autoCheckpointTimer);
216
243
  server.close();
217
244
  },
218
245
  };
@@ -1 +1 @@
1
- {"version":3,"file":"sidecar.js","sourceRoot":"","sources":["../../src/hooks/sidecar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG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F,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-working-memory",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Cognitive memory layer for AI agents — activation-based retrieval, salience filtering, associative connections",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/cli.ts CHANGED
@@ -178,15 +178,32 @@ function setup() {
178
178
 
179
179
  ## Memory (AWM)
180
180
  You have persistent memory via the agent-working-memory MCP server.
181
- - At conversation start: ALWAYS call memory_restore to recover previous context
182
- - When you learn something important: call memory_write PROACTIVELY — do not wait to be asked
183
- - When you need past context: call memory_recall (use the "query" parameter)
184
- - Before long operations: ALWAYS call memory_task_begin to checkpoint and recall context
185
- - When finishing a task: call memory_task_end with a summary of what was accomplished
181
+
182
+ ### Lifecycle (always do these)
183
+ - Session start: call memory_restore to recover previous context
184
+ - Starting a task: call memory_task_begin (checkpoints + recalls relevant memories)
185
+ - Finishing a task: call memory_task_end with a summary
186
+ - Auto-checkpoint: hooks handle compaction, session end, and 15-min timer (no action needed)
187
+
188
+ ### Write memory when:
189
+ - A project decision is made or changed
190
+ - A root cause is discovered after debugging
191
+ - A reusable implementation pattern is established
192
+ - A user preference, constraint, or requirement is clarified
193
+ - A prior assumption is found to be wrong
194
+ - A significant piece of work is completed
195
+
196
+ ### Recall memory when:
197
+ - Starting work on a new task or subsystem
198
+ - Re-entering code you haven't touched recently
199
+ - After a failed attempt — check if there's prior knowledge
200
+ - Before refactoring or making architectural changes
201
+ - When a topic comes up that you might have prior context on
202
+
203
+ ### Also:
186
204
  - After using a recalled memory: call memory_feedback (useful/not-useful)
187
- - To retract incorrect info: call memory_retract
188
- - To manage tasks: call memory_task_add, memory_task_update, memory_task_list, memory_task_next
189
- - Auto-checkpoint: hooks auto-save on context compaction and session end (no action needed)
205
+ - To correct wrong info: call memory_retract
206
+ - To track work items: memory_task_add, memory_task_update, memory_task_list, memory_task_next
190
207
  `;
191
208
 
192
209
  // For global: write to ~/.claude/CLAUDE.md (loaded by Claude Code in every session)
@@ -237,23 +254,34 @@ You have persistent memory via the agent-working-memory MCP server.
237
254
 
238
255
  const hookUrl = `http://127.0.0.1:${hookPort}/hooks/checkpoint`;
239
256
 
257
+ // Stop — remind Claude to write/recall/switch tasks after each response
258
+ settings.hooks.Stop = [{
259
+ matcher: '',
260
+ hooks: [{
261
+ type: 'command',
262
+ command: 'echo "MEMORY: (1) Did you learn anything new? Call memory_write. (2) Are you about to work on a topic you might have prior knowledge about? Call memory_recall. (3) Switching tasks? Call memory_task_begin."',
263
+ timeout: 5,
264
+ async: true,
265
+ }],
266
+ }];
267
+
240
268
  // PreCompact — auto-checkpoint before context compaction
241
269
  settings.hooks.PreCompact = [{
242
270
  matcher: '',
243
271
  hooks: [{
244
272
  type: 'command',
245
- command: `curl -sf -X POST ${hookUrl} -H "Content-Type: application/json" -H "Authorization: Bearer ${hookSecret}" -d "{\\"hook_event_name\\":\\"PreCompact\\"}" --max-time 5`,
246
- timeout: 10,
273
+ command: `curl -sf -X POST ${hookUrl} -H "Content-Type: application/json" -H "Authorization: Bearer ${hookSecret}" -d "{\\"hook_event_name\\":\\"PreCompact\\"}" --max-time 2`,
274
+ timeout: 3,
247
275
  }],
248
276
  }];
249
277
 
250
- // SessionEnd — auto-checkpoint on session close
278
+ // SessionEnd — auto-checkpoint on session close (fast timeout to avoid cancellation)
251
279
  settings.hooks.SessionEnd = [{
252
280
  matcher: '',
253
281
  hooks: [{
254
282
  type: 'command',
255
- command: `curl -sf -X POST ${hookUrl} -H "Content-Type: application/json" -H "Authorization: Bearer ${hookSecret}" -d "{\\"hook_event_name\\":\\"SessionEnd\\"}" --max-time 5`,
256
- timeout: 10,
283
+ command: `curl -sf -X POST ${hookUrl} -H "Content-Type: application/json" -H "Authorization: Bearer ${hookSecret}" -d "{\\"hook_event_name\\":\\"SessionEnd\\"}" --max-time 2`,
284
+ timeout: 3,
257
285
  }],
258
286
  }];
259
287
 
@@ -264,7 +292,7 @@ You have persistent memory via the agent-working-memory MCP server.
264
292
  }
265
293
 
266
294
  writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n');
267
- hookAction = ` Hooks: PreCompact + SessionEnd → auto-checkpoint (port ${hookPort})`;
295
+ hookAction = ` Hooks: Stop (memory reminder) + PreCompact + SessionEnd → auto-checkpoint (port ${hookPort})`;
268
296
  }
269
297
 
270
298
  const scope = isGlobal ? 'globally (all projects)' : cwd;
@@ -130,6 +130,8 @@ function json(res: ServerResponse, status: number, body: Record<string, unknown>
130
130
  res.end(JSON.stringify(body));
131
131
  }
132
132
 
133
+ const AUTO_CHECKPOINT_INTERVAL_MS = 15 * 60_000; // 15 minutes
134
+
133
135
  export function startSidecar(deps: SidecarDeps): { close: () => void } {
134
136
  const { store, agentId, secret, port, onConsolidate } = deps;
135
137
 
@@ -250,8 +252,35 @@ export function startSidecar(deps: SidecarDeps): { close: () => void } {
250
252
  }
251
253
  });
252
254
 
255
+ // --- Silent auto-checkpoint every 15 minutes ---
256
+ const autoCheckpointTimer = setInterval(() => {
257
+ try {
258
+ const checkpoint = store.getCheckpoint(agentId);
259
+ if (!checkpoint) return; // No state to save yet
260
+
261
+ // Only checkpoint if there's been activity since last auto-checkpoint
262
+ const lastActivity = checkpoint.auto.lastActivityAt?.getTime() ?? 0;
263
+ const sinceActivity = Date.now() - lastActivity;
264
+ if (sinceActivity > AUTO_CHECKPOINT_INTERVAL_MS) return; // Idle — skip
265
+
266
+ const state: ConsciousState = {
267
+ currentTask: checkpoint.executionState?.currentTask ?? 'Active session (auto-checkpoint)',
268
+ decisions: checkpoint.executionState?.decisions ?? [],
269
+ activeFiles: checkpoint.executionState?.activeFiles ?? [],
270
+ nextSteps: checkpoint.executionState?.nextSteps ?? [],
271
+ relatedMemoryIds: checkpoint.executionState?.relatedMemoryIds ?? [],
272
+ notes: `Auto-checkpoint (15min timer). Last activity: ${Math.round(sinceActivity / 60_000)}min ago.`,
273
+ episodeId: checkpoint.executionState?.episodeId ?? null,
274
+ };
275
+
276
+ store.saveCheckpoint(agentId, state);
277
+ log(agentId, 'hook:timer', `auto-checkpoint (${Math.round(sinceActivity / 60_000)}min since activity)`);
278
+ } catch { /* timer failure is non-fatal */ }
279
+ }, AUTO_CHECKPOINT_INTERVAL_MS);
280
+
253
281
  return {
254
282
  close: () => {
283
+ clearInterval(autoCheckpointTimer);
255
284
  server.close();
256
285
  },
257
286
  };