From any source → git worktrees → AI agents → PRs
🚧 Note: This project is still under active development. Expect breaking changes, incomplete features, and rough edges.
MOCHI reads a task source (a file or any custom source plugin), spins up an isolated git worktree per task, invokes an AI agent in each worktree in parallel, and optionally opens GitHub pull requests when agents finish.
curl -fsSL https://raw.githubusercontent.com/thisguymartin/Mochi/main/install.sh | shOr with wget:
wget -qO- https://raw.githubusercontent.com/thisguymartin/Mochi/main/install.sh | shThe script will:
- Detect your OS and architecture (macOS/Linux, amd64/arm64)
- Download the latest pre-built binary from GitHub Releases
- Fall back to building from source if no binary is available
- Install
mochito/usr/local/bin
git clone https://github.com/thisguymartin/Mochi.git
cd Mochi
make buildThe binary will be at bin/mochi. You can move it to your PATH:
sudo mv bin/mochi /usr/local/bin/sudo rm /usr/local/bin/mochiRequirement: The repo must have at least one commit (so the base branch, e.g. main, exists). If you see fatal: invalid reference: main, run:
git commit --allow-empty -m "Initial commit"# Run with a file (entire content becomes the task context)
mochi --input examples/PRD.md
# Preview what would happen (no agents invoked)
mochi --input examples/PRD.md --dry-runMOCHI uses a plugin-based Source interface. Any file can be used as input — the entire content becomes the task context sent to the AI agent. Custom sources (MCP, API, etc.) can be added by implementing the Source interface. See docs/ADDING_SOURCES.md for a guide.
Pass any file with --input. The filename (without extension) becomes the task title and branch slug. The full file content becomes the task description.
# Markdown spec
mochi --input architecture-spec.md
# Plain text TODO
mochi --input TODO.txt
# YAML, JSON — whatever your model can parse
mochi --input tasks.yamlIf --input defaults to PRD.md and that file doesn't exist, MOCHI searches for common alternatives: PLAN.md, plan.md, input.md, tasks.md, docs/PLAN.md, docs/PRD.md, examples/PRD.md.
| Command | Alias | Description |
|---|---|---|
mochi |
Run tasks from a source | |
mochi prune |
Remove stale worktree registrations and manifest entries | |
mochi worktree list |
wt ls |
List all tracked worktrees |
mochi worktree status |
wt status |
Show worktrees with disk-existence check |
mochi worktree remove <slug...> |
wt rm |
Remove specific worktrees by slug |
mochi worktree clean |
wt nuke |
Remove ALL tracked worktrees |
| Flag | Default | Description |
|---|---|---|
--input <file> / -i |
PRD.md |
Task file to read (any format). Aliases: --plan, --prd. |
--model <model-id> |
gemini-2.5-pro |
Default AI model. Override via MOCHI_MODEL env var. |
--prompt-model |
false |
Show interactive TUI model picker before running |
--worktrees <N> |
0 (unlimited) |
Max concurrent worktrees |
--reviewer-model <model-id> |
— | Model for the reviewer agent (enables the Ralph Loop) |
--max-iterations <num> |
1 |
Maximum worker iterations per task |
--output-mode <mode> |
pr |
Output mode: pr | research-report | audit | knowledge-base | issue | file |
--output-dir <dir> |
output |
Directory for file/report outputs |
--create-prs |
false |
Push branches and open GitHub PRs |
--dry-run |
false |
Preview the plan without executing |
--sequential |
false |
Run tasks one at a time (debug mode) |
--task <slug> |
— | Run only the task matching this slug |
--timeout <seconds> |
3600 |
Max time per agent |
--verbose |
false |
Stream agent output live to terminal |
--keep-worktrees |
false |
Keep worktrees on disk after run |
--base-branch <branch> |
main |
Branch to base worktrees on |
The provider is auto-detected from the model name prefix (claude-* or gemini-*).
Claude (requires claude CLI)
| Model ID | Use Case | Cost |
|---|---|---|
claude-opus-4-6 |
Complex architecture, migrations, auth | Highest |
claude-sonnet-4-6 |
General purpose | Balanced |
claude-haiku-4-5 |
Tests, docs, simple fixes | Lowest |
Gemini (requires gemini CLI)
| Model ID | Use Case |
|---|---|
gemini-2.5-pro |
Complex reasoning, large context tasks (default) |
gemini-2.0-flash |
Fast, cost-effective general purpose |
gemini-1.5-pro |
Long context, multimodal tasks |
MOCHI delegates all AI work to the claude and gemini CLI tools. It does not call model APIs directly — it shells out to whichever CLI matches the model prefix.
This means:
- MCP servers configured for the
claudeCLI (in~/.claude/settings.jsonor project-level.claude/settings.json) are automatically available to agents spawned by MOCHI. No extra configuration is needed. - Claude CLI features like
claude team agents, tool permissions, and CLAUDE.md project instructions all work as expected, since MOCHI simply invokesclaude -p <prompt>in each worktree. - Gemini CLI configuration (API keys, settings) is similarly inherited by agents running under
gemini-*models.
If you want agents to have access to databases, APIs, or other tools via MCP, configure them in your Claude/Gemini CLI settings and they will be available in every MOCHI task.
mochi --input examples/add-user-auth.md --model claude-opus-4-6 --create-prsmochi --input examples/PRD.md --task fix-mobile-navbar --sequential --verbosemochi --input PLAN.md --prompt-modelmochi --input PLAN.md --worktrees 2mochi --input examples/database-migration.md \
--reviewer-model claude-opus-4-6 \
--max-iterations 3mochi --input examples/api-test-suite.md \
--output-mode research-report \
--output-dir ./reports# List all tracked worktrees
mochi worktree list
# Check disk status
mochi worktree status
# Remove a specific worktree
mochi worktree remove fix-mobile-navbar
# Remove ALL tracked worktrees
mochi worktree clean
# Clean up stale registrations after a crash
mochi pruneDuring a run with a task:
.worktrees/
└── add-user-auth/ <- full repo copy on branch feature/add-user-auth
logs/
└── add-user-auth.log <- full agent session output + timestamps
.mochi_manifest.json <- live task status tracking
Worktrees and the manifest are cleaned up at the end of each run unless --keep-worktrees is set.
Source (file, or custom plugin: MCP, API, etc.)
-> source.Source interface -> FetchTasks() -> []source.Task
-> [orchestrator] creates git worktrees via [worktree.Manager]
-> parallel goroutines: [agent.Invoke] runs claude/gemini CLI
-> [github] pushes branches and opens PRs (if --create-prs)
-> colored summary, exit 1 on any failure
New sources can be added by implementing:
type Source interface {
Name() string
FetchTasks() ([]Task, error)
}Built-in source: FileSource (any file). See docs/ADDING_SOURCES.md to add custom sources.
Model prefix determines which CLI tool is invoked:
gemini-*->geminiCLI- everything else ->
claudeCLI
mochi/
├── main.go # Entry point
├── cmd/
│ └── root.go # CLI flags + worktree subcommands (Cobra)
├── internal/
│ ├── agent/agent.go # AI CLI invocation (Claude/Gemini)
│ ├── config/config.go # Config struct and defaults
│ ├── github/github.go # git push + gh pr create
│ ├── memory/memory.go # Ralph Loop persistence
│ ├── orchestrator/
│ │ ├── orchestrator.go # Main run loop + ResolveSource
│ │ ├── helpers.go # Task filtering, slug formatting
│ │ └── display.go # Terminal output (Lipgloss styles)
│ ├── output/output.go # Output dispatch (PRs, files, reports)
│ ├── reviewer/reviewer.go # Ralph Loop reviewer logic
│ ├── source/
│ │ ├── source.go # Source interface + Task struct + ToSlug
│ │ └── file.go # FileSource: any file -> single task
│ ├── tui/ # Terminal UI (splash, model picker, progress)
│ └── worktree/worktree.go # Git worktree manager + manifest
├── config/defaults.env # Default values reference
├── examples/ # Example task files
└── logs/ # Agent log output (gitignored)
- Go 1.22+
git(for worktree management)claudeCLI — Claude Code — required forclaude-*modelsgeminiCLI — Gemini CLI — required forgemini-*modelsghCLI — only required for--create-prs
Planned features and improvements — roughly ordered by priority.
- GitHub Issue source — fetch task context from a GitHub Issue via
ghCLI (--issue <number>) - Linear source — pull tasks from Linear tickets (
--linear <issue-id>) - MCP source — fetch tasks by calling an MCP server tool (
--mcp-server <name> --mcp-tool <tool>) - REST API source — generic HTTP endpoint for task ingestion (
--api-endpoint <url>) - Jira source — pull tasks from Jira tickets
- Notion source — read task specs from Notion pages/databases
- Multi-task file parsing — parse a single input file into multiple independent tasks (e.g. checklist items, YAML task lists)
- Task dependency graph — define dependencies between tasks so they execute in the correct order
- Agent-to-agent handoff — allow one task's output to feed into another task's input
- Retry with backoff — automatically retry failed agent invocations with exponential backoff
- Cost estimation — estimate token usage and cost before running (shown in
--dry-run) - Progress TUI — real-time progress dashboard with per-task status, spinner, and live log tailing
- Slack/Discord notifications — post summaries to a channel when a run completes
- Webhook output — POST results to a configurable endpoint on completion
- PR auto-review — use the reviewer model to leave inline comments on the generated PR
- Merge strategy — optionally auto-merge PRs that pass CI (
--auto-merge) - Custom PR templates — configurable PR body templates with task metadata
-
mochi init— scaffold a project with example task files and config - Config file support —
.mochi.yaml/.mochi.tomlfor per-project defaults (model, branch prefix, output mode, etc.) - Plugin registry — discover and install community source plugins
-
mochi logs— TUI for browsing and searching past run logs -
mochi replay— re-run a previous task with the same context
- CI/CD integration guide — documented patterns for running MOCHI in GitHub Actions, GitLab CI, etc.
- Containerized runs — Docker image for sandboxed agent execution
- Telemetry & analytics — opt-in run metrics (duration, success rate, iterations) for team dashboards