Documentation

ThreadPort records what happens during a development task and hands it to the next AI agent as a short, sourced context pack. This page covers the CLI (version 0.5 and later) and the VS Code extension.

Install

You need Node.js 24 or newer and npm. Git is recommended: without it, ThreadPort still works but cannot take snapshots or tie verification to a commit.

npm install -g threadport
threadport --version
threadport doctor

doctor shows your Node version, whether the project is initialized, and which agents (Claude Code, Codex) are installed.

Quick start

Run these from the root of the project you want to track.

threadport init
threadport new "Fix token rotation"
threadport task add "Write a concurrency test"
threadport decision "Keep token IDs in Redis" -r "Shared revocation"
threadport run claude

When Claude exits, record anything its interface did not expose, then hand off:

threadport note "The collision happens during simultaneous renewal"
threadport check npm test
threadport switch codex

Codex starts with the objective, the open task, the decision and the failing test. Commands work from any subdirectory of the project.

How it works

Session
One task with an objective. One session is active at a time; open and resume switch between them.
Records
Tasks, notes, errors, decisions, test results, constraints, relevant files and project memory. Each has an ID you can edit or delete.
Context pack
Markdown built from the session and the live Git state, ordered by priority and cut to a token budget. Every section names its source.
Runs
Each agent launch is recorded with its status and exit code. A run that stops unexpectedly is marked interrupted.

All of it lives in .threadport/threadport.sqlite inside your project. ThreadPort writes .threadport/.gitignore so Git ignores it.

Commands

CommandWhat it does
initInitialize the project in the current directory.
new "objective", sessions, open <id>, resume <id>Create, list and reactivate sessions. resume also prints the context.
rename, finish, deleteRename, finish or permanently delete a session.
status, timeline, snapshotShow the active session, its events, or capture the Git state.
task add, task done <id>, task listTrack tasks.
decision "title" -r "reason", decisionsRecord and list decisions.
note, error, constraint, memoryRecord notes, issues, constraints, and knowledge shared by every session.
file <path>, files, artifact <path>Mark relevant files and artifacts; files also lists Git changes.
record edit, record deleteCorrect or remove a record.
check <cmd> [args], test-result, command-logRun a command and save its result, or record one run elsewhere.
summary, search "terms"Summarize the session, or search every session locally.
context [--mode] [--explain]Preview the context pack and its token budget.
run, switch, continue <agent>Launch an agent with the context, or resume its native session.
verify, handoff, linkVerify work, review a handoff, link a GitHub issue or pull request.
export, importMove a session to another copy of the project.
fork, compareTry several agents in separate Git worktrees and compare them.
agents, doctor, configList agents, check the environment, change settings.
hook, plugin, privacyLifecycle hooks, custom agents, privacy audit and scrub.
tui, serve, mcpTerminal menu, local HTTP API, MCP server.

Run threadport <command> --help for every option.

Context modes

ModeBudgetIncludes
minimal500 tokensObjective, high-priority items and a few events.
standard1,500 tokensSummary, memory, constraints, tasks, errors, decisions, tests, notes, files and Git state as space allows.
deep4,000 tokensThe same, with more events and a filtered Git diff.
full10,000 tokensThe same selection with a larger budget.
threadport context --mode deep --explain
threadport config set-default-mode deep

Token counts use cl100k_base as a reference and may differ from a given model's tokenizer. --explain lists the sources used and the sections that did not fit.

Running agents

run launches Claude Code or Codex in your terminal with the context file. switch does the same and records the handoff from the previous agent.

threadport run codex --structured
threadport status
threadport continue codex

--structured runs the agent without its interactive interface and records the commands, messages, errors and provider session ID from its JSON stream. continue then resumes that native session.

Automatic handoffs with hooks

threadport hook install claude
threadport hook install codex

These project-local hooks give the agent the context when it starts, record the files it edits, and write a summary when it stops. They never copy conversations, tool arguments or tool output. Codex asks you to trust new hooks with /hooks.

Verify and hand off

verify runs the check, test and build scripts of a Node project, or the commands in .threadport/config.json, and ties the result to the current Git state. Any file change makes the report stale.

threadport link issue https://github.com/owner/repo/issues/42
threadport verify
threadport handoff draft --out .threadport/handoff.md
threadport handoff save .threadport/handoff.md
threadport handoff show

Privacy

  • API keys, GitHub, GitLab, npm, Stripe, AWS, Google and Slack tokens, JWTs, Bearer headers, URL credentials, private keys and token= or password: values are redacted before storage and before any handoff. Detection is heuristic.
  • .env, .env.*, *.pem, *.key, credentials.json and secrets/** are excluded by default. Add patterns, one per line, in .threadportignore.
  • Snapshots store paths, not diff contents. A diff appears only in deep and full context.
threadport privacy audit --show-context
threadport privacy scrub

scrub applies current rules to data recorded before them.

Configuration

Project settings live in .threadport/config.json:

{
  "context": { "defaultMode": "standard" },
  "privacy": { "exclude": ["private/**"] },
  "verification": {
    "commands": [{ "command": "cargo", "args": ["test"] }]
  }
}

MCP, API and custom agents

MCP: threadport mcp serves the context, the saved handoff and session tools over stdio. threadport mcp setup prints the commands for Claude Code and Codex.

claude mcp add --scope project threadport -- threadport mcp

HTTP API: threadport serve --port 0 listens on 127.0.0.1 and prints a temporary Bearer token.

Custom agents: describe any CLI agent in a JSON manifest. It runs only after you trust it.

{
  "version": 1,
  "id": "my-agent",
  "label": "My Agent",
  "command": "my-agent",
  "args": ["Read {contextFile} and continue the current task."],
  "capabilities": ["filesystem_access", "git_access"]
}
threadport plugin add ./agent.json
threadport plugin trust my-agent

VS Code extension

Available on the Visual Studio Marketplace. It opens sessions as editable Markdown documents, shows tasks with checkboxes, runs the next instruction with Ctrl + Enter, and offers an @threadport chat participant and an MCP server to VS Code agents. It uses the same .threadport/ data as the CLI.

code --install-extension aristideghost.threadport-vscode

Troubleshooting

"Project is not initialized"
Run threadport init at the project root. Commands then work from any subdirectory.
An agent is not found
Run threadport doctor. The agent CLI must be on your PATH.
A project agent is refused
Review its manifest, then run threadport plugin trust <id>.
Verification says "stale"
A file changed after the checks ran. Run threadport verify again.

Edit this page on GitHub