throughline 0.6.0 → 0.6.2
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 +33 -0
- package/README.md +46 -5
- package/bin/throughline.mjs +41 -0
- package/docs/00_overview.md +2 -0
- package/docs/04_public_release_plan.md +2 -0
- package/docs/12_desktop_clear_handoff_plan.md +3 -3
- package/docs/13_native_factory_diagnostics_plan.md +46 -0
- package/docs/BUGHUB_RUNTIME_ERROR_STORE_PLAN.md +52 -0
- package/package.json +2 -2
- package/src/auditor-context.mjs +330 -0
- package/src/auditor-context.test.mjs +303 -0
- package/src/cli/auditor-context.mjs +141 -0
- package/src/cli/auditor-context.test.mjs +148 -0
- package/src/cli/codex-hook.mjs +27 -4
- package/src/cli/codex-hook.test.mjs +4 -0
- package/src/cli/codex-restore-smoke.mjs +2 -1
- package/src/cli/codex-restore-source-audit.mjs +1 -1
- package/src/cli/doctor.mjs +5 -1
- package/src/cli/factory-diagnostics.mjs +246 -0
- package/src/cli/factory-diagnostics.test.mjs +201 -0
- package/src/cli/runtime-errors.mjs +85 -0
- package/src/cli/runtime-errors.test.mjs +75 -0
- package/src/cli/trim.mjs +4 -4
- package/src/codex-handoff-model-smoke.mjs +2 -3
- package/src/codex-sidecar-cli.test.mjs +19 -8
- package/src/codex-sidecar.mjs +2 -5
- package/src/codex-sidecar.test.mjs +17 -9
- package/src/codex-thread-index.mjs +17 -2
- package/src/db.mjs +1 -1
- package/src/factory-diagnostics.mjs +118 -0
- package/src/factory-diagnostics.test.mjs +97 -0
- package/src/haiku-summarizer.mjs +3 -5
- package/src/haiku-summarizer.test.mjs +52 -47
- package/src/hook-entrypoints.test.mjs +3 -1
- package/src/phase0-spotter-contract.test.mjs +279 -0
- package/src/portable-spawn-sync.mjs +58 -0
- package/src/portable-spawn-sync.test.mjs +40 -0
- package/src/prompt-submit.mjs +2 -0
- package/src/runtime-error-hook.test.mjs +106 -0
- package/src/runtime-error-observer.mjs +8 -0
- package/src/runtime-error-store.mjs +595 -0
- package/src/runtime-error-store.test.mjs +307 -0
- package/src/session-start.mjs +2 -0
- package/src/test-env.mjs +59 -2
- package/src/turn-backfill.test.mjs +2 -2
- package/src/turn-processor.mjs +2 -0
- package/src/windows-acl-test-helper.mjs +29 -0
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,37 @@ shipped to npm but were not individually tagged on GitHub.
|
|
|
10
10
|
|
|
11
11
|
## [Unreleased]
|
|
12
12
|
|
|
13
|
+
## [0.6.2] — release candidate (pending)
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- Added an opt-in, local-only runtime error aggregate for BugHub factory
|
|
18
|
+
reporting. Collection requires the canonical dotagents config boolean
|
|
19
|
+
`collection.enabled: true`; it never performs network I/O or accepts raw
|
|
20
|
+
exceptions, stderr, stacks, prompts, sessions, paths, or arbitrary context.
|
|
21
|
+
Fixed hook error codes/templates are aggregated by SHA-256 fingerprint in an
|
|
22
|
+
owner-private atomic store with count, first/last seen, resolve/reopen,
|
|
23
|
+
monotonic cursor/ack, retention that preserves unacknowledged records, and
|
|
24
|
+
bounded `throughline runtime-errors ... --json` snapshot/diagnostics APIs.
|
|
25
|
+
- Release candidate only: collection remains disabled by default and the local
|
|
26
|
+
store sends no network traffic. Publication, tag, CI, and registry-install
|
|
27
|
+
verification are pending.
|
|
28
|
+
- Raised the Node.js floor to 22.13, where `node:sqlite` is available without
|
|
29
|
+
an experimental command-line flag; CI now exercises that exact minimum.
|
|
30
|
+
|
|
31
|
+
## [0.6.1] — 2026-07-13
|
|
32
|
+
|
|
33
|
+
### Added
|
|
34
|
+
|
|
35
|
+
- **Spotter auditor context v1.** `throughline auditor-context` adds an
|
|
36
|
+
opt-in, JSON-only, read-only projection for Spotter. It verifies the exact
|
|
37
|
+
session/project and the latest completed L2 user/assistant pair against an
|
|
38
|
+
origin/turn/SHA-256 freshness expectation, supplied explicitly or derived
|
|
39
|
+
from a Claude JSONL or Codex rollout. Only `fresh` returns bounded pair
|
|
40
|
+
bodies; all other states return no bodies. The command never creates,
|
|
41
|
+
migrates, or writes the Throughline DB. Opt-in and any onward transmission
|
|
42
|
+
remain Spotter responsibilities.
|
|
43
|
+
|
|
13
44
|
## [0.6.0] — 2026-07-12
|
|
14
45
|
|
|
15
46
|
L2 capture is rebuilt from "save only the last pair each Stop" to a
|
|
@@ -957,6 +988,8 @@ two attempts, instrument first instead of patching again.
|
|
|
957
988
|
|
|
958
989
|
---
|
|
959
990
|
|
|
991
|
+
[Unreleased]: https://github.com/kitepon-rgb/Throughline/compare/v0.6.2...HEAD
|
|
992
|
+
[0.6.2]: https://github.com/kitepon-rgb/Throughline/compare/v0.6.1...v0.6.2
|
|
960
993
|
[0.3.22]: https://github.com/kitepon-rgb/Throughline/releases/tag/v0.3.22
|
|
961
994
|
[0.3.21]: https://github.com/kitepon-rgb/Throughline/compare/v0.3.19...v0.3.21
|
|
962
995
|
[0.3.20]: https://github.com/kitepon-rgb/Throughline/compare/v0.3.19...v0.3.20
|
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ guarded `trim --execute --host codex` surface.
|
|
|
58
58
|
| **Tool I/O handling** | retired to L3, retrievable by `/sc-detail HH:MM:SS` | gone | folded into summary, unreadable | folded into summary |
|
|
59
59
|
| **Coding-assistant fit** | high — tool I/O is the heavy 80% | low — you lose the thread | medium — but irreversible | medium |
|
|
60
60
|
| **Auto-inheritance risk** | low (typed `/clear` / `/tl` names the predecessor) | n/a | n/a | high |
|
|
61
|
-
| **Runtime deps** | **zero** (Node 22.
|
|
61
|
+
| **Runtime deps** | **zero** (Node 22.13+ built-in `node:sqlite`) | n/a | n/a | many |
|
|
62
62
|
| **Multi-session token monitor** | ✅ real `message.usage` / Codex rollout `token_count` | — | — | — |
|
|
63
63
|
|
|
64
64
|
**Short version**: `/clear` throws everything away, `/compact` blurs everything together, Throughline keeps the *text* you wrote verbatim and only retires the *tool output* — which is where 80% of the bloat lives.
|
|
@@ -109,7 +109,7 @@ Anthropic API usage from the transcript JSONL (no `length / 4` heuristics).
|
|
|
109
109
|
|
|
110
110
|
---
|
|
111
111
|
|
|
112
|
-
## Three-layer memory model (schema
|
|
112
|
+
## Three-layer memory model (schema v8)
|
|
113
113
|
|
|
114
114
|
```mermaid
|
|
115
115
|
flowchart LR
|
|
@@ -716,6 +716,11 @@ entry to the `tasks` array yourself:
|
|
|
716
716
|
|
|
717
717
|
## Commands
|
|
718
718
|
|
|
719
|
+
**v0.6.2 は release candidate(公開待ち)です。** factory diagnostics と local
|
|
720
|
+
runtime error aggregate は collection が既定OFFで、canonical dotagents config の
|
|
721
|
+
`collection.enabled: true` を明示した場合だけ収集します。いずれも network I/O は
|
|
722
|
+
行いません。npm公開、tag、CI、registry由来installの確認は未完了です。
|
|
723
|
+
|
|
719
724
|
| Command | What it does |
|
|
720
725
|
| ---------------------------------------------- | ------------------------------------------------------------ |
|
|
721
726
|
| `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 |
|
|
@@ -728,6 +733,13 @@ entry to the `tasks` array yourself:
|
|
|
728
733
|
| `throughline doctor --session <id-prefix>` | Diagnose a specific session — detect state/transcript drift, idle vs. stuck |
|
|
729
734
|
| `throughline doctor --trim --host claude\|codex` | Diagnose trim host boundaries, manual procedure, and Codex host primitive blockage |
|
|
730
735
|
| `throughline doctor --codex` | Diagnose Codex primary entry state, captured DB sessions, context-refresh memory contract, new-thread handoff readiness, safe continuation status, and host primitive audit |
|
|
736
|
+
| `throughline factory-diagnostics --json` | Versioned read-only native factory readiness JSON for database schema/migration, connector hooks, and representative capture/restore/handoff; does not emit bodies, secrets, absolute paths, or raw state |
|
|
737
|
+
| `throughline runtime-errors snapshot --json` | Read the bounded product-owned runtime error aggregate. Collection occurs only when canonical dotagents config explicitly sets `collection.enabled: true`; this command performs no network I/O |
|
|
738
|
+
| `throughline runtime-errors diagnostics --json` | Read bounded collection/store status without exposing the state path or raw errors |
|
|
739
|
+
| `throughline runtime-errors ack <cursor> --json` | Explicitly acknowledge records through a monotonic cursor; unacknowledged records are never compacted |
|
|
740
|
+
| `throughline runtime-errors resolve <fingerprint> --json` | Explicitly resolve an aggregate; observing the same fingerprint again reopens it |
|
|
741
|
+
| `throughline runtime-errors reopen <fingerprint> --json` | Explicitly reopen a resolved aggregate without fabricating a new occurrence |
|
|
742
|
+
| `throughline runtime-errors compact --json` | Remove only acknowledged, resolved aggregates after retention; open or unacknowledged records remain |
|
|
731
743
|
| `throughline handoff-preview --session <id>` | Print a Codex-facing `throughline_handoff` JSON projection |
|
|
732
744
|
| `throughline codex-capture --codex-thread-id <id>` | Capture active Codex rollout turns into a `codex:<thread_id>` DB session |
|
|
733
745
|
| `throughline codex-summarize --session codex:<id>` | Summarize captured Codex L2 into L1 with the Codex CLI backend |
|
|
@@ -789,9 +801,38 @@ project history.
|
|
|
789
801
|
|
|
790
802
|
---
|
|
791
803
|
|
|
804
|
+
## Spotter auditor context (read-only)
|
|
805
|
+
|
|
806
|
+
`throughline auditor-context` is a **Spotter-only, opt-in read-only
|
|
807
|
+
projection** for an auditor. It does not create, migrate, or write the
|
|
808
|
+
Throughline database. The caller must name an exact `--session` and `--project`;
|
|
809
|
+
the stored session must belong to that project root (or one of its descendants).
|
|
810
|
+
|
|
811
|
+
It returns only completed L2 user/assistant pairs—never L1 summaries, L3 tool
|
|
812
|
+
details, developer messages, or an in-flight Codex turn. Freshness is checked
|
|
813
|
+
against the latest completed pair by origin session, turn number, and normalized
|
|
814
|
+
SHA-256 hashes. Supply that expectation either explicitly, or derive it from a
|
|
815
|
+
Claude JSONL / Codex rollout with `--host claude|codex --transcript`; the two
|
|
816
|
+
sources are mutually exclusive. Returned context is bounded by `--recent-turns`
|
|
817
|
+
(default 2), `--max-body-chars` (1,200), and `--max-total-chars` (4,000).
|
|
818
|
+
|
|
819
|
+
The command is JSON-only. `fresh` is the only status that contains pair bodies;
|
|
820
|
+
`empty`, `stale`, `session_mismatch`, `unavailable`, and `schema_mismatch`
|
|
821
|
+
return no bodies and still exit successfully. Argument and internal errors are
|
|
822
|
+
fixed JSON errors on stderr with a non-zero exit. Spotter owns the
|
|
823
|
+
decision to opt in and any onward transmission of this local projection;
|
|
824
|
+
Throughline only reads and projects it.
|
|
825
|
+
|
|
826
|
+
```bash
|
|
827
|
+
throughline auditor-context --session claude-session-id --project "$PWD" \
|
|
828
|
+
--host claude --transcript "$HOME/.claude/projects/.../session.jsonl" --json
|
|
829
|
+
```
|
|
830
|
+
|
|
831
|
+
---
|
|
832
|
+
|
|
792
833
|
## Requirements
|
|
793
834
|
|
|
794
|
-
- **Node.js >= 22.
|
|
835
|
+
- **Node.js >= 22.13** (for the stable, flag-free built-in `node:sqlite` module — no native build
|
|
795
836
|
required, no `npm install` of SQLite bindings)
|
|
796
837
|
- **Claude Code** with hooks support (`SessionStart`, `Stop`)
|
|
797
838
|
- **Claude Max subscription** (for Haiku-based L1 summarization via `claude -p`)
|
|
@@ -812,7 +853,7 @@ plain `.mjs` files.
|
|
|
812
853
|
└── <session_id>.json Per-session activity state for the monitor
|
|
813
854
|
```
|
|
814
855
|
|
|
815
|
-
Schema
|
|
856
|
+
Schema v8:
|
|
816
857
|
|
|
817
858
|
- `sessions` — one row per `session_id`, with `project_path` and `merged_into`
|
|
818
859
|
- `skeletons` — L1 one-liners, keyed by `(session_id, origin_session_id, turn, role)`
|
|
@@ -970,7 +1011,7 @@ unchanged here.
|
|
|
970
1011
|
|
|
971
1012
|
**Database got corrupted / want a clean slate**
|
|
972
1013
|
Delete `~/.throughline/throughline.db` (and the `-shm` / `-wal` companion files)
|
|
973
|
-
and `~/.throughline/state/*.json`. A fresh database with schema
|
|
1014
|
+
and `~/.throughline/state/*.json`. A fresh database with schema v8 is created on
|
|
974
1015
|
the next hook fire.
|
|
975
1016
|
|
|
976
1017
|
**New session didn't inherit memory from the previous one**
|
package/bin/throughline.mjs
CHANGED
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
* throughline session-start # SessionStart hook (Claude Code から呼ばれる)
|
|
11
11
|
* throughline detail <時刻> # L2+L3 詳細取得 (Claude が Bash 経由で呼ぶ想定)
|
|
12
12
|
* throughline handoff-preview # Codex-facing throughline_handoff JSON preview
|
|
13
|
+
* throughline auditor-context --json # Read-only bounded auditor context JSON
|
|
14
|
+
* throughline factory-diagnostics --json # Native factory read-only readiness JSON
|
|
15
|
+
* throughline runtime-errors snapshot --json # Product-owned runtime error aggregates
|
|
13
16
|
* throughline codex-capture # Capture active Codex rollout turns into Throughline DB
|
|
14
17
|
* throughline codex-hook user-prompt-submit # Codex current-session auto-refresh prompt hook
|
|
15
18
|
* throughline codex-hook post-tool-use # Codex current-session auto-refresh tool-loop hook
|
|
@@ -40,6 +43,7 @@
|
|
|
40
43
|
|
|
41
44
|
const [, , cmd, ...rest] = process.argv;
|
|
42
45
|
|
|
46
|
+
try {
|
|
43
47
|
switch (cmd) {
|
|
44
48
|
case 'install':
|
|
45
49
|
await (await import('../src/cli/install.mjs')).run(rest);
|
|
@@ -65,6 +69,21 @@ switch (cmd) {
|
|
|
65
69
|
case 'handoff-preview':
|
|
66
70
|
await (await import('../src/cli/handoff-preview.mjs')).run(rest);
|
|
67
71
|
break;
|
|
72
|
+
case 'auditor-context': {
|
|
73
|
+
const exitCode = (await import('../src/cli/auditor-context.mjs')).run(rest);
|
|
74
|
+
if (exitCode !== 0) process.exitCode = exitCode;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
case 'factory-diagnostics': {
|
|
78
|
+
const exitCode = (await import('../src/cli/factory-diagnostics.mjs')).run(rest);
|
|
79
|
+
if (exitCode !== 0) process.exitCode = exitCode;
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
case 'runtime-errors': {
|
|
83
|
+
const exitCode = (await import('../src/cli/runtime-errors.mjs')).run(rest);
|
|
84
|
+
if (exitCode !== 0) process.exitCode = exitCode;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
68
87
|
case 'codex-capture':
|
|
69
88
|
await (await import('../src/cli/codex-capture.mjs')).run(rest);
|
|
70
89
|
break;
|
|
@@ -136,6 +155,18 @@ switch (cmd) {
|
|
|
136
155
|
default:
|
|
137
156
|
await showHelp();
|
|
138
157
|
}
|
|
158
|
+
} catch (error) {
|
|
159
|
+
const code = {
|
|
160
|
+
'session-start': 'HOOK_SESSION_START_FAILED',
|
|
161
|
+
'prompt-submit': 'HOOK_PROMPT_SUBMIT_FAILED',
|
|
162
|
+
'process-turn': 'HOOK_PROCESS_TURN_FAILED',
|
|
163
|
+
}[cmd];
|
|
164
|
+
if (code) {
|
|
165
|
+
const { recordRuntimeErrorBestEffort } = await import('../src/runtime-error-store.mjs');
|
|
166
|
+
recordRuntimeErrorBestEffort(code);
|
|
167
|
+
}
|
|
168
|
+
throw error;
|
|
169
|
+
}
|
|
139
170
|
|
|
140
171
|
async function showHelp() {
|
|
141
172
|
const { createRequire } = await import('node:module');
|
|
@@ -149,6 +180,16 @@ Usage:
|
|
|
149
180
|
throughline monitor Multi-session token monitor (use --all, --session <id>)
|
|
150
181
|
throughline detail <time> Retrieve L2+L3 detail for a turn (e.g. 14:23:05 or 14:23-14:30)
|
|
151
182
|
throughline handoff-preview Print Codex-facing throughline_handoff JSON
|
|
183
|
+
throughline auditor-context --session <id> --project <root>
|
|
184
|
+
Read only bounded completed user/assistant context
|
|
185
|
+
for an auditor; requires either --host plus --transcript,
|
|
186
|
+
or explicit pair identity/hashes; always requires --json
|
|
187
|
+
throughline factory-diagnostics --json
|
|
188
|
+
Read-only native factory readiness JSON. Never emits
|
|
189
|
+
session/prompt bodies, secrets, absolute paths, or raw state
|
|
190
|
+
throughline runtime-errors snapshot --json
|
|
191
|
+
Read bounded local runtime error aggregates. Also supports
|
|
192
|
+
diagnostics, ack <cursor>, resolve <fingerprint>, and compact
|
|
152
193
|
throughline codex-capture Capture active Codex rollout turns into DB
|
|
153
194
|
(requires --codex-thread-id or env thread id)
|
|
154
195
|
throughline codex-hook user-prompt-submit
|
package/docs/00_overview.md
CHANGED
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
| [09_rollback_context_trim_insight.md](09_rollback_context_trim_insight.md) | rollback を context delete primitive と見る設計メモ |
|
|
18
18
|
| [10_transcript_injection_plan.md](10_transcript_injection_plan.md) | transcript injection 検証計画と v0.5 実機結果 |
|
|
19
19
|
| [11_codex_monitor_implementation_plan.md](11_codex_monitor_implementation_plan.md) | Codex monitor 対応の実装記録 |
|
|
20
|
+
| [13_native_factory_diagnostics_plan.md](13_native_factory_diagnostics_plan.md) | native factory read-only readiness 診断の実装記録 |
|
|
21
|
+
| [BUGHUB_RUNTIME_ERROR_STORE_PLAN.md](BUGHUB_RUNTIME_ERROR_STORE_PLAN.md) | local runtime error aggregate store の契約と実装 TODO |
|
|
20
22
|
|
|
21
23
|
## Supporting Records
|
|
22
24
|
|
|
@@ -137,6 +137,8 @@ schema v4 で PostToolUse (`capture-tool`) は廃止、L2/L3 は Stop 内で一
|
|
|
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) と [02_clear_auto_handoff_plan.md](02_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
|
+
| **npm 公開 (v0.6.1): Spotter auditor context projection** | `throughline auditor-context`を追加。exact session/projectと最新完了L2 pairのorigin/turn/hash freshnessを検査し、fresh時だけbounded user/assistant本文をversioned JSONで返す。DBはread-onlyで開き、作成・migration・WAL書き込みをしない。Spotter側はproject opt-inでのみ利用する。580 tests、CI 6/6、pack scan、registry global install / doctorを通過し、npm / tag / GitHub Releaseを2026-07-13に公開した |
|
|
141
|
+
| **v0.6.2 release candidate(公開待ち): factory diagnostics + local runtime error store** | `throughline factory-diagnostics --json` と `throughline runtime-errors ... --json` を公開候補へ同期する。collection は canonical dotagents config の `collection.enabled: true` が明示された時だけ有効で既定OFF、store は network I/O を行わない。npm公開、tag、CI、registry由来installの確認はこの時点で未実施であり、公開済みとは扱わない |
|
|
140
142
|
| **未リリース: 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` も有効化する |
|
|
141
143
|
| **グローバル E2E 検証** | 2026-04-17 別ディレクトリから `throughline doctor` 全緑を確認 |
|
|
142
144
|
|
|
@@ -50,7 +50,7 @@ docs 整合: ビルトインコマンドは UserPromptSubmit(prompt 送信時
|
|
|
50
50
|
|
|
51
51
|
### 3. 案A(startup 時間窓フォールバック)不採用の根拠
|
|
52
52
|
|
|
53
|
-
- 幽霊セッション: 2026-07-11 だけで project_path
|
|
53
|
+
- 幽霊セッション: 2026-07-11 だけで user home直下のproject_pathのstartupが **182 件**(03:02〜12:56、最短間隔 0.001 秒、全て bodies=0)。haiku-workdir に 207 件=headless `claude -p` も SessionStart hook を発火する。
|
|
54
54
|
- 幽霊がチェーンに入ると MAX_CHAIN_DEPTH=10([src/session-merger.mjs](../src/session-merger.mjs):14)へ数時間で到達し resolveMergeTarget throw → ターン捕捉が恒久停止=ここで記憶が本当に失われる。
|
|
55
55
|
- source='startup' は「/clear の後継」と「並行して開いた別窓」を原理的に区別できず、稼働中セッションのレコードを relabel して記憶を split する。「bodies>0 の前任だけ選ぶ」は前任側フィルタなので無効(refuter 検証済み)。
|
|
56
56
|
|
|
@@ -90,7 +90,7 @@ docs 整合: ビルトインコマンドは UserPromptSubmit(prompt 送信時
|
|
|
90
90
|
- [x] 本プランを docs/12 として正本化(本文書)
|
|
91
91
|
- [x] rag/01-hooks に SessionEnd reason enum を還流([session-end-reasons.md](../rag/01-hooks/raw/session-end-reasons.md))、rag/INDEX.md に Finding 8 追記
|
|
92
92
|
- [x] 今日の調査を caveat に記録: public `claude-code-clear-userpromptsubmit-hook`(confirmed)/ private `claude-code-desktop-assistant-transcript-jsonl`(tentative・B-2 で更新)
|
|
93
|
-
- [x] 実稼働デプロイ(2026-07-12):
|
|
93
|
+
- [x] 実稼働デプロイ(2026-07-12): ローカルcheckoutをglobal install(symlink化=リポ変更が即時反映。リリース時はregistry版へ戻す)
|
|
94
94
|
|
|
95
95
|
## Workstream B-1 — 捕捉のバックフィル化(先行。A の E2E 品質の前提。挙動修正レーン=挙動差を明文化して個別承認)
|
|
96
96
|
|
|
@@ -117,7 +117,7 @@ docs 整合: ビルトインコマンドは UserPromptSubmit(prompt 送信時
|
|
|
117
117
|
| Desktop セッション削除(675493fb) | 発火(12 秒後) | **`other`** | payload 構造は /clear と完全同一 |
|
|
118
118
|
| VSCode `/clear`(fa43271f) | 即時 | **`clear`** | 42ms 後に後継 SessionStart(source=clear)→auto merge。仕組み自体は健全 |
|
|
119
119
|
|
|
120
|
-
副次発見: Desktop
|
|
120
|
+
副次発見: Desktop のuser home直下の幽霊セッションも SessionEnd(other) を高頻度で発火する。
|
|
121
121
|
- [x] 判定: **NO-GO**。Desktop は /clear で SessionEnd を即時発火するが reason を `other` にラベルし、**セッション削除(明示的破棄)と区別不能**。reason=other でバトンを書くと削除セッションの記憶が次セッションに蘇る誤注入 + 幽霊バトン汚染。reason 不問の退行案は不採用(計画どおり)。→ A Phase 2 は実装せず停止、fallback 裁定へ
|
|
122
122
|
- [x] spike 撤去: settings.json から SessionEnd 登録を削除(JSON 検証済み)、spike ファイル削除(git 履歴に残存)。実測ログ `~/.throughline/logs/session-end-spike.log` は証拠として保全
|
|
123
123
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Wave 4: Native Factory Diagnostics
|
|
2
|
+
|
|
3
|
+
## 目的
|
|
4
|
+
|
|
5
|
+
`throughline factory-diagnostics --json` を追加し、Throughline の native
|
|
6
|
+
factory 接続に必要な read-only readiness を、安定した機械可読 JSON として返す。
|
|
7
|
+
この診断は capture / restore / handoff を実行せず、DB・state・hook 設定・rollout・
|
|
8
|
+
session の本文、秘密、絶対パス、例外詳細を出力しない。
|
|
9
|
+
|
|
10
|
+
## 契約
|
|
11
|
+
|
|
12
|
+
- 診断 schema は versioned とし、CLI version、diagnostic schema、overall、database
|
|
13
|
+
schema/migration、hook、capture / restore / handoff の代表 read-only readiness を返す。
|
|
14
|
+
- 判定値は `ready` / `not_ready` / `not_applicable` / `unverified`。正常に未設定な
|
|
15
|
+
代表入力は `not_applicable`、観測不能・判定不能は `unverified` とし、pass に丸めない。
|
|
16
|
+
- `overall` は `ready` を、必須の applicable check がすべて `ready` の場合だけ返す。
|
|
17
|
+
`unverified` は成功に含めない。
|
|
18
|
+
- 既存の `doctor` / `status` の人間向け stdout 契約は変更しない。既存 helper の
|
|
19
|
+
read-only projection だけを利用し、runtime error store / telemetry は追加しない。
|
|
20
|
+
- CLIは`--json`をちょうど一つ必須とする。exit 0は有効snapshot、exit 1は固定文言の
|
|
21
|
+
internal diagnostic failure、exit 2は固定文言のusage errorを表す。
|
|
22
|
+
- DBは`PRAGMA user_version`だけでgreenにせず、正規table/column/index shapeをread-onlyで
|
|
23
|
+
検証する。handoff memoryは一致確認済みproject/threadだけを数える。
|
|
24
|
+
- restore capabilityとlive smoke evidenceを分離する。未実行smokeは`unverified`だが、
|
|
25
|
+
capability readinessを恒常的に失敗扱いにはしない。
|
|
26
|
+
- Codex hookはcanonical shapeを検査するが、trust実火は機械検証不能なので`unverified`に
|
|
27
|
+
留める。Claude connectorはこの単位では未検査として明示`unverified`にする。
|
|
28
|
+
|
|
29
|
+
## 実施 TODO
|
|
30
|
+
|
|
31
|
+
- [x] 既存の doctor / status、Codex capture、restore、handoff、state schema、hook
|
|
32
|
+
入口、および関連するテストを実読する。
|
|
33
|
+
- [x] 変更前のベースラインとして `npm test` を green で取得する。
|
|
34
|
+
- [x] privacy / schema / characterization fixture を先に追加し、本文・秘密・絶対パスを
|
|
35
|
+
含めない JSON 契約を固定する。
|
|
36
|
+
- [x] read-only factory diagnostics の projection と CLI entrypoint を実装する。
|
|
37
|
+
- [x] version、diagnostic schema、overall、state schema、hook、capture / restore /
|
|
38
|
+
handoff readiness を段階別に返す。
|
|
39
|
+
- [x] help / README の実装済み CLI 仕様を追記する。
|
|
40
|
+
- [x] 対象テスト、`npm test`、`git diff --check` を通し、差分を再読して完了確認する。
|
|
41
|
+
|
|
42
|
+
## 完了条件
|
|
43
|
+
|
|
44
|
+
- JSON は stdout に一つだけ出力され、read-only fixture で DB・state・設定を作成・更新しない。
|
|
45
|
+
- 代表 capture / restore / handoff の未設定と不明を区別し、unverified を ready にしない。
|
|
46
|
+
- 出力・エラーには session / prompt 本文、秘密、絶対パス、raw state / log が含まれない。
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# BugHub runtime error store plan
|
|
2
|
+
|
|
3
|
+
Status: implementation complete; v0.6.2 release pending
|
|
4
|
+
|
|
5
|
+
This plan is the implementation TODO for Throughline's product-owned, local
|
|
6
|
+
runtime error projection. It implements the cross-repository contract in
|
|
7
|
+
`dotagents/docs/plan_bughub-factory-integration.md` without changing the
|
|
8
|
+
existing transcript, handoff, or SQLite memory contracts.
|
|
9
|
+
|
|
10
|
+
## Contract
|
|
11
|
+
|
|
12
|
+
- Collection is disabled unless the canonical dotagents factory reporter
|
|
13
|
+
config exists and contains the JSON boolean `collection.enabled: true`.
|
|
14
|
+
- This module never performs network I/O and never reads
|
|
15
|
+
`reporting.enabled`, endpoints, or credentials.
|
|
16
|
+
- Persist only an allow-listed aggregate: product/version, component, stable
|
|
17
|
+
error code, fixed message template, severity, SHA-256 fingerprint, count,
|
|
18
|
+
first/last seen, state schema version, OS/arch, status, and sequence.
|
|
19
|
+
- Never accept or persist exception objects, stderr/stdout, stacks, prompts,
|
|
20
|
+
session/transcript bodies, absolute paths, file contents, tokens, cookies,
|
|
21
|
+
arbitrary context, or provider output.
|
|
22
|
+
- One failure has one owning observation layer. Existing stderr remains local
|
|
23
|
+
operator diagnostics but is not copied into this store.
|
|
24
|
+
- Store failure must not replace the product failure. Emit one fixed diagnostic
|
|
25
|
+
without reflecting the storage error. Observation runs in a bounded child
|
|
26
|
+
process so blocked config/state I/O cannot hold the original hook result.
|
|
27
|
+
- Use an owner-private directory/file, atomic replacement, monotonic cursor,
|
|
28
|
+
explicit acknowledgement, explicit resolution/reopen, and retention that
|
|
29
|
+
never removes an unacknowledged record.
|
|
30
|
+
- Serialize mutations with a private SQLite `BEGIN IMMEDIATE` mutex. The OS
|
|
31
|
+
releases the lock when a process crashes, so no PID/mtime stale-owner guess
|
|
32
|
+
or application-level reclaim can remove a newer writer's lock.
|
|
33
|
+
|
|
34
|
+
## TODO
|
|
35
|
+
|
|
36
|
+
- [x] Add characterization tests for disabled/missing/malformed config.
|
|
37
|
+
- [x] Add privacy negative fixtures and stable fingerprint aggregation tests.
|
|
38
|
+
- [x] Add acknowledgement, resolution/reopen, retention, mode, and atomic-write tests.
|
|
39
|
+
- [x] Implement the product-owned aggregate store and read-only snapshot API.
|
|
40
|
+
- [x] Add a machine-readable diagnostics projection without exposing state paths.
|
|
41
|
+
- [x] Connect only the top-level hook processing failure boundaries, with fixed
|
|
42
|
+
codes/templates and no duplicate lower-layer observation.
|
|
43
|
+
- [x] Run the complete test suite and update product documentation.
|
|
44
|
+
- [x] Commit and push this repository independently.
|
|
45
|
+
|
|
46
|
+
## Release wave
|
|
47
|
+
|
|
48
|
+
- [x] Bump the package and release-facing documentation to `0.6.2` without moving an existing tag.
|
|
49
|
+
- [x] Run the full test suite, pack inspection, secret/path scan, and temporary-prefix install smoke.
|
|
50
|
+
- [ ] Push the release commit and require the public CI gate to pass.
|
|
51
|
+
- [ ] After the owner H gate, publish `throughline@0.6.2`, create tag/release, and verify npm `latest` plus a registry-derived global install.
|
|
52
|
+
- [ ] Confirm `throughline factory-diagnostics --json` and the runtime-error snapshot/ack commands from the published package, then record the public SHA and results in the changelog and canonical docs.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "throughline",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Claude Code hooks plugin for structured context compression (/clear-safe persistent memory)",
|
|
6
6
|
"keywords": [
|
|
@@ -34,6 +34,6 @@
|
|
|
34
34
|
"test": "node --import ./src/test-env.mjs --test src/*.test.mjs src/cli/*.test.mjs"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
37
|
-
"node": ">=22.
|
|
37
|
+
"node": ">=22.13"
|
|
38
38
|
}
|
|
39
39
|
}
|