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.
- package/CHANGELOG.md +88 -27
- package/README.ja.md +83 -49
- package/README.md +106 -78
- package/bin/throughline.mjs +32 -13
- package/docs/00_overview.md +56 -42
- package/docs/01_l1_l2_l3_redesign.md +1 -1
- package/docs/02_clear_auto_handoff_plan.md +39 -333
- package/docs/04_public_release_plan.md +73 -190
- package/docs/05_codex_first_roadmap.md +4 -4
- package/docs/06_codex_trim_rollback_fix_plan.md +1 -1
- package/docs/08_codex_dual_support.md +1 -1
- package/docs/09_rollback_context_trim_insight.md +1 -1
- package/docs/12_desktop_clear_handoff_plan.md +6 -213
- package/docs/15_windows_ci_release_latency_plan.md +6 -87
- package/docs/16_readonly_handoff_context_plan.md +7 -38
- package/docs/adr/0005-observer-read-pagination.md +1 -1
- package/docs/adr/0014-two-phase-handoff-ghost-baton.md +1 -1
- package/docs/adr/0019-product-owned-database-migration-acceptance.md +1 -1
- package/docs/adr/0021-grok-host-capture.md +1 -1
- package/docs/adr/0022-cursor-host-capture.md +39 -0
- package/docs/archive/02_clear_auto_handoff_plan.md +350 -0
- package/docs/{03_inheritance_on_clear_only.md → archive/03_inheritance_on_clear_only.md} +22 -22
- package/docs/{07_codex_trim_implementation_plan.md → archive/07_codex_trim_implementation_plan.md} +8 -8
- package/docs/{10_transcript_injection_plan.md → archive/10_transcript_injection_plan.md} +12 -12
- package/docs/archive/12_desktop_clear_handoff_plan.md +218 -0
- package/docs/{14_observer_completed_turn_feed_plan.md → archive/14_observer_completed_turn_feed_plan.md} +7 -7
- package/docs/archive/15_windows_ci_release_latency_plan.md +89 -0
- package/docs/archive/16_readonly_handoff_context_plan.md +40 -0
- package/docs/archive/README.md +28 -15
- package/docs/archive/plan_grok-successor-launch.md +99 -0
- package/docs/archive/room-log_throughline_20260830-155052.md +285 -0
- package/docs/plan_grok-successor-launch.md +6 -97
- package/package.json +19 -11
- package/rag/INDEX.md +2 -2
- package/src/baton.mjs +11 -9
- package/src/cli/handoff-context.test.mjs +36 -0
- package/src/cli/help.test.mjs +5 -0
- package/src/cli/install.mjs +91 -0
- package/src/cli/install.test.mjs +57 -0
- package/src/cli/runtime-errors.mjs +9 -3
- package/src/cli/runtime-errors.test.mjs +13 -13
- package/src/cli/self-update.mjs +402 -0
- package/src/cli/self-update.test.mjs +525 -0
- package/src/db.mjs +1 -1
- package/src/docs-contract.test.mjs +153 -0
- package/src/hosts/claude.mjs +1 -0
- package/src/hosts/codex.mjs +1 -0
- package/src/hosts/cursor.mjs +128 -0
- package/src/hosts/cursor.test.mjs +104 -0
- package/src/hosts/grok.mjs +1 -0
- package/src/hosts/identity.mjs +19 -2
- package/src/hosts/identity.test.mjs +27 -4
- package/src/hosts/index.mjs +11 -2
- package/src/product-ci-contract.test.mjs +14 -0
- package/src/prompt-submit.mjs +8 -10
- package/src/resume-context.mjs +4 -4
- package/src/runtime-error-hook.test.mjs +4 -6
- package/src/runtime-error-store.mjs +40 -18
- package/src/runtime-error-store.test.mjs +53 -26
- package/src/session-merger.mjs +16 -7
- package/src/session-merger.test.mjs +27 -0
- package/src/session-start.mjs +24 -1
- package/src/spike-transcript-writer.mjs +1 -1
- package/src/transcript-reader-cursor.test.mjs +43 -0
- package/src/transcript-reader.mjs +14 -7
- /package/docs/{11_codex_monitor_implementation_plan.md → archive/11_codex_monitor_implementation_plan.md} +0 -0
- /package/docs/{13_native_factory_diagnostics_plan.md → archive/13_native_factory_diagnostics_plan.md} +0 -0
- /package/docs/{BUGHUB_RUNTIME_ERROR_STORE_PLAN.md → archive/BUGHUB_RUNTIME_ERROR_STORE_PLAN.md} +0 -0
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src=".github/og.png" alt="Throughline — a whale family carrying direction and memory across changing boundaries" width="100%">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/kitepon/Throughline/main/.github/og.png" alt="Throughline — a whale family carrying direction and memory across changing boundaries" width="100%">
|
|
3
3
|
<br>
|
|
4
4
|
<sub><em>This image represents continuity that preserves relationships, direction, and memory even as environments and boundaries change.</em></sub>
|
|
5
5
|
</p>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
[](https://www.npmjs.com/package/throughline)
|
|
10
10
|
[](LICENSE)
|
|
11
11
|
[](https://nodejs.org)
|
|
12
|
-
[](https://github.com/kitepon/Throughline/actions/workflows/test.yml)
|
|
13
13
|
|
|
14
14
|
**English** · [日本語](README.ja.md)
|
|
15
15
|
|
|
@@ -20,10 +20,12 @@ Built and maintained by [Quo](https://x.com/QLyun35332) at [kitepon.dev](https:/
|
|
|
20
20
|
|
|
21
21
|
## Ownership boundary
|
|
22
22
|
|
|
23
|
-
This repository owns
|
|
24
|
-
diagnostics
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
This repository owns installation, configuration, state, schema and migrations,
|
|
24
|
+
diagnostics, recovery, updates, and release decisions. Throughline works on its
|
|
25
|
+
own through the documented CLI and does not require a factory controller.
|
|
26
|
+
[dotagents](https://github.com/kitepon/dotagents) may wire Throughline into the
|
|
27
|
+
kitepon.dev development factory, but it integrates the product rather than
|
|
28
|
+
owning its state or controlling its lifecycle.
|
|
27
29
|
MarkItDown is a separately managed third-party CLI.
|
|
28
30
|
|
|
29
31
|
## In 30 seconds
|
|
@@ -34,15 +36,23 @@ throughline install # registers hooks/skills and provisions the VS Code moni
|
|
|
34
36
|
```
|
|
35
37
|
|
|
36
38
|
That's it. Open any Claude Code session and your turns flow into
|
|
37
|
-
`~/.throughline/throughline.db` automatically.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
`~/.throughline/throughline.db` automatically. In VS Code, `/clear` resumes
|
|
40
|
+
through the `SessionStart source='clear'` auto path. Claude Desktop does not
|
|
41
|
+
emit that source, so type `/tl` before `/clear` there. Use `/tl` before any
|
|
42
|
+
other boundary, such as a brand-new chat or a VS Code restart, when you want
|
|
43
|
+
to name the predecessor exactly.
|
|
41
44
|
|
|
42
45
|
Grok Desktop is also a first-class host. `throughline install` writes
|
|
43
46
|
`~/.grok/hooks/throughline.json`. On Grok, `/tl` does not inject into the
|
|
44
47
|
current window — it starts a new Terminal seat. See below.
|
|
45
48
|
|
|
49
|
+
Cursor is also a first-class host. `throughline install` upserts
|
|
50
|
+
`sessionStart` / `beforeSubmitPrompt` / `stop` into `~/.cursor/hooks.json` and
|
|
51
|
+
leaves factory hooks in place. Capture reads Cursor `agent-transcripts` jsonl.
|
|
52
|
+
Handoff injection uses `sessionStart` `additional_context`. `/tl` does not
|
|
53
|
+
auto-launch a successor Cursor chat — the next new conversation drinks the
|
|
54
|
+
baton. See [ADR 0022](docs/adr/0022-cursor-host-capture.md).
|
|
55
|
+
|
|
46
56
|
<details>
|
|
47
57
|
<summary><b>Also using Codex?</b> Global install registers Codex hooks too — click for details.</summary>
|
|
48
58
|
|
|
@@ -107,7 +117,7 @@ one or two turns, then `/tl`.
|
|
|
107
117
|
| **Memory after the boundary** | ✅ recent turns verbatim (whole, budget-packed) + everything older via `recall` pull + L3 on demand | ❌ zero | △ lossy single summary | △ lossy summary |
|
|
108
118
|
| **Tool I/O handling** | retired to L3, retrievable by `/sc-detail HH:MM:SS` | gone | folded into summary, unreadable | folded into summary |
|
|
109
119
|
| **Coding-assistant fit** | high — tool I/O is the heavy 80% | low — you lose the thread | medium — but irreversible | medium |
|
|
110
|
-
| **Auto-inheritance risk** | low (
|
|
120
|
+
| **Auto-inheritance risk** | low (`/tl` names the predecessor; VS Code `/clear` freezes one transcript-backed candidate) | n/a | n/a | high |
|
|
111
121
|
| **Runtime deps** | **zero** (Node 22.13+ built-in `node:sqlite`) | n/a | n/a | many |
|
|
112
122
|
| **Multi-session token monitor** | ✅ real `message.usage` / Codex rollout `token_count` | — | — | — |
|
|
113
123
|
|
|
@@ -224,18 +234,19 @@ of tool inputs, tool outputs, and hook output captured at L3 for that turn.
|
|
|
224
234
|
|
|
225
235
|
---
|
|
226
236
|
|
|
227
|
-
## Inheritance:
|
|
237
|
+
## Inheritance: `/tl` writes a baton; VS Code `/clear` uses `source='clear'`
|
|
228
238
|
|
|
229
|
-
Throughline
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
239
|
+
Throughline supports two inheritance paths. A `/tl` baton names one predecessor
|
|
240
|
+
exactly. If no eligible baton exists, the VS Code `/clear` path can use the
|
|
241
|
+
`SessionStart source='clear'` signal to freeze one transcript-backed predecessor.
|
|
242
|
+
The baton is checked first.
|
|
233
243
|
|
|
234
244
|
```mermaid
|
|
235
245
|
flowchart LR
|
|
236
|
-
U["User types<br/>/
|
|
246
|
+
U["User types<br/>/tl"] -->|UserPromptSubmit| W["writeBaton<br/>(session_id + TTL 1h)"]
|
|
237
247
|
W --> B[("handoff_batons<br/>SQLite")]
|
|
238
|
-
M["
|
|
248
|
+
M["VS Code<br/>/clear"] -->|SessionStart source='clear'| X["freeze predecessor<br/>no baton"]
|
|
249
|
+
D["Claude Desktop<br/>/clear"] -->|source='startup'| N["no automatic handoff<br/>use /tl first"]
|
|
239
250
|
NS["Next SessionStart<br/>(registers intent only)"] --> FP["First user prompt<br/>(proof the session is real)"]
|
|
240
251
|
FP --> C{"baton<br/>present?"}
|
|
241
252
|
B -.-> C
|
|
@@ -254,10 +265,10 @@ flowchart LR
|
|
|
254
265
|
class P3,INJ neutral
|
|
255
266
|
```
|
|
256
267
|
|
|
257
|
-
### baton path
|
|
268
|
+
### baton path: `/tl` → deterministic inheritance
|
|
258
269
|
|
|
259
|
-
When the user types `/
|
|
260
|
-
|
|
270
|
+
When the user types `/tl`, the `UserPromptSubmit` hook writes a handoff baton
|
|
271
|
+
with **that session's `session_id`** into the
|
|
261
272
|
`handoff_batons` table. The next new session consumes the baton **at its
|
|
262
273
|
first user prompt** (eligibility: the session must have been born within the
|
|
263
274
|
1-hour TTL after the baton was written) and merges that exact predecessor's
|
|
@@ -274,28 +285,29 @@ started empty. Deferring consumption to the first user prompt closes this:
|
|
|
274
285
|
a ghost never submits a prompt, so it can never take the baton (ADR 0014).
|
|
275
286
|
|
|
276
287
|
This path is deterministic: it names the predecessor by id rather than
|
|
277
|
-
guessing, so multi-window
|
|
278
|
-
|
|
288
|
+
guessing, so it is the explicit path for multi-window work and for hosts that
|
|
289
|
+
do not emit `source='clear'`.
|
|
279
290
|
|
|
280
291
|
```
|
|
281
|
-
|
|
282
|
-
typed /tl: Session A → /tl → (new chat / restart) → Session B (consumes baton, merges A)
|
|
292
|
+
/tl: Session A → /tl → (/clear, new chat, or restart) → Session B (consumes A's baton)
|
|
283
293
|
```
|
|
284
294
|
|
|
285
|
-
### auto path
|
|
295
|
+
### auto path: VS Code `source='clear'` → frozen predecessor
|
|
286
296
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
`UserPromptSubmit`), Throughline resolves the most recent unmerged session
|
|
297
|
+
The built-in `/clear` command does **not** reach `UserPromptSubmit` on the
|
|
298
|
+
tested Claude Code clients. VS Code instead sends `SessionStart source='clear'`.
|
|
299
|
+
When no baton is present, Throughline resolves the most recent unmerged session
|
|
291
300
|
for the same project **at `SessionStart` time** (freezing that choice, and
|
|
292
301
|
skipping candidates that have no transcript — i.e. ghosts) and performs the
|
|
293
302
|
merge + injection at the session's first user prompt.
|
|
294
303
|
|
|
295
304
|
Set `THROUGHLINE_DISABLE_AUTO_HANDOFF=1` in your environment to opt out of
|
|
296
|
-
this
|
|
297
|
-
|
|
298
|
-
|
|
305
|
+
this path. The env var does not disable explicit `/tl` batons.
|
|
306
|
+
|
|
307
|
+
Claude Desktop neither forwards built-in `/clear` to `UserPromptSubmit` nor
|
|
308
|
+
emits `SessionStart source='clear'`; use `/tl` before `/clear` there. The
|
|
309
|
+
cross-client measurements and upstream report are recorded in the archived
|
|
310
|
+
[`docs/12_desktop_clear_handoff_plan.md`](docs/archive/12_desktop_clear_handoff_plan.md).
|
|
299
311
|
|
|
300
312
|
### What gets injected
|
|
301
313
|
|
|
@@ -328,7 +340,8 @@ pinning the latest exchange at the top of the injection prevents that drift.
|
|
|
328
340
|
Each merged row keeps its `origin_session_id`, so repeated handoffs
|
|
329
341
|
accumulate memory through chains:
|
|
330
342
|
|
|
331
|
-
```
|
|
343
|
+
```text
|
|
344
|
+
VS Code:
|
|
332
345
|
S1 (4 turns) --/clear--> S2 (auto-merges S1, adds 3 turns) --/clear--> S3 (auto-merges S2, adds 5 turns)
|
|
333
346
|
origin=S1×4 origin=S1×4, S2×3, S3×5
|
|
334
347
|
```
|
|
@@ -447,9 +460,10 @@ rollout text, not an exact host tokenizer measurement. If rollback candidate
|
|
|
447
460
|
turns are `0`, there is no current trim saving under the active keep-recent
|
|
448
461
|
setting.
|
|
449
462
|
|
|
450
|
-
Claude-side rewind UI itself is not driven by Throughline.
|
|
451
|
-
flow is `/clear` → new session → automatic injection of curated
|
|
452
|
-
session's first user prompt.
|
|
463
|
+
Claude-side rewind UI itself is not driven by Throughline. In VS Code, the
|
|
464
|
+
auto-handoff flow is `/clear` → new session → automatic injection of curated
|
|
465
|
+
memory at the session's first user prompt. Claude Desktop requires `/tl`
|
|
466
|
+
before `/clear`.
|
|
453
467
|
Throughline does not invoke `/rewind` or any Claude Code internal command.
|
|
454
468
|
|
|
455
469
|
Codex-primary setup has an installed Stop hook after global
|
|
@@ -803,17 +817,18 @@ entry to the `tasks` array yourself:
|
|
|
803
817
|
|
|
804
818
|
## Commands
|
|
805
819
|
|
|
806
|
-
**
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
normal handoff behavior remain available
|
|
811
|
-
local-only contracts.
|
|
820
|
+
**The current release is v0.10.5.** Throughline supports Claude Code, Codex,
|
|
821
|
+
Grok, and Cursor as documented host adapters. The versioned, read-only
|
|
822
|
+
`handoff-context` boundary opens only an existing database and leaves baton
|
|
823
|
+
state, session ownership, and memory rows unchanged. Factory diagnostics,
|
|
824
|
+
Observer, runtime-error, capture, and normal handoff behavior remain available
|
|
825
|
+
under the same explicit-failure and local-only contracts.
|
|
812
826
|
|
|
813
827
|
| Command | What it does |
|
|
814
828
|
| ---------------------------------------------- | ------------------------------------------------------------ |
|
|
815
829
|
| `throughline install` | Register Claude user hooks/slash commands, the global Codex UserPromptSubmit/PostToolUse/Stop hooks, the global `$throughline` Codex skill, `~/.grok/hooks/throughline.json`, and the current VS Code monitor task when applicable |
|
|
816
830
|
| `throughline install --project` | Register Claude hooks/slash commands in this repo only |
|
|
831
|
+
| `throughline self-update [--json]` | Update the official npm package, verify that public PATH resolves to that new CLI/version, reapply product-owned integrations, migrate an existing database, and verify public diagnostics in one call |
|
|
817
832
|
| `throughline uninstall` | Remove Throughline-managed Claude hooks/slash commands, only the Throughline-managed Codex hook, and the `$throughline` Codex skill |
|
|
818
833
|
| `throughline monitor [--all] [--session <id>]` | Run the multi-session token monitor |
|
|
819
834
|
| `throughline monitor --diag` | Dump TTY/columns/env diagnostics (for debugging monitor render bugs) |
|
|
@@ -827,7 +842,9 @@ local-only contracts.
|
|
|
827
842
|
| `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 |
|
|
828
843
|
| `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 |
|
|
829
844
|
| `throughline migrate --json` | Migrate only an existing Throughline database to the current schema and emit a versioned bounded result; a missing database is not created, while future schemas and migration failures exit non-zero |
|
|
830
|
-
| `throughline runtime-errors
|
|
845
|
+
| `throughline runtime-errors enable --json` | Enable product-owned local runtime error collection in Throughline's own config; default is disabled |
|
|
846
|
+
| `throughline runtime-errors disable --json` | Disable product-owned local runtime error collection |
|
|
847
|
+
| `throughline runtime-errors snapshot --json` | Read the bounded product-owned runtime error aggregate; this command performs no network I/O |
|
|
831
848
|
| `throughline runtime-errors diagnostics --json` | Read bounded collection/store status without exposing the state path or raw errors |
|
|
832
849
|
| `throughline runtime-errors ack <cursor> --json` | Explicitly acknowledge records through a monotonic cursor; unacknowledged records are never compacted |
|
|
833
850
|
| `throughline runtime-errors resolve <fingerprint> --json` | Explicitly resolve an aggregate; observing the same fingerprint again reopens it |
|
|
@@ -858,6 +875,24 @@ local-only contracts.
|
|
|
858
875
|
| `throughline status` | Print DB statistics (sessions, skeletons, bodies, details) |
|
|
859
876
|
| `throughline --version` | Print the installed version |
|
|
860
877
|
|
|
878
|
+
### Product-owned runtime error collection
|
|
879
|
+
|
|
880
|
+
Collection is off by default. Enable it through Throughline's own CLI:
|
|
881
|
+
|
|
882
|
+
```bash
|
|
883
|
+
throughline runtime-errors enable --json
|
|
884
|
+
throughline runtime-errors diagnostics --json
|
|
885
|
+
```
|
|
886
|
+
|
|
887
|
+
The product-owned config is
|
|
888
|
+
`$XDG_CONFIG_HOME/throughline/runtime-errors.config.json` on macOS/Linux
|
|
889
|
+
(`~/.config/throughline/...` when `XDG_CONFIG_HOME` is unset) and
|
|
890
|
+
`%LOCALAPPDATA%\throughline\runtime-errors.config.json` on Windows. The CLI
|
|
891
|
+
writes the versioned `throughline.runtime_error_config.v1` shape with private
|
|
892
|
+
permissions. `disable --json` changes only this product config. Throughline
|
|
893
|
+
does not read dotagents configuration; factory integration consumes the public
|
|
894
|
+
`runtime-errors ... --json` contract.
|
|
895
|
+
|
|
861
896
|
### Read-only handoff context for local launchers
|
|
862
897
|
|
|
863
898
|
Use this boundary when a local launcher needs Throughline memory without
|
|
@@ -879,21 +914,19 @@ Slash commands (invoked by the user in Claude Code):
|
|
|
879
914
|
|
|
880
915
|
| Command | What it does |
|
|
881
916
|
| ------------- | ----------------------------------------------------------------- |
|
|
882
|
-
| `/tl` | Write a handoff baton
|
|
883
|
-
| `/clear` | Built-in Claude Code reset.
|
|
917
|
+
| `/tl` | Write a handoff baton that names the predecessor exactly (use before a new chat, restart, or Claude Desktop `/clear`). On Grok, also launches `grok-continue` after a successful baton write |
|
|
918
|
+
| `/clear` | Built-in Claude Code reset. VS Code can auto-inherit through `SessionStart source='clear'`; Claude Desktop requires `/tl` first |
|
|
884
919
|
| `/sc-detail <time>` | Retrieve L2 body text and L3 tool I/O for a past turn |
|
|
885
920
|
|
|
886
|
-
>
|
|
887
|
-
>
|
|
888
|
-
>
|
|
889
|
-
>
|
|
890
|
-
> fallback for `/clear` triggered outside `UserPromptSubmit` (for example via
|
|
891
|
-
> the VSCode extension menu); `THROUGHLINE_DISABLE_AUTO_HANDOFF=1` only opts
|
|
892
|
-
> out of that fallback.
|
|
921
|
+
> Built-in `/clear` does not reach the tested clients' `UserPromptSubmit` hook.
|
|
922
|
+
> `/tl` is the deterministic baton path. VS Code `/clear` uses the separate
|
|
923
|
+
> `source='clear'` auto path; `THROUGHLINE_DISABLE_AUTO_HANDOFF=1` disables only
|
|
924
|
+
> that auto path.
|
|
893
925
|
|
|
894
926
|
Hook subcommands (invoked by Claude Code, not by humans):
|
|
895
927
|
`session-start` (SessionStart), `process-turn` (Stop),
|
|
896
|
-
`prompt-submit` (UserPromptSubmit —
|
|
928
|
+
`prompt-submit` (UserPromptSubmit — executes pending handoff and writes `/tl`
|
|
929
|
+
batons; Grok `/tl` also launches `grok-continue`).
|
|
897
930
|
|
|
898
931
|
### Observer completed-turn feed (development)
|
|
899
932
|
|
|
@@ -991,13 +1024,13 @@ plain `.mjs` files.
|
|
|
991
1024
|
└── <session_id>.json Per-session activity state for the monitor
|
|
992
1025
|
```
|
|
993
1026
|
|
|
994
|
-
Schema
|
|
1027
|
+
Schema v9:
|
|
995
1028
|
|
|
996
1029
|
- `sessions` — one row per `session_id`, with `project_path` and `merged_into`
|
|
997
1030
|
- `skeletons` — L1 one-liners, keyed by `(session_id, origin_session_id, turn, role)`
|
|
998
1031
|
- `bodies` — L2 verbatim text (user + assistant), same key shape
|
|
999
1032
|
- `details` — L3 records with `kind` column (`tool_input` / `tool_output` / `system` / `image` / `thinking`) and `source_id` for idempotent re-processing
|
|
1000
|
-
- `handoff_batons` — one row per `project_path`, with `session_id` and `created_at`. Written by the `UserPromptSubmit` hook
|
|
1033
|
+
- `handoff_batons` — one row per `project_path`, with `session_id` and `created_at`. Written by the `UserPromptSubmit` hook for `/tl`. A compatibility `/clear` branch remains in the hook, but tested built-in `/clear` commands are not forwarded to it. The next new session consumes and deletes an eligible baton at its **first user prompt**, if it was born within the 1-hour TTL. (v8 dropped the `memo_text` column when memo was retired in v0.4.0.)
|
|
1001
1034
|
- `pending_handoffs` — one row per newborn session (`session_id` PK, `project_path`, `source`, `auto_predecessor_id`, `created_at`). Registered by `SessionStart`, consumed exactly once by the session's first `UserPromptSubmit`. Rows belonging to ghost sessions are never consumed and stay behind harmlessly (a few hundred bytes each). Added in v9 (ADR 0014).
|
|
1002
1035
|
- `injection_log` — audit trail of injection events
|
|
1003
1036
|
|
|
@@ -1154,23 +1187,21 @@ and `~/.throughline/state/*.json`. A fresh database with schema v9 is created on
|
|
|
1154
1187
|
the next hook fire.
|
|
1155
1188
|
|
|
1156
1189
|
**New session didn't inherit memory from the previous one**
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
never recorded (no Stop hook fired — check `throughline status`),
|
|
1161
|
-
1-hour baton TTL expired before the new session opened, (c) the new
|
|
1162
|
-
`project_path` (cwd) differs from the previous one,
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
Memory is still in SQLite — you can retrieve specific turns with
|
|
1166
|
-
`/sc-detail <time>`.
|
|
1190
|
+
Use `/tl` before the boundary when you need deterministic inheritance. VS Code
|
|
1191
|
+
`/clear` can also use the `source='clear'` auto path; Claude Desktop cannot, so
|
|
1192
|
+
it requires `/tl` before `/clear`. Other likely causes are: (a) the previous
|
|
1193
|
+
session was never recorded (no Stop hook fired — check `throughline status`),
|
|
1194
|
+
(b) the 1-hour baton TTL expired before the new session opened, (c) the new
|
|
1195
|
+
session's `project_path` (cwd) differs from the previous one, or (d)
|
|
1196
|
+
`THROUGHLINE_DISABLE_AUTO_HANDOFF=1` disabled the VS Code auto path. Memory is
|
|
1197
|
+
still in SQLite — retrieve specific turns with `/sc-detail <time>`.
|
|
1167
1198
|
|
|
1168
1199
|
---
|
|
1169
1200
|
|
|
1170
1201
|
## Development
|
|
1171
1202
|
|
|
1172
1203
|
```bash
|
|
1173
|
-
git clone https://github.com/kitepon
|
|
1204
|
+
git clone https://github.com/kitepon/Throughline.git
|
|
1174
1205
|
cd Throughline
|
|
1175
1206
|
npm link # Put `throughline` on PATH (dev only)
|
|
1176
1207
|
throughline install --project # Register hooks for this repo only
|
|
@@ -1196,9 +1227,8 @@ the first generation to pick up the auto-start task.
|
|
|
1196
1227
|
- [`docs/01_l1_l2_l3_redesign.md`](docs/01_l1_l2_l3_redesign.md) — **core design
|
|
1197
1228
|
spec** for the L1/L2/L3 differential layer model (schema v4 base + v5 L3
|
|
1198
1229
|
classification extension). Authoritative for the memory layering rules.
|
|
1199
|
-
- [`docs/
|
|
1200
|
-
|
|
1201
|
-
why the current inheritance is opt-in rather than heuristic.
|
|
1230
|
+
- [`docs/02_clear_auto_handoff_plan.md`](docs/02_clear_auto_handoff_plan.md) —
|
|
1231
|
+
current `/clear` and `/tl` handoff contract.
|
|
1202
1232
|
- [`docs/08_codex_dual_support.md`](docs/08_codex_dual_support.md) —
|
|
1203
1233
|
architecture brief for adding Codex support without replacing the Claude
|
|
1204
1234
|
Code hook/slash-command path.
|
|
@@ -1208,17 +1238,15 @@ the first generation to pick up the auto-start task.
|
|
|
1208
1238
|
- [`docs/05_codex_first_roadmap.md`](docs/05_codex_first_roadmap.md) —
|
|
1209
1239
|
current next-phase TODO plan: Codex primary first, Codex rewind-compatible
|
|
1210
1240
|
trim next, Claude rewind finalization after that.
|
|
1211
|
-
- [`docs/07_codex_trim_implementation_plan.md`](docs/07_codex_trim_implementation_plan.md) —
|
|
1212
|
-
historical integrated TODO plan and implementation record for Claude/Codex
|
|
1213
|
-
dual support and rollback trim.
|
|
1214
1241
|
- [`docs/04_public_release_plan.md`](docs/04_public_release_plan.md) — public
|
|
1215
1242
|
release plan, implementation status by version, § 0 fallback rule, and
|
|
1216
1243
|
remaining tasks.
|
|
1217
|
-
- [`docs/
|
|
1218
|
-
|
|
1219
|
-
- [`docs/
|
|
1220
|
-
|
|
1221
|
-
|
|
1244
|
+
- [`docs/archive/12_desktop_clear_handoff_plan.md`](docs/archive/12_desktop_clear_handoff_plan.md) —
|
|
1245
|
+
historical Claude Desktop measurements, NO-GO decision, and backfill acceptance.
|
|
1246
|
+
- [`docs/00_overview.md`](docs/00_overview.md) — current/history/evidence map and
|
|
1247
|
+
document lifecycle rules.
|
|
1248
|
+
- [`docs/archive/`](docs/archive/) — completed plans and superseded designs,
|
|
1249
|
+
kept only for historical reference.
|
|
1222
1250
|
|
|
1223
1251
|
---
|
|
1224
1252
|
|
package/bin/throughline.mjs
CHANGED
|
@@ -16,10 +16,12 @@
|
|
|
16
16
|
* throughline auditor-context --json # Read-only bounded auditor context JSON
|
|
17
17
|
* throughline factory-diagnostics --json # Native factory read-only readiness JSON
|
|
18
18
|
* throughline migrate --json # Migrate the existing Throughline database only
|
|
19
|
-
* throughline
|
|
19
|
+
* throughline self-update # Update package, integrations, database, and verify the result
|
|
20
|
+
* throughline runtime-errors enable --json # Enable product-owned runtime error collection
|
|
21
|
+
* throughline runtime-errors snapshot --json # Read product-owned runtime error aggregates
|
|
20
22
|
* throughline codex-capture # Capture active Codex rollout turns into Throughline DB
|
|
21
|
-
* throughline codex-hook user-prompt-submit # Codex
|
|
22
|
-
* throughline codex-hook post-tool-use # Codex
|
|
23
|
+
* throughline codex-hook user-prompt-submit # Codex rollout capture + monitor state hook
|
|
24
|
+
* throughline codex-hook post-tool-use # Codex tool-loop capture + monitor state hook
|
|
23
25
|
* throughline codex-hook stop # Codex native Stop hook (capture + L1 summarize)
|
|
24
26
|
* throughline codex-summarize # Summarize captured Codex L2 turns into L1 via Codex CLI
|
|
25
27
|
* throughline codex-resume # Render Codex active-work context from DB
|
|
@@ -113,6 +115,11 @@ switch (cmd) {
|
|
|
113
115
|
if (exitCode !== 0) process.exitCode = exitCode;
|
|
114
116
|
break;
|
|
115
117
|
}
|
|
118
|
+
case 'self-update': {
|
|
119
|
+
const exitCode = (await import('../src/cli/self-update.mjs')).run(rest);
|
|
120
|
+
if (exitCode !== 0) process.exitCode = exitCode;
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
116
123
|
case 'runtime-errors': {
|
|
117
124
|
const exitCode = (await import('../src/cli/runtime-errors.mjs')).run(rest);
|
|
118
125
|
if (exitCode !== 0) process.exitCode = exitCode;
|
|
@@ -186,6 +193,15 @@ switch (cmd) {
|
|
|
186
193
|
console.log(pkg.version);
|
|
187
194
|
break;
|
|
188
195
|
}
|
|
196
|
+
case '--self-update-identity': {
|
|
197
|
+
if (rest.length > 0) {
|
|
198
|
+
process.exitCode = 2;
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
const { buildSelfUpdateIdentity } = await import('../src/cli/self-update.mjs');
|
|
202
|
+
console.log(JSON.stringify(buildSelfUpdateIdentity()));
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
189
205
|
default:
|
|
190
206
|
await showHelp();
|
|
191
207
|
}
|
|
@@ -235,22 +251,25 @@ Usage:
|
|
|
235
251
|
session/prompt bodies, secrets, absolute paths, or raw state
|
|
236
252
|
throughline migrate --json Migrate the existing Throughline database only.
|
|
237
253
|
Does not create a missing database and emits a versioned JSON result
|
|
238
|
-
throughline
|
|
239
|
-
|
|
240
|
-
|
|
254
|
+
throughline self-update [--json]
|
|
255
|
+
Update the official npm package, reapply product-owned
|
|
256
|
+
integrations, migrate an existing database, and verify
|
|
257
|
+
the installed version and public diagnostics in one call
|
|
258
|
+
throughline runtime-errors enable --json
|
|
259
|
+
Enable product-owned local runtime error collection.
|
|
260
|
+
Also supports disable, snapshot, diagnostics, ack <cursor>,
|
|
261
|
+
resolve <fingerprint>, reopen <fingerprint>, and compact
|
|
241
262
|
throughline codex-capture Capture active Codex rollout turns into DB
|
|
242
263
|
(requires --codex-thread-id or env thread id)
|
|
243
264
|
throughline codex-hook user-prompt-submit
|
|
244
|
-
Codex UserPromptSubmit hook: capture rollout and
|
|
245
|
-
|
|
246
|
-
instruction from verified rollout token_count
|
|
265
|
+
Codex UserPromptSubmit hook: capture rollout and
|
|
266
|
+
write monitor state; automatic refresh is disabled
|
|
247
267
|
throughline codex-hook post-tool-use
|
|
248
268
|
Codex PostToolUse hook: during tool loops, capture
|
|
249
|
-
rollout and
|
|
250
|
-
instruction from verified rollout token_count
|
|
269
|
+
rollout and write monitor state; no instruction injection
|
|
251
270
|
throughline codex-hook stop Codex native Stop hook: capture rollout,
|
|
252
|
-
summarize old L2 turns into L1, and
|
|
253
|
-
|
|
271
|
+
summarize old L2 turns into L1, and write monitor state;
|
|
272
|
+
automatic current-thread refresh is disabled
|
|
254
273
|
throughline codex-summarize Summarize captured Codex L2 into L1 via Codex CLI
|
|
255
274
|
(requires a codex:<thread-id> session)
|
|
256
275
|
throughline codex-resume Render Codex active-work context from DB
|
package/docs/00_overview.md
CHANGED
|
@@ -1,58 +1,72 @@
|
|
|
1
1
|
# Throughline Documentation Overview
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Throughline の文書は、現行契約・履歴・証拠を分ける。通常作業で読むのはこのページの
|
|
4
|
+
「現行契約」だけであり、完了済み計画を無意識に読み込ませない。
|
|
4
5
|
|
|
5
|
-
##
|
|
6
|
+
## 現行契約
|
|
6
7
|
|
|
7
8
|
| 文書 | 役割 |
|
|
8
9
|
|---|---|
|
|
9
|
-
| [
|
|
10
|
-
| [
|
|
11
|
-
| [
|
|
12
|
-
| [
|
|
13
|
-
| [
|
|
14
|
-
| [
|
|
15
|
-
| [
|
|
16
|
-
| [
|
|
17
|
-
| [
|
|
18
|
-
| [
|
|
19
|
-
| [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
10
|
+
| [../README.md](../README.md) / [../README.ja.md](../README.ja.md) | 利用者向けの導入、設定、コマンド、状態、診断、復旧、更新 |
|
|
11
|
+
| [CLAUDE.md](https://github.com/kitepon/Throughline/blob/main/CLAUDE.md) | Claude Code 作業者向けの製品正本 |
|
|
12
|
+
| [AGENTS.md](https://github.com/kitepon/Throughline/blob/main/AGENTS.md) | Codex など Claude Code 以外の作業者向け入口 |
|
|
13
|
+
| [01_l1_l2_l3_redesign.md](01_l1_l2_l3_redesign.md) | L1/L2/L3 記憶レイヤーの設計 |
|
|
14
|
+
| [02_clear_auto_handoff_plan.md](02_clear_auto_handoff_plan.md) | `/clear` / `/tl` handoff の現行仕様 |
|
|
15
|
+
| [04_public_release_plan.md](04_public_release_plan.md) | 公開配布、明示的失敗、release gate |
|
|
16
|
+
| [05_codex_first_roadmap.md](05_codex_first_roadmap.md) | Codex primary / trim / Claude finalization の現行順序 |
|
|
17
|
+
| [06_codex_trim_rollback_fix_plan.md](06_codex_trim_rollback_fix_plan.md) | Codex rollback / inject incident 後の現行判断 |
|
|
18
|
+
| [08_codex_dual_support.md](08_codex_dual_support.md) | Claude primary を維持する Codex adapter 方針 |
|
|
19
|
+
| [09_rollback_context_trim_insight.md](09_rollback_context_trim_insight.md) | rollback を context delete primitive と見る設計 |
|
|
20
|
+
| [adr/](adr/) | 現行実装が依拠する不変の設計判断 |
|
|
21
|
+
|
|
22
|
+
特に現行 host 契約は [ADR 0021](adr/0021-grok-host-capture.md) と
|
|
23
|
+
[ADR 0022](adr/0022-cursor-host-capture.md)、二相 handoff と schema v9 は
|
|
24
|
+
[ADR 0014](adr/0014-two-phase-handoff-ghost-baton.md)、製品所有 migration は
|
|
25
|
+
[ADR 0018](adr/0018-product-owned-database-migration.md) を正とする。
|
|
26
|
+
|
|
27
|
+
## 固定参照の互換入口
|
|
28
|
+
|
|
29
|
+
次の短い文書は現行契約の正本ではない。旧pathを固定した計画・証拠・公開URLから、
|
|
30
|
+
archiveと現行正本へ案内するためだけに残す。
|
|
31
|
+
|
|
32
|
+
| 互換入口 | 現行正本 |
|
|
33
|
+
|---|---|
|
|
34
|
+
| [12_desktop_clear_handoff_plan.md](12_desktop_clear_handoff_plan.md) | [02_clear_auto_handoff_plan.md](02_clear_auto_handoff_plan.md) |
|
|
35
|
+
| [15_windows_ci_release_latency_plan.md](15_windows_ci_release_latency_plan.md) | [04_public_release_plan.md](04_public_release_plan.md) / [ADR 0020](adr/0020-windows-ci-release-latency.md) |
|
|
36
|
+
| [16_readonly_handoff_context_plan.md](16_readonly_handoff_context_plan.md) | [README.md](../README.md) / [公開JSON例](throughline-handoff-context.example.json) |
|
|
37
|
+
| [plan_grok-successor-launch.md](plan_grok-successor-launch.md) | [ADR 0021](adr/0021-grok-host-capture.md) / [README.md](../README.md) |
|
|
38
|
+
|
|
39
|
+
## 履歴
|
|
28
40
|
|
|
29
41
|
| 場所 | 役割 |
|
|
30
42
|
|---|---|
|
|
31
|
-
| [
|
|
43
|
+
| [archive/](archive/) | 完了済み計画、置換済み設計、過去の実装・受入記録。通常は読まない |
|
|
32
44
|
| [audit-2026-05/](audit-2026-05/) | 2026-05 の監査・インシデント記録 |
|
|
33
|
-
| [
|
|
34
|
-
| [../
|
|
45
|
+
| [adr/](adr/) | 判断時点の背景も保持する設計判断記録 |
|
|
46
|
+
| [../CHANGELOG.md](../CHANGELOG.md) | 公開版ごとの変更履歴 |
|
|
35
47
|
|
|
36
|
-
|
|
48
|
+
## 証拠
|
|
37
49
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
50
|
+
| 場所 | 役割 |
|
|
51
|
+
|---|---|
|
|
52
|
+
| [../rag/INDEX.md](../rag/INDEX.md) | 外部仕様・実機調査の索引 |
|
|
53
|
+
| [evidence/](https://github.com/kitepon/Throughline/tree/main/evidence) | host受入などの固定証拠 |
|
|
54
|
+
| [throughline-handoff-context.example.json](throughline-handoff-context.example.json) | 公開JSON契約の例 |
|
|
43
55
|
|
|
44
|
-
|
|
45
|
-
ThroughlineはClaude Stop receiptとCodex rolloutの`task_complete`だけからcompleted cursorを構築し、
|
|
46
|
-
ObserverがDB、WAL、rolloutを直接監視するfallbackは持たない。waitは最大3600秒で、`changed`、`timeout`、
|
|
47
|
-
`resync_required`、`ambiguous_parent`を返す。
|
|
56
|
+
## 製品の所有境界
|
|
48
57
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
Throughline は単独で install、設定、状態保存、schema と migration、診断、復旧、更新、
|
|
59
|
+
release 判定まで完結する。状態の正本は `~/.throughline/` と製品コードであり、他製品は
|
|
60
|
+
公開CLI・JSON契約を介して連携する。dotagents は工場全体の配線と統合契約を管理するが、
|
|
61
|
+
Throughline の状態を直接書き換えず、製品の単独運用やrelease判断を制御しない。
|
|
53
62
|
|
|
54
|
-
##
|
|
63
|
+
## 文書の寿命
|
|
55
64
|
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
65
|
+
- 現行値・操作・判断は既存の現行文書へ統合し、同じ意味の現行文書を増やさない。
|
|
66
|
+
- 完了した計画、置換済み設計、当時の受入記録は `archive/` へ物理移動する。
|
|
67
|
+
- 履歴・証拠は削除せず、通常の必読経路から外す。
|
|
68
|
+
- source と文書が食い違う場合は source とfocused testで確認し、現行文書を同じ変更で直す。
|
|
69
|
+
- 新しい文書は、現行契約・履歴・証拠のどれかを決めてから置く。
|
|
70
|
+
- `npm run verify:docs` は全local link、top-level分類、archive索引、固定参照の互換stub、
|
|
71
|
+
公開npm tarball内Markdownの相対link/image閉包を検査する。Markdown-only変更でも
|
|
72
|
+
製品所有CIがこの入口を実行する。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 新 L1/L2/L3 設計(再定義)
|
|
2
2
|
|
|
3
|
-
> **Status**: 実装完了(2026-04-16 時点)。この文書は **L1/L2/L3 再定義の設計記録**であり、schema v4-v5 相当の変更までを扱う。以後の `handoff_batons` (v6)・`memo_text` (v7)・state.usage スナップショット・VSCode 自動起動・monitor 診断機能は本仕様と独立で、[CLAUDE.md](
|
|
3
|
+
> **Status**: 実装完了(2026-04-16 時点)。この文書は **L1/L2/L3 再定義の設計記録**であり、schema v4-v5 相当の変更までを扱う。以後の `handoff_batons` (v6)・`memo_text` (v7)・state.usage スナップショット・VSCode 自動起動・monitor 診断機能は本仕様と独立で、[CLAUDE.md](https://github.com/kitepon/Throughline/blob/main/CLAUDE.md) と [04_public_release_plan.md](04_public_release_plan.md) に索引あり。
|
|
4
4
|
> 全ステップ (1〜8) 実装済み。L1/L2/L3 すべて書き込みパスが稼働。schema v5 で details に `kind` / `source_id` 列追加済み。
|
|
5
5
|
> 進捗の詳細は「実装順序」セクション末尾の進捗表を参照。
|
|
6
6
|
|