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
package/CHANGELOG.md ADDED
@@ -0,0 +1,23 @@
1
+ # Changelog
2
+
3
+ ## 0.1.1
4
+
5
+ ### Fixed
6
+
7
+ - Published CLI normalization now uses the same bundled correction as the SDK, preserving exact failed Pi/OMP tool-output text outside the workspace.
8
+ - Packed-consumer checks assert failed-result content through the real CLI sync and show commands.
9
+
10
+ ## 0.1.0
11
+
12
+ ### Added
13
+
14
+ - Portable session conversion SDK for 11 harness formats, usable in Node.
15
+ - Bun CLI for reading and searching 18 local history formats, retaining Ledger's indexing, bounded sync, watch, deletion, and robot output.
16
+ - Canonical managed session logs, explicit native continuation bindings, and offline migration from version 1 stores.
17
+ - Installation utilities and agent skill for Linux and macOS. Existing Ledger search databases keep their paths.
18
+ - Tested npm publication from reviewed package tags through GitHub Actions.
19
+
20
+ ### Limitations
21
+
22
+ - Conversion prepares history; callers coordinate harness execution and credentials.
23
+ - See the README for supported compaction boundaries. Optional semantic search requires its embedding runtime and model; lexical search does not.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,275 @@
1
- # trajectories
1
+ # Trajectories
2
2
 
3
- Name reserved. First release in progress; see the `trajector` package.
3
+ Keep one conversation identity while moving its history between 11 harnesses:
4
+ Claude Code, Codex, Pi, Oh My Pi, OpenCode, Grok Build, Cursor, Deep Agents,
5
+ GitHub Copilot, Cline, and fx. Read and search 18 local history formats through
6
+ the CLI, or use the independent conversion SDK.
7
+
8
+ One package, two entrypoints: `import … from 'trajectories'` works in Node 22.13+;
9
+ the `trajectories` CLI uses Bun 1.4.2+ for the existing Ledger SQLite/search engine.
10
+ Conversion support has explicit fidelity limits; it is not a universal native
11
+ state converter. Compatibility evidence is in the [source repository](https://github.com/archeism/oh-my-ai/tree/main/packages/trajectories/evidence).
12
+
13
+ ## Install
14
+
15
+ ```sh
16
+ # CLI: requires Bun 1.4.2 or newer on PATH.
17
+ bun add --global trajectories@0.1.0
18
+ trajectories --version
19
+ trajectories search --help
20
+
21
+ # SDK: inside your project; also works in Node 22.13 or newer.
22
+ bun add trajectories@0.1.0
23
+ ```
24
+
25
+ The package includes the CLI, SDK, agent skill, and OS service installers.
26
+ It keeps the existing Ledger database path; installation does not start an
27
+ indexing service. See [installation and service cutover](./ops/README.md).
28
+ Lexical search works without embedding models. Optional semantic search needs
29
+ the ONNX runtime and a downloaded model (`trajectories models pull`); that
30
+ download is separate from the release's lexical installation checks.
31
+
32
+ The optional Workflow adapter remains a separate package and is not part of
33
+ this release. The SDK and CLI do not require Workflow.
34
+
35
+ ## The session boundary
36
+
37
+ - A **managed session** has a stable id, an existing workspace reference, a head
38
+ in its own canonical log, and prepared native-session bindings. Sessions share
39
+ a schema and artifact store; each retains its own accepted conversation order.
40
+ - A **snapshot** is a transient native codec capture or explicit archive export.
41
+ Managed history retains accepted records, source evidence and required sidecars
42
+ through immutable references instead of saving another full snapshot per turn.
43
+ - A **native export** is a new runtime session artifact plus explicit native
44
+ import/resume argument vectors. Conversion never executes a tool or a harness.
45
+
46
+ Managed API version 2 follows the
47
+ [canonical-log contract](../../docs/adr/0011-trajectories-log-authority.md): one
48
+ conversation authority per logical session, shared evidence/artifacts, and
49
+ explicitly bounded native checkpoints. Version 1 stores require explicit migration
50
+ before using these managed APIs. Native scan/sync continues to use Ledger's engine.
51
+
52
+ The current central store is local, private files. Omakase can use this SDK and
53
+ keep Vercel's HarnessAgent for execution. Same-harness native resume remains
54
+ useful: a transcript does not reconstruct runtime caches, permissions, pending
55
+ approvals, installed tools/skills, filesystem state, or opaque reasoning state.
56
+ The caller must stop the source and provide the target's tools and credentials.
57
+
58
+ `switch` **prepares** a continuation and publishes a binding event, returning a
59
+ new head and binding id. Carry both into the target's completed capture. Stale
60
+ imports fail instead of overwriting newer history. The caller coordinates native
61
+ execution; preparing a binding never launches a harness.
62
+
63
+ For durable execution, compose the optional
64
+ [`@oh-my-ai-sdk/trajectories-workflow`](../trajectories-workflow) adapter with
65
+ Vercel Workflow and HarnessAgent. Core history conversion and storage have no
66
+ Workflow dependency. Mutations require a caller-owned intent id. An exact retry
67
+ replays the same receipt while its child head remains current; changed input or
68
+ an advanced head fails. Staged captures and receipts contain retained references,
69
+ not full histories. Local files must live on storage that survives the worker.
70
+
71
+ ## Use the SDK
72
+
73
+ ```ts
74
+ import {
75
+ readSnapshot, createSession, switchSession, appendCapture, readSession,
76
+ } from 'trajectories';
77
+
78
+ const history = await readSnapshot({
79
+ harness: 'claude-code', path: '/absolute/native/session.jsonl',
80
+ });
81
+ const created = await createSession('/absolute/session-store', history, {
82
+ id: 'conversation', workspace: '/absolute/existing-workspace', intentId: 'import-source',
83
+ });
84
+ const prepared = await switchSession('/absolute/session-store', created.session.id, 'pi', {
85
+ expectedHead: created.session.head, intentId: 'prepare-pi',
86
+ write: { directory: '/absolute/new-export-directory', cwd: created.session.workspace },
87
+ });
88
+ // The host executes prepared.native.prepare (if present), then native.resume.
89
+ // Each action carries command, args, and cwd; preserve that cwd when spawning.
90
+ // After the host proves completion and stops the target:
91
+ const capture = await readSnapshot({ harness: 'pi', path: '/absolute/completed-pi.jsonl' });
92
+ const appended = await appendCapture('/absolute/session-store', created.session.id, capture, {
93
+ expectedHead: prepared.session.head, bindingId: prepared.binding.id, intentId: 'import-pi',
94
+ });
95
+ const page = await readSession('/absolute/session-store', created.session.id, {
96
+ atHead: appended.session.head, view: 'history', limit: 100,
97
+ });
98
+ // Continue with page.nextCursor, keeping the same session, head and view.
99
+ ```
100
+
101
+ For conversion without central storage, use `readSnapshot`, `convert` (pure),
102
+ or `writeSnapshot` (writes exclusively into a new directory). `NativeExport`
103
+ contains `files`, `entrypoint`, `prepare?`, `resume`, and `diagnostics`.
104
+ Arguments are arrays; callers should not concatenate them into shell commands.
105
+ Model/provider overrides configure the new session, not historical measurements.
106
+
107
+ ## Use the CLI from this checkout
108
+
109
+ ```sh
110
+ bun install --frozen-lockfile
111
+ bun run --cwd packages/trajectories build
112
+ bun packages/trajectories/dist/cli.js --help
113
+
114
+ # Existing search/index options and existing Ledger database remain supported.
115
+ bun packages/trajectories/dist/cli.js search 'deployment decision' --robot
116
+
117
+ # Create the named central session; the receipt includes its id and head.
118
+ bun packages/trajectories/dist/cli.js import /absolute/session.jsonl \
119
+ --from cc --session conversation --intent-id import-source \
120
+ --cwd /absolute/workspace --store /absolute/session-store
121
+
122
+ # Use the returned id/head. The output tells the caller how to import and resume.
123
+ bun packages/trajectories/dist/cli.js switch SESSION_ID --to pi \
124
+ --out /absolute/new-pi-export --expected-head HEAD --intent-id prepare-pi \
125
+ --store /absolute/session-store
126
+ ```
127
+
128
+ Other history commands: `read`, `convert`, `sessions`, and `session`.
129
+ `sessions` returns a page; continue with `--cursor` and select its size with `--limit`.
130
+ Import after a run with `import FILE --from HARNESS --session ID --expected-head HEAD
131
+ --binding-id BINDING --intent-id IMPORT_INTENT`. The binding is required for a
132
+ prepared target lineage. Reuse the exact session, intent, parent and input on retry.
133
+ Aliases: `cc` means `claude-code`. Native artifacts and source transcripts are
134
+ never overwritten. Workspace files must already be present; `--cwd` changes the
135
+ workspace reference, not tool-output text or historical file contents.
136
+
137
+ Inspect a managed conversation directly, or add its current complete history to
138
+ the same search index that holds native sessions:
139
+
140
+ ```sh
141
+ trajectories show SESSION_ID --store /absolute/session-store
142
+ trajectories index --store /absolute/session-store --db /absolute/ledger.sqlite --robot
143
+ trajectories search 'deployment decision' --db /absolute/ledger.sqlite --robot
144
+ trajectories show managed:SESSION_ID --db /absolute/ledger.sqlite --robot
145
+ ```
146
+
147
+ `index` is an explicit lexical projection, separate from execution. Repeat it
148
+ after importing completed history. A central session keeps the search id
149
+ `managed:SESSION_ID` when its harness changes. Re-indexing replaces the searchable
150
+ head from the accepted log. Uncommitted stages stay outside conversation and
151
+ search views. Managed rows use `source: managed`; records retain their original
152
+ harness, native-session id and prepared binding id across handoffs. Index
153
+ tombstones remain suppressed without excluding native listings. `show --store`
154
+ returns the complete accepted history with central record ids, payloads and origin.
155
+ Indexed `show` returns full Ledger DB record bodies, labels that projection as
156
+ `record_format: ledger-db`, and points to `managed_log_path`. The index remains
157
+ a derived projection. Search snippets are excerpts.
158
+ The scheduled native `sync` does not index managed stores.
159
+
160
+ ## Ledger migration
161
+
162
+ The [current parity bootstrap](./docs/harness-parity-bootstrap.md) separates
163
+ 18 CLI history sources, 11 SDK codecs, and 11 execution implementations
164
+ available through Vercel's adapters plus our OMP adapter. Codec coverage does
165
+ not imply every adapter is installed or every model route has passed a live run.
166
+ The [native results](./evidence/harness-parity-results-2026-10-05.md) retain
167
+ successful and failed live cohorts, current native readback checks and limits.
168
+ The [initial inventory](./docs/harness-support-parity.md) preserves the earlier
169
+ 16-reader/six-codec baseline.
170
+
171
+ The port retains `search/query`, `recent/last`, `sync`, `status`, `scan`, `build`,
172
+ `watch`, `models pull`, and `delete`, including robot output, tombstones, writer
173
+ leases, source discovery, and read-only search. Source attribution and intentional
174
+ changes are in [legacy/NOTICE.md](./legacy/NOTICE.md).
175
+
176
+ The remaining operational utilities now ship with the package: worktree and
177
+ SHA-pinned release installers, Linux/macOS bounded scheduled sync, the
178
+ [Trajectories agent skill](./skills/trajectories/SKILL.md) and search/recent
179
+ wrappers, prompt-history recovery, native SQLite smoke checks, and the legacy
180
+ retitle recipe. The read-only daemon observer and rollout snapshot/query checks
181
+ are retained under `legacy/scripts`. See [installation](./ops/README.md) and the
182
+ [Ledger retirement checklist](./docs/ledger-migration.md).
183
+
184
+ The [inspiration index](./docs/inspirations.md) preserves Ledger's pinned source
185
+ research, implemented patterns and rejected experiments. The new
186
+ [Huihua and OAR assessment](./docs/research/2026-10-06-huihua-and-oar.md)
187
+ records the owner's decision to skip the [evidence API design](./docs/evidence-api.md).
188
+ Long-history SDK acquisition remains an unmeasured candidate. Repeated full
189
+ checkpoint storage is a rejected architecture; the managed log replaces that
190
+ storage without adding a harness executor or a new codec.
191
+
192
+ Search database resolution is `--db`, then `TRAJECTORIES_DB`, then `LEDGER_DB`,
193
+ then the existing `${XDG_DATA_HOME:-~/.local/share}/ledger/ledger.sqlite`.
194
+ Installation does not rename an existing database or reconfigure a running Ledger
195
+ service. For a service cutover, keep the database path and replace only its CLI
196
+ entrypoint after stopping the previous writer. Automatic machine-wide cutover is
197
+ outside this bootstrap.
198
+
199
+ The [verified Mac cutover](./evidence/mac-cutover-2026-10-07/README.md) replaced
200
+ the command and scheduled writer while keeping the existing database and native
201
+ histories. The receipt records parity checks, one restored rollback, and remaining
202
+ backlog and integrity-check limits. There is no Ledger forwarding command.
203
+
204
+ Managed-session storage is separate: `--store`, then `TRAJECTORIES_HOME`, then
205
+ `${XDG_DATA_HOME:-~/.local/share}/trajectories`. `index --store` projects managed
206
+ heads into the search database without coupling the conversion SDK to SQLite.
207
+
208
+ For a version 1 managed store, stop all native and Workflow writers, then migrate
209
+ into a fresh destination:
210
+
211
+ ```sh
212
+ trajectories migrate /absolute/v1-store --out /absolute/new-v2-store --writers-stopped --robot
213
+ ```
214
+
215
+ The source remains recoverable. A successful migration writes `migration.json`
216
+ with preserved session IDs, accepted capture references and prepared binding/head
217
+ mappings. Update caller state to those exact heads and bindings before resuming
218
+ against the destination. Failed destinations remain intact without a completed
219
+ manifest; inspect them and select a new destination for another attempt.
220
+
221
+ For Claude's prompt-only `history.jsonl`, use `import-claude-history` with explicit
222
+ `--history`, `--session`, zoned `--from`/`--to`, `--db`, and `--evidence` paths.
223
+ It preserves selected source bytes and byte-offset provenance, labels the slice
224
+ partial, and does not reconstruct assistant replies or pasted text.
225
+
226
+ ## Fidelity and supported boundaries
227
+
228
+ Readers retain complete tool arguments/results and include system records.
229
+ Native writers preserve user/assistant text and completed tool-call/result pairs.
230
+ Source system instructions and reasoning remain in the snapshot and are not
231
+ silently installed as the target's instructions or provider reasoning. Every
232
+ export reports this and other format limitations. Images and native-only state
233
+ are not portable through Letta's text-oriented projection; captured native text
234
+ and retained sidecars remain available. Native-required synthetic usage fields
235
+ are explicitly diagnosed and must not be counted as measured tokens or cost.
236
+
237
+ Branched, compacted, reset, or inherited-prefix histories whose active context
238
+ cannot be established are rejected for managed capture and conversion. Standalone
239
+ `readSnapshot`/`read` can inspect their raw history where normalization succeeds,
240
+ with portability issues attached.
241
+ Unfinished tool batches are rejected. This version does not guess missing results
242
+ or replay abandoned branches into a new agent's context.
243
+
244
+ Identified linear Pi v3 compactions can export their verified native summary and
245
+ retained tail while preserving the complete original transcript. See the
246
+ [bounded Pi compaction contract](docs/pi-compaction-context.md) and its native
247
+ Pi-to-OMP transfer receipt. OMP native auto-compaction remains unsupported; an
248
+ actual GLM5.3 reviewer produced it during the
249
+ [canonical-log implementation checks](evidence/canonical-log-2026-10-07/README.md).
250
+ The stopped archive stays inspectable, and managed capture refuses it. Ordinary
251
+ codec handoffs do not imply support for every native compaction schema.
252
+
253
+ Pi's native provider omits aborted/error assistant drafts from its next model
254
+ context. The SDK applies that same narrow projection to Pi canonical records and
255
+ reports each omission; the complete source remains in `snapshot.raw`. Actual tool
256
+ results remain preserved, so an orphan result still rejects conversion. OMP has
257
+ different interrupted-message behavior and is not projected this way. See the
258
+ [verified source contract](./docs/pi-provider-context.md).
259
+
260
+ The SDK and CLI converter builds bundle the pinned normalizer, including the
261
+ [Pi/OMP empty-error-output correction](../../repros/trajectory-error-roundtrip/README.md).
262
+ The external Letta dependency remains for types and the legacy search engine.
263
+
264
+ ## Development
265
+
266
+ ```sh
267
+ bun run verify
268
+ bun run test:package
269
+ ```
270
+
271
+ `verify` runs the source and legacy unit suites. The separate `test:package` check
272
+ in `smoke/` installs the packed tarball outside the workspace, imports the SDK
273
+ in Node, checks the patched normalization behavior, and invokes the Bun CLI's
274
+ new and existing command surfaces. Live checks use real native sessions, separate
275
+ workspaces, withheld facts, and actual output files; see the evidence directory.
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ export {};