Throughline CLAUDE.md

Project instructions for Throughline, a Claude Code hooks plugin that stores parts of conversations in SQLite so they can be restored after clearing a session. It also includes a command-line token monitor and supports several coding-agent hosts.

In plain words
What is it for?
Use it when modifying Throughline’s hooks, memory storage, session handoffs, command-line tools, configuration, migrations, diagnostics, or release process.
Why use it?
It explains how memory handoffs, session records, configuration ownership, migrations, diagnostics, and releases are meant to work. This prevents changes from confusing real sessions with temporary sessions or breaking stored memory.

Instructions file

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/kitepon/throughline/claude-md
Clone the repo
git clone --depth 1 https://github.com/kitepon/Throughline
Per session 18,554 This file is loaded in full into every session.
When invoked 18,554 The same file — it is already loaded in full.
Security scan B 2 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.18554 $0.18554
Opus 5 $0.09277 $0.09277
Sonnet 5 $0.03711 $0.03711
Haiku 4.5 $0.01855 $0.01855

Measured 2d ago against content hash 251dce6551cb, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

Throughline CLAUDE.md scanned grade B with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

| [src/cli/install.mjs](src/cli/install.mjs) | `install` / `uninstall`(デフォルト global、`--project` で Claude ローカル)。global install は `~/.claude/settings.json` と slash commands に加えて `~/.codex/hooks.json` の UserPromptSubmit / P

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

| [src/os/portable-spawn-sync.mjs](src/os/portable-spawn-sync.mjs) | 旧 src/portable-spawn-sync.mjs。Windows の .cmd/.ps1/.mjs shim 解決つき spawnSync |
CLAUDE.md · 390 lines

How it starts

The opening of the file, as written. The whole thing — 390 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

このファイルは Claude Code がこのリポジトリで作業する際のガイダンスです。

プロジェクト概要

Throughline は Claude Code の hooks プラグインで、会話ターンを 3 層 (L1/L2/L3) に分解して SQLite に保存し、/clear 後も記憶を復元します。加えてマルチセッション対応のトークンモニター CLI も同梱しています。

Throughline は単独で install、設定、状態保存とschema migration、診断、復旧、更新、 release判定まで完結する。dotagentsは工場への配線と統合契約を担当するが、Throughlineの 状態や製品寿命を所有・制御しない。runtime-error collectionはThroughline自身の runtime-errors enable|disable --jsonと製品所有configが管理し、工場側は公開JSON契約だけを使う。

現行版は v0.10.4(schema v9)。Claude Code、Codex、Grok、Cursorをfirst-class hostとして扱う。現行host契約はREADMEとADR 0021/0022、release gateはdocs/04_public_release_plan.mdを正とする。版ごとの変更・公開commit・CI・npm・tag・smoke履歴はCHANGELOG.mdとdocs/archive/, evidence/に置き、この常時読込正本へ複製しない。

設計の核 (v0.4.0 以降 + ADR 0014 二相化、docs/02_clear_auto_handoff_plan.md)

  • /clear 後も SQLite はそのまま残る。前任セッションの全レコードを新 session_id に張り替える(記憶張り替え方式)
  • 二相ハンドオフ (ADR 0014): Claude Code は同一 project に短時間で複数の SessionStart を発火させることがあり、一部は transcript を生成しない幽霊セッションになる。SessionStart 時点では実体と幽霊を判別できない(本物の transcript も hook より数百 ms 遅れて作られる)ため、SessionStart は pending_handoffs への intent 登録のみを行い、merge + 注入は最初の UserPromptSubmit(= 実体の証明。幽霊はプロンプトを発火しない)で実行する。2026-07-17 に幽霊がバトンを先取りして実セッションが記憶ゼロで始まる incident が同日 2 回発生した(実測・機序は ADR 0014
  • 引き継ぎ発火条件は 2 経路 (baton path 優先):
    1. baton path: 旧セッションで /tl を実行すると UserPromptSubmit hook が handoff_batons テーブルにそのセッションの session_id を書き込み、次の新規セッションが初回プロンプト時に消費して merge。適格性はセッション誕生時刻基準0 ≤ (誕生 − baton書込) ≤ TTL 1h。負 age(誕生後に書かれた baton)は消さずに残す=走行中セッションが横取りしない。source 値関係なく発火する確定指名方法
    2. auto path: baton が無く SessionStart で source='clear' を受け取ったとき、env THROUGHLINE_DISABLE_AUTO_HANDOFF'1' でなければ findLatestClaudePredecessortranscript 実在フィルタ付き — 幽霊 twin を前任に選ばない)で前任を SessionStart 時点で解決・凍結し、初回プロンプト時に merge + 注入。組み込み /clear は実測したどのクライアントでも UserPromptSubmit に届かない。VS Code は source='clear' を送るため auto path、Desktop は送らないため /tl を先に使う(経緯と実測は archive docs/12、upstream: anthropics/claude-code#76704
    3. baton 消費が auto 判定より先発なので両者は構造上同時成立しない
  • 注入内容 (ADR 0016, 2026-07-18〜): push は「現在地」だけ — ヘッダ + 現在地アンカー + 案内セクション(無条件表示)+ L2 を新しい順に丸ごと入るターンだけ全文(ターン原子・固定 N なし)。L1 は注入しない。窓 (20 ターン) の残りは throughline recall --l2、それより古い全ターンは recall --l1(要約 or 未要約明示)、一点掘りは throughline detail <時刻> の pull 三段構成。範囲・境界 (ISO ms strict less-than)・件数・session は全部注入時に案内コマンドへ焼き込み、recall 側は窓を再計算しない。memo / thinking は注入しない
  • 注入予算 (ADR 0014): hook stdout は約 10k 字超で <persisted-output>(path + 先頭 2KB preview)に file 化されモデル可視が劣化する(実測 9,501 字 inline / 15,286 字 file 化。10k 判定は per context string で multi-hook なら突破可能と実測済みだが構造的想定外として不採用 — ADR 0016)。注入は buildBudgetedResumeContext(上限 9,500 字)で行う
  • thinking の L3 保存: assistant の extended thinking ブロックは details テーブルに kind='thinking' で全ターン保存される。throughline detail <時刻> で取り出せるが、注入には含めない
  • 各レコードは origin_session_id を保持するため、複数回の引き継ぎでも記憶がチェーン状に蓄積する(ホップ制限なし)
  • CLAUDE_AUTOCOMPACT_PCT_OVERRIDE使わない(自動コンパクト依存の設計は放棄済み)
  • フォールバック / 逃げ道のコードを書かないdocs/04_public_release_plan.md §0 参照。silent try/catch、exit(0) でのエラー隠蔽は禁止

Read the full file on GitHub · 390 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 390 lines · 18,554 tokens per session scan B 251dce6551cb

Subscribe to this mod's changes

Throughline CLAUDE.md is an instructions file published in the GitHub repository kitepon/Throughline (2 stars, last pushed 3d ago), licensed MIT. It adds 18,554 tokens to every session, about $0.0928 per session on Opus 5. A static security scan graded it B with 2 findings (reads agent configuration directories, runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.