throughline 0.3.25 → 0.4.0

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.
@@ -4,27 +4,12 @@ description: 次の新規セッションに現セッションの記憶を引き
4
4
 
5
5
  Throughline の UserPromptSubmit hook が `/tl` を検出し、バトン(現セッション ID)を保存しました。
6
6
 
7
- 次に必ずやること(スキップ厳禁):
7
+ これだけで完了です。**追加の操作は不要**。
8
8
 
9
- 1. 今この時点の「中断地点の状態」を自分の文脈から思い出し、以下 4 項目を Markdown で整理する:
10
- - **次の一手**: 今まさに何をやろうとしていたか(1-3 文、具体的に)
11
- - **現在の方針 / 仮説**: 追っているバグの原因、設計の方向性、調査中の観点など
12
- - **未解決の疑問**: 判断保留中の論点
13
- - **進行中 TODO**: 完了済みを除いた現行 TODO(TodoWrite の最新状態や Plan の内容を踏まえて、意味のあるものだけ)
9
+ このあと:
10
+ - 1 時間以内に新セッションを開く(新 chat / VSCode 再起動など)と、Throughline がバトンを消費して前セッションの記憶 (L1 + L2 + L3 references) を新セッションに自動注入します
11
+ - バトンは 1 時間で失効します
14
12
 
15
- 2. Bash ツールで次のコマンドを実行し、stdin で上記 Markdown を流し込む:
13
+ 通常は `/clear` だけで自動引継ぎが発火するため、`/tl` **`THROUGHLINE_DISABLE_AUTO_HANDOFF=1` で自動引継ぎを OFF にしているユーザー** または **`/clear` を経由せずに新セッションを開くケース** の明示意思マーカーとして使います。
16
14
 
17
- ```bash
18
- throughline save-inflight <<'EOF'
19
- **次の一手**: ...
20
- **現在の方針**: ...
21
- **未解決の疑問**: ...
22
- **進行中 TODO**:
23
- - [ ] ...
24
- - [ ] ...
25
- EOF
26
- ```
27
-
28
- Bash の出力 (`[throughline] in-flight memo saved (N chars) for next session`) がそのまま完了確認になります。追加のユーザーへの報告テキストは不要です。ツール呼び出し後は何も返さずターンを終えて構いません(必要なら一言だけ)。
29
-
30
- バトン(および in-flight メモ)は 1 時間で失効します。失効後に新セッションを開いた場合は引き継ぎは発火しません。
15
+ ユーザーへの追加報告テキストは不要です。一言だけ完了を伝えるか、何も返さずターンを終えて構いません。
package/CHANGELOG.md CHANGED
@@ -10,6 +10,55 @@ shipped to npm but were not individually tagged on GitHub.
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.4.0] — 2026-05-08
14
+
15
+ ### Breaking changes
16
+
17
+ - **`/clear` で自動引継ぎがデフォルト ON** に変更。Claude Code 2.1.128 で
18
+ SessionStart hook の `source='clear'` が reliable になったため、`/clear` 後の
19
+ 新セッションは自動的に前セッションの memory を merge + 注入する。
20
+ ([GitHub issue #49937](https://github.com/anthropics/claude-code/issues/49937)
21
+ は解決済み)
22
+ - **`THROUGHLINE_DISABLE_AUTO_HANDOFF=1`** env var で auto path を OFF にできる。
23
+ - **`/tl` の役割を明示意思マーカーに簡素化**。memo 4 項目入力の指示を削除し、
24
+ baton を立てるだけの slash command に。`/tl` は env で auto OFF にしている
25
+ ユーザー、または `/clear` を経由しない引継ぎに使う逃げ道。
26
+ - **`/tl-trim` slash command 廃止**。memo 入力 + dry-run preview の役割を持って
27
+ いたが、memo 廃止と軽量化方針で役割なしに。Codex 経路の `throughline trim`
28
+ CLI は維持 (`--host codex` での guarded execute / preflight など)。
29
+ - **`throughline save-inflight` CLI 削除**。memo 廃止に伴う除去。
30
+ - **`updateBatonMemo` 関数削除**。`src/baton.mjs` の export から外した。
31
+ - **schema v8 migration**: `handoff_batons.memo_text` 列を drop。
32
+ - **注入内容を L1 + L2 + L3 references のみに簡素化**。memo セクション、
33
+ 中断直前 thinking セクション、Claude 向け footer の使い方説明を削除。L2 全文
34
+ に「次に何をしようとしていたか」が含まれているため redundant。
35
+
36
+ ### Added
37
+
38
+ - `src/db.mjs`: schema v8 migration (handoff_batons.memo_text 列 drop)。
39
+ - `src/session-start.mjs`: 引継ぎ判定の 2 経路ロジック:
40
+ 1. baton path: `consumeBaton` 先発で baton ありなら merge + 注入
41
+ 2. auto path: baton 無し + `source='clear'` + env disable 無し で同 project の
42
+ 最新 Claude unmerged session を自動 predecessor に merge + 注入
43
+ - `inheritance-decision.log` に `triggered_path` / `auto_handoff_disabled`
44
+ フィールドを追加。`baton_has_memo` フィールドは削除。
45
+ - `src/resume-context.mjs`: L3 references 一覧を注入テキストに追加
46
+ (Codex `renderCodexRolloutMemoryPreview` 形式の `- ${kind}:
47
+ \`throughline detail <time>\``)。Reading Contract / Continuation Instruction
48
+ も Codex 風 framing に揃えた。
49
+
50
+ ### Notes
51
+
52
+ - `src/handoff-record.mjs` の memo / thinking projection は **維持**: Codex 側
53
+ (`codex-handoff.mjs`, `codex-resume.mjs`, `codex-handoff-smoke.mjs` など) が
54
+ `memory.inflightMemo` / `memory.latestThinking` を参照しているため。Claude
55
+ 側は resume-context.mjs で「使わない」だけ。
56
+ - `src/cli/trim.mjs` は **維持**: Codex 経路 (`--host codex`) と doctor
57
+ (`--trim --host claude`) で使う `describeTrimHost('claude')` の dry-run 表示
58
+ が依存しているため。`/tl-trim` slash command が無くなっても CLI は残る。
59
+ - 既存 `~/.throughline/logs/inflight-memo.log` ファイルは新版で書き込まれない。
60
+ ユーザー側で手動削除可能。
61
+
13
62
  ## [0.3.25] — 2026-05-08
14
63
 
15
64
  ### Added
package/README.ja.md CHANGED
@@ -126,60 +126,58 @@ L3 に保存された `kind` 別 (ツール入力 / ツール出力 / hook 出
126
126
 
127
127
  ---
128
128
 
129
- ## 明示的引き継ぎ `/tl` (in-flight メモ付き)
129
+ ## 引き継ぎ: `/clear` で自動、env で OFF、`/tl` で明示
130
130
 
131
- 引き継ぎは **明示的** であり、自動ではありません。次セッションへ「ここから続けてほしい」と
132
- 渡したいときは、現セッションで `/clear` または新規チャットを開く **前に** `/tl` を打ちます。
133
- `/tl` 無しの場合、新セッションはまっさらな状態で始まり、過去メモリは引き継がれません。
131
+ Throughline 0.4.0 から引き継ぎは 2 経路:
134
132
 
135
- `/tl` は 2 つの仕事をします:
133
+ ### auto path (デフォルト): `/clear` で自動引き継ぎ
136
134
 
137
- 1. **引き継ぎバトンの書き込み**。現在の `session_id` `handoff_batons` テーブルへ、
138
- `UserPromptSubmit` hook 経由で記録します。
139
- 2. **現 Claude in-flight メモを書かせる**。`/tl` は Claude に対し、
140
- *次に何をしようとしていたか、現在の仮説、未解決の問い、進行中 TODO* を Markdown で
141
- 要約し、`throughline save-inflight` 経由でバトンの `memo_text` カラムに添付するよう
142
- 指示します。これにより、トランスクリプト再生だけでは保てない「いま考え中だった内容」を保存できます。
135
+ Claude Code 2.1.128 以降は `/clear` 直後の SessionStart hook に
136
+ `source='clear'` が確実に乗ります。Throughline がこれを検出して、前セッションの
137
+ メモリを新セッションに自動 merge します。**ユーザー操作不要** `/clear`
138
+ だけで新チャットが「途中から」再開されます。
143
139
 
144
- 次の `SessionStart` では、hook がバトンを読み、**1 時間以内** であれば
145
- そのセッションのメモリを `BEGIN IMMEDIATE` トランザクション内で
146
- `UPDATE session_id = ?` を使って決定論的にマージします。バトンはマージと
147
- 原子的に消費 (削除) されるため、二重発火しません。注入される再開コンテキストは
148
- **「中断されたタスクの再開」** として再フレーミングされ、in-flight メモと最終ターンの
149
- 拡張思考が先頭に来ることで、新 Claude は思考の途中から拾えます。
140
+ `THROUGHLINE_DISABLE_AUTO_HANDOFF=1` を環境変数に立てると auto path を OFF にできます。
141
+
142
+ ### baton path (`/tl`): 明示意思マーカー
143
+
144
+ 次のいずれかのユーザー向け:
145
+
146
+ - `THROUGHLINE_DISABLE_AUTO_HANDOFF=1` を立てている、**または**
147
+ - `/clear` 経由しないで引き継ぎたい (新 chat / VSCode 再起動など)
148
+
149
+ 新セッションを開く前に `/tl` を打つと `UserPromptSubmit` hook が baton を書き、
150
+ 次の `SessionStart` (1 時間以内) が baton を消費して merge します。
151
+ `source` 値関係なく発火します。
150
152
 
151
153
  ```
152
- Session A (/tl を打つ) -----------> バトン書き込み
153
- |
154
- /clear |
155
- | ▼
156
- Session B ---- バトン読込 → A を B にマージ → バトン削除 ---->
157
- |
158
- (もう一度 /tl で更に渡せる)
154
+ auto path: Session A /clear → Session B (A を auto-merge)
155
+ baton path: Session A → /tl → (新 chat / 再起動) → Session B (baton を消費して A を merge)
159
156
  ```
160
157
 
161
- 明示的バトン方式を選んだ理由:
158
+ ### 注入されるもの
159
+
160
+ 両経路で同じ curated memory が注入されます:
162
161
 
163
- - **誤継承ゼロ**。並行ウィンドウや VSCode 再起動、同じリポジトリでの新規タスクが、
164
- 前セッションのメモリを誤って引き継ぐことはありません。`/tl` 明示時のみ発火。
165
- - **VSCode 拡張対応**。`SessionStart` hook `source` フィールドは VSCode 拡張で
166
- `/clear` 後も `"startup"` に書き換えられてしまう
167
- ([issue #49937](https://github.com/anthropics/claude-code/issues/49937))。
168
- source 判定は信用できないため、ユーザー駆動のバトンで回避。
169
- - **決定論的**。時間窓ヒューリスティック、PID 推測、祖先プロセス追跡なし。
170
- ユーザーが意思を宣言し、hook が実行する。それだけ。
162
+ - L1 サマリー (古い turn の一行要約)
163
+ - L2 verbatim (直近 20 turn の本文)
164
+ - L3 references (`throughline detail <時刻>` で引き出すコマンド一覧、本文は SQLite に残置)
171
165
 
172
- 各マージ行は `origin_session_id` を保持するので、`/tl` を繰り返すと
166
+ 注入は **「中断されたタスクの再開」** として再フレーミングされます。L2 verbatim に
167
+ 最終 assistant turn (= 次に何をしようとしていたか) が含まれるため、別途 memo /
168
+ extended thinking セクションは注入されません。
169
+
170
+ 各マージ行は `origin_session_id` を保持するので、繰り返し引き継ぐと
173
171
  記憶がチェーン状に蓄積します:
174
172
 
175
173
  ```
176
- S1 (4 ターン) --/tl,/clear--> S2 (S1 をマージ + 3 ターン追加) --/tl,/clear--> S3 (S2 をマージ + 5 ターン追加)
177
- origin=S1×4 origin=S1×4, S2×3, S3×5
174
+ S1 (4 ターン) --/clear--> S2 (S1 auto-merge + 3 ターン追加) --/clear--> S3 (S2 auto-merge + 5 ターン追加)
175
+ origin=S1×4 origin=S1×4, S2×3, S3×5
178
176
  ```
179
177
 
180
178
  ---
181
179
 
182
- ## Codex sidecar と `/tl-trim` プレビュー
180
+ ## Codex sidecar と Codex trim
183
181
 
184
182
  Throughline の主軸は引き続き **Claude Code** です。Codex 対応は、Claude hooks /
185
183
  slash command / transcript / baton / resume behavior を置き換えるものではなく、
@@ -189,20 +187,11 @@ adapter / projection として追加されます。
189
187
  `codex-sidecar` が `summarize-l1` preset で設定されている場合はその要約に
190
188
  Codex sidecar を使えます。使えない場合は、従来どおり Claude Haiku 経路を使います。
191
189
 
192
- `/tl-trim` は現在 **dry-run のみ** です。何ターンを trim 候補にするか、
193
- どの recent context を残すか、どの curated memory を戻す必要があるかを表示します。
194
- automatic rollback / inject host primitive の検証が終わるまで無効です。
195
-
196
- ```bash
197
- throughline doctor --trim --host claude
198
- printf '**次の一手**: 今の実装を続ける\n' \
199
- | throughline trim --dry-run --host claude --memo-stdin
200
- ```
201
-
202
- 重要なのは current-work framing です。L1/L2 をそのまま戻すだけだと、
203
- モデルがそれを「過去ログ」として読んでしまうことがあります。Throughline は recent L2 を
204
- active work thread として構造化し、古い仮説は後続の判断で上書きされ得ること、
205
- そして中断地点から続行することを、注入 memory の先頭と末尾で明示します。
190
+ Codex 側 trim (= same-thread context trim) は `throughline trim --execute --host codex`
191
+ で発火します。Claude 側は `/clear` での auto path 引継ぎが本線になったため、
192
+ `/tl-trim` slash commandv0.4.0 で廃止されました。current-work framing は
193
+ SessionStart 注入の Reading Contract / Continuation Instruction で同じ意図を
194
+ 継承しています。
206
195
 
207
196
  ---
208
197
 
@@ -238,13 +227,13 @@ throughline monitor --session <id-prefix>
238
227
  | `throughline monitor` | マルチセッション監視を起動 |
239
228
  | `throughline monitor --diag` | TTY/columns/env 診断ダンプ (描画バグ切り分け用) |
240
229
  | `throughline detail <時刻>` | あるターンの L2 本文と L3 ツール I/O を取得 (Claude が使う) |
241
- | `throughline save-inflight` | `/tl` から呼ばれ、現バトンに in-flight メモを添付 (stdin 経由) |
242
230
  | `throughline doctor` | Node バージョン、hook 登録状況、DB、PATH をチェック |
243
231
  | `throughline doctor --trim --host claude` | trim boundary と手動手順を診断 |
244
232
  | `throughline handoff-preview --session <id>` | Codex 向け `throughline_handoff` JSON projection を表示 |
245
233
  | `throughline codex-sidecar-diagnostics` | この project の `codex-sidecar` diagnostics status を確認 |
246
234
  | `throughline codex-sidecar-dry-run` | App Server を呼ばずに read-only sidecar request を正規化表示 |
247
- | `throughline trim --dry-run` | `/tl-trim` 用の dry-run preview。自動 rollback はしない |
235
+ | `throughline trim --dry-run --host codex` | Codex same-thread trim dry-run preview |
236
+ | `throughline trim --execute --host codex` | Codex 同 thread の guarded rollback + DB memory inject |
248
237
  | `throughline doctor --session <id-prefix>` | 特定セッションの state/transcript ズレを診断 |
249
238
  | `throughline status` | DB 統計表示 (sessions / skeletons / bodies / details) |
250
239
  | `throughline --version` | インストール済みバージョンを表示 |
@@ -253,13 +242,12 @@ throughline monitor --session <id-prefix>
253
242
 
254
243
  | コマンド | 役割 |
255
244
  | --- | --- |
256
- | `/tl` | 引き継ぎバトンを書き込み + Claude in-flight メモを書かせる |
257
- | `/tl-trim` | 現 Claude が current-work memo を書き、trim dry-run を実行 |
245
+ | `/tl` | 引き継ぎバトンを書き込む (auto path OFF にしているユーザー / `/clear` 経由しない引継ぎの逃げ道) |
258
246
  | `/sc-detail <時刻>` | 過去ターンの L2 本文と L3 ツール I/O を取得 |
259
247
 
260
- > `/tl` 発火時、Claude Bash 経由で `throughline save-inflight` を呼びます。
261
- > 初回は許可確認が出るので、`Bash(throughline save-inflight:*)` allowlist
262
- > 追加すると以後の確認はスキップできます。
248
+ > v0.4.0 から auto-handoff がデフォルト ON です。`/clear` だけで新セッションが
249
+ > 「途中から」再開されます。`THROUGHLINE_DISABLE_AUTO_HANDOFF=1` OFF にできます。
250
+ > `/tl` は OFF 設定下、または `/clear` 経由しない引継ぎ用の明示マーカー。
263
251
 
264
252
  ---
265
253
 
package/README.md CHANGED
@@ -141,66 +141,59 @@ of tool inputs, tool outputs, and hook output captured at L3 for that turn.
141
141
 
142
142
  ---
143
143
 
144
- ## Explicit handoff via `/tl` (with in-flight memo)
145
-
146
- Inheritance is **opt-in**, not automatic. When you want the next session to
147
- pick up where this one left off, type `/tl` in the current session before you
148
- `/clear` or open a new chat. Without `/tl`, new sessions start fresh — no
149
- memory is carried over.
150
-
151
- The `/tl` slash command does two things:
152
-
153
- 1. **Writes a handoff baton** (the current `session_id`) into the
154
- `handoff_batons` table via the `UserPromptSubmit` hook.
155
- 2. **Asks the current Claude to write an in-flight memo.** `/tl` instructs
156
- Claude to summarize *what it was about to do next, its current hypothesis,
157
- open questions, and in-progress TODOs*, then pipe that Markdown into
158
- `throughline save-inflight`, which attaches it to the baton's `memo_text`
159
- column. This captures the "currently thinking" state that plain transcript
160
- replay cannot preserve.
161
-
162
- On the next `SessionStart`, the hook reads the baton, and if it is less than
163
- **1 hour old**, merges that session's memory into the new session using a
164
- deterministic `UPDATE session_id = ?` inside a `BEGIN IMMEDIATE` transaction.
165
- The baton is consumed (deleted) atomically with the merge, so it cannot fire
166
- twice. The injected resume context is reframed as **"resuming an interrupted
167
- task"** rather than *"reading past logs"*, and the in-flight memo plus the
168
- final turn's extended thinking appear at the top so the new Claude picks up
169
- mid-thought.
144
+ ## Inheritance: auto via `/clear`, opt-out via env, opt-in via `/tl`
145
+
146
+ Throughline 0.4.0+ supports two inheritance paths:
147
+
148
+ ### auto path (default): `/clear` automatic inheritance
149
+
150
+ Since Claude Code 2.1.128, the SessionStart hook receives `source='clear'`
151
+ reliably after `/clear`. Throughline detects this and automatically merges the
152
+ previous session's memory into the new one. **No user action required** —
153
+ just type `/clear` and the new chat resumes mid-thought.
154
+
155
+ Set `THROUGHLINE_DISABLE_AUTO_HANDOFF=1` in your environment to opt out.
156
+
157
+ ### baton path (`/tl`): explicit inheritance signal
158
+
159
+ For users who:
160
+
161
+ - have `THROUGHLINE_DISABLE_AUTO_HANDOFF=1` set, **or**
162
+ - want to inherit across a non-`/clear` boundary (new chat / VSCode restart),
163
+
164
+ type `/tl` before opening the new session. The `UserPromptSubmit` hook writes
165
+ a handoff baton; the next `SessionStart` (within 1 hour) consumes the baton
166
+ and merges the previous session's memory, regardless of the `source` value.
170
167
 
171
168
  ```
172
- Session A (type /tl) -----------> baton written
173
- |
174
- /clear |
175
- | ▼
176
- Session B ---- reads baton, merges A into B, deletes baton ---->
177
- |
178
- (type /tl again to hand off further)
169
+ auto path: Session A /clear Session B (auto-merges A)
170
+ baton path: Session A → /tl → (new chat / restart) → Session B (consumes baton, merges A)
179
171
  ```
180
172
 
181
- Why explicit baton instead of auto-inherit:
173
+ ### What gets injected
174
+
175
+ Both paths inject the **same** curated memory:
182
176
 
183
- - **Zero false positives.** A parallel window, a VSCode restart, or a genuine
184
- new task in the same repo won't accidentally inherit the previous session's
185
- memory. Only an explicit `/tl` triggers inheritance.
186
- - **VSCode extension compatibility.** The `SessionStart` hook's `source` field
187
- is rewritten to `"startup"` by the Claude Code VSCode extension even after
188
- `/clear` (see [issue #49937](https://github.com/anthropics/claude-code/issues/49937)),
189
- so source-based detection is unreliable. A user-driven baton sidesteps this.
190
- - **Deterministic.** No time-window heuristic, no PID guessing, no ancestor
191
- walking. The user declares intent; the hook carries it out.
177
+ - L1 summaries (older turns, one-line)
178
+ - L2 verbatim (most recent 20 turns, full text)
179
+ - L3 references (`throughline detail <time>` retrieval commands; bodies stay in SQLite)
192
180
 
193
- Each merged row keeps its `origin_session_id`, so repeated `/tl` handoffs
181
+ The injection is reframed as **"resuming an interrupted task"** rather than
182
+ "reading past logs". The L2 verbatim already contains the last assistant
183
+ turn — what Claude was about to do next — so no separate memo or extended
184
+ thinking section is injected.
185
+
186
+ Each merged row keeps its `origin_session_id`, so repeated handoffs
194
187
  accumulate memory through chains:
195
188
 
196
189
  ```
197
- S1 (4 turns) --/tl,/clear--> S2 (merges S1, adds 3 turns) --/tl,/clear--> S3 (merges S2, adds 5 turns)
198
- origin=S1×4 origin=S1×4, S2×3, S3×5
190
+ S1 (4 turns) --/clear--> S2 (auto-merges S1, adds 3 turns) --/clear--> S3 (auto-merges S2, adds 5 turns)
191
+ origin=S1×4 origin=S1×4, S2×3, S3×5
199
192
  ```
200
193
 
201
194
  ---
202
195
 
203
- ## Codex sidecar and `/tl-trim` preview
196
+ ## Codex sidecar and Codex trim
204
197
 
205
198
  Throughline is still **Claude Code first**. Codex support is an adapter layer:
206
199
  it can project the same `HandoffRecord` into a `throughline_handoff` JSON block,
@@ -241,11 +234,7 @@ summarization. When `codex-sidecar` is configured for `summarize-l1`,
241
234
  Throughline can use it for that step; otherwise it keeps the existing Claude
242
235
  Haiku path. This is an explicit compatibility mode, not silent auto-detection.
243
236
 
244
- `/tl-trim` starts from dry-run. It previews how many captured turns would be
245
- trimmed, what recent turns would remain, and what curated memory would need to
246
- be injected back.
247
-
248
- **Codex rollback / inject is enabled again.** The 2026-05-06 incident initially
237
+ **Codex rollback / inject is enabled.** The 2026-05-06 incident initially
249
238
  looked like a rolled-back user prompt could reappear after VS Code restart /
250
239
  reconnect, but controlled model-visible rollback smokes did not reproduce that
251
240
  path. `throughline trim --execute --host codex` now sends the guarded
@@ -311,12 +300,9 @@ rollout text, not an exact host tokenizer measurement. If rollback candidate
311
300
  turns are `0`, there is no current trim saving under the active keep-recent
312
301
  setting.
313
302
 
314
- Claude primary remains manual-only for conversation rewind. Throughline can
315
- prepare the current-work memory preview, but it does not drive Claude Code's
316
- interactive rewind UI or claim an automatic Claude rewind path. After a manual
317
- conversation-only rewind, give Claude the preview from `/tl-trim` / `trim
318
- --dry-run`; the preview uses the same active-work framing as Codex so restored
319
- L1/L2 reads as the current task rather than as a passive archive.
303
+ Claude-side rewind UI itself is not driven by Throughline. The auto-handoff
304
+ flow is `/clear` new SessionStart automatic injection of curated memory.
305
+ Throughline does not invoke `/rewind` or any Claude Code internal command.
320
306
 
321
307
  Codex-primary setup has an installed Stop hook after global
322
308
  `throughline install`. In real sessions, verify capture rather than assuming it:
@@ -380,8 +366,8 @@ references while pointing back to the full `codex-resume` context. `--format
380
366
  item-json` returns a Codex developer-message item for hosts that accept
381
367
  structured item injection; it is a rendering surface only and does not mutate
382
368
  the Codex thread by itself. `--memo-stdin` prepends an explicit Codex-primary
383
- in-flight memo to that rendered context; this is the first Codex-side equivalent
384
- of `/tl`'s "what was I about to do next" signal, without touching Claude batons.
369
+ current-work memo to that rendered context; this is a Codex-side opt-in for
370
+ "what was I about to do next" signal, independent from the Claude `/tl` baton.
385
371
  `throughline codex-visibility-smoke` is the experimental mutation check for
386
372
  that rendered memory: it injects the active-work developer message and starts a
387
373
  marker-check model turn through the Codex app-server, so it requires the
@@ -650,7 +636,6 @@ entry to the `tasks` array yourself:
650
636
  | `throughline monitor [--all] [--session <id>]` | Run the multi-session token monitor |
651
637
  | `throughline monitor --diag` | Dump TTY/columns/env diagnostics (for debugging monitor render bugs) |
652
638
  | `throughline detail <time>` | Retrieve L2 body text and L3 tool I/O for a turn (see below) |
653
- | `throughline save-inflight` | Called by `/tl` to attach an in-flight memo (stdin) to the current baton |
654
639
  | `throughline doctor` | Check Node version, hook registration, DB writability, PATH |
655
640
  | `throughline doctor --session <id-prefix>` | Diagnose a specific session — detect state/transcript drift, idle vs. stuck |
656
641
  | `throughline doctor --trim --host claude\|codex` | Diagnose trim host boundaries, manual procedure, and Codex host primitive blockage |
@@ -672,7 +657,7 @@ entry to the `tasks` array yourself:
672
657
  | `throughline codex-threads` | List read-only Codex thread id candidates for the current project |
673
658
  | `throughline codex-sidecar-diagnostics` | Check `codex-sidecar` diagnostics status for this project |
674
659
  | `throughline codex-sidecar-dry-run` | Print a normalized read-only sidecar request without running the app server |
675
- | `throughline trim --dry-run` | Preview `/tl-trim` context trim memory and host boundary; does not rollback automatically |
660
+ | `throughline trim --dry-run --host codex` | Preview Codex same-thread context trim memory and host boundary; does not rollback automatically |
676
661
  | `throughline trim --preflight --host codex` | Read/resume the explicit Codex thread and verify turn-count guards without rollback/inject |
677
662
  | `throughline trim --execute --host codex` | Explicit Codex rollback-inject path; requires Codex thread identity, injectable DB memory, and rollout/app-server turn-count agreement |
678
663
  | `throughline status` | Print DB statistics (sessions, skeletons, bodies, details) |
@@ -682,14 +667,13 @@ Slash commands (invoked by the user in Claude Code):
682
667
 
683
668
  | Command | What it does |
684
669
  | ------------- | ----------------------------------------------------------------- |
685
- | `/tl` | Write a handoff baton + ask Claude to save an in-flight memo for the next session |
686
- | `/tl-trim` | Ask Claude to write a current-work memo and run trim dry-run |
670
+ | `/tl` | Write a handoff baton (used as opt-in inheritance signal when `/clear` auto path is OFF or you skip `/clear`) |
687
671
  | `/sc-detail <time>` | Retrieve L2 body text and L3 tool I/O for a past turn |
688
672
 
689
- > When `/tl` triggers, Claude will call `throughline save-inflight` via its
690
- > Bash tool. Claude Code will prompt for permission the first time; add
691
- > `Bash(throughline save-inflight:*)` to your allowlist to skip the prompt on
692
- > subsequent `/tl` invocations.
673
+ > Auto-handoff is ON by default since v0.4.0: just type `/clear` and the new
674
+ > chat resumes mid-thought. Set `THROUGHLINE_DISABLE_AUTO_HANDOFF=1` in your
675
+ > environment to opt out. `/tl` is for users who opt out, or who want to
676
+ > inherit across non-`/clear` boundaries (new chat / VSCode restart).
693
677
 
694
678
  Hook subcommands (invoked by Claude Code, not by humans):
695
679
  `session-start` (SessionStart), `process-turn` (Stop),
@@ -743,7 +727,7 @@ Schema v7:
743
727
  - `skeletons` — L1 one-liners, keyed by `(session_id, origin_session_id, turn, role)`
744
728
  - `bodies` — L2 verbatim text (user + assistant), same key shape
745
729
  - `details` — L3 records with `kind` column (`tool_input` / `tool_output` / `system` / `image` / `thinking`) and `source_id` for idempotent re-processing
746
- - `handoff_batons` — one row per `project_path`, with `session_id`, `created_at`, and `memo_text` (the in-flight memo written by `save-inflight` after `/tl`). Consumed and deleted by the next `SessionStart` if within the 1-hour TTL.
730
+ - `handoff_batons` — one row per `project_path`, with `session_id` and `created_at`. Consumed and deleted by the next `SessionStart` if within the 1-hour TTL. (v8 dropped the `memo_text` column when memo was retired in v0.4.0.)
747
731
  - `injection_log` — audit trail of injection events
748
732
 
749
733
  All memory tables carry an `origin_session_id` so rebonded rows keep their
@@ -27,7 +27,7 @@
27
27
  * throughline codex-threads # List read-only Codex thread id candidates
28
28
  * throughline codex-sidecar-diagnostics # Check codex-sidecar availability
29
29
  * throughline codex-sidecar-dry-run # Print normalized sidecar request
30
- * throughline trim --dry-run # Preview same-session context trim plan
30
+ * throughline trim --execute --host codex # Codex same-thread guarded trim
31
31
  * throughline doctor # 環境チェック
32
32
  * throughline status # DB 統計表示
33
33
  * throughline --version # バージョン表示
@@ -60,9 +60,6 @@ switch (cmd) {
60
60
  case 'detail':
61
61
  (await import('../src/sc-detail.mjs')).run(rest);
62
62
  break;
63
- case 'save-inflight':
64
- await (await import('../src/cli/save-inflight.mjs')).run();
65
- break;
66
63
  case 'handoff-preview':
67
64
  await (await import('../src/cli/handoff-preview.mjs')).run(rest);
68
65
  break;
@@ -149,7 +146,6 @@ Usage:
149
146
  throughline uninstall Remove hooks
150
147
  throughline monitor Multi-session token monitor (use --all, --session <id>)
151
148
  throughline detail <time> Retrieve L2+L3 detail for a turn (e.g. 14:23:05 or 14:23-14:30)
152
- throughline save-inflight Save in-flight memo (stdin) to the current /tl baton
153
149
  throughline handoff-preview Print Codex-facing throughline_handoff JSON
154
150
  throughline codex-capture Capture active Codex rollout turns into DB
155
151
  (requires --codex-thread-id or env thread id)
@@ -226,13 +222,15 @@ Usage:
226
222
  Check codex-sidecar diagnostics status
227
223
  throughline codex-sidecar-dry-run
228
224
  Print normalized read-only sidecar request
229
- throughline trim --dry-run Preview same-session context trim plan
230
- (Codex: accepts --codex-thread-id <id> or
225
+ throughline trim --dry-run --host codex
226
+ Preview Codex same-thread context trim plan
227
+ (accepts --codex-thread-id <id> or
231
228
  THROUGHLINE_CODEX_THREAD_ID / CODEX_THREAD_ID)
232
229
  (text preview accepts --preview-max-chars <n>)
233
- throughline trim --preflight
234
- Codex-only app-server read/resume guard; does not rollback
235
- throughline trim --execute Codex rollback/inject guard; requires a Codex
230
+ throughline trim --preflight --host codex
231
+ Codex app-server read/resume guard; does not rollback
232
+ throughline trim --execute --host codex
233
+ Codex rollback/inject guard; requires a Codex
236
234
  thread id, injectable DB memory, and matching
237
235
  rollout/app-server turns
238
236
  throughline doctor Check environment
@@ -1,5 +1,18 @@
1
1
  # 引き継ぎ発火条件の絞り込み調査 & 実装計画
2
2
 
3
+ > **Status (2026-05-08 update): 本書は履歴扱い**
4
+ >
5
+ > 当時 (2026-04-18) は VSCode 拡張 2.1.112 で `/clear` 後も `source='startup'` に
6
+ > 潰される問題があり、バトン方式 (案 E) を採用した。その後 Claude Code 2.1.105
7
+ > (VSCode `/clear` not clearing context fix) と 2.1.126 (Windows env fix) で
8
+ > 段階的に修正され、**2.1.128 で `source='clear'` が reliable**になっている。
9
+ >
10
+ > 現行仕様 (v0.4.0): auto path (`/clear` で自動引継ぎ) + baton path (`/tl` 明示
11
+ > マーカー) の 2 経路。`THROUGHLINE_DISABLE_AUTO_HANDOFF=1` で auto path を OFF
12
+ > にできる。詳細は [THROUGHLINE_CLEAR_AUTO_HANDOFF_PLAN.md](THROUGHLINE_CLEAR_AUTO_HANDOFF_PLAN.md)。
13
+ >
14
+ > 本書は当時のバトン採用判断を残す履歴ドキュメント。
15
+
3
16
  ## Status (2026-04-18 更新)
4
17
 
5
18
  - **Phase 0 実機検証: 完了**
@@ -78,7 +78,8 @@ schema v4 で PostToolUse (`capture-tool`) は廃止、L2/L3 は Stop 内で一
78
78
  | schema v4 migration(bodies 追加、judgments DROP) | [src/db.mjs](../src/db.mjs) |
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
- | schema v7 migration(`handoff_batons.memo_text` カラム追加、in-flight メモ保存) | [src/db.mjs](../src/db.mjs), [src/baton.mjs](../src/baton.mjs), [src/cli/save-inflight.mjs](../src/cli/save-inflight.mjs) |
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
83
  | VSCode `.vscode/tasks.json` の自動プロビジョニング(token-monitor の folderOpen 自動起動) | [src/vscode-task.mjs](../src/vscode-task.mjs) |
83
84
  | Stop フック時の state.usage スナップショット(monitor の「止まって見える」問題の切り分け用) | [src/state-file.mjs](../src/state-file.mjs), [src/turn-processor.mjs](../src/turn-processor.mjs) |
84
85
  | `throughline doctor --session <id-prefix>` セッション診断(state/transcript ズレ検出) | [src/cli/doctor.mjs](../src/cli/doctor.mjs) |