humemory 0.2.12 → 0.2.14
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/AGENTS.md +43 -25
- package/CHANGELOG.md +12 -0
- package/README.md +31 -16
- package/docs/TESTING.md +22 -13
- package/docs/architecture/architecture.html +230 -0
- package/package.json +19 -19
- package/public/app/index-0fw784fa.js +12 -0
- package/public/app/index.html +1 -1
- package/public/app/index-n2qg9hyr.js +0 -12
package/AGENTS.md
CHANGED
|
@@ -12,9 +12,10 @@ For the project's identity and "why", read [README.md](./README.md) first.
|
|
|
12
12
|
humemory has two halves, both built as of Phase 8 (2026-08-08). The direction
|
|
13
13
|
was **Direction 1**, chosen 2026-06-17; everything below is the shipped result.
|
|
14
14
|
|
|
15
|
-
1. **Retrospective** ✅ —
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
1. **Retrospective** ✅ — a five-state model (detail → summary → essential →
|
|
16
|
+
keywords → lost/merged). Automatic aging currently stops at L3; explicit merge
|
|
17
|
+
sets L4. Original content stays in SQLite. Recall reinforces; inverse search
|
|
18
|
+
visits the degraded fields first, then ranks matches across fields.
|
|
18
19
|
2. **Prospective** ✅ — intentions that fire on a **cue** (time/event), **Zeigarnik**
|
|
19
20
|
open loops that stay salient until a `commit` closes them, and context-triggered
|
|
20
21
|
**scripts** that fade on disuse rather than time. A memory that resurfaces
|
|
@@ -35,7 +36,7 @@ prospective, scripts cognitifs, effet Zeigarnik).
|
|
|
35
36
|
|
|
36
37
|
```bash
|
|
37
38
|
pnpm install
|
|
38
|
-
pnpm build # tsc
|
|
39
|
+
pnpm build # backend tsc → dist/ + web typecheck + web bundle → public/app/
|
|
39
40
|
pnpm dev # watch src/cli/index.ts (bun)
|
|
40
41
|
pnpm start:api # HTTP API + dashboard on :3456
|
|
41
42
|
pnpm cli <cmd> # run CLI directly
|
|
@@ -62,12 +63,23 @@ src/
|
|
|
62
63
|
│ ├── types.ts # Memory, DecayLevel, SearchQuery, MemoryStore iface
|
|
63
64
|
│ ├── decay.ts # degradation curve + thresholds
|
|
64
65
|
│ ├── search.ts # inverse search (lexical, degraded-first)
|
|
65
|
-
│
|
|
66
|
+
│ ├── llm-generator.ts # deterministic L1/L2/L3; optional injected LLM
|
|
67
|
+
│ ├── clock.ts # Clock seam (systemClock / FakeClock)
|
|
68
|
+
│ ├── event-bus.ts # AppEvent + InMemoryEventBus
|
|
69
|
+
│ ├── cue-arg.ts # cue syntax shared by CLI and React form
|
|
70
|
+
│ ├── cues.ts # cue resolver, cron matcher, loop ids
|
|
71
|
+
│ ├── scripts.ts # script disuse calculation + archival sweep
|
|
72
|
+
│ ├── trust.ts / sanitize.ts # authority scoring + context hardening
|
|
73
|
+
│ ├── dreamer.ts # clusters, corroboration metadata, reviewed proposals
|
|
74
|
+
│ ├── embeddings.ts / hybrid.ts / vector-clusterer.ts # optional semantic lane
|
|
75
|
+
│ ├── paths.ts # data/db/queue/model-cache/install root resolver
|
|
76
|
+
│ └── doctor.ts # install diagnostic (no memory content read)
|
|
66
77
|
├── store/
|
|
67
78
|
│ └── sqlite.ts # bun:sqlite store (WAL), findSimilar/merge/setPhotographic
|
|
68
79
|
├── agent/
|
|
69
80
|
│ ├── session-parser.ts # parse Claude Code session transcripts
|
|
70
81
|
│ ├── source-registry.ts # discover local AI runtimes without reading sessions
|
|
82
|
+
│ ├── codex-rollout-parser.ts / codex-import.ts # Codex rollout → queue
|
|
71
83
|
│ ├── kimi-session-parser.ts / kimi-import.ts # Kimi wire → maintenance queue
|
|
72
84
|
│ ├── opencode-session-parser.ts / opencode-import.ts # public OpenCode export → queue
|
|
73
85
|
│ ├── mcp-client-setup.ts # merge humemory into Kimi/OpenCode MCP configs
|
|
@@ -77,15 +89,9 @@ src/
|
|
|
77
89
|
│ ├── maintenance-state.ts # durable health record of the loop (data/maintenance-state.json)
|
|
78
90
|
│ ├── claude-hook.ts # worker-side session learning encoder
|
|
79
91
|
│ └── session-context.ts # SessionStart → markdown block (open loops + traces)
|
|
80
|
-
├── core/
|
|
81
|
-
│ ├── clock.ts # Clock seam (systemClock / FakeClock)
|
|
82
|
-
│ ├── event-bus.ts # AppEvent + InMemoryEventBus
|
|
83
|
-
│ ├── cue-arg.ts # cue syntax, shared by the CLI and the React form
|
|
84
|
-
│ ├── paths.ts # single resolver for data/db/queue/model-cache/install root
|
|
85
|
-
│ ├── doctor.ts # install diagnostic behind `humemory doctor` (no content read)
|
|
86
|
-
│ └── cues.ts # cue resolver, cron matcher, loop ids
|
|
87
92
|
├── api/server.ts # Hono HTTP API + serves public/ dashboard
|
|
88
93
|
├── cli/index.ts # commander CLI
|
|
94
|
+
├── mcp/server.ts # shared-store tools over stdio, process agent identity
|
|
89
95
|
└── index.ts # library exports
|
|
90
96
|
web/ # React front (bun bundler → public/app, served at /app)
|
|
91
97
|
scripts/hook-session.ts # Claude Code Stop hook → queue raw session only
|
|
@@ -115,9 +121,13 @@ data/humemory.db # legacy in-checkout DB; new installs use the OS data
|
|
|
115
121
|
| `keywords` | Indices de récupération | retrieval cues |
|
|
116
122
|
| `memoryType` | Type | episodic / semantic / procedural |
|
|
117
123
|
|
|
118
|
-
**
|
|
119
|
-
|
|
120
|
-
|
|
124
|
+
**Automatic decay thresholds:** L0→L1 24h · L1→L2 168h · L2→L3 720h,
|
|
125
|
+
before slowdown. The configured L4 threshold (2160h) is not visited by the
|
|
126
|
+
calculator. Slowdown is the product of `(1 + recallCount * 0.3)`, 1.5 when
|
|
127
|
+
saillance >=70, and 1.5 when verified, capped at 2.5×. The more recent creation
|
|
128
|
+
or recall determines age. Content length and keyword count affect stored
|
|
129
|
+
`decayRate`, which does not currently affect the calculated level.
|
|
130
|
+
`photographic: true` returns L0. See the [architecture guide](docs/architecture/architecture.html).
|
|
121
131
|
|
|
122
132
|
**Memory types:** `episodic` (events), `semantic` (facts), `procedural` (skills).
|
|
123
133
|
|
|
@@ -131,11 +141,11 @@ keywords >5. `photographic: true` disables decay entirely.
|
|
|
131
141
|
| GET | `/memories` | list (limit, level, type) |
|
|
132
142
|
| GET | `/memories/:id` | fetch one |
|
|
133
143
|
| POST | `/memories/:id/recall` | bump recall + saillance |
|
|
134
|
-
|
|
|
144
|
+
| GET | `/memories/:id/similar` | find similar |
|
|
135
145
|
| POST | `/memories/:id/merge` | merge (L4) |
|
|
136
146
|
| POST | `/memories/:id/photo` | toggle photographic |
|
|
137
147
|
| DELETE | `/memories/:id` | forget |
|
|
138
|
-
| GET | `/search?
|
|
148
|
+
| GET | `/search?q=X` | inverse search |
|
|
139
149
|
| POST | `/decay` | run consolidation |
|
|
140
150
|
| GET | `/status` | pool stats |
|
|
141
151
|
|
|
@@ -184,7 +194,8 @@ Core rules:
|
|
|
184
194
|
- **Isolated DB per run** — never touch `data/humemory.db`; use an in-memory or
|
|
185
195
|
temp-file `bun:sqlite` instance, torn down after each suite.
|
|
186
196
|
- **Injectable clock** — decay is time-driven, so time must be a parameter, not
|
|
187
|
-
`Date.now()`. Tests fast-forward a fake clock
|
|
197
|
+
`Date.now()`. Tests fast-forward a fake clock through automatic L0→L3;
|
|
198
|
+
L4 is tested as an explicit merge state.
|
|
188
199
|
- **Mocked LLM** — no calls to Anthropic in tests; `LLMClient` is stubbed with
|
|
189
200
|
deterministic fixtures. CI runs with no `ANTHROPIC_API_KEY`.
|
|
190
201
|
- **Fixtures, not live data** — seed memories from `tests/fixtures/`.
|
|
@@ -201,7 +212,8 @@ clock- and event-driven and cannot be trusted without it.
|
|
|
201
212
|
### ✅ Done — Sprints 1–4
|
|
202
213
|
- Core decay + inverse search; `bun:sqlite` store (WAL, write-queue serialization)
|
|
203
214
|
- CLI + Hono API + web dashboard ("palais de mémoire")
|
|
204
|
-
-
|
|
215
|
+
- Consolidation entry point for an external scheduler (`0 3 * * *` is an example,
|
|
216
|
+
not installed automatically); API maintenance imports/encodes sessions every 15 min
|
|
205
217
|
- Deterministic L1/L2/L3 generation; optional injected LLM enhancement
|
|
206
218
|
- Similar-detection + merge (L4); enriched search (type/period/saillance/recalls)
|
|
207
219
|
- Photographic mode; Claude Code `Stop` hook → durable async maintenance queue
|
|
@@ -220,7 +232,8 @@ branch_switch / error_pattern). One intention → N cues.
|
|
|
220
232
|
|
|
221
233
|
**Cue resolver (5.2): ✅ shipped (S5-02), `src/core/cues.ts`.** `resolveTimeCues(now)` + `resolveEventCues(event)` + expiry.
|
|
222
234
|
Decay × intention rule: `armed` → saillance pinned at 100, no decay (open loop stays
|
|
223
|
-
salient); `fired` not `closed` →
|
|
235
|
+
salient); `fired` not `closed` → intention-specific fade (−10 points/day from
|
|
236
|
+
`firedAt`, not the retrospective L0→L3 curve); `closed`
|
|
224
237
|
→ archived.
|
|
225
238
|
|
|
226
239
|
**Hooks (5.3): ✅ shipped (S5-03a, S5-03b).**
|
|
@@ -269,14 +282,18 @@ recurring traces across sessions/agents (KeywordClusterer behind a `Clusterer`
|
|
|
269
282
|
interface — vectors are Phase 7), scores clusters on `base(source)` only,
|
|
270
283
|
writes **idempotent** `dream_proposals` (14-day expiry) reviewed via
|
|
271
284
|
`pnpm cli dream review` / `approve` / `reject`; API `GET /dreams`,
|
|
272
|
-
`POST /dreams/:id/approve|reject`.
|
|
273
|
-
|
|
285
|
+
`POST /dreams/:id/approve|reject`. Content-changing proposals require approval;
|
|
286
|
+
keyword corroboration can automatically update verification metadata on existing
|
|
287
|
+
memories. `update_agents_md` returns a suggestion and never edits the file.
|
|
288
|
+
Dream kinds: `promote_semantic`, `merge_cluster`,
|
|
274
289
|
`contradiction`, `close_stale_loop`, `update_agents_md` (suggestion only).
|
|
275
290
|
|
|
276
291
|
**6.2 — MCP server: ✅ shipped** (`pnpm mcp`, `src/mcp/server.ts`, stdio).
|
|
277
292
|
Tools `humemory_add / search / recall / intent_add / intent_close / dreams` —
|
|
278
293
|
Claude, Codex, Kimi, OpenCode share one store with agent attribution on every
|
|
279
|
-
write (
|
|
294
|
+
write (identity from `$HUMEMORY_AGENT` in the server process, not a tool argument;
|
|
295
|
+
`HUMEMORY_DB` override for tests). Cross-agent reuse earns verification only
|
|
296
|
+
through a caller that supplies a trusted process identity, not an HTTP attribution header.
|
|
280
297
|
|
|
281
298
|
**Client registration** — the repo ships `.mcp.json` (Claude Code project
|
|
282
299
|
scope, `HUMEMORY_AGENT=claude`). `pnpm cli sources setup` merge-registers the
|
|
@@ -319,7 +336,7 @@ bundle (scripts are markdown any CLI agent reads, humemory stays agent-agnostic)
|
|
|
319
336
|
human-authored renders bare, everything else wrapped in
|
|
320
337
|
`<humemory-untrusted>`, escape-attempt telemetry on every render path.
|
|
321
338
|
- **8.3 — authoring & trust.** Three paths: human (`script add` → active
|
|
322
|
-
directly), agent (
|
|
339
|
+
directly), agent (API/library authoring → draft, human activates), dreamer-mined
|
|
323
340
|
(→ draft, see 8.5). Draft scripts never fire.
|
|
324
341
|
- **8.4 — disuse decay, the inverse Zeigarnik.** Scripts fade on *disuse*, not
|
|
325
342
|
time: active + unfired 60 days → −10 saillance/month past the grace period;
|
|
@@ -376,7 +393,8 @@ accepts a script id as the loser. API: `POST/GET /scripts`,
|
|
|
376
393
|
- `tsc` global can shadow local — `pnpm build` is `tsc -p tsconfig.json`.
|
|
377
394
|
|
|
378
395
|
## 📝 Notes
|
|
379
|
-
- Shared DB: `
|
|
396
|
+
- Shared DB: `src/core/paths.ts` resolves environment overrides, a legacy checkout
|
|
397
|
+
DB or the OS user data directory · API port `3456` (`PORT` env)
|
|
380
398
|
- Stack: TypeScript · `bun:sqlite` · `flexsearch` · `hono` · `commander` · `@anthropic-ai/sdk`
|
|
381
399
|
- `CLAUDE.md` is a thin quick-start companion that points back to this file; this
|
|
382
400
|
AGENTS.md remains the canonical source of truth for project vision and concepts.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.14] - 2026-09-27
|
|
4
|
+
**Chores:**
|
|
5
|
+
- update dependencies
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## [0.2.13] - 2026-09-20
|
|
10
|
+
**Documentation:**
|
|
11
|
+
- update project guidance and architecture
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
3
15
|
## [0.2.12] - 2026-09-20
|
|
4
16
|
**Features:**
|
|
5
17
|
- add Jev shadow qualification
|
package/README.md
CHANGED
|
@@ -26,17 +26,24 @@ Past learnings are **encoded**, then **degraded** over time on a human curve:
|
|
|
26
26
|
| Level | Name | Lifespan | Holds |
|
|
27
27
|
|-------|------|----------|-------|
|
|
28
28
|
| L0 | full detail | fresh (<24h) | complete content |
|
|
29
|
-
| L1 | summary | days | LLM
|
|
29
|
+
| L1 | summary | days | deterministic summary; optional LLM enhancement |
|
|
30
30
|
| L2 | essential | weeks | the gist |
|
|
31
31
|
| L3 | keywords | months | lexical retrieval tokens |
|
|
32
|
-
| L4 | lost / merged |
|
|
32
|
+
| L4 | lost / merged | explicit merge | source linked to a sibling trace |
|
|
33
33
|
|
|
34
34
|
Recall resists decay. Saillance (mnemonic strength, 0–100) and recall count slow
|
|
35
35
|
the curve. A **photographic** flag pins critical traces so they never fade.
|
|
36
36
|
|
|
37
|
-
**Inverse search**
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
**Inverse search** visits indexed fields in order: L3 keywords → L2 essentials →
|
|
38
|
+
L1 summary → full content. It collects matches across these fields, then ranks and
|
|
39
|
+
limits the results. A relaxed pass runs only if the strict pass found nothing.
|
|
40
|
+
Search does not itself reinforce a trace; use `recall` for that.
|
|
41
|
+
|
|
42
|
+
The model has five states, but automatic aging currently stops at L3: the decay
|
|
43
|
+
calculator does not visit the configured L4 threshold. Aging preserves the original
|
|
44
|
+
content and derived fields in SQLite, so detailed content remains searchable.
|
|
45
|
+
See the [interactive architecture guide](docs/architecture/architecture.html)
|
|
46
|
+
for the overall system and the detailed rules.
|
|
40
47
|
|
|
41
48
|
A Claude Code `Stop` hook can queue each completed session instantly; maintenance
|
|
42
49
|
extracts and stores its learnings afterward, outside the agent's critical path.
|
|
@@ -396,7 +403,7 @@ The CLI provides several commands to interact with humemory:
|
|
|
396
403
|
Options:
|
|
397
404
|
- `-d, --directory <dir>`: Filter by mental space
|
|
398
405
|
- `-s, --session <id>`: Filter by context
|
|
399
|
-
- `-l, --level <max>`:
|
|
406
|
+
- `-l, --level <max>`: Highest indexed field to search (0-4); not a filter on a trace's current state
|
|
400
407
|
- `-n, --limit <n>`: Number of traces
|
|
401
408
|
- `-t, --type <type>`: Filter by type (episodic/semantic/procedural)
|
|
402
409
|
- `--from <date>`: Start date YYYY-MM-DD
|
|
@@ -443,7 +450,7 @@ The CLI provides several commands to interact with humemory:
|
|
|
443
450
|
pnpm cli merge <sourceId> <targetId>
|
|
444
451
|
```
|
|
445
452
|
Options:
|
|
446
|
-
- `--auto`:
|
|
453
|
+
- `--auto`: Regenerate merged derived levels locally; an injected LLM may enhance them
|
|
447
454
|
|
|
448
455
|
- **Delete a memory trace**:
|
|
449
456
|
```bash
|
|
@@ -489,11 +496,11 @@ The API will be available at `http://localhost:3456`. You can interact with it u
|
|
|
489
496
|
- `GET /memories`: List memories
|
|
490
497
|
- `GET /memories/:id`: Fetch a specific memory
|
|
491
498
|
- `POST /memories/:id/recall`: Bump recall and saillance
|
|
492
|
-
- `
|
|
499
|
+
- `GET /memories/:id/similar`: Find similar memories
|
|
493
500
|
- `POST /memories/:id/merge`: Merge memories
|
|
494
501
|
- `POST /memories/:id/photo`: Toggle photographic mode
|
|
495
502
|
- `DELETE /memories/:id`: Forget a memory
|
|
496
|
-
- `GET /search?
|
|
503
|
+
- `GET /search?q=X`: Inverse search
|
|
497
504
|
- `POST /decay`: Run consolidation
|
|
498
505
|
- `GET /status`: Pool stats
|
|
499
506
|
|
|
@@ -670,9 +677,12 @@ days later on a user's machine. Runs on Linux, macOS and Windows in CI.
|
|
|
670
677
|
| `keywords` | Indices de récupération | retrieval cues |
|
|
671
678
|
| `memoryType` | Type | episodic / semantic / procedural |
|
|
672
679
|
|
|
673
|
-
**
|
|
674
|
-
|
|
675
|
-
|
|
680
|
+
**Automatic decay thresholds:** L0→L1 24h · L1→L2 168h · L2→L3 720h,
|
|
681
|
+
before slowdown. L4 is configured at 2160h but is not reached by automatic aging.
|
|
682
|
+
Age is measured from the more recent creation or recall. Slowdown is
|
|
683
|
+
`min((1 + recallCount * 0.3) × (saillance >= 70 ? 1.5 : 1) × (verified ? 1.5 : 1), 2.5)`.
|
|
684
|
+
Content length and keyword count affect the stored `decayRate`, which the level
|
|
685
|
+
calculator currently does not use. `photographic: true` returns L0.
|
|
676
686
|
|
|
677
687
|
**Memory types:** `episodic` (events), `semantic` (facts), `procedural` (skills).
|
|
678
688
|
|
|
@@ -683,7 +693,8 @@ keywords >5. `photographic: true` disables decay entirely.
|
|
|
683
693
|
### ✅ Done — Sprints 1–4
|
|
684
694
|
- Core decay + inverse search; `bun:sqlite` store (WAL, write-queue serialization)
|
|
685
695
|
- CLI + Hono API + web dashboard ("palais de mémoire")
|
|
686
|
-
-
|
|
696
|
+
- Consolidation entry point for an external scheduler (example: `0 3 * * *`);
|
|
697
|
+
the API's 15-minute maintenance loop imports and encodes sessions, not trace decay
|
|
687
698
|
- Deterministic L1/L2/L3 generation; optional injected LLM enhancement
|
|
688
699
|
- Similar-detection + merge (L4); enriched search (type/period/saillance/recalls)
|
|
689
700
|
- Photographic mode; Claude Code `Stop` hook → durable async maintenance queue
|
|
@@ -698,14 +709,17 @@ keywords >5. `photographic: true` disables decay entirely.
|
|
|
698
709
|
typed `trigger_spec`. One intention → N cues.
|
|
699
710
|
- [x] **5.2 Cue resolver** — time cues (ISO/cron) and event cues (file_open,
|
|
700
711
|
branch_switch, error_pattern). Decay rule: `armed` → saillance pinned at 100;
|
|
701
|
-
`fired` not `closed` →
|
|
712
|
+
`fired` not `closed` → −10 saillance points/day from `firedAt`;
|
|
713
|
+
`closed` → archived. This is separate from retrospective trace aging.
|
|
702
714
|
- [x] **5.3 Hooks** — `SessionStart` injects context (`scripts/hook-session-start.ts`,
|
|
703
715
|
budget via `HUMEMORY_SESSION_BUDGET`); git `post-commit` closes loops via the
|
|
704
716
|
explicit `Closes loop-<id>` marker, and only *suggests* on file-overlap.
|
|
705
717
|
- [x] **5.4 CLI/API** — `pnpm cli intent {add,list,close,fire,resolve}`,
|
|
706
718
|
`POST /intentions`, `POST /cues`, `POST /events`, `POST /cues/resolve`.
|
|
707
719
|
|
|
708
|
-
**
|
|
720
|
+
**Phases 6–8 shipped** — trust and contradictions, reviewed dream proposals, MCP,
|
|
721
|
+
optional vector search, and cognitive scripts. See the detailed shipped status in
|
|
722
|
+
[AGENTS.md](AGENTS.md). Cognitive scripts are Phase 8, not deferred work.
|
|
709
723
|
|
|
710
724
|
### 🛣️ Beyond
|
|
711
725
|
- Shared multi-project DB with concurrency lock (WAL + advisory) — done (Sprint 5 / S5-00a)
|
|
@@ -721,7 +735,8 @@ keywords >5. `photographic: true` disables decay entirely.
|
|
|
721
735
|
- `tsc` global can shadow local — `pnpm build` is `tsc -p tsconfig.json`.
|
|
722
736
|
|
|
723
737
|
## Notes
|
|
724
|
-
- Shared DB: `
|
|
738
|
+
- Shared DB: resolved by `src/core/paths.ts` (legacy checkout `data/humemory.db`,
|
|
739
|
+
otherwise the OS user data directory, with environment overrides) · API port `3456` (`PORT` env)
|
|
725
740
|
- Stack: TypeScript · `bun:sqlite` · `flexsearch` · `hono` · `commander` · `@anthropic-ai/sdk`
|
|
726
741
|
- `CLAUDE.md` is a thin Claude-Code-specific quick-start that delegates to
|
|
727
742
|
`AGENTS.md`; `AGENTS.md` remains the canonical source of truth.
|
package/docs/TESTING.md
CHANGED
|
@@ -24,11 +24,12 @@ LLM. Every run must be:
|
|
|
24
24
|
|
|
25
25
|
### 1. Isolated database — done
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
`beforeEach
|
|
27
|
+
`tests/humemory.test.ts` uses `freshStore()` with a frozen `FakeClock` and a
|
|
28
|
+
fresh `:memory:` database in `beforeEach`, closed in `afterEach`. Suites testing
|
|
29
|
+
cross-process persistence use isolated temporary files.
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
Every suite gets its own `bun:sqlite` instance; pass `':memory:'` unless the
|
|
32
|
+
scenario specifically needs on-disk persistence.
|
|
32
33
|
|
|
33
34
|
```ts
|
|
34
35
|
import { freshStore } from './helpers/store.js';
|
|
@@ -57,7 +58,8 @@ Threaded through `SQLiteStore` (`add`, `recall`, `updateDecay`) and
|
|
|
57
58
|
took `now` as a parameter. Anything still calling `new Date()` in a hot path is a
|
|
58
59
|
regression.
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
Decay tests assert the automatic L0→L3 curve without waiting; L4 is covered
|
|
62
|
+
as an explicit merge state, because automatic aging currently stops at L3:
|
|
61
63
|
|
|
62
64
|
```ts
|
|
63
65
|
const clock = new FakeClock(new Date('2026-01-01'));
|
|
@@ -68,9 +70,9 @@ await store.updateDecay();
|
|
|
68
70
|
expect((await store.getById(m.id)).currentLevel).toBe(1); // L0→L1
|
|
69
71
|
```
|
|
70
72
|
|
|
71
|
-
|
|
72
|
-
`new Date()` at the edges.
|
|
73
|
-
prospective
|
|
73
|
+
`scripts/consolidate.js` and some CLI/API entry points still stamp `day` with
|
|
74
|
+
`new Date()` at the edges. Behavioral tests exercise the injected store clock;
|
|
75
|
+
SessionStart and the prospective resolver also accept an injected clock.
|
|
74
76
|
|
|
75
77
|
### 3. Mocked LLM — seam already exists
|
|
76
78
|
|
|
@@ -82,8 +84,14 @@ prospective hooks land (S5-03a/b).
|
|
|
82
84
|
import { setLLMClient } from '../src/core/llm-generator.js';
|
|
83
85
|
|
|
84
86
|
setLLMClient({
|
|
85
|
-
|
|
86
|
-
|
|
87
|
+
messages: {
|
|
88
|
+
async create() {
|
|
89
|
+
return { content: [{ type: 'text', text: JSON.stringify({
|
|
90
|
+
level1Summary: 'fixed summary',
|
|
91
|
+
level2Essential: 'fixed gist',
|
|
92
|
+
level3Keywords: 'keyword-one keyword-two keyword-three',
|
|
93
|
+
}) }] };
|
|
94
|
+
},
|
|
87
95
|
},
|
|
88
96
|
});
|
|
89
97
|
```
|
|
@@ -116,9 +124,10 @@ handler unsubscribing mid-broadcast cannot corrupt the iteration. `published()`
|
|
|
116
124
|
`publishedOf(type)` expose the log for assertions without subscribing; `reset()`
|
|
117
125
|
clears both handlers and log.
|
|
118
126
|
|
|
119
|
-
`FileSystemEventBus` (fs.watch / chokidar
|
|
120
|
-
|
|
121
|
-
|
|
127
|
+
`FileSystemEventBus` (fs.watch / chokidar) is **not implemented**. The shipped
|
|
128
|
+
resolver accepts events through the injected bus or `POST /events`; callers must
|
|
129
|
+
supply file-open, branch-switch and error events. SessionStart additionally
|
|
130
|
+
resolves branch cues for scripts, not for intentions.
|
|
122
131
|
|
|
123
132
|
### 5. React components — same runner, no second stack
|
|
124
133
|
|