@techsavvyash/threads-claude is a Claude Code plugin named threads.

Install

npm install -g @techsavvyash/threads-claude
claude --plugin-dir "$(npm root -g)/@techsavvyash/threads-claude"

The plugin’s runtime is one self-contained file, bin/claude.js, with the library bundled in. That’s because Claude Code copies a plugin’s directory and installs no dependencies. The npm package ships exactly the plugin directory: .claude-plugin/, .mcp.json, hooks/, commands/, skills/ and bin/.

The threads skill

The plugin ships a threads skill. It tells Claude when to cut a thread (a hand-off, parallel work, a nearly full context) and how:

  1. Find the cutoff with threads_history.
  2. Pick the fewest events the new thread needs.
  3. Preview the cut, and ask before committing.
  4. Commit with the pinned expect.

Claude loads it when a request matches, so you can just say “hand off the store work to a new thread”.

What it does

Hooks: live capture and compaction

hooks/hooks.json runs bin/claude.js hook on four events:

  • SessionStart, Stop and PreCompact: capture the conversation into the store (~/.threads/log.jsonl, shared by every project); PreCompact captures it just before Claude Code compacts.
  • UserPromptSubmit: records which session is current, so the tools know which conversation “this one” is.

What that means in practice:

  • After /clear: you don’t need to do anything differently.
    • If you created a thread in the conversation you just cleared and nothing has picked it up yet, the fresh session opens in it: it’s attached to the thread and starts from the thread’s seed alone. /clear again for a blank session.
    • Otherwise, once you send a message, the new conversation is recorded as a continue child of the one you cleared, so the tree shows how one led to the other.
  • After compaction: Claude Code decides when to compact; the plugin doesn’t estimate context. Each compaction continues the conversation in a new continue thread, claude:<session>/2, /3 and so on, seeded with Claude Code’s own summary. Everything before it stays in the earlier thread, in full, so you can cut from any point in it. After compacting, Claude Code shows ⑂ Compacted: continuing in thread ….

A hook never breaks your session: errors are reported on stderr, and the hook exits cleanly.

MCP tools

.mcp.json starts bin/claude.js mcp, a small stdio MCP server. Claude Code names its tools mcp__plugin_threads_threads__<tool>.

The server lives as long as the session, and /reload-plugins doesn’t restart it. When the plugin is rebuilt under it, each later call runs in a fresh process on the new code, and the server tells Claude Code its tool list changed. A session never runs old code against the store and needs no restart.

ToolPurpose
threads_historyThis conversation’s events as #n role: text, optionally filtered by query
threads_cutPreview a cut. Call again with approve: true and expect to commit; launch (claude, codex or pi) runs it in the background, model picks its --model, and a Claude launch gets this session’s permission mode (permission_mode overrides it)
threads_treeThe project forest
threads_resultStatus and latest reply of a thread, for example one launched in the background

threads_cut always takes two calls.

  1. Called without approve, it returns the seed preview. It also returns the exact at and expect values to commit that preview.
  2. After you agree, the agent calls it again with those values plus approve: true.

If the conversation moved on and the cut would differ, the commit is refused. See concepts > Preview, approve, commit.

Commands

  • /threads:thread [request]: finds the cutoff (asking you if several points match), picks the intent and the fewest events needed, shows you the preview verbatim, and asks whether to create it and where to run it: here with you, or in the background.
  • /threads:open <id>: opens a specific thread in this terminal, starting clean: run /clear, then /threads:open <id>. You rarely need it, because /clear does this on its own for a thread you just created (see Hooks above). To go back to a thread that already has a conversation, run dough thread open <id> in a terminal: it resumes that conversation where it ran.
  • /threads:tree: shows the forest.

Configuration

VariableDefaultMeaning
THREADS_STOREStore file instead of ~/.threads/log.jsonl
THREADS_HOME~/.threadsFolder for the store and plugin state (claude/<project>/)
THREADS_PI_ARGSExtra args for background Pi launches
THREADS_CLAUDE_ARGSExtra args for background Claude Code launches
THREADS_CODEX_ARGSExtra args for background Codex launches

One current session per project

The current session is recorded once per project directory. With two Claude Code sessions open in the same directory, the tools act on whichever session last submitted a prompt or finished a reply.