cd /news/ai-tools/published-throughline-to-npm-a-hook-… · home topics ai-tools article
[ARTICLE · art-23040] src=dev.to pub= topic=ai-tools verified=true sentiment=↑ positive

Published Throughline to npm: A hook to offload Claude Code tool I/O to SQLite

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.

read2 min publishedJun 6, 2026

I have published a hook plugin for Claude Code called Throughline to npm.

In 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.

Throughline manages the conversation in three layers.

Layer Content Context Injection
L2 Conversation body (user input + AI response) Last 20 turns injected as is
L1 Summarized version of L2 (1/5th size) while retaining key points Injected for turns older than 20
L3 Tool I/O, system messages, and thinking Not injected; offloaded to SQLite, retrieved by Claude as needed

Since 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.

In a 50-turn session on my machine, a conversation that consumed 125,000 tokens was reduced to within 13,000 tokens.

npm install -g throughline
throughline install

install

registers the hook in ~/.claude/settings.json

. It runs automatically for all Claude Code projects on your PC. No configuration is required for individual projects.

Throughline offloads conversations to SQLite, so the data remains even after running /clear

. If you want to carry over your memory to the next session, type /tl

in the previous session.

Data is only carried over to the next session when you type /tl

. 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

."

When 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.

As a byproduct, a multi-session capable token monitor is included.

throughline monitor
[Throughline] 1 session
▶ Throughline  2ed5039c  ████░░░░░░░░░░░░░░░░  205.1k /  21%  Remaining 794.9k  claude-opus-4-6

Since it reads actual API values (message.usage

) from the transcript JSONL, it provides accurate values rather than estimates based on character count / 4

. It also supports automatic detection of 1M context windows.

node:sqlite

module)Zero. The tarball published to npm contains only .mjs

files. No build process or native bindings are required.

The background of the design and my trial-and-error process are written in this article.

MIT licensed. Bug reports and PRs are welcome.

── more in #ai-tools 4 stories · sorted by recency
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/published-throughlin…] indexed:0 read:2min 2026-06-06 ·