throughline 0.3.23 → 0.3.25

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 (111) hide show
  1. package/.claude/commands/tl-trim.md +42 -0
  2. package/.codex-sidecar.yml +62 -0
  3. package/CHANGELOG.md +583 -0
  4. package/README.ja.md +42 -5
  5. package/README.md +400 -23
  6. package/bin/throughline.mjs +168 -4
  7. package/codex/skills/throughline/SKILL.md +157 -0
  8. package/codex/skills/throughline/agents/openai.yaml +7 -0
  9. package/docs/INHERITANCE_ON_CLEAR_ONLY.md +146 -0
  10. package/docs/L1_L2_L3_REDESIGN.md +415 -0
  11. package/docs/PUBLIC_RELEASE_PLAN.md +184 -0
  12. package/docs/THROUGHLINE_CODEX_DUAL_SUPPORT.md +249 -0
  13. package/docs/THROUGHLINE_CODEX_FIRST_ROADMAP.md +555 -0
  14. package/docs/THROUGHLINE_CODEX_MONITOR_IMPLEMENTATION_PLAN.md +220 -0
  15. package/docs/THROUGHLINE_CODEX_TRIM_IMPLEMENTATION_PLAN.md +528 -0
  16. package/docs/THROUGHLINE_CODEX_TRIM_ROLLBACK_FIX_PLAN.md +672 -0
  17. package/docs/archive/CONCEPT.md +476 -0
  18. package/docs/archive/EXPERIMENT.md +371 -0
  19. package/docs/archive/README.md +22 -0
  20. package/docs/archive/SESSION_LINKING_DESIGN.md +231 -0
  21. package/docs/archive/THROUGHLINE_NEXT_STEPS.md +134 -0
  22. package/docs/throughline-codex-trim-rollback-incident-report.md +306 -0
  23. package/docs/throughline-handoff-context.example.json +57 -0
  24. package/docs/throughline-rollback-context-trim-insight.md +455 -0
  25. package/package.json +6 -2
  26. package/src/cli/codex-capture.mjs +95 -0
  27. package/src/cli/codex-handoff-model-smoke.mjs +292 -0
  28. package/src/cli/codex-handoff-model-smoke.test.mjs +262 -0
  29. package/src/cli/codex-handoff-smoke.mjs +163 -0
  30. package/src/cli/codex-handoff-smoke.test.mjs +149 -0
  31. package/src/cli/codex-handoff-start.mjs +291 -0
  32. package/src/cli/codex-handoff-start.test.mjs +194 -0
  33. package/src/cli/codex-hook.mjs +276 -0
  34. package/src/cli/codex-hook.test.mjs +293 -0
  35. package/src/cli/codex-host-primitive-audit.mjs +110 -0
  36. package/src/cli/codex-host-primitive-audit.test.mjs +75 -0
  37. package/src/cli/codex-restore-smoke.mjs +357 -0
  38. package/src/cli/codex-restore-source-audit.mjs +304 -0
  39. package/src/cli/codex-resume.mjs +138 -0
  40. package/src/cli/codex-rollback-model-visible-smoke.mjs +373 -0
  41. package/src/cli/codex-rollback-model-visible-smoke.test.mjs +255 -0
  42. package/src/cli/codex-sidecar-diagnostics.mjs +48 -0
  43. package/src/cli/codex-sidecar-dry-run.mjs +85 -0
  44. package/src/cli/codex-summarize.mjs +224 -0
  45. package/src/cli/codex-threads.mjs +89 -0
  46. package/src/cli/codex-visibility-smoke.mjs +196 -0
  47. package/src/cli/codex-vscode-restore-smoke.mjs +226 -0
  48. package/src/cli/codex-vscode-rollback-smoke.mjs +114 -0
  49. package/src/cli/doctor.mjs +503 -1
  50. package/src/cli/doctor.test.mjs +542 -3
  51. package/src/cli/handoff-preview.mjs +78 -0
  52. package/src/cli/help.test.mjs +64 -0
  53. package/src/cli/install.mjs +227 -4
  54. package/src/cli/install.test.mjs +207 -4
  55. package/src/cli/trim.mjs +564 -0
  56. package/src/codex-app-server.mjs +1816 -0
  57. package/src/codex-app-server.test.mjs +512 -0
  58. package/src/codex-auto-refresh.mjs +194 -0
  59. package/src/codex-auto-refresh.test.mjs +182 -0
  60. package/src/codex-capture.mjs +235 -0
  61. package/src/codex-capture.test.mjs +393 -0
  62. package/src/codex-handoff-model-smoke.mjs +114 -0
  63. package/src/codex-handoff-model-smoke.test.mjs +89 -0
  64. package/src/codex-handoff-smoke.mjs +124 -0
  65. package/src/codex-handoff-smoke.test.mjs +103 -0
  66. package/src/codex-handoff.mjs +331 -0
  67. package/src/codex-handoff.test.mjs +220 -0
  68. package/src/codex-host-primitive-audit.mjs +374 -0
  69. package/src/codex-host-primitive-audit.test.mjs +208 -0
  70. package/src/codex-restore-smoke.test.mjs +639 -0
  71. package/src/codex-restore-source-audit.mjs +1348 -0
  72. package/src/codex-restore-source-audit.test.mjs +623 -0
  73. package/src/codex-resume.test.mjs +242 -0
  74. package/src/codex-rollout-memory.mjs +711 -0
  75. package/src/codex-rollout-memory.test.mjs +610 -0
  76. package/src/codex-sidecar-cli.test.mjs +75 -0
  77. package/src/codex-sidecar.mjs +246 -0
  78. package/src/codex-sidecar.test.mjs +172 -0
  79. package/src/codex-summarize.test.mjs +143 -0
  80. package/src/codex-thread-identity.mjs +23 -0
  81. package/src/codex-thread-index.mjs +173 -0
  82. package/src/codex-thread-index.test.mjs +164 -0
  83. package/src/codex-usage.mjs +110 -0
  84. package/src/codex-usage.test.mjs +140 -0
  85. package/src/codex-visibility-smoke.test.mjs +222 -0
  86. package/src/codex-vscode-restore-smoke.mjs +206 -0
  87. package/src/codex-vscode-restore-smoke.test.mjs +325 -0
  88. package/src/codex-vscode-rollback-smoke.mjs +90 -0
  89. package/src/codex-vscode-rollback-smoke.test.mjs +290 -0
  90. package/src/db-schema.test.mjs +97 -0
  91. package/src/haiku-summarizer.mjs +267 -26
  92. package/src/haiku-summarizer.test.mjs +282 -0
  93. package/src/handoff-preview.test.mjs +108 -0
  94. package/src/handoff-record.mjs +294 -0
  95. package/src/handoff-record.test.mjs +226 -0
  96. package/src/hook-entrypoints.test.mjs +326 -0
  97. package/src/package-files.test.mjs +19 -0
  98. package/src/prompt-submit.mjs +9 -6
  99. package/src/resume-context.mjs +44 -140
  100. package/src/resume-context.test.mjs +172 -0
  101. package/src/session-start.mjs +8 -5
  102. package/src/state-file.mjs +50 -6
  103. package/src/state-file.test.mjs +50 -0
  104. package/src/token-monitor.mjs +14 -10
  105. package/src/token-monitor.test.mjs +27 -0
  106. package/src/trim-cli.test.mjs +1584 -0
  107. package/src/trim-model.mjs +584 -0
  108. package/src/trim-model.test.mjs +568 -0
  109. package/src/turn-processor.mjs +17 -10
  110. package/src/vscode-task.mjs +94 -6
  111. package/src/vscode-task.test.mjs +186 -6
package/CHANGELOG.md ADDED
@@ -0,0 +1,583 @@
1
+ # Changelog
2
+
3
+ All notable changes to Throughline are documented here. The format is based on
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
5
+ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ Pre-`0.3.18` iteration history is preserved as a rollup section near the bottom
8
+ since most of those releases were rapid-fire monitor render bug fixes that
9
+ shipped to npm but were not individually tagged on GitHub.
10
+
11
+ ## [Unreleased]
12
+
13
+ ## [0.3.25] — 2026-05-08
14
+
15
+ ### Added
16
+ - Claude-primary / Codex-sidecar groundwork:
17
+ `HandoffRecord` projection, `throughline handoff-preview`,
18
+ `throughline_handoff` example context, and `codex-sidecar-diagnostics` /
19
+ `codex-sidecar-dry-run` command surfaces.
20
+ - Optional `codex-sidecar` L2→L1 summarization path. When the sidecar is
21
+ configured for the `summarize-l1` preset, Throughline uses it for the only
22
+ subagent-like external model call; disabled/unavailable/run-failed sidecar
23
+ states keep the existing Claude Haiku route.
24
+ - `/tl-trim` dry-run surface:
25
+ `throughline trim --dry-run`, `--host`, `--keep-recent`, `--all`,
26
+ `--memo-stdin`, `--codex-thread-id`, and `throughline doctor --trim`.
27
+ - Codex app-server protocol helpers for the verified trim flow: newline JSON
28
+ framing, initialize / resume / rollback / inject / turn-start request
29
+ builders, and parser coverage.
30
+ - Codex rollout-backed trim source for explicit `--codex-thread-id` plans.
31
+ This lets Codex dry-run / preflight / guarded execute use the active rollout
32
+ even when the Throughline DB has no Codex `bodies` rows.
33
+ - `throughline codex-capture`, which captures explicit Codex rollout active
34
+ turns into a namespaced `codex:<thread_id>` Throughline DB session. Re-capture
35
+ rebuilds that session so rolled-back tail turns do not survive as current L2.
36
+ - Codex capture now stores rollout function-call L3 details as well as L2
37
+ bodies: `function_call` becomes `details.kind = tool_input`, and
38
+ `function_call_output` becomes `details.kind = tool_output`.
39
+ - Host-mode L2→L1 backend selection. Claude-primary keeps the existing
40
+ `codex-sidecar` / Claude Haiku compatibility route, while Codex-primary uses
41
+ the Codex CLI backend and reports failure explicitly instead of falling back.
42
+ - `throughline codex-summarize`, which writes L1 skeletons for captured
43
+ `codex:<thread_id>` sessions through the Codex CLI backend once the captured
44
+ body count exceeds the L2 window.
45
+ - `throughline codex-resume`, which renders captured `codex:<thread_id>` memory
46
+ as Codex active-work context. `--format handoff` emits a concise fresh-thread
47
+ handoff prompt for safe continuation without mutating the current Codex
48
+ thread; the handoff view caps recent L2 entries, long body text, and detail
49
+ references while preserving the full context in the normal text renderer.
50
+ `--format item-json` emits a Codex developer message item so hosts can
51
+ inject the memory as current-task context instead of a passive archive.
52
+ `--memo-stdin` prepends a Codex-primary in-flight memo without touching Claude
53
+ `/tl` batons.
54
+ - `throughline codex-handoff-smoke`, a read-only validator for the
55
+ `codex-resume --format handoff` prompt. It checks fresh-thread header /
56
+ current-task contract / source session / start instruction / mutation
57
+ boundary / prompt size / detail-command deduplication before a user starts a
58
+ new Codex thread with that prompt.
59
+ - `throughline codex-handoff-model-smoke`, an explicit opt-in model smoke for
60
+ the same handoff prompt. It first requires the structural handoff smoke to be
61
+ ready, then runs `codex exec --ephemeral --ignore-user-config --ignore-rules
62
+ --sandbox read-only` with a marker prompt. `--dry-run` inspects the exact
63
+ readiness / command boundary without starting Codex exec, and
64
+ `--print-prompt` can include the combined prompt for audit. Live model smoke
65
+ requires `THROUGHLINE_EXPERIMENTAL_CODEX_HANDOFF_MODEL_SMOKE=1` and does not
66
+ mutate the current Codex thread.
67
+ - `throughline codex-handoff-start`, a guided read-only fresh-thread start plan
68
+ for Codex handoff. It reports the structural smoke command, model-smoke dry-run
69
+ boundary, handoff render command, optional live model smoke command, and can
70
+ include the handoff prompt with `--print-prompt`. When `--memo-stdin` is used,
71
+ the replay commands include `--memo-stdin` and the output reminds callers to
72
+ pipe the same memo.
73
+ - `throughline doctor --codex`, a read-only Codex-primary diagnostic that shows
74
+ current thread env identity, rollout candidates for the cwd, captured
75
+ `codex:<thread_id>` DB sessions, context refresh blockage, new-thread
76
+ handoff readiness, and the next capture/resume commands.
77
+ - Global `throughline install` now also registers the Codex Stop hook in
78
+ `~/.codex/hooks.json` with absolute node + installed `bin/throughline.mjs`,
79
+ `async: false`, and `timeoutSec: 300`, and enables
80
+ `[features].codex_hooks = true` in `~/.codex/config.toml`. Existing non-
81
+ Throughline Codex hooks, including Caveat / Spotter hooks, are preserved.
82
+ - Global install now also installs a `$throughline` Codex skill under
83
+ `~/.codex/skills/throughline`, giving Codex a natural-language entrypoint for
84
+ Throughline status, resume, summarize, dry-run, preflight, and explicit
85
+ execute workflows. The rollback / inject execute path is enabled again after
86
+ controlled rollback model-visible smokes failed to reproduce rollback marker
87
+ resurrection.
88
+ - A bare `$throughline` Codex skill invocation now runs the safe inspection
89
+ shape: `doctor --codex`, guarded dry-run, and preflight. Explicit
90
+ `trim --execute --host codex --all` mutates the current Codex thread when the
91
+ user asks for it and the guard checks pass.
92
+ - Codex Stop hook automatic refresh now attempts guarded rollback + Throughline
93
+ DB memory injection at the 90% verified-usage threshold. Estimate-only usage
94
+ still never triggers mutation.
95
+ - `throughline codex-visibility-smoke`, an experimental opt-in Codex app-server
96
+ smoke that injects the Codex active-work developer message and starts a
97
+ marker-check model turn. It requires
98
+ `THROUGHLINE_EXPERIMENTAL_CODEX_MODEL_VISIBLE_SMOKE=1` and supports explicit
99
+ model-turn timeouts with `--request-timeout-ms` / `--timeout-ms`; it also
100
+ accepts the same `--memo-stdin` active-work memo surface as `codex-resume`.
101
+ `--resume-after-inject` re-runs `thread/resume` after injection before
102
+ starting the marker turn, so resume persistence can be checked explicitly.
103
+ - Codex-first roadmap docs that set the next implementation order: Codex
104
+ primary support with a Codex CLI L2→L1 backend, then Codex rewind-compatible
105
+ trim, then Claude rewind finalization.
106
+
107
+ ### Changed
108
+ - Resume context now frames recent L2 as an active work thread with explicit
109
+ reading/continuation instructions at both the top and bottom of injected
110
+ memory. Older L2 entries may be superseded by later entries and are not
111
+ blindly treated as still-current truth.
112
+ - Hook entry modules are import-safe and expose `run()` so subprocess tests can
113
+ cover the Claude path without touching the user's real database.
114
+ - VSCode task tests suppress Claude-facing `<system-reminder>` notices by
115
+ default and opt in only for notice assertions, keeping test output from
116
+ looking like fresh user-facing instructions.
117
+ - `codex-sidecar` subprocess calls now shell-wrap on Windows so npm global
118
+ `.cmd` shims resolve consistently, matching the existing Claude CLI handling.
119
+ - L2→L1 sidecar summarization accepts the stable `SidecarResult` JSON shape
120
+ (`summary` without `status: "ok"`) as well as the older test fixture shape.
121
+ - `codex-sidecar-dry-run --turn-timeout-ms` now forwards the timeout into the
122
+ normalized sidecar request instead of only changing the local subprocess
123
+ timeout.
124
+ - `.codex-sidecar.yml` no longer denies every path containing `token`, so
125
+ legitimate source files such as `src/token-monitor.mjs` remain reviewable.
126
+ - `.codex-sidecar.yml` allows release docs and Claude slash commands, so
127
+ review/risk-check sidecars can inspect the same contract surfaces that are
128
+ shipped in the npm tarball.
129
+ - `.codex-sidecar/logs/` is ignored as a runtime artifact from real sidecar
130
+ smoke runs.
131
+ - Codex trim host status now distinguishes verified app-server rollback/inject
132
+ primitives from guarded execution requirements. Codex Stop hook automatic
133
+ refresh is enabled only at the 90% verified-usage threshold and still uses the
134
+ same explicit thread identity, injectable DB memory, and rollout/app-server
135
+ turn-count guards.
136
+ - Trim dry-run now carries an explicit Codex thread identity separately from
137
+ the Claude/Throughline `session_id`, avoiding latest-rollout guessing.
138
+ - Codex trim can now use `THROUGHLINE_CODEX_THREAD_ID` or `CODEX_THREAD_ID` as
139
+ a current-thread identity signal when `--codex-thread-id` is omitted; the CLI
140
+ flag remains authoritative and Throughline still does not guess from the
141
+ latest rollout.
142
+ - `throughline doctor --trim --host codex` now reports whether a current Codex
143
+ thread id is available from env and adjusts its dry-run example accordingly.
144
+ - `throughline doctor --trim --host codex` now also reports the read-only host
145
+ primitive audit status as diagnostic evidence rather than an execute blocker.
146
+ - `throughline trim --preflight --host codex --codex-thread-id <id>` now
147
+ performs a guarded Codex app-server initialize/read/resume check and stops
148
+ before sending rollback or inject. When the plan source is `codex-rollout`,
149
+ preflight compares rollout active turns with app-server read/resume turns and
150
+ refuses the plan if they differ.
151
+ - Codex rollout-backed trim source now excludes the current in-flight turn from
152
+ rollback planning, including the latest post-rollback assistant continuation.
153
+ This keeps preflight aligned with app-server `thread/read` / `thread/resume`,
154
+ which only report completed host-visible turns during an ongoing Codex turn.
155
+ - `throughline trim --execute --host codex --codex-thread-id <id>` no longer
156
+ requires `THROUGHLINE_EXPERIMENTAL_CODEX_TRIM_EXECUTE=1` and no longer treats
157
+ host primitive audit or restore-safety diagnostics as mutation blockers.
158
+ Execute still refuses before mutation when Codex thread identity, injectable
159
+ Throughline DB memory, or rollout/app-server turn-count agreement is missing.
160
+ - Codex guarded execute now polls post-inject `thread/read` until the injected
161
+ memory item is visible when the app-server reports an injected turn count, and
162
+ reports `postInjectVisibilityCheck` so stale immediate app-server reads are
163
+ explicit. If `thread/inject_items` returns no turn list, developer memory is
164
+ treated as item-level injection and the expected post-inject turn count remains
165
+ the rollback result turn count.
166
+ - Codex guarded execute status now separates live mutation from durable
167
+ success: a visible app-server mutation reports `execute-sent-live-only` with
168
+ `durableVerification.durableVerified: false` and exits non-zero; post-inject
169
+ visibility timeout reports `execute-unverified`.
170
+ - Codex guarded execute can now report `execute-durable-verified` only when the
171
+ rollout records a new `thread_rolled_back` event, records the injected
172
+ `## Throughline: Active Work Context` memory, and restore-safety diagnostics
173
+ remain `ok`.
174
+ - Added `throughline codex-restore-smoke`, a read-only diagnostic that starts
175
+ fresh Codex app-server processes and compares `thread/read`,
176
+ `thread/resume`, and paginated `thread/turns/list` turn counts against the
177
+ rollout active turn count. Its proof scope is
178
+ `app_server_process_restart_only`, and it always reports `restartSafe: false`
179
+ because it is not VS Code restart / reconnect proof. If the required
180
+ read-only app-server request fails, the CLI returns structured
181
+ `app-server-restore-smoke-error` JSON instead of a stack trace.
182
+ - `codex-restore-smoke --inspect-risky-rollout` can now inspect a risky rollout
183
+ read-only and search app-server responses for retained rollback text. If
184
+ retained text appears in direct turn text or `replacement_history`, the smoke
185
+ reports `app-server-restore-text-retained` instead of a success-like stable
186
+ status, even when read/resume/list turn counts are stable. If retained text
187
+ appears only in quoted/tool-output fields such as `aggregatedOutput`, it
188
+ reports `app-server-restore-text-quoted`. Match reports include sample JSON
189
+ paths, location kinds, risk classes, and blocking-candidate summaries.
190
+ - `codex-vscode-rollback-smoke` text output now includes retained rollback text
191
+ count, resurrected user message count, and restore-safety risk type summary so
192
+ incident audits do not require opening the full JSON payload.
193
+ - `codex-restore-source-audit` now inventories SQLite-backed VS Code storage
194
+ candidates (`.vscdb`, `.sqlite`, `.sqlite3`, `.db`) read-only and reports
195
+ table / searchable column / needle match summaries alongside raw byte matches.
196
+ - `codex-restore-source-audit` now classifies VS Code log evidence into thread
197
+ id hits, retained rollback text hits, patch-apply failures, thread stream
198
+ broadcasts, and `replacement_history` signals, including a first/last
199
+ timestamp window for patch-apply failures when log timestamps are present.
200
+ - `codex-restore-source-audit` now reports explicit VS Code extension
201
+ rollback non-resurrection projection candidates, such as
202
+ `replacement_history` filter / tombstone paths, separately from deletion-based
203
+ repair primitives.
204
+ - `codex-restore-smoke --inspect-risky-rollout` now separates blocking retained
205
+ text candidates from quoted/tool-output matches. Direct turn text and
206
+ `replacement_history` keep the `app-server-restore-text-retained` status;
207
+ matches found only in fields such as `aggregatedOutput` report
208
+ `app-server-restore-text-quoted` with `blocking-candidates=no`.
209
+ - Added `throughline codex-rollback-model-visible-smoke`, a controlled
210
+ two-phase smoke for the unresolved rollback question. `--prepare` starts a
211
+ unique marker user turn and rolls it back; `--verify` later starts a model
212
+ turn that contains only the marker prefix, not the full marker. A returned
213
+ full marker reports `reproduced`; an explicit not-visible answer reports
214
+ `not-reproduced`. The command is gated by
215
+ `THROUGHLINE_EXPERIMENTAL_CODEX_ROLLBACK_MODEL_VISIBLE_SMOKE=1`. Live runs can
216
+ use `--marker-file` so the full marker is not printed into the same thread
217
+ being tested; marker-file prepares also use a unique per-trial prefix. Verify
218
+ output reports `rolledBackMarkerModelVisible` and `modelReportedNotVisible`
219
+ separately from `restartSafe`.
220
+ - Real controlled current-thread smoke on 2026-05-08 returned
221
+ `not-reproduced` both before and after a VS Code reload/reconnect command,
222
+ with `promptIncludesMarker: false` and no observed full marker. This weakens
223
+ the rollback-resurrection hypothesis for the controlled marker path enough to
224
+ remove the overbroad automatic Codex trim blocker. Retained compacted history
225
+ and same-thread host primitive audit remain diagnostics.
226
+ - Added `throughline codex-restore-source-audit`, a read-only local inventory of
227
+ Codex rollout, `session_index.jsonl`, `state_*.sqlite`, and VS Code
228
+ globalStorage / workspaceStorage candidates for an explicit Codex thread. It
229
+ now also scans VS Code `settings.json`, VS Code logs, and installed
230
+ OpenAI/Codex VS Code extension bundles for restore-path signals such as
231
+ `thread/read`, `thread/resume`, `thread/turns/list`, reconnect
232
+ `needs_resume`, persisted webview atoms, and follow-up queue signals.
233
+ Its proof scope is `local_restore_source_inventory_only`, and it does not
234
+ prove VS Code restart safety.
235
+ - Added `throughline codex-vscode-restore-smoke`, a manual two-phase VS Code
236
+ reload/reconnect proof protocol. `--prepare` injects a hidden active-work
237
+ marker memory behind `THROUGHLINE_EXPERIMENTAL_CODEX_VSCODE_RESTORE_SMOKE=1`;
238
+ `--verify` scans the rollout for a marker-free smoke prompt followed by an
239
+ assistant marker-only answer after prepare, and rejects marker leaks in the
240
+ user prompt. It reports `restartSafe: true` only with an explicit
241
+ `--after-vscode-restart` acknowledgement and marker proof.
242
+ - Real VS Code reload/reconnect marker proof passed for thread
243
+ `019dfddb-8288-7392-a461-bf3ebc5da409` with marker
244
+ `TL_CODEX_VSCODE_RESTORE_46888202`. This proves hidden developer memory
245
+ visibility across reconnect, not rollback-target non-resurrection.
246
+ - Tightened the VS Code restore smoke verifier after a false-positive hazard:
247
+ assistant marker mentions in normal progress text no longer count. The proof
248
+ now requires the marker-free smoke prompt and an assistant marker-only answer.
249
+ - Added `throughline codex-vscode-rollback-smoke`, a read-only rollback
250
+ non-resurrection verifier. It requires a rollback event, rolled-back user
251
+ text, a later user turn, restore-safety `ok`, and explicit
252
+ `--after-vscode-restart` before reporting `restartSafe: true`.
253
+ - Added `throughline codex-host-primitive-audit`, a read-only audit that
254
+ generates the installed Codex app-server JSON schema and checks whether a
255
+ same-thread rollback non-resurrection primitive exists. The primitive may
256
+ delete/rewrite retained rollback sources, or isolate/project them away from
257
+ model-visible input. It now also reports a host-agnostic same-thread repair
258
+ contract requiring a rollback non-resurrection guarantee, memory reinjection,
259
+ post-repair host reads, and restart/reconnect non-resurrection proof; VS Code
260
+ diagnostics can provide evidence but do not satisfy the contract. On
261
+ `codex-cli 0.128.0-alpha.1`, the audit reports
262
+ `diagnostic-only`: rollback/inject/new-thread primitives exist, but no
263
+ current-thread rollback non-resurrection primitive is exposed, and
264
+ `thread/resume(history)` is marked unstable/do-not-use with `thread_id`
265
+ ignored.
266
+ - Real incident-shaped live rollback run for thread
267
+ `019dfddb-8288-7392-a461-bf3ebc5da409` remains a `restoreSafety: risk`
268
+ incident: rollout recorded `thread_rolled_back` and injected active-work
269
+ memory, while `compacted.replacement_history` retained rollback-targeted user
270
+ text and read-only diagnostics later observed matching text after rollback.
271
+ Later app-server restore inspection separated direct user-message candidates
272
+ from quoted/tool-output matches; the current thread's retained app-server
273
+ matches are `aggregatedOutput` only, and the controlled model-visible smoke
274
+ did not reproduce marker resurrection. Automatic Codex trim is enabled again
275
+ with DB memory and turn-count guards.
276
+ - Codex trim dry-run plans and `doctor --trim --host codex` now expose the safe
277
+ continuation path as `new-thread-handoff-only`: use the guided entrypoint
278
+ `throughline codex-handoff-start --session codex:<thread-id>`, or validate the
279
+ handoff with `throughline codex-handoff-smoke --session codex:<thread-id>`, optionally
280
+ inspect the model-smoke boundary with
281
+ `throughline codex-handoff-model-smoke --session codex:<thread-id> --dry-run --json`,
282
+ render a fresh-thread handoff with
283
+ `throughline codex-resume --session codex:<thread-id> --format handoff`, and
284
+ start a new Codex thread, without mutating the current risky thread.
285
+ - Human-readable trim dry-run reports now truncate the inline curated memory
286
+ preview for scanability while leaving full `memoryPreview.text` intact in JSON
287
+ and in the Codex `codex-resume` safe-continuation command.
288
+ - `parseCodexRolloutFile` now exposes `userMessagesAfterRollback`,
289
+ `latestRollbackAt`, and `restoreSafety.rolledBackTexts` so rollback smoke
290
+ results carry enough audit evidence instead of only pass/fail status.
291
+ - Guarded execute now still checks rollout durability evidence when post-inject
292
+ live read visibility times out, so reports can include observed rollback
293
+ markers, observed injected memory, and post-execute restore-safety risk.
294
+ - Codex trim preflight / execute now reports planned restore-safety diagnostics:
295
+ if the planned rollback would remove user text that already appears in
296
+ `compacted.replacement_history`, Throughline reports
297
+ `planned_restore_safety_risk` as diagnostic evidence but does not refuse
298
+ solely for that reason.
299
+ - `codex-restore-source-audit` no longer uses very short retained rollback texts
300
+ as VS Code storage needles, avoiding false positives from generic prompts such
301
+ as `go`.
302
+ - Codex guarded execute no longer uses the old
303
+ `THROUGHLINE_EXPERIMENTAL_CODEX_TRIM=1` gate or the later
304
+ `THROUGHLINE_EXPERIMENTAL_CODEX_TRIM_EXECUTE=1` blocker. It now requires only
305
+ explicit `--execute`, Codex thread identity, injectable Throughline DB memory,
306
+ and rollout/app-server turn-count checks before mutation.
307
+ - Codex app-server helpers now report spawn failures explicitly instead of
308
+ waiting for a request timeout.
309
+ - Codex app-server stderr in diagnostics is now capped after warning
310
+ compaction, so external plugin/OAuth warnings cannot make smoke JSON
311
+ excessively large.
312
+ - `throughline codex-threads` lists read-only Codex rollout/thread candidates
313
+ for the current project so users can pass an explicit `--codex-thread-id`
314
+ without Throughline guessing the active thread.
315
+ - `throughline codex-threads` now sorts candidates by rollout file mtime, not
316
+ stale `session_index.jsonl` timestamps, so actively written threads appear
317
+ before old probe threads.
318
+ - Codex trim memory previews now apply `thread_rolled_back` rollout events
319
+ before building the active work thread, so rolled-back tail turns are not
320
+ reintroduced as current memory.
321
+ - Codex trim dry-run now reports a heuristic context reduction estimate when
322
+ rollout text is available: rollback-candidate estimated tokens, injected
323
+ memory estimated tokens, net estimated reduction, and reduction percentage.
324
+ This is intentionally labeled as `chars / 4`, not an exact host tokenizer
325
+ measurement.
326
+ - Codex rollout parsing now mirrors app-server turn counts for injected
327
+ active-work developer messages and for the latest post-rollback assistant
328
+ continuation turn. This keeps guarded trim preflight aligned after a real
329
+ rollback/inject cycle.
330
+ - Codex guarded trim now uses rollout/app-server data for rollback planning and
331
+ turn-count guards, but uses Throughline DB memory for injection when
332
+ available: older turns as L1 summaries, the latest 20 turns as full L2 bodies,
333
+ and L3 as references only; L3 bodies / tool payloads are not injected.
334
+ Execute refuses before mutation when only a rollout preview is available.
335
+ - `throughline doctor --codex` now reports context-refresh readiness, including
336
+ rollback source, inject memory source, the L1/L2/L3 memory contract, current
337
+ memory counts, and heuristic reduction estimate when available.
338
+ - `throughline doctor --codex` now reports the host primitive audit status and
339
+ prints `throughline codex-host-primitive-audit` as the next read-only command
340
+ for diagnostic detail.
341
+ - `throughline doctor --codex` labels context refresh as `ready` when the
342
+ executable guard inputs are present, even if restore-safety diagnostics are
343
+ risky. Those diagnostics are reported separately.
344
+ - `throughline doctor --codex` now reports the VS Code monitor task status and
345
+ prints the Reload Window note there too, because Codex Stop hook stdout is not
346
+ guaranteed to appear in the chat.
347
+ - `throughline doctor --codex` and human-readable guarded trim reports now label
348
+ L3 as references-only and explicitly say L3 bodies are not injected.
349
+ - Guarded Codex execute now performs the same rollout/app-server turn-count
350
+ check before rollback; mismatch or unavailable app-server counts refuse
351
+ execution before any rollback or inject request is sent.
352
+ - Codex app-server stderr in trim preflight / guarded execute now compacts
353
+ repeated unknown-turn item warnings while preserving the first occurrence and
354
+ unrelated diagnostics.
355
+ - Codex visibility smoke now waits for app-server notification events
356
+ (`item/agentMessage/delta` or `turn/completed`) after `turn/start`, so it does
357
+ not mistake an accepted model turn for completed model visibility.
358
+ - Codex visibility smoke can now verify the `inject -> resume -> turn/start`
359
+ path. Real-host smoke confirmed marker
360
+ `TL_CODEX_RESUME_AFTER_INJECT_REAL_20260506` after a post-inject resume.
361
+ - Codex CLI L1 summarization now uses the `codex exec` option set supported by
362
+ local `codex-cli 0.128.0-alpha.1`; the removed `--ask-for-approval` flag is
363
+ no longer passed. The subprocess also passes `--ignore-user-config` so
364
+ user-level Codex plugins/hooks are not loaded during the summarization call.
365
+ - Codex CLI summarization errors now include compacted stderr in JSON output,
366
+ preserving actionable `ERROR:` lines without dumping enormous HTML challenge
367
+ pages verbatim.
368
+ - `throughline monitor` is now host-aware for Claude and Codex state files.
369
+ Codex Stop hook writes `codex:<thread_id>` monitor state with `rolloutPath`,
370
+ snapshots verified rollout `token_count` usage when present, and marks
371
+ rollout-text estimates with `estimated: true` / `est` when no token-count
372
+ event is available. State filenames are URL-encoded so `codex:` session ids
373
+ remain portable. The compact row now displays used tokens over the model
374
+ context window, instead of percent plus remaining tokens.
375
+
376
+ ### Documentation
377
+ - Added integrated implementation/TODO plan and cross-links for the Codex dual
378
+ support and rollback trim design docs.
379
+ - README now documents Claude-primary behavior, optional Codex sidecar usage,
380
+ and the current dry-run-only state of context trim.
381
+ - npm packaging now includes `docs/` and `CHANGELOG.md`, so README-linked
382
+ design docs and the `throughline_handoff` example context are present in the
383
+ tarball.
384
+ - npm packaging also includes `.codex-sidecar.yml`, keeping the documented
385
+ sidecar diagnostics / dry-run examples reproducible from the package source.
386
+ - `npm test` now includes nested `src/cli/*.test.mjs` coverage in addition to
387
+ the top-level `src/*.test.mjs` tests.
388
+ - Recorded the 2026-05-06 Codex app-server rollback/inject spike: `thread/read`
389
+ can read persisted threads, `thread/rollback` requires a loaded thread via
390
+ `thread/resume`, and injected developer items are visible to the next turn.
391
+ - Recorded the 2026-05-06 real Codex-primary active-work smoke: injected
392
+ `codex-resume` developer context produced marker `TL_CODEX_VISIBLE_REAL_20260506_C`
393
+ in `item/agentMessage/delta`, confirming the rendered memory is model-visible
394
+ as current work in a real Codex host.
395
+ - Documented the current Codex-primary setup flow. Global install manages only
396
+ the Throughline Codex Stop hook / skill and preserves existing
397
+ non-Throughline hooks; users can verify natural capture with `doctor --codex`,
398
+ then summarize, render, or inject active-work memory through the `$throughline`
399
+ skill or the explicit Codex CLI surfaces.
400
+ - Recorded the 2026-05-06 final Codex Stop hook smoke: after the absolute-path
401
+ hook shape was installed, a newly started VSCode-origin Codex thread
402
+ `019dfd62-9a9d-7211-bf91-89d8e3fc908e` naturally advanced the latest DB
403
+ session to `codex:019dfd62-9a9d-7211-bf91-89d8e3fc908e` as reported by
404
+ `doctor --codex`.
405
+ - Added and completed the Codex monitor implementation plan, documenting the
406
+ host-aware state contract, Codex `rolloutPath`, verified `token_count`
407
+ usage, and explicit estimate labeling.
408
+
409
+ ## [0.3.24] — 2026-05-02
410
+
411
+ ### Added
412
+ - `shouldRecommendGitignore` in [src/vscode-task.mjs](src/vscode-task.mjs):
413
+ when `ensureMonitorTaskFile` transitions to `created` / `merged` / `repaired`
414
+ inside a git repository whose `.gitignore` lacks a `.vscode/tasks.json`-
415
+ matching entry, emit a one-time `<system-reminder>` to stdout recommending
416
+ `.gitignore` registration. Suppressed by a `.throughline-gitignore-noted`
417
+ marker so it does not repeat. Negation patterns (`!.vscode/tasks.json`) are
418
+ treated as explicit-track intent and still trigger the recommendation.
419
+
420
+ ### Why
421
+ - `.vscode/tasks.json` always contains environment-specific absolute paths
422
+ (`process.execPath`, the install location of `throughline.mjs`). Even though
423
+ v0.3.23 auto-repairs stale paths after the fact, the right answer is to not
424
+ commit it in the first place. The published npm tarball was already clean of
425
+ absolute paths (`files` field excludes `.vscode/`, no hardcoded paths in
426
+ source); this release strengthens runtime advice for the consumer side.
427
+
428
+ ## [0.3.23] — 2026-05-02
429
+
430
+ ### Added
431
+ - Cross-environment `.vscode/tasks.json` repair: when an existing Monitor task
432
+ references absolute paths that don't exist on the current machine
433
+ (e.g. a Windows path on a WSL2 clone), `ensureMonitorTaskFile` now rewrites
434
+ just `command` / `args` while preserving any `label` / `presentation` /
435
+ `isBackground` customization. New helpers `findMonitorTaskIndex` and
436
+ `isMonitorTaskBroken` (absolute-path + non-existent test) drive the new
437
+ `action: 'repaired'` branch, and `buildSetupNotice('repaired')` returns a
438
+ one-time `Reload Window` notice.
439
+ - `resolveThroughlineOnPath` in [src/cli/install.mjs](src/cli/install.mjs):
440
+ after `throughline install` completes, walk PATH to confirm `throughline`
441
+ resolves. If not, print a stderr fix recipe (`npm prefix -g` → add to
442
+ `~/.bashrc` → re-run `doctor`). Catches the silent-fail case where
443
+ `~/.npm-global/bin` is exported in `~/.profile` but not `~/.bashrc` (VSCode's
444
+ interactive non-login bash skips `.profile`).
445
+
446
+ ### Documentation
447
+ - README Troubleshooting now covers PATH resolution, WSL2 ↔ Windows PATH
448
+ crossover, cross-OS DB separation (each `os.homedir()` is its own DB), and
449
+ the auto-repair behavior for stale tasks.
450
+
451
+ ## [0.3.22] — 2026-04-19
452
+
453
+ ### Changed
454
+ - Register the `Stop` hook with `"async": true` so `throughline process-turn`
455
+ runs in the background and no longer blocks the user-visible turn completion
456
+ on the Haiku L1-summarization subprocess (which can take seconds to tens of
457
+ seconds). L1 summaries are only needed for the *next* `SessionStart`
458
+ injection, so there is no reason to make the current turn wait for them.
459
+ `SessionStart` and `UserPromptSubmit` remain synchronous because their work
460
+ must complete before the next turn begins.
461
+
462
+ ### Migration
463
+ - Existing installs need `throughline uninstall && throughline install` to
464
+ pick up the new `async` flag. The install dedup compares the `command`
465
+ string, so a re-install without uninstalling first will skip the already-
466
+ registered (but still synchronous) entry.
467
+
468
+ ## [0.3.21] — 2026-04-19
469
+
470
+ ### Changed
471
+ - `throughline install` now writes the `/tl` and `/sc-detail` slash command
472
+ definitions to `~/.claude/commands/*.md` (user scope) instead of relying on
473
+ per-project `.claude/commands/`. New projects no longer need to copy the
474
+ slash command files manually.
475
+
476
+ ## [0.3.20] — 2026-04-19
477
+
478
+ ### Changed
479
+ - Monitor's context-exhaustion warning now recommends `/tl` instead of
480
+ `/clear`, so the suggested action does not break the handoff baton path.
481
+
482
+ ## [0.3.19] — 2026-04-18
483
+
484
+ ### Added
485
+ - `ensureMonitorTaskFile` now emits a one-time `<system-reminder>` to stdout
486
+ the moment it creates or merges a `.vscode/tasks.json`, so Claude can tell
487
+ the user a **Developer: Reload Window** is needed to activate the
488
+ `folderOpen` task. The notice is silent on the `already_present` path so it
489
+ fires at most once per project.
490
+
491
+ ## [0.3.18] — 2026-04-18
492
+
493
+ ### Added
494
+ - Fan-out of `ensureMonitorTaskFile` to **all three hooks** (`SessionStart`,
495
+ `UserPromptSubmit`, `Stop`) so `.vscode/tasks.json` is provisioned by
496
+ whichever hook fires first in a given environment. Previously only `Stop`
497
+ invoked it, which meant projects where `Stop` did not fire on the first
498
+ session never got the monitor task. The provisioning logic is idempotent,
499
+ so the redundant calls are no-ops once the task exists.
500
+
501
+ ## [0.3.0] — 2026-04-18
502
+
503
+ This is the first release line that supports the schema v7 / `/tl` baton
504
+ handoff with in-flight memo and L3 thinking storage. `0.3.1` through `0.3.17`
505
+ were rapid-fire monitor render-bug iterations published to npm but not tagged
506
+ on GitHub; they are summarized in the rollup section below for completeness.
507
+
508
+ ### Added
509
+ - **In-flight memo via `/tl`** (schema v7). When `/tl` fires, the
510
+ `UserPromptSubmit` hook writes a baton row, then Claude itself pipes a
511
+ Markdown memo (next planned move, current hypothesis, open questions,
512
+ in-progress TODOs) into `throughline save-inflight`, which attaches it to
513
+ `handoff_batons.memo_text`. The next `SessionStart` injects the memo at the
514
+ top of the resume context so the new Claude picks up mid-thought.
515
+ - **Extended thinking captured at L3.** Assistant `thinking` blocks are
516
+ persisted in `details` with `kind='thinking'`. The most recent turn's
517
+ thinking is injected inline above the L2 history on `SessionStart`; older
518
+ thinking remains retrievable via `throughline detail <time>`.
519
+ - **Resume reframing.** The injected context is presented as "resuming an
520
+ interrupted task" rather than "reading past logs", so the new session
521
+ behaves like a continuation rather than a recap.
522
+
523
+ ## [0.2.0] — 2026-04-18
524
+
525
+ ### Added
526
+ - **Explicit `/tl` baton handoff** (schema v6). Replaces the auto-inheritance
527
+ heuristics. The previous session writes a baton, the next session consumes
528
+ it within a 1-hour TTL, and merge happens via deterministic
529
+ `UPDATE session_id = ?` inside a `BEGIN IMMEDIATE` transaction. Sessions
530
+ without a baton start clean — no false-positive carryover.
531
+
532
+ ## [0.1.0] — 2026-04-17
533
+
534
+ ### Added
535
+ - Initial public release on npm. Schema v5 (L1/L2/L3 with `kind` and
536
+ `source_id` columns on `details`).
537
+ - CLI: `install`, `uninstall`, `doctor`, `status`, `monitor`, `detail`.
538
+ - Hook entry points: `session-start`, `process-turn`, `prompt-submit`.
539
+ - Multi-session token monitor reading real `message.usage` from the
540
+ Claude Code transcript JSONL (no `length / 4` heuristics) with 1M-context
541
+ detection.
542
+ - Zero runtime dependencies; uses Node 22.5+ built-in `node:sqlite`.
543
+
544
+ ---
545
+
546
+ ## Unreleased pre-0.3.18 iterations (npm-only, not tagged on GitHub)
547
+
548
+ These versions shipped to npm in rapid succession on 2026-04-18 while
549
+ debugging a single class of monitor render bugs (rows stacking instead of
550
+ redrawing in place inside Windows ConPTY + VS Code task terminals). They are
551
+ rolled up here because individually they are not interesting consumption
552
+ units — the user-visible result is "the monitor finally renders correctly
553
+ across PTY, ConPTY, VS Code task terminal, and panel resize".
554
+
555
+ | Version | Theme |
556
+ | ------- | ----- |
557
+ | `0.3.1`–`0.3.2` | Monitor crash resilience, accurate 1M-context detection, color-blind-safe markers. |
558
+ | `0.3.3` | `.vscode/tasks.json` auto-provisioning (two-stage merge, JSONC detection). |
559
+ | `0.3.4`–`0.3.5` | Stop-hook `state.usage` snapshot, `doctor --session` diagnostic, `(Nm ago)` per-row stamp, columns polling. |
560
+ | `0.3.6`–`0.3.12` | Successive guesses at the "rows stacking" render bug (columns fallback, `isTTY` branching, `clearScreen`, alt screen, `type:shell`). All later confirmed off-target by the `--diag` instrumentation added in `0.3.11`. |
561
+ | `0.3.13` | Root-cause fix: removed the `>= 40` columns floor in `resolveColumns` that was misclassifying real 30-cell panels as "insane" and falling back to 200, which then wrapped output and undercounted CUU on redraw. |
562
+ | `0.3.14`–`0.3.15` | Diagnostic surfacing (startup header, per-frame columns) confirming that `process.stdout.columns` does not track panel resize on Windows ConPTY + VS Code tasks. |
563
+ | `0.3.16` | New module `src/terminal-size.mjs`: query the terminal directly via OSC 18t (`\x1b[18t`) and parse the `\x1b[8;rows;cols t` reply on stdin in raw mode. Resize now follows panel width even when Node's `columns` is frozen. |
564
+ | `0.3.17` | Force a full `clearScreen` (`\x1b[2J\x1b[3J\x1b[H`) on every resize-triggered redraw so the previous, wrongly-sized frame can no longer stack beneath the new one. |
565
+
566
+ ### Lessons preserved as memory
567
+
568
+ The seven-version stretch of `0.3.6`–`0.3.12` was guesswork without
569
+ measurement; once `--diag` (`0.3.11`) and `terminal-size.mjs` (`0.3.16`) were
570
+ added, the real cause was found in two more versions. This is recorded as a
571
+ working-discipline note: when a terminal- or platform-specific bug resists
572
+ two attempts, instrument first instead of patching again.
573
+
574
+ ---
575
+
576
+ [0.3.22]: https://github.com/kitepon-rgb/Throughline/releases/tag/v0.3.22
577
+ [0.3.21]: https://github.com/kitepon-rgb/Throughline/compare/v0.3.19...v0.3.21
578
+ [0.3.20]: https://github.com/kitepon-rgb/Throughline/compare/v0.3.19...v0.3.20
579
+ [0.3.19]: https://github.com/kitepon-rgb/Throughline/releases/tag/v0.3.19
580
+ [0.3.18]: https://github.com/kitepon-rgb/Throughline/releases/tag/v0.3.18
581
+ [0.3.0]: https://github.com/kitepon-rgb/Throughline/releases/tag/v0.3.0
582
+ [0.2.0]: https://github.com/kitepon-rgb/Throughline/releases/tag/v0.2.0
583
+ [0.1.0]: https://github.com/kitepon-rgb/Throughline/compare/v0.1.0