Skip to content

tr00x/Manta

Repository files navigation

Manta — one agent forked into many

⧉ Manta

Clone Driven Development

A new experiment in parallel AI coding — and it actually works.

Instead of spawning cold, specialized helper agents, Manta makes Claude Code clone itself: same system prompt, your whole conversation inherited, each copy in its own isolated git worktree, all coordinating over a shared bus.

version license node tests platform Claude Code


What it is

Subagent Driven Development spawns fresh, specialized helpers that start cold and don't know what you've been working on.

Clone Driven Development forks the agent that already understands your problem — the one you've been talking to — into N copies that work in parallel on real branches.

You're in a Claude Code session. You hit something big, repetitive, or branchy. You run one command:

manta cast forking-realities --clones 2 --task "Add rate limiting to the API"

Manta spawns 2 clones of your current agent. Each one wakes up already knowing the whole conversation, gets its own git worktree, does real work (writes code, runs tests, commits to its own branch), and coordinates with its siblings over a message bus. You review what they built and merge the best.

That's it. No role hierarchy to design, no "researcher agent + coder agent" to wire up. A clone is just you, again, somewhere else.

Note

Manta is an experiment, stated honestly: 0.1.0, early, real, not a demo. As far as we know it's the first same-system-prompt, full-transcript-inheritance cloning pattern for Claude Code. The core works and is tested (see status); the rough edges are listed, not hidden.

Tip

You don't have to drive the CLI. Manta looks like a power-user tool — worktrees, a message bus, file locks. You can ignore all of it. Tell your agent "orchestrate this with Manta" and it does the deciding: whether to cast, how many clones, reviewing their branches, merging the winner. You watch and approve.

Power users get the raw manta CLI. Vibe-coders get a one-line ask. Same engine underneath.


Why clone instead of spawn helpers?

Claude Code already has subagents (the Agent tool), and frameworks like CrewAI / LangGraph build crews of specialized roles. Manta makes a different bet:

Subagents (Agent tool) Role frameworks (CrewAI, LangGraph) Manta (Clone Driven)
Context cold — re-explain everything per-role prompts you write warm — inherits your live transcript
Parallelism one-shot, returns a message a role graph you maintain N clones on real branches
Owns a branch + locks? varies ✓ real git worktree + bus locks
Setup none, but starts blind design a crew up front none — clone what already gets it

The agent that's been in the conversation is the best worker for the task. So Manta forks that agent and lets the copies divide the work live, through coordination primitives, instead of a fixed hierarchy.

Tip

Task takes you 5 minutes solo? Don't cast — just do it. Manta earns its keep when the work is big, branchy, or repetitive. The built-in manta-cast-decide skill is a gut-check for exactly this.


How it works

The system — your main agent casts clones into isolated worktrees; they coordinate over the bus and commit to their own branches; you get a reviewed result:

flowchart LR
    You([You]) --> Main["Main agent<br/>(your Claude Code)"]
    Main -->|manta cast| K{{⧉ Manta}}
    K -->|fork your transcript<br/>+ task contract| A["Clone A<br/>worktree · branch"]
    K -->|fork your transcript<br/>+ task contract| B["Clone B<br/>worktree · branch"]
    A <-->|locks · claims ·<br/>broadcasts · heartbeats| Bus[("manta-bus<br/>MCP server")]
    B <-->|locks · claims ·<br/>broadcasts · heartbeats| Bus
    A -->|commit| MR[["merge-review<br/>(scored verdict)"]]
    B -->|commit| MR
    MR -->|you pick the winner| Main
Loading

The lifecycle — what actually happens, in order:

sequenceDiagram
    actor You as You · main agent
    participant M as manta cast
    participant A as Clone A
    participant B as Clone B
    participant Bus as manta-bus (MCP)
    You->>M: manta cast forking-realities --clones 2 --task "…"
    M->>A: git worktree + branch · claude --print --resume «forked transcript»
    M->>B: git worktree + branch · claude --print --resume «forked transcript»
    Note over A,B: boot WARM — inherit your whole conversation
    A->>Bus: ack contract · take file locks · heartbeat
    B->>Bus: ack contract · claim work · broadcast findings
    A-->>A: write code · run tests · commit → branch A
    B-->>B: write code · run tests · commit → branch B
    A->>Bus: release locks · report death (no push)
    B->>Bus: release locks · report death (no push)
    M->>You: scored merge-review + verdict
    You->>You: pick winner · review diff · merge
Loading
Step by step (click to expand)
  1. Allocate & isolate. Manta creates a git worktree per clone under .manta/worktrees/ — a separate checkout on its own branch. Clones never touch your working tree or each other's.
  2. Inherit your context — conversation and standards. Manta forks a copy of your live session transcript into each clone and boots it with claude --print --resume <fork>, so the clone wakes up knowing the whole conversation. (There's a safe default auto-fork threshold (~2 MB) so a cast doesn't blindly copy a huge transcript across N clones — above it the clone boots cold with a loud warning, never silently. Pass --force-full-transcript to fork the whole thing regardless; verified live on an 18 MB session.) It also copies your project's CLAUDE.md / CLAUDE.local.md into each clone's worktree — a clone's worktree is its own git checkout, and a gitignored CLAUDE.md would never reach it otherwise — so the clone also inherits your coding standards, conventions, and guardrails. (Opt out with --no-inherit-instructions.)
  3. Hand off a contract. Each clone gets a task contract — what to build, which paths it may touch, its budget, success criteria — and acknowledges it on the bus before starting.
  4. Work in parallel, coordinate on the bus. Clones talk through the Manta bus (an MCP server): file locks (no two edit the same file), work claims, broadcasts, heartbeats. No clone can silently corrupt shared state.
  5. Commit & die gracefully. A clone writes a report, commits to its branch, releases its locks, and signals its own death. It does not push — you pull.
  6. You review & merge. For competing approaches, Manta scores the branches against a quality gate and writes a merge-review with a verdict. You pick the winner and merge.

The building blocks

Block What it is
Worktrees Each clone gets an isolated git worktree on its own branch. Isolation is real, not cooperative.
Transcript inheritance Clones boot from a fork of your live session via claude --resume. They start warm.
Project instructions Your CLAUDE.md / CLAUDE.local.md are copied into every clone worktree (even when gitignored — a checkout wouldn't carry them). Each user's own CLAUDE.md, never one baked into Manta. So clones obey your project's standards.
The bus manta-bus (MCP server) — locks, work claims, broadcasts, heartbeats, contracts. Coordination with no central scheduler.
Task contracts The spec + scope fence + budget each clone agrees to before working.
Usage guardrails A subscription-aware rate/parallelism system so a cast can't exhaust your usage limit or your machine.
Merge-review For competing branches, an automated quality-gated score + verdict you follow when merging.
Skills Plain-markdown behavior contracts that tell clones how to behave. Shipped with the plugin.

Important

Your CLAUDE.md is half of what makes a clone more than a subagent. Transcript inheritance carries the conversation; CLAUDE.md carries the standards — your quality bar, conventions, and guardrails. A clone with neither is just a cold helper; a clone with both works like you would. Manta delivers both automatically, so a well-written CLAUDE.md directly raises the quality of every clone's output. If you take cloning seriously, invest in your CLAUDE.md — it's the single highest-leverage file in a Clone Driven workflow.


Install

Two ways. The Claude Code plugin is the easy path — it lights up /manta:* commands, ships the skills, and auto-registers the bus.

Plugin (recommended)

From inside Claude Code:

/plugin marketplace add https://github.com/tr00x/Manta.git
/plugin install manta@manta-dev

The marketplace is manta-dev, the plugin inside it is manta → the install spec is manta@manta-dev. Then run /manta:help for a tour, or manta doctor in a terminal to health-check your setup. You get:

  • /manta:* slash commands (cast, status, cost, charges, inspect, tail, kill, promote, recover, replay, abort, doctor, help).
  • Manta's skills in your skill list, resolvable by spawned clones.
  • The manta-bus MCP server, registered automatically — including native tool calls (manta_cast, manta_status, …) so your agent can drive Manta without shelling out.

Test a local checkout without installing: claude --plugin-dir /path/to/Manta.

Warning

Working inside the Manta repo itself? /manta:* may not show up. A Claude Code quirk (#14929): with cwd = this repo, it discovers the repo's own marketplace as a directory and the slash commands silently don't register. The manta CLI works regardless of cwd.

Workarounds for contributors
  • Launch from another directory: cd ~ && claude --plugin-dir /path/to/Manta
  • Or in ~/.claude/settings.json set "enabledPlugins": { "manta@manta-dev": false }, then claude --plugin-dir . from the repo.

npm CLI (terminal)

Published as @tr00x/manta — live on npm.

Note

Install the scoped name @tr00x/manta; plain manta is an unrelated package, so don't npx manta.

npx @tr00x/manta@latest install          # registers the manta-bus MCP server
manta cast recon-swarm --clones 2 --task "Map this codebase"

Full walkthrough → Getting Started.


Your first cast

Want to understand an unfamiliar codebase before changing it? That's a read-only mapping job — use recon-swarm:

manta cast recon-swarm --clones 2 \
  --task "Map the auth and billing code: entry points, data flow, where to add a feature" \
  --max-files-changed 3 --allowed-paths "docs/audits"

Watch it:

$ manta status
⧉ Clone | Mode         | State    | Heartbeat age | Locks | Claims
  A     | recon-swarm  | WORKING  | 2s            | -     | -
  B     | recon-swarm  | WORKING  | 4s            | -     | -

↑ "Clone" is the id. Stop one: manta kill <id> · stop all: manta abort · details: manta inspect <id>

Each clone reads the code warm (it already knows what you care about from your conversation) and writes an audit doc. You read two focused write-ups instead of spelunking yourself — and your own context stays clean.

Got a real "which approach?" question? Use forking-realities — two clones each build it their way, Manta scores both, you merge the winner:

manta cast forking-realities --clones 2 --task "Migrate the config loader to zod"

Stop everything anytime with manta abort.


Modes

A mode sets how clones behave and how many spawn. Pick by the shape of the work:

flowchart TD
    T([New task]) --> Q{Worth casting?<br/>&gt;10 min · many files ·<br/>independent parts · rival approaches}
    Q -->|no| S([Just do it solo])
    Q -->|yes| K{What shape?}
    K -->|map / understand| R[recon-swarm]
    K -->|2+ rival approaches| F[forking-realities]
    K -->|same change × N places| RW[refactor-wave]
    K -->|multi-layer bug| BH[bug-hunt]
    K -->|build feature + tests| TS[test-storm]
    K -->|writer ↔ reviewer| PP[pair-programming]
    K -->|code → docs| DC[documentation-chase]
    K -->|N independent opinions| CO["council (advanced)"]
    K -->|a draft to react to| DE["decoy (advanced)"]
Loading
Mode Clones Use when
recon-swarm 1–5 Read-only. Map a codebase, gather intel, write audits. Nothing merges.
bug-hunt 1+ A multi-layer bug with unknown cause, or a well-scoped implementation task.
refactor-wave 2–5 The same change repeated across many places.
forking-realities 2+ 2+ rival approaches — built, scored, you merge the best.
pair-programming 2 Writer + reviewer loop on one risky change.
test-storm 3 Build a feature and its tests (coder + tester + fuzzer).
documentation-chase 1+ Bring docs in line with the code.
council (advanced) 3–5 N independent opinions on a hard call; you decide (no auto-merge).
decoy (advanced) 1–2 A draft to react to and finish, not a final artifact.

Note

council and decoy are opt-in advanced modes — enable them in .manta/config/budget.json (aghs.unlocked: [...]) or with the MANTA_UNLOCK_AGHS env var. Every mode has its own guide in docs/user/.


CLI

manta cast <mode> --task "..."   Spawn clones for a mode (the core verb)
manta status                     Active clones, their state, locks, claims
manta inspect <cloneId>          Deep-dive one clone: contract, locks, events
manta tail <cloneId>             Stream a clone's events live
manta promote <castId/cloneId>   Merge the winning branch of a forking cast
manta abort                      Stop all clones now   ·   manta kill <id>  one clone
manta recover                    Clean up stale state after a crash
manta cost / charges / limit     Usage summary · charge state · budget config
manta doctor                     Health-check your environment
Usage caps & advanced flags

Claude Code is a subscription, not pay-per-token — so the guardrails are usage / rate / parallelism, never dollars:

--max-parallel-clones <n>   cap clones running at once (default 5)
--max-casts-per-hour <n>    rolling-hour cast-rate cap (default 6)
--max-tokens-estimate <n>   per-cast usage ceiling
--allowed-paths / --forbidden-paths   scope fence (CSV)
--max-files-changed <n>     per-clone write cap (0 = read-only)
--dry-run                   preview without spawning
--tasks <file.yaml>         per-clone task / approach / scope overlays

How ready is it?

Honest status — 0.1.0, early but real. Everything below is verified by tests run independently; no self-reported green.

Area Status
Transcript inheritance ✓ clones provably boot with your context (a test reproduces a parent-only token; a control inherits nothing)
Isolation & coordination ✓ worktrees, the bus (locks/claims/broadcasts/heartbeats), contracts, graceful death
All 9 modes ✓ 7 core + 2 opt-in (council, decoy)
Native MCP control ✓ 31 bus tools, incl. 6 for driving Manta from your orchestrator
Merge-review gate ✓ runs the real quality gate before scoring competing branches
Usage guardrails ✓ subscription-aware rate / parallelism / cooldown caps
Distribution ✓ self-contained npm artifact + a validated Claude Code plugin
Concurrent casts ✓ safe — disjoint clone slots + a data-loss guard (verified 4 in parallel)
Clone safety ✓ an always-on guard enforces each clone's path scope + blocks dangerous ops in the harness
Observability ✓ live statusline, manta doctor, manta tail, post-run reports
Tests 1667 passing (real-Claude end-to-end tests run on demand, never as a silent skip)

Warning

Known limitations — none block normal use:

  • macOS / Linux first. Windows isn't exercised yet.
  • Inside the Manta repo itself, /manta:* collides with the installed plugin (upstream #14929) — use claude --plugin-dir . there. Users in their own projects are fine.

Docs


Manta builds Manta

Manta is self-built: once the first clones worked, they built the rest of Manta. Much of this codebase was implemented by Manta clones cast from a Claude Code session — bug-hunts, refactor-waves, doc-chases, forking-realities — then reviewed and merged by the main agent. The transcript-inheritance fix, the de-phased docs, even parts of this README were shaped by clones that inherited the conversation they were spawned from. Clone Driven Development, dogfooded all the way down.


MIT — see LICENSE. · An experiment built with Claude Code, using Manta to build Manta.

About

Claude Code clones itself to work in parallel — each clone in its own git worktree. Drive the CLI, or just tell your agent 'orchestrate this with Manta.' Clone Driven Development.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors