throughline 0.5.0 → 0.6.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 (51) hide show
  1. package/.codex-sidecar.yml +5 -0
  2. package/CHANGELOG.md +60 -2
  3. package/README.ja.md +37 -21
  4. package/README.md +79 -29
  5. package/bin/throughline.mjs +10 -0
  6. package/docs/00_overview.md +34 -0
  7. package/docs/{L1_L2_L3_REDESIGN.md → 01_l1_l2_l3_redesign.md} +3 -3
  8. package/docs/{THROUGHLINE_CLEAR_AUTO_HANDOFF_PLAN.md → 02_clear_auto_handoff_plan.md} +6 -6
  9. package/docs/{INHERITANCE_ON_CLEAR_ONLY.md → 03_inheritance_on_clear_only.md} +3 -3
  10. package/docs/{PUBLIC_RELEASE_PLAN.md → 04_public_release_plan.md} +3 -3
  11. package/docs/{THROUGHLINE_CODEX_FIRST_ROADMAP.md → 05_codex_first_roadmap.md} +9 -9
  12. package/docs/{THROUGHLINE_CODEX_TRIM_ROLLBACK_FIX_PLAN.md → 06_codex_trim_rollback_fix_plan.md} +6 -6
  13. package/docs/{THROUGHLINE_CODEX_TRIM_IMPLEMENTATION_PLAN.md → 07_codex_trim_implementation_plan.md} +10 -10
  14. package/docs/{THROUGHLINE_CODEX_DUAL_SUPPORT.md → 08_codex_dual_support.md} +8 -8
  15. package/docs/{throughline-rollback-context-trim-insight.md → 09_rollback_context_trim_insight.md} +5 -5
  16. package/docs/{THROUGHLINE_TRANSCRIPT_INJECTION_PLAN.md → 10_transcript_injection_plan.md} +6 -6
  17. package/docs/{THROUGHLINE_CODEX_MONITOR_IMPLEMENTATION_PLAN.md → 11_codex_monitor_implementation_plan.md} +1 -1
  18. package/docs/12_desktop_clear_handoff_plan.md +215 -0
  19. package/docs/adr/0001-claude-primary-codex-adapter.md +22 -0
  20. package/docs/archive/README.md +3 -3
  21. package/docs/archive/THROUGHLINE_NEXT_STEPS.md +3 -3
  22. package/package.json +2 -1
  23. package/rag/01-hooks/raw/session-end-reasons.md +21 -0
  24. package/{docs/RAG → rag}/INDEX.md +20 -16
  25. package/src/auditor-context.mjs +330 -0
  26. package/src/auditor-context.test.mjs +296 -0
  27. package/src/baton.mjs +2 -2
  28. package/src/cli/auditor-context.mjs +141 -0
  29. package/src/cli/auditor-context.test.mjs +148 -0
  30. package/src/cli/codex-hook.mjs +20 -0
  31. package/src/codex-thread-index.mjs +11 -2
  32. package/src/db.mjs +2 -2
  33. package/src/hook-entrypoints.test.mjs +102 -0
  34. package/src/package-files.test.mjs +1 -0
  35. package/src/phase0-spotter-contract.test.mjs +280 -0
  36. package/src/prompt-submit.mjs +2 -2
  37. package/src/resume-context.mjs +1 -1
  38. package/src/session-merger.mjs +1 -1
  39. package/src/session-start.mjs +62 -3
  40. package/src/spike-transcript-writer.mjs +1 -1
  41. package/src/state-file.mjs +1 -1
  42. package/src/token-monitor.mjs +1 -1
  43. package/src/transcript-reader.mjs +71 -0
  44. package/src/turn-backfill.mjs +131 -0
  45. package/src/turn-backfill.test.mjs +213 -0
  46. package/src/turn-processor.mjs +28 -40
  47. /package/docs/{throughline-codex-trim-rollback-incident-report.md → audit-2026-05/codex-trim-rollback-incident-report.md} +0 -0
  48. /package/{docs/RAG/_raw/01-hooks → rag/01-hooks/raw}/hooks-reference-extract.md +0 -0
  49. /package/{docs/RAG/_raw/02-messages-api → rag/02-messages-api/raw}/messages-api-extract.md +0 -0
  50. /package/{docs/RAG/_raw/03-settings → rag/03-settings/raw}/sessions-extract.md +0 -0
  51. /package/{docs/RAG/_raw/04-skills → rag/04-skills/raw}/initialUserMessage-investigation.md +0 -0
@@ -19,6 +19,7 @@ allowed_paths:
19
19
  - bin/
20
20
  - docs/
21
21
  - package.json
22
+ - spike/
22
23
  - src/
23
24
 
24
25
  deny_paths:
@@ -35,6 +36,10 @@ deny_paths:
35
36
  - .codex-sidecar/logs/
36
37
 
37
38
  presets:
39
+ work:
40
+ workflow: work
41
+ readonly: false
42
+ prompt: "Implement the requested scoped change in the isolated worktree, run the listed verification commands, and report results."
38
43
  review:
39
44
  workflow: review
40
45
  readonly: true
package/CHANGELOG.md CHANGED
@@ -10,6 +10,64 @@ shipped to npm but were not individually tagged on GitHub.
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.6.1] — 2026-07-13
14
+
15
+ ### Added
16
+
17
+ - **Spotter auditor context v1.** `throughline auditor-context` adds an
18
+ opt-in, JSON-only, read-only projection for Spotter. It verifies the exact
19
+ session/project and the latest completed L2 user/assistant pair against an
20
+ origin/turn/SHA-256 freshness expectation, supplied explicitly or derived
21
+ from a Claude JSONL or Codex rollout. Only `fresh` returns bounded pair
22
+ bodies; all other states return no bodies. The command never creates,
23
+ migrates, or writes the Throughline DB. Opt-in and any onward transmission
24
+ remain Spotter responsibilities.
25
+
26
+ ## [0.6.0] — 2026-07-12
27
+
28
+ L2 capture is rebuilt from "save only the last pair each Stop" to a
29
+ full-transcript backfill, closing the permanent holes that left `/clear`
30
+ handoffs with empty or partial memory. Also documents that Claude Code
31
+ Desktop `/clear` cannot be auto-detected by hooks (upstream client bug).
32
+
33
+ ### Fixed
34
+
35
+ - **L2 capture completeness (backfill).** The Stop hook previously stored
36
+ only the last user/assistant pair, so any Stop that fired before the
37
+ transcript flushed — or did not fire at all — became a permanent gap in
38
+ `bodies`. Measured omission of completed logical turns was 27% (Desktop) /
39
+ 41% (VS Code). `turn-processor` now scans the whole transcript into logical
40
+ turn groups and backfills every uncaptured turn (`src/turn-backfill.mjs`
41
+ `backfillBodies`). On a `/clear` merge, `session-start` also backfills the
42
+ predecessor's transcript **before** rendering the resume context, so the
43
+ turn immediately preceding `/clear` is recovered. Verified end-to-end on a
44
+ real Desktop `/tl` → `/clear` handoff (successor inherits the full
45
+ predecessor conversation).
46
+ - Group-level dedup: a logical turn group whose fragments are already in
47
+ `bodies` is skipped whole, preventing duplicate pairs when a turn spans
48
+ multiple Stops (interrupts, plan rejections, AskUserQuestion replies).
49
+ - Representative fragment = the last non-junk assistant fragment; API
50
+ notices (e.g. session-limit messages) no longer overwrite the real reply.
51
+ - `created_at` uses the transcript entry timestamp so bulk-recovered rows
52
+ preserve conversation order for the L2 window / current anchor.
53
+ - Predecessor transcript path is derived deterministically from the project
54
+ path (`deriveTranscriptPath`); the state file is only a fallback, because
55
+ a predecessor whose Stop never fired has no state file.
56
+ - `readTranscript` now excludes `isSidechain` entries.
57
+
58
+ ### Known limitations
59
+
60
+ - **Claude Code Desktop `/clear` is undetectable by hooks.** Desktop sends
61
+ SessionStart `source:"startup"` (not `"clear"`) and SessionEnd
62
+ `reason:"other"` (indistinguishable from session deletion), so the auto
63
+ handoff path never fires there. Reported upstream
64
+ ([anthropics/claude-code#76704](https://github.com/anthropics/claude-code/issues/76704)).
65
+ Workaround: run `/tl` before `/clear` on Desktop.
66
+ - **Desktop can drop assistant text from the transcript entirely.** In long
67
+ tool-heavy turns, intermediate assistant text blocks are sometimes never
68
+ written to the session JSONL (permanent, no local recovery path). Reported
69
+ upstream ([anthropics/claude-code#76706](https://github.com/anthropics/claude-code/issues/76706)).
70
+
13
71
  ## [0.5.0] — 2026-05-24
14
72
 
15
73
  This release closes out the v0.5 transcript-injection investigation and
@@ -64,9 +122,9 @@ are absent and have no effect on the shipped path.
64
122
 
65
123
  ### Added
66
124
 
67
- - `docs/THROUGHLINE_TRANSCRIPT_INJECTION_PLAN.md`: full Phase 0 plan and
125
+ - `docs/10_transcript_injection_plan.md`: full Phase 0 plan and
68
126
  result log for the D / `initialUserMessage` investigation.
69
- - `docs/RAG/`: third-party spec knowledge base (Claude Code hooks
127
+ - `rag/`: third-party spec knowledge base (Claude Code hooks
70
128
  reference, Anthropic Messages API, sessions docs, openclaude
71
129
  `initialUserMessage` source extract) used as the grounding for the
72
130
  no-go calls above.
package/README.ja.md CHANGED
@@ -38,14 +38,18 @@ skill も登録する。75% 自動発火は token-monitor 依存ではなく、
38
38
 
39
39
  ## 他の手段との比較
40
40
 
41
- | | Throughline | MemGPT / SummaryBufferMemory | 素の Claude Code |
42
- |---|---|---|---|
43
- | **圧縮の軸** | コンテンツの **種類** (テキスト vs ツール I/O) | **新旧** (古い 要約) | 無し |
44
- | **コーディング用途への適合** | ツール I/O こそ重い 80% | 残したい部分まで圧縮される | |
45
- | **`/clear` 後の生存** | ✅ SQLite + typed `/clear` / `/tl` バトン | ホスト依存 | |
46
- | **誤継承リスク** | (typed `/clear` / `/tl` が前任を指名) | | |
47
- | **ランタイム依存** | **ゼロ** (Node 22.5+ 同梱の `node:sqlite`) | 多数 | — |
48
- | **マルチセッション トークン監視** | Claude 実測 `message.usage`、Codex rollout `token_count` | | |
41
+ | | **Throughline** | `/clear` (組み込み) | `/compact` (組み込み) | MemGPT / SummaryBufferMemory |
42
+ |---|---|---|---|---|
43
+ | **何をする** | ツール I/O を SQLite に退避、本文は残す | ウィンドウを全消去 | ウィンドウ全体を LLM 要約 | 新旧で要約 |
44
+ | **圧縮の軸** | コンテンツの **種類** (テキスト vs ツール I/O) | 無し全消去 | **新旧** (一律) | **新旧** (一律) |
45
+ | **境界後に残る記憶** | ✅ 直近 20 ターン本文 + それ以前 L1 + L3 オンデマンド | ゼロ | 一個の要約 (情報欠落) | △ 要約 (情報欠落) |
46
+ | **ツール I/O の扱い** | L3 に退避、`/sc-detail HH:MM:SS` で取り戻せる | 消える | 要約に溶けて読めない | 要約に溶ける |
47
+ | **コーディング用途への適合** | ツール I/O こそ重い 80% | — 文脈が切れる | ただし不可逆 | 中 |
48
+ | **誤継承リスク** | (typed `/clear` / `/tl` が前任を指名) | n/a | n/a | 高 |
49
+ | **ランタイム依存** | **ゼロ** (Node 22.5+ 同梱の `node:sqlite`) | n/a | n/a | 多数 |
50
+ | **マルチセッション トークン監視** | ✅ 実測 `message.usage` / Codex rollout `token_count` | — | — | — |
51
+
52
+ **ひとことで**: `/clear` は全部捨てる、`/compact` は全部混ぜる、Throughline は **書いた本文はそのまま残し、ツール出力 (= 80% の重量物) だけ退避** する。
49
53
 
50
54
  <details>
51
55
  <summary><b>なぜこれが効くのか — 80% ツール I/O 問題</b></summary>
@@ -54,18 +58,25 @@ skill も登録する。75% 自動発火は token-monitor 依存ではなく、
54
58
  ファイル読み込み、Bash 出力、grep 結果。これらは Claude が即座に消費するデータですが、
55
59
  コンテキスト上には永久に残り、ウィンドウ上限に向かって押し出されていきます。
56
60
 
57
- Throughline はこの問題を、会話を **時間ではなく種類** で分離することで解決します:
61
+ ```mermaid
62
+ xychart-beta
63
+ title "コーディング 50 ターン後のコンテキスト (典型例)"
64
+ x-axis ["Throughline 無し", "/clear + Throughline 再開後"]
65
+ y-axis "コンテキスト内トークン数" 0 --> 140000
66
+ bar [125000, 13000]
67
+ ```
58
68
 
59
69
  ```
60
70
  Throughline 無し (50 ターン、/clear なし):
61
- コンテキスト = ユーザー文 + アシスタント文 + ツール I/O + システムメッセージ
62
- 125,000 トークン (うち 80% は二度と読み返さないツール I/O)
71
+ ユーザー / アシスタント本文 ~25,000 tok ████
72
+ ツール I/O (80%) ~100,000 tok ████████████████
73
+ ≈ 125,000 tok 合計
63
74
 
64
75
  Throughline 有り (50 ターン → /clear → 再開):
65
- コンテキスト = 直近 20 ターンの会話本文 (L2)
66
- + それ以前 30 ターンの一行要約 (L1)
67
- + ツール I/O ゼロ (L3 — SQLite に退避、必要時にだけ取得)
68
- ≈ 13,000 トークン同じ判断、同じ文脈、90% 軽量
76
+ 直近 20 ターン L2 ~10,000 tok ██
77
+ それ以前 30 ターン L1 ~3,000 tok ▌
78
+ ツール I/O 0 tok (SQLite 退避、オンデマンド取得)
79
+ ≈ 13,000 tok — 90% 軽量
69
80
  ```
70
81
 
71
82
  MemGPT や LangChain の SummaryBufferMemory が **新旧** で圧縮するのに対し、
@@ -210,6 +221,9 @@ S1 (4 ターン) --/clear--> S2 (S1 を auto-merge + 3 ターン追加) --/clear
210
221
 
211
222
  ---
212
223
 
224
+ <details>
225
+ <summary><b>Codex sidecar と Codex trim</b> — operator 向け adapter 詳細 (クリックで展開)</summary>
226
+
213
227
  ## Codex sidecar と Codex trim
214
228
 
215
229
  Throughline の主軸は引き続き **Claude Code** です。Codex 対応は、Claude hooks /
@@ -227,6 +241,8 @@ memory inject を直接実行します。Claude 側は `/clear` での auto path
227
241
  SessionStart 注入の Reading Contract / Continuation Instruction で同じ意図を
228
242
  継承しています。
229
243
 
244
+ </details>
245
+
230
246
  ---
231
247
 
232
248
  ## マルチセッション トークン監視
@@ -306,12 +322,12 @@ Throughline state をまだ書いていない現在セッションも表示で
306
322
 
307
323
  ## 設計ドキュメント
308
324
 
309
- - [`docs/L1_L2_L3_REDESIGN.md`](docs/L1_L2_L3_REDESIGN.md) — L1/L2/L3 差分階層モデルの **設計仕様書** (schema v4 ベース + v5 L3 分類拡張)。記憶階層化ルールの正典
310
- - [`docs/INHERITANCE_ON_CLEAR_ONLY.md`](docs/INHERITANCE_ON_CLEAR_ONLY.md) — `/tl` バトン引き継ぎ方式の設計判断記録 (schema v6–v7)
311
- - [`docs/THROUGHLINE_CODEX_DUAL_SUPPORT.md`](docs/THROUGHLINE_CODEX_DUAL_SUPPORT.md) — Claude 主軸を維持したまま Codex 対応を足すための architecture brief
312
- - [`docs/throughline-rollback-context-trim-insight.md`](docs/throughline-rollback-context-trim-insight.md) — rollback / trim 設計 insight。復元 memory を current work として読ませる制約も記録
313
- - [`docs/THROUGHLINE_CODEX_TRIM_IMPLEMENTATION_PLAN.md`](docs/THROUGHLINE_CODEX_TRIM_IMPLEMENTATION_PLAN.md) — Claude/Codex 両対応と rollback trim の統合 TODO 計画
314
- - [`docs/PUBLIC_RELEASE_PLAN.md`](docs/PUBLIC_RELEASE_PLAN.md) — 公開配布化プラン、§ 0 フォールバック禁止ルール、バージョン別実装ステータス
325
+ - [`docs/01_l1_l2_l3_redesign.md`](docs/01_l1_l2_l3_redesign.md) — L1/L2/L3 差分階層モデルの **設計仕様書** (schema v4 ベース + v5 L3 分類拡張)。記憶階層化ルールの正典
326
+ - [`docs/03_inheritance_on_clear_only.md`](docs/03_inheritance_on_clear_only.md) — `/tl` バトン引き継ぎ方式の設計判断記録 (schema v6–v7)
327
+ - [`docs/08_codex_dual_support.md`](docs/08_codex_dual_support.md) — Claude 主軸を維持したまま Codex 対応を足すための architecture brief
328
+ - [`docs/09_rollback_context_trim_insight.md`](docs/09_rollback_context_trim_insight.md) — rollback / trim 設計 insight。復元 memory を current work として読ませる制約も記録
329
+ - [`docs/07_codex_trim_implementation_plan.md`](docs/07_codex_trim_implementation_plan.md) — Claude/Codex 両対応と rollback trim の統合 TODO 計画
330
+ - [`docs/04_public_release_plan.md`](docs/04_public_release_plan.md) — 公開配布化プラン、§ 0 フォールバック禁止ルール、バージョン別実装ステータス
315
331
  - [`CHANGELOG.md`](CHANGELOG.md) — リリース履歴
316
332
  - [`docs/archive/`](docs/archive/) — 破棄済み旧設計 (CONCEPT 初期案、session-linking 実験記録など)
317
333
 
package/README.md CHANGED
@@ -50,14 +50,18 @@ guarded `trim --execute --host codex` surface.
50
50
 
51
51
  ## How it compares
52
52
 
53
- | | Throughline | MemGPT / SummaryBufferMemory | Plain Claude Code |
54
- |---|---|---|---|
55
- | **Compression axis** | content **type** (text vs tool I/O) | **recency** (old summarized) | none |
56
- | **Coding-assistant fit** | high tool I/O is the heavy 80% | mediumalso compresses what you want to keep | |
57
- | **`/clear` survival** | ✅ via SQLite + typed `/clear` / `/tl` baton | depends on host | ❌ |
58
- | **Auto-inheritance risk** | low (typed `/clear` or `/tl` names the predecessor) | high | |
59
- | **Runtime deps** | **zero** (Node 22.5+ built-in `node:sqlite`) | many | — |
60
- | **Multi-session token monitor** | Claude real `message.usage`; Codex rollout `token_count` when available | | |
53
+ | | **Throughline** | `/clear` (built-in) | `/compact` (built-in) | MemGPT / SummaryBufferMemory |
54
+ |---|---|---|---|---|
55
+ | **What it does** | retire tool I/O to SQLite, keep text in-context | wipe the whole window | LLM-summarize the whole window | recency-based summarize |
56
+ | **Compression axis** | content **type** (text vs tool I/O) | nonefull wipe | **recency** (uniform) | **recency** (uniform) |
57
+ | **Memory after the boundary** | ✅ recent 20 turns verbatim + older as L1 + L3 on demand | ❌ zero | △ lossy single summary | △ lossy summary |
58
+ | **Tool I/O handling** | retired to L3, retrievable by `/sc-detail HH:MM:SS` | gone | folded into summary, unreadable | folded into summary |
59
+ | **Coding-assistant fit** | high tool I/O is the heavy 80% | low — you lose the thread | medium but irreversible | medium |
60
+ | **Auto-inheritance risk** | low (typed `/clear` / `/tl` names the predecessor) | n/a | n/a | high |
61
+ | **Runtime deps** | **zero** (Node 22.5+ built-in `node:sqlite`) | n/a | n/a | many |
62
+ | **Multi-session token monitor** | ✅ real `message.usage` / Codex rollout `token_count` | — | — | — |
63
+
64
+ **Short version**: `/clear` throws everything away, `/compact` blurs everything together, Throughline keeps the *text* you wrote verbatim and only retires the *tool output* — which is where 80% of the bloat lives.
61
65
 
62
66
  <details>
63
67
  <summary><b>Why this matters — the 80% tool-I/O problem</b></summary>
@@ -67,24 +71,32 @@ file reads, Bash output, grep results. This data is consumed the moment Claude
67
71
  acts on it, but it stays in the context forever, pushing you toward the window
68
72
  limit.
69
73
 
70
- Throughline fixes this by separating conversation content by **type, not time**:
74
+ ```mermaid
75
+ xychart-beta
76
+ title "Context after 50 turns of coding work (typical session)"
77
+ x-axis ["Without Throughline", "After /clear + Throughline resume"]
78
+ y-axis "Tokens in context" 0 --> 140000
79
+ bar [125000, 13000]
80
+ ```
71
81
 
72
82
  ```
73
83
  Without Throughline (50 turns, no /clear):
74
- Context = user text + assistant text + tool I/O + system messages
75
- ≈ 125,000 tokens (80% is tool I/O you'll never re-read)
84
+ user/assistant text ~25,000 tok ████
85
+ tool I/O (80%) ~100,000 tok ████████████████
86
+ ≈ 125,000 tok total
76
87
 
77
88
  With Throughline (50 turns → /clear → resume):
78
- Context = recent 20 turns of conversation text (L2)
79
- + older 30 turns as one-line summaries (L1)
80
- + zero tool I/O (L3 — retired to SQLite, on-demand)
81
- ≈ 13,000 tokenssame decisions, same context, 90% lighter
89
+ recent 20 turns L2 ~10,000 tok ██
90
+ older 30 turns L1 ~3,000 tok ▌
91
+ tool I/O 0 tok (retired to SQLite, on-demand)
92
+ ≈ 13,000 tok total — 90% lighter
82
93
  ```
83
94
 
95
+ Throughline separates conversation content by **type, not time**: human-readable
96
+ conversation stays in-context, machine-generated tool output retires to L3.
84
97
  Unlike MemGPT or LangChain's SummaryBufferMemory which compress by **recency**
85
- (old = summarized), Throughline separates by **content type**: human-readable
86
- conversation stays, machine-generated tool output retires. This is purpose-built
87
- for coding assistants where tool I/O is heavy but transient.
98
+ (old = summarized), this is purpose-built for coding assistants where tool I/O
99
+ is heavy but transient.
88
100
 
89
101
  The retired L3 data isn't lost — Claude can pull it back on demand via
90
102
  `throughline detail <time>` when a past turn's tool output becomes relevant
@@ -97,7 +109,7 @@ Anthropic API usage from the transcript JSONL (no `length / 4` heuristics).
97
109
 
98
110
  ---
99
111
 
100
- ## Three-layer memory model (schema v7)
112
+ ## Three-layer memory model (schema v8)
101
113
 
102
114
  ```mermaid
103
115
  flowchart LR
@@ -242,6 +254,9 @@ S1 (4 turns) --/clear--> S2 (auto-merges S1, adds 3 turns) --/clear--> S3 (auto-
242
254
 
243
255
  ---
244
256
 
257
+ <details>
258
+ <summary><b>Codex sidecar and Codex trim</b> — operator-level adapter details (click to expand)</summary>
259
+
245
260
  ## Codex sidecar and Codex trim
246
261
 
247
262
  Throughline is still **Claude Code first**. Codex support is an adapter layer:
@@ -535,6 +550,8 @@ the full text remains in `--json` as `memoryPreview.text`, and for Codex the
535
550
  fresh-thread continuation can be guided with `codex-handoff-start` or rendered
536
551
  directly with the `codex-resume` command shown in the fresh-thread continuation path.
537
552
 
553
+ </details>
554
+
538
555
  ---
539
556
 
540
557
  ## Multi-session token monitor
@@ -772,6 +789,35 @@ project history.
772
789
 
773
790
  ---
774
791
 
792
+ ## Spotter auditor context (read-only)
793
+
794
+ `throughline auditor-context` is a **Spotter-only, opt-in read-only
795
+ projection** for an auditor. It does not create, migrate, or write the
796
+ Throughline database. The caller must name an exact `--session` and `--project`;
797
+ the stored session must belong to that project root (or one of its descendants).
798
+
799
+ It returns only completed L2 user/assistant pairs—never L1 summaries, L3 tool
800
+ details, developer messages, or an in-flight Codex turn. Freshness is checked
801
+ against the latest completed pair by origin session, turn number, and normalized
802
+ SHA-256 hashes. Supply that expectation either explicitly, or derive it from a
803
+ Claude JSONL / Codex rollout with `--host claude|codex --transcript`; the two
804
+ sources are mutually exclusive. Returned context is bounded by `--recent-turns`
805
+ (default 2), `--max-body-chars` (1,200), and `--max-total-chars` (4,000).
806
+
807
+ The command is JSON-only. `fresh` is the only status that contains pair bodies;
808
+ `empty`, `stale`, `session_mismatch`, `unavailable`, and `schema_mismatch`
809
+ return no bodies and still exit successfully. Argument and internal errors are
810
+ fixed JSON errors on stderr with a non-zero exit. Spotter owns the
811
+ decision to opt in and any onward transmission of this local projection;
812
+ Throughline only reads and projects it.
813
+
814
+ ```bash
815
+ throughline auditor-context --session claude-session-id --project "$PWD" \
816
+ --host claude --transcript "$HOME/.claude/projects/.../session.jsonl" --json
817
+ ```
818
+
819
+ ---
820
+
775
821
  ## Requirements
776
822
 
777
823
  - **Node.js >= 22.5** (for the built-in `node:sqlite` module — no native build
@@ -795,7 +841,7 @@ plain `.mjs` files.
795
841
  └── <session_id>.json Per-session activity state for the monitor
796
842
  ```
797
843
 
798
- Schema v7:
844
+ Schema v8:
799
845
 
800
846
  - `sessions` — one row per `session_id`, with `project_path` and `merged_into`
801
847
  - `skeletons` — L1 one-liners, keyed by `(session_id, origin_session_id, turn, role)`
@@ -827,7 +873,7 @@ The only tolerated silent paths are:
827
873
  - JSONL per-line parse tolerance (tail partial writes are part of the format spec)
828
874
  - State-file corruption recovery (files are idempotently regenerated next turn)
829
875
 
830
- See [`docs/PUBLIC_RELEASE_PLAN.md §0`](docs/PUBLIC_RELEASE_PLAN.md) for the full
876
+ See [`docs/04_public_release_plan.md §0`](docs/04_public_release_plan.md) for the full
831
877
  rule.
832
878
 
833
879
  ---
@@ -852,6 +898,10 @@ See [`src/haiku-summarizer.mjs`](src/haiku-summarizer.mjs) for the implementatio
852
898
 
853
899
  ## Troubleshooting
854
900
 
901
+ ### Claude Code Desktop `/clear`
902
+
903
+ Automatic inheritance (the auto path) does not fire for `/clear` in Claude Code Desktop: the client does not send `source="clear"` and also mislabels the SessionEnd `reason` as `"other"`. This is reported upstream in [anthropics/claude-code#76704](https://github.com/anthropics/claude-code/issues/76704). On Desktop, run `/tl` before `/clear` (the baton lasts one hour). The 0.6.0 backfill work means this `/tl` handoff carries complete L2 through the immediately preceding turn. The VS Code extension's `/clear` auto-handoff works normally.
904
+
855
905
  **Monitor says `待機中 — アクティブなセッションがありません`**
856
906
  No session has touched its state file in the last 15 minutes. Send a message in
857
907
  Claude Code and the monitor should pick it up within 1 second. If it still does
@@ -949,7 +999,7 @@ unchanged here.
949
999
 
950
1000
  **Database got corrupted / want a clean slate**
951
1001
  Delete `~/.throughline/throughline.db` (and the `-shm` / `-wal` companion files)
952
- and `~/.throughline/state/*.json`. A fresh database with schema v7 is created on
1002
+ and `~/.throughline/state/*.json`. A fresh database with schema v8 is created on
953
1003
  the next hook fire.
954
1004
 
955
1005
  **New session didn't inherit memory from the previous one**
@@ -992,25 +1042,25 @@ the first generation to pick up the auto-start task.
992
1042
 
993
1043
  ## Design docs
994
1044
 
995
- - [`docs/L1_L2_L3_REDESIGN.md`](docs/L1_L2_L3_REDESIGN.md) — **core design
1045
+ - [`docs/01_l1_l2_l3_redesign.md`](docs/01_l1_l2_l3_redesign.md) — **core design
996
1046
  spec** for the L1/L2/L3 differential layer model (schema v4 base + v5 L3
997
1047
  classification extension). Authoritative for the memory layering rules.
998
- - [`docs/INHERITANCE_ON_CLEAR_ONLY.md`](docs/INHERITANCE_ON_CLEAR_ONLY.md) —
1048
+ - [`docs/03_inheritance_on_clear_only.md`](docs/03_inheritance_on_clear_only.md) —
999
1049
  design record for the `/tl` baton handoff system (schema v6–v7). Explains
1000
1050
  why the current inheritance is opt-in rather than heuristic.
1001
- - [`docs/THROUGHLINE_CODEX_DUAL_SUPPORT.md`](docs/THROUGHLINE_CODEX_DUAL_SUPPORT.md) —
1051
+ - [`docs/08_codex_dual_support.md`](docs/08_codex_dual_support.md) —
1002
1052
  architecture brief for adding Codex support without replacing the Claude
1003
1053
  Code hook/slash-command path.
1004
- - [`docs/throughline-rollback-context-trim-insight.md`](docs/throughline-rollback-context-trim-insight.md) —
1054
+ - [`docs/09_rollback_context_trim_insight.md`](docs/09_rollback_context_trim_insight.md) —
1005
1055
  design insight for context rollback/trim, including why restored memory must
1006
1056
  be framed as current work rather than passive history.
1007
- - [`docs/THROUGHLINE_CODEX_FIRST_ROADMAP.md`](docs/THROUGHLINE_CODEX_FIRST_ROADMAP.md) —
1057
+ - [`docs/05_codex_first_roadmap.md`](docs/05_codex_first_roadmap.md) —
1008
1058
  current next-phase TODO plan: Codex primary first, Codex rewind-compatible
1009
1059
  trim next, Claude rewind finalization after that.
1010
- - [`docs/THROUGHLINE_CODEX_TRIM_IMPLEMENTATION_PLAN.md`](docs/THROUGHLINE_CODEX_TRIM_IMPLEMENTATION_PLAN.md) —
1060
+ - [`docs/07_codex_trim_implementation_plan.md`](docs/07_codex_trim_implementation_plan.md) —
1011
1061
  historical integrated TODO plan and implementation record for Claude/Codex
1012
1062
  dual support and rollback trim.
1013
- - [`docs/PUBLIC_RELEASE_PLAN.md`](docs/PUBLIC_RELEASE_PLAN.md) — public
1063
+ - [`docs/04_public_release_plan.md`](docs/04_public_release_plan.md) — public
1014
1064
  release plan, implementation status by version, § 0 fallback rule, and
1015
1065
  remaining tasks.
1016
1066
  - [`docs/archive/`](docs/archive/) — superseded design documents kept for
@@ -10,6 +10,7 @@
10
10
  * throughline session-start # SessionStart hook (Claude Code から呼ばれる)
11
11
  * throughline detail <時刻> # L2+L3 詳細取得 (Claude が Bash 経由で呼ぶ想定)
12
12
  * throughline handoff-preview # Codex-facing throughline_handoff JSON preview
13
+ * throughline auditor-context --json # Read-only bounded auditor context JSON
13
14
  * throughline codex-capture # Capture active Codex rollout turns into Throughline DB
14
15
  * throughline codex-hook user-prompt-submit # Codex current-session auto-refresh prompt hook
15
16
  * throughline codex-hook post-tool-use # Codex current-session auto-refresh tool-loop hook
@@ -65,6 +66,11 @@ switch (cmd) {
65
66
  case 'handoff-preview':
66
67
  await (await import('../src/cli/handoff-preview.mjs')).run(rest);
67
68
  break;
69
+ case 'auditor-context': {
70
+ const exitCode = (await import('../src/cli/auditor-context.mjs')).run(rest);
71
+ if (exitCode !== 0) process.exitCode = exitCode;
72
+ break;
73
+ }
68
74
  case 'codex-capture':
69
75
  await (await import('../src/cli/codex-capture.mjs')).run(rest);
70
76
  break;
@@ -149,6 +155,10 @@ Usage:
149
155
  throughline monitor Multi-session token monitor (use --all, --session <id>)
150
156
  throughline detail <time> Retrieve L2+L3 detail for a turn (e.g. 14:23:05 or 14:23-14:30)
151
157
  throughline handoff-preview Print Codex-facing throughline_handoff JSON
158
+ throughline auditor-context --session <id> --project <root>
159
+ Read only bounded completed user/assistant context
160
+ for an auditor; requires either --host plus --transcript,
161
+ or explicit pair identity/hashes; always requires --json
152
162
  throughline codex-capture Capture active Codex rollout turns into DB
153
163
  (requires --codex-thread-id or env thread id)
154
164
  throughline codex-hook user-prompt-submit
@@ -0,0 +1,34 @@
1
+ # Throughline Documentation Overview
2
+
3
+ このディレクトリは Throughline の設計・計画・監査記録の入口です。実装判断は常に source を正とし、文書は現行実装へ追従させます。
4
+
5
+ ## Canonical Docs
6
+
7
+ | 文書 | 役割 |
8
+ |---|---|
9
+ | [01_l1_l2_l3_redesign.md](01_l1_l2_l3_redesign.md) | L1/L2/L3 記憶レイヤーの設計記録 |
10
+ | [02_clear_auto_handoff_plan.md](02_clear_auto_handoff_plan.md) | `/clear` / `/tl` handoff の現行仕様と計画 |
11
+ | [03_inheritance_on_clear_only.md](03_inheritance_on_clear_only.md) | 2026-04 段階の継承方式検証履歴 |
12
+ | [04_public_release_plan.md](04_public_release_plan.md) | 公開配布化、フォールバック禁止、リリース状態 |
13
+ | [05_codex_first_roadmap.md](05_codex_first_roadmap.md) | Codex primary / trim / Claude finalization の実装順 |
14
+ | [06_codex_trim_rollback_fix_plan.md](06_codex_trim_rollback_fix_plan.md) | Codex rollback / inject incident 後の修正計画 |
15
+ | [07_codex_trim_implementation_plan.md](07_codex_trim_implementation_plan.md) | Codex 両対応 + rollback trim の旧統合計画と実装履歴 |
16
+ | [08_codex_dual_support.md](08_codex_dual_support.md) | Claude primary を維持した Codex adapter 方針 |
17
+ | [09_rollback_context_trim_insight.md](09_rollback_context_trim_insight.md) | rollback を context delete primitive と見る設計メモ |
18
+ | [10_transcript_injection_plan.md](10_transcript_injection_plan.md) | transcript injection 検証計画と v0.5 実機結果 |
19
+ | [11_codex_monitor_implementation_plan.md](11_codex_monitor_implementation_plan.md) | Codex monitor 対応の実装記録 |
20
+
21
+ ## Supporting Records
22
+
23
+ | 場所 | 役割 |
24
+ |---|---|
25
+ | [adr/](adr/) | 根幹の設計判断 |
26
+ | [audit-2026-05/](audit-2026-05/) | 2026-05 の監査・インシデント記録 |
27
+ | [archive/](archive/) | 破棄または履歴扱いの旧設計 |
28
+ | [../rag/INDEX.md](../rag/INDEX.md) | 外部仕様・調査の再利用棚 |
29
+
30
+ ## Entrypoints
31
+
32
+ - [../CLAUDE.md](../CLAUDE.md): AI 作業者向けの正本。
33
+ - [../README.md](../README.md): ユーザー向けの入口。
34
+ - [../AGENTS.md](../AGENTS.md): Codex など Claude Code 以外のエージェント向け入口。
@@ -1,6 +1,6 @@
1
1
  # 新 L1/L2/L3 設計(再定義)
2
2
 
3
- > **Status**: 実装完了(2026-04-16 時点)。この文書は **L1/L2/L3 再定義の設計記録**であり、schema v4-v5 相当の変更までを扱う。以後の `handoff_batons` (v6)・`memo_text` (v7)・state.usage スナップショット・VSCode 自動起動・monitor 診断機能は本仕様と独立で、[CLAUDE.md](../CLAUDE.md) と [PUBLIC_RELEASE_PLAN.md](PUBLIC_RELEASE_PLAN.md) に索引あり。
3
+ > **Status**: 実装完了(2026-04-16 時点)。この文書は **L1/L2/L3 再定義の設計記録**であり、schema v4-v5 相当の変更までを扱う。以後の `handoff_batons` (v6)・`memo_text` (v7)・state.usage スナップショット・VSCode 自動起動・monitor 診断機能は本仕様と独立で、[CLAUDE.md](../CLAUDE.md) と [04_public_release_plan.md](04_public_release_plan.md) に索引あり。
4
4
  > 全ステップ (1〜8) 実装済み。L1/L2/L3 すべて書き込みパスが稼働。schema v5 で details に `kind` / `source_id` 列追加済み。
5
5
  > 進捗の詳細は「実装順序」セクション末尾の進捗表を参照。
6
6
 
@@ -240,7 +240,7 @@ N=20 は中央値の約 1.5 倍、p75 の少し下。典型的なセッション
240
240
  - [src/session-merger.mjs](../src/session-merger.mjs) — **bodies テーブルも merge 追従対象に追加**、judgments 張り替えロジックは削除(skeletons/details/bodies の 3 テーブルで session_id 張り替え)
241
241
  - `src/detail-capture.mjs` — **削除**(Stop フックに統合)
242
242
  - `.claude-plugin/hooks.json` — detail-capture の PostToolUse 登録を削除
243
- - [.claude/settings.json](../.claude/settings.json) — classifier / detail-capture 関連 hook があれば削除
243
+ - `.claude/settings.json` / `.claude/settings.local.json` — classifier / detail-capture 関連 hook がローカル設定にあれば削除
244
244
  - [docs/archive/CONCEPT.md](archive/CONCEPT.md) — 再定義の反映
245
245
  - **新規**: `commands/sc-detail.md` — L3 オンデマンド参照コマンド。bodies 設計と同時実装必須
246
246
 
@@ -279,7 +279,7 @@ N=20 は中央値の約 1.5 倍、p75 の少し下。典型的なセッション
279
279
  - ~~src/context-injector.mjs~~ から judgments 読み出しを削除(ファイル自体が廃止済み)
280
280
  - [src/session-merger.mjs](../src/session-merger.mjs) から judgments の UPDATE を削除
281
281
  - `src/classifier.mjs` 削除
282
- - [.claude/settings.json](../.claude/settings.json) / `.claude-plugin/hooks.json` から classifier 関連 hook があれば削除
282
+ - `.claude/settings.json` / `.claude/settings.local.json` / `.claude-plugin/hooks.json` から classifier 関連 hook があれば削除
283
283
  - この段階では judgments テーブルは DB に残したまま。参照が消えただけ
284
284
 
285
285
  2. **schema v4 migration** — [src/db.mjs](../src/db.mjs)
@@ -4,7 +4,7 @@
4
4
  2026-05-08 セッションの議論と実機検証、外部仕様調査に基づく。
5
5
  A 案 (= /clear で自動引継ぎ + /tl は逃げ道として残す + /tl-trim 廃止) **採択確定**。
6
6
 
7
- > 過去の経緯 (なぜ `/tl` バトンを採用したか) は [INHERITANCE_ON_CLEAR_ONLY.md](INHERITANCE_ON_CLEAR_ONLY.md) を参照。
7
+ > 過去の経緯 (なぜ `/tl` バトンを採用したか) は [03_inheritance_on_clear_only.md](03_inheritance_on_clear_only.md) を参照。
8
8
  > 本書は **2026-05-08 時点の現状検証 + 新理想設計** を扱う。
9
9
 
10
10
  > **2026-05-09 (v0.4.1) update**: 2 経路の優先順位を **入れ替えた**。
@@ -136,7 +136,7 @@ on SessionStart(source, session_id, project_path):
136
136
  - 元機能: memo 入力 + dry-run preview 表示
137
137
  - 新仕様で memo 廃止 + 軽量化方針 → 役割なし
138
138
  - 削除対象:
139
- - [.claude/commands/tl-trim.md](../.claude/commands/tl-trim.md) (slash command)
139
+ - `.claude/commands/tl-trim.md` (deleted slash command)
140
140
  - [src/cli/trim.mjs](../src/cli/trim.mjs) の **Claude path 部分のみ** 削除 (`describeTrimHost('claude')` ブランチ、Claude 用 memory preview 経路など)
141
141
  - 関連 test
142
142
  - **維持** (Codex 側を壊さないため):
@@ -218,7 +218,7 @@ auto-compaction は Claude Code 内部の context 圧縮で、conversation 連
218
218
  - [ ] **`src/prompt-submit.mjs`**: 維持 (baton 書き込み + ensureMonitorTaskFile)
219
219
  - [ ] **[.claude/commands/tl.md](../.claude/commands/tl.md)**: memo 4 項目入力要求を削除、純粋に「baton 立てるだけ」の最小実装に書き換え
220
220
  - [x] **`/tl-trim` 関連削除**:
221
- - [.claude/commands/tl-trim.md](../.claude/commands/tl-trim.md) ファイル削除
221
+ - `.claude/commands/tl-trim.md` ファイル削除
222
222
  - **`src/cli/trim.mjs` 自体は維持**: Codex 経路 (`--host codex`, `--preflight`, `--execute`, `--codex-app-server-bin` 等) と doctor `--trim --host claude` で使う `describeTrimHost('claude')` の dry-run 表示が依存しているため、コード削除はしない (= ユーザーが直接 `throughline trim --host claude --dry-run` を打つ余地は残す。実用は SessionStart 自動経路に置き換わる)
223
223
  - [ ] **[src/cli/install.mjs](../src/cli/install.mjs)**: Throughline 管理 slash commands の copy 対象リストから `tl-trim.md` を除外。`tl.md` は維持。`src/cli/install.test.mjs` の関連 test も update
224
224
  - [ ] **[bin/throughline.mjs](../bin/throughline.mjs) の `showHelp()` 文言 update**:
@@ -246,8 +246,8 @@ auto-compaction は Claude Code 内部の context 圧縮で、conversation 連
246
246
  - `THROUGHLINE_DISABLE_AUTO_HANDOFF` env var 紹介を新規追加
247
247
  - 既存 `inflight-memo.log` ファイルは新版で書き込み停止することを README で告知 (= 手動削除提案)
248
248
  - [CHANGELOG.md](../CHANGELOG.md): breaking change を明示 (memo 廃止、save-inflight 削除、/tl-trim 削除、`updateBatonMemo` 削除、baton_has_memo フィールド削除)
249
- - [INHERITANCE_ON_CLEAR_ONLY.md](INHERITANCE_ON_CLEAR_ONLY.md): 「2026-04 段階の検証 → 2026-05 でバグ修正により案 A 成立、本書は履歴扱い」note 追加
250
- - [PUBLIC_RELEASE_PLAN.md](PUBLIC_RELEASE_PLAN.md): version bump + breaking change 反映
249
+ - [03_inheritance_on_clear_only.md](03_inheritance_on_clear_only.md): 「2026-04 段階の検証 → 2026-05 でバグ修正により案 A 成立、本書は履歴扱い」note 追加
250
+ - [04_public_release_plan.md](04_public_release_plan.md): version bump + breaking change 反映
251
251
  - [ ] **package.json**: **0.4.0** に bump (semver minor、pre-1.0 の breaking)
252
252
  - [ ] **caveat 記録**: 「`/clear` SessionStart `source` は 2.1.128 で reliable、過去 #49937 は fix 済み」を public で記録
253
253
 
@@ -258,7 +258,7 @@ auto-compaction は Claude Code 内部の context 圧縮で、conversation 連
258
258
  廃止対象:
259
259
  - `src/cli/save-inflight.mjs` (~80 行) → 削除
260
260
  - `src/cli/trim.mjs` の Claude path 部分 (~30 行) → 削除 (Codex path は維持)
261
- - [.claude/commands/tl-trim.md](../.claude/commands/tl-trim.md) (~40 行) → 削除
261
+ - `.claude/commands/tl-trim.md` (~40 行) → 削除
262
262
  - `src/baton.mjs` の `updateBatonMemo` 関数 (~10 行) → 削除
263
263
  - `handoff_batons.memo_text` 列 (schema migration、コードへの影響は consumeBaton 戻り値変更のみ)
264
264
  - `src/hook-entrypoints.test.mjs` 内 save-inflight test ケース (~30 行) → 削除
@@ -13,7 +13,7 @@
13
13
  > メニュー由来 `/clear` のように UserPromptSubmit に届かない経路のための
14
14
  > fallback で、`THROUGHLINE_DISABLE_AUTO_HANDOFF=1` で OFF にできる (typed
15
15
  > `/clear` / `/tl` は env と無関係に引き続き発火する)。詳細は
16
- > [THROUGHLINE_CLEAR_AUTO_HANDOFF_PLAN.md](THROUGHLINE_CLEAR_AUTO_HANDOFF_PLAN.md)。
16
+ > [02_clear_auto_handoff_plan.md](02_clear_auto_handoff_plan.md)。
17
17
  >
18
18
  > 本書は当時のバトン採用判断を残す履歴ドキュメント。「結局 baton primary に
19
19
  > 戻った」という結末は皮肉だが、当時の判断は VSCode 拡張側 source バグへの
@@ -129,7 +129,7 @@ Throughline の SessionStart フックは現在 **同一 project_path の未合
129
129
  - 注入は session-start.mjs 側の `mergeResult.merged` 分岐で既に制御されているので修正不要
130
130
  - ただし「同一 session 継続(source='resume')での注入」が必要か要検討。現状の resume フックは本計画のスコープ外として deferred(別タスクで検討)
131
131
 
132
- 4. **[docs/L1_L2_L3_REDESIGN.md](L1_L2_L3_REDESIGN.md) / [CLAUDE.md](../CLAUDE.md) / [README.md](../README.md) の更新**
132
+ 4. **[docs/01_l1_l2_l3_redesign.md](01_l1_l2_l3_redesign.md) / [CLAUDE.md](../CLAUDE.md) / [README.md](../README.md) の更新**
133
133
  - 「記憶張り替えの発火条件は SessionStart source='clear' のみ」を明記
134
134
  - CLAUDE.md 冒頭「設計の核」の「`/clear` 後も SQLite はそのまま残る。`SessionStart` フックで前任セッションの全レコードを新 session_id に張り替える」の直後に引き継ぎ条件を追記
135
135
 
@@ -158,7 +158,7 @@ Throughline の SessionStart フックは現在 **同一 project_path の未合
158
158
  - [src/session-merger.mjs](../src/session-merger.mjs) — 参照のみ(現状維持)
159
159
  - [src/session-merger.test.mjs](../src/session-merger.test.mjs) — テスト追加
160
160
  - [src/resume-context.mjs](../src/resume-context.mjs) — 参照のみ
161
- - [CLAUDE.md](../CLAUDE.md) / [docs/L1_L2_L3_REDESIGN.md](L1_L2_L3_REDESIGN.md) / [README.md](../README.md) — ドキュメント更新
161
+ - [CLAUDE.md](../CLAUDE.md) / [docs/01_l1_l2_l3_redesign.md](01_l1_l2_l3_redesign.md) / [README.md](../README.md) — ドキュメント更新
162
162
 
163
163
  ## Non-Goals (本計画では扱わない)
164
164
 
@@ -79,7 +79,7 @@ schema v4 で PostToolUse (`capture-tool`) は廃止、L2/L3 は Stop 内で一
79
79
  | schema v5 migration(details に kind / source_id 追加、L3 分離書き込み対応) | [src/db.mjs](../src/db.mjs) |
80
80
  | schema v6 migration(handoff_batons テーブル追加、`/tl` バトン引き継ぎ方式) | [src/db.mjs](../src/db.mjs), [src/baton.mjs](../src/baton.mjs) |
81
81
  | schema v7 migration(`handoff_batons.memo_text` カラム追加、in-flight メモ保存) | (v8 で memo_text drop、save-inflight 削除済み) |
82
- | schema v8 migration(`handoff_batons.memo_text` drop、`/clear` auto path 化、`save-inflight` / `/tl-trim` / `updateBatonMemo` 削除、注入を L1+L2+L3 refs のみに簡素化) | [src/db.mjs](../src/db.mjs), [src/session-start.mjs](../src/session-start.mjs), [src/resume-context.mjs](../src/resume-context.mjs), [docs/THROUGHLINE_CLEAR_AUTO_HANDOFF_PLAN.md](THROUGHLINE_CLEAR_AUTO_HANDOFF_PLAN.md) |
82
+ | schema v8 migration(`handoff_batons.memo_text` drop、`/clear` auto path 化、`save-inflight` / `/tl-trim` / `updateBatonMemo` 削除、注入を L1+L2+L3 refs のみに簡素化) | [src/db.mjs](../src/db.mjs), [src/session-start.mjs](../src/session-start.mjs), [src/resume-context.mjs](../src/resume-context.mjs), [docs/02_clear_auto_handoff_plan.md](02_clear_auto_handoff_plan.md) |
83
83
  | VSCode `.vscode/tasks.json` の自動プロビジョニング(token-monitor の folderOpen 自動起動) | [src/vscode-task.mjs](../src/vscode-task.mjs) |
84
84
  | Stop フック時の state.usage スナップショット(monitor の「止まって見える」問題の切り分け用) | [src/state-file.mjs](../src/state-file.mjs), [src/turn-processor.mjs](../src/turn-processor.mjs) |
85
85
  | `throughline doctor --session <id-prefix>` セッション診断(state/transcript ズレ検出) | [src/cli/doctor.mjs](../src/cli/doctor.mjs) |
@@ -132,9 +132,9 @@ schema v4 で PostToolUse (`capture-tool`) は廃止、L2/L3 は Stop 内で一
132
132
  | **npm 公開 (v0.3.25): Codex VS Code rollback smoke verifier** | `throughline codex-vscode-rollback-smoke --verify --codex-thread-id <id>` を追加。rollout を read-only で読み、rollback event、rollback 済み user text、rollback 後 user turn、`restoreSafety.status = ok` を必須条件にする。`--after-vscode-restart` がある場合だけ `restartSafe: true` を返す。実 incident-shaped live rollback run では `thread_rolled_back` と injected memory は記録されたが、rollback 対象 user text が `compacted.replacement_history` に残り、後続 verifier では rollback 済み user text の再出現も観測した。後続分類で app-server response 上の retained text は `aggregatedOutput` に限定され、controlled rollback model-visible smoke は再現しなかったため、これは現在は diagnostic evidence として扱う |
133
133
  | **npm 公開 (v0.3.25): Codex primary doctor** | `throughline doctor --codex` を追加。現在 project の Codex thread env identity、rollout candidates、captured `codex:<thread_id>` DB sessions、context-refresh memory contract、new-thread handoff readiness、safe continuation status、host primitive audit status、次に使う capture / handoff / resume / audit command を表示する。doctor 自体は read-only で、Codex thread / DB / Claude settings を変更しない。`doctor --trim --host codex` も host primitive audit status を表示する |
134
134
  | **npm 公開 (v0.3.25): Codex global Stop hook / skill install** | `throughline install` が Claude hooks / slash commands に加えて `~/.codex/hooks.json` に絶対 node + installed `bin/throughline.mjs codex-hook stop` を `async: false` で登録し、`~/.codex/config.toml` の `[features].codex_hooks = true` を有効化し、`~/.codex/skills/throughline` に `$throughline` skill を配置する。Codex App Server / VSCode host の PATH 差分で bare `throughline` が見えない可能性があるため、hook は Caveat と同じ絶対パス型に寄せる。既存 Caveat / Spotter などの Codex hooks は保持し、`throughline uninstall` は Throughline 管理の Codex hook / skill だけを削除する。既に bare command または `async: true` で登録済みの Throughline Codex Stop hook は次回 install で更新する。実環境では `codex exec --json` child thread `019dfd4f-93ff-7522-8f89-bd1e1996c8d7` が Stop hook で自然 capture され、`doctor --codex` の latest DB session が `codex:019dfd4f-93ff-7522-8f89-bd1e1996c8d7` に進むことを確認した。さらに絶対パス型へ更新後、child thread `019dfd5e-1248-7c11-8ddc-97e1b0701e10` でも latest DB session が `codex:019dfd5e-1248-7c11-8ddc-97e1b0701e10` に進むことを確認した。hook shape 変更後に新規開始した VSCode-origin thread `019dfd62-9a9d-7211-bf91-89d8e3fc908e` でも `doctor --codex` の current thread と latest DB session が一致し、自然 Stop hook capture を確認済み。hook shape 変更前から開いていた VSCode-origin parent thread は、変更後の自然 Stop smoke としては扱わない。Caveat 側にも `async: false` Stop hook が動く実測があるため、Codex 側は Caveat と同じ同期 hook 方針に寄せる。`codex-capture` / `codex-summarize` / `codex-resume --memo-stdin` は診断・明示操作 surface として維持し、model-visible smoke は明示 opt-in。2026-05-08 以降、Stop hook auto-refresh は verified usage 75% 以上で guarded rollback / inject を試行し、estimate usage では mutation しない。2026-05-09 以降は Codex native auto-compact より先に Throughline refresh を走らせつつ、70% warning よりは mutation を遅らせる |
135
- | **npm 公開 (v0.3.25): Codex-first roadmap** | [THROUGHLINE_CODEX_FIRST_ROADMAP.md](THROUGHLINE_CODEX_FIRST_ROADMAP.md) を追加。次フェーズは Codex primary 実用化、Codex Rewind 互換、Claude 側 finalization の順で進める。Codex primary の L2→L1 backend は Codex CLI を本線とし、`codex-sidecar` は Claude primary からの review / risk-check / second opinion / 互換 L2→L1 経路として整理する |
135
+ | **npm 公開 (v0.3.25): Codex-first roadmap** | [05_codex_first_roadmap.md](05_codex_first_roadmap.md) を追加。次フェーズは Codex primary 実用化、Codex Rewind 互換、Claude 側 finalization の順で進める。Codex primary の L2→L1 backend は Codex CLI を本線とし、`codex-sidecar` は Claude primary からの review / risk-check / second opinion / 互換 L2→L1 経路として整理する |
136
136
  | **npm 公開 (v0.3.25): npm docs packaging** | README から参照する `docs/` と `CHANGELOG.md` を npm `files` に追加。`docs/throughline-handoff-context.example.json` を含め、README の sidecar dry-run 例が tarball 内でも成立するようにする |
137
- | **npm 公開 (v0.4.0): /clear auto-handoff + memo / save-inflight / /tl-trim retire** | 2026-05-08 Claude Code 2.1.128 で `source='clear'` が reliable になったため、`/clear` で自動引継ぎがデフォルト ON になる auto path を追加。`THROUGHLINE_DISABLE_AUTO_HANDOFF=1` で OFF にできる。`/tl` slash command は明示意思マーカーへ簡素化 (memo 4 項目入力廃止、`save-inflight` CLI 削除、`/tl-trim` slash command 廃止、`updateBatonMemo` 関数削除、`handoff_batons.memo_text` を schema v8 で drop)。注入は L1 + L2 + L3 references のみに簡素化し、memo / 中断直前 thinking セクションを削除。Codex 側 trim path は維持。詳細は [CHANGELOG.md](../CHANGELOG.md) と [THROUGHLINE_CLEAR_AUTO_HANDOFF_PLAN.md](THROUGHLINE_CLEAR_AUTO_HANDOFF_PLAN.md) |
137
+ | **npm 公開 (v0.4.0): /clear auto-handoff + memo / save-inflight / /tl-trim retire** | 2026-05-08 Claude Code 2.1.128 で `source='clear'` が reliable になったため、`/clear` で自動引継ぎがデフォルト ON になる auto path を追加。`THROUGHLINE_DISABLE_AUTO_HANDOFF=1` で OFF にできる。`/tl` slash command は明示意思マーカーへ簡素化 (memo 4 項目入力廃止、`save-inflight` CLI 削除、`/tl-trim` slash command 廃止、`updateBatonMemo` 関数削除、`handoff_batons.memo_text` を schema v8 で drop)。注入は L1 + L2 + L3 references のみに簡素化し、memo / 中断直前 thinking セクションを削除。Codex 側 trim path は維持。詳細は [CHANGELOG.md](../CHANGELOG.md) と [02_clear_auto_handoff_plan.md](02_clear_auto_handoff_plan.md) |
138
138
  | **npm 公開 (v0.4.1): typed `/clear` も baton を書く + 2 経路の優先順位入れ替え** | 2026-05-09 `/clear` を UserPromptSubmit hook で検出した時点で当該セッションの `session_id` を `handoff_batons` に書き込み、次 SessionStart が確定的にそのセッションを引き継ぐ。これで multi-window で「最新更新セッション ≠ /clear したセッション」になるシナリオで `findLatestClaudePredecessor` heuristic が誤った前任を選ぶ問題を解消。2 経路の優先順位を **baton path = primary、auto path = fallback** に変更 (auto path は VSCode 拡張メニュー由来など UserPromptSubmit に届かない経路のフォールバック)。`THROUGHLINE_DISABLE_AUTO_HANDOFF=1` は fallback path のみに作用するようになった (typed `/clear` / `/tl` は env と無関係に発火する)。あわせて `.vscode/tasks.json` を git 追跡から外し (gitignore)、`ensureMonitorTaskFile` が hook 発火ごとに絶対パスを書き換える挙動による別環境での dirty diff を解消。`src/prompt-submit.test.mjs` を新設し、`isClearCommand` / `isBatonCommand` 判定 14 件と subprocess+DB 実体テスト 3 件を追加。詳細は [CHANGELOG.md](../CHANGELOG.md) |
139
139
  | **npm 公開 (v0.4.7): Codex monitor direct discovery + 80% auto-refresh** | 2026-05-09 Codex Stop hook auto-refresh の verified usage threshold を 90% から 80% に変更し、Codex native auto-compact より先に Throughline DB memory refresh を試行する。estimate usage / estimated context window では mutation しない。`throughline monitor` は `~/.throughline/state` に加えて `~/.codex/sessions/**/rollout-*.jsonl` を直接 discovery し、Throughline state が未生成の現在 Codex thread も表示する。既存 state がある場合は state の usage snapshot を保持しつつ discovered rollout path / mtime を合流する。Codex 表示 ID は `codex:01` ではなく raw thread id 先頭 8 桁 (`019e085c`) にした。Codex open turn の transient `output_tokens` は token count に overlay するが、モデル欄の `live+<tokens>` marker は表示しない |
140
140
  | **未リリース: Codex current-session 75% trigger** | Codex 自動発火を token-monitor に依存させず、global install が Codex `UserPromptSubmit` / `PostToolUse` hooks も登録する。hook は当該 Codex session の rollout `token_count` を直接読み、verified 75% 以上なら同じ user turn または tool loop 継続前に `$throughline` workflow 実行指示を `additionalContext` で注入する。Stop hook の guarded auto-refresh は残す。`~/.codex/config.toml` は旧 `codex_hooks = true` に加えて現行 `hooks = true` も有効化する |