trajectories 0.0.0 → 0.1.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.
Files changed (204) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/LICENSE +201 -0
  3. package/README.md +274 -2
  4. package/dist/cli.d.ts +2 -0
  5. package/dist/cli.js +8542 -0
  6. package/dist/convert.d.ts +31 -0
  7. package/dist/convert.js +431 -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 +1219 -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 +120 -0
  195. package/ops/install-cli.sh +63 -0
  196. package/ops/install-release.sh +49 -0
  197. package/ops/linux/install-systemd-user.sh +103 -0
  198. package/ops/macos/install-launchd.sh +72 -0
  199. package/ops/sync-settings.sh +37 -0
  200. package/package.json +19 -5
  201. package/skills/trajectories/SKILL.md +138 -0
  202. package/skills/trajectories/scripts/trajectories_recent.sh +26 -0
  203. package/skills/trajectories/scripts/trajectories_search.sh +26 -0
  204. package/index.js +0 -1
@@ -0,0 +1,163 @@
1
+ # Confer inspiration review — 2026-09-07
2
+
3
+ ## Outcome
4
+
5
+ Retain published `@letta-ai/trajectory`. Independently implement writer ownership
6
+ and transactional ingestion progress using Obelisk as a behavioral reference;
7
+ learn recovery and supervision from Cass; use AgentsView's extraction/retraction
8
+ semantics as the strongest inspected Dream reference. AI SDK Harnesses offer a
9
+ live capture seam, not Ledger's persistence layer.
10
+
11
+ This is source research and a proposed implementation sequence, not a claim that
12
+ Ledger now provides these guarantees. No upstream code was copied.
13
+
14
+ ## Reproducibility and method
15
+
16
+ Confer shell snapshot `e0d97b88dfc57c170845a906875ff7ac0ae29d60e185d031e6ec55cdfc5f6814`,
17
+ created `2026-09-07T00:08:05.393Z`. Read the manifest, searched the five repositories,
18
+ then inspected narrow numbered implementation and test ranges. No corpus clones.
19
+
20
+ | Repository | Commit |
21
+ |---|---|
22
+ | letta-ai/trajectory | `21ae92d10579499b183d93929c85da0b91233167` |
23
+ | tommy0103/obelisk | `69d9e21a90e55f310376d8f49929b1c16f5a1f0c` |
24
+ | dicklesworthstone/cass | `a18a6261a9815204b6ef59f9d186370ebd35dc34` |
25
+ | kenn-io/agentsview | `2298453833a5c5126a486a2554eac6c35cd2b55f` |
26
+ | vercel/ai | `c3c189c068baefe62808b4eca5432fe092dc37cb` |
27
+
28
+ Also used Confer's durable research-agent surface: job
29
+ `dff6263d-7c31-49d3-aced-58d48b078327`, terminal state `succeeded`.
30
+ Reported execution: oh-my-pi, Google Gemini 3.7 Flash, 41 turns. This confirms a
31
+ research-agent execution, not multiple independent reviewers; telemetry did not
32
+ show a multi-agent fan-out. Retrieve with `confer.py status <job-id>`.
33
+
34
+ The agent report supplied useful leads on leases, index recovery and supervision.
35
+ Shell validation corrected its overclaims: normalization output bounds do not
36
+ prove bounded peak ingestion memory; `os.OpenRoot` is not a model execution
37
+ sandbox; generic AI SDK generation APIs do not establish Harness durability.
38
+ Some embedded report snippets differed from the cited bytes, so the evidence
39
+ below uses directly inspected shell ranges instead. Coverage is targeted, not
40
+ an exhaustive security or runtime audit. Upstream tests were read, not run.
41
+
42
+ ## Adopt, adapt, avoid
43
+
44
+ ### Trajectory: retain the dependency; own the ingestion protocol
45
+
46
+ Native identities and byte-location identities support conflict detection;
47
+ content fallback supports exact dedup only. Codex/Cursor byte offsets are chunkable
48
+ with `baseByteOffset`, while other formats can use whole-decode ordinals. Do not
49
+ apply generic byte chunking to every adapter.
50
+
51
+ Evidence: `letta-ai/trajectory@21ae92d10579499b183d93929c85da0b91233167:CANONICAL.md#L115-L152`.
52
+
53
+ The documented worker contract owns dedup by source/record identity, content
54
+ versions, configuration hashes and serialized ingestion IDs. Ledger must persist
55
+ these with committed records; normalization alone does not create a Dream cursor.
56
+
57
+ Evidence: `letta-ai/trajectory@21ae92d10579499b183d93929c85da0b91233167:CANONICAL.md#L154-L170`.
58
+
59
+ These are corpus contracts, not proof the locally installed package version
60
+ exports every API. Verify installed-version compatibility before implementation.
61
+
62
+ ### Obelisk: independent implementation of ownership and commit semantics
63
+
64
+ Its lease holds `BEGIN IMMEDIATE` on a separate SQLite connection, releases via
65
+ rollback/close, and treats contention separately from unexpected errors. Its
66
+ provider loop persists data and invokes the persisted callback inside one
67
+ transaction, then invokes the committed callback afterwards; failures are
68
+ reported with a skip/stop policy. Useful patterns for Ledger's cursor ownership.
69
+
70
+ Evidence:
71
+
72
+ - `tommy0103/obelisk@69d9e21a90e55f310376d8f49929b1c16f5a1f0c:packages/core/src/writer-lease.ts#L54-L93`
73
+ - `tommy0103/obelisk@69d9e21a90e55f310376d8f49929b1c16f5a1f0c:packages/core/src/provider-indexing.ts#L264-L300`
74
+
75
+ Do not copy AGPL code. A database lease is writer coordination, not process
76
+ isolation, and only works if every writer participates. Cursor+records must
77
+ commit together; a model call must not hold the write transaction open.
78
+
79
+ ### Cass: supervision and source-bound recovery
80
+
81
+ The launchd renderer XML-escapes each argument and distinguishes incremental
82
+ intervals from nightly schedules. Its lexical reconciliation compares a durable
83
+ checkpoint's source identity and shape against current input before retrying;
84
+ changed input fails with explicit recovery guidance.
85
+
86
+ Evidence:
87
+
88
+ - `dicklesworthstone/cass@a18a6261a9815204b6ef59f9d186370ebd35dc34:src/schedule.rs#L207-L222`
89
+ - `dicklesworthstone/cass@a18a6261a9815204b6ef59f9d186370ebd35dc34:src/indexer/lexical_reconcile.rs#L213-L249`
90
+
91
+ Adapt lifecycle rendering and recovery validation, not the entire separate
92
+ Tantivy pipeline. The inspected shape check is not a cryptographic content hash.
93
+ Ledger should keep lexical retrieval available when optional model work fails.
94
+ That last sentence is a Ledger requirement, not verified Cass behavior here.
95
+
96
+ ### AgentsView: Dream needs invalidation, not only scheduled extraction
97
+
98
+ The extraction pass reconciles newly ineligible sessions before model work, so
99
+ endpoint failure cannot indefinitely postpone privacy retraction. Building
100
+ generations are staged, a second reconciliation catches mid-pass changes, and
101
+ only unrestricted passes advance the scan watermark. This directly addresses
102
+ the risk of a batch limit permanently hiding older eligible sessions.
103
+
104
+ Evidence: `kenn-io/agentsview@2298453833a5c5126a486a2554eac6c35cd2b55f:internal/recall/extract/manager.go#L227-L335`.
105
+
106
+ A test checks that appending outside the evidenced range preserves provenance
107
+ and that evidence carries a content digest:
108
+ `kenn-io/agentsview@2298453833a5c5126a486a2554eac6c35cd2b55f:internal/recall/extract/manager_test.go#L1800-L1822`.
109
+
110
+ Adapt versioned findings, digest-bound evidence, staged publication, eligibility
111
+ rechecks and retraction. Do not treat generated findings as authoritative memory.
112
+ The inspected watermark assignment is in-memory; it does not by itself prove
113
+ crash-safe progress. Ledger needs explicit persisted job state.
114
+
115
+ ### AI SDK Harnesses: distinguish suspension from cancellation
116
+
117
+ The sandbox channel's suspend operation stops dispatch/reconnect and returns an
118
+ event cursor; the documented bridge continues the in-flight turn. A pinned
119
+ checkpoint can replay an already delivered tail. The corresponding test checks
120
+ that releasing a checkpoint returns suspension to the latest cursor.
121
+
122
+ Evidence:
123
+
124
+ - `vercel/ai@c3c189c068baefe62808b4eca5432fe092dc37cb:packages/harness/src/utils/sandbox-channel.ts#L290-L325`
125
+ - `vercel/ai@c3c189c068baefe62808b4eca5432fe092dc37cb:packages/harness/src/utils/sandbox-channel.test.ts#L192-L212`
126
+
127
+ Adapt explicit event IDs, replay dedup and lifecycle meanings for live capture.
128
+ Do not equate disconnection with cancellation, or an event cursor with committed
129
+ Ledger storage. This channel code does not establish isolation strength or
130
+ complete child-agent capture across every adapter.
131
+
132
+ ## Ordered implementation gates
133
+
134
+ 1. **Ingestion correctness:** adapter-specific discovery fixtures including
135
+ JSONL for non-Cursor directory sources; overlapping-root dedup; bounded,
136
+ resumable backfill. Compare canonical output with whole-file normalization;
137
+ measure real-corpus peak RSS. A recent-session limit is not full coverage.
138
+ 2. **Durable ownership:** one participating writer; records and input progress
139
+ commit atomically. Kill/restart during a batch, race CLI against daemon, and
140
+ test truncation, replacement, late records and normalization-version changes.
141
+ 3. **Operational application:** stable paths and lifecycle commands, escaped
142
+ launchd/systemd definitions, periodic reconciliation, visible failed/pending
143
+ coverage. Verify actual login/reboot restart and upgrades on both OS families.
144
+ 4. **Independent retrieval:** prove lexical search with provider credentials
145
+ absent and embeddings failing; reindex derived data from retained evidence.
146
+ Use the known Netcup session as a discovery regression, without preselecting
147
+ its path or requiring a remembered harness.
148
+ 5. **Dream:** durable jobs with leases, bounded input, input/config/model versions,
149
+ retry and idempotent findings; recheck evidence at publication and retract
150
+ stale/excluded evidence. Kill during generation/publication; verify no lost
151
+ input or duplicated findings. Promotion remains a separate authorized action.
152
+ 6. **Fleet:** prove machine identity and explicit per-machine coverage before
153
+ claiming cross-machine search. Define synchronization/privacy policy before
154
+ moving any private transcripts off a machine.
155
+
156
+ ## Remaining research gaps
157
+
158
+ Follow complete watcher callers and shutdown paths; run cross-process lease and
159
+ crash recovery tests; inspect every adapter's identity/partial-input behavior;
160
+ verify installed package APIs and licenses before adoption. Model-facing search
161
+ contracts, extension points and isolation were not uniformly audited across all
162
+ five projects. The agent report is a lead inventory, not evidence closing those
163
+ gaps. No replacement for Letta is justified by this comparison.
@@ -0,0 +1,104 @@
1
+ # Letta Code continuous-service implementation
2
+
3
+ Inspected public `letta-ai/letta-code` at commit
4
+ `701f2a5367828847313876c735ade27b9df97689` on 2026-09-07 via GitHub's contents API.
5
+ Confer's previously inspected snapshot
6
+ `e0d97b88dfc57c170845a906875ff7ac0ae29d60e185d031e6ec55cdfc5f6814`
7
+ contains Trajectory but not Letta Code, so this follow-up uses pinned upstream
8
+ files rather than a corpus clone. No upstream code was copied or executed.
9
+
10
+ ## Service, scheduler and reflection are separate owners
11
+
12
+ 1. `letta server` routes to the remote listener; `letta server --listen` routes
13
+ to the local App Server. They are different modes, not synonyms. The App
14
+ Server defaults to loopback and exposes explicit authentication configuration
15
+ for broader access.
16
+ [server.ts:8-41,109-127](https://github.com/letta-ai/letta-code/blob/701f2a5367828847313876c735ade27b9df97689/src/cli/subcommands/server.ts#L8-L41)
17
+ 2. The App Server CLI starts a server handle, then waits for SIGINT/SIGTERM.
18
+ An idempotent shutdown guard calls the handle's asynchronous close method;
19
+ close failures produce a failing exit result. This is a foreground process
20
+ suitable for OS supervision, not proof of an installed service.
21
+ [app-server.ts:32-53,118-139](https://github.com/letta-ai/letta-code/blob/701f2a5367828847313876c735ade27b9df97689/src/cli/subcommands/app-server.ts#L32-L53)
22
+ 3. Listener startup installs process event routing and starts cron with a
23
+ process transport, guarded by process-service generation state. Cron can be
24
+ disabled with `LETTA_DISABLE_CRON_SCHEDULER=1`. Do not infer ownership solely
25
+ from scheduler comments saying "when the WS listener connects": the caller
26
+ distinguishes connection state from process services.
27
+ [lifecycle.ts:375-399,460-497](https://github.com/letta-ai/letta-code/blob/701f2a5367828847313876c735ade27b9df97689/src/websocket/listener/lifecycle.ts#L460-L497)
28
+
29
+ ## Scheduling persistence and failure handling
30
+
31
+ `crons.json` writes use a flushed temporary file and rename. A lock protects
32
+ scheduler lease claims. The stored owner includes PID, token and process identity;
33
+ a live other process prevents acquisition. Lease verification compares both PID
34
+ and token. Linux process identity includes process start ticks and boot ID.
35
+ This is more explicit than assuming a PID alone identifies an owner, but is not
36
+ proof of identical crash/power-loss guarantees on every filesystem or OS.
37
+
38
+ [cron-file.ts:181-221,646-682](https://github.com/letta-ai/letta-code/blob/701f2a5367828847313876c735ade27b9df97689/src/cron/cron-file.ts#L646-L682)
39
+
40
+ The scheduler verifies its lease on each tick, refreshes cached tasks, deduplicates
41
+ within the current minute and delays recurring tasks with jitter. Before delayed
42
+ execution it rereads the task and checks active status. Failure paths persist a
43
+ failed outcome and append run-log information. Startup retries lease acquisition
44
+ at bounded intervals, then warns that schedules will not fire. Stop clears tick,
45
+ GC and pending jitter timers and attempts lease release.
46
+
47
+ [scheduler.ts:498-712](https://github.com/letta-ai/letta-code/blob/701f2a5367828847313876c735ade27b9df97689/src/cron/scheduler.ts#L498-L712)
48
+
49
+ Limits worth testing before adopting the design:
50
+
51
+ - The per-minute fired set is in memory; it does not alone prove durable
52
+ occurrence deduplication or exactly-once effects.
53
+ - Lease-acquisition retry timeouts are scheduled separately from the tracked
54
+ pending jitter timers. Cancellation during acquisition needs its own test.
55
+ - The delayed-fire block checks runtime/task state but does not itself verify
56
+ the lease token again. Full fencing requires tracing downstream dispatch.
57
+ - Clearing timers does not by itself cancel or checkpoint an already-running
58
+ agent. Shutdown/drain and run recovery need separate contracts.
59
+
60
+ These are source-level review questions, not reproduced production failures.
61
+
62
+ ## Reflection is not just cron
63
+
64
+ The post-turn helper explicitly requires transcript delta capture to precede
65
+ trigger evaluation. It handles `off`, `compaction-event`, and `step-count`, using
66
+ steps since the last successful reflection for the latter.
67
+ [post-turn-reflection.ts:17-77](https://github.com/letta-ai/letta-code/blob/701f2a5367828847313876c735ade27b9df97689/src/cli/helpers/post-turn-reflection.ts#L17-L77)
68
+
69
+ The launcher refuses work when MemFS is disabled, when Cloud cutover assigns
70
+ reflection to the server, when automatic launches are suppressed by configuration
71
+ failure, or when another launch is active. Dirty parent memory and empty payloads
72
+ also produce explicit skip reasons. It prepares a memory worktree for the agent.
73
+ [reflection-launcher.ts:712-795](https://github.com/letta-ai/letta-code/blob/701f2a5367828847313876c735ade27b9df97689/src/cli/helpers/reflection-launcher.ts#L712-L795)
74
+
75
+ Completion first finalizes worktree integration, then passes `completionSuccess`
76
+ to transcript completion, and releases the launch reservation in `finally`.
77
+ Thus subagent success is not simply treated as successful memory integration.
78
+ The client cutover guard proves an ownership interface exists, not the deployed
79
+ Cloud scheduler's implementation or rollout status.
80
+ [reflection-launcher.ts:847-883](https://github.com/letta-ai/letta-code/blob/701f2a5367828847313876c735ade27b9df97689/src/cli/helpers/reflection-launcher.ts#L847-L883)
81
+
82
+ ## Tests and transfer to Ledger
83
+
84
+ Located tests for App Server bind failure/retry and shared-runtime ownership,
85
+ scheduler invalid-cron reporting and missed one-shot logs, and reflection cutover,
86
+ dirty-parent rejection and configuration-failure suppression. Test declarations
87
+ were inspected; this was not an upstream test run or full behavioral audit.
88
+
89
+ - [App Server lifecycle tests](https://github.com/letta-ai/letta-code/blob/701f2a5367828847313876c735ade27b9df97689/src/websocket/app-server-lifecycle.test.ts)
90
+ - [Scheduler tests](https://github.com/letta-ai/letta-code/blob/701f2a5367828847313876c735ade27b9df97689/src/cron/scheduler.test.ts)
91
+ - [Reflection launcher tests](https://github.com/letta-ai/letta-code/blob/701f2a5367828847313876c735ade27b9df97689/src/cli/helpers/reflection-launcher.test.ts)
92
+
93
+ Adopt explicit process ownership, observable skipped/failed runs, cancellation
94
+ boundaries, and an integration-success gate before advancing analysis progress.
95
+ Keep Ledger ingestion independent of relay connectivity or an active chat.
96
+ Use durable job/occurrence identities and transactional progress rather than
97
+ copying in-memory dedup or reservation assumptions. Preserve separate authority
98
+ for promoting findings into memory or harness changes.
99
+
100
+ No evidence here says a daemon is too large. No RSS/startup benchmark was run.
101
+ This server hosts agent work; it does not prove continuous discovery/backfill of
102
+ all local harness transcripts. A fleet-wide transcript sync protocol, Cloud
103
+ reflection backend, OS service installers and all shutdown callees remain outside
104
+ this targeted source pass.
@@ -0,0 +1,117 @@
1
+ # Bounded Claude history retrieval probe
2
+
3
+ ## Question and fixture
4
+
5
+ Can Ledger recover the original June 26 request to create the ACTI eval developer
6
+ skill after indexing a small historical slice?
7
+
8
+ The source was Claude's native `~/.claude/history.jsonl`, session
9
+ `e880706f-0c24-4ff4-9955-4f6ccab9b6c8`. The retained session transcript begins on
10
+ July 22 and has no June 26 records; widening the normal session scan alone would
11
+ not recover this prompt. The installed trajectory 0.3.0 Claude decoder accepts
12
+ user-message envelopes, not history rows with `display` fields.
13
+
14
+ ### Follow-up: why the retained transcript starts in July
15
+
16
+ On September 9, a bounded native-history search found a specific recovery request
17
+ in Claude session `74636afc-517d-4359-8c8d-27daf41145fe`:
18
+
19
+ - July 23, 14:52:04 UTC, history line 22778: locate the `e880706f` transcript.
20
+ - 14:53:17 UTC, line 22780: the user reported it was corrupted and could not resume.
21
+ - 14:59:51 UTC, line 22781: the user requested a wholesale backup followed by
22
+ keeping only the last two days of transcript to test resumption.
23
+ - 15:13:12 UTC, line 22788: the user asked where the backup was.
24
+
25
+ The current transcript's filesystem birth time is July 23, 15:01:57 UTC, its
26
+ earliest retained message is July 22, 01:22:38 UTC, and that first message's parent
27
+ record is absent. This strongly supports deliberate trimming during the recovery
28
+ attempt. The actual command log and wholesale backup have not been located, so
29
+ do not claim a verified deletion mechanism, blame automatic retention, or describe
30
+ the older conversation as permanently lost. The prompt-history copy survived.
31
+
32
+ Selection was frozen before import: June 26 in China time, represented as
33
+ `2026-06-25T16:00:00Z <= timestamp < 2026-06-26T16:00:00Z`, one session,
34
+ 78 nonempty prompts, 26,293 raw bytes including line endings. Snapshot SHA-256:
35
+ `6c16e022c970bf875b3c6eceb6a7870cb7fc87dbaf669f4a0fbbff5d028bd584`.
36
+
37
+ ## Import and provenance
38
+
39
+ `packages/core/scripts/import-claude-history.ts` maps each selected prompt through
40
+ the public trajectory canonicalizer with partial-transcript semantics. It neither
41
+ invents assistant turns nor edits source artifacts. Original byte offsets anchor
42
+ location-derived identities; an external private manifest and exact raw snapshot
43
+ preserve lineage omitted by the canonicalizer.
44
+
45
+ The supplemental slice has a namespaced ID derived from the source path, session,
46
+ and UTC bounds. It does not replace the existing session. This is a scoped import
47
+ utility, not default scanner/watcher integration or a general merging policy for
48
+ overlapping windows. The normal Ledger CLI and search wrapper query its FTS data.
49
+
50
+ ## Results
51
+
52
+ Before import, none of the frozen queries retrieved the exact June 26 prompt.
53
+ After import, with source `claude-code` and limit 20:
54
+
55
+ | Frozen query | Exact prompt rank |
56
+ | --- | --- |
57
+ | `"we should also make a acti-eval skill"` | 1 |
58
+ | `eval skill` | 1 |
59
+ | `benchflow` | 1 |
60
+ | `eval best practice` | Not found |
61
+ | Unique unrelated negative-control token | No hits |
62
+
63
+ The initial all-positive-queries acceptance therefore **failed**; the failed
64
+ record was retained. Source inspection explained the miss: `buildFtsExpression`
65
+ quotes plain multiword input as one contiguous phrase. Follow-up queries, marked
66
+ post hoc rather than replacements for the frozen workload:
67
+
68
+ - `eval AND best AND practice`: exact prompt rank 1.
69
+ - `eval`: exact prompt rank 5.
70
+
71
+ A further scope check without the Claude source filter found the prompt at rank
72
+ 17 for `eval skill`; bare `eval` did not retrieve it in the top 20 across all
73
+ sources. Coverage and ranking are separate concerns: more indexing alone does
74
+ not establish useful top-k ranking for vague queries.
75
+
76
+ All 78 stored prompt texts and timestamps matched their source. The target remains
77
+ at `2026-06-26T11:44:16.686Z`, original history line 20775. The existing full-session
78
+ metadata was unchanged. Database records increased from 68,223 to 68,301; session
79
+ rows increased from 189 to 190 (the additional row is a partial slice, not a newly
80
+ discovered complete conversation). A repeat import deduplicated; SQLite
81
+ `quick_check` returned `ok`.
82
+
83
+ ## Cost and limits
84
+
85
+ One measured import on Charless-MacBook-Air, Bun 1.4.0, with existing OS caches:
86
+
87
+ - Child launch through exit: 0.0586 seconds.
88
+ - Import-body CPU: 0.0471 CPU-seconds.
89
+ - Child RSS before import: 48,611,328 bytes; lifetime maximum: 84,754,432 bytes.
90
+ - No LLM or embedding model called; token and model-cache counters do not apply.
91
+ - A separate repeat checked idempotence, not stable performance.
92
+
93
+ Peak sampled CPU, physical I/O bytes and post-exit memory were not measured.
94
+ The evidence validator reports structurally valid but incomplete resource evidence.
95
+ No throughput, p95, whole-corpus recall, or full-index capacity claim follows from
96
+ this one-message probe.
97
+
98
+ The result supports broader source coverage: indexed prompt evidence is retrievable
99
+ through Ledger. Full indexing must include Claude prompt history as well as session
100
+ transcripts and account for phrase-search behavior. Full backfill and daemon startup
101
+ were not performed.
102
+
103
+ ## Replay and artifacts
104
+
105
+ See `ops/README.md` for the bounded importer command. Reuse the selected session and
106
+ UTC bounds above, then query through `skills/ledger/scripts/ledger_search.sh` with
107
+ the intended `--db`. To repeat RED/GREEN, use a separate copy of the pre-import
108
+ database; never overwrite the active database with the older backup.
109
+
110
+ Private local evidence is in `.local/claude-history-probe/`: `spec.json`,
111
+ `pre-import.sqlite`, `source/selected-history.jsonl`, `source/provenance.json`,
112
+ `attempt-1.json`, `attempt-2.json`, `verdict.json`, `followup.json`, and `run.json`.
113
+ The report preserves the initial failed query expectation. Raw prompts/databases
114
+ are excluded from Git; only this compact result, importer, and tests are committed.
115
+
116
+ Validation: focused history-import tests (2 passed, 16 assertions), core typecheck,
117
+ real before/after import and search, idempotent reimport, and SQLite integrity check.
@@ -0,0 +1,87 @@
1
+ # AgentsView Native Discovery
2
+
3
+ Audited **2026-09-09, 02:10 UTC**: GitHub [main][branch] resolved to
4
+ [`e1e41fd0e31c41b7a6a0cd76c1f61a0cb2da4147`][head] (commit 2026-09-09T01:42:46Z).
5
+ The pinned [LICENSE][license] is MIT, copyright Kenn Software LLC.
6
+
7
+ ## Native Readers
8
+
9
+ **Cursor IDE:** [globalStorage/state.vscdb][ide] contains
10
+ `cursorDiskKV(key,value)`: `composerData:<id>` supplies
11
+ `fullConversationHeadersOnly[].bubbleId`, ordered references to
12
+ `bubbleId:<composerId>:<bubbleId>`. Bubble types 1/2 mean user/assistant;
13
+ `toolFormerData` carries tool details. Session identity is
14
+ `cursor-ide:<composerId>`; provenance is `<db>#<composerId>`; message identity
15
+ is the bubble UUID. Neither Cursor reader emits session parentage.
16
+
17
+ **Cursor transcripts:** [discovery][cursor-discovery] reads
18
+ `~/.cursor/projects/<project>/agent-transcripts/<id>.{txt,jsonl}` and
19
+ `<id>/<id>.{txt,jsonl}`, preferring JSONL. The [reader][cursor-reader] accepts
20
+ text or JSONL `role` plus `message.content`; identity is `cursor:<filename-stem>`.
21
+ This is separate from IDE identity, not automatic cross-store deduplication.
22
+
23
+ **OpenCode:** [discovery][discovery] accepts `opencode.db` and
24
+ `opencode-<channel>.db` under the [configured root][catalog]
25
+ (default `~/.local/share/opencode`). [SQLite assembly][opencode] reads
26
+ `session/project/message/part`, JSON `data`, and message/part `session_id`
27
+ plus part `message_id`. [Legacy storage][legacy] assembles
28
+ `storage/session/<project>/<sid>.json`, `storage/message/<sid>/*.json`,
29
+ and `storage/part/<mid>/*.json`. [Storage wins duplicate IDs][oc-discovery];
30
+ SQLite contributes missing IDs. Identity is `opencode:<id>`; explicit
31
+ `parent_id` or legacy `parentID` supplies parentage. SQL provenance is
32
+ `<db>#<id>`.
33
+
34
+ ## Freshness And Limits
35
+
36
+ Cursor IDE uses a read-only connection and one [read transaction][ide] for
37
+ composer, bubbles, and their content digest. Missing/empty conversational bubbles
38
+ mark truncation; malformed JSON errors rather than masquerading as missing.
39
+ Its [container fingerprint][ide-provider] includes file identity, SQLite header,
40
+ and WAL size/header; member digests cover raw composer/bubble bytes.
41
+ It watches `state.vscdb` and `state.vscdb-*` shallowly; transcripts use recursive
42
+ TXT/JSONL watches.
43
+
44
+ OpenCode uses [SQLite/WAL state][sqlite-state] and [per-session fingerprints][oc-freshness]:
45
+ session/project/child update times, child counts, and ordered child-ID/timestamp
46
+ digests. This discovery digest is not a body-content hash. [Parsing][oc-parse]
47
+ hashes content but uses separate autocommit queries, capturing the watermark
48
+ before children, not a single snapshot. Legacy [stat gates][storage-state] cover
49
+ session/message/part files; same-size, timestamp-preserving edits require watcher
50
+ invalidation.
51
+
52
+ [Watch plans][oc-watch] separate shallow DB/WAL coverage from recursive storage
53
+ when possible; [event filtering][oc-events] ignores SHM and empty WALs.
54
+ [Fast watermark passes][gate] deliberately defer child-only edits to full
55
+ discovery; [digest verification expires after five minutes][verify].
56
+
57
+ ## Ledger Implication
58
+
59
+ Beyond the [Cass format inventory](2026-09-09-native-history-discovery.md),
60
+ useful lessons are snapshot-aligned digests, gap/error distinction,
61
+ deletion-sensitive fingerprints, and separate live-database/archive watch budgets.
62
+ This is complementary evidence, not an exhaustive Cass feature comparison.
63
+ Use selected chat fields: [maintainers flag credential-bearing Cursor fields][catalog].
64
+
65
+ Public-source audit only: no clone, private-store access, runtime execution,
66
+ or upstream code copying.
67
+
68
+ [branch]: https://api.github.com/repos/kenn-io/agentsview/branches/main
69
+ [head]: https://github.com/kenn-io/agentsview/commit/e1e41fd0e31c41b7a6a0cd76c1f61a0cb2da4147
70
+ [license]: https://github.com/kenn-io/agentsview/blob/e1e41fd0e31c41b7a6a0cd76c1f61a0cb2da4147/LICENSE
71
+ [ide]: https://github.com/kenn-io/agentsview/blob/e1e41fd0e31c41b7a6a0cd76c1f61a0cb2da4147/internal/parser/cursor_ide.go#L17-L536
72
+ [cursor-discovery]: https://github.com/kenn-io/agentsview/blob/e1e41fd0e31c41b7a6a0cd76c1f61a0cb2da4147/internal/parser/cursor_provider.go#L417-L552
73
+ [cursor-reader]: https://github.com/kenn-io/agentsview/blob/e1e41fd0e31c41b7a6a0cd76c1f61a0cb2da4147/internal/parser/cursor.go#L496-L589
74
+ [discovery]: https://github.com/kenn-io/agentsview/blob/e1e41fd0e31c41b7a6a0cd76c1f61a0cb2da4147/internal/parser/discovery.go#L96-L212
75
+ [catalog]: https://github.com/kenn-io/agentsview/blob/e1e41fd0e31c41b7a6a0cd76c1f61a0cb2da4147/internal/parser/types.go#L257-L352
76
+ [opencode]: https://github.com/kenn-io/agentsview/blob/e1e41fd0e31c41b7a6a0cd76c1f61a0cb2da4147/internal/parser/opencode.go#L987-L1319
77
+ [oc-discovery]: https://github.com/kenn-io/agentsview/blob/e1e41fd0e31c41b7a6a0cd76c1f61a0cb2da4147/internal/parser/opencode_provider.go#L569-L711
78
+ [ide-provider]: https://github.com/kenn-io/agentsview/blob/e1e41fd0e31c41b7a6a0cd76c1f61a0cb2da4147/internal/parser/cursor_ide_provider.go#L52-L192
79
+ [sqlite-state]: https://github.com/kenn-io/agentsview/blob/e1e41fd0e31c41b7a6a0cd76c1f61a0cb2da4147/internal/parser/sqlite_container_state.go#L15-L143
80
+ [oc-freshness]: https://github.com/kenn-io/agentsview/blob/e1e41fd0e31c41b7a6a0cd76c1f61a0cb2da4147/internal/parser/opencode.go#L764-L847
81
+ [oc-parse]: https://github.com/kenn-io/agentsview/blob/e1e41fd0e31c41b7a6a0cd76c1f61a0cb2da4147/internal/parser/opencode.go#L1151-L1207
82
+ [storage-state]: https://github.com/kenn-io/agentsview/blob/e1e41fd0e31c41b7a6a0cd76c1f61a0cb2da4147/internal/parser/opencode_storage_state.go#L15-L127
83
+ [oc-watch]: https://github.com/kenn-io/agentsview/blob/e1e41fd0e31c41b7a6a0cd76c1f61a0cb2da4147/internal/parser/opencode_provider.go#L714-L778
84
+ [oc-events]: https://github.com/kenn-io/agentsview/blob/e1e41fd0e31c41b7a6a0cd76c1f61a0cb2da4147/internal/parser/opencode_provider.go#L2056-L2112
85
+ [gate]: https://github.com/kenn-io/agentsview/blob/e1e41fd0e31c41b7a6a0cd76c1f61a0cb2da4147/internal/sync/opencode_container_gate.go#L257-L378
86
+ [legacy]: https://github.com/kenn-io/agentsview/blob/e1e41fd0e31c41b7a6a0cd76c1f61a0cb2da4147/internal/parser/opencode.go#L1663-L1918
87
+ [verify]: https://github.com/kenn-io/agentsview/blob/e1e41fd0e31c41b7a6a0cd76c1f61a0cb2da4147/internal/sync/opencode_container_gate.go#L17-L43