throughline 0.10.3 → 0.10.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +82 -29
  2. package/README.ja.md +79 -47
  3. package/README.md +103 -78
  4. package/bin/throughline.mjs +32 -13
  5. package/docs/00_overview.md +56 -43
  6. package/docs/01_l1_l2_l3_redesign.md +1 -1
  7. package/docs/02_clear_auto_handoff_plan.md +39 -333
  8. package/docs/04_public_release_plan.md +77 -190
  9. package/docs/05_codex_first_roadmap.md +4 -4
  10. package/docs/06_codex_trim_rollback_fix_plan.md +1 -1
  11. package/docs/08_codex_dual_support.md +1 -1
  12. package/docs/09_rollback_context_trim_insight.md +1 -1
  13. package/docs/12_desktop_clear_handoff_plan.md +6 -213
  14. package/docs/15_windows_ci_release_latency_plan.md +6 -87
  15. package/docs/16_readonly_handoff_context_plan.md +7 -38
  16. package/docs/adr/0005-observer-read-pagination.md +1 -1
  17. package/docs/adr/0014-two-phase-handoff-ghost-baton.md +1 -1
  18. package/docs/adr/0019-product-owned-database-migration-acceptance.md +1 -1
  19. package/docs/adr/0021-grok-host-capture.md +1 -1
  20. package/docs/archive/02_clear_auto_handoff_plan.md +350 -0
  21. package/docs/{03_inheritance_on_clear_only.md → archive/03_inheritance_on_clear_only.md} +22 -22
  22. package/docs/{07_codex_trim_implementation_plan.md → archive/07_codex_trim_implementation_plan.md} +8 -8
  23. package/docs/{10_transcript_injection_plan.md → archive/10_transcript_injection_plan.md} +12 -12
  24. package/docs/archive/12_desktop_clear_handoff_plan.md +218 -0
  25. package/docs/{14_observer_completed_turn_feed_plan.md → archive/14_observer_completed_turn_feed_plan.md} +7 -7
  26. package/docs/archive/15_windows_ci_release_latency_plan.md +89 -0
  27. package/docs/archive/16_readonly_handoff_context_plan.md +40 -0
  28. package/docs/archive/README.md +28 -15
  29. package/docs/archive/plan_grok-successor-launch.md +99 -0
  30. package/docs/archive/room-log_throughline_20260830-155052.md +285 -0
  31. package/docs/plan_grok-successor-launch.md +6 -97
  32. package/package.json +11 -4
  33. package/rag/INDEX.md +2 -2
  34. package/src/baton.mjs +11 -9
  35. package/src/cli/handoff-context.test.mjs +36 -0
  36. package/src/cli/help.test.mjs +5 -0
  37. package/src/cli/runtime-errors.mjs +9 -3
  38. package/src/cli/runtime-errors.test.mjs +13 -13
  39. package/src/cli/self-update.mjs +402 -0
  40. package/src/cli/self-update.test.mjs +525 -0
  41. package/src/db.mjs +1 -1
  42. package/src/docs-contract.test.mjs +153 -0
  43. package/src/product-ci-contract.test.mjs +14 -0
  44. package/src/prompt-submit.mjs +8 -10
  45. package/src/resume-context.mjs +4 -4
  46. package/src/runtime-error-hook.test.mjs +4 -6
  47. package/src/runtime-error-store.mjs +40 -18
  48. package/src/runtime-error-store.test.mjs +53 -26
  49. package/src/session-merger.mjs +16 -7
  50. package/src/session-merger.test.mjs +27 -0
  51. package/src/spike-transcript-writer.mjs +1 -1
  52. /package/docs/{11_codex_monitor_implementation_plan.md → archive/11_codex_monitor_implementation_plan.md} +0 -0
  53. /package/docs/{13_native_factory_diagnostics_plan.md → archive/13_native_factory_diagnostics_plan.md} +0 -0
  54. /package/docs/{BUGHUB_RUNTIME_ERROR_STORE_PLAN.md → archive/BUGHUB_RUNTIME_ERROR_STORE_PLAN.md} +0 -0
package/CHANGELOG.md CHANGED
@@ -10,6 +10,56 @@ shipped to npm but were not individually tagged on GitHub.
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.10.6] — 2026-09-01
14
+
15
+ ### Fixed
16
+
17
+ - Document the one-time official npm bootstrap required when upgrading from
18
+ v0.10.4 or earlier, whose CLI predates `throughline self-update`. Once the
19
+ current CLI is installed, all later updates continue through the single
20
+ `throughline self-update` entry.
21
+
22
+ ## [0.10.5] — 2026-09-01
23
+
24
+ ### Added
25
+
26
+ - `throughline self-update` now owns the complete product update path: official
27
+ npm package update, integration reapplication, existing-database migration,
28
+ installed-version verification, and public diagnostics. Factory callers no
29
+ longer need to interpret Throughline's migration schema. It resolves the new
30
+ CLI from npm's global root, rejects old-CLI help or malformed handshakes even
31
+ when they exit zero, requires overall diagnostics readiness, preserves child
32
+ errors, and uses `npm.cmd` through PowerShell 7 on Windows. It also refuses a
33
+ mixed-prefix update when the public `throughline` on PATH does not resolve to
34
+ the newly installed CLI and version.
35
+
36
+ ### Fixed
37
+
38
+ - Session inheritance now refuses to reassign L1/L2/L3 memory when the named
39
+ predecessor and successor belong to different projects. Project-scoped
40
+ predecessor discovery already filtered candidates, but the final merge
41
+ state transition did not enforce the same ownership invariant itself.
42
+
43
+ ## [0.10.4] — 2026-08-30
44
+
45
+ ### Changed
46
+
47
+ - Runtime-error collection is now configured and owned by Throughline itself.
48
+ `throughline runtime-errors enable|disable --json` writes the private,
49
+ versioned product config under the Throughline config directory. The runtime
50
+ no longer reads dotagents factory-reporter configuration; factory integration
51
+ uses the public `runtime-errors ... --json` boundary.
52
+ - Corrected the documented Claude handoff boundary: built-in `/clear` does not
53
+ reach `UserPromptSubmit`; VS Code uses `SessionStart source='clear'`, while
54
+ Claude Desktop requires `/tl` before `/clear`.
55
+ - Moved the completed v0.4 auto-handoff plan into `docs/archive/` and replaced
56
+ the current path with a concise current contract. Fixed Lattice consumers of
57
+ other archived plans keep small compatibility entrypoints.
58
+ - Product-owned CI now runs `npm run verify:docs` for Markdown-only changes,
59
+ checking local links, the document/archive indexes, compatibility stubs, and
60
+ relative link/image closure inside the actual npm tarball file list.
61
+ - The Windows-native product CI path now uses PowerShell 7 exclusively.
62
+
13
63
  ## [0.10.3] — 2026-08-24
14
64
 
15
65
  ### Added
@@ -472,7 +522,7 @@ are absent and have no effect on the shipped path.
472
522
 
473
523
  ### Added
474
524
 
475
- - `docs/10_transcript_injection_plan.md`: full Phase 0 plan and
525
+ - `docs/archive/10_transcript_injection_plan.md`: full Phase 0 plan and
476
526
  result log for the D / `initialUserMessage` investigation.
477
527
  - `rag/`: third-party spec knowledge base (Claude Code hooks
478
528
  reference, Anthropic Messages API, sessions docs, openclaude
@@ -1320,31 +1370,34 @@ two attempts, instrument first instead of patching again.
1320
1370
 
1321
1371
  ---
1322
1372
 
1323
- [Unreleased]: https://github.com/kitepon-rgb/Throughline/compare/v0.10.3...HEAD
1324
- [0.10.3]: https://github.com/kitepon-rgb/Throughline/compare/v0.10.2...v0.10.3
1325
- [0.10.2]: https://github.com/kitepon-rgb/Throughline/compare/v0.10.1...v0.10.2
1326
- [0.10.1]: https://github.com/kitepon-rgb/Throughline/compare/v0.10.0...v0.10.1
1327
- [0.10.0]: https://github.com/kitepon-rgb/Throughline/compare/v0.9.1...v0.10.0
1328
- [0.9.1]: https://github.com/kitepon-rgb/Throughline/compare/v0.9.0...v0.9.1
1329
- [0.9.0]: https://github.com/kitepon-rgb/Throughline/compare/v0.8.9...v0.9.0
1330
- [0.8.9]: https://github.com/kitepon-rgb/Throughline/compare/v0.8.8...v0.8.9
1331
- [0.8.8]: https://github.com/kitepon-rgb/Throughline/compare/v0.8.7...v0.8.8
1332
- [0.8.7]: https://github.com/kitepon-rgb/Throughline/compare/v0.8.6...v0.8.7
1333
- [0.8.6]: https://github.com/kitepon-rgb/Throughline/compare/v0.8.5...v0.8.6
1334
- [0.8.5]: https://github.com/kitepon-rgb/Throughline/compare/v0.8.4...v0.8.5
1335
- [0.8.4]: https://github.com/kitepon-rgb/Throughline/compare/v0.8.3...v0.8.4
1336
- [0.8.3]: https://github.com/kitepon-rgb/Throughline/compare/v0.8.2...v0.8.3
1337
- [0.8.2]: https://github.com/kitepon-rgb/Throughline/compare/v0.8.1...v0.8.2
1338
- [0.8.1]: https://github.com/kitepon-rgb/Throughline/compare/v0.8.0...v0.8.1
1339
- [0.8.0]: https://github.com/kitepon-rgb/Throughline/compare/v0.7.0...v0.8.0
1340
- [0.7.0]: https://github.com/kitepon-rgb/Throughline/compare/v0.6.3...v0.7.0
1341
- [0.6.3]: https://github.com/kitepon-rgb/Throughline/compare/v0.6.2...v0.6.3
1342
- [0.6.2]: https://github.com/kitepon-rgb/Throughline/compare/v0.6.1...v0.6.2
1343
- [0.3.22]: https://github.com/kitepon-rgb/Throughline/releases/tag/v0.3.22
1344
- [0.3.21]: https://github.com/kitepon-rgb/Throughline/compare/v0.3.19...v0.3.21
1345
- [0.3.20]: https://github.com/kitepon-rgb/Throughline/compare/v0.3.19...v0.3.20
1346
- [0.3.19]: https://github.com/kitepon-rgb/Throughline/releases/tag/v0.3.19
1347
- [0.3.18]: https://github.com/kitepon-rgb/Throughline/releases/tag/v0.3.18
1348
- [0.3.0]: https://github.com/kitepon-rgb/Throughline/releases/tag/v0.3.0
1349
- [0.2.0]: https://github.com/kitepon-rgb/Throughline/releases/tag/v0.2.0
1350
- [0.1.0]: https://github.com/kitepon-rgb/Throughline/compare/v0.1.0
1373
+ [Unreleased]: https://github.com/kitepon/Throughline/compare/v0.10.6...HEAD
1374
+ [0.10.6]: https://github.com/kitepon/Throughline/compare/v0.10.5...v0.10.6
1375
+ [0.10.5]: https://github.com/kitepon/Throughline/compare/v0.10.4...v0.10.5
1376
+ [0.10.4]: https://github.com/kitepon/Throughline/compare/v0.10.3...v0.10.4
1377
+ [0.10.3]: https://github.com/kitepon/Throughline/compare/v0.10.2...v0.10.3
1378
+ [0.10.2]: https://github.com/kitepon/Throughline/compare/v0.10.1...v0.10.2
1379
+ [0.10.1]: https://github.com/kitepon/Throughline/compare/v0.10.0...v0.10.1
1380
+ [0.10.0]: https://github.com/kitepon/Throughline/compare/v0.9.1...v0.10.0
1381
+ [0.9.1]: https://github.com/kitepon/Throughline/compare/v0.9.0...v0.9.1
1382
+ [0.9.0]: https://github.com/kitepon/Throughline/compare/v0.8.9...v0.9.0
1383
+ [0.8.9]: https://github.com/kitepon/Throughline/compare/v0.8.8...v0.8.9
1384
+ [0.8.8]: https://github.com/kitepon/Throughline/compare/v0.8.7...v0.8.8
1385
+ [0.8.7]: https://github.com/kitepon/Throughline/compare/v0.8.6...v0.8.7
1386
+ [0.8.6]: https://github.com/kitepon/Throughline/compare/v0.8.5...v0.8.6
1387
+ [0.8.5]: https://github.com/kitepon/Throughline/compare/v0.8.4...v0.8.5
1388
+ [0.8.4]: https://github.com/kitepon/Throughline/compare/v0.8.3...v0.8.4
1389
+ [0.8.3]: https://github.com/kitepon/Throughline/compare/v0.8.2...v0.8.3
1390
+ [0.8.2]: https://github.com/kitepon/Throughline/compare/v0.8.1...v0.8.2
1391
+ [0.8.1]: https://github.com/kitepon/Throughline/compare/v0.8.0...v0.8.1
1392
+ [0.8.0]: https://github.com/kitepon/Throughline/compare/v0.7.0...v0.8.0
1393
+ [0.7.0]: https://github.com/kitepon/Throughline/compare/v0.6.3...v0.7.0
1394
+ [0.6.3]: https://github.com/kitepon/Throughline/compare/v0.6.2...v0.6.3
1395
+ [0.6.2]: https://github.com/kitepon/Throughline/compare/v0.6.1...v0.6.2
1396
+ [0.3.22]: https://github.com/kitepon/Throughline/releases/tag/v0.3.22
1397
+ [0.3.21]: https://github.com/kitepon/Throughline/compare/v0.3.19...v0.3.21
1398
+ [0.3.20]: https://github.com/kitepon/Throughline/compare/v0.3.19...v0.3.20
1399
+ [0.3.19]: https://github.com/kitepon/Throughline/releases/tag/v0.3.19
1400
+ [0.3.18]: https://github.com/kitepon/Throughline/releases/tag/v0.3.18
1401
+ [0.3.0]: https://github.com/kitepon/Throughline/releases/tag/v0.3.0
1402
+ [0.2.0]: https://github.com/kitepon/Throughline/releases/tag/v0.2.0
1403
+ [0.1.0]: https://github.com/kitepon/Throughline/compare/v0.1.0
package/README.ja.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <p align="center">
2
- <img src=".github/og.png" alt="Throughline — 環境や境界が変わっても方向と記憶を保って進むクジラの群れ" width="100%">
2
+ <img src="https://raw.githubusercontent.com/kitepon/Throughline/main/.github/og.png" alt="Throughline — 環境や境界が変わっても方向と記憶を保って進むクジラの群れ" width="100%">
3
3
  <br>
4
4
  <sub><em>この画像は、環境や境界が変わっても、関係・方向・記憶を失わずに進み続ける連続性を表しています。</em></sub>
5
5
  </p>
@@ -9,7 +9,7 @@
9
9
  [![npm version](https://img.shields.io/npm/v/throughline.svg?color=cb3837&logo=npm)](https://www.npmjs.com/package/throughline)
10
10
  [![license](https://img.shields.io/npm/l/throughline.svg?color=blue)](LICENSE)
11
11
  [![node](https://img.shields.io/node/v/throughline.svg?color=339933&logo=node.js&logoColor=white)](https://nodejs.org)
12
- [![CI](https://github.com/kitepon-rgb/Throughline/actions/workflows/test.yml/badge.svg)](https://github.com/kitepon-rgb/Throughline/actions/workflows/test.yml)
12
+ [![CI](https://github.com/kitepon/Throughline/actions/workflows/test.yml/badge.svg)](https://github.com/kitepon/Throughline/actions/workflows/test.yml)
13
13
 
14
14
  [English](README.md) · **日本語**
15
15
 
@@ -21,9 +21,10 @@
21
21
 
22
22
  ## 所有境界
23
23
 
24
- 本repositoryはdatabase、migration、capture契約、release、diagnosticsを所有します。
25
- 製品横断の導入とhost統合は、kitepon.devの製品開発を支える内部基盤
26
- [dotagents](https://github.com/kitepon-rgb/dotagents)が担当します。
24
+ 本repositoryは導入、設定、状態、schemaとmigration、診断、復旧、更新、release判断を
25
+ 所有します。Throughlineは文書化したCLIだけで単独運用でき、工場の制御装置を必要としません。
26
+ [dotagents](https://github.com/kitepon/dotagents)はkitepon.dev開発工場への配線と統合契約を
27
+ 担当しますが、Throughlineの状態や製品寿命を所有・制御しません。
27
28
  MarkItDownは別区分の第三者CLIです。
28
29
 
29
30
  ## 30 秒で始める
@@ -34,9 +35,10 @@ throughline install # hook / Codex skill / VS Code monitor task を登録
34
35
  ```
35
36
 
36
37
  これだけ。Claude Code のセッションを開けば、以後すべてのターンが
37
- `~/.throughline/throughline.db` に自動で流れていく。50 ターン作業した後、
38
- `/clear` を打てば新セッションはゼロからではなく、**思考の途中から再開** される。
39
- `/clear` を経由しない新規 chat / VS Code 再起動では `/tl` で前任を指名できる。
38
+ `~/.throughline/throughline.db` に自動で流れていく。VS Code では `/clear` 後の
39
+ `SessionStart source='clear'` から自動で再開する。Claude Desktop はその source を
40
+ 送らないため、`/clear` の前に `/tl` を実行する。新規 chat や再起動でも、前任を
41
+ 確定的に指名したいときは境界の前に `/tl` を使う。
40
42
 
41
43
  Grok Desktop も first-class host である。`throughline install` は
42
44
  `~/.grok/hooks/throughline.json` を書く。Grok では `/tl` は今の窓へ注入せず、
@@ -105,8 +107,8 @@ current-thread rollback
105
107
  | **境界後に残る記憶** | ✅ 直近ターン本文そのまま (予算内ターン原子詰め) + それ以前は `recall` で pull + L3 オンデマンド | ❌ ゼロ | △ 一個の要約 (情報欠落) | △ 要約 (情報欠落) |
106
108
  | **ツール I/O の扱い** | L3 に退避、`/sc-detail HH:MM:SS` で取り戻せる | 消える | 要約に溶けて読めない | 要約に溶ける |
107
109
  | **コーディング用途への適合** | 高 — ツール I/O こそ重い 80% | 低 — 文脈が切れる | 中 — ただし不可逆 | 中 |
108
- | **誤継承リスク** | 低 (typed `/clear` / `/tl` が前任を指名) | n/a | n/a | 高 |
109
- | **ランタイム依存** | **ゼロ** (Node 22.5+ 同梱の `node:sqlite`) | n/a | n/a | 多数 |
110
+ | **誤継承リスク** | 低 (`/tl` は前任を指名、VS Code `/clear` はtranscriptのある候補を凍結) | n/a | n/a | 高 |
111
+ | **ランタイム依存** | **ゼロ** (Node 22.13+ 同梱の `node:sqlite`) | n/a | n/a | 多数 |
110
112
  | **マルチセッション トークン監視** | ✅ 実測 `message.usage` / Codex rollout `token_count` | — | — | — |
111
113
 
112
114
  **ひとことで**: `/clear` は全部捨てる、`/compact` は全部混ぜる、Throughline は **書いた本文はそのまま残し、ツール出力 (= 80% の重量物) だけ退避** する。
@@ -215,17 +217,18 @@ L3 に保存された `kind` 別 (ツール入力 / ツール出力 / hook 出
215
217
 
216
218
  ---
217
219
 
218
- ## 引き継ぎ: typed `/clear` / `/tl` が前任を指名、source-`clear` は補助
220
+ ## 引き継ぎ: `/tl` はbaton、VS Code `/clear` `source='clear'`
219
221
 
220
- Throughline 0.4.1+ の引き継ぎは 2 経路です。主経路は typed `/clear` または
221
- `/tl` が書く baton で、`source='clear'` の auto path は `/clear` が
222
- UserPromptSubmit hook に届かない場合の補助です。
222
+ 引き継ぎは2経路です。`/tl` のbatonは前任をsession idで確定指名します。
223
+ 適格なbatonが無い場合だけ、VS Code `/clear` `SessionStart source='clear'` から
224
+ transcriptのある前任を1件凍結します。消費時はbatonを先に確認します。
223
225
 
224
226
  ```mermaid
225
227
  flowchart LR
226
- U["ユーザーが入力<br/>/clear または /tl"] -->|UserPromptSubmit| W["writeBaton<br/>(session_id + TTL 1h)"]
228
+ U["ユーザーが入力<br/>/tl"] -->|UserPromptSubmit| W["writeBaton<br/>(session_id + TTL 1h)"]
227
229
  W --> B[("handoff_batons<br/>SQLite")]
228
- M["VS Code メニュー<br/>clear"] -->|UserPromptSubmit に届かない| X["baton 無し"]
230
+ M["VS Code<br/>/clear"] -->|SessionStart source='clear'| X["前任を凍結<br/>baton 無し"]
231
+ D["Claude Desktop<br/>/clear"] -->|source='startup'| N["自動引継ぎなし<br/>先に /tl"]
229
232
  NS["次の SessionStart<br/>(intent 登録のみ)"] --> FP["初回ユーザープロンプト<br/>(実セッションの証明)"]
230
233
  FP --> C{"baton<br/>あり?"}
231
234
  B -.-> C
@@ -244,14 +247,13 @@ flowchart LR
244
247
  class P3,INJ neutral
245
248
  ```
246
249
 
247
- ### baton path (primary): typed `/clear` または `/tl`
250
+ ### baton path: `/tl`
248
251
 
249
- ユーザーが prompt に `/clear` または `/tl` を打つと、UserPromptSubmit hook
250
- **そのセッションの** `session_id` を `handoff_batons` に書きます。次の新セッション
252
+ ユーザーが `/tl` を実行すると、UserPromptSubmit hook が**そのセッションの**
253
+ `session_id` を `handoff_batons` に書きます。次の新セッション
251
254
  は **初回ユーザープロンプト時** に baton を消費し(適格性: セッション誕生が baton
252
255
  書き込みから TTL 1 時間以内)、その前任を確定的に merge します。
253
- 複数ウィンドウで「最新更新セッション」と「今 `/clear` したセッション」が違っても、
254
- 指名された前任だけを引き継ぎます。
256
+ 複数ウィンドウでも指名された前任だけを引き継ぎます。
255
257
 
256
258
  なぜ SessionStart でなく初回プロンプトか: Claude Code は同一 project に数百 ms の
257
259
  間隔で複数の SessionStart を発火させることがあり、その一部は transcript を一切
@@ -260,22 +262,25 @@ flowchart LR
260
262
  が空で始まる事故が起きます。幽霊はプロンプトを発火しないので、消費を初回
261
263
  プロンプトへ遅延させればこの事故は構造的に起きません(二相ハンドオフ、ADR 0014)。
262
264
 
263
- ### auto path (fallback): `source='clear'`
265
+ ### auto path: VS Code `source='clear'`
264
266
 
265
- baton が無く、SessionStart の `source='clear'` が届いた場合だけ、同 project
267
+ 組み込み `/clear` は、実測したどの Claude Code クライアントでも
268
+ UserPromptSubmit hook に届きません。VS Code は代わりに SessionStart の
269
+ `source='clear'` を送ります。baton が無い場合だけ、同 project の
266
270
  最新 Claude predecessor を **SessionStart 時点で** 解決・凍結し(transcript の
267
- 無い幽霊は候補から除外)、merge + 注入は初回プロンプト時に行います。これは
268
- VS Code 拡張メニューなど、typed `/clear` が UserPromptSubmit hook に届かない
269
- 経路のための補助です。
271
+ 無い幽霊は候補から除外)、merge + 注入は初回プロンプト時に行います。
270
272
 
271
- `THROUGHLINE_DISABLE_AUTO_HANDOFF=1` はこの fallback path だけを OFF にします。
272
- typed `/clear` と `/tl` はユーザーの明示意思なので、この env に関係なく baton
273
- 書いて引き継ぎます。
273
+ `THROUGHLINE_DISABLE_AUTO_HANDOFF=1` はこのauto pathだけをOFFにし、明示 `/tl` の
274
+ batonは止めません。
275
+
276
+ Claude Desktop は組み込み `/clear` をUserPromptSubmitへ渡さず、SessionStartでも
277
+ `source='clear'` を送りません。Desktopでは `/clear` の前に `/tl` を実行します。
278
+ 対照実測とupstream報告はarchiveの
279
+ [`docs/12_desktop_clear_handoff_plan.md`](docs/archive/12_desktop_clear_handoff_plan.md)にあります。
274
280
 
275
281
  ```
276
- typed /clear: Session A → /clear → Session B (A baton を消費して merge)
277
- typed /tl: Session A /tl → chat / 再起動 Session B (A の baton を消費して merge)
278
- fallback: baton 無し + source='clear' → latest predecessor を merge
282
+ /tl: Session A → /tl → (/clear・新chat・再起動) → Session B (Aのbatonを消費)
283
+ VS Code: baton無し + /clear source='clear'transcriptのある直近前任をmerge
279
284
  ```
280
285
 
281
286
  ### 注入されるもの
@@ -300,7 +305,8 @@ extended thinking セクションは注入されません。
300
305
  各マージ行は `origin_session_id` を保持するので、繰り返し引き継ぐと
301
306
  記憶がチェーン状に蓄積します:
302
307
 
303
- ```
308
+ ```text
309
+ VS Code:
304
310
  S1 (4 ターン) --/clear--> S2 (S1 を auto-merge + 3 ターン追加) --/clear--> S3 (S2 を auto-merge + 5 ターン追加)
305
311
  origin=S1×4 origin=S1×4, S2×3, S3×5
306
312
  ```
@@ -320,10 +326,10 @@ adapter / projection として追加されます。
320
326
  backend 順は codex-sidecar(`summarize-l1` preset 明示設定時)→ Codex CLI
321
327
  (既定 `gpt-5.6-luna`)→ Claude Haiku です(ADR 0015)。
322
328
 
323
- Codex 側 trim (= same-thread context trim) は `throughline trim --execute --host codex`
324
- で発火します。Codex bare `$throughline` skill もこの scripted rollback + DB
325
- memory inject を直接実行します。Claude 側は `/clear` での auto path 引継ぎが本線になったため、
326
- `/tl-trim` slash command は v0.4.0 で廃止されました。current-work framing は
329
+ Codex 側 trim (= same-thread context trim) は、診断・実験として明示した場合だけ
330
+ `throughline trim --execute --host codex` で発火します。bare `$throughline`
331
+ `codex-handoff-start` による新スレッド handoff で、current thread をrollbackしません。
332
+ Claude 側の `/tl-trim` slash command は v0.4.0 で廃止されました。current-work framing は
327
333
  再開注入の Reading Contract / Continuation Instruction で同じ意図を
328
334
  継承しています。
329
335
 
@@ -367,13 +373,22 @@ Throughline state をまだ書いていない現在セッションも表示で
367
373
  | --- | --- |
368
374
  | `throughline install` | hook / Codex UserPromptSubmit・PostToolUse・Stop hook / Codex skill / `~/.grok/hooks/throughline.json` を登録し、VS Code 配下なら現プロジェクトの monitor task も配置 |
369
375
  | `throughline install --project` | 現リポジトリの `.claude/settings.json` だけに hook を登録 |
376
+ | `throughline self-update [--json]` | 公式npm package更新、公開PATHがその新CLI・versionを指すことの確認、製品所有連携の再適用、既存DB migration、公開diagnosticsの確認までを一回で実行 |
370
377
  | `throughline uninstall` | hook を削除 |
378
+
379
+ v0.10.4以前には `self-update` が存在しない。該当版からの初回だけ
380
+ `npm install --global throughline@latest` を実行し、続けて
381
+ `throughline self-update` を実行する。以後の更新は `throughline self-update` だけで完結する。
371
382
  | `throughline monitor` | マルチセッション監視を起動 |
372
383
  | `throughline monitor --diag` | TTY/columns/env 診断ダンプ (描画バグ切り分け用) |
373
384
  | `throughline detail <時刻>` | あるターンの L2 本文と L3 ツール I/O を取得 (Claude が使う) |
374
385
  | `throughline recall --l2\|--l1 --session <id> --before <ISO> ...` | 注入の案内セクションが指す古い記憶を pull (read-only、正確なコマンドは注入に焼き込み済み) |
375
386
  | `throughline doctor` | Node バージョン、hook 登録状況、DB、PATH をチェック |
376
387
  | `throughline doctor --trim --host claude` | trim boundary と手動手順を診断 |
388
+ | `throughline runtime-errors enable --json` | Throughline所有のruntime error収集を有効化(既定OFF) |
389
+ | `throughline runtime-errors disable --json` | Throughline所有のruntime error収集を無効化 |
390
+ | `throughline runtime-errors snapshot --json` | boundedなlocal aggregateを読み取る(network I/Oなし) |
391
+ | `throughline runtime-errors diagnostics --json` | collection/store状態をpathやraw errorなしで診断 |
377
392
  | `throughline handoff-preview --session <id>` | Codex 向け `throughline_handoff` JSON projection を表示 |
378
393
  | `throughline handoff-context --session <id> --json` | SessionStart と同じ引き継ぎ文脈を versioned JSON で取得。記憶行の `session_id` と `sessions.merged_into` は変更せず、同一端末内の別ベンダーランチャーから使える |
379
394
  | `throughline grok-continue --session <id>` | handoff-context を初手 user 文にした対話 Grok 席を立てる。cwd は源の `project_path`。ready でなければ spawn しない。`--rules` なし。macOS Terminal のみ |
@@ -385,6 +400,22 @@ Throughline state をまだ書いていない現在セッションも表示で
385
400
  | `throughline status` | DB 統計表示 (sessions / skeletons / bodies / details) |
386
401
  | `throughline --version` | インストール済みバージョンを表示 |
387
402
 
403
+ ### 製品所有のruntime error収集
404
+
405
+ 収集は既定OFFです。Throughline自身のCLIで有効化します。
406
+
407
+ ```bash
408
+ throughline runtime-errors enable --json
409
+ throughline runtime-errors diagnostics --json
410
+ ```
411
+
412
+ 設定はmacOS/Linuxでは
413
+ `$XDG_CONFIG_HOME/throughline/runtime-errors.config.json`
414
+ (未設定時`~/.config/throughline/...`)、Windowsでは
415
+ `%LOCALAPPDATA%\throughline\runtime-errors.config.json`です。CLIはprivate権限で
416
+ `throughline.runtime_error_config.v1`を書きます。Throughlineはdotagents設定を読まず、
417
+ 工場連携側は公開`runtime-errors ... --json`契約だけを利用します。
418
+
388
419
  ### ローカルlauncher向けread-only handoff context
389
420
 
390
421
  通常handoffを実行せず、同一端末のlauncherからThroughline記憶だけを使う場合は次を呼ぶ:
@@ -402,18 +433,19 @@ latest session推測・`sessions.merged_into`変更・L1/L2/L3 rowの所属変
402
433
 
403
434
  | コマンド | 役割 |
404
435
  | --- | --- |
405
- | `/tl` | 引き継ぎバトンを書き込む (auto path を OFF にしているユーザー / `/clear` 経由しない引継ぎの逃げ道)。Grok ではバトン成功後に `grok-continue` も起動する |
436
+ | `/tl` | 前任を確定指名する引き継ぎバトンを書き込む(新規chat・再起動・Claude Desktopの`/clear`前に使う)。Grokではbaton成功後に`grok-continue`も起動する |
406
437
  | `/sc-detail <時刻>` | 過去ターンの L2 本文と L3 ツール I/O を取得 |
407
438
 
408
- > v0.4.0 から auto-handoff がデフォルト ON です。`/clear` だけで新セッションが
409
- > 「途中から」再開されます。`THROUGHLINE_DISABLE_AUTO_HANDOFF=1` OFF にできます。
410
- > `/tl` は OFF 設定下、または `/clear` 経由しない引継ぎ用の明示マーカー。
439
+ > 組み込み `/clear` は実測したクライアントのUserPromptSubmitには届きません。
440
+ > VS Codeは別経路の`source='clear'` auto pathで再開します。Claude Desktopは
441
+ > `/clear`前の`/tl`が必要です。`THROUGHLINE_DISABLE_AUTO_HANDOFF=1`はVS Codeの
442
+ > auto pathだけを止め、`/tl` batonは止めません。
411
443
 
412
444
  ---
413
445
 
414
446
  ## 動作要件
415
447
 
416
- - **Node.js 22.5 以上** (組み込み `node:sqlite` モジュール使用、ネイティブビルド不要)
448
+ - **Node.js 22.13 以上** (組み込み `node:sqlite` モジュール使用、ネイティブビルド不要)
417
449
  - **Claude Code** (`SessionStart`, `Stop`, `UserPromptSubmit` hooks 対応版)
418
450
  - **Codex CLI ログイン**(既定の L1 要約 backend、`gpt-5.6-luna`)または
419
451
  **Claude Max サブスクリプション**(`claude -p` 経由の Haiku fallback)— どちらも API キー不要
@@ -426,16 +458,16 @@ latest session推測・`sessions.merged_into`変更・L1/L2/L3 rowの所属変
426
458
  ## 設計ドキュメント
427
459
 
428
460
  - [`docs/01_l1_l2_l3_redesign.md`](docs/01_l1_l2_l3_redesign.md) — L1/L2/L3 差分階層モデルの **設計仕様書** (schema v4 ベース + v5 L3 分類拡張)。記憶階層化ルールの正典
429
- - [`docs/03_inheritance_on_clear_only.md`](docs/03_inheritance_on_clear_only.md) — `/tl` バトン引き継ぎ方式の設計判断記録 (schema v6–v7)
461
+ - [`docs/02_clear_auto_handoff_plan.md`](docs/02_clear_auto_handoff_plan.md) — 現行の `/clear` / `/tl` handoff契約
430
462
  - [`docs/08_codex_dual_support.md`](docs/08_codex_dual_support.md) — Claude 主軸を維持したまま Codex 対応を足すための architecture brief
431
463
  - [`docs/09_rollback_context_trim_insight.md`](docs/09_rollback_context_trim_insight.md) — rollback / trim 設計 insight。復元 memory を current work として読ませる制約も記録
432
464
  - [`docs/adr/0021-grok-host-capture.md`](docs/adr/0021-grok-host-capture.md) — Grok first-class host と `/tl` → `grok-continue` の現行契約
433
- - [`docs/plan_grok-successor-launch.md`](docs/plan_grok-successor-launch.md) — Grok 後継席の CLI・初手・非目標・実機受入
434
- - [`docs/07_codex_trim_implementation_plan.md`](docs/07_codex_trim_implementation_plan.md) — Claude/Codex 両対応と rollback trim の統合 TODO 計画
465
+ - [`docs/adr/0022-cursor-host-capture.md`](docs/adr/0022-cursor-host-capture.md) — Cursor first-class host の現行契約
435
466
  - [`docs/04_public_release_plan.md`](docs/04_public_release_plan.md) — 公開配布化プラン、§ 0 フォールバック禁止ルール、バージョン別実装ステータス
436
- - [`docs/15_windows_ci_release_latency_plan.md`](docs/15_windows_ci_release_latency_plan.md) — Windows CI性能gateとACL契約を維持するrelease工程
467
+ - [`docs/archive/12_desktop_clear_handoff_plan.md`](docs/archive/12_desktop_clear_handoff_plan.md) — Claude Desktopの対照実測・NO-GO判断・backfill受入の履歴
468
+ - [`docs/00_overview.md`](docs/00_overview.md) — current/history/evidenceの地図と文書寿命規則
437
469
  - [`CHANGELOG.md`](CHANGELOG.md) — リリース履歴
438
- - [`docs/archive/`](docs/archive/) — 破棄済み旧設計 (CONCEPT 初期案、session-linking 実験記録など)
470
+ - [`docs/archive/`](docs/archive/) — 完了済み計画と置換済み設計。履歴確認時だけ参照
439
471
 
440
472
  ---
441
473