trajectories 0.0.0 → 0.1.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.
Files changed (205) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/LICENSE +201 -0
  3. package/README.md +288 -2
  4. package/dist/cli.js +30210 -0
  5. package/dist/convert.d.ts +31 -0
  6. package/dist/convert.js +431 -0
  7. package/dist/deepagents_checkpoint.py +362 -0
  8. package/dist/index.d.ts +7 -0
  9. package/dist/index.js +8402 -0
  10. package/dist/log-baseline.d.ts +26 -0
  11. package/dist/log-baseline.js +104 -0
  12. package/dist/log-content.d.ts +16 -0
  13. package/dist/log-content.js +80 -0
  14. package/dist/log-io.d.ts +10 -0
  15. package/dist/log-io.js +121 -0
  16. package/dist/log-read.d.ts +24 -0
  17. package/dist/log-read.js +117 -0
  18. package/dist/log-reconcile.d.ts +5 -0
  19. package/dist/log-reconcile.js +38 -0
  20. package/dist/log-records.d.ts +35 -0
  21. package/dist/log-records.js +85 -0
  22. package/dist/log-recovery.d.ts +18 -0
  23. package/dist/log-recovery.js +123 -0
  24. package/dist/log-stage.d.ts +14 -0
  25. package/dist/log-stage.js +138 -0
  26. package/dist/log-state.d.ts +89 -0
  27. package/dist/log-state.js +92 -0
  28. package/dist/log-switch.d.ts +3 -0
  29. package/dist/log-switch.js +98 -0
  30. package/dist/log-types.d.ts +129 -0
  31. package/dist/log-types.js +8 -0
  32. package/dist/log.d.ts +8 -0
  33. package/dist/log.js +62 -0
  34. package/dist/migrate.d.ts +29 -0
  35. package/dist/migrate.js +173 -0
  36. package/dist/normalization-runtime.d.ts +1 -0
  37. package/dist/normalization-runtime.js +3150 -0
  38. package/dist/portable.d.ts +9 -0
  39. package/dist/portable.js +26 -0
  40. package/dist/readers/canonical.d.ts +13 -0
  41. package/dist/readers/canonical.js +54 -0
  42. package/dist/readers/cline.d.ts +10 -0
  43. package/dist/readers/cline.js +107 -0
  44. package/dist/readers/cursor.d.ts +20 -0
  45. package/dist/readers/cursor.js +374 -0
  46. package/dist/readers/deepagents.d.ts +41 -0
  47. package/dist/readers/deepagents.js +163 -0
  48. package/dist/readers/fx.d.ts +11 -0
  49. package/dist/readers/fx.js +573 -0
  50. package/dist/readers/github-copilot.d.ts +8 -0
  51. package/dist/readers/github-copilot.js +216 -0
  52. package/dist/readers/grok-build.d.ts +12 -0
  53. package/dist/readers/grok-build.js +391 -0
  54. package/dist/readers/guards.d.ts +4 -0
  55. package/dist/readers/guards.js +121 -0
  56. package/dist/readers/pi-compaction.d.ts +7 -0
  57. package/dist/readers/pi-compaction.js +112 -0
  58. package/dist/readers/pi-context.d.ts +13 -0
  59. package/dist/readers/pi-context.js +64 -0
  60. package/dist/store.d.ts +25 -0
  61. package/dist/store.js +218 -0
  62. package/dist/types.d.ts +91 -0
  63. package/dist/types.js +1 -0
  64. package/dist/writers/claude-code.d.ts +5 -0
  65. package/dist/writers/claude-code.js +51 -0
  66. package/dist/writers/cline.d.ts +3 -0
  67. package/dist/writers/cline.js +77 -0
  68. package/dist/writers/codex.d.ts +3 -0
  69. package/dist/writers/codex.js +32 -0
  70. package/dist/writers/cursor.d.ts +3 -0
  71. package/dist/writers/cursor.js +197 -0
  72. package/dist/writers/deepagents.d.ts +3 -0
  73. package/dist/writers/deepagents.js +116 -0
  74. package/dist/writers/entropy.d.ts +5 -0
  75. package/dist/writers/entropy.js +33 -0
  76. package/dist/writers/fx.d.ts +3 -0
  77. package/dist/writers/fx.js +135 -0
  78. package/dist/writers/github-copilot.d.ts +3 -0
  79. package/dist/writers/github-copilot.js +71 -0
  80. package/dist/writers/grok-build.d.ts +3 -0
  81. package/dist/writers/grok-build.js +43 -0
  82. package/dist/writers/helpers.d.ts +17 -0
  83. package/dist/writers/helpers.js +75 -0
  84. package/dist/writers/omp.d.ts +3 -0
  85. package/dist/writers/omp.js +7 -0
  86. package/dist/writers/opencode.d.ts +3 -0
  87. package/dist/writers/opencode.js +65 -0
  88. package/dist/writers/pi.d.ts +3 -0
  89. package/dist/writers/pi.js +45 -0
  90. package/docs/cline-native-format.md +43 -0
  91. package/docs/copilot-native-format.md +78 -0
  92. package/docs/cursor-native-format.md +103 -0
  93. package/docs/deepagents-native-format.md +98 -0
  94. package/docs/evidence-api.md +170 -0
  95. package/docs/fx-native-format.md +87 -0
  96. package/docs/harness-parity-bootstrap.md +78 -0
  97. package/docs/harness-support-parity.md +107 -0
  98. package/docs/inspirations.md +103 -0
  99. package/docs/ledger-migration.md +141 -0
  100. package/docs/pi-compaction-context.md +75 -0
  101. package/docs/pi-provider-context.md +76 -0
  102. package/docs/research/2026-10-06-huihua-and-oar.md +176 -0
  103. package/docs/research/ledger/README.md +96 -0
  104. package/docs/research/ledger/confer/2026-09-13-round-10/README.md +61 -0
  105. package/docs/research/ledger/confer/2026-09-13-round-2/cass.md +72 -0
  106. package/docs/research/ledger/confer/2026-09-13-round-3/README.md +70 -0
  107. package/docs/research/ledger/confer/2026-09-13-round-5/README.md +61 -0
  108. package/docs/research/ledger/confer/2026-09-13-round-6/README.md +68 -0
  109. package/docs/research/ledger/confer/2026-09-13-round-7/README.md +64 -0
  110. package/docs/research/ledger/confer/2026-09-13-round-9/README.md +59 -0
  111. package/docs/research/ledger/confer/2026-09-14-wake/wake.md +146 -0
  112. package/docs/research/ledger/docs/inspirations.md +320 -0
  113. package/docs/research/ledger/docs/pr2-pr6-integration.md +53 -0
  114. package/docs/research/ledger/docs/research/2026-09-07-confer-inspirations.md +163 -0
  115. package/docs/research/ledger/docs/research/2026-09-07-letta-continuous-service.md +104 -0
  116. package/docs/research/ledger/docs/research/2026-09-08-claude-history-retrieval.md +117 -0
  117. package/docs/research/ledger/docs/research/2026-09-09-agentsview-native-discovery.md +87 -0
  118. package/docs/research/ledger/docs/research/2026-09-09-daemon-observation.md +231 -0
  119. package/docs/research/ledger/docs/research/2026-09-09-discovery-pagination.md +114 -0
  120. package/docs/research/ledger/docs/research/2026-09-09-harness-transcript-contract.md +145 -0
  121. package/docs/research/ledger/docs/research/2026-09-09-native-history-discovery.md +180 -0
  122. package/docs/research/ledger/docs/research/2026-09-09-native-history-implementation.md +137 -0
  123. package/docs/research/ledger/docs/research/2026-09-09-other-inspirations.md +279 -0
  124. package/docs/research/ledger/docs/research/2026-09-09-trajectory-and-letta-code.md +128 -0
  125. package/docs/research/ledger/docs/research/2026-09-13-diagnostics-coverage.md +116 -0
  126. package/docs/research/ledger/docs/research/2026-09-13-fts-rebuild.md +83 -0
  127. package/docs/research/ledger/docs/research/2026-09-13-read-path-split.md +74 -0
  128. package/docs/research/ledger/docs/research/2026-09-13-runtime-rollout.md +102 -0
  129. package/docs/research/ledger/docs/research/2026-09-13-scan-outcomes.md +80 -0
  130. package/docs/research/ledger/docs/research/2026-09-13-search-quality.md +105 -0
  131. package/docs/research/ledger/docs/research/2026-09-13-source-coverage.md +64 -0
  132. package/docs/research/ledger/docs/research/2026-09-13-sync-wall-budget.md +82 -0
  133. package/docs/research/ledger/docs/research/2026-09-13-typed-read-gate.md +81 -0
  134. package/docs/research/ledger/docs/research/2026-09-13-writer-lease.md +84 -0
  135. package/docs/research/ledger/docs/research/2026-09-16-c1-copy-fallback.md +227 -0
  136. package/docs/research/ledger/docs/research/2026-09-16-c10-kimi.md +414 -0
  137. package/docs/research/ledger/docs/research/2026-09-16-c2-derive-counter.md +216 -0
  138. package/docs/research/ledger/docs/research/2026-09-16-c3-echo-filter.md +305 -0
  139. package/docs/research/ledger/docs/research/2026-09-16-c4-title-index.md +349 -0
  140. package/docs/research/ledger/docs/research/2026-09-16-c5-trigram.md +268 -0
  141. package/docs/research/ledger/docs/research/2026-09-16-c6-recency-prior.md +438 -0
  142. package/docs/research/ledger/docs/research/2026-09-16-c7-tombstones.md +467 -0
  143. package/docs/research/ledger/docs/research/2026-09-16-c8-remote-truth.md +390 -0
  144. package/docs/research/ledger/docs/research/2026-09-16-c9-grok.md +380 -0
  145. package/docs/research/ledger/docs/research/2026-09-16-wake-port-program.md +38 -0
  146. package/docs/research/ledger/docs/research/2026-09-17-cursor-blobstore.md +157 -0
  147. package/docs/research/ledger/manifest.json +540 -0
  148. package/legacy/NOTICE.md +50 -0
  149. package/legacy/bin/ledger-core.ts +7 -0
  150. package/legacy/bin/ledger.ts +7 -0
  151. package/legacy/bin/traj-bridge.ts +7 -0
  152. package/legacy/scripts/import-claude-history.ts +130 -0
  153. package/legacy/scripts/native-history-smoke.ts +52 -0
  154. package/legacy/scripts/observe-daemon.ts +570 -0
  155. package/legacy/scripts/retitle-sessions.md +19 -0
  156. package/legacy/scripts/verify-runtime-rollout.ts +151 -0
  157. package/legacy/src/canonical.ts +108 -0
  158. package/legacy/src/cli.ts +1293 -0
  159. package/legacy/src/db.ts +2254 -0
  160. package/legacy/src/diagnostics.ts +87 -0
  161. package/legacy/src/discovery.ts +56 -0
  162. package/legacy/src/embeddings.ts +382 -0
  163. package/legacy/src/filter.ts +602 -0
  164. package/legacy/src/gemini_embeddings.ts +103 -0
  165. package/legacy/src/identity.ts +9 -0
  166. package/legacy/src/index.ts +10 -0
  167. package/legacy/src/ingest.ts +791 -0
  168. package/legacy/src/managed.ts +178 -0
  169. package/legacy/src/native/common.ts +68 -0
  170. package/legacy/src/native/cursor.ts +647 -0
  171. package/legacy/src/native/grok.ts +540 -0
  172. package/legacy/src/native/kimi.ts +706 -0
  173. package/legacy/src/native/opencode.ts +470 -0
  174. package/legacy/src/native/sqlite-ro.ts +281 -0
  175. package/legacy/src/native.ts +97 -0
  176. package/legacy/src/normalizer.ts +457 -0
  177. package/legacy/src/parentage.ts +562 -0
  178. package/legacy/src/pressure.ts +162 -0
  179. package/legacy/src/private-storage.ts +74 -0
  180. package/legacy/src/reader.ts +1255 -0
  181. package/legacy/src/scanner.ts +591 -0
  182. package/legacy/src/schema-gate.ts +263 -0
  183. package/legacy/src/schema.ts +829 -0
  184. package/legacy/src/semantic-top-k.ts +71 -0
  185. package/legacy/src/session-hash.ts +49 -0
  186. package/legacy/src/store-status.ts +218 -0
  187. package/legacy/src/sync-preparation.ts +45 -0
  188. package/legacy/src/sync-truth.ts +843 -0
  189. package/legacy/src/sync.ts +1233 -0
  190. package/legacy/src/types.ts +436 -0
  191. package/legacy/src/vocab.txt +30522 -0
  192. package/legacy/src/watch.ts +673 -0
  193. package/legacy/src/writer-lease.ts +310 -0
  194. package/ops/README.md +150 -0
  195. package/ops/install-cli.sh +63 -0
  196. package/ops/install-native.sh +35 -0
  197. package/ops/install-release.sh +49 -0
  198. package/ops/linux/install-systemd-user.sh +103 -0
  199. package/ops/macos/install-launchd.sh +72 -0
  200. package/ops/sync-settings.sh +37 -0
  201. package/package.json +21 -5
  202. package/skills/trajectories/SKILL.md +138 -0
  203. package/skills/trajectories/scripts/trajectories_recent.sh +26 -0
  204. package/skills/trajectories/scripts/trajectories_search.sh +26 -0
  205. package/index.js +0 -1
@@ -0,0 +1,180 @@
1
+ # Native History Discovery
2
+
3
+ ## Answer
4
+
5
+ **Trajectory's normalized format and Cursor/OpenCode transformations exist.
6
+ Native-store discovery and extraction are the missing steps, not a replacement
7
+ canonical format.** Cass implements native readers for both; Obelisk's registered
8
+ providers implement neither at the inspected revision. This is source research,
9
+ not a claim that Ledger's native-store ingestion has now been fixed.
10
+
11
+ ## Trajectory: prepared input, not arbitrary native storage
12
+
13
+ The inspected `@letta-ai/trajectory` 0.3.0 revision is
14
+ [`21ae92d10579499b183d93929c85da0b91233167`][trajectory-head].
15
+
16
+ - **Cursor:** captured JSONL with `role` and `message.content`, not SQLite or
17
+ arbitrary Cursor JSONL. Canonical normalization needs caller-supplied session
18
+ identity. [Input contract][trajectory-cursor].
19
+ - **OpenCode:** one assembled JSON document containing session `info` and
20
+ `messages`, each with message `info` and `parts`. Separate native rows/files
21
+ must first be assembled into that shape. [Input contract][trajectory-opencode].
22
+ - Both sources deliberately return `listing_unavailable` from
23
+ `listTrajectories()`. [Dispatcher][trajectory-listing].
24
+
25
+ The [preceding contract investigation](2026-09-09-harness-transcript-contract.md)
26
+ also records successful synthetic normalization probes for both sources. These
27
+ prove the prepared-input transformation, not coverage of actual local histories.
28
+
29
+ ## Cass: native readers before its own normalization
30
+
31
+ Fresh `main` inspection resolved Cass to
32
+ [`000301c949df5180c0023ef7f6b19767a0cf9fbc`][cass-head], committed
33
+ 2026-09-09T00:37:44Z. Its Cursor/OpenCode modules now
34
+ [re-export][cass-cursor] [connectors][cass-opencode] from
35
+ `franken-agent-detection`, pinned to exactly **0.2.3** by
36
+ [Cargo.toml][cass-dependency] and [Cargo.lock][cass-lock].
37
+ The published crate's `.cargo_vcs_info.json` and annotated release tag both
38
+ resolve to [`0feebc55fed8db4d596f330742fe11ca4cb70764`][fad-head]; the reader
39
+ links below use that version-matched source, not the dependency's moving main.
40
+ [Published archive][fad-archive], [release tag object][fad-tag].
41
+
42
+ ### Cursor
43
+
44
+ - Finds `state.vscdb` in global/workspace storage, including macOS
45
+ `~/Library/Application Support/Cursor/User/`. Opens read-only; reconstructs
46
+ Composer sessions from `composerData` plus referenced `bubbleId` rows, with
47
+ legacy `ItemTable`/conversation layouts. [Discovery][cass-cursor-roots],
48
+ [database reader][cass-cursor-db], [assembly][cass-cursor-assembly].
49
+ - Separately recognizes
50
+ `~/.cursor/projects/<project>/agent-transcripts/<sid>/<sid>.jsonl` and
51
+ role/message content. It explicitly excludes subagent paths and does not
52
+ decode `agentKv:blob:*`. The source labels this path reporter-documented,
53
+ not verified there against real Cursor data. [Coverage and exclusions][cass-cursor-agent].
54
+
55
+ Thus this is implemented, selective coverage, not every Cursor store or a
56
+ universal export format.
57
+
58
+ ### OpenCode
59
+
60
+ - Reads `opencode.db` and assembles conversations from `session`, `message`,
61
+ and `part` tables. [Layout][cass-opencode-layout],
62
+ [session reader][cass-opencode-db], [message/part loading][cass-opencode-rows].
63
+ - Also assembles legacy `storage/session/<project>/<session>.json`,
64
+ `message/<session>/<message>.json`, and `part/<message>/<part>.json`.
65
+ It starts from session files, not every JSON file under `storage`, and
66
+ deduplicates sessions already read from SQLite. [Selection and dedup][cass-opencode-selection],
67
+ [assembly][cass-opencode-assembly].
68
+
69
+ Both readers emit their own `NormalizedConversation` / `NormalizedMessage`
70
+ types, not Letta Trajectory records. OpenCode content is flattened for search
71
+ and some control parts are discarded, so Cass's output is not a lossless
72
+ native export to pass straight into Trajectory. [Shared types][cass-types],
73
+ [content projection][cass-opencode-content].
74
+
75
+ Cass scope: inspected public source and package metadata; no Cass installation,
76
+ test execution, or private-store scan. Existing
77
+ [licensing cautions](2026-09-09-other-inspirations.md) remain; this is not a
78
+ dependency adoption or permission to reuse implementation code.
79
+
80
+ ## Obelisk: Cursor and OpenCode
81
+
82
+ Audited **2026-09-09, 01:57 UTC**. GitHub's [repository metadata][repo-api] and
83
+ [branch API][branch-api] resolved default branch `main` to
84
+ [`69d9e21a90e55f310376d8f49929b1c16f5a1f0c`][head], committed
85
+ 2026-09-03T10:48:53Z. All source links below pin that revision.
86
+
87
+ **Verdict: neither Cursor nor OpenCode native local-history discovery or
88
+ normalization is implemented by the registered built-in providers.**
89
+ [The exact registration list][builtins], lines 17-23, is `claude`, `codex`,
90
+ `deepseek`, `kimi`, `pi`: Claude Code, Codex, DeepSeek Harness, Kimi Code, and Pi.
91
+ The [registry][registry] enumerates only supplied adapters; the
92
+ [configured runtime][settings] resolves roots from that catalog and reconstructs
93
+ the same built-ins. Adding a directory setting cannot add another source format.
94
+
95
+ Two misleading matches deserve explicit separation:
96
+
97
+ - **Cursor:** [editor integration][editor] builds file-opening URLs using the
98
+ Cursor scheme. It does not discover or decode Cursor history. The contract's
99
+ `Cursor` type means a resume checkpoint, not the Cursor application.
100
+ - **OpenCode:** the [provider-contract introduction][types] mentions it as a
101
+ future source. An [activity-label test][label-test] uses `opencode` to verify
102
+ unknown-provider labeling, not ingestion. Neither occurrence supplies an
103
+ OpenCode adapter.
104
+
105
+ **What native discovery actually does:** adapters read harness-owned history
106
+ directly. For example, [Claude discovery][claude] reads project transcripts and
107
+ history-title metadata; [Codex discovery][codex] scans both active and archived
108
+ JSONL transcript directories, using `session_index.jsonl` for title/update
109
+ metadata rather than message bodies. Discovery and decoding remain
110
+ source-specific, not inferred from a directory's name.
111
+
112
+ **Native-provider contract:** Obelisk defines its own internal
113
+ [`ProviderAdapter` / `TranscriptRecord` contract][types]. An adapter supplies a
114
+ descriptor/default root, watch targets, discovery, parsing, and raw-record
115
+ lookup. `discover(ctx)` returns `IndexUnit` work items with stable keys, session
116
+ identity, and opaque metadata. Context supplies previous cursors, optional
117
+ changed paths, indexed-session provenance, and incomplete-inventory reporting.
118
+ `parse(unit, cursor)` yields canonical session, message, tool, summary, subagent,
119
+ workflow, and update/retraction records, then returns its next opaque checkpoint.
120
+ The [shared indexing caller][indexing] invokes registered adapters and persists
121
+ their records into SQLite. The contract allows non-file work units, including
122
+ database-backed sources; that extensibility is not implemented Cursor/OpenCode
123
+ support.
124
+
125
+ Scope: public-source inspection only, no clone or runtime verification, and no
126
+ private transcripts, databases, or secrets accessed. Under the AGPL-3.0 boundary,
127
+ this note records behavior only; no upstream code was copied, vendored, or derived.
128
+
129
+ ## Ledger implication
130
+
131
+ The [current scanner](https://github.com/archeism/ledger/blob/43081aef54c23b4bd017b6c0e11fc42a9a1cb381/packages/core/src/scanner.ts) walks Cursor JSONL
132
+ and OpenCode JSON by extension. It neither reads these SQLite layouts nor
133
+ assembles OpenCode's split native records. Finding telemetry or `session_diff`
134
+ files does not make them valid conversation inputs.
135
+
136
+ **Proposed boundary, not implemented here:** native discovery and read-only
137
+ extraction/assembly, followed by a validated Trajectory input, canonical
138
+ normalization, and durable Ledger ingestion. Matching Cursor Agent JSONL may
139
+ already fit the input shape; SQLite histories need a deliberate projection.
140
+ Retain native evidence and identities instead of routing through Cass's flattened
141
+ search text. Use source-specific candidate validation, explicit unsupported or
142
+ incomplete coverage, and bounded regression fixtures for native-store versions.
143
+
144
+ No runtime code, daemon, database, or ingestion state was changed by this note.
145
+
146
+ [trajectory-head]: https://github.com/letta-ai/trajectory/commit/21ae92d10579499b183d93929c85da0b91233167
147
+ [trajectory-cursor]: https://github.com/letta-ai/trajectory/blob/21ae92d10579499b183d93929c85da0b91233167/src/adapters/cursor/README.md#L3-L27
148
+ [trajectory-opencode]: https://github.com/letta-ai/trajectory/blob/21ae92d10579499b183d93929c85da0b91233167/src/adapters/opencode/README.md#L3-L37
149
+ [trajectory-listing]: https://github.com/letta-ai/trajectory/blob/21ae92d10579499b183d93929c85da0b91233167/src/listing.ts#L63-L97
150
+ [cass-head]: https://github.com/Dicklesworthstone/coding_agent_session_search/commit/000301c949df5180c0023ef7f6b19767a0cf9fbc
151
+ [cass-cursor]: https://github.com/Dicklesworthstone/coding_agent_session_search/blob/000301c949df5180c0023ef7f6b19767a0cf9fbc/src/connectors/cursor.rs#L1-L5
152
+ [cass-opencode]: https://github.com/Dicklesworthstone/coding_agent_session_search/blob/000301c949df5180c0023ef7f6b19767a0cf9fbc/src/connectors/opencode.rs#L1-L5
153
+ [cass-dependency]: https://github.com/Dicklesworthstone/coding_agent_session_search/blob/000301c949df5180c0023ef7f6b19767a0cf9fbc/Cargo.toml#L137
154
+ [cass-lock]: https://github.com/Dicklesworthstone/coding_agent_session_search/blob/000301c949df5180c0023ef7f6b19767a0cf9fbc/Cargo.lock#L1882-L1886
155
+ [fad-head]: https://github.com/Dicklesworthstone/franken_agent_detection/commit/0feebc55fed8db4d596f330742fe11ca4cb70764
156
+ [fad-archive]: https://static.crates.io/crates/franken-agent-detection/franken-agent-detection-0.2.3.crate
157
+ [fad-tag]: https://api.github.com/repos/Dicklesworthstone/franken_agent_detection/git/tags/38662916851d9c5438fae5bfbe622fb958b7aca8
158
+ [cass-cursor-roots]: https://github.com/Dicklesworthstone/franken_agent_detection/blob/0feebc55fed8db4d596f330742fe11ca4cb70764/src/connectors/cursor.rs#L90-L257
159
+ [cass-cursor-db]: https://github.com/Dicklesworthstone/franken_agent_detection/blob/0feebc55fed8db4d596f330742fe11ca4cb70764/src/connectors/cursor.rs#L478-L555
160
+ [cass-cursor-assembly]: https://github.com/Dicklesworthstone/franken_agent_detection/blob/0feebc55fed8db4d596f330742fe11ca4cb70764/src/connectors/cursor.rs#L558-L645
161
+ [cass-cursor-agent]: https://github.com/Dicklesworthstone/franken_agent_detection/blob/0feebc55fed8db4d596f330742fe11ca4cb70764/src/connectors/cursor.rs#L911-L1010
162
+ [cass-opencode-layout]: https://github.com/Dicklesworthstone/franken_agent_detection/blob/0feebc55fed8db4d596f330742fe11ca4cb70764/src/connectors/opencode.rs#L1-L10
163
+ [cass-opencode-db]: https://github.com/Dicklesworthstone/franken_agent_detection/blob/0feebc55fed8db4d596f330742fe11ca4cb70764/src/connectors/opencode.rs#L475-L608
164
+ [cass-opencode-rows]: https://github.com/Dicklesworthstone/franken_agent_detection/blob/0feebc55fed8db4d596f330742fe11ca4cb70764/src/connectors/opencode.rs#L611-L780
165
+ [cass-opencode-selection]: https://github.com/Dicklesworthstone/franken_agent_detection/blob/0feebc55fed8db4d596f330742fe11ca4cb70764/src/connectors/opencode.rs#L1026-L1116
166
+ [cass-opencode-assembly]: https://github.com/Dicklesworthstone/franken_agent_detection/blob/0feebc55fed8db4d596f330742fe11ca4cb70764/src/connectors/opencode.rs#L1333-L1451
167
+ [cass-types]: https://github.com/Dicklesworthstone/coding_agent_session_search/blob/000301c949df5180c0023ef7f6b19767a0cf9fbc/src/connectors/mod.rs#L11-L24
168
+ [cass-opencode-content]: https://github.com/Dicklesworthstone/franken_agent_detection/blob/0feebc55fed8db4d596f330742fe11ca4cb70764/src/connectors/opencode.rs#L1481-L1521
169
+ [repo-api]: https://api.github.com/repos/tommy0103/obelisk
170
+ [branch-api]: https://api.github.com/repos/tommy0103/obelisk/branches/main
171
+ [head]: https://github.com/tommy0103/obelisk/commit/69d9e21a90e55f310376d8f49929b1c16f5a1f0c
172
+ [builtins]: https://github.com/tommy0103/obelisk/blob/69d9e21a90e55f310376d8f49929b1c16f5a1f0c/packages/core/src/providers/builtins.ts#L13-L23
173
+ [registry]: https://github.com/tommy0103/obelisk/blob/69d9e21a90e55f310376d8f49929b1c16f5a1f0c/packages/core/src/providers/registry.ts#L20-L49
174
+ [settings]: https://github.com/tommy0103/obelisk/blob/69d9e21a90e55f310376d8f49929b1c16f5a1f0c/packages/core/src/provider-settings.ts#L98-L138
175
+ [editor]: https://github.com/tommy0103/obelisk/blob/69d9e21a90e55f310376d8f49929b1c16f5a1f0c/app/src/main/file-reference.ts#L7-L82
176
+ [types]: https://github.com/tommy0103/obelisk/blob/69d9e21a90e55f310376d8f49929b1c16f5a1f0c/packages/core/src/providers/types.ts#L4-L320
177
+ [label-test]: https://github.com/tommy0103/obelisk/blob/69d9e21a90e55f310376d8f49929b1c16f5a1f0c/tests/app-activity-ledger.test.mjs#L73-L75
178
+ [claude]: https://github.com/tommy0103/obelisk/blob/69d9e21a90e55f310376d8f49929b1c16f5a1f0c/packages/core/src/providers/claude.ts#L80-L137
179
+ [codex]: https://github.com/tommy0103/obelisk/blob/69d9e21a90e55f310376d8f49929b1c16f5a1f0c/packages/core/src/providers/codex.ts#L77-L151
180
+ [indexing]: https://github.com/tommy0103/obelisk/blob/69d9e21a90e55f310376d8f49929b1c16f5a1f0c/packages/core/src/provider-indexing.ts#L201-L279
@@ -0,0 +1,137 @@
1
+ # Native History Implementation Verification
2
+
3
+ ## Scope And Status
4
+
5
+ Implemented in `feat/native-history-discovery`, based on PR7's
6
+ `6782d5575b017eefa35b7714f92c40ce8c690220`, in an isolated worktree. The running
7
+ daemon checkout and its Ledger database were not changed or restarted. This is
8
+ implementation acceptance, not a deployed full-corpus backfill.
9
+
10
+ The other inspiration is **AgentsView**, alongside Cass and Obelisk. Its
11
+ [pinned native-reader audit](2026-09-09-agentsview-native-discovery.md) supplied
12
+ format and operational evidence. Native readers were independently implemented;
13
+ no upstream reader code was copied and no dependency was added. The installed
14
+ `@letta-ai/trajectory` 0.3.0 remains the canonical normalizer.
15
+
16
+ | Source | Discovery and assembly |
17
+ | --- | --- |
18
+ | Cursor captures | Validated `role` / `message.content` JSONL, flat or nested including `subagents/`; existing incremental JSONL importer retained. |
19
+ | Cursor IDE | Global/workspace `state.vscdb`; Composer headers joined to bubble IDs, supported inline maps, legacy ItemTable tabs with proved native IDs. Text, reasoning and structured tools are projected into capture JSONL. |
20
+ | OpenCode SQLite | `opencode.db` and channel databases; one native session joined to ordered messages and parts, including native IDs, parent ID, timestamps and structured tool state. |
21
+ | OpenCode legacy | `storage/session/<project>/<id>.json`, `storage/message/<id>/*.json`, `storage/part/<message>/*.json`; assembled export JSON is also accepted in curated roots. |
22
+
23
+ ## Invariants
24
+
25
+ - SQLite is opened read-only and session assembly uses a single deferred read
26
+ transaction. Size/count checks precede payload fetches. Defaults are 64 MiB
27
+ per assembled native session and 100,000 input records. These are input/output
28
+ bounds, not a bound on SQLite parser memory or total process RSS.
29
+ - Cursor extraction selects chat fields, not credential-bearing Composer fields.
30
+ OpenCode native-root discovery skips auth/config/token files, extension/cache
31
+ trees and symlinks before opening candidates. Native stores are never copied
32
+ wholesale into the repository or mutated by ingestion.
33
+ - DB, WAL and rollback-journal file identities invalidate native snapshots;
34
+ SHM does not. Legacy fingerprints include message/part files and directories,
35
+ detecting additions and deletions without a session-metadata timestamp change.
36
+ - Source changes during normalization discard the candidate before commit.
37
+ Native build uses the same guarded ingestion path as watch, rather than
38
+ retaining a batch of prepared native sessions across embedding awaits.
39
+ - Shared SQLite paths are not replacement identities. Native session/bubble/
40
+ message/part IDs remain source-scoped. Content hash hits refresh metadata and
41
+ provenance without replacing records. Explicit parentless snapshot evidence
42
+ cannot fall through to a second database read.
43
+ - Failed native assembly preserves previously committed records. Deterministic
44
+ failures are cached for that snapshot and byte limit; repair or a raised limit
45
+ makes the source eligible again. Transient lock/read failures remain retryable.
46
+ - Within the discovered page, native watch imports rotate by oldest attempt so
47
+ a frequently changing newest session cannot starve older candidates.
48
+
49
+ ## Verification
50
+
51
+ Baseline: `bun test` reported **184 passed, 0 failed**, 1,108 assertions across
52
+ 19 files. Final parent-run gates on Bun 1.4.0:
53
+
54
+ - `bun test`: **245 passed, 0 failed**, 1,478 assertions across 23 files, 17.13 s.
55
+ - `bun run typecheck`: passed.
56
+ - `bun run build`: passed, including TypeScript checking.
57
+ - `git diff --check`: passed.
58
+
59
+ An earlier full run was 244 passed / 1 failed: the new embedding-retry test
60
+ queried with the parent process's default provider, while the CLI fixture wrote
61
+ vectors for its isolated two-dimensional provider. Aligning and restoring the
62
+ test provider fixed the assertion; the subsequent full run above passed. This
63
+ was a test-isolation correction, not a hidden runtime embedding failure.
64
+
65
+ Regression coverage includes shared-container isolation, WAL-only updates,
66
+ stable record IDs, FTS replacement, legacy child-file additions, size/schema/
67
+ identity failures, repaired-source retry, transient locks, source changes during
68
+ normalization, metadata refresh, parentage, watch fairness and native CLI build
69
+ racing a newer import. The new discovery, metadata and parentage tests were
70
+ observed failing before their fixes.
71
+
72
+ Live-store checks use `packages/core/scripts/native-history-smoke.ts`, not the
73
+ daemon database. It considers at most three candidates, caps each assembled
74
+ session at 8 MiB, disables embedding, prints aggregate counts only, and deletes
75
+ its private temporary SQLite store afterward. A metadata-only session is not
76
+ accepted as a successful conversation import. Example from `packages/core`:
77
+
78
+ ```sh
79
+ bun scripts/native-history-smoke.ts opencode "$HOME/.local/share/opencode/opencode.db"
80
+ bun scripts/native-history-smoke.ts cursor "$HOME/Library/Application Support/Cursor/User/globalStorage/state.vscdb"
81
+ ```
82
+
83
+ Both final live-smoke commands exited 0. Each discovered three candidates and
84
+ successfully imported the first into its own temporary database:
85
+
86
+ | Source | Canonical records | Idempotence and coverage |
87
+ | --- | --- | --- |
88
+ | Cursor | 266: meta 1, user 37, reasoning 67, assistant 51, assistant-tool-call 55, tool 55 | No duplicate IDs; second ingest unchanged; `sessionNeedsIngest` false. Discovery also reported 113 incomplete-evidence and 48 invalid-metadata diagnostics from other entries. No all-Cursor coverage claim. |
89
+ | OpenCode | 2: meta 1, user 1 | Current pending conversation retained; no duplicate IDs; second ingest unchanged; `sessionNeedsIngest` false. No discovery diagnostics in this bounded probe. |
90
+
91
+ These are small functional acceptance samples, not capacity or performance
92
+ benchmarks. No full backfill or daemon deployment was performed. The running
93
+ checkout remained clean at `6a33ca80e921040981114bf3a94e9995566a0f15`.
94
+
95
+ Initial real-store attempts exposed two fixture gaps. OpenCode persisted a
96
+ message before its parts; retaining the empty message envelope avoids discarding
97
+ the rest of that session. Cursor's empty-text rows included reasoning-only
98
+ `thinking.text` bubbles and explicit `isPlaceholder: true` bubbles. Reasoning is
99
+ preserved; explicit empty placeholders retain their source position. Arbitrary
100
+ malformed or missing referenced bubbles still fail rather than silently truncate.
101
+ Only shapes/counts, not private transcript text or credential values, were used
102
+ in the investigation output. Synthetic regressions cover the observed shapes.
103
+
104
+ ### WAL Watch Regression
105
+
106
+ - Initial attempts at `a direct database watch observes WAL changes without
107
+ periodic reconciliation` timed out after five seconds. The SQLite writer ran
108
+ in the same Bun test process. Fingerprints changed and the WAL-only
109
+ `sessionNeedsIngest` regression passed, but these attempts produced no observed
110
+ filesystem events or watcher `onEvent`, despite explicit database/WAL/journal
111
+ file watches and a 50 ms setup wait.
112
+ - The revised regression passed when another Bun process performed the SQLite
113
+ update, matching the harness/daemon process boundary. `reconcileMs: 0` excluded
114
+ periodic reconciliation as the mechanism delivering this fixture's update.
115
+ - A separate raw filesystem-watch probe observed some events. No root cause was
116
+ established for the same-process fixture failures; the passing revision does
117
+ not establish complete filesystem-event delivery across environments.
118
+ - Explicit database/WAL/journal watchers and the 50 ms setup wait were retained;
119
+ temporary tracing was removed. The production periodic reconciliation floor
120
+ remains unchanged.
121
+
122
+ ## Remaining Boundaries
123
+
124
+ - Cursor TXT captures, opaque `agentKv` / `store.db` payloads, unsupported native
125
+ layouts and attachment-only content are not claimed as supported. Discovery
126
+ diagnostics distinguish unsupported/incomplete input from no available history.
127
+ - Native SQLite freshness conservatively invalidates the whole container. It
128
+ does not yet have AgentsView-style per-session content digests. The scan page
129
+ defaults to 1,000 candidates per source; rotation is only within that page.
130
+ Full coverage, large-store capacity and fair pagination remain unverified.
131
+ - Filesystem events are best-effort; the production periodic reconciliation
132
+ floor remains necessary. No guarantee follows from one passing watcher test.
133
+ - Canonical projection is not lossless raw archival. Auxiliary fields and
134
+ unsupported control parts can be omitted by the normalizer. This work does
135
+ not restore history already deleted by a harness or coordinate all writers.
136
+ - Legacy JSONL build behavior outside the new native branch is unchanged;
137
+ native acceptance is not a claim that every older build path is bounded.
@@ -0,0 +1,279 @@
1
+ # Other inspirations: source refresh, 2026-09-09
2
+
3
+ ## Outcome
4
+
5
+ Keep the existing normalization dependency. The smallest useful follow-ups are:
6
+ retained source generations, participating-writer ownership around atomic
7
+ ingestion, fair resumable backfill, and an evidence-bearing agent search envelope.
8
+ These are proposed Ledger changes, not guarantees inherited from another project.
9
+
10
+ PR2 and PR6 are both merged in main at
11
+ `56b51e2b76d8d37f749bb114f5b73f1e40164cf9`. The
12
+ [integration report](../pr2-pr6-integration.md) records schema-6 migration,
13
+ atomic cursors, staged replacements and bounded JSONL ingestion as tested
14
+ contracts. Preserve that implementation; the remaining adaptations below extend
15
+ it rather than reopening the superseded integration findings.
16
+
17
+ ## Scope and reproducibility
18
+
19
+ Read [inspirations](../inspirations.md) and the
20
+ [September 7 review](2026-09-07-confer-inspirations.md), then inspected primary
21
+ source and test ranges at the following GitHub commits on September 9, CST.
22
+ Loaded the Confer skill and checked the callable tool inventory and registrar.
23
+ `confer_shell` was unavailable in this session, so the refresh used GitHub
24
+ commit, compare, tree and contents APIs. No queue job or local clones were used.
25
+ There is no new Confer snapshot ID; the immutable GitHub pins are the evidence.
26
+ This document update refreshes only the Ledger comparison to merged code; it
27
+ does not perform new upstream research or change the upstream pins.
28
+
29
+ | Repository | September 7 pin | Refresh pin | Repository delta |
30
+ | --- | --- | --- | --- |
31
+ | dicklesworthstone/coding_agent_session_search, called `cass` in Confer | `a18a6261a9815204b6ef59f9d186370ebd35dc34` | `e5a492b47bfeef8400e326a8fa03b2870dc0dc87` | 46 commits ahead |
32
+ | kenn-io/agentsview | `2298453833a5c5126a486a2554eac6c35cd2b55f` | `b95262043e49c20108b73f825b3bb26cbf591b58` | 13 commits ahead |
33
+ | tommy0103/obelisk | `69d9e21a90e55f310376d8f49929b1c16f5a1f0c` | `69d9e21a90e55f310376d8f49929b1c16f5a1f0c` | Unchanged |
34
+ | vercel/ai | `c3c189c068baefe62808b4eca5432fe092dc37cb` | `46cea633cf7286386eb4e70f9c04413c57723d35` | 15 commits ahead |
35
+
36
+ GitHub blob-ID comparisons found the previously cited Cass
37
+ `src/indexer/lexical_reconcile.rs`, AgentsView
38
+ `internal/recall/extract/manager.go`, and AI
39
+ `packages/harness/src/utils/sandbox-channel.ts` unchanged between their old and
40
+ new pins. Freshly verified does not mean newly implemented.
41
+
42
+ This pass did not inspect private transcript bodies, credentials or runtime
43
+ databases; execute models; run upstream or Ledger tests; or measure performance.
44
+ Trajectory and Letta Code are owned by the separate research worker and are not
45
+ re-researched here. No implementation or upstream source was copied into Ledger.
46
+
47
+ ## Ledger comparison baseline
48
+
49
+ Final merged main: `56b51e2b76d8d37f749bb114f5b73f1e40164cf9` (PR6 merge),
50
+ including PR2 merge `7fe199ce9d62e4a9e966aff18b7c33eda917ac40`.
51
+ The follow-up branch contains this main commit. The
52
+ [pinned integration report](https://github.com/archeism/ledger/blob/56b51e2b76d8d37f749bb114f5b73f1e40164cf9/docs/pr2-pr6-integration.md)
53
+ identifies implementation commit `9f52f8a` and records these verified contracts:
54
+
55
+ - **Schema and identity:** schema 6 distinguishes main-v3, PR2 identity-v4 and
56
+ PR6 parentage-v4/cursor-v5 layouts by shape. Migration preserves source-scoped
57
+ sessions, records, FTS, embeddings, parent links and recovered prompt-history
58
+ identities without double-prefixing. The conflicting v4 meanings are resolved
59
+ integration history, not an outstanding migration proposal.
60
+ - **Atomic ingestion and replacement:** [records and cursors commit together](https://github.com/archeism/ledger/blob/56b51e2b76d8d37f749bb114f5b73f1e40164cf9/packages/core/src/db.ts#L475-L494).
61
+ Existing sessions remain searchable while a replacement is staged, including
62
+ after restart. [Completed promotion](https://github.com/archeism/ledger/blob/56b51e2b76d8d37f749bb114f5b73f1e40164cf9/packages/core/src/db.ts#L556-L618)
63
+ is transactional and streams staged records in bounded batches. This protects
64
+ recall during rebuilding, not every historical source generation afterward.
65
+ - **JSONL continuity and limits:** [defaults are a 1 MiB chunk target and a 64 MiB
66
+ individual-record ceiling](https://github.com/archeism/ledger/blob/56b51e2b76d8d37f749bb114f5b73f1e40164cf9/packages/core/src/ingest.ts#L11-L31).
67
+ Precise file identity and prefix hashes validate continuity. Incomplete lines
68
+ do not advance progress; oversized rows warn without consumption. Raising the
69
+ configured ceiling or ingestion version retries cached failures. These input
70
+ limits are not peak-RSS guarantees.
71
+ - **Lineage and ordering:** source-snapshot-bound Claude classification, including
72
+ a sidechain-only first chunk, source-backed parent corrections, whitespace
73
+ rejection, native OMP identities and diagnostic routing have regressions.
74
+ Cursor/Copilot ordering uses verified prefix line counts without changing
75
+ canonical record identities or byte anchors.
76
+ - **Watch and discovery:** [startup/periodic reconciliation and asynchronous
77
+ shutdown drain](https://github.com/archeism/ledger/blob/56b51e2b76d8d37f749bb114f5b73f1e40164cf9/packages/core/src/watch.ts#L190-L255),
78
+ missed-root discovery, import budgets, append events and enrichment warnings
79
+ are covered. [Discovery paginates upstream 1,000-item pages](https://github.com/archeism/ledger/blob/56b51e2b76d8d37f749bb114f5b73f1e40164cf9/packages/core/src/scanner.ts#L52-L80).
80
+ Pagination and a per-tick budget are not a durable fairness frontier.
81
+
82
+ The integration report records `bun test`: **152 passed, 0 failed, 959 assertions
83
+ across 17 files**, and `bun run typecheck` passed. These were bounded synthetic
84
+ store tests, not broad personal-history normalization. This documentation update
85
+ checked the report and final source; it did not rerun that suite or observe a
86
+ daemon. Runtime installation and observation remain separate evidence.
87
+
88
+ The earlier [PR6 ingest findings at `1efa46d`](https://github.com/archeism/ledger/blob/1efa46d9ac7164f2c32b2a47957b6ea732322f8d/packages/core/src/ingest.ts#L95-L217)
89
+ about mtime/size-only skipping and separately persisted cursors no longer describe
90
+ the merged path. Remaining limits from the report still apply: this is a mutable
91
+ snapshot index, non-JSONL adapters may read whole inputs, changed-source prefix
92
+ verification and session hashing require history-linear work, and first-chunk
93
+ metadata/synthesized timestamps do not universally match whole-file normalization.
94
+
95
+ ## Refreshed source findings
96
+
97
+ ### AgentsView: capture, checkpoints and ownership are separate boundaries
98
+
99
+ The [raw-file capture path](https://github.com/kenn-io/agentsview/blob/b95262043e49c20108b73f825b3bb26cbf591b58/internal/rawcapture/files.go#L160-L259)
100
+ copies into a temporary object, hashes and syncs it, and revalidates the source
101
+ handle/path and digest. [Capture publication](https://github.com/kenn-io/agentsview/blob/b95262043e49c20108b73f825b3bb26cbf591b58/internal/rawcheckpoint/outbox.go#L655-L790)
102
+ checks reservation ownership and predecessor identity, then records the
103
+ generation, object references and source progress in one write transaction.
104
+ This is stronger evidence than a watcher notification or an updated mtime.
105
+ Its outbox and garbage-collection policy are not Ledger's perpetual retention
106
+ policy; borrow the publication boundary, not assumed archive semantics.
107
+
108
+ New [parser-checkpoint validation](https://github.com/kenn-io/agentsview/blob/b95262043e49c20108b73f825b3bb26cbf591b58/internal/sync/checkpoint.go#L115-L232)
109
+ compares the committed database prefix, source identity, size and tail anchor
110
+ before resuming. Checkpoint/hash state is loaded lazily for append. The fast path
111
+ uses append-trust assumptions, not a proof that every old byte is unchanged;
112
+ the [audit worker](https://github.com/kenn-io/agentsview/blob/b95262043e49c20108b73f825b3bb26cbf591b58/cmd/agentsview/sync_worker.go#L191-L205)
113
+ bypasses that shortcut for content verification. The
114
+ [review regression suite](https://github.com/kenn-io/agentsview/blob/b95262043e49c20108b73f825b3bb26cbf591b58/internal/sync/checkpoint_review_test.go#L192-L320)
115
+ contains stale-checkpoint and cold-restart cases; this pass read, but did not run,
116
+ them.
117
+
118
+ [Writable open](https://github.com/kenn-io/agentsview/blob/b95262043e49c20108b73f825b3bb26cbf591b58/cmd/agentsview/main.go#L1382-L1406)
119
+ acquires ownership before opening the database. Its
120
+ [worker handoff](https://github.com/kenn-io/agentsview/blob/b95262043e49c20108b73f825b3bb26cbf591b58/cmd/agentsview/worker_pass.go#L228-L297)
121
+ closes the writer, releases ownership and reacquires it before reopening.
122
+ [Periodic reconciliation and the separate audit](https://github.com/kenn-io/agentsview/blob/b95262043e49c20108b73f825b3bb26cbf591b58/cmd/agentsview/main.go#L2660-L2704)
123
+ are distinct work. Neither an in-process mutex nor an OS supervisor alone gives
124
+ every CLI and daemon writer this ownership protocol.
125
+
126
+ ### Cass: describe incomplete answers and validate the served index
127
+
128
+ The new [hollow-generation verdict](https://github.com/dicklesworthstone/coding_agent_session_search/blob/e5a492b47bfeef8400e326a8fa03b2870dc0dc87/src/search/asset_state.rs#L1517-L1553)
129
+ compares live-document metadata with a completed, compatible rebuild checkpoint.
130
+ Missing evidence gives no verdict; a severe deficit invalidates readiness.
131
+ The [GH457 regression](https://github.com/dicklesworthstone/coding_agent_session_search/blob/e5a492b47bfeef8400e326a8fa03b2870dc0dc87/tests/gh457_hollow_generation.rs#L165-L286)
132
+ constructs a near-empty published index while its checkpoint still looks complete.
133
+ This is a useful failure case, not comprehensive content-integrity verification.
134
+
135
+ The [search cursor manifest](https://github.com/dicklesworthstone/coding_agent_session_search/blob/e5a492b47bfeef8400e326a8fa03b2870dc0dc87/src/lib.rs#L33623-L33765)
136
+ exposes exact versus lower-bound counts, returned counts, field projection,
137
+ truncation, partial index state and requested versus realized retrieval mode.
138
+ The cursor itself encodes offset/limit, not a query-bound immutable snapshot.
139
+ Its continuation caveats should not be upgraded into a snapshot guarantee.
140
+ The earlier [source-shape recovery check](https://github.com/dicklesworthstone/coding_agent_session_search/blob/e5a492b47bfeef8400e326a8fa03b2870dc0dc87/src/indexer/lexical_reconcile.rs#L213-L262)
141
+ is unchanged and is still not a cryptographic source-content identity.
142
+
143
+ ### Obelisk: behavioral reference only
144
+
145
+ At the unchanged pin, the [writer lease](https://github.com/tommy0103/obelisk/blob/69d9e21a90e55f310376d8f49929b1c16f5a1f0c/packages/core/src/writer-lease.ts#L54-L93)
146
+ and [provider persistence callbacks](https://github.com/tommy0103/obelisk/blob/69d9e21a90e55f310376d8f49929b1c16f5a1f0c/packages/core/src/provider-indexing.ts#L254-L300)
147
+ make ownership and commit ordering explicit. The
148
+ [subagent/workflow record types](https://github.com/tommy0103/obelisk/blob/69d9e21a90e55f310376d8f49929b1c16f5a1f0c/packages/core/src/providers/types.ts#L150-L203)
149
+ represent contributors arriving in different orders, with optional evidence.
150
+ The [Codex projection](https://github.com/tommy0103/obelisk/blob/69d9e21a90e55f310376d8f49929b1c16f5a1f0c/packages/core/src/providers/codex.ts#L174-L226)
151
+ folds child messages under a parent session while retaining an agent identity.
152
+ That projection is not a requirement to collapse Ledger's canonical child IDs.
153
+ No code, SQL, implementation structure or dependency is adopted from Obelisk.
154
+
155
+ ### AI Harnesses: replay identity is not archival commitment
156
+
157
+ The repository delta includes Pi's [filesystem round-trip identity probe](https://github.com/vercel/ai/blob/46cea633cf7286386eb4e70f9c04413c57723d35/packages/harness-pi/src/pi-session.ts#L285-L314),
158
+ not a new durable capture contract. The existing
159
+ [bridge log](https://github.com/vercel/ai/blob/46cea633cf7286386eb4e70f9c04413c57723d35/packages/harness/src/bridge/index.ts#L437-L519)
160
+ mirrors events to disk asynchronously, suppresses append failures and retains a
161
+ turn-scoped replay log. [Monotonic sequence/replay](https://github.com/vercel/ai/blob/46cea633cf7286386eb4e70f9c04413c57723d35/packages/harness/src/bridge/index.ts#L581-L603)
162
+ is useful consumer input identity, not proof of committed Ledger storage.
163
+ [Suspension](https://github.com/vercel/ai/blob/46cea633cf7286386eb4e70f9c04413c57723d35/packages/harness/src/utils/sandbox-channel.ts#L289-L325)
164
+ freezes delivery without cancelling the bridge turn; a pinned checkpoint may
165
+ cause an already-delivered tail to replay.
166
+
167
+ The [disk-replay test](https://github.com/vercel/ai/blob/46cea633cf7286386eb4e70f9c04413c57723d35/packages/harness/src/bridge/disk-replay.integration.test.ts#L62-L145)
168
+ checks tail replay after the log has been written, not survival of every
169
+ unflushed event. Claude's adapter [drops messages with a parent tool-use ID](https://github.com/vercel/ai/blob/46cea633cf7286386eb4e70f9c04413c57723d35/packages/harness-claude-code/src/bridge/create-emit-stream-event.ts#L213-L218).
170
+ Native-source capture remains necessary for child execution evidence.
171
+
172
+ ## Four minimal adaptations and test gates
173
+
174
+ ### 1. Retain evidence before advancing capture progress
175
+
176
+ Start with one JSONL source: retain a captured snapshot or bounded captured
177
+ chunks, digest and source-generation identity before normalization progress can
178
+ advance. Replacements must create attributable generations, not erase prior
179
+ evidence. Keep search rebuildable. The merged
180
+ [staging tables](https://github.com/archeism/ledger/blob/56b51e2b76d8d37f749bb114f5b73f1e40164cf9/packages/core/src/schema.ts#L97-L125)
181
+ retain canonical replacement records until promotion, not raw bytes or historical
182
+ generations after promotion. Prefix hashes do not supply that retention boundary.
183
+ Use AgentsView's capture-publication behavior as the implementation reference,
184
+ without importing its replication/outbox subsystem.
185
+
186
+ Gate: synthetic truncation, same-size rewrite, replacement before append,
187
+ mutation during capture, duplicate import, and crash between object installation
188
+ and metadata publication. Delete the synthetic original and rebuild search from
189
+ retained evidence. Check object and directory durability where applicable.
190
+ See the [upstream replacement fixtures](https://github.com/kenn-io/agentsview/blob/b95262043e49c20108b73f825b3bb26cbf591b58/internal/rawcapture/capturer_test.go#L976-L1058).
191
+ Define explicit deletion, exclusion and capacity behavior; source disappearance
192
+ is not authorization to erase captured history.
193
+
194
+ ### 2. Add participating-writer ownership around the merged atomic cursor
195
+
196
+ Preserve the merged records/cursor transaction, staged replacement and input
197
+ limits; do not add a competing ingestion path. Ingestion-version and configured
198
+ ceiling changes already invalidate cached failures. The remaining adaptation is
199
+ to inventory mutating CLI, import, migration, watch and enrichment entry points
200
+ and give them one cross-process ownership contract. Extend progress invalidation
201
+ only for additional configuration that changes normalization semantics. Use
202
+ AgentsView for implementation reference, not Obelisk-derived code.
203
+
204
+ New gate: two processes targeting the same database, loss of writer ownership
205
+ and recovery without admitting an overlapping writer. Preserve the integration's
206
+ regressions for atomic rollback, restart during staged replacement, partial
207
+ multibyte/JSONL tails, oversized-row handling, version/ceiling changes and the
208
+ schema-6 layout matrix, including scoped parent/cursor IDs, FTS and foreign keys.
209
+ Embedding failure must not undo committed ingestion. Neither the input ceilings
210
+ nor the passing synthetic suite establish bounded end-to-end memory or IO.
211
+
212
+ ### 3. Persist discovery work and reserve backfill capacity
213
+
214
+ Separate watcher hints, resumable discovery and the per-tick normalization
215
+ budget. Raising a scan limit or adding pagination within one invocation is not
216
+ durable progress across restarts. The merged watcher still
217
+ [selects a prefix of currently needed work](https://github.com/archeism/ledger/blob/56b51e2b76d8d37f749bb114f5b73f1e40164cf9/packages/core/src/watch.ts#L401-L417).
218
+ The integration report explicitly leaves durable fairness unresolved. A small
219
+ persisted pending-work table with stable enumeration progress and an explicit
220
+ share for older work is preferable to repeatedly rediscovering only the newest
221
+ window.
222
+
223
+ AgentsView's [keyset candidates and transactional completion](https://github.com/kenn-io/agentsview/blob/b95262043e49c20108b73f825b3bb26cbf591b58/internal/db/project_identity_backfill.go#L218-L325)
224
+ provide a bounded precedent for identity backfill, not evidence of universal
225
+ transcript-ingestion fairness. Ledger must define its own scheduling policy.
226
+
227
+ Gate: more than 1,000 synthetic sessions, a tiny import budget, continuous writes
228
+ to newest sessions, restart mid-page, a repeatedly failing item and an unavailable
229
+ root. The oldest eligible work must eventually finish while live capture still
230
+ progresses. Report enumeration-incomplete, pending and failed states; do not
231
+ label coverage complete merely because one bounded pass returned no new work.
232
+
233
+ ### 4. Expose record evidence, lineage uncertainty and search completeness
234
+
235
+ Add an opt-in versioned response envelope so existing robot JSONL consumers need
236
+ not break. Return an explicit empty result, `record_id`, retained source locator,
237
+ generation identity, returned count and count precision, partial/failed/pending
238
+ coverage, and requested/realized retrieval mode. The merged
239
+ [robot projection](https://github.com/archeism/ledger/blob/56b51e2b76d8d37f749bb114f5b73f1e40164cf9/packages/core/src/cli.ts#L437-L461)
240
+ still drops record identity and emits no JSONL for zero hits. If pagination is
241
+ added, bind it to query, filters and a defined snapshot/generation, or explicitly
242
+ declare best-effort semantics.
243
+
244
+ Keep parentage evidence origin and conflict/unknown state rather than making
245
+ nullable display columns the complete relationship contract. Source metadata,
246
+ path-derived layout and a tool-call link are different evidence strengths;
247
+ shared directory proximity alone does not establish delegation. Do not import
248
+ Obelisk's parent-folding projection or assume an AI Harness stream includes all
249
+ children. A later live adapter should scope replay identity by session and bridge
250
+ incarnation as well as sequence, and persist its consumer cursor with evidence.
251
+
252
+ Gate: empty versus incomplete output, JSON parseability under truncation,
253
+ canonical-record/FTS discrepancy, lexical access during embedding failure,
254
+ cross-provider native-ID collision, child-before-parent arrival, conflicting
255
+ lineage evidence and a cycle. A later live adapter needs duplicate-tail replay,
256
+ sequence-reset and disconnect-without-cancellation fixtures before adoption.
257
+
258
+ ## Licensing and publication boundary
259
+
260
+ - Obelisk is AGPL-3.0; design reference only. No copying, vendoring or derived
261
+ implementation without the owner's explicit licensing decision. Rewriting
262
+ code in another language would not establish independent provenance.
263
+ - Cass's [current LICENSE](https://github.com/dicklesworthstone/coding_agent_session_search/blob/e5a492b47bfeef8400e326a8fa03b2870dc0dc87/LICENSE#L1-L44)
264
+ includes an OpenAI/Anthropic rider. Do not describe it as ordinary MIT or treat
265
+ this research as code-reuse clearance. Its observations and failure scenarios
266
+ are not a proposal to import its engine or implementation.
267
+ - AgentsView's [root license](https://github.com/kenn-io/agentsview/blob/b95262043e49c20108b73f825b3bb26cbf591b58/LICENSE)
268
+ is MIT; AI's [root license](https://github.com/vercel/ai/blob/46cea633cf7286386eb4e70f9c04413c57723d35/LICENSE)
269
+ identifies Apache-2.0. Verify the actual adopted files/dependencies and retain
270
+ applicable notices before any future implementation reuse.
271
+
272
+ This note owns only this file on `docs/daemon-observation-and-inspirations`.
273
+ It does not update the other worker's research or claim the integrated daemon is
274
+ running, archival, single-writer, fair or memory-bounded. PR2 and PR6 are now both
275
+ merged, and this comparison is pinned to their final integrated main. Runtime
276
+ observation and authorization of a separate follow-up PR remain independent of
277
+ the recorded integration test result. No push or PR is part of this document
278
+ update. New proposal gates above have not been executed here; existing regression
279
+ results are attributed to the integration report.