omp-fabric 1.26.15 → 1.27.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.
- package/CHANGELOG.md +42 -0
- package/README.md +0 -27
- package/dist/agents/handoff.d.ts +2 -3
- package/dist/agents/handoff.d.ts.map +1 -1
- package/dist/agents/manager.d.ts.map +1 -1
- package/dist/agents/types.d.ts +0 -7
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/chunks/{chunk-5EZWERJY.js → chunk-2BOZMRT5.js} +25 -8
- package/dist/chunks/{chunk-5EZWERJY.js.map → chunk-2BOZMRT5.js.map} +3 -3
- package/dist/chunks/{chunk-TF3MK3TH.js → chunk-4PQDZ3AY.js} +13 -13
- package/dist/chunks/{chunk-5U6HKMJV.js → chunk-4XLJPEI4.js} +3 -5
- package/dist/chunks/{chunk-5U6HKMJV.js.map → chunk-4XLJPEI4.js.map} +1 -1
- package/dist/chunks/{chunk-O5SZML2M.js → chunk-5MH37C4Y.js} +14 -7
- package/dist/chunks/chunk-5MH37C4Y.js.map +7 -0
- package/dist/chunks/{chunk-YWEXP724.js → chunk-7OZDA7YP.js} +5 -5
- package/dist/chunks/{chunk-673LUJCK.js → chunk-7QKSPNXQ.js} +7 -7
- package/dist/chunks/{chunk-PTYCFQEH.js → chunk-ABFK2RPI.js} +2 -2
- package/dist/chunks/{chunk-S3URDR4K.js → chunk-ANHZ3SWB.js} +8 -9
- package/dist/chunks/chunk-ANHZ3SWB.js.map +7 -0
- package/dist/chunks/{chunk-YLMDFMXM.js → chunk-BQ2U44IL.js} +2 -2
- package/dist/chunks/{chunk-RGE6MBYP.js → chunk-CNCRWY4Q.js} +27 -69
- package/dist/chunks/chunk-CNCRWY4Q.js.map +7 -0
- package/dist/chunks/{chunk-HWOL2YVU.js → chunk-CT23CX67.js} +48 -7
- package/dist/chunks/chunk-CT23CX67.js.map +7 -0
- package/dist/chunks/{chunk-3QPIB3H2.js → chunk-EV36BIIO.js} +8 -690
- package/dist/chunks/chunk-EV36BIIO.js.map +7 -0
- package/dist/chunks/{chunk-CA2P7NLW.js → chunk-FA7TNLOV.js} +2 -88
- package/dist/chunks/chunk-FA7TNLOV.js.map +7 -0
- package/dist/chunks/{chunk-BV3EDWSX.js → chunk-FVGI5PSL.js} +4 -1
- package/dist/chunks/chunk-FVGI5PSL.js.map +7 -0
- package/dist/chunks/{chunk-6IPXBDCA.js → chunk-FWFET65L.js} +211 -4
- package/dist/chunks/chunk-FWFET65L.js.map +7 -0
- package/dist/chunks/{chunk-ESPCTYVX.js → chunk-IPI4UOTC.js} +352 -1
- package/dist/chunks/chunk-IPI4UOTC.js.map +7 -0
- package/dist/chunks/{chunk-EZWJ5GBW.js → chunk-K7IN6FTM.js} +4 -15
- package/dist/chunks/chunk-K7IN6FTM.js.map +7 -0
- package/dist/commands/fabric.d.ts.map +1 -1
- package/dist/compaction/branch-details.d.ts +3 -9
- package/dist/compaction/branch-details.d.ts.map +1 -1
- package/dist/compaction/instructions.d.ts +4 -29
- package/dist/compaction/instructions.d.ts.map +1 -1
- package/dist/compaction/trace-events.d.ts +1 -1
- package/dist/compaction/trace-events.d.ts.map +1 -1
- package/dist/completed-outputs.d.ts +12 -0
- package/dist/completed-outputs.d.ts.map +1 -0
- package/dist/config-migrations.d.ts +1 -1
- package/dist/config-migrations.d.ts.map +1 -1
- package/dist/config.d.ts +0 -18
- package/dist/config.d.ts.map +1 -1
- package/dist/core/action-registry.d.ts.map +1 -1
- package/dist/core/action-registry.js +3 -3
- package/dist/core/action-repair.d.ts +1 -0
- package/dist/core/action-repair.d.ts.map +1 -1
- package/dist/core/compact-controller.d.ts +0 -7
- package/dist/core/compact-controller.d.ts.map +1 -1
- package/dist/entropy/index.js +6 -7
- package/dist/execution-service.d.ts +2 -0
- package/dist/execution-service.d.ts.map +1 -1
- package/dist/fabric-runtime-state.d.ts +0 -64
- package/dist/fabric-runtime-state.d.ts.map +1 -1
- package/dist/fabric-runtime-state.js +195 -126
- package/dist/fabric-runtime-state.js.map +4 -4
- package/dist/fabric-state.d.ts +0 -3
- package/dist/fabric-state.d.ts.map +1 -1
- package/dist/failure-progress.d.ts +2 -1
- package/dist/failure-progress.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +148 -251
- package/dist/index.js.map +3 -3
- package/dist/memory/discovery.js +2 -3
- package/dist/memory/normalize.js +1 -2
- package/dist/memory/search.js +2 -3
- package/dist/providers/agents-actions.d.ts.map +1 -1
- package/dist/providers/agents-provider.d.ts.map +1 -1
- package/dist/providers/compact-provider.d.ts.map +1 -1
- package/dist/providers/memory-provider.d.ts +0 -11
- package/dist/providers/memory-provider.d.ts.map +1 -1
- package/dist/providers/memory-provider.js +4 -7
- package/dist/residency/host.js +6 -14
- package/dist/residency/omp-entry.js +6 -14
- package/dist/residency/omp-entry.js.map +1 -1
- package/dist/runtime/core-override-guest-types.js +1 -1
- package/dist/runtime/guest-types.d.ts +1 -1
- package/dist/runtime/guest-types.d.ts.map +1 -1
- package/dist/runtime/guest-types.js +1 -1
- package/dist/runtime/node-process-runtime.js +8 -8
- package/dist/runtime/quickjs-runtime.d.ts +1 -1
- package/dist/runtime/quickjs-runtime.d.ts.map +1 -1
- package/dist/runtime/quickjs-runtime.js +2 -2
- package/dist/runtime/type-checker.js +1 -1
- package/dist/type-error-guidance.d.ts.map +1 -1
- package/dist/ui/controller.d.ts +0 -1
- package/dist/ui/controller.d.ts.map +1 -1
- package/dist/ui/conversation.js +5 -5
- package/dist/ui/dashboard.d.ts.map +1 -1
- package/dist/ui/dashboard.js +13 -18
- package/dist/ui/dashboard.js.map +2 -2
- package/dist/ui/settings.d.ts.map +1 -1
- package/dist/ui/settings.js +9 -203
- package/dist/ui/settings.js.map +2 -2
- package/docs/agents.md +1 -3
- package/docs/audit-trace.md +3 -3
- package/docs/configuration.md +18 -6
- package/docs/entropy.md +1 -2
- package/docs/interface.md +0 -35
- package/docs/memory-recall.md +6 -11
- package/docs/programmatic-compaction.md +14 -32
- package/package.json +8 -11
- package/dist/chunks/chunk-3J7BKUNG.js +0 -354
- package/dist/chunks/chunk-3J7BKUNG.js.map +0 -7
- package/dist/chunks/chunk-3QPIB3H2.js.map +0 -7
- package/dist/chunks/chunk-6IPXBDCA.js.map +0 -7
- package/dist/chunks/chunk-BV3EDWSX.js.map +0 -7
- package/dist/chunks/chunk-CA2P7NLW.js.map +0 -7
- package/dist/chunks/chunk-ESPCTYVX.js.map +0 -7
- package/dist/chunks/chunk-EZWJ5GBW.js.map +0 -7
- package/dist/chunks/chunk-G3VKU6GZ.js +0 -1681
- package/dist/chunks/chunk-G3VKU6GZ.js.map +0 -7
- package/dist/chunks/chunk-HWOL2YVU.js.map +0 -7
- package/dist/chunks/chunk-JL3KVPFJ.js +0 -291
- package/dist/chunks/chunk-JL3KVPFJ.js.map +0 -7
- package/dist/chunks/chunk-O5SZML2M.js.map +0 -7
- package/dist/chunks/chunk-QD2B5FUE.js +0 -15
- package/dist/chunks/chunk-QD2B5FUE.js.map +0 -7
- package/dist/chunks/chunk-QSRTEINF.js +0 -469
- package/dist/chunks/chunk-QSRTEINF.js.map +0 -7
- package/dist/chunks/chunk-QZJB7QTM.js +0 -248
- package/dist/chunks/chunk-QZJB7QTM.js.map +0 -7
- package/dist/chunks/chunk-RGE6MBYP.js.map +0 -7
- package/dist/chunks/chunk-S3URDR4K.js.map +0 -7
- package/dist/chunks/chunk-SMNOQLKU.js +0 -53
- package/dist/chunks/chunk-SMNOQLKU.js.map +0 -7
- package/dist/chunks/chunk-TQQPXV3I.js +0 -58
- package/dist/chunks/chunk-TQQPXV3I.js.map +0 -7
- package/dist/chunks/chunk-UAP6IQIR.js +0 -76
- package/dist/chunks/chunk-UAP6IQIR.js.map +0 -7
- package/dist/chunks/chunk-VE3FWDRH.js +0 -221
- package/dist/chunks/chunk-VE3FWDRH.js.map +0 -7
- package/dist/chunks/chunk-ZHDN5ESL.js +0 -130
- package/dist/chunks/chunk-ZHDN5ESL.js.map +0 -7
- package/dist/compaction/bounds.d.ts +0 -25
- package/dist/compaction/bounds.d.ts.map +0 -1
- package/dist/compaction/branch-summary.d.ts +0 -9
- package/dist/compaction/branch-summary.d.ts.map +0 -1
- package/dist/compaction/enrichers.d.ts +0 -10
- package/dist/compaction/enrichers.d.ts.map +0 -1
- package/dist/compaction/hook.d.ts +0 -117
- package/dist/compaction/hook.d.ts.map +0 -1
- package/dist/compaction/hook.js +0 -21
- package/dist/compaction/hook.js.map +0 -7
- package/dist/compaction/lcm-addresses.d.ts +0 -10
- package/dist/compaction/lcm-addresses.d.ts.map +0 -1
- package/dist/compaction/lcm-doctor.d.ts +0 -60
- package/dist/compaction/lcm-doctor.d.ts.map +0 -1
- package/dist/compaction/lcm-loader.d.ts +0 -12
- package/dist/compaction/lcm-loader.d.ts.map +0 -1
- package/dist/compaction/lcm-maintenance.d.ts +0 -152
- package/dist/compaction/lcm-maintenance.d.ts.map +0 -1
- package/dist/compaction/lcm-model.d.ts +0 -44
- package/dist/compaction/lcm-model.d.ts.map +0 -1
- package/dist/compaction/lcm-recovery.d.ts +0 -7
- package/dist/compaction/lcm-recovery.d.ts.map +0 -1
- package/dist/compaction/lcm-runtime.d.ts +0 -233
- package/dist/compaction/lcm-runtime.d.ts.map +0 -1
- package/dist/compaction/lcm-runtime.js +0 -2863
- package/dist/compaction/lcm-runtime.js.map +0 -7
- package/dist/compaction/lcm-status.d.ts +0 -5
- package/dist/compaction/lcm-status.d.ts.map +0 -1
- package/dist/compaction/normalize.d.ts +0 -83
- package/dist/compaction/normalize.d.ts.map +0 -1
- package/dist/compaction/projections.d.ts +0 -26
- package/dist/compaction/projections.d.ts.map +0 -1
- package/dist/compaction/render.d.ts +0 -11
- package/dist/compaction/render.d.ts.map +0 -1
- package/dist/core/event-loop-slice.d.ts +0 -11
- package/dist/core/event-loop-slice.d.ts.map +0 -1
- package/dist/memory/lcm-adapter.d.ts +0 -111
- package/dist/memory/lcm-adapter.d.ts.map +0 -1
- package/dist/storage/lcm-directory.d.ts +0 -17
- package/dist/storage/lcm-directory.d.ts.map +0 -1
- package/dist/storage/lcm-identity.d.ts +0 -48
- package/dist/storage/lcm-identity.d.ts.map +0 -1
- package/dist/storage/lcm-ledger.d.ts +0 -159
- package/dist/storage/lcm-ledger.d.ts.map +0 -1
- package/dist/storage/lcm-migration.d.ts +0 -87
- package/dist/storage/lcm-migration.d.ts.map +0 -1
- package/dist/storage/lcm-offthread.d.ts +0 -9
- package/dist/storage/lcm-offthread.d.ts.map +0 -1
- package/dist/storage/sqlite.d.ts +0 -19
- package/dist/storage/sqlite.d.ts.map +0 -1
- package/dist/ui/frame.d.ts +0 -7
- package/dist/ui/frame.d.ts.map +0 -1
- package/dist/ui/lcm-dashboard.d.ts +0 -43
- package/dist/ui/lcm-dashboard.d.ts.map +0 -1
- package/dist/ui/lcm-dashboard.js +0 -395
- package/dist/ui/lcm-dashboard.js.map +0 -7
- package/dist/ui/lcm-panel.d.ts +0 -37
- package/dist/ui/lcm-panel.d.ts.map +0 -1
- package/dist/ui/lcm-panel.js +0 -23
- package/dist/ui/lcm-panel.js.map +0 -7
- package/docs/adr/0001-lcm-durable-context-ledger.md +0 -6
- package/docs/certification.md +0 -134
- package/docs/compaction.md +0 -188
- /package/dist/chunks/{chunk-TF3MK3TH.js.map → chunk-4PQDZ3AY.js.map} +0 -0
- /package/dist/chunks/{chunk-YWEXP724.js.map → chunk-7OZDA7YP.js.map} +0 -0
- /package/dist/chunks/{chunk-673LUJCK.js.map → chunk-7QKSPNXQ.js.map} +0 -0
- /package/dist/chunks/{chunk-PTYCFQEH.js.map → chunk-ABFK2RPI.js.map} +0 -0
- /package/dist/chunks/{chunk-YLMDFMXM.js.map → chunk-BQ2U44IL.js.map} +0 -0
package/docs/certification.md
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
# Context and memory certification
|
|
2
|
-
|
|
3
|
-
The repository provides three evaluation commands:
|
|
4
|
-
|
|
5
|
-
- `bun certify:context` is deterministic, runs offline, and costs nothing.
|
|
6
|
-
- `bun run certify:entropy` is deterministic and offline: fixed corpora through the versioned [tool-entropy meter](entropy.md), with a ratchet proof, the compile loop (applied, gate-rejected, and converged rounds), ingestion checks, and, against a real corpus with `--trial`, the held-out divergence trial that fails if the compiled artifact would reject any recorded successful call. With `--trial` and no `--artifact`, the compiled artifact is read from `<agent dir>/fabric/entropy/compiled.json`, where the agent dir is `OMP_FABRIC_AGENT_DIR` (expanding `~` and `file://`) and otherwise the host's `getAgentDir()` default of `~/.omp/agent`; a missing artifact fails `trial-mode` and names the directory it searched.
|
|
7
|
-
- `bun benchmark:real-resume` is an opt-in, billable OMP RPC benchmark with a safe skip as its default behavior.
|
|
8
|
-
|
|
9
|
-
`bun test` excludes these commands, which keeps the normal test suite offline and fast.
|
|
10
|
-
|
|
11
|
-
## Deterministic certification
|
|
12
|
-
|
|
13
|
-
Both certification commands run under Bun. They import the installed host package, whose `exports` map points `import` at TypeScript sources, and Node refuses to strip types for files under `node_modules`:
|
|
14
|
-
|
|
15
|
-
```sh
|
|
16
|
-
bun certify:context
|
|
17
|
-
bun certify:context -- --json /tmp/omp-fabric-certification.json
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
The package command builds `dist/` first, then runs `scripts/certify-context.mjs`. It prints a human summary followed by the complete JSON report. When any threshold fails, the command exits nonzero.
|
|
21
|
-
|
|
22
|
-
### Compaction endurance
|
|
23
|
-
|
|
24
|
-
The harness builds a persisted session through OMP's `SessionManager`. Messages and compactions go in through its public methods. The active parent-linked branch comes back through `getBranch()`. Under deterministic settings (`contextWindow=64`, `reserveTokens=63`, `keepRecentTokens=1`), the harness performs exactly 100 Fabric compactions. Before every hook event it sums the host's `estimateTokens` over `SessionManager.buildSessionContext().messages`, applies `shouldCompact`, and requires `prepareCompaction` to return a preparation. It then invokes the callback registered by `registerCompactionHook` with OMP's `SessionBeforeCompactEvent` shape: `type`, `preparation`, `branchEntries`, an optional `customInstructions`, and `signal`. That event carries neither a compaction reason nor a retry flag, so certification asserts nothing about either.
|
|
25
|
-
|
|
26
|
-
The host package is `@oh-my-pi/pi-coding-agent`. Certification reads the installed version from its own `package.json` and checks it against the range `omp-fabric` declares in `peerDependencies`, so no certified version is hard-coded; a host outside the declared range aborts the run and reports both the range and the resolved version and path. Each function is then resolved from a supported entry point, and a missing one aborts the run naming the entry point: `SessionManager` and `buildSessionContext` from the package root, `estimateTokens` from `@oh-my-pi/pi-coding-agent/extensibility/legacy-pi-coding-agent-shim`, and `prepareCompaction` plus `shouldCompact` from `@oh-my-pi/pi-agent-core/compaction`. At the pinned 18.18.8 host the package root exports `SessionManager` and `buildSessionContext`, does not export `prepareCompaction` or `shouldCompact`, and has no `buildContextEntries` export at all; the report records each of those observations under `hostApi.rootExports`. No public API supplies a preparation unless an `AgentSession` runs with a model, so certification makes no claim past that.
|
|
27
|
-
|
|
28
|
-
Every persisted summary carries a cycle-unique `PRIOR_SUMMARY_POISON_991_…` suffix inside the actual `CompactionEntry`. On the next cycle, OMP's preparation has to expose that exact stored previous summary. A proxy around the event preparation records whether the registered Fabric callback reads `previousSummary`. The result derives from those accesses. Fabric must leave the value unread and keep its poison out of anything it emits. No step converts a summary into a user message by hand.
|
|
29
|
-
|
|
30
|
-
Every cycle also checks:
|
|
31
|
-
|
|
32
|
-
- the original goal, constraint, and pinned Unicode rare fact
|
|
33
|
-
- the cumulative source, file, and unresolved-error addresses
|
|
34
|
-
- tool-call/result closure at the kept boundary
|
|
35
|
-
- the presence of every nonempty `firstKeptEntryId` on the active branch
|
|
36
|
-
- exact round trips of persisted summaries and details
|
|
37
|
-
- agreement between `SessionManager.buildSessionContext()` and the public `buildSessionContext(entries, leafId)`
|
|
38
|
-
- a resolved context that, after the compaction and after each subsequent append, is identical to the context the host resolves from the retained entries alone: those from `firstKeptEntryId` onward, the `compaction` entry, and everything appended after it
|
|
39
|
-
- a valid UTF-8 summary size of at most 32 KiB.
|
|
40
|
-
|
|
41
|
-
The last 20 summary sizes must span a range of at most 512 bytes. Their absolute least-squares slope must stay at or under 16 bytes per cycle. These bounds catch late unbounded growth while letting cycle sizes differ.
|
|
42
|
-
|
|
43
|
-
Six explicit eligible closure fixtures must each run at least once: normal, compact-all, OMP split-turn preparation, parallel/delayed results, reverse-order call/result, and malformed prior boundary. The harness checks every resulting Fabric cut for call/result closure.
|
|
44
|
-
|
|
45
|
-
A separate maximal source of about 330 KiB mixes multibyte goals, instructions, paths, errors, turns, and typed Fabric activity. Its summary must reach at least 24 KiB, stay within 32 KiB, and survive a round trip through a fatal UTF-8 decoder. This fixture pushes the bound close to its reachable projection saturation. The endurance fixture alone plateaus naturally at roughly 5.8 KiB.
|
|
46
|
-
|
|
47
|
-
The certificate covers deterministic cumulative projection, OMP eligibility and context behavior, closure handling for the named fixtures, and byte-safe saturation for generated typed event streams. Arbitrary human conversations and general model behavior require separate evaluation.
|
|
48
|
-
|
|
49
|
-
### Cross-layer memory
|
|
50
|
-
|
|
51
|
-
The same run creates 1,000 additional persisted OMP sessions. One unique rare-fact session receives an old source mtime. It must classify as cold. Only eight sessions may stay hot. Certification calls `MemoryProvider` directly. No shell output gets parsed.
|
|
52
|
-
|
|
53
|
-
The pass conditions are:
|
|
54
|
-
|
|
55
|
-
- at least 1,000 eligible sessions with complete indexing coverage
|
|
56
|
-
- exact lexical recall of the cold rare fact
|
|
57
|
-
- exact structural selection of a cold `omp.grep` operation by persisted ref/outcome, followed by source- and lineage-bound hydration
|
|
58
|
-
- a nonexistent-ref structural negative control that returns zero results
|
|
59
|
-
- a session header whose recorded id matches `SessionManager.getSessionId()`, so a session that cannot be identified from its own JSONL cannot pass
|
|
60
|
-
- exact source expansion by its stable entry ID
|
|
61
|
-
- exact expansion of every distinct entry ID emitted by the 100 compaction summaries or their structured details
|
|
62
|
-
- 100% address expansion agreement with a fresh normalization of the source JSONL
|
|
63
|
-
- V6 `sourceHash` integrity checks on both cold hydration and context address expansion.
|
|
64
|
-
|
|
65
|
-
`memory.expand` caps exact selectors and returned entries per call, so the harness requests the emitted addresses in batches of at most 100 selectors and follows each response's `next` cursor until the selection is exhausted, concatenating the text chunks per entry. Every page has to report the same `sourceHash`; a change mid-expansion fails the run. The JSON report includes the eligible, indexed, and stale counts. It also lists the emitted and expanded address counts plus the cache and source byte sizes.
|
|
66
|
-
|
|
67
|
-
This proves lexical addressability and exact capability-head addressability through the current cache, digest, search, and source-expansion layers. Fuzzy semantic retrieval, ranking under unrelated corpora, cache performance on all filesystems, and recovery after source deletion stay outside that proof.
|
|
68
|
-
|
|
69
|
-
### Continuation QA
|
|
70
|
-
|
|
71
|
-
Continuation QA creates two small temporary repositories. Each holds exact expected final files, an executable Node oracle, and files that must stay byte-identical. A no-model handoff simulator receives only:
|
|
72
|
-
|
|
73
|
-
1. the compacted summary and the structured compaction details
|
|
74
|
-
2. constrained current-session pointer and expansion APIs backed by `MemoryProvider`.
|
|
75
|
-
|
|
76
|
-
The source phase persists a handoff envelope that holds the compacted context and the current OMP session ID. Task operations and captured session paths never enter that envelope. In the resume phase, the simulator reads that output, builds a fresh `MemoryProvider`, and asks it for a V6 integrity-bound current-session pointer. It then derives the cumulative source entry ID from the compaction details and expands that address with `expectedSourceHash`. The `addressResolved` score comes from the returned entry. The harness never substitutes a constant. No callback closes over `manager.getSessionFile()`.
|
|
77
|
-
|
|
78
|
-
The simulator decodes `CERT_TASK_V1` and applies its operations only after the source expansion succeeds. When an exact operation or file payload is unavailable, it throws and fails the run. It never fabricates a success. The external oracle then scores exact filesystem state, forbidden-file integrity, and process exit status. The oracle never supplies `task.operations` to the simulator.
|
|
79
|
-
|
|
80
|
-
This proves that the emitted address, the current persisted session identity, and the allowed memory operations can carry these mechanically executable tasks across a fresh handoff. OMP's compaction result itself exposes no session ID and no source hash. Those two values come from persisted current-session context and from `MemoryProvider`, in that order. Whether arbitrary prose can turn into operations, whether a model will choose to recall, and whether the two fixtures represent all software work stay unresolved here.
|
|
81
|
-
|
|
82
|
-
## Real OMP RPC benchmark
|
|
83
|
-
|
|
84
|
-
The benchmark compares two arms in deterministic randomized paired order:
|
|
85
|
-
|
|
86
|
-
- `baseline`: resumes the full, uncompacted context
|
|
87
|
-
- `fabric`: compacts with Fabric, terminates that process, then resumes in a fresh process.
|
|
88
|
-
|
|
89
|
-
The resumed process receives exactly:
|
|
90
|
-
|
|
91
|
-
```text
|
|
92
|
-
Resume and complete the task.
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
A filesystem and test oracle outside the model scores the result. Reports capture pass/fail diff reasons, tokens, USD cost, tool calls, recall calls, wall time, summary bytes, Wilson 95% pass-rate intervals, and paired win/tie rates. A report names the credential variable and never shows its value. Session and repository data live in a temporary directory. The run removes that directory afterward.
|
|
96
|
-
|
|
97
|
-
The RPC reader implements strict LF JSONL framing. It splits only on `\n`, strips an optional trailing `\r`, and preserves U+2028/U+2029 inside JSON strings. Node's `readline` plays no part in the reader.
|
|
98
|
-
|
|
99
|
-
### Safety gate
|
|
100
|
-
|
|
101
|
-
Without configuration, this command exits zero and reports `SKIP`:
|
|
102
|
-
|
|
103
|
-
```sh
|
|
104
|
-
bun benchmark:real-resume
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
A billable run requires all of these gates:
|
|
108
|
-
|
|
109
|
-
```sh
|
|
110
|
-
OMP_FABRIC_REAL_RESUME=1 \
|
|
111
|
-
OMP_FABRIC_BENCH_PROVIDER=anthropic \
|
|
112
|
-
OMP_FABRIC_BENCH_MODEL=claude-sonnet-4-5 \
|
|
113
|
-
OMP_FABRIC_BENCH_KEY_ENV=ANTHROPIC_API_KEY \
|
|
114
|
-
OMP_FABRIC_BENCH_REPEATS=3 \
|
|
115
|
-
OMP_FABRIC_BENCH_MAX_USD=5 \
|
|
116
|
-
bun benchmark:real-resume
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
`OMP_FABRIC_BENCH_KEY_ENV` names an already-set credential environment variable. The benchmark checks the observed session cost before each next arm starts. It stops once the run reaches the configured budget. A single in-flight request can still exceed the remaining budget. Treat the maximum as a stop boundary. Hard spending caps live on the provider side.
|
|
120
|
-
|
|
121
|
-
The benchmark proves end-to-end behavior for the selected model, provider, fixture, extension versions, and repeats only. Small samples carry wide confidence intervals. General superiority and full isolation of provider variance stay outside that proof.
|
|
122
|
-
|
|
123
|
-
The benchmark compares only the explicitly selected baseline and Fabric arms. Its oracle and paired report remain bounded evidence for the configured model, provider, fixture, extension version, and repeats; they do not claim general provider superiority.
|
|
124
|
-
|
|
125
|
-
## Test coverage
|
|
126
|
-
|
|
127
|
-
The suite in `tests/certification/` covers:
|
|
128
|
-
|
|
129
|
-
- strict LF JSONL parsing, including split UTF-8 and Unicode line separators
|
|
130
|
-
- the default skip gate and the complete opt-in gate
|
|
131
|
-
- deterministic paired order and benchmark confidence/paired reporting
|
|
132
|
-
- executable continuation oracle passes and forbidden-change failures
|
|
133
|
-
- certification rejection under sabotage of eligibility, poison exclusion, address resolution, or the external oracle
|
|
134
|
-
- certification report threshold failures.
|
package/docs/compaction.md
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
# LCM compaction
|
|
2
|
-
|
|
3
|
-
OMP Fabric uses LCM as its default compaction engine. Set `compaction.engine` to `"omp"` only when OMP's native compaction should own the session.
|
|
4
|
-
|
|
5
|
-
## Model-visible context
|
|
6
|
-
|
|
7
|
-
LCM assembles one bounded OMP compaction result from:
|
|
8
|
-
|
|
9
|
-
- ready summary-frontier nodes;
|
|
10
|
-
- a protected fresh tail selected by OMP's `firstKeptEntryId` preparation;
|
|
11
|
-
- bounded source and lineage metadata.
|
|
12
|
-
|
|
13
|
-
The hook uses the standard `session_before_compact` contract. It reads committed nodes and produces a valid `CompactionResult`; it does not call or await a summarization model. When semantic maintenance has not produced a ready node, the hook emits a bounded deterministic emergency excerpt with explicit source references.
|
|
14
|
-
|
|
15
|
-
## Durable storage
|
|
16
|
-
|
|
17
|
-
LCM stores the complete authoritative OMP `SessionEntry` as canonical UTF-8 JSON in a project-scoped SQLite ledger outside the working tree. Object keys are recursively sorted before hashing. The ledger retains raw entries indefinitely by default and never deletes them during compaction.
|
|
18
|
-
|
|
19
|
-
Each summary node is immutable after publication of its source identity. Leaf nodes cover bounded raw-entry ranges. Condensed nodes cover completed child nodes. Every source reference carries the session, entry ID, revision, and payload hash. Node, edge, frontier, and maintenance-job publication is transactional.
|
|
20
|
-
|
|
21
|
-
SQLite uses WAL, `synchronous=FULL`, a serialized writer, a 5-second busy timeout, and startup integrity verification. Project storage uses canonical recorded cwd/realpath identity with device/inode preference when available. Symlink aliases and renames converge; distinct worktrees remain distinct projects.
|
|
22
|
-
|
|
23
|
-
## Lifecycle
|
|
24
|
-
|
|
25
|
-
`message_end` is only a dirty-session hint because OMP emits a detached message before native persistence. LCM assigns authoritative identity from post-persistence session readback:
|
|
26
|
-
|
|
27
|
-
1. `session_start` reconciles only the selected `getSessionFile()`; unrelated sessions are not scanned.
|
|
28
|
-
2. `agent_end` and `session_compact` read the stable active branch and append complete entries idempotently.
|
|
29
|
-
3. Background maintenance claims leaf and condensation jobs with durable leases and bounded retries.
|
|
30
|
-
4. A later compaction hook reads ready nodes without waiting for maintenance.
|
|
31
|
-
5. `session_shutdown` aborts model work, drains writes, and closes the ledger.
|
|
32
|
-
|
|
33
|
-
The selected-session reconciler stores a source generation/checkpoint and resumes after interruption. It does not perform a global three-day migration. The old bulk migration command is not part of normal operation.
|
|
34
|
-
|
|
35
|
-
Reconciling the live session reads a file the session itself is writing. A read the writer moves under the reader is counted as `raced` and retried up to three times; only a settled read is scanned. A raced read is never counted as an error, and the panel names how many reads were retried. A source that never settles within those attempts is reported as incomplete discovery. An unreadable source, a project-key mismatch, and a dropped entry stay errors and drops.
|
|
36
|
-
|
|
37
|
-
A reconciliation fault recorded at startup would otherwise last the whole session, because reconciliation runs once at session selection. While the record holds an error, the next three turn boundaries re-run the same reconciliation after readback. A clean pass replaces the record and clears the message; a fault that is still true is recorded again at the same volume. Drops are facts about content already read, so a later pass leaves them standing.
|
|
38
|
-
|
|
39
|
-
## Summary maintenance
|
|
40
|
-
|
|
41
|
-
The dedicated model is selected from `compaction.summaryModel` through OMP's public model registry and session-aware resolver. Pick it in `/fabric settings` under Compaction > Summary model, which lists the models OMP has available and offers Inherit to fall back to the active session model. The runtime resolves compaction options at use time, so a change applies to the next maintenance pass and the next compaction without restarting the session. The active session model is the fallback when the dedicated route is unavailable. Leaf and condensed prompts XML-fence transcript evidence and treat it as untrusted data.
|
|
42
|
-
|
|
43
|
-
Maintenance defaults are bounded to 32 model calls, 2,000,000 input tokens, and 128,000 output tokens per project per UTC day, with a nested 16-call session limit. Up to `compaction.lcmMaintenanceConcurrency` model jobs hold a lease at once, 3 by default. Jobs use 30-second leases renewed every 10 seconds and reclaimed 60 seconds after a lease lapses, 60-second call limits, exponential retry backoff capped at 15 minutes, and three attempts. A claim refused because the cap is full or the budget is spent leaves the job pending and costs it no attempt. A job that a release before 1.13.2 retired on such a refusal returns to pending with its attempts cleared on one maintenance pass, once per job for the life of the ledger. The synchronous claim a compaction makes when no ready frontier covers its range takes a lapsed lease at 30 seconds without waiting for the reclaim grace, and when a live worker holds the lease it serves the deterministic excerpt and leaves the node alone. A failed call does not publish a ready node or increment usage counters.
|
|
44
|
-
|
|
45
|
-
The emergency reducer is deterministic, explicitly nonsemantic, source-addressed, and bounded to 4,096 bytes by UTF-8 size. Provider failure keeps raw entries and pending maintenance recoverable.
|
|
46
|
-
|
|
47
|
-
## Retrieval
|
|
48
|
-
|
|
49
|
-
Use the existing namespaced memory actions:
|
|
50
|
-
|
|
51
|
-
- `memory.recall` returns bounded raw and summary hits. The default LCM scope is the current session when one is bound; explicit session scope remains available. Active-branch results require source references on the live branch. Incomplete or stale coverage is reported and never treated as an authoritative no-match.
|
|
52
|
-
- `memory.expand` follows a stable raw or summary reference. Raw expansion returns the exact structured `SessionEntry` payload, including tool arguments, tool results, custom details, and media fields. Summary expansion descends one level: it returns the constituent messages the summary was built from, each with its own address and a `memory.expand` follow-up, or the child nodes of a condensed node. The node's own text, kind, state, sources, and children sit in a top-level `node` field.
|
|
53
|
-
- `memory.sessions` remains the session inventory action.
|
|
54
|
-
|
|
55
|
-
Summary text is a navigation aid. Exact action or factual claims should be checked against expanded raw source entries.
|
|
56
|
-
|
|
57
|
-
## Tree and handoff behavior
|
|
58
|
-
|
|
59
|
-
LCM uses the standard `session_before_tree` hook when the user requests a branch summary. The result contains bounded typed branch facts and the abandoned `oldLeafId`; sibling branch prose is not used as source truth.
|
|
60
|
-
|
|
61
|
-
Trajectory handoff compaction has no live `ExtensionContext`, so it uses the LCM deterministic emergency reducer over the discarded prefix, keeps the latest user boundary when one exists, and records source range metadata. It does not invoke the old Fabric compiler or a hidden model call.
|
|
62
|
-
|
|
63
|
-
## Operational controls
|
|
64
|
-
|
|
65
|
-
Raw retention is indefinite but bounded operationally:
|
|
66
|
-
|
|
67
|
-
- 8 GiB per project: warning in status and UI when available;
|
|
68
|
-
- 10 GiB per project: stop new model-maintenance claims while preserving raw appends;
|
|
69
|
-
- ENOSPC: durable degraded state; no successful skip is reported;
|
|
70
|
-
- backup/export: mode-0600 `VACUUM INTO` copy with SHA-256, row counts, and integrity manifest;
|
|
71
|
-
- deletion: explicit typed project confirmation, verified backup, transactional scoped delete, post-delete integrity check, and audit manifest.
|
|
72
|
-
|
|
73
|
-
Automatic raw deletion is disabled.
|
|
74
|
-
|
|
75
|
-
## Configuration
|
|
76
|
-
|
|
77
|
-
```json
|
|
78
|
-
{
|
|
79
|
-
"compaction": {
|
|
80
|
-
"engine": "lcm",
|
|
81
|
-
"summaryModel": "provider/model",
|
|
82
|
-
"targetContextRatio": 0.75,
|
|
83
|
-
"softThresholdRatio": 0.55,
|
|
84
|
-
"hardThresholdRatio": 0,
|
|
85
|
-
"lcmMaxInputChars": 48000,
|
|
86
|
-
"lcmMaxOutputTokens": 4096,
|
|
87
|
-
"lcmMaxOutputChars": 16384,
|
|
88
|
-
"lcmMaxLeafEntries": 8,
|
|
89
|
-
"lcmMaxCondenseChildren": 4,
|
|
90
|
-
"lcmMaintenancePasses": 8,
|
|
91
|
-
"lcmMaintenanceConcurrency": 3,
|
|
92
|
-
"lcmModelSummaries": true,
|
|
93
|
-
"lcmModelTimeoutSeconds": 120,
|
|
94
|
-
"lcmMaxDailyModelCalls": 0,
|
|
95
|
-
"lcmMaxSessionModelCalls": 0,
|
|
96
|
-
"lcmMaxDailyModelSeconds": 0
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
Legacy persisted `compaction.engine: "fabric"` is migrated to `"lcm"` by the config migration. Unknown engine values normalize to the LCM default. OMP native delegation remains the explicit `"omp"` value.
|
|
102
|
-
|
|
103
|
-
## Verification
|
|
104
|
-
|
|
105
|
-
Focused LCM tests cover ledger durability, canonical payload identity, branch isolation, model budgets, emergency bounds, on-demand session reconciliation, memory provider routing, tree summaries, and handoff continuity. Run:
|
|
106
|
-
|
|
107
|
-
```sh
|
|
108
|
-
bun run check
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
This command includes typecheck, a fresh `dist/` build, the lazy-graph assertion, the full test suite, and dead-code lint.
|
|
112
|
-
|
|
113
|
-
## Occupancy thresholds
|
|
114
|
-
|
|
115
|
-
`softThresholdRatio` is a floor that forces maintenance, not the permission to run it. A pass is due when the active branch carries at least `lcmMaxLeafEntries` uncovered entries, when a claimable job for that branch is waiting, or when context occupancy reaches this ratio. The first two build the summary DAG ahead of need, at any occupancy; the ratio adds the last sweep, so the tail below one leaf is covered before a compaction asks for it. When `getContextUsage()` is missing or reports an unknown percentage the floor counts as reached, so a missing reading never silently disables LCM. At `0` every sync reaches the floor and maintenance runs at any occupancy; both ratio keys use the same `0`-is-off convention. Persistence and bookkeeping are never gated at all: every `agent_end` and `session_compact` reads the session branch back into the ledger and reclaims the jobs whose owner died, whatever the occupancy is. A configured daily or per-session model budget is the ceiling: once it is exhausted no pass is scheduled, so the cap stops spend without burning job attempts.
|
|
116
|
-
|
|
117
|
-
`hardThresholdRatio` is the blocking trigger and is disabled at `0`. A model listed in `thresholds` or `tokenThresholds` uses its own entry; every other model falls back to this ratio when it is above `0`. Normalization keeps an enabled soft ratio strictly below an enabled hard ratio, and rounds the ratio it derives to the 0.05 grid `/fabric settings` offers, so a reconciled value is always selectable there.
|
|
118
|
-
|
|
119
|
-
## Addressed summaries
|
|
120
|
-
|
|
121
|
-
Every summary a compaction serves carries engine-derived addresses beneath each node's text: `address: lcm.summary:<nodeId>` for the node itself, then `sources: lcm.raw:<session>:<entry>:<revision>` for the raw entries it covers, or `children: lcm.summary:<nodeId>` for a condensed node. These are the exact forms `memory.expand` parses, so a model reading a summary can always retrieve what was summarized. They are appended after the frontier walk from ledger data and are never taken from model output. When every block fits, each is rendered complete with its own address. When they do not, the render shares the budget: each node keeps its own text up to an equal share, the nodes under that share keep everything, and the leftover is redistributed to the ones above it, so a 65 KB frontier still reaches the model as ten addressed blocks where it used to reach it as two. A clip's `…` marker sits inside the block text, above its `address:` line. The withheld notice remains for the case where the share would fall under 512 bytes. The withheld notice names what was dropped: `… withheld N frontier nodes that did not fit; expand: lcm.summary:<id>`, listing the addresses it withheld and appending `, +K more` when even that list must truncate. An address list is emitted only when it fits whole, so `sources:` and `children:` lines are never half-written.
|
|
122
|
-
|
|
123
|
-
A leaf counts as oversized when it carries more sources than `max(lcmMaxLeafEntries, 32)`, so lowering that setting cannot mark ordinary leaves oversized while a legacy whole-tail leaf still trips it.
|
|
124
|
-
|
|
125
|
-
An address list keeps the newest addresses and names the older ones it dropped, as `sources: +N older, lcm.raw:…`, because recovery reaches for recent evidence first. In a deterministic excerpt that list is capped at a tenth of the output bound, so provenance never crowds out the text it addresses.
|
|
126
|
-
|
|
127
|
-
The tail order is fixed: the active request block, then block text, the block's `address:` line, its `sources:` or `children:` lines, then the withheld notice when one is needed, then the recent-detail digest, then the recovery pointer. Every non-empty render closes on exactly one recovery pointer line, and a withheld notice sits directly above that pointer with a blank line between them. The render is empty only when no frontier node carries text at all. Every node stays reachable through `memory.expand`; before this, a frontier past 32 KiB lost both the trailing addresses and the pointer.
|
|
128
|
-
|
|
129
|
-
## Maintenance throughput
|
|
130
|
-
|
|
131
|
-
Maintenance runs after every turn inside a long agent run, at `agent_end`, and on session compaction, whenever a pass is due; the hook itself never calls a model. A turn arriving while a run is in flight starts no second run. Each run makes at most `compaction.lcmMaintenancePasses` passes bounded by `compaction.lcmMaintenanceRunSeconds` (60 by default, 10 to 600), and a pass opens up to `compaction.lcmMaintenanceConcurrency` leaves, each packing unconsumed raw entries until either `compaction.lcmMaxLeafEntries` or the `compaction.lcmMaxInputChars` prompt budget is reached, so a leaf never clips its own evidence. One pass therefore covers passes times concurrency leaves worth of backlog. An emergency node whose sources no longer fit one prompt is left as it is: upgrading it would summarize a truncated slice and claim coverage of the whole range.
|
|
132
|
-
|
|
133
|
-
Raise `lcmMaintenancePasses` (1-64) for more leaves per turn. `lcmMaintenanceConcurrency` (1-8, 3 by default) is how many summary calls one run keeps in flight and how many leaves a pass opens, and it decides how much of a backlog a single run can clear. Measured against an 8-job session backlog at 15 seconds per call, a run cleared 4 jobs per turn at 1, and all 8 in one turn at 2 and at 3. Spend per turn scales with the same number, so 3 costs up to three times what 1 costs over the same wall time. A job whose call outlives the run deadline holds its slot until it returns; the deadline stops new dispatch and never abandons work already paid for. Model spend carries no limit by default: `lcmMaxDailyModelCalls`, `lcmMaxSessionModelCalls`, and `lcmMaxDailyModelSeconds` are 0, which means no cap, and setting any of them applies that cap. A summary call is abandoned after `lcmModelTimeoutSeconds` (120 by default, 10 to 900). A deterministic excerpt is written when the summary model cannot be called, when it overruns that deadline, or when `lcmModelSummaries` is false, and maintenance replaces such a node with a model summary once the model answers again. It is separate from `lcmMaxCondenseChildren`, which is the condensation fan-in: how many ready nodes are folded into one condensed parent. The daily project and per-session call, token, cost, and wall-time budgets still bound every run. A claim reserves one call for itself and one for every live sibling lease, so admitted calls stay inside the daily and session call caps. For the token, cost, and wall-time caps it reserves the average consumption per call recorded today. Two cases pay for a call that will be refused: the first calls of a day, where nothing is recorded and the average reserves zero, so the batch is admitted on recorded usage alone, and a call heavier than the recorded mean, which the average understates. In both the call is made, completion refuses its result, and the range falls back to the deterministic excerpt. Recorded usage never passes a cap, because completion re-checks every dimension and refuses a result that would cross it. A lease counts against the cap and against those reservations until 60 seconds after it lapses, the moment the sweep hands its slot back. A worker whose process stalls through the full 90 seconds of lease and reclaim window keeps its call running after its slot is handed on, and its result is refused when it returns: the call is paid for, no usage is recorded, and the job keeps its attempt count. Concurrent calls pass the cap by the number of stalled workers.
|
|
134
|
-
|
|
135
|
-
## Cutting a turn in half
|
|
136
|
-
|
|
137
|
-
A compaction can cut inside a turn, leaving the user request that started it behind the boundary. The summary then opens with that request verbatim under `[Active Request] lcm.raw:<session>:<entry>:<revision>`, so the task in flight survives the cut. The block appears only for a split turn: the host's own `isSplitTurn` decides when it is passed, and otherwise the cut is read as split when the first kept entry is not a user message. A cut at a turn boundary carries no such block, because the request before it is already answered. The block is derived from the session branch, never from model output, and the pure fallback path gives it up to 40% of `lcmMaxOutputChars`.
|
|
138
|
-
|
|
139
|
-
Coverage is partial, not all-or-nothing. Ready summaries render for the range they cover, and the entries no summary covers yet render as `[Recent Detail]`: one line per entry, newest first, carrying user and assistant text, tool calls with their intent, and tool results with their status. The emergency leaf is created over that uncovered tail alone, so it can never grow larger than the model summaries beside it and hide them on the next frontier walk.
|
|
140
|
-
|
|
141
|
-
## Entry identity
|
|
142
|
-
|
|
143
|
-
A stored entry keeps one identity across the rewrites the host performs after the fact. Inline image data is hashed to `blob:sha256:<digest>` so the same picture is one entry before and after the host externalizes it; opaque reasoning signatures, `retryRecovery`, and a zero `errorId` are dropped; and a tool result the host replaced with a pruning notice stays on the revision it replaced. Without this an entry that changed only in those fields gained a revision and was summarized a second time.
|
|
144
|
-
|
|
145
|
-
## Inspecting a live ledger
|
|
146
|
-
|
|
147
|
-
`/fabric status` carries one LCM line: operational state, summary model, entry count, how many ready nodes the model wrote against how many exist, and today's calls and model seconds against their budget.
|
|
148
|
-
|
|
149
|
-
The report carries one reconciled `state` that already accounts for any runtime fault, so a surface that prints it can never place `healthy` beside a fault message. `ledgerState` keeps the ledger's own word, and both renderers print `degraded (ledger healthy)` when the store is intact while the runtime holds a fault. A third surface that prints `state` alone stays truthful without repeating the reconciliation.
|
|
150
|
-
|
|
151
|
-
Every compaction key appears in `/fabric settings` under Compaction. `/fabric lcm` opens a dashboard of its own with four tabs:
|
|
152
|
-
|
|
153
|
-
- `1 health` runs the doctor: one line per check (ledger, session, readback, reconcile, coverage, jobs, model), each naming the evidence it read. A check that can be repaired offers the repair on `r`; `R` runs the first one offered. Repairs are idempotent and report the delta they caused, and the last eight appear under the checks.
|
|
154
|
-
- `2 graph` pages the node graph by depth. `enter` opens a node: its sources, ancestors, children, and the exact stored raw entry behind any source. A node replaced by a model summary keeps its previous text, so an excerpt and the summary that superseded it sit side by side.
|
|
155
|
-
- `3 coverage` draws every stored entry of the branch as one cell, aggregated losslessly when the branch is wider than the terminal, above the text a compaction would serve right now and the session payload it draws from.
|
|
156
|
-
- `4 jobs` lists maintenance jobs failure-first with attempts, error, and retry time. `r` requeues failed jobs; `l` releases expired leases.
|
|
157
|
-
|
|
158
|
-
The header states the verdict (`healthy`, `priming`, `attention`, `degraded`), the project key, live versus stored entry counts, and today's model spend. Each projection is read once per refresh; nothing in the render path touches the ledger.
|
|
159
|
-
|
|
160
|
-
A session whose file the host has not written yet reads `priming`: reconciliation reports the file as absent, and the branch still in memory lands in the ledger on the next message.
|
|
161
|
-
|
|
162
|
-
## Repair
|
|
163
|
-
|
|
164
|
-
The ledger keeps a repair budget per fault class. On every turn boundary the runtime runs at most one repair, preferring a failing check over a warning one, records the attempt, and backs off exponentially from 30 seconds to 8 minutes across the five attempts it is allowed. After the fifth the fault parks and the health tab says so. A budget clears only once its check has been quiet for half an hour, so a repair that keeps resurrecting the same fault still reaches the park. The budget lives in the ledger, so restarting resumes it. `r` on the health tab runs the same repair on demand and ignores the budget.
|
|
165
|
-
|
|
166
|
-
Readback hashes each branch entry and appends only the ones whose payload the session has not stored yet, so it runs on every message and the dashboard never trails the conversation. An entry amended in place gains a revision the same way a fresh one does. Changing session re-reads the whole branch.
|
|
167
|
-
|
|
168
|
-
## Branch isolation
|
|
169
|
-
|
|
170
|
-
A summary is served only when every source it covers is still on the live branch. That set is rebuilt from the session on every readback, so a rewind drops the summaries that covered the abandoned entries on the next sync, and a fork keeps the ones whose sources it inherited.
|
|
171
|
-
|
|
172
|
-
The check is per source. No branch label takes part: summary nodes carry none, and the `branch` column on a stored entry is provenance from the session file, read by nothing.
|
|
173
|
-
|
|
174
|
-
A source is identified by its entry id and the hash of its payload, so the same entry means the same source whatever session stored it. A fork mints a new session id and keeps the entries it inherited, and those entries keep their identity, so its first compaction already serves the summaries the parent built and `memory.expand` opens their raw sources. What the fork rebuilds is condensation: a condensed node groups children from one session, so the fork condenses its own leaves and leaves the parent's alone. A summary the parent left unfinished does not block the fork; only a ready one counts as covering.
|
|
175
|
-
|
|
176
|
-
An earlier design stamped each stored entry with the host's leaf id, which is the id of the newest entry and therefore moves with every message, then filtered the frontier on it. A summary built at one leaf stopped matching one message later and left the frontier for good. On a 5,400-entry production ledger that pinned 106 of 133 nodes behind 36 dead leaf values and held coverage at 2 of 400 sources; the same branch reaches 160 of 400 once the label is out of the way. Ledgers written by that design keep their labels, and nothing reads them, so no migration runs and a leaf window that spans two of them is built like any other.
|
|
177
|
-
|
|
178
|
-
## Ledger identity and retention
|
|
179
|
-
|
|
180
|
-
A project is keyed by the device and inode of its directory, which a rebuild or a remount changes. `projects.json` in the ledger root remembers the key each canonical path was first filed under, so a project that changes inode keeps its history and no empty ledger appears beside it. Once a day, and only when a recorded project directory no longer exists and nothing has written its ledger for 30 days, that ledger is deleted.
|
|
181
|
-
|
|
182
|
-
## Performance gate
|
|
183
|
-
|
|
184
|
-
`bun run benchmark:lcm` drives the fixed fixture from the LCM operational contract: 10 sessions of 1,000 raw entries at 1 KiB each, 20 compaction cycles through the built `session_before_compact` hook, a repeat pass that must reuse the ready frontier, and a second process appending to the same ledger. It fails when a row is lost or duplicated, when a node references an uncommitted source or child, when the hook issues any model call, when hook p95 exceeds 250 ms, when recall precision or exact expansion regresses, or when a restart loses rows or nodes. The run prints and writes a JSON report covering ingest throughput, hook latency percentiles for both the emergency and ready-frontier paths, maintenance backlog, recall and expansion latency, migration counts, database and WAL bytes, checkpoint outcomes, and lock errors observed by the competing process:
|
|
185
|
-
|
|
186
|
-
```sh
|
|
187
|
-
bun run benchmark:lcm -- --out lcm-report.json
|
|
188
|
-
```
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|