{"slug": "published-throughline-to-npm-a-hook-to-offload-claude-code-tool-i-o-to-sqlite", "title": "Published Throughline to npm: A hook to offload Claude Code tool I/O to SQLite", "summary": "A developer has published Throughline, a hook plugin for Claude Code that offloads tool I/O to SQLite to reduce token consumption. In a 50-turn session, the plugin reduced context from 125,000 tokens to within 13,000 tokens by removing tool I/O data and compressing older conversation turns to one-fifth their original size. Throughline also includes a multi-session token monitor that reads actual API values from transcript JSONL for accurate usage tracking.", "body_md": "I have published a hook plugin for Claude Code called [Throughline](https://github.com/kitepon-rgb/Throughline) to npm.\n\nIn a Claude Code session, the majority of the context is filled with the remnants of \"tool I/O.\" The contents of read files, grep results, and Bash output—data that served its purpose the moment the AI read it, made a decision, and moved on. However, it stays in the context until the end, consuming tokens.\n\nThroughline manages the conversation in three layers.\n\n| Layer | Content | Context Injection |\n|---|---|---|\n| L2 | Conversation body (user input + AI response) | Last 20 turns injected as is |\n| L1 | Summarized version of L2 (1/5th size) while retaining key points | Injected for turns older than 20 |\n| L3 | Tool I/O, system messages, and thinking | Not injected; offloaded to SQLite, retrieved by Claude as needed |\n\nSince tool I/O is completely removed from the context, read grep results and Bash outputs do not linger until the end of the session. Older conversations are compressed to 1/5th of their original size while keeping key points, so you can still follow the context of decisions made dozens of turns ago.\n\nIn a 50-turn session on my machine, a conversation that consumed 125,000 tokens was reduced to within 13,000 tokens.\n\n```\nnpm install -g throughline\nthroughline install\n```\n\n`install`\n\nregisters the hook in `~/.claude/settings.json`\n\n. It runs automatically for all Claude Code projects on your PC. No configuration is required for individual projects.\n\nThroughline offloads conversations to SQLite, so the data remains even after running `/clear`\n\n. If you want to carry over your memory to the next session, type `/tl`\n\nin the previous session.\n\nData is only carried over to the next session when you type `/tl`\n\n. If you don't type it, it starts as a fresh session. Even if you open parallel windows or restart VSCode, it is designed so that it \"won't fire accidentally unless you type `/tl`\n\n.\"\n\nWhen carrying over, the \"next step memo\" written by the previous Claude and the internal reasoning (thinking) of the final turn are passed along as well. The next Claude runs in \"continue from interruption\" mode rather than \"reading past logs\" mode.\n\nAs a byproduct, a multi-session capable token monitor is included.\n\n```\nthroughline monitor\n[Throughline] 1 session\n▶ Throughline  2ed5039c  ████░░░░░░░░░░░░░░░░  205.1k /  21%  Remaining 794.9k  claude-opus-4-6\n```\n\nSince it reads actual API values (`message.usage`\n\n) from the transcript JSONL, it provides accurate values rather than estimates based on `character count / 4`\n\n. It also supports automatic detection of 1M context windows.\n\n`node:sqlite`\n\nmodule)Zero. The tarball published to npm contains only `.mjs`\n\nfiles. No build process or native bindings are required.\n\nThe background of the design and my trial-and-error process are written in [this article](https://dev.to/quolu/why-i-gave-up-on-automatic-detection-for-resuming-sessions-in-claude-code-3bj0).\n\nMIT licensed. Bug reports and PRs are welcome.", "url": "https://wpnews.pro/news/published-throughline-to-npm-a-hook-to-offload-claude-code-tool-i-o-to-sqlite", "canonical_source": "https://dev.to/quolu/published-throughline-to-npm-a-hook-to-offload-claude-code-tool-io-to-sqlite-13d9", "published_at": "2026-06-06 00:54:54+00:00", "updated_at": "2026-06-06 01:12:37.678284+00:00", "lang": "en", "topics": ["ai-tools", "large-language-models", "ai-agents", "ai-infrastructure", "ai-products"], "entities": ["Throughline", "Claude Code", "SQLite", "npm"], "alternates": {"html": "https://wpnews.pro/news/published-throughline-to-npm-a-hook-to-offload-claude-code-tool-i-o-to-sqlite", "markdown": "https://wpnews.pro/news/published-throughline-to-npm-a-hook-to-offload-claude-code-tool-i-o-to-sqlite.md", "text": "https://wpnews.pro/news/published-throughline-to-npm-a-hook-to-offload-claude-code-tool-i-o-to-sqlite.txt", "jsonld": "https://wpnews.pro/news/published-throughline-to-npm-a-hook-to-offload-claude-code-tool-i-o-to-sqlite.jsonld"}}