Skip to main content
typemux-cc runs as a Claude Code plugin and works automatically in the background. You don’t need to manually start or configure it for basic operation.

How It Works

The plugin acts as a transparent proxy between Claude Code and your Python type-checking backend (pyright, ty, or pyrefly). It automatically detects .venv directories and spawns backend processes as needed.
1

Plugin starts with Claude Code

When Claude Code launches, typemux-cc starts automatically. It searches for a fallback .venv in:
  1. Git repository root (if in a git repo)
  2. Current working directory
  3. If neither exists, starts with an empty backend pool
2

Opening Python files triggers detection

When you open a Python file, typemux-cc:
  1. Searches for .venv by traversing parent directories from the file location
  2. Stops at git toplevel (repository boundary) if in a git repo
  3. Verifies that .venv/pyvenv.cfg exists (strict validation)
  4. Spawns a backend if .venv is found and not already in the pool
3

Backend spawns with correct environment

Each backend process spawns with:
  • VIRTUAL_ENV set to the detected .venv path
  • PATH prefixed with .venv/bin
  • Unique session ID for tracking
These environment variables are only set for the backend process. Your shell environment and system PATH remain unchanged.

When Backends Are Spawned

Backends spawn automatically in these scenarios:

First file open in a project

When you open the first Python file from a project (directory with .venv), typemux-cc searches for .venv and spawns a backend if found.

Switching to a different project

Opening a file from a project with a different .venv path spawns a new backend. The previous backend stays alive in the pool.

Late .venv creation

If you create .venv after opening files, reopen the file to trigger detection. Cached documents don’t automatically re-search for .venv.
If .venv doesn’t exist when you open a file, typemux-cc caches venv=None for that document. Creating .venv later won’t take effect until you close and reopen the file.

Document State and Caching

What Gets Cached

For every opened document, typemux-cc maintains:
  • URI (file:// URL)
  • Language ID (python)
  • Version number (incremented on each change)
  • Full text content (updated via textDocument/didChange)
  • Associated venv path (detected on first open)

Why Caching Matters

1

State restoration when backends spawn

When a new backend spawns, it needs to know about already-open files. typemux-cc automatically resends textDocument/didOpen for all documents belonging to that .venv.
2

Incremental text updates

textDocument/didChange events update the cached text immediately, even if no backend is running for that document.
3

Cache invalidation on close

When you close a file, typemux-cc removes it from the cache.

Cache Limitations

Important: The .venv path is cached when a document is first opened. If you:
  1. Open a file (no .venv exists yet)
  2. Create .venv later
  3. Try to use LSP features
You’ll get errors because the cached venv=None is reused. Solution: Close and reopen the file to trigger a fresh .venv search.
Why this design? Re-searching for .venv on every LSP request would be expensive (filesystem I/O). Caching trades off flexibility for performance. The workaround (reopen files) is simple and rare in practice.

Verification

To check if typemux-cc is working:
1

Enable logging

2

Restart Claude Code and open a Python file

Open any Python file in a project with .venv.
3

Check the log

You should see:

Summary

Zero-configuration operation

  • Plugin starts automatically with Claude Code
  • Detects .venv when you open Python files
  • Spawns backends as needed
  • Maintains document state across backend lifecycle
  • No manual intervention required for basic workflows
For advanced scenarios (worktrees, monorepos), see the dedicated guides in this section.