throughline 0.4.7 → 0.4.9
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/CHANGELOG.md +63 -0
- package/README.ja.md +6 -1
- package/README.md +29 -20
- package/bin/throughline.mjs +15 -2
- package/docs/PUBLIC_RELEASE_PLAN.md +4 -3
- package/docs/THROUGHLINE_CLEAR_AUTO_HANDOFF_PLAN.md +1 -1
- package/docs/THROUGHLINE_CODEX_FIRST_ROADMAP.md +3 -2
- package/docs/THROUGHLINE_CODEX_TRIM_IMPLEMENTATION_PLAN.md +2 -2
- package/docs/THROUGHLINE_CODEX_TRIM_ROLLBACK_FIX_PLAN.md +7 -2
- package/docs/throughline-rollback-context-trim-insight.md +1 -1
- package/package.json +1 -1
- package/src/cli/codex-handoff-smoke.mjs +1 -1
- package/src/cli/codex-hook.mjs +258 -29
- package/src/cli/codex-hook.test.mjs +169 -2
- package/src/cli/doctor.mjs +174 -6
- package/src/cli/doctor.test.mjs +58 -2
- package/src/cli/help.test.mjs +2 -0
- package/src/cli/install.mjs +82 -12
- package/src/cli/install.test.mjs +100 -16
- package/src/codex-auto-refresh.mjs +1 -1
- package/src/codex-auto-refresh.test.mjs +4 -4
- package/src/codex-handoff-smoke.mjs +15 -12
- package/src/codex-handoff-smoke.test.mjs +25 -6
- package/src/codex-handoff.mjs +82 -58
- package/src/codex-handoff.test.mjs +69 -28
- package/src/codex-resume.test.mjs +11 -2
- package/src/handoff-record.mjs +51 -8
- package/src/l3-summary.mjs +72 -0
- package/src/resume-context.mjs +58 -56
- package/src/resume-context.test.mjs +332 -36
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,69 @@ shipped to npm but were not individually tagged on GitHub.
|
|
|
10
10
|
|
|
11
11
|
## [Unreleased]
|
|
12
12
|
|
|
13
|
+
## [0.4.9] — 2026-05-09
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- **Resume context overhaul.** The Claude `/clear` resume injection no longer
|
|
18
|
+
carries a verbose meta-instruction ("respond with: I have inherited the prior
|
|
19
|
+
task..."). The header now contains only a one-line natural-continuation cue
|
|
20
|
+
and the `Bash` invocation contract for `throughline detail HH:MM:SS`. The L2
|
|
21
|
+
active-work thread is anchored at the very bottom of the injected context so
|
|
22
|
+
Claude's attention falls on the most recent turn instead of on a recap line.
|
|
23
|
+
Older L1 summaries are now timestamped with the original turn body time
|
|
24
|
+
(`bodies.created_at` MIN) instead of the skeleton row's summarization time,
|
|
25
|
+
so detail commands derived from L1 lines actually resolve.
|
|
26
|
+
- **L3 references collapsed into per-line `(詳細:…)` suffixes.** Both the
|
|
27
|
+
Claude resume context and the Codex active-work / new-thread handoff
|
|
28
|
+
renderers no longer print a standalone `### L3 詳細参照` /
|
|
29
|
+
`### Detail References` section. Instead, every L1 / L2 line ends with a
|
|
30
|
+
compact `(詳細:…)` suffix that aggregates the L3 evidence belonging to that
|
|
31
|
+
turn (`本文`, tool name, `思考`, `画像`, etc.), with `×N` only when count > 1.
|
|
32
|
+
The same-turn user / assistant pair only emits the suffix on the last role to
|
|
33
|
+
avoid duplicating the per-turn L3 hint. MCP tool names are shortened to the
|
|
34
|
+
trailing function name (`mcp__plugin_..._playwright__browser_navigate` →
|
|
35
|
+
`browser_navigate`) so namespace noise does not dominate the suffix.
|
|
36
|
+
- Codex auto-refresh and current-session `$throughline` trigger now use a 75%
|
|
37
|
+
verified-usage threshold instead of 80%, so Throughline can fire before Codex
|
|
38
|
+
native auto-compact wins the race.
|
|
39
|
+
- `throughline doctor --codex` now reads the Codex hook trust gate from
|
|
40
|
+
`~/.codex/config.toml` (`[hooks.state."<hooks.json>:event:i:j"].trusted_hash`)
|
|
41
|
+
and reports a top-level `Codex hook trust:` summary plus per-hook
|
|
42
|
+
`trusted: yes/no`. A registered hook that is not yet trusted in the Codex
|
|
43
|
+
hook acceptance menu may not actually run.
|
|
44
|
+
|
|
45
|
+
### Added
|
|
46
|
+
|
|
47
|
+
- `src/l3-summary.mjs`: shared helpers (`shortenMcpToolName`, `localizeL3Part`,
|
|
48
|
+
`groupL3ByTurn`, `buildPartsSummary`) used by both the Claude resume context
|
|
49
|
+
and the Codex handoff renderers to build the per-line `(詳細:…)` suffix.
|
|
50
|
+
|
|
51
|
+
### Notes
|
|
52
|
+
|
|
53
|
+
- The Codex `--max-detail-refs` CLI flag is preserved for backwards
|
|
54
|
+
compatibility but is now a validated no-op: the new per-line suffix
|
|
55
|
+
aggregates L3 references at turn granularity, so a separate cap on a
|
|
56
|
+
standalone Detail References list is no longer meaningful.
|
|
57
|
+
- `codex-handoff-smoke` now reports `renderedDetailSuffixes` instead of
|
|
58
|
+
`renderedDetailCommands` / `uniqueRenderedDetailCommands`. The
|
|
59
|
+
`detail_commands_deduplicated` check has been retired because the new
|
|
60
|
+
rendering aggregates L3 by turn structurally and cannot emit duplicate
|
|
61
|
+
detail commands for the same turn.
|
|
62
|
+
|
|
63
|
+
## [0.4.8] — 2026-05-09
|
|
64
|
+
|
|
65
|
+
### Changed
|
|
66
|
+
|
|
67
|
+
- Codex install now registers `UserPromptSubmit` and `PostToolUse` hooks in
|
|
68
|
+
addition to the Stop hook. These hooks read the current Codex rollout
|
|
69
|
+
`token_count` directly and, at the verified 80% threshold, inject a
|
|
70
|
+
current-session `$throughline` instruction before the assistant answers or
|
|
71
|
+
continues a tool loop. This keeps automatic refresh independent of
|
|
72
|
+
token-monitor and available to users who never run the monitor.
|
|
73
|
+
- `throughline install` now enables both `[features].codex_hooks = true` and
|
|
74
|
+
`[features].hooks = true` for Codex hook compatibility.
|
|
75
|
+
|
|
13
76
|
## [0.4.7] — 2026-05-09
|
|
14
77
|
|
|
15
78
|
### Changed
|
package/README.ja.md
CHANGED
|
@@ -26,6 +26,11 @@ throughline install # hook / Codex skill / VS Code monitor task を登録
|
|
|
26
26
|
`/clear` を打てば新セッションはゼロからではなく、**思考の途中から再開** される。
|
|
27
27
|
`/clear` を経由しない新規 chat / VS Code 再起動では `/tl` で前任を指名できる。
|
|
28
28
|
|
|
29
|
+
Codex では `UserPromptSubmit` / `PostToolUse` / `Stop` hook と `$throughline`
|
|
30
|
+
skill も登録する。75% 自動発火は token-monitor 依存ではなく、当該 Codex
|
|
31
|
+
セッションの rollout `token_count` を hook が読み、prompt 送信時または tool loop
|
|
32
|
+
途中の閾値到達時に同じセッションへ `$throughline` 実行指示を注入する。
|
|
33
|
+
|
|
29
34
|
## 他の手段との比較
|
|
30
35
|
|
|
31
36
|
| | Throughline | MemGPT / SummaryBufferMemory | 素の Claude Code |
|
|
@@ -231,7 +236,7 @@ Throughline state をまだ書いていない現在セッションも表示で
|
|
|
231
236
|
|
|
232
237
|
| コマンド | 役割 |
|
|
233
238
|
| --- | --- |
|
|
234
|
-
| `throughline install` | hook / Codex skill を登録し、VS Code 配下なら現プロジェクトの monitor task も配置 |
|
|
239
|
+
| `throughline install` | hook / Codex UserPromptSubmit・PostToolUse・Stop hook / Codex skill を登録し、VS Code 配下なら現プロジェクトの monitor task も配置 |
|
|
235
240
|
| `throughline install --project` | 現リポジトリの `.claude/settings.json` だけに hook を登録 |
|
|
236
241
|
| `throughline uninstall` | hook を削除 |
|
|
237
242
|
| `throughline monitor` | マルチセッション監視を起動 |
|
package/README.md
CHANGED
|
@@ -27,16 +27,20 @@ type `/clear` — the new session resumes mid-thought instead of starting from
|
|
|
27
27
|
zero. (For non-`/clear` boundaries such as a brand-new chat or a VSCode
|
|
28
28
|
restart, type `/tl` first to mark the predecessor.)
|
|
29
29
|
|
|
30
|
-
Global install also registers
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
Global install also registers Codex `UserPromptSubmit`, `PostToolUse`, and
|
|
31
|
+
`Stop` hooks in `~/.codex/hooks.json` and enables both
|
|
32
|
+
`[features].codex_hooks = true` and `[features].hooks = true` in
|
|
33
|
+
`~/.codex/config.toml`. The Codex hooks invoke the installed
|
|
34
|
+
`bin/throughline.mjs` through an absolute Node path, so Codex App Server PATH
|
|
35
|
+
differences do not hide the command. They are registered synchronously
|
|
36
|
+
(`async: false`), matching the Codex hook behavior verified in Caveat. Existing
|
|
37
|
+
non-Throughline Codex hooks are preserved. The prompt and tool-loop hooks read
|
|
38
|
+
the current rollout `token_count` themselves and inject `$throughline` at the
|
|
39
|
+
verified 75% threshold; token-monitor is display-only and is never the trigger
|
|
40
|
+
source. It also installs a global `$throughline` Codex skill. Bare
|
|
41
|
+
`$throughline` runs the scripted current-thread rollback + Throughline DB memory
|
|
42
|
+
injection directly; ask explicitly for status, resume, summarize, diagnostics,
|
|
43
|
+
or fresh-thread handoff when you want those read-only surfaces instead.
|
|
40
44
|
|
|
41
45
|
## How it compares
|
|
42
46
|
|
|
@@ -249,10 +253,12 @@ looked like a rolled-back user prompt could reappear after VS Code restart /
|
|
|
249
253
|
reconnect, but controlled model-visible rollback smokes did not reproduce that
|
|
250
254
|
path. `throughline trim --execute --host codex` now sends the guarded
|
|
251
255
|
rollback + Throughline DB memory injection when app-server turn-count guards and
|
|
252
|
-
injectable DB memory are available. Codex
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
+
injectable DB memory are available. Codex current-session auto-refresh is not a
|
|
257
|
+
token-monitor feature: the Codex `UserPromptSubmit` hook reads the current
|
|
258
|
+
rollout `token_count` and, at the verified 75% threshold, injects a same-session
|
|
259
|
+
instruction to run the installed `$throughline` workflow before answering. The
|
|
260
|
+
Codex Stop hook still attempts the guarded live refresh when it naturally fires,
|
|
261
|
+
so non-monitor users get the same threshold behavior.
|
|
256
262
|
|
|
257
263
|
`throughline codex-host-primitive-audit` can inspect the installed Codex
|
|
258
264
|
app-server schema read-only. On the current tested Codex CLI, it finds
|
|
@@ -529,10 +535,13 @@ Example output:
|
|
|
529
535
|
Codex rollout has no token-count event, Throughline can show an explicit
|
|
530
536
|
estimate with `estimated: true` and the monitor marks it with `est`; it is not
|
|
531
537
|
presented as exact usage.
|
|
532
|
-
- **Codex auto-refresh
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
538
|
+
- **Codex auto-refresh is driven by the current Codex session, not the monitor.**
|
|
539
|
+
The Codex `UserPromptSubmit` and `PostToolUse` hooks capture rollout memory
|
|
540
|
+
and, when verified usage reaches 75%, inject a current-session `$throughline`
|
|
541
|
+
instruction before the assistant answers or continues a tool loop. The Codex
|
|
542
|
+
Stop hook also captures DB memory, writes monitor state, and attempts guarded
|
|
543
|
+
rollback + Throughline DB memory injection when it naturally fires above the
|
|
544
|
+
threshold.
|
|
536
545
|
- **1M-context detection** is automatic. It checks the `[1m]` suffix in the
|
|
537
546
|
transcript, falls back to string matching on `1M context`, and finally
|
|
538
547
|
promotes to 1M if observed usage exceeds 200k.
|
|
@@ -598,7 +607,7 @@ monitor appears in a dedicated terminal panel the next time you open that
|
|
|
598
607
|
folder.
|
|
599
608
|
|
|
600
609
|
**How it works.** `ensureMonitorTaskFile` is called from `throughline install`
|
|
601
|
-
and from **all three hooks (SessionStart, UserPromptSubmit, Stop)**. Whichever
|
|
610
|
+
and from **all three Claude hooks (SessionStart, UserPromptSubmit, Stop)**. Whichever
|
|
602
611
|
one fires first in your environment creates the file; the rest are idempotent
|
|
603
612
|
no-ops. Once per project it inspects `.vscode/tasks.json`:
|
|
604
613
|
|
|
@@ -658,7 +667,7 @@ entry to the `tasks` array yourself:
|
|
|
658
667
|
|
|
659
668
|
| Command | What it does |
|
|
660
669
|
| ---------------------------------------------- | ------------------------------------------------------------ |
|
|
661
|
-
| `throughline install` | Register Claude user hooks/slash commands, the global Codex Stop
|
|
670
|
+
| `throughline install` | Register Claude user hooks/slash commands, the global Codex UserPromptSubmit/PostToolUse/Stop hooks, the global `$throughline` Codex skill, and the current VS Code monitor task when applicable |
|
|
662
671
|
| `throughline install --project` | Register Claude hooks/slash commands in this repo only |
|
|
663
672
|
| `throughline uninstall` | Remove Throughline-managed Claude hooks/slash commands, only the Throughline-managed Codex hook, and the `$throughline` Codex skill |
|
|
664
673
|
| `throughline monitor [--all] [--session <id>]` | Run the multi-session token monitor |
|
package/bin/throughline.mjs
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
* throughline detail <時刻> # L2+L3 詳細取得 (Claude が Bash 経由で呼ぶ想定)
|
|
12
12
|
* throughline handoff-preview # Codex-facing throughline_handoff JSON preview
|
|
13
13
|
* throughline codex-capture # Capture active Codex rollout turns into Throughline DB
|
|
14
|
+
* throughline codex-hook user-prompt-submit # Codex current-session auto-refresh prompt hook
|
|
15
|
+
* throughline codex-hook post-tool-use # Codex current-session auto-refresh tool-loop hook
|
|
14
16
|
* throughline codex-hook stop # Codex native Stop hook (capture + L1 summarize)
|
|
15
17
|
* throughline codex-summarize # Summarize captured Codex L2 turns into L1 via Codex CLI
|
|
16
18
|
* throughline codex-resume # Render Codex active-work context from DB
|
|
@@ -149,8 +151,17 @@ Usage:
|
|
|
149
151
|
throughline handoff-preview Print Codex-facing throughline_handoff JSON
|
|
150
152
|
throughline codex-capture Capture active Codex rollout turns into DB
|
|
151
153
|
(requires --codex-thread-id or env thread id)
|
|
152
|
-
throughline codex-hook
|
|
153
|
-
|
|
154
|
+
throughline codex-hook user-prompt-submit
|
|
155
|
+
Codex UserPromptSubmit hook: capture rollout and,
|
|
156
|
+
at 75%, inject current-session $throughline
|
|
157
|
+
instruction from verified rollout token_count
|
|
158
|
+
throughline codex-hook post-tool-use
|
|
159
|
+
Codex PostToolUse hook: during tool loops, capture
|
|
160
|
+
rollout and inject the same 75% $throughline
|
|
161
|
+
instruction from verified rollout token_count
|
|
162
|
+
throughline codex-hook stop Codex native Stop hook: capture rollout,
|
|
163
|
+
summarize old L2 turns into L1, and run guarded
|
|
164
|
+
auto-refresh when verified usage reaches 75%
|
|
154
165
|
throughline codex-summarize Summarize captured Codex L2 into L1 via Codex CLI
|
|
155
166
|
(requires a codex:<thread-id> session)
|
|
156
167
|
throughline codex-resume Render Codex active-work context from DB
|
|
@@ -243,6 +254,8 @@ Hook subcommands (called by Claude Code / Codex):
|
|
|
243
254
|
throughline session-start SessionStart hook
|
|
244
255
|
throughline process-turn Stop hook
|
|
245
256
|
throughline prompt-submit UserPromptSubmit hook (/tl & /clear baton writer)
|
|
257
|
+
throughline codex-hook user-prompt-submit Codex current-session refresh prompt hook
|
|
258
|
+
throughline codex-hook post-tool-use Codex current-session refresh tool-loop hook
|
|
246
259
|
throughline codex-hook stop Codex Stop hook
|
|
247
260
|
`);
|
|
248
261
|
}
|
|
@@ -119,7 +119,7 @@ schema v4 で PostToolUse (`capture-tool`) は廃止、L2/L3 は Stop 内で一
|
|
|
119
119
|
| **npm 公開 (v0.3.24)** | 2026-05-02 v0.3.23 の補完: `.vscode/tasks.json` には現環境の絶対パスが書き込まれるため、**そもそも commit すべきではない**。`shouldRecommendGitignore` を [src/vscode-task.mjs](../src/vscode-task.mjs) に追加し、`ensureMonitorTaskFile` が created / merged / repaired を返すタイミングで「git リポジトリ内かつ `.gitignore` に `.vscode/tasks.json` 系エントリが無い」を判定。該当時に `<system-reminder>` で `.gitignore` 追加推奨を 1 度だけ stdout 通知 (`.throughline-gitignore-noted` marker で抑止)。否定パターン (`!.vscode/tasks.json`) はスキップ判定 = 推奨を出す。README Troubleshooting にも明示。配布物 (npm tarball) には絶対パスは入っていない (`files` フィールドが `.vscode/` を含まない、ソースに hard-coded path 無し) ことを再確認 |
|
|
120
120
|
| **npm 公開 (v0.3.25): Claude-primary / Codex-sidecar groundwork** | `HandoffRecord` projection、`throughline handoff-preview`、`throughline_handoff` example、`codex-sidecar-diagnostics` / `codex-sidecar-dry-run` を追加。Claude Code hooks / slash command / transcript / baton / resume behavior は正本として維持し、Codex 対応は adapter / projection として足す |
|
|
121
121
|
| **npm 公開 (v0.3.25): optional Codex-sidecar L1 summarization** | Claude primary の L2→L1 要約は、`codex-sidecar` が `summarize-l1` preset で configured の場合だけ sidecar を使う。disabled / unavailable / run failure では、ユーザー許可済み互換経路として既存 Claude Haiku 要約を維持する。Codex primary の L2→L1 backend は次フェーズ計画で Codex CLI 本線として扱う。Claude CLI smoke / test で Claude を呼ぶ場合は Haiku を使う |
|
|
122
|
-
| **npm 公開 (v0.3.25): `/tl-trim` dry-run** | `throughline trim --dry-run`、`--preflight`、guarded `--execute`、`--host`、`--keep-recent`、`--all`、`--memo-stdin`、`--preview-max-chars`、`--codex-thread-id`、`THROUGHLINE_CODEX_THREAD_ID` / `CODEX_THREAD_ID`、`throughline codex-threads`、`throughline doctor --trim`、Claude slash command `/tl-trim` を追加。Codex app-server の rollback / inject primitive は live app-server 上で実測済み。2026-05-06 incident 後は一時 blocked としたが、2026-05-08 の controlled rollback model-visible smoke が app-server restart 境界と VS Code reload/reconnect 境界の両方で `not-reproduced` だったため、過剰 blocker は解除済み。`trim --execute --host codex` は明示実行で current-thread rollback + Throughline DB memory inject を送り、Codex Stop hook auto-refresh は verified usage
|
|
122
|
+
| **npm 公開 (v0.3.25): `/tl-trim` dry-run** | `throughline trim --dry-run`、`--preflight`、guarded `--execute`、`--host`、`--keep-recent`、`--all`、`--memo-stdin`、`--preview-max-chars`、`--codex-thread-id`、`THROUGHLINE_CODEX_THREAD_ID` / `CODEX_THREAD_ID`、`throughline codex-threads`、`throughline doctor --trim`、Claude slash command `/tl-trim` を追加。Codex app-server の rollback / inject primitive は live app-server 上で実測済み。2026-05-06 incident 後は一時 blocked としたが、2026-05-08 の controlled rollback model-visible smoke が app-server restart 境界と VS Code reload/reconnect 境界の両方で `not-reproduced` だったため、過剰 blocker は解除済み。`trim --execute --host codex` は明示実行で current-thread rollback + Throughline DB memory inject を送り、Codex Stop hook auto-refresh は verified usage 75% 以上で同じ guarded path を試行する。DB memory 不在、Codex thread identity 不在、rollout/app-server turn-count 不一致は mutation 前に拒否する。restore-safety / planned restore-safety / host primitive audit は diagnostics として表示する |
|
|
123
123
|
| **npm 公開 (v0.3.25): Codex primary capture** | `throughline codex-capture --codex-thread-id <id>` を追加。Codex rollout JSONL の active turns を `codex:<thread_id>` session として DB `bodies` に保存し、`function_call` / `function_call_output` を DB `details` の L3 tool input / output として保存する。`thread_rolled_back` 適用後の active thread だけを再構成し、rollback 済み tail は current L2/L3 に残さない。Codex thread id は明示指定または env 指定のみで、自動推測しない |
|
|
124
124
|
| **npm 公開 (v0.3.25): Codex-primary L1 backend** | `summarizeToL1` に `hostMode` 分岐を追加。Claude primary は既存の `codex-sidecar` / Claude Haiku 互換経路を維持し、Codex primary は Codex CLI backend を使う。Codex CLI failure は `source = codex-cli` / `reason` 付き explicit error とし、Claude Haiku / `raw_l2` に silent fallback しない |
|
|
125
125
|
| **npm 公開 (v0.3.25): Codex-primary L1 CLI** | `throughline codex-summarize --session codex:<thread_id>` を追加。captured Codex L2 が L2 window を超えた場合、最古の未要約 turn を Codex CLI backend で L1 skeleton に書く。Codex CLI failure は explicit error |
|
|
@@ -131,12 +131,13 @@ schema v4 で PostToolUse (`capture-tool`) は廃止、L2/L3 は Stop 内で一
|
|
|
131
131
|
| **npm 公開 (v0.3.25): Codex VS Code restore smoke protocol** | `throughline codex-vscode-restore-smoke --prepare/--verify --codex-thread-id <id>` を追加。`--prepare` は hidden active-work marker memory を app-server へ注入し、VS Code reload / reconnect 後に marker を含まない prompt を送る二段階手順を出す。`--verify` は rollout を読み、prepare 後の marker-free smoke prompt、assistant の marker-only answer、user prompt への marker leak 不在を確認する。prepare は `THROUGHLINE_EXPERIMENTAL_CODEX_VSCODE_RESTORE_SMOKE=1` 必須。実 VS Code reload / reconnect marker proof は `TL_CODEX_VSCODE_RESTORE_46888202` で成功済み。ただしこれは hidden developer memory visibility 証明であり、rollback 済み user turn の非復活証明ではない |
|
|
132
132
|
| **npm 公開 (v0.3.25): Codex VS Code rollback smoke verifier** | `throughline codex-vscode-rollback-smoke --verify --codex-thread-id <id>` を追加。rollout を read-only で読み、rollback event、rollback 済み user text、rollback 後 user turn、`restoreSafety.status = ok` を必須条件にする。`--after-vscode-restart` がある場合だけ `restartSafe: true` を返す。実 incident-shaped live rollback run では `thread_rolled_back` と injected memory は記録されたが、rollback 対象 user text が `compacted.replacement_history` に残り、後続 verifier では rollback 済み user text の再出現も観測した。後続分類で app-server response 上の retained text は `aggregatedOutput` に限定され、controlled rollback model-visible smoke は再現しなかったため、これは現在は diagnostic evidence として扱う |
|
|
133
133
|
| **npm 公開 (v0.3.25): Codex primary doctor** | `throughline doctor --codex` を追加。現在 project の Codex thread env identity、rollout candidates、captured `codex:<thread_id>` DB sessions、context-refresh memory contract、new-thread handoff readiness、safe continuation status、host primitive audit status、次に使う capture / handoff / resume / audit command を表示する。doctor 自体は read-only で、Codex thread / DB / Claude settings を変更しない。`doctor --trim --host codex` も host primitive audit status を表示する |
|
|
134
|
-
| **npm 公開 (v0.3.25): Codex global Stop hook / skill install** | `throughline install` が Claude hooks / slash commands に加えて `~/.codex/hooks.json` に絶対 node + installed `bin/throughline.mjs codex-hook stop` を `async: false` で登録し、`~/.codex/config.toml` の `[features].codex_hooks = true` を有効化し、`~/.codex/skills/throughline` に `$throughline` skill を配置する。Codex App Server / VSCode host の PATH 差分で bare `throughline` が見えない可能性があるため、hook は Caveat と同じ絶対パス型に寄せる。既存 Caveat / Spotter などの Codex hooks は保持し、`throughline uninstall` は Throughline 管理の Codex hook / skill だけを削除する。既に bare command または `async: true` で登録済みの Throughline Codex Stop hook は次回 install で更新する。実環境では `codex exec --json` child thread `019dfd4f-93ff-7522-8f89-bd1e1996c8d7` が Stop hook で自然 capture され、`doctor --codex` の latest DB session が `codex:019dfd4f-93ff-7522-8f89-bd1e1996c8d7` に進むことを確認した。さらに絶対パス型へ更新後、child thread `019dfd5e-1248-7c11-8ddc-97e1b0701e10` でも latest DB session が `codex:019dfd5e-1248-7c11-8ddc-97e1b0701e10` に進むことを確認した。hook shape 変更後に新規開始した VSCode-origin thread `019dfd62-9a9d-7211-bf91-89d8e3fc908e` でも `doctor --codex` の current thread と latest DB session が一致し、自然 Stop hook capture を確認済み。hook shape 変更前から開いていた VSCode-origin parent thread は、変更後の自然 Stop smoke としては扱わない。Caveat 側にも `async: false` Stop hook が動く実測があるため、Codex 側は Caveat と同じ同期 hook 方針に寄せる。`codex-capture` / `codex-summarize` / `codex-resume --memo-stdin` は診断・明示操作 surface として維持し、model-visible smoke は明示 opt-in。2026-05-08 以降、Stop hook auto-refresh は verified usage
|
|
134
|
+
| **npm 公開 (v0.3.25): Codex global Stop hook / skill install** | `throughline install` が Claude hooks / slash commands に加えて `~/.codex/hooks.json` に絶対 node + installed `bin/throughline.mjs codex-hook stop` を `async: false` で登録し、`~/.codex/config.toml` の `[features].codex_hooks = true` を有効化し、`~/.codex/skills/throughline` に `$throughline` skill を配置する。Codex App Server / VSCode host の PATH 差分で bare `throughline` が見えない可能性があるため、hook は Caveat と同じ絶対パス型に寄せる。既存 Caveat / Spotter などの Codex hooks は保持し、`throughline uninstall` は Throughline 管理の Codex hook / skill だけを削除する。既に bare command または `async: true` で登録済みの Throughline Codex Stop hook は次回 install で更新する。実環境では `codex exec --json` child thread `019dfd4f-93ff-7522-8f89-bd1e1996c8d7` が Stop hook で自然 capture され、`doctor --codex` の latest DB session が `codex:019dfd4f-93ff-7522-8f89-bd1e1996c8d7` に進むことを確認した。さらに絶対パス型へ更新後、child thread `019dfd5e-1248-7c11-8ddc-97e1b0701e10` でも latest DB session が `codex:019dfd5e-1248-7c11-8ddc-97e1b0701e10` に進むことを確認した。hook shape 変更後に新規開始した VSCode-origin thread `019dfd62-9a9d-7211-bf91-89d8e3fc908e` でも `doctor --codex` の current thread と latest DB session が一致し、自然 Stop hook capture を確認済み。hook shape 変更前から開いていた VSCode-origin parent thread は、変更後の自然 Stop smoke としては扱わない。Caveat 側にも `async: false` Stop hook が動く実測があるため、Codex 側は Caveat と同じ同期 hook 方針に寄せる。`codex-capture` / `codex-summarize` / `codex-resume --memo-stdin` は診断・明示操作 surface として維持し、model-visible smoke は明示 opt-in。2026-05-08 以降、Stop hook auto-refresh は verified usage 75% 以上で guarded rollback / inject を試行し、estimate usage では mutation しない。2026-05-09 以降は Codex native auto-compact より先に Throughline refresh を走らせつつ、70% warning よりは mutation を遅らせる |
|
|
135
135
|
| **npm 公開 (v0.3.25): Codex-first roadmap** | [THROUGHLINE_CODEX_FIRST_ROADMAP.md](THROUGHLINE_CODEX_FIRST_ROADMAP.md) を追加。次フェーズは Codex primary 実用化、Codex Rewind 互換、Claude 側 finalization の順で進める。Codex primary の L2→L1 backend は Codex CLI を本線とし、`codex-sidecar` は Claude primary からの review / risk-check / second opinion / 互換 L2→L1 経路として整理する |
|
|
136
136
|
| **npm 公開 (v0.3.25): npm docs packaging** | README から参照する `docs/` と `CHANGELOG.md` を npm `files` に追加。`docs/throughline-handoff-context.example.json` を含め、README の sidecar dry-run 例が tarball 内でも成立するようにする |
|
|
137
137
|
| **npm 公開 (v0.4.0): /clear auto-handoff + memo / save-inflight / /tl-trim retire** | 2026-05-08 Claude Code 2.1.128 で `source='clear'` が reliable になったため、`/clear` で自動引継ぎがデフォルト ON になる auto path を追加。`THROUGHLINE_DISABLE_AUTO_HANDOFF=1` で OFF にできる。`/tl` slash command は明示意思マーカーへ簡素化 (memo 4 項目入力廃止、`save-inflight` CLI 削除、`/tl-trim` slash command 廃止、`updateBatonMemo` 関数削除、`handoff_batons.memo_text` を schema v8 で drop)。注入は L1 + L2 + L3 references のみに簡素化し、memo / 中断直前 thinking セクションを削除。Codex 側 trim path は維持。詳細は [CHANGELOG.md](../CHANGELOG.md) と [THROUGHLINE_CLEAR_AUTO_HANDOFF_PLAN.md](THROUGHLINE_CLEAR_AUTO_HANDOFF_PLAN.md) |
|
|
138
138
|
| **npm 公開 (v0.4.1): typed `/clear` も baton を書く + 2 経路の優先順位入れ替え** | 2026-05-09 `/clear` を UserPromptSubmit hook で検出した時点で当該セッションの `session_id` を `handoff_batons` に書き込み、次 SessionStart が確定的にそのセッションを引き継ぐ。これで multi-window で「最新更新セッション ≠ /clear したセッション」になるシナリオで `findLatestClaudePredecessor` heuristic が誤った前任を選ぶ問題を解消。2 経路の優先順位を **baton path = primary、auto path = fallback** に変更 (auto path は VSCode 拡張メニュー由来など UserPromptSubmit に届かない経路のフォールバック)。`THROUGHLINE_DISABLE_AUTO_HANDOFF=1` は fallback path のみに作用するようになった (typed `/clear` / `/tl` は env と無関係に発火する)。あわせて `.vscode/tasks.json` を git 追跡から外し (gitignore)、`ensureMonitorTaskFile` が hook 発火ごとに絶対パスを書き換える挙動による別環境での dirty diff を解消。`src/prompt-submit.test.mjs` を新設し、`isClearCommand` / `isBatonCommand` 判定 14 件と subprocess+DB 実体テスト 3 件を追加。詳細は [CHANGELOG.md](../CHANGELOG.md) |
|
|
139
139
|
| **npm 公開 (v0.4.7): Codex monitor direct discovery + 80% auto-refresh** | 2026-05-09 Codex Stop hook auto-refresh の verified usage threshold を 90% から 80% に変更し、Codex native auto-compact より先に Throughline DB memory refresh を試行する。estimate usage / estimated context window では mutation しない。`throughline monitor` は `~/.throughline/state` に加えて `~/.codex/sessions/**/rollout-*.jsonl` を直接 discovery し、Throughline state が未生成の現在 Codex thread も表示する。既存 state がある場合は state の usage snapshot を保持しつつ discovered rollout path / mtime を合流する。Codex 表示 ID は `codex:01` ではなく raw thread id 先頭 8 桁 (`019e085c`) にした。Codex open turn の transient `output_tokens` は token count に overlay するが、モデル欄の `live+<tokens>` marker は表示しない |
|
|
140
|
+
| **未リリース: Codex current-session 75% trigger** | Codex 自動発火を token-monitor に依存させず、global install が Codex `UserPromptSubmit` / `PostToolUse` hooks も登録する。hook は当該 Codex session の rollout `token_count` を直接読み、verified 75% 以上なら同じ user turn または tool loop 継続前に `$throughline` workflow 実行指示を `additionalContext` で注入する。Stop hook の guarded auto-refresh は残す。`~/.codex/config.toml` は旧 `codex_hooks = true` に加えて現行 `hooks = true` も有効化する |
|
|
140
141
|
| **グローバル E2E 検証** | 2026-04-17 別ディレクトリから `throughline doctor` 全緑を確認 |
|
|
141
142
|
|
|
142
143
|
### ❌ 未完タスク
|
|
@@ -148,7 +149,7 @@ schema v4 で PostToolUse (`capture-tool`) は廃止、L2/L3 は Stop 内で一
|
|
|
148
149
|
| **GitHub Actions 自動 publish** | `release` タグ push をトリガー(Phase 3+、Trusted Publishing 使用) |
|
|
149
150
|
| **Claude Code プラグインマーケットプレース登録** | npm 公開の後継ステップ(Phase 3+) |
|
|
150
151
|
| **turn-processor.test.mjs の 10 秒タイムアウト解消** | `main()` が stdin を待ち続けるためテストファイルがハングする既存の問題。実装動作は無影響、テスト個別 9/9 は pass |
|
|
151
|
-
| **automatic context rollback / inject** | Codex Stop hook auto-refresh は verified usage
|
|
152
|
+
| **automatic context rollback / inject** | Codex Stop hook auto-refresh は verified usage 75% 以上で guarded rollback + Throughline DB memory inject を試行する。controlled rollback model-visible smoke で復活が未再現となったため、2026-05-06 incident 後の overbroad blocker は解除済み。estimate usage では実行しない |
|
|
152
153
|
|
|
153
154
|
---
|
|
154
155
|
|
|
@@ -278,7 +278,7 @@ Codex 側 v0.3.25 の以下は本計画で **完全に無変更**:
|
|
|
278
278
|
- `codex-capture` / `codex-summarize` / `codex-resume` (Codex primary L1/L2/L3 path)
|
|
279
279
|
- `codex-resume --format handoff` (新規 Codex thread 用 prompt)
|
|
280
280
|
- `trim --execute --host codex` / `--preflight --host codex` (app-server `thread/rollback` + `thread/inject_items`)
|
|
281
|
-
- Codex Stop hook
|
|
281
|
+
- Codex Stop hook 75% auto-refresh
|
|
282
282
|
- restore-safety / host primitive audit diagnostics
|
|
283
283
|
- Codex skill ([codex/skills/throughline](../codex/skills/throughline)) の trim 機能 (= 機能自体は無変更、SKILL.md 内の `/tl-trim` 言及があれば 4 TODO で update)
|
|
284
284
|
- [src/codex-app-server.mjs](../src/codex-app-server.mjs), [src/codex-rollout-memory.mjs](../src/codex-rollout-memory.mjs)
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
- Claude-primary の現行 L2 -> L1 要約は `codex-sidecar` が configured の場合に sidecar を優先し、使えない場合は Claude Haiku 経路に戻る。Codex-primary は Codex CLI backend 失敗を明示 error にし、Claude Haiku / raw L2 へ fallback しない。
|
|
29
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
30
|
- Claude `/rewind` 自動化はまだ有効化しない。
|
|
31
|
-
- Codex automatic refresh mutation は再有効化済み。`
|
|
31
|
+
- Codex automatic refresh mutation は再有効化済み。`75%` の verified usage threshold で rollback / Throughline DB memory inject を試行し、estimate usage では実行しない。Codex native auto-compact より先に Throughline refresh を走らせつつ、70% warning よりは mutation を遅らせる。
|
|
32
32
|
|
|
33
33
|
## 新セッション引き継ぎ
|
|
34
34
|
|
|
@@ -468,7 +468,8 @@ Phase 5 implementation status (2026-05-06):
|
|
|
468
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
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` に保存する。2026-05-09 以降、monitor は `~/.throughline/state` だけでなく `~/.codex/sessions/**/rollout-*.jsonl` も直接 discovery するため、state 未生成の現在 Codex thread も表示できる。既存 state がある場合は usage snapshot を保持しつつ discovered rollout path / mtime を合流する。rollout に `event_msg` / `token_count` がある場合は verified usage として表示し、無い場合だけ `estimated: true` / `source = codex-rollout-chars-div-4` の明示 estimate を使う。state filename は URL encode し、`codex:` session id を Windows でも保存可能にした。表示 ID は `codex:` prefix を外した raw thread id 先頭 8 桁。
|
|
470
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 は送らない状態にした。2026-05-08 unblock 後は guarded rollback / inject を再有効化し、2026-05-09 以降は Codex native auto-compact より先に Throughline refresh を走らせるため verified usage `
|
|
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 は送らない状態にした。2026-05-08 unblock 後は guarded rollback / inject を再有効化し、2026-05-09 以降は Codex native auto-compact より先に Throughline refresh を走らせるため verified usage `75%` 以上を既定閾値にする。
|
|
472
|
+
- current-session trigger 修正: Codex auto-refresh を token-monitor の描画ループに置かず、Codex `UserPromptSubmit` / `PostToolUse` hooks が当該 session の rollout `token_count` を直接読んで verified 75% 以上なら `$throughline` workflow 実行指示を同じ user turn または tool loop 継続前の `additionalContext` として注入する。monitor は表示専用で、自動発火の判定元にしない。
|
|
472
473
|
|
|
473
474
|
## Phase 6: Claude Side Finalization
|
|
474
475
|
|
|
@@ -372,13 +372,13 @@ Phase 6 result (2026-05-06):
|
|
|
372
372
|
- `thread/inject_items` に raw Responses API item `{ type: "message", role: "developer", content: [{ type: "input_text", text: "..." }] }` を渡し、次の `turn/start` で injected memory が model-visible になることを確認した。marker `TL_PHASE6_INJECT_OK` を正しく返した。
|
|
373
373
|
- その後の Codex primary 実装で、`codex-resume` が描画する active-work developer message も実 Codex host で model-visible になることを確認した。marker `TL_CODEX_VISIBLE_REAL_20260506_C` が `item/agentMessage/delta` に出た。詳細な実測値は [THROUGHLINE_CODEX_FIRST_ROADMAP.md](THROUGHLINE_CODEX_FIRST_ROADMAP.md) の Phase 3 result を正とする。
|
|
374
374
|
- さらに `thread/inject_items` 後にもう一度 `thread/resume` してから `turn/start` を呼ぶ smoke も追加し、実 Codex host で marker `TL_CODEX_RESUME_AFTER_INJECT_REAL_20260506` が `item/agentMessage/delta` に出ることを確認した。
|
|
375
|
-
- Codex host primitive は live app-server 上では実測済み。ただし restart-safe durability は未証明。現在は明示 `--codex-thread-id` または env thread identity と rollout/app-server turn count guard が live mutation の最低条件であり、durable success は別分類で扱う。2026-05-06 incident 後はいったん Codex Stop hook 後の automatic refresh mutation を blocked としたが、2026-05-08 unblock 後は guarded rollback / inject を試行する。2026-05-09 以降は Codex native auto-compact より先に Throughline refresh を走らせるため、verified usage
|
|
375
|
+
- Codex host primitive は live app-server 上では実測済み。ただし restart-safe durability は未証明。現在は明示 `--codex-thread-id` または env thread identity と rollout/app-server turn count guard が live mutation の最低条件であり、durable success は別分類で扱う。2026-05-06 incident 後はいったん Codex Stop hook 後の automatic refresh mutation を blocked としたが、2026-05-08 unblock 後は guarded rollback / inject を試行する。2026-05-09 以降は Codex native auto-compact より先に Throughline refresh を走らせるため、verified usage 75% 以上を既定閾値にする。
|
|
376
376
|
- Claude `/rewind conversation only` は手動 UX として扱う。外部ツールからの自動化 surface は未確認。Claude host の automatic rollback / inject は `manual-only`。
|
|
377
377
|
- Phase 8 では dry-run / preflight を本線にしつつ、Codex だけ guarded execute を追加した。Claude は manual-only のまま扱う。
|
|
378
378
|
|
|
379
379
|
完了条件:
|
|
380
380
|
|
|
381
|
-
- [x] rollback trim を自動実装してよい host と、手動案内に留める host が判断できる。Codex は 2026-05-08 unblock 後、Stop hook auto-refresh と明示 execute を許可する。2026-05-09 以降の auto-refresh 既定閾値は verified usage
|
|
381
|
+
- [x] rollback trim を自動実装してよい host と、手動案内に留める host が判断できる。Codex は 2026-05-08 unblock 後、Stop hook auto-refresh と明示 execute を許可する。2026-05-09 以降の auto-refresh 既定閾値は verified usage 75%。Claude は manual-only。
|
|
382
382
|
|
|
383
383
|
## Phase 7: Trim Handoff Model
|
|
384
384
|
|
|
@@ -19,7 +19,7 @@ model-visible input に入ることは controlled smoke で再現していませ
|
|
|
19
19
|
run の retained text は risk evidence として残す一方、単独では mutation 前 blocker にしません。
|
|
20
20
|
Codex current-thread trim は、明示 `--execute`、Throughline DB injectable memory、
|
|
21
21
|
Codex thread identity、rollout/app-server turn-count guard を条件に実行します。Codex Stop hook
|
|
22
|
-
auto-refresh は verified usage
|
|
22
|
+
auto-refresh は verified usage 75% 以上で同じ guarded path を試行し、estimate usage では実行しません。
|
|
23
23
|
|
|
24
24
|
最初のインシデント仮説に対する重要な訂正:
|
|
25
25
|
|
|
@@ -644,8 +644,13 @@ TODO:
|
|
|
644
644
|
という記述を訂正する。
|
|
645
645
|
- [x] hypothesis を compacted replacement-history restore に言及する形へ更新する。
|
|
646
646
|
- [x] Codex Rewind-equivalent trim が complete だという roadmap claim を格下げする。
|
|
647
|
-
- [x] Codex auto-refresh は verified usage
|
|
647
|
+
- [x] Codex auto-refresh は verified usage 75% 以上で guarded rollback / inject を
|
|
648
648
|
実行する。estimate usage では実行しない。
|
|
649
|
+
- [x] Codex 75% trigger は token-monitor 依存にしない。Codex `UserPromptSubmit`
|
|
650
|
+
/ `PostToolUse` hooks が当該 session の rollout `token_count` を直接読み、
|
|
651
|
+
verified 75% 以上なら current session へ `$throughline` workflow 実行指示を
|
|
652
|
+
注入する。`PostToolUse` により、tool loop 中に閾値を超えた場合も次の継続前に
|
|
653
|
+
同じ判定を走らせる。
|
|
649
654
|
- [x] 新セッションが古い「Codex side complete」claim ではなく、この fix plan から
|
|
650
655
|
再開できるように `CLAUDE.md` を更新する。
|
|
651
656
|
|
|
@@ -263,7 +263,7 @@ Codex で考えられる流れ:
|
|
|
263
263
|
9. ユーザーは同じ Codex thread で続行する。
|
|
264
264
|
```
|
|
265
265
|
|
|
266
|
-
現行実装では、Codex Stop hook 後の
|
|
266
|
+
現行実装では、Codex Stop hook 後の 75% automatic refresh は guarded rollback / inject
|
|
267
267
|
mutation を試行する。明示 CLI の `throughline trim --execute --host codex --codex-thread-id <id>`
|
|
268
268
|
も env gate なしで実行する。明示 Codex thread identity、injectable Throughline DB memory、
|
|
269
269
|
rollout/app-server turn count guard は live mutation の最低条件であり、durable success は
|
package/package.json
CHANGED
|
@@ -101,7 +101,7 @@ function renderTextResult(result) {
|
|
|
101
101
|
lines.push(` L1 summaries: ${result.l1Summaries}`);
|
|
102
102
|
lines.push(` recent L2 bodies: ${result.recentBodies}`);
|
|
103
103
|
lines.push(` L3 references: ${result.l3References}`);
|
|
104
|
-
lines.push(` rendered detail
|
|
104
|
+
lines.push(` rendered detail suffixes: ${result.renderedDetailSuffixes}`);
|
|
105
105
|
lines.push('');
|
|
106
106
|
lines.push(' checks:');
|
|
107
107
|
for (const check of result.checks) {
|