throughline 0.4.2 → 0.4.3

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 CHANGED
@@ -10,6 +10,17 @@ shipped to npm but were not individually tagged on GitHub.
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.4.3] — 2026-05-09
14
+
15
+ ### Changed
16
+
17
+ - Changed the installed Codex `$throughline` skill so bare `$throughline` runs
18
+ the scripted current-thread refresh directly:
19
+ `throughline trim --execute --host codex --all --json`. Doctor, dry-run,
20
+ preflight, restore-safety analysis, host primitive audit, and fresh-thread
21
+ handoff remain available only when explicitly requested instead of being the
22
+ normal skill path.
23
+
13
24
  ## [0.4.2] — 2026-05-09
14
25
 
15
26
  ### Fixed
package/README.ja.md CHANGED
@@ -188,7 +188,8 @@ adapter / projection として追加されます。
188
188
  Codex sidecar を使えます。使えない場合は、従来どおり Claude Haiku 経路を使います。
189
189
 
190
190
  Codex 側 trim (= same-thread context trim) は `throughline trim --execute --host codex`
191
- で発火します。Claude 側は `/clear` での auto path 引継ぎが本線になったため、
191
+ で発火します。Codex bare `$throughline` skill もこの scripted rollback + DB
192
+ memory inject を直接実行します。Claude 側は `/clear` での auto path 引継ぎが本線になったため、
192
193
  `/tl-trim` slash command は v0.4.0 で廃止されました。current-work framing は
193
194
  SessionStart 注入の Reading Contract / Continuation Instruction で同じ意図を
194
195
  継承しています。
@@ -233,7 +234,7 @@ throughline monitor --session <id-prefix>
233
234
  | `throughline codex-sidecar-diagnostics` | この project の `codex-sidecar` diagnostics status を確認 |
234
235
  | `throughline codex-sidecar-dry-run` | App Server を呼ばずに read-only sidecar request を正規化表示 |
235
236
  | `throughline trim --dry-run --host codex` | Codex same-thread trim の dry-run preview |
236
- | `throughline trim --execute --host codex` | Codex 同 thread の guarded rollback + DB memory inject |
237
+ | `throughline trim --execute --host codex` | Codex 同 thread の scripted rollback + DB memory inject |
237
238
  | `throughline doctor --session <id-prefix>` | 特定セッションの state/transcript ズレを診断 |
238
239
  | `throughline status` | DB 統計表示 (sessions / skeletons / bodies / details) |
239
240
  | `throughline --version` | インストール済みバージョンを表示 |
package/README.md CHANGED
@@ -33,8 +33,10 @@ hook invokes the installed `bin/throughline.mjs` through an absolute Node path,
33
33
  so Codex App Server PATH differences do not hide the command. It is registered
34
34
  synchronously (`async: false`), matching the Codex hook behavior verified in
35
35
  Caveat. Existing non-Throughline Codex hooks are preserved. It also installs a
36
- global `$throughline` Codex skill, so in Codex you can ask for Throughline
37
- status, resume, summarize, or trim without typing the full guarded command.
36
+ global `$throughline` Codex skill. Bare `$throughline` runs the scripted
37
+ current-thread rollback + Throughline DB memory injection directly; ask
38
+ explicitly for status, resume, summarize, diagnostics, or fresh-thread handoff
39
+ when you want those read-only surfaces instead.
38
40
 
39
41
  ## How it compares
40
42
 
@@ -344,6 +346,7 @@ throughline trim --dry-run --host codex --codex-thread-id <id>
344
346
  throughline trim --dry-run --host codex --codex-thread-id <id> --preview-max-chars 4000
345
347
  throughline trim --preflight --host codex --codex-thread-id <id>
346
348
  CODEX_THREAD_ID=<id> throughline trim --preflight --host codex
349
+ throughline trim --execute --host codex --all --json
347
350
  # read-only app-server process restart smoke; not full VS Code restart-safe proof:
348
351
  # THROUGHLINE_EXPERIMENTAL_CODEX_RESTORE_SMOKE=1 throughline codex-restore-smoke --codex-thread-id <id> --json
349
352
  # read-only local restore source inventory; not full VS Code restart-safe proof:
@@ -673,7 +676,7 @@ entry to the `tasks` array yourself:
673
676
  | `throughline codex-sidecar-dry-run` | Print a normalized read-only sidecar request without running the app server |
674
677
  | `throughline trim --dry-run --host codex` | Preview Codex same-thread context trim memory and host boundary; does not rollback automatically |
675
678
  | `throughline trim --preflight --host codex` | Read/resume the explicit Codex thread and verify turn-count guards without rollback/inject |
676
- | `throughline trim --execute --host codex` | Explicit Codex rollback-inject path; requires Codex thread identity, injectable DB memory, and rollout/app-server turn-count agreement |
679
+ | `throughline trim --execute --host codex` | Scripted Codex current-thread rollback + Throughline DB memory inject; this is what bare `$throughline` runs in Codex |
677
680
  | `throughline status` | Print DB statistics (sessions, skeletons, bodies, details) |
678
681
  | `throughline --version` | Print the installed version |
679
682
 
@@ -8,20 +8,21 @@ description: Use when the user asks to use Throughline from Codex, continue or r
8
8
  Use this skill to operate Throughline from Codex without making the user type long
9
9
  commands.
10
10
 
11
- If the user invokes `$throughline` by itself, treat that as a request to inspect
12
- the current Codex context and prepare a refresh plan. Codex rollback / inject is
13
- enabled again after controlled rollback model-visible smokes failed to reproduce
14
- rollback marker resurrection.
11
+ If the user invokes `$throughline` by itself, treat that as a request to run the
12
+ scripted current-thread refresh now. The normal path is not an AI planning
13
+ exercise: it rolls back the current Codex thread and injects Throughline DB
14
+ memory using the original `/tl` contract.
15
15
 
16
16
  ## Core Rule
17
17
 
18
18
  Do not ask the user for a Codex thread id when the current environment can
19
19
  provide it. Prefer the current `CODEX_THREAD_ID` / `THROUGHLINE_CODEX_THREAD_ID`
20
- identity and verify it with `throughline doctor --codex`.
20
+ identity.
21
21
 
22
- Do not manually capture payloads before checking natural Stop hook capture.
23
- If natural capture looks wrong, inspect `doctor --codex`, the latest rollout,
24
- and hook logs first.
22
+ For bare `$throughline`, do not run doctor / dry-run / handoff / preflight first
23
+ and do not ask for confirmation. Execute the script command directly. If it
24
+ fails, report the error plainly instead of silently falling back to another
25
+ memory source or a fresh-thread handoff.
25
26
 
26
27
  ## Common Requests
27
28
 
@@ -30,27 +31,21 @@ and hook logs first.
30
31
  Run:
31
32
 
32
33
  ```bash
33
- throughline doctor --codex
34
- throughline trim --dry-run --host codex --all --json
35
- throughline codex-handoff-start --session codex:<current-thread-id> --json
36
- throughline trim --preflight --host codex --all --json
34
+ throughline trim --execute --host codex --all --json
37
35
  ```
38
36
 
39
- This is the safe Codex context-refresh inspection flow. `--all` previews a
40
- rollback-based reset of the model-visible thread. `codex-handoff-start` is an
41
- optional fresh-thread continuation surface: it validates the handoff, shows the
42
- model-smoke dry-run boundary, and can render the prompt with `--print-prompt`
43
- without mutating the current thread. Report the preflight result, handoff-start
44
- status, and context reduction estimate from the dry-run. Do not claim the
45
- refresh happened unless `trim --execute` or auto-refresh actually ran.
37
+ This is the scripted Codex context-refresh flow. It mutates the current Codex
38
+ thread by sending rollback + Throughline DB memory injection. Report only the
39
+ execution status, whether rollback / inject were sent, whether durable evidence
40
+ was observed, and the selected memory session.
46
41
 
47
42
  The injected memory must preserve the original `/tl` memory contract:
48
43
 
49
- - older turns: L1 summaries
50
44
  - recent work: L2 full bodies for the latest 20 turns
45
+ - older turns: L1 summaries
51
46
  - L3: detail references only; L3 bodies / tool payloads are not injected
52
47
 
53
- If the dry-run reports no captured turns or no injectable memory, say that
48
+ If there are no captured turns or no injectable Throughline DB memory, say that
54
49
  clearly.
55
50
 
56
51
  ### "Throughline status" / "doctor"
@@ -104,9 +99,19 @@ back to Claude Haiku.
104
99
 
105
100
  ### "trim" / "rewind" / "rollback" / "context cleanup"
106
101
 
107
- Default to the same inspection flow as bare `$throughline` when the user
102
+ Default to the same scripted execute flow as bare `$throughline` when the user
108
103
  asks to trim, rewind, rollback, clean up context, or use Throughline memory.
109
104
 
105
+ Execute:
106
+
107
+ ```bash
108
+ throughline trim --execute --host codex --all --json
109
+ ```
110
+
111
+ Report only the essential outcome. Do not introduce fresh-thread handoff,
112
+ restore-safety analysis, host primitive audit, or dry-run planning unless the
113
+ user explicitly asks for those diagnostics.
114
+
110
115
  Preview:
111
116
 
112
117
  ```bash
@@ -141,17 +146,17 @@ Execute path:
141
146
  throughline trim --execute --host codex --all
142
147
  ```
143
148
 
144
- Run this only when the user explicitly wants the current thread trimmed. It sends
145
- rollback + Throughline DB memory injection after the app-server guard checks.
149
+ This is the same command used by bare `$throughline`.
146
150
 
147
151
  ## User-Facing Explanation
148
152
 
149
153
  Explain the behavior simply:
150
154
 
151
155
  - normal Codex turn end: Stop hook captures DB memory and writes monitor state
152
- - `$throughline` / context refresh: doctor, dry-run, preflight, and optional
153
- execute; execute mutates the current Codex thread
154
- - Stop hook auto-refresh attempts rollback / inject when verified usage reaches
155
- 90%; estimate usage does not trigger mutation
156
- - dry-run reports estimated savings when there are rollback candidate turns, but
157
- exact host-visible token reduction is not yet measured with the host tokenizer
156
+ - `$throughline` / context refresh: one script command mutates the current Codex
157
+ thread by rollback + memory inject
158
+ - injected memory is L2 latest 20 full bodies + older L1 summaries + L3
159
+ references only
160
+ - diagnostics such as doctor, dry-run, preflight, fresh-thread handoff, restore
161
+ safety, and host primitive audit are optional tools, not the normal
162
+ `$throughline` path
@@ -1,7 +1,7 @@
1
1
  interface:
2
2
  display_name: "Throughline"
3
3
  short_description: "Operate Throughline memory, Codex capture, resume, and trim"
4
- default_prompt: "Use $throughline to check capture, resume memory, summarize, inspect guarded Codex trim, or prepare a safe fresh-thread handoff without typing long commands."
4
+ default_prompt: "Use $throughline to run the scripted current-thread rollback + Throughline memory inject, or explicitly ask for status, resume, summarize, diagnostics, or fresh-thread handoff."
5
5
 
6
6
  policy:
7
7
  allow_implicit_invocation: true
@@ -440,7 +440,7 @@ Phase 5 implementation status (2026-05-06):
440
440
  - [x] `doctor --codex` は Claude settings を変更しない。Codex primary entrypoint の診断に限定する。
441
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
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 以降、skilldiagnostics / dry-run / preflight を既定の確認 flow とし、ユーザーが current-thread trim を明示した場合は `trim --execute --host codex --all` を案内する。
443
+ - [x] Codex primary の setup / install 手順は README に記録した。global install は Codex Stop hook と `$throughline` skill を自動登録する。2026-05-09 以降、bare `$throughline` AI による診断 flow ではなく `trim --execute --host codex --all --json` を直接走らせる scripted current-thread refresh とする。diagnostics / dry-run / preflight / fresh-thread handoff は明示要求時だけ使う。
444
444
  - [x] `codex-summarize` を明示診断・運用 flow に追加した。Codex CLI backend を使い、Claude Haiku へ fallback しない。
445
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
446
  - `codex-capture`: `capturedTurns = 41`, `capturedRows = 75`, `capturedDetails = 2424`
@@ -459,8 +459,8 @@ Phase 5 implementation status (2026-05-06):
459
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
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
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 ではなく、安全な現状確認として扱う。
462
+ - historical 2026-05-07 correction: 以下の Codex trim smoke は live app-server primitive の履歴として残す。ただし 2026-05-06 incident 後、restart / reconnect 越しの durable context trim 成功とは一時的に扱わず、`$throughline` / Codex Stop hook automatic mutation を止めていた。
463
+ - 2026-05-09 UX 修正: bare `$throughline` は `doctor --codex` / `trim --dry-run --all` / `trim --preflight --all` を AI に順番実行させる説明 surface ではなく、`throughline trim --execute --host codex --all --json` を直接実行する scripted current-thread refresh に戻す。注入 memory L2 最新 20 full bodies + L1 older summaries + L3 references only。diagnostics / dry-run / preflight / fresh-thread handoff は明示要求時だけ使う。
464
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
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
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 で削減できない」という意味ではない。
@@ -21,6 +21,8 @@
21
21
 
22
22
  2026-05-08 unblock: その後の切り分けで、incident thread の retained text は app-server response 上では `aggregatedOutput` など quoted/tool-output field に分類され、controlled rollback model-visible smoke は app-server restart 境界と VS Code reload/reconnect 境界の両方で `not-reproduced` だった。これを受け、Codex `trim --execute --host codex` と Stop hook auto-refresh の過剰 blocker は解除する。`compacted.replacement_history` retention、restore-safety risk、host primitive audit は引き続き diagnostics だが、単独では mutation 前 refusal にしない。DB memory 不在と rollout/app-server turn-count 不一致は引き続き mutation 前 blocker。
23
23
 
24
+ 2026-05-09 skill UX: bare `$throughline` は diagnostics / dry-run / preflight を AI に順番実行させる surface ではなく、`throughline trim --execute --host codex --all --json` を直接走らせる scripted current-thread refresh とする。目的は rollback と、Throughline DB の L2 最新 20 full bodies + older L1 summaries + L3 references-only memory injection のみ。doctor / dry-run / preflight / fresh-thread handoff / restore-safety / host primitive audit は明示診断用であり、通常 `$throughline` の前段にはしない。
25
+
24
26
  2026-05-07 host primitive audit: `throughline codex-host-primitive-audit` で installed Codex app-server schema を機械監査した。`thread/rollback` / `thread/inject_items` / `thread/compact/start` / `thread/start` / `thread/fork` / `thread/resume` は存在するが、rollback 済み user text を current-thread の model-visible input へ復活させない deletion / isolation / projection primitive は見つからなかった。`thread/resume(history)` は schema 上 `[UNSTABLE] FOR CODEX CLOUD - DO NOT USE` で、`thread_id` も ignored になるため、Throughline の current-thread repair primitive には採用しない。
25
27
 
26
28
  ## 概要
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "throughline",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "type": "module",
5
5
  "description": "Claude Code hooks plugin for structured context compression (/clear-safe persistent memory)",
6
6
  "keywords": [
@@ -133,10 +133,11 @@ test('global install copies Throughline Codex skill to ~/.codex/skills/', async
133
133
  const metadataBody = readFileSync(metadata, 'utf8');
134
134
  assert.match(skillBody, /name: throughline/);
135
135
  assert.match(skillBody, /Bare "\$throughline"/);
136
- assert.match(skillBody, /throughline codex-handoff-start --session codex:<current-thread-id> --json/);
137
136
  assert.match(skillBody, /throughline trim --execute --host codex --all/);
138
- assert.match(metadataBody, /inspect guarded Codex trim/);
137
+ assert.match(skillBody, /do not run doctor \/ dry-run \/ handoff \/ preflight first/);
138
+ assert.match(metadataBody, /scripted current-thread rollback \+ Throughline memory inject/);
139
139
  assert.doesNotMatch(metadataBody, /preview blocked Codex trim/);
140
+ assert.doesNotMatch(metadataBody, /inspect guarded Codex trim/);
140
141
  } finally {
141
142
  unsilence();
142
143
  home.restore();