throughline 0.10.2 → 0.10.5

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 (68) hide show
  1. package/CHANGELOG.md +88 -27
  2. package/README.ja.md +83 -49
  3. package/README.md +106 -78
  4. package/bin/throughline.mjs +32 -13
  5. package/docs/00_overview.md +56 -42
  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 +73 -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/adr/0022-cursor-host-capture.md +39 -0
  21. package/docs/archive/02_clear_auto_handoff_plan.md +350 -0
  22. package/docs/{03_inheritance_on_clear_only.md → archive/03_inheritance_on_clear_only.md} +22 -22
  23. package/docs/{07_codex_trim_implementation_plan.md → archive/07_codex_trim_implementation_plan.md} +8 -8
  24. package/docs/{10_transcript_injection_plan.md → archive/10_transcript_injection_plan.md} +12 -12
  25. package/docs/archive/12_desktop_clear_handoff_plan.md +218 -0
  26. package/docs/{14_observer_completed_turn_feed_plan.md → archive/14_observer_completed_turn_feed_plan.md} +7 -7
  27. package/docs/archive/15_windows_ci_release_latency_plan.md +89 -0
  28. package/docs/archive/16_readonly_handoff_context_plan.md +40 -0
  29. package/docs/archive/README.md +28 -15
  30. package/docs/archive/plan_grok-successor-launch.md +99 -0
  31. package/docs/archive/room-log_throughline_20260830-155052.md +285 -0
  32. package/docs/plan_grok-successor-launch.md +6 -97
  33. package/package.json +19 -11
  34. package/rag/INDEX.md +2 -2
  35. package/src/baton.mjs +11 -9
  36. package/src/cli/handoff-context.test.mjs +36 -0
  37. package/src/cli/help.test.mjs +5 -0
  38. package/src/cli/install.mjs +91 -0
  39. package/src/cli/install.test.mjs +57 -0
  40. package/src/cli/runtime-errors.mjs +9 -3
  41. package/src/cli/runtime-errors.test.mjs +13 -13
  42. package/src/cli/self-update.mjs +402 -0
  43. package/src/cli/self-update.test.mjs +525 -0
  44. package/src/db.mjs +1 -1
  45. package/src/docs-contract.test.mjs +153 -0
  46. package/src/hosts/claude.mjs +1 -0
  47. package/src/hosts/codex.mjs +1 -0
  48. package/src/hosts/cursor.mjs +128 -0
  49. package/src/hosts/cursor.test.mjs +104 -0
  50. package/src/hosts/grok.mjs +1 -0
  51. package/src/hosts/identity.mjs +19 -2
  52. package/src/hosts/identity.test.mjs +27 -4
  53. package/src/hosts/index.mjs +11 -2
  54. package/src/product-ci-contract.test.mjs +14 -0
  55. package/src/prompt-submit.mjs +8 -10
  56. package/src/resume-context.mjs +4 -4
  57. package/src/runtime-error-hook.test.mjs +4 -6
  58. package/src/runtime-error-store.mjs +40 -18
  59. package/src/runtime-error-store.test.mjs +53 -26
  60. package/src/session-merger.mjs +16 -7
  61. package/src/session-merger.test.mjs +27 -0
  62. package/src/session-start.mjs +24 -1
  63. package/src/spike-transcript-writer.mjs +1 -1
  64. package/src/transcript-reader-cursor.test.mjs +43 -0
  65. package/src/transcript-reader.mjs +14 -7
  66. /package/docs/{11_codex_monitor_implementation_plan.md → archive/11_codex_monitor_implementation_plan.md} +0 -0
  67. /package/docs/{13_native_factory_diagnostics_plan.md → archive/13_native_factory_diagnostics_plan.md} +0 -0
  68. /package/docs/{BUGHUB_RUNTIME_ERROR_STORE_PLAN.md → archive/BUGHUB_RUNTIME_ERROR_STORE_PLAN.md} +0 -0
package/CHANGELOG.md CHANGED
@@ -10,6 +10,63 @@ shipped to npm but were not individually tagged on GitHub.
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.10.5] — 2026-09-01
14
+
15
+ ### Added
16
+
17
+ - `throughline self-update` now owns the complete product update path: official
18
+ npm package update, integration reapplication, existing-database migration,
19
+ installed-version verification, and public diagnostics. Factory callers no
20
+ longer need to interpret Throughline's migration schema. It resolves the new
21
+ CLI from npm's global root, rejects old-CLI help or malformed handshakes even
22
+ when they exit zero, requires overall diagnostics readiness, preserves child
23
+ errors, and uses `npm.cmd` through PowerShell 7 on Windows. It also refuses a
24
+ mixed-prefix update when the public `throughline` on PATH does not resolve to
25
+ the newly installed CLI and version.
26
+
27
+ ### Fixed
28
+
29
+ - Session inheritance now refuses to reassign L1/L2/L3 memory when the named
30
+ predecessor and successor belong to different projects. Project-scoped
31
+ predecessor discovery already filtered candidates, but the final merge
32
+ state transition did not enforce the same ownership invariant itself.
33
+
34
+ ## [0.10.4] — 2026-08-30
35
+
36
+ ### Changed
37
+
38
+ - Runtime-error collection is now configured and owned by Throughline itself.
39
+ `throughline runtime-errors enable|disable --json` writes the private,
40
+ versioned product config under the Throughline config directory. The runtime
41
+ no longer reads dotagents factory-reporter configuration; factory integration
42
+ uses the public `runtime-errors ... --json` boundary.
43
+ - Corrected the documented Claude handoff boundary: built-in `/clear` does not
44
+ reach `UserPromptSubmit`; VS Code uses `SessionStart source='clear'`, while
45
+ Claude Desktop requires `/tl` before `/clear`.
46
+ - Moved the completed v0.4 auto-handoff plan into `docs/archive/` and replaced
47
+ the current path with a concise current contract. Fixed Lattice consumers of
48
+ other archived plans keep small compatibility entrypoints.
49
+ - Product-owned CI now runs `npm run verify:docs` for Markdown-only changes,
50
+ checking local links, the document/archive indexes, compatibility stubs, and
51
+ relative link/image closure inside the actual npm tarball file list.
52
+ - The Windows-native product CI path now uses PowerShell 7 exclusively.
53
+
54
+ ## [0.10.3] — 2026-08-24
55
+
56
+ ### Added
57
+
58
+ - Cursor を first-class hook host にする(工場 Cursor harness campaign Wave 6)。
59
+ - envelope は `hook_event_name=sessionStart|beforeSubmitPrompt|stop` と
60
+ `conversation_id` / `cursor_version`。session id は `cursor:<uuid>`。
61
+ - L2 は payload の `transcript_path`、無ければ
62
+ `~/.cursor/projects/<slug>/agent-transcripts/<id>/<id>.jsonl`。
63
+ - `throughline install` は `~/.cursor/hooks.json` へ絶対 `node` +
64
+ `bin/throughline.mjs` の sessionStart / beforeSubmitPrompt / stop を upsert
65
+ する。工場 hook(`cursor-*-hook`)は残す。bare `throughline` は書かない。
66
+ - beforeSubmitPrompt は continue のみなので、引き継ぎ注入は sessionStart の
67
+ `additional_context`。`/tl` 後継の自動起動はしない。
68
+ - Claude / Codex / Grok 契約は変えない。
69
+
13
70
  ## [0.10.2] — 2026-08-24
14
71
 
15
72
  ### Changed
@@ -456,7 +513,7 @@ are absent and have no effect on the shipped path.
456
513
 
457
514
  ### Added
458
515
 
459
- - `docs/10_transcript_injection_plan.md`: full Phase 0 plan and
516
+ - `docs/archive/10_transcript_injection_plan.md`: full Phase 0 plan and
460
517
  result log for the D / `initialUserMessage` investigation.
461
518
  - `rag/`: third-party spec knowledge base (Claude Code hooks
462
519
  reference, Anthropic Messages API, sessions docs, openclaude
@@ -1304,29 +1361,33 @@ two attempts, instrument first instead of patching again.
1304
1361
 
1305
1362
  ---
1306
1363
 
1307
- [Unreleased]: https://github.com/kitepon-rgb/Throughline/compare/v0.10.1...HEAD
1308
- [0.10.1]: https://github.com/kitepon-rgb/Throughline/compare/v0.10.0...v0.10.1
1309
- [0.10.0]: https://github.com/kitepon-rgb/Throughline/compare/v0.9.1...v0.10.0
1310
- [0.9.1]: https://github.com/kitepon-rgb/Throughline/compare/v0.9.0...v0.9.1
1311
- [0.9.0]: https://github.com/kitepon-rgb/Throughline/compare/v0.8.9...v0.9.0
1312
- [0.8.9]: https://github.com/kitepon-rgb/Throughline/compare/v0.8.8...v0.8.9
1313
- [0.8.8]: https://github.com/kitepon-rgb/Throughline/compare/v0.8.7...v0.8.8
1314
- [0.8.7]: https://github.com/kitepon-rgb/Throughline/compare/v0.8.6...v0.8.7
1315
- [0.8.6]: https://github.com/kitepon-rgb/Throughline/compare/v0.8.5...v0.8.6
1316
- [0.8.5]: https://github.com/kitepon-rgb/Throughline/compare/v0.8.4...v0.8.5
1317
- [0.8.4]: https://github.com/kitepon-rgb/Throughline/compare/v0.8.3...v0.8.4
1318
- [0.8.3]: https://github.com/kitepon-rgb/Throughline/compare/v0.8.2...v0.8.3
1319
- [0.8.2]: https://github.com/kitepon-rgb/Throughline/compare/v0.8.1...v0.8.2
1320
- [0.8.1]: https://github.com/kitepon-rgb/Throughline/compare/v0.8.0...v0.8.1
1321
- [0.8.0]: https://github.com/kitepon-rgb/Throughline/compare/v0.7.0...v0.8.0
1322
- [0.7.0]: https://github.com/kitepon-rgb/Throughline/compare/v0.6.3...v0.7.0
1323
- [0.6.3]: https://github.com/kitepon-rgb/Throughline/compare/v0.6.2...v0.6.3
1324
- [0.6.2]: https://github.com/kitepon-rgb/Throughline/compare/v0.6.1...v0.6.2
1325
- [0.3.22]: https://github.com/kitepon-rgb/Throughline/releases/tag/v0.3.22
1326
- [0.3.21]: https://github.com/kitepon-rgb/Throughline/compare/v0.3.19...v0.3.21
1327
- [0.3.20]: https://github.com/kitepon-rgb/Throughline/compare/v0.3.19...v0.3.20
1328
- [0.3.19]: https://github.com/kitepon-rgb/Throughline/releases/tag/v0.3.19
1329
- [0.3.18]: https://github.com/kitepon-rgb/Throughline/releases/tag/v0.3.18
1330
- [0.3.0]: https://github.com/kitepon-rgb/Throughline/releases/tag/v0.3.0
1331
- [0.2.0]: https://github.com/kitepon-rgb/Throughline/releases/tag/v0.2.0
1332
- [0.1.0]: https://github.com/kitepon-rgb/Throughline/compare/v0.1.0
1364
+ [Unreleased]: https://github.com/kitepon/Throughline/compare/v0.10.5...HEAD
1365
+ [0.10.5]: https://github.com/kitepon/Throughline/compare/v0.10.4...v0.10.5
1366
+ [0.10.4]: https://github.com/kitepon/Throughline/compare/v0.10.3...v0.10.4
1367
+ [0.10.3]: https://github.com/kitepon/Throughline/compare/v0.10.2...v0.10.3
1368
+ [0.10.2]: https://github.com/kitepon/Throughline/compare/v0.10.1...v0.10.2
1369
+ [0.10.1]: https://github.com/kitepon/Throughline/compare/v0.10.0...v0.10.1
1370
+ [0.10.0]: https://github.com/kitepon/Throughline/compare/v0.9.1...v0.10.0
1371
+ [0.9.1]: https://github.com/kitepon/Throughline/compare/v0.9.0...v0.9.1
1372
+ [0.9.0]: https://github.com/kitepon/Throughline/compare/v0.8.9...v0.9.0
1373
+ [0.8.9]: https://github.com/kitepon/Throughline/compare/v0.8.8...v0.8.9
1374
+ [0.8.8]: https://github.com/kitepon/Throughline/compare/v0.8.7...v0.8.8
1375
+ [0.8.7]: https://github.com/kitepon/Throughline/compare/v0.8.6...v0.8.7
1376
+ [0.8.6]: https://github.com/kitepon/Throughline/compare/v0.8.5...v0.8.6
1377
+ [0.8.5]: https://github.com/kitepon/Throughline/compare/v0.8.4...v0.8.5
1378
+ [0.8.4]: https://github.com/kitepon/Throughline/compare/v0.8.3...v0.8.4
1379
+ [0.8.3]: https://github.com/kitepon/Throughline/compare/v0.8.2...v0.8.3
1380
+ [0.8.2]: https://github.com/kitepon/Throughline/compare/v0.8.1...v0.8.2
1381
+ [0.8.1]: https://github.com/kitepon/Throughline/compare/v0.8.0...v0.8.1
1382
+ [0.8.0]: https://github.com/kitepon/Throughline/compare/v0.7.0...v0.8.0
1383
+ [0.7.0]: https://github.com/kitepon/Throughline/compare/v0.6.3...v0.7.0
1384
+ [0.6.3]: https://github.com/kitepon/Throughline/compare/v0.6.2...v0.6.3
1385
+ [0.6.2]: https://github.com/kitepon/Throughline/compare/v0.6.1...v0.6.2
1386
+ [0.3.22]: https://github.com/kitepon/Throughline/releases/tag/v0.3.22
1387
+ [0.3.21]: https://github.com/kitepon/Throughline/compare/v0.3.19...v0.3.21
1388
+ [0.3.20]: https://github.com/kitepon/Throughline/compare/v0.3.19...v0.3.20
1389
+ [0.3.19]: https://github.com/kitepon/Throughline/releases/tag/v0.3.19
1390
+ [0.3.18]: https://github.com/kitepon/Throughline/releases/tag/v0.3.18
1391
+ [0.3.0]: https://github.com/kitepon/Throughline/releases/tag/v0.3.0
1392
+ [0.2.0]: https://github.com/kitepon/Throughline/releases/tag/v0.2.0
1393
+ [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,13 +35,20 @@ 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
- `~/.grok/hooks/throughline.json` を書く。Grok `/tl` は今の窓へ注入せず、
43
- Terminal に新席を立てる(詳細は下)。
44
+ `~/.grok/hooks/throughline.json` を書く。Grok では `/tl` は今の窓へ注入せず、
45
+ 新しい Terminal 席を立てる。
46
+
47
+ Cursor も first-class host である。`throughline install` は `~/.cursor/hooks.json`
48
+ へ sessionStart / beforeSubmitPrompt / stop を upsert し、工場 hook は残す。
49
+ capture は Cursor の `agent-transcripts` jsonl。注入は sessionStart の
50
+ `additional_context`。`/tl` 後継の自動起動はしない。
51
+ [ADR 0022](docs/adr/0022-cursor-host-capture.md) を正とする。
44
52
 
45
53
  <details>
46
54
  <summary><b>Grok も併用する場合</b> Grok hooks も登録される — クリックで詳細</summary>
@@ -99,8 +107,8 @@ current-thread rollback
99
107
  | **境界後に残る記憶** | ✅ 直近ターン本文そのまま (予算内ターン原子詰め) + それ以前は `recall` で pull + L3 オンデマンド | ❌ ゼロ | △ 一個の要約 (情報欠落) | △ 要約 (情報欠落) |
100
108
  | **ツール I/O の扱い** | L3 に退避、`/sc-detail HH:MM:SS` で取り戻せる | 消える | 要約に溶けて読めない | 要約に溶ける |
101
109
  | **コーディング用途への適合** | 高 — ツール I/O こそ重い 80% | 低 — 文脈が切れる | 中 — ただし不可逆 | 中 |
102
- | **誤継承リスク** | 低 (typed `/clear` / `/tl` が前任を指名) | n/a | n/a | 高 |
103
- | **ランタイム依存** | **ゼロ** (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 | 多数 |
104
112
  | **マルチセッション トークン監視** | ✅ 実測 `message.usage` / Codex rollout `token_count` | — | — | — |
105
113
 
106
114
  **ひとことで**: `/clear` は全部捨てる、`/compact` は全部混ぜる、Throughline は **書いた本文はそのまま残し、ツール出力 (= 80% の重量物) だけ退避** する。
@@ -209,17 +217,18 @@ L3 に保存された `kind` 別 (ツール入力 / ツール出力 / hook 出
209
217
 
210
218
  ---
211
219
 
212
- ## 引き継ぎ: typed `/clear` / `/tl` が前任を指名、source-`clear` は補助
220
+ ## 引き継ぎ: `/tl` はbaton、VS Code `/clear` `source='clear'`
213
221
 
214
- Throughline 0.4.1+ の引き継ぎは 2 経路です。主経路は typed `/clear` または
215
- `/tl` が書く baton で、`source='clear'` の auto path は `/clear` が
216
- UserPromptSubmit hook に届かない場合の補助です。
222
+ 引き継ぎは2経路です。`/tl` のbatonは前任をsession idで確定指名します。
223
+ 適格なbatonが無い場合だけ、VS Code `/clear` `SessionStart source='clear'` から
224
+ transcriptのある前任を1件凍結します。消費時はbatonを先に確認します。
217
225
 
218
226
  ```mermaid
219
227
  flowchart LR
220
- U["ユーザーが入力<br/>/clear または /tl"] -->|UserPromptSubmit| W["writeBaton<br/>(session_id + TTL 1h)"]
228
+ U["ユーザーが入力<br/>/tl"] -->|UserPromptSubmit| W["writeBaton<br/>(session_id + TTL 1h)"]
221
229
  W --> B[("handoff_batons<br/>SQLite")]
222
- 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"]
223
232
  NS["次の SessionStart<br/>(intent 登録のみ)"] --> FP["初回ユーザープロンプト<br/>(実セッションの証明)"]
224
233
  FP --> C{"baton<br/>あり?"}
225
234
  B -.-> C
@@ -238,14 +247,13 @@ flowchart LR
238
247
  class P3,INJ neutral
239
248
  ```
240
249
 
241
- ### baton path (primary): typed `/clear` または `/tl`
250
+ ### baton path: `/tl`
242
251
 
243
- ユーザーが prompt に `/clear` または `/tl` を打つと、UserPromptSubmit hook
244
- **そのセッションの** `session_id` を `handoff_batons` に書きます。次の新セッション
252
+ ユーザーが `/tl` を実行すると、UserPromptSubmit hook が**そのセッションの**
253
+ `session_id` を `handoff_batons` に書きます。次の新セッション
245
254
  は **初回ユーザープロンプト時** に baton を消費し(適格性: セッション誕生が baton
246
255
  書き込みから TTL 1 時間以内)、その前任を確定的に merge します。
247
- 複数ウィンドウで「最新更新セッション」と「今 `/clear` したセッション」が違っても、
248
- 指名された前任だけを引き継ぎます。
256
+ 複数ウィンドウでも指名された前任だけを引き継ぎます。
249
257
 
250
258
  なぜ SessionStart でなく初回プロンプトか: Claude Code は同一 project に数百 ms の
251
259
  間隔で複数の SessionStart を発火させることがあり、その一部は transcript を一切
@@ -254,22 +262,25 @@ flowchart LR
254
262
  が空で始まる事故が起きます。幽霊はプロンプトを発火しないので、消費を初回
255
263
  プロンプトへ遅延させればこの事故は構造的に起きません(二相ハンドオフ、ADR 0014)。
256
264
 
257
- ### auto path (fallback): `source='clear'`
265
+ ### auto path: VS Code `source='clear'`
258
266
 
259
- baton が無く、SessionStart の `source='clear'` が届いた場合だけ、同 project
267
+ 組み込み `/clear` は、実測したどの Claude Code クライアントでも
268
+ UserPromptSubmit hook に届きません。VS Code は代わりに SessionStart の
269
+ `source='clear'` を送ります。baton が無い場合だけ、同 project の
260
270
  最新 Claude predecessor を **SessionStart 時点で** 解決・凍結し(transcript の
261
- 無い幽霊は候補から除外)、merge + 注入は初回プロンプト時に行います。これは
262
- VS Code 拡張メニューなど、typed `/clear` が UserPromptSubmit hook に届かない
263
- 経路のための補助です。
271
+ 無い幽霊は候補から除外)、merge + 注入は初回プロンプト時に行います。
272
+
273
+ `THROUGHLINE_DISABLE_AUTO_HANDOFF=1` はこのauto pathだけをOFFにし、明示 `/tl` の
274
+ batonは止めません。
264
275
 
265
- `THROUGHLINE_DISABLE_AUTO_HANDOFF=1` はこの fallback path だけを OFF にします。
266
- typed `/clear` `/tl` はユーザーの明示意思なので、この env に関係なく baton を
267
- 書いて引き継ぎます。
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)にあります。
268
280
 
269
281
  ```
270
- typed /clear: Session A → /clear → Session B (A baton を消費して merge)
271
- typed /tl: Session A /tl → chat / 再起動 Session B (A の baton を消費して merge)
272
- 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
273
284
  ```
274
285
 
275
286
  ### 注入されるもの
@@ -294,7 +305,8 @@ extended thinking セクションは注入されません。
294
305
  各マージ行は `origin_session_id` を保持するので、繰り返し引き継ぐと
295
306
  記憶がチェーン状に蓄積します:
296
307
 
297
- ```
308
+ ```text
309
+ VS Code:
298
310
  S1 (4 ターン) --/clear--> S2 (S1 を auto-merge + 3 ターン追加) --/clear--> S3 (S2 を auto-merge + 5 ターン追加)
299
311
  origin=S1×4 origin=S1×4, S2×3, S3×5
300
312
  ```
@@ -314,10 +326,10 @@ adapter / projection として追加されます。
314
326
  backend 順は codex-sidecar(`summarize-l1` preset 明示設定時)→ Codex CLI
315
327
  (既定 `gpt-5.6-luna`)→ Claude Haiku です(ADR 0015)。
316
328
 
317
- Codex 側 trim (= same-thread context trim) は `throughline trim --execute --host codex`
318
- で発火します。Codex bare `$throughline` skill もこの scripted rollback + DB
319
- memory inject を直接実行します。Claude 側は `/clear` での auto path 引継ぎが本線になったため、
320
- `/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 は
321
333
  再開注入の Reading Contract / Continuation Instruction で同じ意図を
322
334
  継承しています。
323
335
 
@@ -361,6 +373,7 @@ Throughline state をまだ書いていない現在セッションも表示で
361
373
  | --- | --- |
362
374
  | `throughline install` | hook / Codex UserPromptSubmit・PostToolUse・Stop hook / Codex skill / `~/.grok/hooks/throughline.json` を登録し、VS Code 配下なら現プロジェクトの monitor task も配置 |
363
375
  | `throughline install --project` | 現リポジトリの `.claude/settings.json` だけに hook を登録 |
376
+ | `throughline self-update [--json]` | 公式npm package更新、公開PATHがその新CLI・versionを指すことの確認、製品所有連携の再適用、既存DB migration、公開diagnosticsの確認までを一回で実行 |
364
377
  | `throughline uninstall` | hook を削除 |
365
378
  | `throughline monitor` | マルチセッション監視を起動 |
366
379
  | `throughline monitor --diag` | TTY/columns/env 診断ダンプ (描画バグ切り分け用) |
@@ -368,6 +381,10 @@ Throughline state をまだ書いていない現在セッションも表示で
368
381
  | `throughline recall --l2\|--l1 --session <id> --before <ISO> ...` | 注入の案内セクションが指す古い記憶を pull (read-only、正確なコマンドは注入に焼き込み済み) |
369
382
  | `throughline doctor` | Node バージョン、hook 登録状況、DB、PATH をチェック |
370
383
  | `throughline doctor --trim --host claude` | trim boundary と手動手順を診断 |
384
+ | `throughline runtime-errors enable --json` | Throughline所有のruntime error収集を有効化(既定OFF) |
385
+ | `throughline runtime-errors disable --json` | Throughline所有のruntime error収集を無効化 |
386
+ | `throughline runtime-errors snapshot --json` | boundedなlocal aggregateを読み取る(network I/Oなし) |
387
+ | `throughline runtime-errors diagnostics --json` | collection/store状態をpathやraw errorなしで診断 |
371
388
  | `throughline handoff-preview --session <id>` | Codex 向け `throughline_handoff` JSON projection を表示 |
372
389
  | `throughline handoff-context --session <id> --json` | SessionStart と同じ引き継ぎ文脈を versioned JSON で取得。記憶行の `session_id` と `sessions.merged_into` は変更せず、同一端末内の別ベンダーランチャーから使える |
373
390
  | `throughline grok-continue --session <id>` | handoff-context を初手 user 文にした対話 Grok 席を立てる。cwd は源の `project_path`。ready でなければ spawn しない。`--rules` なし。macOS Terminal のみ |
@@ -379,6 +396,22 @@ Throughline state をまだ書いていない現在セッションも表示で
379
396
  | `throughline status` | DB 統計表示 (sessions / skeletons / bodies / details) |
380
397
  | `throughline --version` | インストール済みバージョンを表示 |
381
398
 
399
+ ### 製品所有のruntime error収集
400
+
401
+ 収集は既定OFFです。Throughline自身のCLIで有効化します。
402
+
403
+ ```bash
404
+ throughline runtime-errors enable --json
405
+ throughline runtime-errors diagnostics --json
406
+ ```
407
+
408
+ 設定はmacOS/Linuxでは
409
+ `$XDG_CONFIG_HOME/throughline/runtime-errors.config.json`
410
+ (未設定時`~/.config/throughline/...`)、Windowsでは
411
+ `%LOCALAPPDATA%\throughline\runtime-errors.config.json`です。CLIはprivate権限で
412
+ `throughline.runtime_error_config.v1`を書きます。Throughlineはdotagents設定を読まず、
413
+ 工場連携側は公開`runtime-errors ... --json`契約だけを利用します。
414
+
382
415
  ### ローカルlauncher向けread-only handoff context
383
416
 
384
417
  通常handoffを実行せず、同一端末のlauncherからThroughline記憶だけを使う場合は次を呼ぶ:
@@ -396,18 +429,19 @@ latest session推測・`sessions.merged_into`変更・L1/L2/L3 rowの所属変
396
429
 
397
430
  | コマンド | 役割 |
398
431
  | --- | --- |
399
- | `/tl` | 引き継ぎバトンを書き込む (auto path を OFF にしているユーザー / `/clear` 経由しない引継ぎの逃げ道)。Grok ではバトン成功後に `grok-continue` も起動する |
432
+ | `/tl` | 前任を確定指名する引き継ぎバトンを書き込む(新規chat・再起動・Claude Desktopの`/clear`前に使う)。Grokではbaton成功後に`grok-continue`も起動する |
400
433
  | `/sc-detail <時刻>` | 過去ターンの L2 本文と L3 ツール I/O を取得 |
401
434
 
402
- > v0.4.0 から auto-handoff がデフォルト ON です。`/clear` だけで新セッションが
403
- > 「途中から」再開されます。`THROUGHLINE_DISABLE_AUTO_HANDOFF=1` OFF にできます。
404
- > `/tl` は OFF 設定下、または `/clear` 経由しない引継ぎ用の明示マーカー。
435
+ > 組み込み `/clear` は実測したクライアントのUserPromptSubmitには届きません。
436
+ > VS Codeは別経路の`source='clear'` auto pathで再開します。Claude Desktopは
437
+ > `/clear`前の`/tl`が必要です。`THROUGHLINE_DISABLE_AUTO_HANDOFF=1`はVS Codeの
438
+ > auto pathだけを止め、`/tl` batonは止めません。
405
439
 
406
440
  ---
407
441
 
408
442
  ## 動作要件
409
443
 
410
- - **Node.js 22.5 以上** (組み込み `node:sqlite` モジュール使用、ネイティブビルド不要)
444
+ - **Node.js 22.13 以上** (組み込み `node:sqlite` モジュール使用、ネイティブビルド不要)
411
445
  - **Claude Code** (`SessionStart`, `Stop`, `UserPromptSubmit` hooks 対応版)
412
446
  - **Codex CLI ログイン**(既定の L1 要約 backend、`gpt-5.6-luna`)または
413
447
  **Claude Max サブスクリプション**(`claude -p` 経由の Haiku fallback)— どちらも API キー不要
@@ -420,16 +454,16 @@ latest session推測・`sessions.merged_into`変更・L1/L2/L3 rowの所属変
420
454
  ## 設計ドキュメント
421
455
 
422
456
  - [`docs/01_l1_l2_l3_redesign.md`](docs/01_l1_l2_l3_redesign.md) — L1/L2/L3 差分階層モデルの **設計仕様書** (schema v4 ベース + v5 L3 分類拡張)。記憶階層化ルールの正典
423
- - [`docs/03_inheritance_on_clear_only.md`](docs/03_inheritance_on_clear_only.md) — `/tl` バトン引き継ぎ方式の設計判断記録 (schema v6–v7)
457
+ - [`docs/02_clear_auto_handoff_plan.md`](docs/02_clear_auto_handoff_plan.md) — 現行の `/clear` / `/tl` handoff契約
424
458
  - [`docs/08_codex_dual_support.md`](docs/08_codex_dual_support.md) — Claude 主軸を維持したまま Codex 対応を足すための architecture brief
425
459
  - [`docs/09_rollback_context_trim_insight.md`](docs/09_rollback_context_trim_insight.md) — rollback / trim 設計 insight。復元 memory を current work として読ませる制約も記録
426
460
  - [`docs/adr/0021-grok-host-capture.md`](docs/adr/0021-grok-host-capture.md) — Grok first-class host と `/tl` → `grok-continue` の現行契約
427
- - [`docs/plan_grok-successor-launch.md`](docs/plan_grok-successor-launch.md) — Grok 後継席の CLI・初手・非目標・実機受入
428
- - [`docs/07_codex_trim_implementation_plan.md`](docs/07_codex_trim_implementation_plan.md) — Claude/Codex 両対応と rollback trim の統合 TODO 計画
461
+ - [`docs/adr/0022-cursor-host-capture.md`](docs/adr/0022-cursor-host-capture.md) — Cursor first-class host の現行契約
429
462
  - [`docs/04_public_release_plan.md`](docs/04_public_release_plan.md) — 公開配布化プラン、§ 0 フォールバック禁止ルール、バージョン別実装ステータス
430
- - [`docs/15_windows_ci_release_latency_plan.md`](docs/15_windows_ci_release_latency_plan.md) — Windows CI性能gateとACL契約を維持するrelease工程
463
+ - [`docs/archive/12_desktop_clear_handoff_plan.md`](docs/archive/12_desktop_clear_handoff_plan.md) — Claude Desktopの対照実測・NO-GO判断・backfill受入の履歴
464
+ - [`docs/00_overview.md`](docs/00_overview.md) — current/history/evidenceの地図と文書寿命規則
431
465
  - [`CHANGELOG.md`](CHANGELOG.md) — リリース履歴
432
- - [`docs/archive/`](docs/archive/) — 破棄済み旧設計 (CONCEPT 初期案、session-linking 実験記録など)
466
+ - [`docs/archive/`](docs/archive/) — 完了済み計画と置換済み設計。履歴確認時だけ参照
433
467
 
434
468
  ---
435
469