Skip to main content

mainai

A CLI that figures out which coding agent (Claude Code, Codex, Grok, ...) last did real work in a project folder, and hands off cleanly to the one you pick next.

The problem

Working the same project folders with several coding agents means that coming back months later, it's unclear which agent did the most recent real work, and what the other agents did in the meantime.

What it does

$ mainai .
Found 6 session(s) in /home/user/projects/endotypes
  codex    2026-09-25  "fix the endotype clustering..."   <- latest work
  claude   2026-09-18  "add the GSE cohort loader..."
  ...

Continue with: codex (its edits match the files on disk; the Claude sessions
were read-only questions)
  Advice: cd /home/user/projects/endotypes && codex

$ mainai --handoff .
...
Wrote /home/user/projects/endotypes/HANDOFF.md
  1. Reads every agent's stored conversations, keeps the ones for the given folder.
  2. Decides which agent to continue with. An LLM reads each session's actual content (not just the newest timestamp) and recommends one, with its reasoning printed alongside the pick.
  3. Prints advice: the command to run to continue with that agent. mainai never launches anything itself.

The folder argument is required (mainai . for the current directory) -- mainai with no arguments prints help and does nothing, so a stray bare invocation after install never spends tokens or bills an API key unasked.

Flags: --list (sessions + a free file-evidence guess only, no LLM call, no file written), --agent NAME (override the pick, no LLM call), --handoff (also summarize the other agents' sessions into HANDOFF.md, one extra LLM call), -y/--yes (skip the confirmation before an LLM call that would bill ANTHROPIC_API_KEY directly, when no claude.ai subscription login is found).

See mainai.md for the full design notes (reader architecture, per-agent log formats, picker logic, summarizer, scope/build order).

Status

Readers for Claude Code, Codex, and Grok, the LLM-based picker, --handoff, and the CLI are implemented. Published to PyPI as mainai.

Development

uv-managed project.

uv sync
uv run mainai --list .

Metadata

Release files for mainai 0.2.1

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

Source distribution (sdist)

Source distribution for mainai 0.2.1
File Size Uploaded
mainai-0.2.1.tar.gz 19.3 kB Details

Built distribution (wheel)

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

Total release size: 37.0 kB

Release files / mainai-0.2.1.tar.gz

Download URL mainai-0.2.1.tar.gz
Size 19.3 kB
Tags Source
SHA-256 checksum
How to use checksums
aeb9e90c1ee7565aea165b45dc4fd282ab58ecbc35105fd99c168a5cee9aa00f
BLAKE2b-256 checksum
How to use checksums
14452bb59fcb8da976431a0b11f1c76e6b2d128afc98b5003702581b66724605
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.4

Release files / mainai-0.2.1-py3-none-any.whl

Download URL mainai-0.2.1-py3-none-any.whl
Size 17.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e061c4108ee735d6c56be83cdf668889ddb9a045d5ecbaff472e10b186ffe00b
BLAKE2b-256 checksum
How to use checksums
645c996cd378251e454330128b1d0b208c11f58eafc13574e7669172b35e7978
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.4

Release history Release notifications | RSS feed

0.2.2

2 release files

This release

0.2.1 This release

2 release files

0.1.0

2 release files

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