Skip to main content

🧵 Main Thread

PyPI version Python versions License Discord

Multi-threaded Claude conversations with a web UI. Spawn sub-threads for parallel work that you can jump into at any time—these aren't autonomous sub-agents running in the background, they're full conversations you can continue from the CLI or UI whenever you need to.

Use Cases

  • Single orchestrator, multiple workstreams: Interact with one main agent that spawns and manages sub-threads for parallel tasks. Jump into any conversation whenever you need to provide guidance or take over.

  • Naturally parallelizable work: Work on different tickets, features, or areas of the codebase simultaneously. Each sub-thread maintains its own context and working directory.

  • Git worktree integration: With worktrees, each sub-thread can operate in its own isolated branch—making parallel agent work even more ergonomic.

Quick Start

# Try it instantly with uvx (no install needed)
uvx mainthread

# Or install with pip/uv
pip install mainthread
# or
uv add mainthread

# Run the server (opens web UI at http://localhost:2026)
mainthread

# Run in current directory
mainthread serve

# Or specify a different directory
mainthread serve --work-dir /path/to/project

Features

  • Spawned Sub-threads: Create parallel threads for independent work—not background sub-agents, but full conversations you can jump into and continue anytime
  • Nested Sub-threads: Sub-threads can spawn their own sub-threads for hierarchical task decomposition
  • Continue from CLI: Every thread can be resumed from the command line with full conversation history
  • Automatic Notifications: Sub-threads signal completion or need attention; parent thread stays informed
  • Claude Code Integration: Uses Claude Code SDK for tool use and extended thinking
  • Real-time Streaming: SSE-based streaming with reconnection recovery
  • Git-Aware: Detects branch, repo, and worktree status
  • Permission Modes: Plan, Accept, Normal, or Bypass permissions

Thread Tools

Main threads have access to these tools:

Tool Description
SpawnThread Create a sub-thread for parallel work
ListThreads List all threads with status
ReadThread Read a thread's conversation history
ArchiveThread Archive completed threads
SendToThread Send follow-up messages to child threads
Task Quick ephemeral work (Explore, Plan agents)

Sub-threads have:

Tool Description
SignalStatus Signal completion (done) or need for help (blocked)
Task Same as main thread

Development

Prerequisites

  • Python 3.11+
  • Node.js 20+ / Bun
  • Claude Code CLI (npm install -g @anthropic-ai/claude-code)

Setup

# Install all dependencies
just install

# Run both backend and frontend in dev mode
just dev

# Or run them separately:
just serve          # Backend with auto-reload
just dev-frontend   # Frontend with hot reload

Many quick scripts are available in the justfile. Run just to see all available commands.

Project Structure

mainthread/
├── src/mainthread/           # Python backend (FastAPI)
│   ├── cli.py               # Typer CLI
│   ├── server.py            # FastAPI server with SSE
│   ├── db.py                # SQLite persistence
│   └── agents/              # Claude SDK integration + tools
├── apps/web/                # React frontend (TypeScript, Vite, Tailwind)
│   └── src/
│       ├── components/      # UI components
│       └── store/           # Zustand state
└── justfile                 # Development commands

Testing & Quality

just test        # Run tests
just lint        # Check linting
just lint-fix    # Fix lint issues
just typecheck   # Type check
just check       # Run all checks

License

MIT

Metadata

Release files for mainthread 0.1.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 mainthread 0.1.0
File Size Uploaded Provenance
mainthread-0.1.0.tar.gz 203.8 kB With provenance Details

Built distribution (wheel)

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

Total release size: 415.8 kB

Release files / mainthread-0.1.0.tar.gz

Download URL mainthread-0.1.0.tar.gz
Size 203.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1bcbc5dad1769901b007103252e8dccd5ea13f5720b9ca588020bc519eb83876
BLAKE2b-256 checksum
How to use checksums
5d8eca409276db4b1e23fae67b2d1654f254ca06517ee25bc4db4da788dbc7b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 6, 2026.

Transparency log

Release files / mainthread-0.1.0-py3-none-any.whl

Download URL mainthread-0.1.0-py3-none-any.whl
Size 211.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
862a427d9d764f99c9e5ee9befb1907066b9e8f98f064734ec169aa2e345824f
BLAKE2b-256 checksum
How to use checksums
8e2b2091e111bd0513a1f54df09d2d42b218d0201ad3f6e28d66a46873b7e9df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 6, 2026.

Transparency log

Security for mainthread 0.1.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mainthread-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 6, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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