Skip to main content

Redthread

Portable, git-backed memory for AI agents and multi-phase workflows.

CI Docs License: MIT Version

Redthread — a red thread running through every phase of a pipeline

Your coding agent's memory lives in a local folder (.claude/, .agent/) on one machine. Redthread replaces it with a git-backed memory store served over MCP: the same memory is visible to your agent on every machine that clones the store. The same store carries cross-phase pipeline context (e.g. train → eval → present, or build → test → present) as an append-only, content-addressed memory whose source of truth is a git remote — any node can clone the store and continue a run, and each phase publishes a curated handoff to the next.

Phase names are data, not code: every project declares its own pipeline in project.yaml. Nothing domain-specific lives below the adapter layer.

Read the docs →

Features

  • Agent memory over MCP — point a coding agent's MCP config (Claude Code, Cursor, Windsurf, VS Code, ...) at a Redthread store instead of a local .claude/.agent folder.
  • One registration, many projects — run mcp-serve with no --store and every workspace is served the store its own committed .redthread.yaml names, so a single global MCP entry (Cursor, Windsurf, VS Code) works across all your repos instead of binding to the first one.
  • Portable by construction — every entry is keyed by project_id / run_id / phase / entry_id, never by hostname or absolute path. Swap the machine running a phase mid-run with redthread resume.
  • Domain-neutral phase adapters — the same core drives an ML pipeline (train/eval) and an app pipeline (build/test) with zero special-casing.
  • Content-addressed artifacts — small files commit inline; large ones go through a pluggable blob backend, referenced by sha256.
  • Curated handoffs — each phase publishes one small, validated contract for the next phase to consume, never the raw entry log.
  • Report, deck, and docs from handoffs — redthread present renders a markdown report, a slide deck, and a docs-site tree from any run.
  • Worktree mode — run the store as an orphan-branch git worktree of your existing code repo, so its active branch is never touched.
  • Auto-attach on a fresh machine — a committed .redthread.yaml marker lets redthread mcp-serve/redthread attach find and attach the store automatically, so a new clone just needs git clone + the same MCP command — no flags to remember.

Install

pip install redthread          # or: uv tool install redthread

Three ways to use it

Copy the AGENTS.md example into your project and your agent installs Redthread, creates the store, and registers the MCP server itself the next time it opens this project — no manual steps at all. By default the store is an orphan-branch git worktree of this same repo, so there's no second remote to provision and this repo's active branch is never touched.

Option 2 — Register the MCP server yourself

Prefer to do it by hand instead of pasting a file? Create a store, then register it with your agent — pick your client:

redthread init my-project --phases build,test,present --store ./my-store
🟠 Claude Code
claude mcp add redthread -- uvx redthread mcp-serve --store ./my-store

Already have redthread installed? Drop uvx:

claude mcp add redthread -- redthread mcp-serve --store ./my-store

Verify with /mcp inside Claude Code — redthread should show as connected with 18 tools.

⚫ Cursor

Cursor installs MCP servers via a one-click deeplink rather than a CLI command. This generates one and opens it, using only Python (already a Redthread dependency):

python -c "
import base64, json, webbrowser
config = {'command': 'uvx', 'args': ['redthread', 'mcp-serve', '--store', './my-store']}
encoded = base64.b64encode(json.dumps(config).encode()).decode()
webbrowser.open(f'cursor://anysphere.cursor-deeplink/mcp/install?name=redthread&config={encoded}')
"

Accept the install confirmation Cursor opens with to finish.

🔵 VS Code (Copilot)
code --add-mcp '{"name":"redthread","command":"uvx","args":["redthread","mcp-serve","--store","./my-store"]}'

Use code-insiders instead of code if you're on the Insiders build.

Windsurf, Claude Desktop, Codex CLI, Gemini CLI, and the Claude Agent SDK connect just as easily — see MCP client setup for each.

Once connected, ask the agent to call agents_md_bootstrap — it writes the same usage policy as Option 1 above into this project's AGENTS.md/CLAUDE.md itself, so future sessions use this memory automatically without being told.

Option 3 — Drive it from the CLI (no agent required)

redthread run start --store ./my-store
redthread log <run_id> build note '{"msg": "hello"}' --store ./my-store
redthread read <run_id> --store ./my-store

Working from a source checkout instead: uv sync, then prefix each command with uv run.

Docs

Full docs (usage, architecture, store format) are published at sina5.github.io/redthread and live in docs/, built with MkDocs Material:

uv run --group docs mkdocs serve

Changelog

See CHANGELOG.md for release notes.

Development

uv sync
uv run pytest
uv run ruff check .

Metadata

Release files for redthread 0.14.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for redthread 0.14.0
File Size Uploaded Provenance Actions
redthread-0.14.0.tar.gz 415.5 kB Without provenance Details for redthread-0.14.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for redthread 0.14.0
File Interpreter ABI Platform Actions
redthread-0.14.0-py3-none-any.whl Python 3 none any Details for redthread-0.14.0-py3-none-any.whl

Total release size: 502.8 kB

Release files / redthread-0.14.0.tar.gz

Download URL redthread-0.14.0.tar.gz
Size 415.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ceaf77b4fc8e57d30b3cae876a48624143c7d87049d792496b3f8760282b2c7e
BLAKE2b-256 checksum
How to use checksums
5ef9aa5453abe72e6747b34ab2fd0b8012843a55eff55f6a23b1aac1929dad38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / redthread-0.14.0-py3-none-any.whl

Download URL redthread-0.14.0-py3-none-any.whl
Size 87.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
82fda7e0881a8b53d92e104b86b2f3f727226307319e938798e37d48ffeb2ed8
BLAKE2b-256 checksum
How to use checksums
e1322968e3eef9ef0b2d83524e1e5fbe6e8b4662e05b532a0a48d1cd8918612f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for redthread 0.14.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page