throughline 0.3.24 → 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.
- package/.claude/commands/tl-trim.md +42 -0
- package/.codex-sidecar.yml +62 -0
- package/CHANGELOG.md +583 -0
- package/README.ja.md +42 -5
- package/README.md +383 -23
- package/bin/throughline.mjs +168 -4
- package/codex/skills/throughline/SKILL.md +157 -0
- package/codex/skills/throughline/agents/openai.yaml +7 -0
- package/docs/INHERITANCE_ON_CLEAR_ONLY.md +146 -0
- package/docs/L1_L2_L3_REDESIGN.md +415 -0
- package/docs/PUBLIC_RELEASE_PLAN.md +184 -0
- package/docs/THROUGHLINE_CODEX_DUAL_SUPPORT.md +249 -0
- package/docs/THROUGHLINE_CODEX_FIRST_ROADMAP.md +555 -0
- package/docs/THROUGHLINE_CODEX_MONITOR_IMPLEMENTATION_PLAN.md +220 -0
- package/docs/THROUGHLINE_CODEX_TRIM_IMPLEMENTATION_PLAN.md +528 -0
- package/docs/THROUGHLINE_CODEX_TRIM_ROLLBACK_FIX_PLAN.md +672 -0
- package/docs/archive/CONCEPT.md +476 -0
- package/docs/archive/EXPERIMENT.md +371 -0
- package/docs/archive/README.md +22 -0
- package/docs/archive/SESSION_LINKING_DESIGN.md +231 -0
- package/docs/archive/THROUGHLINE_NEXT_STEPS.md +134 -0
- package/docs/throughline-codex-trim-rollback-incident-report.md +306 -0
- package/docs/throughline-handoff-context.example.json +57 -0
- package/docs/throughline-rollback-context-trim-insight.md +455 -0
- package/package.json +6 -2
- package/src/cli/codex-capture.mjs +95 -0
- package/src/cli/codex-handoff-model-smoke.mjs +292 -0
- package/src/cli/codex-handoff-model-smoke.test.mjs +262 -0
- package/src/cli/codex-handoff-smoke.mjs +163 -0
- package/src/cli/codex-handoff-smoke.test.mjs +149 -0
- package/src/cli/codex-handoff-start.mjs +291 -0
- package/src/cli/codex-handoff-start.test.mjs +194 -0
- package/src/cli/codex-hook.mjs +276 -0
- package/src/cli/codex-hook.test.mjs +293 -0
- package/src/cli/codex-host-primitive-audit.mjs +110 -0
- package/src/cli/codex-host-primitive-audit.test.mjs +75 -0
- package/src/cli/codex-restore-smoke.mjs +357 -0
- package/src/cli/codex-restore-source-audit.mjs +304 -0
- package/src/cli/codex-resume.mjs +138 -0
- package/src/cli/codex-rollback-model-visible-smoke.mjs +373 -0
- package/src/cli/codex-rollback-model-visible-smoke.test.mjs +255 -0
- package/src/cli/codex-sidecar-diagnostics.mjs +48 -0
- package/src/cli/codex-sidecar-dry-run.mjs +85 -0
- package/src/cli/codex-summarize.mjs +224 -0
- package/src/cli/codex-threads.mjs +89 -0
- package/src/cli/codex-visibility-smoke.mjs +196 -0
- package/src/cli/codex-vscode-restore-smoke.mjs +226 -0
- package/src/cli/codex-vscode-rollback-smoke.mjs +114 -0
- package/src/cli/doctor.mjs +503 -1
- package/src/cli/doctor.test.mjs +542 -3
- package/src/cli/handoff-preview.mjs +78 -0
- package/src/cli/help.test.mjs +64 -0
- package/src/cli/install.mjs +227 -4
- package/src/cli/install.test.mjs +207 -4
- package/src/cli/trim.mjs +564 -0
- package/src/codex-app-server.mjs +1816 -0
- package/src/codex-app-server.test.mjs +512 -0
- package/src/codex-auto-refresh.mjs +194 -0
- package/src/codex-auto-refresh.test.mjs +182 -0
- package/src/codex-capture.mjs +235 -0
- package/src/codex-capture.test.mjs +393 -0
- package/src/codex-handoff-model-smoke.mjs +114 -0
- package/src/codex-handoff-model-smoke.test.mjs +89 -0
- package/src/codex-handoff-smoke.mjs +124 -0
- package/src/codex-handoff-smoke.test.mjs +103 -0
- package/src/codex-handoff.mjs +331 -0
- package/src/codex-handoff.test.mjs +220 -0
- package/src/codex-host-primitive-audit.mjs +374 -0
- package/src/codex-host-primitive-audit.test.mjs +208 -0
- package/src/codex-restore-smoke.test.mjs +639 -0
- package/src/codex-restore-source-audit.mjs +1348 -0
- package/src/codex-restore-source-audit.test.mjs +623 -0
- package/src/codex-resume.test.mjs +242 -0
- package/src/codex-rollout-memory.mjs +711 -0
- package/src/codex-rollout-memory.test.mjs +610 -0
- package/src/codex-sidecar-cli.test.mjs +75 -0
- package/src/codex-sidecar.mjs +246 -0
- package/src/codex-sidecar.test.mjs +172 -0
- package/src/codex-summarize.test.mjs +143 -0
- package/src/codex-thread-identity.mjs +23 -0
- package/src/codex-thread-index.mjs +173 -0
- package/src/codex-thread-index.test.mjs +164 -0
- package/src/codex-usage.mjs +110 -0
- package/src/codex-usage.test.mjs +140 -0
- package/src/codex-visibility-smoke.test.mjs +222 -0
- package/src/codex-vscode-restore-smoke.mjs +206 -0
- package/src/codex-vscode-restore-smoke.test.mjs +325 -0
- package/src/codex-vscode-rollback-smoke.mjs +90 -0
- package/src/codex-vscode-rollback-smoke.test.mjs +290 -0
- package/src/db-schema.test.mjs +97 -0
- package/src/haiku-summarizer.mjs +267 -26
- package/src/haiku-summarizer.test.mjs +282 -0
- package/src/handoff-preview.test.mjs +108 -0
- package/src/handoff-record.mjs +294 -0
- package/src/handoff-record.test.mjs +226 -0
- package/src/hook-entrypoints.test.mjs +326 -0
- package/src/package-files.test.mjs +19 -0
- package/src/prompt-submit.mjs +9 -6
- package/src/resume-context.mjs +44 -140
- package/src/resume-context.test.mjs +172 -0
- package/src/session-start.mjs +8 -5
- package/src/state-file.mjs +50 -6
- package/src/state-file.test.mjs +50 -0
- package/src/token-monitor.mjs +14 -10
- package/src/token-monitor.test.mjs +27 -0
- package/src/trim-cli.test.mjs +1584 -0
- package/src/trim-model.mjs +584 -0
- package/src/trim-model.test.mjs +568 -0
- package/src/turn-processor.mjs +17 -10
- package/src/vscode-task.mjs +33 -10
- package/src/vscode-task.test.mjs +19 -9
|
@@ -0,0 +1,555 @@
|
|
|
1
|
+
# Throughline: Codex First Roadmap
|
|
2
|
+
|
|
3
|
+
この文書は TODO を兼ねた実装計画です。
|
|
4
|
+
|
|
5
|
+
## この文書の位置づけ
|
|
6
|
+
|
|
7
|
+
この文書は、2026-05-06 時点の次フェーズ実装順を定義する。
|
|
8
|
+
|
|
9
|
+
既存文書との関係:
|
|
10
|
+
|
|
11
|
+
| 文書 | 扱い |
|
|
12
|
+
|---|---|
|
|
13
|
+
| [THROUGHLINE_CODEX_TRIM_IMPLEMENTATION_PLAN.md](THROUGHLINE_CODEX_TRIM_IMPLEMENTATION_PLAN.md) | これまでの統合計画と実装履歴。完了済み成果と根拠は維持するが、今後の実装順はこの文書を優先する |
|
|
14
|
+
| [THROUGHLINE_CODEX_TRIM_ROLLBACK_FIX_PLAN.md](THROUGHLINE_CODEX_TRIM_ROLLBACK_FIX_PLAN.md) | 2026-05-06 incident 後の修正計画。controlled smoke で rollback marker の model-visible 復活は未再現となり、overbroad blocker は解除済み |
|
|
15
|
+
| [THROUGHLINE_CODEX_DUAL_SUPPORT.md](THROUGHLINE_CODEX_DUAL_SUPPORT.md) | Claude / Codex 両対応の architecture brief。adapter 境界の基本方針として維持する |
|
|
16
|
+
| [throughline-rollback-context-trim-insight.md](throughline-rollback-context-trim-insight.md) | rollback / rewind を context delete primitive と見る設計メモ |
|
|
17
|
+
| [PUBLIC_RELEASE_PLAN.md](PUBLIC_RELEASE_PLAN.md) | 公開配布の状態表。実装済み behavior だけを公開説明に出す |
|
|
18
|
+
| [../CLAUDE.md](../CLAUDE.md) / [../AGENTS.md](../AGENTS.md) | 作業者向け入口。Claude 正本を守りつつ、この文書を次フェーズ計画として参照する |
|
|
19
|
+
|
|
20
|
+
この文書は、以後の実装順について [THROUGHLINE_CODEX_TRIM_IMPLEMENTATION_PLAN.md](THROUGHLINE_CODEX_TRIM_IMPLEMENTATION_PLAN.md) を上書きする。
|
|
21
|
+
ただし、Claude primary を壊さない、Claude hooks / `/tl` / baton / DB / resume context を Codex 用に置き換えない、という既存の絶対条件は維持する。
|
|
22
|
+
|
|
23
|
+
## 現状認識
|
|
24
|
+
|
|
25
|
+
- Throughline 本体は、ほとんどが hook から起動されるローカル Node.js コードベースで動く。
|
|
26
|
+
- 現行 Claude path は、Claude hooks、slash command、handoff baton、DB、resume context、L1 / L2 / L3 persistence で成立している。
|
|
27
|
+
- 外部モデル的に呼ぶ主要箇所は L2 -> L1 要約。
|
|
28
|
+
- Claude-primary の現行 L2 -> L1 要約は `codex-sidecar` が configured の場合に sidecar を優先し、使えない場合は Claude Haiku 経路に戻る。Codex-primary は Codex CLI backend 失敗を明示 error にし、Claude Haiku / raw L2 へ fallback しない。
|
|
29
|
+
- Codex guarded trim は、Codex app-server の `thread/read` / `thread/resume` / `thread/rollback` / `thread/inject_items` を使う。明示 thread identity、rollout/app-server turn count guard、injectable memory がない場合は mutation 前に拒否する。
|
|
30
|
+
- Claude `/rewind` 自動化はまだ有効化しない。
|
|
31
|
+
- Codex automatic refresh mutation は再有効化済み。`90%` の verified usage threshold で rollback / Throughline DB memory inject を試行し、estimate usage では実行しない。
|
|
32
|
+
|
|
33
|
+
## 新セッション引き継ぎ
|
|
34
|
+
|
|
35
|
+
2026-05-08 時点では、Codex primary の capture / summarize / resume は実装・実測済み。Codex trim execute / auto-refresh は、controlled rollback model-visible smoke の clean result を受けて blocker を解除した。[THROUGHLINE_CODEX_TRIM_ROLLBACK_FIX_PLAN.md](THROUGHLINE_CODEX_TRIM_ROLLBACK_FIX_PLAN.md) の Phase 0-3 は実装済み。Phase 4 では Codex app-server の protocol / local store 調査、read-only app-server process restart smoke、local restore source audit、manual VS Code restart smoke protocol、実 VS Code reload / reconnect 後の hidden developer memory marker proof、rollback 非復活 verifier、controlled rollback model-visible smoke surface まで進んだ。incident-shaped live rollback run では `compacted.replacement_history` retention を診断したが、後続の risky restore inspection では app-server response 上の retained text は `aggregatedOutput` など quoted/tool-output field に限定され、direct user message / `replacement_history` の復活とは分離された。`throughline codex-host-primitive-audit` は diagnostic-only として残す。
|
|
36
|
+
|
|
37
|
+
Codex 側で実装済み / 診断可能なもの:
|
|
38
|
+
|
|
39
|
+
- `codex-capture`: Codex rollout から active turns を DB に保存できる。
|
|
40
|
+
- `codex-summarize`: Codex CLI backend で L2 -> L1 を書ける。Claude Haiku / raw L2 へ fallback しない。
|
|
41
|
+
- `codex-resume`: L1 summary と active L2 context を Codex active-work context / fresh-thread handoff / developer message item として描画できる。
|
|
42
|
+
- `trim --dry-run --host codex` / `doctor --trim --host codex`: rollback / inject plan、memory contract、context reduction estimate、diagnostics を表示する。fresh-thread handoff は代替継続 surface として残すが、current thread trim の代替ではない。
|
|
43
|
+
- `trim --preflight --host codex`: rollout / app-server turn count guard を確認する。restore-safety diagnostics と planned rollback risk は報告するが、拒否条件ではない。
|
|
44
|
+
- `trim --execute --host codex`: live app-server へ guarded rollback + Throughline DB memory inject を送る。env gate や host primitive audit gate は不要。DB memory が無い場合、または rollout/app-server turn count がずれる場合は mutation 前に拒否する。
|
|
45
|
+
- `codex-visibility-smoke`: injected active-work memory が次 model turn で model-visible になることを確認済み。
|
|
46
|
+
- `codex-rollback-model-visible-smoke`: controlled two-phase smoke。`--prepare` は unique marker を含む user turn を開始して 1 turn rollback し、`--verify` は full marker を含まない prefix-only prompt で rollback 済み marker が model-visible かを測る。これは実 current thread を mutate するため明示 env 必須。live run では `--marker-file` を使い、full marker を同一 thread の chat/tool output に出さない。
|
|
47
|
+
- `codex-restore-smoke`: fresh app-server process を複数回起動し、`thread/read` / `thread/resume` / paginated `thread/turns/list` turn count が rollout active turn count と一致し続けるかを read-only で確認できる。ただし proof scope は `app_server_process_restart_only` で、VS Code restart-safe 証明ではない。
|
|
48
|
+
- `codex-restore-source-audit`: rollout / `session_index.jsonl` / `state_*.sqlite` / VS Code globalStorage / workspaceStorage 候補 / settings / logs / installed OpenAI-Codex VS Code extension bundle を read-only で棚卸しできる。ただし proof scope は `local_restore_source_inventory_only` で、VS Code restart-safe 証明ではない。
|
|
49
|
+
- `codex-host-primitive-audit`: installed Codex app-server schema を read-only で生成・監査し、rollback 済み user text を current-thread の model-visible input に復活させない deletion / isolation / projection primitive があるか判定できる。host-agnostic same-thread repair contract として rollback non-resurrection guarantee、memory reinjection、post-repair read verification、restart/reconnect non-resurrection smoke も要求する。実 `codex-cli 0.128.0-alpha.1` では diagnostic status として `host-primitive-audit-blocked` / `blocked-missing-current-thread-non-resurrection-guarantee` を返すが、Codex trim execute / auto-refresh の blocker にはしない。
|
|
50
|
+
- `codex-vscode-restore-smoke`: `--prepare` で hidden active-work marker memory を注入し、VS Code reload / reconnect 後に marker を含まない prompt への応答を `--verify` で rollout 検証する二段階 protocol。実 reload / reconnect run は `TL_CODEX_VSCODE_RESTORE_46888202` で成功済み。ただしこれは injected developer memory の restart visibility 証明であり、rollback 済み user turn の非復活証明ではない。
|
|
51
|
+
- `codex-vscode-rollback-smoke`: rollout を read-only で読み、rollback event、rollback 済み user text、rollback 後 user turn、restore-safety ok、`--after-vscode-restart` を満たす場合だけ rollback 非復活 proof として pass する。incident-shaped live rollback/reload run は `restore_safety_risk` として扱う。
|
|
52
|
+
- Context 削減量は当初は turn count だけで、実 token 削減量は未計測だった。現行 dry-run は Codex rollout text から `chars / 4` の heuristic estimate として、rollback 候補 tokens、inject memory tokens、net 削減 tokens / % を表示する。これは host tokenizer の厳密実測ではない。
|
|
53
|
+
|
|
54
|
+
Codex 側で再実装しないこと:
|
|
55
|
+
|
|
56
|
+
- `codex-sidecar` を Codex primary backend にしない。Codex primary の L2 -> L1 は Codex CLI。
|
|
57
|
+
- Claude hooks / `/tl` / baton / transcript parser を Codex 用に置き換えない。
|
|
58
|
+
- `thread/inject_items` 後の即時 `thread/read` で injected memory が turn count に出ないことを failure と見なさない。これは実測済み挙動で、次 model turn visibility は別 smoke で確認済み。
|
|
59
|
+
|
|
60
|
+
後日再開する課題:
|
|
61
|
+
|
|
62
|
+
- Codex trim rollback incident の修正計画は、blocker 解除後の durable evidence / UX polish に移る。controlled rollback model-visible smoke は clean。restore-safety diagnostics / host primitive audit / VS Code source audit は、今後も説明と監査の補助として残す。
|
|
63
|
+
- 完成目標は同じ Codex thread の context trim である。new-thread handoff は補助 surface として残す。
|
|
64
|
+
- `plannedRollbackRestoreSafety` は診断として維持する。rollback 予定 tail user text と既存 `compacted.replacement_history` を照合するが、実行前拒否には使わない。
|
|
65
|
+
- Claude `/rewind conversation only` の手動 UX を確認する。
|
|
66
|
+
- Claude Code CLI と VSCode extension で `/rewind` の挙動差があるか確認する。
|
|
67
|
+
- 現時点では Claude rewind は manual-only 正式仕様。documented / scriptable な conversation-only rewind primitive が見つかるまで、Throughline から Claude の rewind UI を自動操作しない。
|
|
68
|
+
|
|
69
|
+
再開時の入口:
|
|
70
|
+
|
|
71
|
+
1. この `新セッション引き継ぎ` を読む。
|
|
72
|
+
2. Codex 側をやり直さず、Claude `/rewind conversation only` の手動 UX 確認へ進む。
|
|
73
|
+
3. Claude 側に触る前に [../CLAUDE.md](../CLAUDE.md) を読む。
|
|
74
|
+
4. Codex rollback incident の追加診断が必要な場合だけ、[THROUGHLINE_CODEX_TRIM_ROLLBACK_FIX_PLAN.md](THROUGHLINE_CODEX_TRIM_ROLLBACK_FIX_PLAN.md) の Phase 4 を参照する。
|
|
75
|
+
5. `.claude/settings.json` はユーザー環境差分を含み得るため、明示依頼なしに整理・置換しない。
|
|
76
|
+
|
|
77
|
+
## 新しい実装順
|
|
78
|
+
|
|
79
|
+
現行の実装順は次の通り。2026-05-08 時点では 1 と 2 は完了扱いで、次に進めるのは 3。
|
|
80
|
+
|
|
81
|
+
```text
|
|
82
|
+
1. Throughline を Codex primary で使えるようにする
|
|
83
|
+
-> Codex 用 hook / lifecycle 相当の入口を作る
|
|
84
|
+
-> L2 -> L1 backend は Codex CLI を本線にする
|
|
85
|
+
|
|
86
|
+
2. Codex で Claude Rewind 相当の current-thread context trim を実現する
|
|
87
|
+
-> conversation-visible context を安全に削る
|
|
88
|
+
-> curated memory を同一 thread に戻す
|
|
89
|
+
-> model turn を不用意に開始しない
|
|
90
|
+
-> controlled rollback model-visible smoke と VS Code restore smoke で restart / reconnect 境界を確認する
|
|
91
|
+
-> retained compacted history / host primitive audit は diagnostics として残す
|
|
92
|
+
|
|
93
|
+
3. Claude 側のトドメを刺す
|
|
94
|
+
-> Claude `/rewind conversation only` の手動 UX / 自動化 surface を詰める
|
|
95
|
+
-> Codex 側と同等の運用体験に寄せる
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## 絶対に守ること
|
|
99
|
+
|
|
100
|
+
- Claude の設定を Codex 用に置き換えない。
|
|
101
|
+
- `CLAUDE.md` は Claude 正本として維持し、`AGENTS.md` は Codex / agent 向けの参照入口として扱う。
|
|
102
|
+
- Claude hooks / slash command / transcript parser / baton / resume context の既存 semantics を rename しない。
|
|
103
|
+
- Codex 対応は adapter / bridge / Codex primary entrypoint として足す。
|
|
104
|
+
- Codex CLI / app-server / rollout の仕様は実測で固定する。未確認の host behavior を成功扱いにしない。
|
|
105
|
+
- silent fallback で失敗を隠さない。互換経路を使う場合は、理由と source を結果に残す。
|
|
106
|
+
|
|
107
|
+
## Phase 0: Current State Audit
|
|
108
|
+
|
|
109
|
+
目的: いま何が Codex-ready で、何が Claude 専用かを切り分ける。
|
|
110
|
+
|
|
111
|
+
TODO:
|
|
112
|
+
|
|
113
|
+
- [x] hook entrypoint 一覧を作る。
|
|
114
|
+
- `process-turn`
|
|
115
|
+
- `session-start`
|
|
116
|
+
- `prompt-submit`
|
|
117
|
+
- `save-inflight`
|
|
118
|
+
- install / uninstall
|
|
119
|
+
- [x] 各 entrypoint について、Claude 固有入力に依存している箇所と、agent-neutral core にできる箇所を分ける。
|
|
120
|
+
- [x] L1 / L2 / L3 persistence のうち、Codex rollout / app-server から再現できる最小入力を定義する。
|
|
121
|
+
- [x] Codex primary で必要な session identity を定義する。
|
|
122
|
+
- Codex `thread_id`
|
|
123
|
+
- project path
|
|
124
|
+
- rollout file
|
|
125
|
+
- Throughline `session_id` 相当を作るかどうか
|
|
126
|
+
- [x] `codex-sidecar` と Codex CLI の役割を再整理する。
|
|
127
|
+
- `codex-sidecar`: review / risk-check / second opinion
|
|
128
|
+
- Codex CLI: Codex primary の L2 -> L1 backend
|
|
129
|
+
- Codex app-server: thread read / resume / rollback / inject
|
|
130
|
+
|
|
131
|
+
完了条件:
|
|
132
|
+
|
|
133
|
+
- [x] Claude 専用 entrypoint と Codex primary entrypoint の境界が docs と tests で追える。
|
|
134
|
+
- [x] Codex primary に必要な input contract が決まっている。
|
|
135
|
+
|
|
136
|
+
Audit result (2026-05-06):
|
|
137
|
+
|
|
138
|
+
| Area | 現状 | Codex primary で必要なこと |
|
|
139
|
+
|---|---|---|
|
|
140
|
+
| `process-turn` | Claude Stop hook payload (`session_id` / `transcript_path` / `cwd`) と Claude transcript reader に依存して L2 / L3 / delayed L1 を保存する | Codex rollout JSONL を source にした capture entrypoint を別に足す。Claude transcript parser は置き換えない |
|
|
141
|
+
| `session-start` | Claude SessionStart payload と stdout injection で baton を consume し、`buildResumeContext` を注入する | Codex 用 resume renderer / injection surface を別に作る。Claude stdout contract は維持する |
|
|
142
|
+
| `prompt-submit` | Claude UserPromptSubmit で `/tl` を検知して baton を作る | Codex primary では slash command 前提にせず、CLI command または explicit memo stdin で同等の baton / memo を作る |
|
|
143
|
+
| `save-inflight` | Claude slash command がメイン Claude に書かせた memo を stdin で受け、現在 project の baton に保存する | Codex primary でも stdin memo writer として再利用可能。ただし memo 生成者は Codex command surface 側で決める |
|
|
144
|
+
| install / uninstall | `~/.claude/settings.json` と `.claude/commands` を管理する Claude 専用 entrypoint | Codex setup は別 command にする。Claude 設定へ Codex hook を混ぜない |
|
|
145
|
+
| DB schema | `sessions` / `bodies` / `skeletons` / `details` は `session_id` / `origin_session_id` で agent-neutral に近いが、現行 writer は Claude 由来 | Codex 由来を書き込む前に source/origin と session identity を固定する。既存 Claude-facing field は rename しない |
|
|
146
|
+
| Codex rollout adapter | `parseCodexRolloutFile` は `thread_rolled_back` を適用した active turns を復元できる。現在は trim preview 用 | 通常 capture 用にも使う。rollback 済み tail を current L2 として保存しない |
|
|
147
|
+
| Handoff projection | `HandoffRecord` は DB から安定 object を作るが、現行 `source.adapter` は `claude` 固定 | Codex capture 後に `source.adapter` / `sourceAgent` を Codex 由来にできるよう調整する |
|
|
148
|
+
| L2 -> L1 backend | `summarizeToL1` は `codex-sidecar` -> Claude Haiku -> `raw_l2` の Claude primary 互換経路 | host mode を必須化し、Codex primary は Codex CLI backend failure を明示 error にする |
|
|
149
|
+
|
|
150
|
+
Codex primary の最小 input contract は Phase 1 で固定した。Codex `thread_id` は裸の `session_id` として流用せず、Throughline DB では `codex:<thread_id>` に namespacing する。
|
|
151
|
+
|
|
152
|
+
## Phase 1: Codex Primary Capture
|
|
153
|
+
|
|
154
|
+
目的: Codex の会話を Throughline DB に取り込めるようにする。最初の実装 slice は L2 `bodies` capture で開始し、実測済み rollout 形式に基づいて L3 `details` も追加する。
|
|
155
|
+
|
|
156
|
+
TODO:
|
|
157
|
+
|
|
158
|
+
- [x] Codex rollout JSONL から active turns を読む adapter を、trim 用だけでなく通常 capture 用にも使える形へ整理する。
|
|
159
|
+
- [x] `event_msg:thread_rolled_back` を適用した active turn reconstruction を共通化する。
|
|
160
|
+
- [x] Codex turn を Throughline の `bodies` / `details` に保存する mapping を決める。
|
|
161
|
+
- `bodies`: user / assistant / developer message を role ごとに L2 として保存する。
|
|
162
|
+
- `details`: `function_call` / `function_call_output` を L3 tool input / output として保存する。
|
|
163
|
+
- [x] Claude transcript 由来と Codex rollout 由来を `source` / `origin` で区別する。
|
|
164
|
+
- Codex primary の Throughline `session_id` / `origin_session_id` は `codex:<thread_id>` とする。
|
|
165
|
+
- `thread_id` を裸の `session_id` として流用しない。
|
|
166
|
+
- `HandoffRecord.source.adapter` は `codex:` namespaced session から `codex` を推定する。
|
|
167
|
+
- [x] Codex primary session を作る CLI entrypoint を追加する。
|
|
168
|
+
- `throughline codex-capture --codex-thread-id <id>`
|
|
169
|
+
- env identity は `THROUGHLINE_CODEX_THREAD_ID` / `CODEX_THREAD_ID`
|
|
170
|
+
- thread id がない場合は guessing せず error
|
|
171
|
+
- [x] 既存 Claude session merge semantics と衝突しないことを test で固定する。
|
|
172
|
+
- Codex session は namespaced id で分離する。
|
|
173
|
+
- capture は同じ Codex thread session を再構成し、rollback 済み tail を DB に残さない。
|
|
174
|
+
|
|
175
|
+
完了条件:
|
|
176
|
+
|
|
177
|
+
- [x] Codex thread の active turns から Throughline DB に L2 を保存できる。
|
|
178
|
+
- [x] rollback 済み tail は current L2 として保存されない。
|
|
179
|
+
- [x] Claude path の transcript capture tests は変わらず通る。
|
|
180
|
+
|
|
181
|
+
Phase 1 implementation result (2026-05-06):
|
|
182
|
+
|
|
183
|
+
- [x] `src/codex-capture.mjs` を追加した。`parseCodexRolloutFile` の active turns を DB `bodies` へ保存する。
|
|
184
|
+
- [x] `throughline codex-capture` を追加した。明示 `--codex-thread-id` または env thread id が必須で、候補を自動選択しない。
|
|
185
|
+
- [x] Codex session identity は `codex:<thread_id>` に固定した。これにより Claude `session_id` と衝突せず、`origin_session_id` も Codex 由来として追跡できる。
|
|
186
|
+
- [x] 同じ Codex thread の再 capture は `skeletons` / `bodies` / `details` を再構成する。前回 capture 後に rollback された tail は残らない。
|
|
187
|
+
- [x] `HandoffRecord` は `codex:` namespaced session を `source.adapter = codex` として扱い、`throughline_handoff.data.sourceAgent` も `codex` になる。
|
|
188
|
+
- [x] Codex rollout の L3 details mapping を追加した。`response_item` の `function_call` / `function_call_output` を `details.kind = tool_input / tool_output` として保存する。
|
|
189
|
+
- 実 session 再 capture: `capturedTurns = 41`, `capturedRows = 75`, `capturedDetails = 2424`
|
|
190
|
+
- parser stats: `toolInputs = 1940`, `toolOutputs = 1937`
|
|
191
|
+
- [x] `npm test` で Claude hook entrypoint / transcript capture を含む 355 tests pass。
|
|
192
|
+
|
|
193
|
+
## Phase 2: Codex CLI L2 -> L1 Backend
|
|
194
|
+
|
|
195
|
+
目的: Codex primary で使う L2 -> L1 要約 backend を Codex CLI にする。
|
|
196
|
+
|
|
197
|
+
現在の `codex-sidecar` 優先 / Claude Haiku fallback は、Claude primary から sidecar を使う互換経路として残す。
|
|
198
|
+
Codex primary では、Codex CLI を本線 backend として扱う。
|
|
199
|
+
|
|
200
|
+
TODO:
|
|
201
|
+
|
|
202
|
+
- [x] `summarizeToL1` の backend 選択を host mode で分ける。
|
|
203
|
+
- `claude-primary`: `codex-sidecar` configured なら sidecar、なければ Claude Haiku
|
|
204
|
+
- `codex-primary`: Codex CLI
|
|
205
|
+
- `unknown`: 明示エラー。呼び出し側が `claude-primary` / `codex-primary` を決める
|
|
206
|
+
- [x] Codex CLI summarizer wrapper を追加する。
|
|
207
|
+
- [x] Codex CLI subprocess は recursion / hook loop を起こさない cwd / env で起動する。
|
|
208
|
+
- `codex exec --ephemeral --ignore-user-config --ignore-rules --skip-git-repo-check --sandbox read-only -C <project>`
|
|
209
|
+
- env guard: `THROUGHLINE_IN_CODEX_SUMMARIZER=1`
|
|
210
|
+
- [x] Codex CLI summarizer は structured output または厳格な plain text output contract を持つ。
|
|
211
|
+
- Phase 2 では strict plain text output contract とする。
|
|
212
|
+
- [x] Codex CLI failure は `source` / `reason` に残す。
|
|
213
|
+
- failure は `source = codex-cli` / `reason = codex_cli_failed` 付き Error として throw する。
|
|
214
|
+
- [x] Codex CLI が使えない場合の扱いを決める。
|
|
215
|
+
- Codex primary では fallback せず error にする。
|
|
216
|
+
- Claude primary 互換経路だけ、既存通り `codex-sidecar` / Claude Haiku / `raw_l2` を source 付きで許可する。
|
|
217
|
+
- [x] tests を追加する。
|
|
218
|
+
- Codex primary は Codex CLI backend を呼ぶ
|
|
219
|
+
- Claude primary は既存 sidecar / Haiku 経路を維持する
|
|
220
|
+
- Codex CLI failure は silent success にならない
|
|
221
|
+
|
|
222
|
+
完了条件:
|
|
223
|
+
|
|
224
|
+
- [x] Codex primary の L2 -> L1 source が `codex-cli` として記録される。
|
|
225
|
+
- [x] Claude primary の L2 -> L1 source は既存通り `codex-sidecar` / `haiku` / `raw_l2` を返せる。
|
|
226
|
+
|
|
227
|
+
Phase 2 implementation result (2026-05-06):
|
|
228
|
+
|
|
229
|
+
- [x] `summarizeToL1(l2Text, { hostMode })` は `claude-primary` / `codex-primary` / `unknown` を分岐する。
|
|
230
|
+
- [x] `turn-processor` は Claude Stop hook path として `hostMode: 'claude-primary'` を明示する。
|
|
231
|
+
- [x] Codex primary は Codex CLI backend を使い、`codex-cli` source を返す。
|
|
232
|
+
- [x] Codex CLI failure は Claude Haiku / raw L2 へ fallback しない。
|
|
233
|
+
- [x] `throughline codex-summarize --session codex:<thread_id>` を追加した。captured Codex L2 が L2 window を超えた場合、最古の未要約 turn を Codex CLI backend で L1 skeleton に書く。
|
|
234
|
+
- [x] 実 Codex host での `codex-summarize` smoke を実施した。`codex-cli` backend で L1 skeleton を書き、Claude Haiku / raw L2 へ fallback しないことを確認した。
|
|
235
|
+
- result: `status = summarized`, `reason = codex_cli_l1_written`, `source = codex-cli`, `inserted = true`
|
|
236
|
+
- target: `session = codex:019dfa40-1cc8-7d13-a110-16b09364fa6a`, `turnNumber = 1`, `l2Window = 20`
|
|
237
|
+
- [x] `node --test src/haiku-summarizer.test.mjs src/turn-processor.test.mjs src/hook-entrypoints.test.mjs` で 24 tests pass。
|
|
238
|
+
- [x] `npm test` で 355 tests pass。
|
|
239
|
+
|
|
240
|
+
## Phase 3: Codex Primary Resume / Handoff
|
|
241
|
+
|
|
242
|
+
目的: Codex で Throughline の記憶を「今やっている作業」として復元する。
|
|
243
|
+
|
|
244
|
+
TODO:
|
|
245
|
+
|
|
246
|
+
- [x] Codex primary 用 resume context renderer を作る。
|
|
247
|
+
- [x] `HandoffRecord` / `throughline_handoff` を Codex primary 向けに調整する。
|
|
248
|
+
- [x] Active Work Thread / Reading Contract / Continuation Instruction の構造を維持する。
|
|
249
|
+
- [x] `/tl` の in-flight memo 相当を Codex primary でどう作るか決める。
|
|
250
|
+
- Codex CLI command
|
|
251
|
+
- explicit memo stdin
|
|
252
|
+
- automatic current-work snapshot
|
|
253
|
+
- 判断: 初期 surface は `--memo-stdin` とする。main Codex が memo を書き、`codex-resume` / `codex-visibility-smoke` に stdin で渡す。Claude baton / `save-inflight` は触らない。
|
|
254
|
+
- [x] Codex に注入する memory item の role を固定する。
|
|
255
|
+
- developer message
|
|
256
|
+
- `throughline codex-resume --format item-json` は `role: developer` の message item を返す。
|
|
257
|
+
- user message への格下げはしない。
|
|
258
|
+
- app-server injected item として自動投入するかは Phase 4 の guarded inject で扱う。
|
|
259
|
+
- [x] model-visible smoke の実行 surface を追加する。
|
|
260
|
+
- [x] 実 Codex host で model-visible であることを実測する。
|
|
261
|
+
|
|
262
|
+
完了条件:
|
|
263
|
+
|
|
264
|
+
- [x] Codex primary で、現時点で保存済みの L2 memory を現在作業として読ませられる。
|
|
265
|
+
- [x] 「過去ログとして読まれる」問題を Codex primary でも再発させない。
|
|
266
|
+
|
|
267
|
+
Phase 3 implementation result (2026-05-06):
|
|
268
|
+
|
|
269
|
+
- [x] `src/codex-handoff.mjs` に `renderCodexActiveWorkContext` と `toCodexDeveloperMessageItem` を追加した。
|
|
270
|
+
- [x] `throughline codex-resume --session codex:<thread_id>` を追加した。保存済み Codex memory を Active Work Thread / Reading Contract / Continuation Instruction 付き Markdown として描画する。
|
|
271
|
+
- [x] `throughline codex-resume --format handoff` は current thread を mutate せず、新規 Codex thread に貼る短い handoff prompt を返す。handoff view は L2 件数 / 本文長 / detail refs を cap し、full active-work context は通常 text renderer に残す。
|
|
272
|
+
- [x] `throughline codex-handoff-smoke --session codex:<thread_id>` は新規 thread handoff prompt を read-only に検査し、prompt size / required sections / mutation boundary / detail command dedupe を固定する。
|
|
273
|
+
- [x] `throughline codex-handoff-model-smoke --session codex:<thread_id>` は明示 opt-in 時だけ `codex exec --ephemeral --ignore-user-config --ignore-rules --sandbox read-only` で handoff prompt の marker model smoke を行う。`--dry-run` は env なしで readiness / command boundary を監査し、`--print-prompt` で結合 prompt を出せる。`--memo-stdin` で Codex-primary current-work memo も同じ prompt に含める。structural handoff smoke が ready でなければ拒否し、current thread は mutate しない。
|
|
274
|
+
- [x] `throughline codex-handoff-start --session codex:<thread_id>` は safe continuation の guided entrypoint として、structural smoke / model smoke dry-run / handoff render / optional live smoke / `--print-prompt` を read-only にまとめて表示する。`--memo-stdin` 時は replay 用コマンドにも `--memo-stdin` を伝播し、same memo を pipe する注意を出す。
|
|
275
|
+
- [x] `throughline codex-resume --format item-json` は Codex developer message item JSON を返す。
|
|
276
|
+
- [x] `codex-resume` は explicit session を受け取れる。省略時は cwd の最新 `codex:%` session だけを対象にし、Claude session を混ぜない。
|
|
277
|
+
- [x] `src/codex-handoff.test.mjs` / `src/codex-resume.test.mjs` で renderer と CLI shape を固定した。
|
|
278
|
+
- [x] `throughline codex-visibility-smoke --session codex:<thread_id>` を追加した。`codex-resume` 相当の active-work developer message に marker 指示を加えて `thread/inject_items` へ送り、`turn/start` の agent delta に marker が出るか確認する。
|
|
279
|
+
- [x] `codex-visibility-smoke` は実 model turn を開始するため、`THROUGHLINE_EXPERIMENTAL_CODEX_MODEL_VISIBLE_SMOKE=1` がない場合は app-server を起動せず refuse する。
|
|
280
|
+
- [x] fake app-server で marker visibility と env guard をテスト固定した。
|
|
281
|
+
- [x] 実 Codex host に対する `codex-visibility-smoke` を実施した。
|
|
282
|
+
- [x] 実 host smoke result:
|
|
283
|
+
- session: `codex:019dfa40-1cc8-7d13-a110-16b09364fa6a`
|
|
284
|
+
- marker: `TL_CODEX_VISIBLE_REAL_20260506_C`
|
|
285
|
+
- result: `status = visible`, `reason = marker_found_in_agent_message`
|
|
286
|
+
- read / resumed turns: `33 / 33`
|
|
287
|
+
- observed notifications: `turn/started`, `item/started`, `item/completed`, `item/agentMessage/delta`, `turn/completed`
|
|
288
|
+
- note: initial 45s attempts exposed that app-server `turn/start` returns before the model delta; the smoke helper now waits for notification events and exposes `--request-timeout-ms` / `--timeout-ms`.
|
|
289
|
+
- [x] `codex-visibility-smoke --resume-after-inject` を追加した。これは `thread/inject_items` 後に再度 `thread/resume` してから `turn/start` を呼び、injected memory が resume 後も model-visible かを確認する。
|
|
290
|
+
- [x] 実 host post-inject resume smoke result:
|
|
291
|
+
- session: `codex:019dfa40-1cc8-7d13-a110-16b09364fa6a`
|
|
292
|
+
- marker: `TL_CODEX_RESUME_AFTER_INJECT_REAL_20260506`
|
|
293
|
+
- result: `status = visible`, `reason = marker_found_in_agent_message`
|
|
294
|
+
- read / resumed / post-inject resumed turns: `38 / 38 / 38`
|
|
295
|
+
- observed notifications included: `turn/started`, `item/agentMessage/delta`, `turn/completed`
|
|
296
|
+
- [x] 実 host smoke 後に `codex-capture` を再実行し、current Codex thread を再 capture した。
|
|
297
|
+
- captured turns: `40`
|
|
298
|
+
- captured body rows: `73`
|
|
299
|
+
- rollback events: `3`
|
|
300
|
+
- rolled-back turns excluded from active thread: `16`
|
|
301
|
+
- injected active-work developer messages counted as Codex turns: `4`
|
|
302
|
+
- [x] Codex primary の `/tl` 相当 memo 作成 surface は `--memo-stdin` に決めた。`codex-resume` は memo を developer context の `In-flight Memo` に含めるが、thread / DB は mutate しない。
|
|
303
|
+
- [x] `codex-visibility-smoke --memo-stdin` は同じ memo を実 injected memory に含めて model-visible smoke できる。
|
|
304
|
+
|
|
305
|
+
## Phase 4: Codex Rewind-Compatible Trim
|
|
306
|
+
|
|
307
|
+
目的: Codex で Claude Rewind 相当の current-thread context trim を実現する。
|
|
308
|
+
|
|
309
|
+
この Phase では、Codex app-server の `thread/rollback` / `thread/inject_items` を使い、同一 thread の conversation-visible context を削って curated memory を戻す。
|
|
310
|
+
|
|
311
|
+
TODO:
|
|
312
|
+
|
|
313
|
+
- [x] guarded execute の条件を本線仕様として再定義する。
|
|
314
|
+
- explicit thread identity
|
|
315
|
+
- rollout/app-server turn count match
|
|
316
|
+
- rollback candidate preview
|
|
317
|
+
- memory preview
|
|
318
|
+
- post-inject visibility check
|
|
319
|
+
- [x] execute env gate を外せる条件を再検討した。
|
|
320
|
+
- 2026-05-07 correction: live app-server smoke / post-inject visibility / worktree 非破壊性だけでは不十分だったため、一時的に `THROUGHLINE_EXPERIMENTAL_CODEX_TRIM_EXECUTE=1` gate を戻した。
|
|
321
|
+
- 2026-05-08 unblock: controlled rollback model-visible smoke が app-server restart 境界と VS Code reload/reconnect 境界の両方で `not-reproduced` だったため、env gate / host primitive audit gate / restore-safety-only blocker を解除した。現行 blocker は thread identity、Throughline DB injectable memory、rollout/app-server turn-count mismatch。
|
|
322
|
+
- [x] partial rollback の multi-turn harness を作る。
|
|
323
|
+
- [x] rollback marker / injected memory が live `thread/resume` 後も効くか確認する。
|
|
324
|
+
- [x] ローカルファイル変更が戻らないことを、実ファイル付き smoke で確認する。
|
|
325
|
+
- [x] model turn を開始しない execute path を維持する。
|
|
326
|
+
- [x] dry-run / preflight / execute の JSON schema を固定する。
|
|
327
|
+
- [x] read-only app-server process restart smoke を追加する。
|
|
328
|
+
- `throughline codex-restore-smoke --codex-thread-id <id>` は fresh app-server process を複数回起動し、rollout active turn count と `thread/read` / `thread/resume` / paginated `thread/turns/list` の一致を確認する。
|
|
329
|
+
- proof scope は `app_server_process_restart_only`。VS Code restart / reconnect 越しの rollback / inject durability はまだ証明しない。
|
|
330
|
+
- [x] failure mode を固定する。
|
|
331
|
+
- turn count mismatch
|
|
332
|
+
- inject visibility timeout
|
|
333
|
+
- app-server unavailable
|
|
334
|
+
- thread not found
|
|
335
|
+
- rollout missing
|
|
336
|
+
|
|
337
|
+
完了条件:
|
|
338
|
+
|
|
339
|
+
- [x] Codex で「Claude Rewind 相当」と呼べる current-thread context trim が同一 thread で動く。
|
|
340
|
+
- 2026-05-08 live run: current thread で guarded rollback + Throughline DB developer-memory inject を実行し、`execute-durable-verified` を確認した。durable success は rollout 上の新 rollback event と injected active-work memory evidence で判定する。`restoreSafety.status = risk` は compacted history retention の diagnostic であり、単独 blocker ではない。
|
|
341
|
+
- [x] 誤 thread を trim しない guard が test で固定されている。
|
|
342
|
+
- [x] inject 済み memory が次の model turn で使えることを実測済み。
|
|
343
|
+
|
|
344
|
+
Phase 4 implementation status (2026-05-07):
|
|
345
|
+
|
|
346
|
+
- [x] `throughline trim --preflight --host codex --codex-thread-id <id>` は `thread/read` / `thread/resume` まで実行し、rollback / inject は送らない。
|
|
347
|
+
- [x] historical: `throughline trim --execute --host codex --codex-thread-id <id>` は guarded execute を行う実装だった。2026-05-07 correction では env gate と host primitive audit gate を戻して一時 blocked にした。2026-05-08 unblock では controlled rollback model-visible smoke が再現しなかったため、env gate / host primitive audit gate / restore-safety-only blocker を外し、DB memory と rollout/app-server turn-count guard を残した。
|
|
348
|
+
- [x] rollout source を使う場合、rollback 前に rollout active turn count と app-server `thread/read` / `thread/resume` turn count を照合する。不一致なら rollback / inject を送らず refuse する。
|
|
349
|
+
- [x] guarded execute は `thread/rollback` -> `thread/inject_items` -> post-inject `thread/read` polling の順に進む。`turn/start` は呼ばない。
|
|
350
|
+
- [x] fake app-server harness で partial rollback、delayed inject visibility、mismatch refusal、mutation not sent preflight を固定した。
|
|
351
|
+
- [x] `thread/resume` 後に injected memory が維持されることを、実 Codex host smoke として確認済み。
|
|
352
|
+
- [x] 実 Codex host での next model turn visibility smoke は Phase 3 の `codex-visibility-smoke` で確認済み。active-work developer message が次の model turn の agent delta に反映された。
|
|
353
|
+
- [x] 実 Codex host で `trim --preflight --host codex --codex-thread-id 019dfa40-1cc8-7d13-a110-16b09364fa6a --json` を実行し、guard が mutation 前に read / resume count を照合することを確認した。
|
|
354
|
+
- latest rollout active turns: `41`
|
|
355
|
+
- latest app-server read / resumed turns: `41 / 41`
|
|
356
|
+
- result: `preflight-ready`, `reason = rollback_not_sent`
|
|
357
|
+
- rollback preview: `numTurns = 1`
|
|
358
|
+
- 判断: `thread/rollback` / `thread/inject_items` は preflight では送らない。
|
|
359
|
+
- [x] 旧 mismatch の原因を調査して解消した。
|
|
360
|
+
- app-server は `thread/inject_items` で入れた `## Throughline: Active Work Context` を standalone turn ではなく `contextCompaction` item として扱う。
|
|
361
|
+
- app-server は legacy `## Throughline Trim Memory Preview` response item を rollback 対象 turn としては数えない。
|
|
362
|
+
- app-server は `task_complete` 後の assistant continuation を `rollout-*` synthetic turn として扱う。
|
|
363
|
+
- rollout parser はこの実測に合わせ、Throughline injected developer memory を turn count へ入れず、assistant continuation を synthetic turn として数える。
|
|
364
|
+
- [x] 実 Codex host で guarded execute を再実施した。2026-05-07 correction 時点では live app-server smoke であり、restart-safe durability の証明ではなかった。
|
|
365
|
+
- historical execute output: `status = executed`, `rollbackSent = true`, `injectSent = true`, `rollbackRequestedTurns = 1`
|
|
366
|
+
- pre-execute guard: rollout / app-server turns `41 / 41`, `status = match`
|
|
367
|
+
- post-inject read: `afterTurns = 40`
|
|
368
|
+
- note: current Codex app-server では injected memory は即時 turn count としては見えない場合がある。2026-05-08 の修正後は、`thread/inject_items` が turn list を返さない developer item-level injection では rollback 後 turn count のまま `postInjectVisibilityCheck.status = match` とし、rollout 上の新 rollback event と injected active-work memory evidence で `execute-durable-verified` と判定する。
|
|
369
|
+
- [x] 実ファイル変更を伴う smoke で、context rollback が worktree を戻さないことを再確認した。2026-05-07 correction: これは worktree 非破壊性の確認であり、restart-safe durability の証明ではない。
|
|
370
|
+
- temporary file: `THROUGHLINE_CODEX_ROLLBACK_SMOKE.tmp`
|
|
371
|
+
- pre-execute hash: `a38b82d91eb5dd83cd116c2ede362b66001612c06f97e84de104074979756f03`
|
|
372
|
+
- post-execute hash: `a38b82d91eb5dd83cd116c2ede362b66001612c06f97e84de104074979756f03`
|
|
373
|
+
- historical execute output: `status = executed`, `rollbackSent = true`, `injectSent = true`, `rollbackRequestedTurns = 1`
|
|
374
|
+
- post-execute preflight: rollout / app-server turns `37 / 37`, `status = preflight-ready`
|
|
375
|
+
- note: rollback 後、同一 Codex turn 内で続いた assistant messages は app-server では `rollout-*` synthetic turn として見える。rollout parser も「最新 rollback 後、次の `task_started` がまだ無い assistant continuation」だけ synthetic turn として数える。
|
|
376
|
+
- [x] 実 resume-after-inject smoke 後の preflight で、rollout / app-server turn count が `40 / 40` に戻ることを確認した。
|
|
377
|
+
- note: `task_complete` 後に続く末尾 pending messages も app-server では現在 turn として見えるため、rollout parser は EOF の pending messages を synthetic turn として数える。
|
|
378
|
+
- [x] Codex app-server protocol / local store を調査した。
|
|
379
|
+
- `codex app-server --help` と generated schema / TypeScript では、`thread/rollback`、`thread/inject_items`、`thread/read`、`thread/resume`、`thread/compact/start` は確認できたが、compacted replacement history を直接更新する documented durable rollback primitive は見つからなかった。
|
|
380
|
+
- `throughline codex-host-primitive-audit --json` を追加し、installed schema の method set を機械監査できるようにした。実環境では `methodCount = 89`、`thread/resume(history)` は `[UNSTABLE] FOR CODEX CLOUD - DO NOT USE` かつ `thread_id` ignored のため不採用、current-thread history rewrite / compacted-history clear candidate は `0`。
|
|
381
|
+
- `~/.codex/state_5.sqlite` の `threads` table は rollout path / metadata を持つが、turn bodies は持たない。turn body の主根拠は rollout JSONL 側である可能性が高い。ただし VS Code extension の restore source は未確定。
|
|
382
|
+
- [x] `throughline codex-restore-smoke` を追加した。
|
|
383
|
+
- `THROUGHLINE_EXPERIMENTAL_CODEX_RESTORE_SMOKE=1` が無い場合は app-server を起動せず refuse する。
|
|
384
|
+
- rollout source が無い場合、または restore-safety risk がある場合も app-server 起動前に refuse する。
|
|
385
|
+
- count-only stable result は `status = app-server-restart-stable` / `proofScope = app_server_process_restart_only` / `restartSafe = false`。
|
|
386
|
+
- 2026-05-07 historical count-only 実測: project thread `019dfddb-8288-7392-a461-bf3ebc5da409` で read-only smoke を実行し、2 cycles とも rollout / read / resume turns `14 / 14 / 14` で stable。これは app-server process restart の部分証明であり、VS Code restart-safe 証明ではない。
|
|
387
|
+
- 2026-05-07 追加: 同 smoke は `thread/turns/list` も paginated に確認するよう拡張した。`thread/read` / `thread/resume` と `thread/turns/list` のどれかが rollout active turn count と不一致なら mismatch とする。2026-05-08 の risky response inspection では、turn count 安定だけでは成功扱いせず、retained rollback text を blocking candidate と quoted/tool-output field に分類する。
|
|
388
|
+
- [x] `throughline codex-restore-source-audit` を追加した。
|
|
389
|
+
- Codex rollout、`session_index.jsonl`、`state_*.sqlite`、VS Code globalStorage / workspaceStorage 候補、installed OpenAI/Codex VS Code extension bundle を read-only で棚卸しする。
|
|
390
|
+
- 実 project thread `019dfddb-8288-7392-a461-bf3ebc5da409` では rollout と session index と `state_5.sqlite` の `threads` metadata row が見つかった。`agent_job_items` / `stage1_outputs` は content 系 table 候補だが、この thread id に紐づく row は 0。VS Code globalStorage / workspaceStorage audit は 45 files scanned / 0 matches だった。
|
|
391
|
+
- proof scope は `local_restore_source_inventory_only`。VS Code extension restart の実 restore path を直接実行するものではない。
|
|
392
|
+
- [x] installed VS Code extension の static audit を実施した。
|
|
393
|
+
- `code --status` で Code `1.118.1`、WSL Remote、`openai.chatgpt` extension が確認できた。
|
|
394
|
+
- `openai.chatgpt-26.429.30905-linux-x64` の minified webview / extension bundle には `thread/read`、`thread/resume`、`thread/turns/list`、`thread/compact/start`、`markAllConversationsNeedResumeAfterReconnect` が見える。reconnect 時は in-memory conversation を `needs_resume` に戻し、app-server resume/read 系へ寄せる仮説が強い。
|
|
395
|
+
- 同 bundle には webview `localStorage` の `codex:persisted-atom:` prefix も見える。これは UI atom persistence であり、rollback 済み user turn の durable restore source かは未確定。
|
|
396
|
+
- `code --status` は read-only で使えるが、`workbench.action.reloadWindow` をこの非対話 Codex session から実行して proof とするのは危険。Caveat のとおり parent-pid watch に依存せず、VS Code extension restart / reconnect smoke は明示 phase boundary として設計する。
|
|
397
|
+
- 2026-05-07 追加実装後の `codex-restore-source-audit` 実測では、extension scan は 942 files / 6 matches / truncated false。`openai.chatgpt-26.429.30905-linux-x64` から `thread/read`、`thread/resume`、`thread/turns/list`、`thread/compact/start`、`thread/rollback`、`markAllConversationsNeedResumeAfterReconnect`、`needs_resume`、`codex:persisted-atom:`、`chatgpt.followUpQueueMode`、`send-follow-up-message`、`steeringUserMessage` を検出し、`replacement_history` は未検出。VS Code storage は 45 files scanned / 0 matches のまま。VS Code settings は searched だが `chatgpt.followUpQueueMode` は not-configured、extension package default は `queue`。conclusion は `vscode_extension_reconnect_appears_to_resume_threads_via_app_server`。
|
|
398
|
+
- 2026-05-08 追加実装後の VS Code log audit は thread-id raw match だけでなく、retained rollback text、patch apply failure、thread stream broadcast、`replacement_history` signal に分類する。実 current thread では logs 1185 files scanned / thread id matches `40` / retained rollback text matches `0` / patch apply failures `39` / patch failure window `2026-05-07 00:35:35.339 -> 2026-05-07 00:36:29.925` / thread stream signals `164` / `replacement_history` signals `0`。patch failure は `Failed to apply patches for conversationId=<thread-id>` の thread-specific signal で、retained rollback text が logs に残っている証拠ではない。
|
|
399
|
+
- [x] `throughline codex-vscode-restore-smoke` を追加した。
|
|
400
|
+
- `--prepare` は hidden active-work marker memory を app-server に inject し、VS Code reload / reconnect 後に送る marker-free prompt と verify command を出す。mutation のため `THROUGHLINE_EXPERIMENTAL_CODEX_VSCODE_RESTORE_SMOKE=1` 必須。
|
|
401
|
+
- `--verify` は rollout を read-only で読み、prepare 後の marker-free smoke prompt、assistant の marker-only answer、user prompt への marker leak 不在を確認する。
|
|
402
|
+
- `restartSafe: true` は `--after-vscode-restart` 明示と marker proof がそろう場合だけ。
|
|
403
|
+
- 実 project thread `019dfddb-8288-7392-a461-bf3ebc5da409` で marker
|
|
404
|
+
`TL_CODEX_VSCODE_RESTORE_46888202` を注入し、VS Code reload / reconnect 後に
|
|
405
|
+
marker-free smoke prompt を送った。`--verify --after-vscode-restart` は
|
|
406
|
+
`status = vscode-restart-visible` / `restartSafe = true`、`userMarkerMatches = []`。
|
|
407
|
+
- verifier は false positive 防止のため、assistant の marker mention だけではなく
|
|
408
|
+
marker-free prompt と marker-only answer の組を要求する。
|
|
409
|
+
|
|
410
|
+
## Phase 5: Codex UX
|
|
411
|
+
|
|
412
|
+
目的: Codex primary ユーザーが Throughline を普通に使える入口を作る。
|
|
413
|
+
|
|
414
|
+
TODO:
|
|
415
|
+
|
|
416
|
+
- [x] Codex 用 command surface の先行 slice を決める。
|
|
417
|
+
- `throughline codex-capture`
|
|
418
|
+
- `throughline codex-resume`
|
|
419
|
+
- [x] Codex trim / setup まで含む command surface を決める。
|
|
420
|
+
- `throughline trim --host codex`
|
|
421
|
+
- `throughline trim --preflight --host codex --codex-thread-id <id>`
|
|
422
|
+
- `throughline trim --execute --host codex --codex-thread-id <id>` (DB memory と rollout/app-server turn-count guard がそろう場合に current-thread rollback / inject を実行)
|
|
423
|
+
- `doctor --codex` / `codex-capture` / `codex-summarize` / `codex-resume --memo-stdin` / `codex-visibility-smoke`
|
|
424
|
+
- [x] Codex primary の doctor を追加または拡張する。
|
|
425
|
+
- [x] Codex primary の setup / install 手順を追加する。
|
|
426
|
+
- global `throughline install` は `~/.codex/hooks.json` に絶対 node + installed `bin/throughline.mjs codex-hook stop` を登録し、`~/.codex/config.toml` の `[features].codex_hooks = true` を有効化し、`~/.codex/skills/throughline` に `$throughline` skill を配置する。
|
|
427
|
+
- 既存 Caveat / Spotter などの Codex hooks は保持し、`throughline uninstall` は Throughline 管理 hook だけを削除する。
|
|
428
|
+
- manual diagnostics / explicit operation: `doctor --codex` -> `codex-capture` -> `codex-summarize` -> `codex-resume --memo-stdin` -> 必要なら model-visible smoke / trim preflight / explicit trim execute。
|
|
429
|
+
- [x] README には実装済み behavior だけ載せる。
|
|
430
|
+
- [x] Codex primary の smoke 手順を docs に固定する。
|
|
431
|
+
|
|
432
|
+
完了条件:
|
|
433
|
+
|
|
434
|
+
- [x] Codex だけを使うセッションで、capture -> summarize -> resume -> trim が通る。
|
|
435
|
+
- [x] Claude 設定なしでも Codex primary path の診断ができる。
|
|
436
|
+
|
|
437
|
+
Phase 5 implementation status (2026-05-06):
|
|
438
|
+
|
|
439
|
+
- [x] `throughline doctor --codex` を追加した。Codex thread env identity、cwd の 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 を表示する。
|
|
440
|
+
- [x] `doctor --codex` は Claude settings を変更しない。Codex primary entrypoint の診断に限定する。
|
|
441
|
+
- [x] 実セッションで `doctor --codex` -> `codex-capture` -> `codex-resume --format item-json` -> `doctor --codex` の local smoke を実施した。`codex-resume` は developer message item JSON を描画し、再診断で captured DB session が 1 件として表示された。
|
|
442
|
+
- [x] 実セッションで `codex-visibility-smoke` を実施した。`THROUGHLINE_EXPERIMENTAL_CODEX_MODEL_VISIBLE_SMOKE=1` を必須にし、長い model turn に備えて `--request-timeout-ms 150000` / `--timeout-ms 180000` を使えるようにした。
|
|
443
|
+
- [x] Codex primary の setup / install 手順は README に記録した。global install は Codex Stop hook と `$throughline` skill を自動登録する。2026-05-08 以降、skill は diagnostics / dry-run / preflight を既定の確認 flow とし、ユーザーが current-thread trim を明示した場合は `trim --execute --host codex --all` を案内する。
|
|
444
|
+
- [x] `codex-summarize` を明示診断・運用 flow に追加した。Codex CLI backend を使い、Claude Haiku へ fallback しない。
|
|
445
|
+
- [x] Codex primary の summarize / guarded execute まで含む end-to-end smoke を実施した。2026-05-07 correction では guarded execute を live app-server smoke としてのみ扱った。2026-05-08 unblock 後は、controlled rollback model-visible smoke の `not-reproduced` と current-thread live run の `execute-durable-verified` を合わせて、Codex current-thread trim 完了条件に含める。
|
|
446
|
+
- `codex-capture`: `capturedTurns = 41`, `capturedRows = 75`, `capturedDetails = 2424`
|
|
447
|
+
- `codex-summarize`: `status = summarized`, `source = codex-cli`
|
|
448
|
+
- `codex-resume --format item-json`: L1 summary と active L2 context を developer message item として描画
|
|
449
|
+
- `trim --preflight --host codex`: rollout / app-server turns `41 / 41`
|
|
450
|
+
- historical `trim --execute --host codex`: `status = executed`, `rollbackSent = true`, `injectSent = true`
|
|
451
|
+
- [x] global install 後の実環境で Codex 設定を確認した。
|
|
452
|
+
- `~/.codex/hooks.json` の Stop 先頭に Throughline Codex Stop hook が入り、Caveat / Spotter hooks は保持されていた。
|
|
453
|
+
- `~/.codex/config.toml` は `[features].codex_hooks = true`。
|
|
454
|
+
- API 経由のこの Codex turn では自然 Stop hook 発火は未確認だったため、同じ payload shape を手動再現して `codex:019dfd15-db7b-7521-9f66-050268bef1c8` capture と `codex-resume --format item-json` 描画まで確認した。
|
|
455
|
+
- 追加実測: assistant final 後に rollout は `task_complete` まで進んだが、latest DB session は `codex:019dfd15-db7b-7521-9f66-050268bef1c8` のままで、current thread `019dfd38-c530-71c3-b7b8-180bdd3054bc` の自然 capture は発生しなかった。同じ payload shape の手動再現では capture できたため、Throughline の payload parser / DB writer は成立している。ただし Caveat project (`/home/kite/projects/Caveat`) では Codex Stop hook が動く実測があるため、これは Codex Stop hook 全体の不発とは一般化せず、Throughline DB capture が自然に進んだかを `doctor --codex` で確認する運用上の制約として扱う。
|
|
456
|
+
- 修正: Caveat の Codex Stop hook は `async: false` で登録され、nested `codex exec` smoke で Stop -> 次 turn 注入まで確認済みだった。Throughline は Claude Stop と同じ発想で Codex Stop も `async: true` にしていたため、Codex 側だけ Caveat と同じ同期 hook に寄せた。既に `async: true` で登録済みの Throughline Codex Stop hook も次回 `throughline install` で `async: false` に更新される。
|
|
457
|
+
- 再実測: `npm install -g .` -> `throughline install` 後、`~/.codex/hooks.json` の Throughline Codex Stop は `async: false` になり、Caveat / Spotter hooks は保持された。`codex exec --json -C /home/kite/projects/Throughline "Reply exactly: TL_CODEX_SYNC_STOP_SMOKE_20260506"` で child thread `019dfd4f-93ff-7522-8f89-bd1e1996c8d7` が作られ、直後の `throughline doctor --codex` で latest DB session が `codex:019dfd4f-93ff-7522-8f89-bd1e1996c8d7` に進んだ。Codex Stop hook の自然 capture は同期登録で確認済み。
|
|
458
|
+
- 追加修正: Caveat の Codex hook は bare `caveat` ではなく絶対 node + installed CLI script path で登録されていた。Throughline も Codex App Server / VSCode host の PATH 差分を避けるため、旧 bare `throughline codex-hook stop` を次回 install で絶対 node + `bin/throughline.mjs codex-hook stop` に置換する。`doctor --codex` は Codex hook feature / Throughline Stop hook command / legacy bare command を診断表示する。
|
|
459
|
+
- 絶対パス型の再実測: `npm install -g .` -> `throughline install` 後、`~/.codex/hooks.json` の Stop 先頭は `/usr/bin/node /home/kite/projects/Throughline/bin/throughline.mjs codex-hook stop`、`async: false`、`timeoutSec: 300` になり、Caveat / Spotter hooks は 2 番目以降に保持された。`doctor --codex` は `Codex hooks feature: enabled` / `Codex Stop hook: registered` を表示した。`codex exec --json -C /home/kite/projects/Throughline "Reply exactly: TL_CODEX_ABSOLUTE_STOP_SMOKE_20260506"` で child thread `019dfd5e-1248-7c11-8ddc-97e1b0701e10` が作られ、直後の `throughline doctor --codex` で latest DB session が `codex:019dfd5e-1248-7c11-8ddc-97e1b0701e10` に進んだ。
|
|
460
|
+
- 追加確認: current VSCode-origin parent thread `019dfd38-c530-71c3-b7b8-180bdd3054bc` は hook shape 変更前に開始していたため、変更後の自然 Stop smoke としては不適格。assistant final 後に rollout は `task_complete` まで進んだが latest DB session は exec child のままだった。次に VSCode-origin を見る場合は、hook shape 変更後に新しく開始した Codex session で確認する。
|
|
461
|
+
- 最終確認: hook shape 変更後に新しく開始した VSCode-origin Codex session で 1 turn 完了後、`throughline doctor --codex` を実行した。`current Codex thread` は `019dfd62-9a9d-7211-bf91-89d8e3fc908e`、`latest DB session` は `codex:019dfd62-9a9d-7211-bf91-89d8e3fc908e` で一致し、`Codex hooks feature: enabled`、`Codex Stop hook: registered`、command は `/usr/bin/node /home/kite/projects/Throughline/bin/throughline.mjs codex-hook stop`、`async: false`、`timeoutSec: 300` だった。VSCode-origin の自然 Stop hook による DB capture も解決済みとして扱う。
|
|
462
|
+
- 2026-05-07 correction: 以下の Codex trim smoke は live app-server primitive の履歴として残す。ただし 2026-05-06 incident 後、restart / reconnect 越しの durable context trim 成功とは扱わない。現在の正は [THROUGHLINE_CODEX_TRIM_ROLLBACK_FIX_PLAN.md](THROUGHLINE_CODEX_TRIM_ROLLBACK_FIX_PLAN.md) であり、`$throughline` / Codex Stop hook は mutation を自動実行しない。
|
|
463
|
+
- UX 修正: 手動 trim の長い `throughline trim --execute --host codex --codex-thread-id <id>` をユーザーに直接打たせるのではなく、global install で `$throughline` Codex skill を配置する。ただし 2026-05-06 incident 後、skill の既定動作は `doctor --codex`、`trim --dry-run --all`、`trim --preflight --all` までに制限する。bare `$throughline` は rollback + curated memory inject を実行する context refresh ではなく、安全な現状確認として扱う。
|
|
464
|
+
- memory contract 修正: Codex guarded trim でも注入 memory は元の `/tl` 思想を正とする。古い turn は L1 summaries、直近 20 turn は L2 full bodies、L3 は reference only で、L3 bodies / tool payloads は注入しない。rollout source は rollback candidate / app-server turn count guard の根拠であり、Throughline DB memory がある場合に rollout active work preview を注入 memory として使わない。DB memory が無い execute は rollout preview を注入せず、mutation 前に拒否する。
|
|
465
|
+
- doctor visibility 修正: `doctor --codex` は旧 context refresh readiness として rollback source、inject memory source、memory contract、L1 summaries / recent L2 bodies / L3 references-only count、heuristic reduction estimate を表示していた。実 thread `019dfd62-9a9d-7211-bf91-89d8e3fc908e` では live readiness として `context refresh: ready`、`rollback source: codex-rollout`、`inject memory source: throughline-db`、`memory contract: older L1 + latest 20 L2 full bodies + L3 references only` を確認した。ただし incident 後は restart-safe readiness ではない。
|
|
466
|
+
- 削減量の記録: `trim --dry-run --host codex` は rollout text がある場合に `contextReductionEstimate` を返す。2026-05-06 の現在 thread `019dfd62-9a9d-7211-bf91-89d8e3fc908e` では通常 keep-recent preview だと `capturedTurns = 14` / `keepRecent = 20` のため `rollbackTurns = 0`、推定削減量も 0 だった。旧 bare `$throughline` context refresh は `--all` を使っていたため、この keep-recent preview の 0 は「Codex で削減できない」という意味ではない。
|
|
467
|
+
- historical live-only `$throughline` context refresh smoke: 同じ VSCode-origin thread `019dfd62-9a9d-7211-bf91-89d8e3fc908e` で `trim --dry-run --host codex --all --json` -> `trim --preflight --host codex --all --json` -> `trim --execute --host codex --all` を実行した。preflight は rollout/app-server turn count `20 / 20` match、execute は `rollbackSent = true`、`injectSent = true`、`injectedItems = 1`、`rollback candidate turns = 20`。直前見積もりは `rollbackEstimatedTokens = 179780`、`injectedMemoryEstimatedTokens = 2009`、`netEstimatedTokens = 177771`、`reductionPct = 99` (`chars / 4` heuristic)。これは live app-server smoke であり、restart-safe durability の証明ではない。
|
|
468
|
+
- post-refresh confirmation: execute 後の次 user turn で `doctor --codex` は current thread と latest DB session の一致を維持し、latest DB session は `2026-05-06 22:41:10` へ更新された。`trim --dry-run --host codex --all --json` は `activeTurns = 2`、`rollbackEvents = 1`、`rolledBackTurns = 20` を返し、`codex-resume` は rollback 後の短い active work context を L2 として描画した。
|
|
469
|
+
- monitor adapter 修正: `throughline monitor` は Claude / Codex host-aware state を読む。Codex Stop hook は `codex:<thread_id>` monitor state を書き、Codex rollout path は Claude transcript 用 `transcriptPath` ではなく `rolloutPath` に保存する。rollout に `event_msg` / `token_count` がある場合は verified usage として表示し、無い場合だけ `estimated: true` / `source = codex-rollout-chars-div-4` の明示 estimate を使う。state filename は URL encode し、`codex:` session id を Windows でも保存可能にした。
|
|
470
|
+
- monitor doctor 修正: Codex Stop hook stdout は VSCode chat に必ず見えるとは限らないため、`doctor --codex` に `.vscode/tasks.json` の Throughline Monitor task 診断を追加した。登録済み / 未登録 / JSONC / parse error / broken absolute path と `runOn`、および初回作成後は `Developer: Reload Window` が必要という note を read-only で表示する。
|
|
471
|
+
- historical automatic refresh 実装: Codex Stop hook は capture / L1 summarize / monitor state 書き込み後、verified usage が verified context window の `90%` 以上なら automatic refresh を試行する経路を持っていた。2026-05-06 incident 後、この経路は blocker として扱い、monitor state / warning / diagnostics は残しても rollback + inject は送らない。
|
|
472
|
+
|
|
473
|
+
## Phase 6: Claude Side Finalization
|
|
474
|
+
|
|
475
|
+
目的: Codex 側の互換機能が固まったあと、Claude 側の Rewind / trim を最後に詰める。
|
|
476
|
+
|
|
477
|
+
TODO:
|
|
478
|
+
|
|
479
|
+
- [ ] Claude `/rewind conversation only` の手動 UX を確認する。
|
|
480
|
+
- [ ] Claude Code CLI / VSCode extension で挙動差があるか確認する。
|
|
481
|
+
- [x] 外部ツールから自動化できる surface があるか確認する。
|
|
482
|
+
- local evidence: `claude --help` on Claude Code `2.1.128` exposes `--resume` / `--continue` / session flags, but no non-interactive rewind command or rollback flag.
|
|
483
|
+
- public docs evidence: Anthropic Claude Code slash command docs list `/clear` and `/compact`, but do not list `/rewind` as a documented built-in slash command.
|
|
484
|
+
- conclusion: Throughline must not claim automatic Claude rewind unless a future Claude CLI / API surface is found and verified.
|
|
485
|
+
- [x] 自動化できない場合、Throughline がどこまで UX を持つか決める。
|
|
486
|
+
- decision: Claude primary remains manual-only for conversation rewind.
|
|
487
|
+
- Throughline provides `/tl-trim` dry-run, current-work memory preview, and explicit instructions. It does not try to drive the interactive `/rewind` UI.
|
|
488
|
+
- No `/tl restore` mutation surface is added until Claude exposes a verified conversation-only rewind primitive.
|
|
489
|
+
- [x] Claude trim で L2 / L1 を current work として再注入する最終 contract を決める。
|
|
490
|
+
- contract: reuse the same Reading Contract / Active Work Thread / Continuation Instruction framing as Codex, but render it as a manual preview for Claude after the user performs conversation-only rewind.
|
|
491
|
+
- in-flight memo remains first-class and comes from the main Claude agent via `/tl` / `save-inflight`; it is not generated by a sidecar.
|
|
492
|
+
- [x] Claude 側の docs / README / doctor を更新する。
|
|
493
|
+
- README に Claude primary は manual-only であり、Throughline は rewind UI を自動操作しないことを明記した。
|
|
494
|
+
- `doctor --trim --host claude` は manual procedure を表示する既存 surface を維持する。
|
|
495
|
+
|
|
496
|
+
完了条件:
|
|
497
|
+
|
|
498
|
+
- [x] Claude 側でできること / できないことが明確に documented されている。
|
|
499
|
+
- [x] Codex 側で完成した互換機能との差分が明示されている。
|
|
500
|
+
- [x] Claude primary の既存 `/tl` baton handoff は壊れていない。
|
|
501
|
+
- verification: `npm test` で baton / SessionStart / hook entrypoint coverage を含む 355 tests pass。
|
|
502
|
+
|
|
503
|
+
## Open Questions
|
|
504
|
+
|
|
505
|
+
- [x] Codex primary の session id は Codex `thread_id` をそのまま使うか、Throughline 独自 session を別に作るか。
|
|
506
|
+
- 判断: 裸の `thread_id` は使わず、Throughline DB では `codex:<thread_id>` を `session_id` / `origin_session_id` に使う。
|
|
507
|
+
- [x] Codex CLI L2 -> L1 backend は `codex` を直接 spawn するか、Throughline 内に thin wrapper module を置くか。
|
|
508
|
+
- 判断: `src/haiku-summarizer.mjs` 内に thin wrapper を置き、Codex primary では `codex exec --ephemeral --ignore-user-config --ignore-rules --skip-git-repo-check --sandbox read-only -C <project>` を呼ぶ。`codex-cli 0.128.0-alpha.1` の `codex exec` には `--ask-for-approval` が無いため使わない。
|
|
509
|
+
- [x] Codex primary で L2 -> L1 backend が失敗した場合の扱い。
|
|
510
|
+
- 判断: Codex primary は Codex CLI backend 失敗を明示 error にする。Claude primary の既存互換経路だけ fallback reason/source 付きで維持する。
|
|
511
|
+
- [x] Codex Rewind-compatible trim を本線化するとき、experimental env を外す条件は何か。
|
|
512
|
+
- [x] Claude 側は automatic rewind を目指すのか、manual-only を正式仕様にするのか。
|
|
513
|
+
- 判断: 現時点は manual-only を正式仕様にする。将来、Claude Code が documented / scriptable な conversation-only rewind primitive を公開した場合だけ automatic 化を再検討する。
|
|
514
|
+
|
|
515
|
+
## 次の作業
|
|
516
|
+
|
|
517
|
+
Codex primary の capture / summarize / resume は完了扱い。Codex trim execute / auto-refresh も 2026-05-08 の controlled rollback model-visible smoke 後に再有効化済み。[THROUGHLINE_CODEX_TRIM_ROLLBACK_FIX_PLAN.md](THROUGHLINE_CODEX_TRIM_ROLLBACK_FIX_PLAN.md) の Phase 0-4、read-only app-server process restart smoke、local restore source audit、host primitive audit、manual VS Code restore smoke protocol、実 VS Code reload / reconnect marker proof、rollback 非復活 verifier、controlled rollback model-visible smoke surface は実装済み。incident-shaped live rollback run は `restoreSafety.status = risk` で、`compacted.replacement_history` retention と rollback 済み text match を診断上は観測した。後続の app-server response 分類では retained text が `aggregatedOutput` の引用に限定され、direct user message / model-visible reproduction とは分けて扱う。host primitive audit でも current-thread rollback non-resurrection primitive は見つかっていないが、これは diagnostic-only で、DB memory と rollout/app-server turn-count guard がそろう `trim --execute` を塞がない。
|
|
518
|
+
|
|
519
|
+
再開時は次を実施する:
|
|
520
|
+
|
|
521
|
+
1. Codex trim execute / Stop hook auto-refresh の実運用 telemetry を見て、`execute-sent-live-only` / `execute-unverified` / `execute-durable-verified` の分類が期待どおりか確認する。
|
|
522
|
+
2. VS Code restore path の追加実測を行い、`compacted.replacement_history` が rollback 済み user text の復元元として残る経路をさらに特定する。
|
|
523
|
+
3. restore-safety / host primitive audit を blocker として再導入する場合は、controlled smoke で再現した具体的 evidence を先に記録する。
|
|
524
|
+
4. その後に Claude `/rewind conversation only` の手動 UX 確認へ戻る。
|
|
525
|
+
|
|
526
|
+
## Audit Notes
|
|
527
|
+
|
|
528
|
+
2026-05-08 監査結果:
|
|
529
|
+
|
|
530
|
+
- [x] `restartSafe` / `restore_safety` / `safeContinuation` / `current-thread compacted-history` / `trim --execute` / `auto-refresh` まわりの README / CLAUDE.md / Codex roadmap / rollback fix plan を再スキャンし、restart-safe evidence がない automatic mutation を安全扱いしている記述が残っていないことを確認した。
|
|
531
|
+
- [x] 同じ文書内で「Codex rollback trim は explicit refusal として固定済み」と「これから product decision を固める」が並ぶ古い引き継ぎ文を修正した。2026-05-08 unblock 後の現行の次手は、実運用結果分類と VS Code restore path の追加実測を続けること。
|
|
532
|
+
- [x] CLI help に載せた Codex subcommand が `bin/throughline.mjs` の dispatch から漏れたら落ちるテストを追加した。
|
|
533
|
+
- [x] Historical audit: current thread `019dfddb-8288-7392-a461-bf3ebc5da409` を read-only 再監査した。当時の `doctor --codex` は context refresh `blocked` / `restore_safety_risk`、new-thread handoff `ready`、host primitive audit `no_current_thread_restore_non_resurrection_primitive`。`trim --preflight --host codex --all` は `restore_safety_risk` で拒否。2026-05-08 unblock 後、この restore-safety risk と host primitive audit は diagnostic-only に変更済み。
|
|
534
|
+
- [x] `codex-restore-source-audit` に VS Code extension signal の bounded `sourceSnippets` と機械判定用 `sourceFacts` を追加した。実 bundle の snippet では `thread/resume` が `history:null` と `path:c?.rolloutPath??null` を渡す近傍、reconnect handler が `markAllConversationsNeedResumeAfterReconnect()` を呼ぶ近傍、follow-up queue default が `queue` である近傍を JSON で監査できる。`sourceFacts.reconnectResumeViaAppServerRolloutPath = true` も出る。これは static source evidence であり、restart-safe proof ではない。
|
|
535
|
+
- [x] `codex-restore-smoke --inspect-risky-rollout` を追加し、risky rollout でも明示 flag 時だけ read-only app-server response を監査できるようにした。実 current thread では `thread/read` / `thread/resume` / `thread/turns/list` の全 response に retained rollback text が見えた。これは app-server process restart count が stable でも、response payload 側には rollback 済み text が残る risk evidence である。risk inspection は exit 1 のまま。
|
|
536
|
+
- [x] `codex-restore-smoke` は restore text が app-server response に残る場合、count stability を成功風に扱わず retained text location を報告する。初期実装では `status = app-server-restore-text-retained` / `reason = restore_text_seen_in_app_server_response` としていたが、後続分類で direct turn text / `replacement_history` と quoted/tool-output field を分けるようにした。
|
|
537
|
+
- [x] `codex-vscode-rollback-smoke` の text output に `rollbackTextRetainedInCompacted` / `resurrectedUserMessages` / risk type summary を追加した。実 current thread の read-only verify は `restore_safety_risk`、retained `20`、resurrected は live snapshot で増え得る。2026-05-08 の再確認時点では user messages after rollback `37`、resurrected `16`、risk types `rollback_text_retained_in_compacted_replacement_history:20` / `rolled_back_user_text_reappeared_after_rollback:3`。
|
|
538
|
+
- [x] `codex-restore-source-audit` の VS Code storage audit に SQLite-backed storage inventory を追加した。`.vscdb` / `.sqlite` / `.sqlite3` / `.db` 候補を read-only で開き、table / searchable column / needle match summary を返す。実 current thread の再確認では default VS Code storage roots は 45 files scanned、direct matches `0`、SQLite DB candidates `0`、SQLite matches `0`。このため current environment では VS Code storage 側に retained rollback text を持つ local persisted restore source は見つかっていない。
|
|
539
|
+
- [x] `codex-restore-smoke --inspect-risky-rollout` を再実行した。2026-05-08 の中間確認では `expectedTurns = 16` / read-resume-list `16 / 16 / 16` で count は一致し、retained rollback text 7 件が全 response source に残っていた。後続分類ではこれらは `aggregatedOutput` に限定され、`app-server-restore-text-quoted` / `blocking-candidates=no` へ分離された。
|
|
540
|
+
- [x] `codex-restore-source-audit` の VS Code log audit に structured signal と patch failure timestamp window を追加した。実 current thread の再確認では VS Code logs は 1185 files scanned、raw log match files `2`、thread id matches `40`、retained rollback text matches `0`、patch apply failures `39`、patch failure window `2026-05-07 00:35:35.339 -> 2026-05-07 00:36:29.925`、thread stream signals `164`、`replacement_history` signals `0`。つまり logs には thread-specific patch failure は強く出ているが、retained rollback text の local log persistence は見つかっていない。
|
|
541
|
+
- [x] `codex-restore-source-audit` の VS Code extension source facts に thread-stream patch path を追加した。実 bundle では owner が `thread-stream-state-changed` patches を broadcast し、follower が `handleThreadStreamStateChanged` 内で patches を会話 state に適用し、失敗時に `Failed to apply patches for` を log する経路が見える。実 current thread では `threadStreamPatchApplyPathPresent = true` かつ log patch failures `39` なので `vscodeThreadStreamPatchFailureSignal = true`。同一 thread repair の次の調査対象は VS Code reconnect / follower patch apply path。
|
|
542
|
+
- [x] `codex-restore-source-audit` の VS Code extension source facts に rollback non-resurrection projection candidate を追加した。削除だけでなく、`replacement_history` filter / tombstone、`restoreMessage` suppress / exclude / projection などの明示近傍 signal を別枠で拾う。実 current thread の再監査では extension reconnect / rollout-path resume / thread-stream patch path は引き続き見える一方、`VS Code rollback projection candidate: no`。つまり現 bundle からは、rollback 済み source を model-visible input から投影・隔離する明示経路は見つかっていない。
|
|
543
|
+
- [x] `codex-restore-smoke` の retained text match に JSON path と location kind を追加した。実 current thread の再確認では `expectedTurns = 20` / read-resume-list `20 / 20 / 20` で count は一致するが、retained rollback text 7 件は `thread_read` / `thread_resume` / `thread_turns_list` の `turns[1].items[*].aggregatedOutput` にあり、location kind は `aggregated_output`。これは user message field ではなく過去 tool/output aggregate に同文が引用されている evidence なので、同一 thread repair では `userMessage.text`、`replacement_history`、`aggregatedOutput` を分けて追う。
|
|
544
|
+
- [x] `codex-restore-smoke --inspect-risky-rollout` は retained text の location kind を blocking candidate と quoted/tool-output に分類する。direct turn text / `replacement_history` は `app-server-restore-text-retained`、`aggregatedOutput` のみなら `app-server-restore-text-quoted` として報告する。実 current thread の再監査では `expectedTurns = 29` / read-resume-list `29 / 29 / 29`、retained rollback text 7 件はすべて `aggregated_output` / `quoted_or_tool_output_context`、`blocking-candidates=no`。つまり app-server response 上の retained text は直接の user message 復活ではなく、過去 tool/output aggregate 内の引用として分類された。
|
|
545
|
+
- [x] `codex-rollback-model-visible-smoke` を追加した。`--prepare` は controlled marker user turn を start して rollback し、`--verify` は marker prefix だけを含む prompt でモデルに問い合わせる。full marker が返った場合だけ `reproduced`、明示 not-visible 応答なら `not-reproduced`。この smoke は current thread を mutate するため env opt-in 必須。
|
|
546
|
+
- [x] 2026-05-08 live current thread で controlled smoke を実行した。最初の run は prepare JSON と assistant 発言に full marker が漏れ、後続 verify がその leaked marker に反応したため汚染ありとして破棄。修正後、`--marker-file` と per-trial prefix で full marker を chat/tool output に出さない run を実施し、fresh app-server process の即時 verify は `status = not-reproduced` / `promptIncludesMarker = false` / `observedMarkers = []`。これは VS Code reload/reconnect 後 proof ではないが、少なくとも app-server process restart 境界では rollback 済み controlled user marker の model-visible reproduction は未再現。
|
|
547
|
+
- [x] VS Code reload/reconnect 後 verify 用の marker-file `.throughline-smoke/rollback-model-visible-after-restart.json` を作成し、restart 前 baseline verify も `not-reproduced` で固定した。`.throughline-smoke/` は secret marker を含むため `.gitignore` に追加済み。Windows 側 VS Code window に reload command を送り、その後 `--after-vscode-restart` 付き verify も `status = not-reproduced` / `promptIncludesMarker = false` / `observedMarkers = []`。controlled user marker の rollback 後 model-visible reproduction は、app-server process restart 境界でも VS Code reload/reconnect 境界でも未再現。
|
|
548
|
+
|
|
549
|
+
2026-05-06 監査結果:
|
|
550
|
+
|
|
551
|
+
- [x] 旧統合計画との関係を明確化した。この文書は今後の実装順を上書きし、旧計画は実装履歴と根拠として残す。
|
|
552
|
+
- [x] `codex-sidecar` と Codex CLI の役割を分離した。`codex-sidecar` は Claude primary からの review / risk-check / second opinion / 互換 L2 -> L1 経路、Codex CLI は Codex primary の L2 -> L1 本線 backend とする。
|
|
553
|
+
- [x] Codex primary の fallback 方針を固定した。Codex CLI backend が使えない場合、Codex primary は silent fallback せず明示 error にする。
|
|
554
|
+
- [x] Claude primary 保護条件を維持した。Claude hooks / `/tl` / baton / resume context は Codex 用に置き換えない。
|
|
555
|
+
- [x] Phase 0 実装時に、Codex primary session identity を実装前に再監査する。結論: `codex:<thread_id>` を Throughline DB の `session_id` / `origin_session_id` に使う。
|