Agestra
Agent + Orchestra — Multi-host MCP orchestration for Claude Code, Codex CLI, Gemini CLI, and local models.
Agestra connects the Claude host/CLI, Ollama (local), Gemini CLI, and Codex CLI as pluggable providers, enabling multi-agent orchestration with independent aggregation, consensus debates, autonomous CLI workers, parallel task dispatch, cross-validation, and capability-based provider routing with optional trace evidence — all through 45 MCP tools.
Quick Start
Pick the host you work in first. Use the --assets path when you want the host-native commands/agents installed too; use MCP-only registration when you only need the server connection.
| Host | From this repository | From global npm | What --assets adds |
|---|---|---|---|
| Claude Code | /plugin marketplace add mua-vtuber/Agestra then /plugin install agestra@agestra | same plugin flow | Plugin bundle, commands, agents, hooks, and MCP server together |
| Codex CLI | npm run bundle then npm run install:codex:assets | npm install -g agestra then agestra-install codex --assets | Generated custom agents under .codex/agents/ |
| Gemini CLI | npm run bundle then npm run install:gemini:assets | npm install -g agestra then agestra-install gemini --assets --scope user | Project assets for project scope, or the native agestra Gemini extension for user scope |
MCP-only registration is also available:
| Host | Repository package | Global package from a checkout |
|---|---|---|
| Codex CLI | npm run install:codex | npm run install:codex:global |
| Gemini CLI | npm run install:gemini | npm run install:gemini:global |
Claude keeps the native plugin UX. Codex combines AGENTS.md, generated custom agents, and the registered agestra MCP server. Gemini combines GEMINI.md, .gemini/commands/agestra/, generated skills, and either project-scope managed files or a user-scope native extension.
Note: npm run install:gemini:assets uses user scope by default. For project-scope managed Gemini files from a checkout, run node scripts/install-host-mcp.mjs gemini --assets --scope project.
Available Gemini commands after asset setup:
/agestra:setup/agestra:review/agestra:design/agestra:idea/agestra:implement/agestra:qa/agestra:security
Prerequisites
At least one AI provider must be installed:
| Provider | Install | Type |
|---|---|---|
| Claude Code | npm install -g @anthropic-ai/claude-code | Cloud |
| Ollama | curl -fsSL https://ollama.com/install.sh | sh | Local LLM |
| Gemini CLI | npm install -g @google/gemini-cli | Cloud |
| Codex CLI | npm install -g @openai/codex | Cloud |
Each CLI manages its own authentication. Sign in through each CLI's own login flow before using Agestra — Agestra spawns these CLIs as child processes and does not handle their credentials.
Optional but recommended:
- tmux — enables visible CLI worker panes during autonomous execution
- ripgrep (
rg) on Windows — if Codex resolvesrgto its bundled Store-app path and fails with an "Access is denied" error, install ripgrep separately so a normalrg.exeis found first inPATH:
cargo install ripgrep
Alternative:
winget install BurntSushi.ripgrep.MSVC
Philosophy
Multi-AI is for verification, not token savings. The review, design exploration, and idea generation workflows are structured as validation processes — getting independent opinions from multiple AI providers to catch blind spots, not to parallelize for speed.
How It Works
flowchart TD
Start([User invokes /agestra command]) --> Preflight[Setup status / environment / provider check]
Preflight --> Domain{Workflow type}
Domain -->|Idea / design / review / security| TextLead[Leader assembles specialist and external AIs]
Domain -->|QA| QaLead[Leader forms QA Brigade]
Domain -->|Implementation| ImplLead[Leader decomposes implementation work]
ImplLead --> ImplRoute{Task shape}
ImplRoute -->|Clear parallel implementation| CliWorkers[Codex / Gemini CLI workers<br/>isolated worktrees]
ImplRoute -->|Capability-matched scoped work| Ollama[Local/tool models<br/>read / write if policy allows]
ImplRoute -->|Risky or core change| HostImpl[Host implementer<br/>close leader supervision]
CliWorkers --> ReviewDiff[Leader monitors status / quota / diff]
Ollama --> ReviewDiff
HostImpl --> ReviewDiff
ReviewDiff --> Merge{Acceptable?}
Merge -->|No| Reassign[Correction prompt or reassignment]
Reassign --> ImplRoute
Merge -->|Yes| QaEvidence
QaLead --> QaEvidence[Host QA collects executable evidence<br/>build / tests / E2E / screenshots]
TextLead --> Providers{External AIs available?}
QaEvidence --> Providers
Providers -->|No| LocalOut[Host specialist writes<br/>domain report or document]
Providers -->|Yes| Individual[Each AI writes independent source material]
LocalOut --> Final([Report back to user])
Individual --> Ledger[ITEM-* JSON consensus ledger]
Ledger --> Round[Sequential rounds<br/>agree / disagree / revise / opinion]
Round --> Gate{Ledger state}
Gate -->|Needs more discussion| Round
Gate -->|Leader judgment needed| LeaderDecision[Leader chooses continue / approve / reject]
Gate -->|Resolved| LeaderDecision
LeaderDecision -->|Continue| Round
LeaderDecision -->|Approve| Approved[Approved synthesis document]
LeaderDecision -->|Reject| Rejected[Rejected / unresolved synthesis document]
Approved --> Final
Rejected --> Final
When no external provider is configured, Agestra skips consensus rounds and the host specialist writes the domain artifact: review or QA report, design plan, idea record, and so on. When a structured debate runs, leader finalization always leaves a synthesis document: approval produces an approved synthesis, while rejection produces a rejected/unresolved synthesis that lists accepted, excluded, and still-open items.
Host Workflows
| Host | Natural entrypoint |
|---|---|
| Claude Code | /agestra setup, /agestra review, /agestra qa, /agestra security, /agestra design, /agestra idea, /agestra implement |
| Codex CLI | Plain-language requests guided by AGENTS.md |
| Gemini CLI | /agestra:setup, /agestra:review, /agestra:qa, /agestra:security, /agestra:design, /agestra:idea, /agestra:implement |
All three hosts drive the same MCP server and shared workflow specs from commands/*.md.
Commands
| Command | Description |
|---|---|
/agestra setup | Initial AI provider selection and setup |
/agestra review [target] | Review code quality, security, and integration completeness |
/agestra qa [target] | Verify implementation results and produce PASS/FAIL evidence |
/agestra security [target] | Run a dedicated security review |
/agestra idea [topic] | Discover improvements by comparing with similar projects |
/agestra design [subject] | Explore architecture and design trade-offs before implementation |
/agestra implement [task] | Execute implementation through Leader-host-only or suggested AI distribution mode |
When external providers are available, review, QA, security, design, and idea workflows route through the team lead for multi-AI cross-validation. For QA, the team lead forms a QA Brigade from the configured provider set by default, then hands it to the moderator engine's existing ITEM-* / JSON stance ledger: host QA collects executable evidence, providers take distinct verification lenses, candidate findings are challenged before inclusion, and the synthesis preserves consensus plus dissent. E2E/browser/runtime execution remains host-owned, and external providers review the resulting evidence. When no providers are detected, the current leader host works with its local specialist agent automatically. Implementation requests first classify the task and can ask whether to propose an AI task distribution.
Agents
| Agent | Model | Role |
|---|---|---|
agestra-team-lead | Sonnet | Full orchestrator — environment check, capability-based provider routing, work mode selection, CLI worker supervision, QA loop |
agestra-implementer | Sonnet | Scoped implementation executor — code edits, test updates, local verification |
agestra-e2e-writer | Sonnet | Persistent E2E test writer — creates approved browser-flow tests without changing product behavior |
agestra-reviewer | Opus | Strict quality verifier — security, orphans, spec drift, test gaps |
agestra-designer | Opus | Architecture explorer — Socratic questioning, trade-off analysis |
agestra-ideator | Sonnet | Improvement discoverer — web research, competitive analysis |
agestra-moderator | Sonnet | Multi-mode facilitator — debate with consensus detection, independent aggregation, document review, conflict resolution |
agestra-qa | Opus | QA verifier — design compliance, PASS/FAIL judgment |
agestra-security | Opus | Security reviewer — threat model, auth/data-flow risk, dependency and secret hygiene |
Skills
| Skill | Description |
|---|---|
provider-guide | Provider routing, mode reference, orchestration pipeline |
worker-manage | List, check, collect, and stop CLI workers |
cancel | Graceful stop for workers, debates, chains, tasks |
build-fix | Auto-diagnose and fix build/typecheck/lint errors |
trace | View agent execution timeline and flow diagrams |
setup | Initial provider selection and providers.config.json write |
design | Architecture exploration workflow with multi-AI mode selection |
idea | Improvement discovery workflow with multi-AI mode selection |
review | Code quality / security / hardcoding review workflow with multi-AI mode selection |
qa | Design-contract verification and PASS/FAIL evidence workflow |
security | Dedicated security review workflow |
e2e | Persistent browser E2E test-authoring workflow |
leader | Multi-AI/provider orchestration entry — catches explicit provider, debate, consensus, or cross-validation signals, classifies the domain, and hands off to agestra-team-lead |
Architecture
Turborepo monorepo with 8 packages:
| Package | Description |
|---|---|
@agestra/core | AIProvider interface, provider descriptors with capability/difficulty metadata, config loader, CLI runner, atomic writes, job queue, secret scanner, worktree manager, task manifest, CLI worker manager |
@agestra/provider-claude | Anthropic Claude CLI adapter |
@agestra/provider-ollama | Ollama HTTP adapter with model detection |
@agestra/provider-gemini | Google Gemini CLI adapter |
@agestra/provider-codex | OpenAI Codex CLI adapter |
@agestra/agents | Debate engine with consensus detection, turn quality evaluator, task dispatcher, cross-validator, task chain, auto-QA, file change tracker, session manager |
@agestra/workspace | Workspace document manager for reviews, analysis notes, and aggregated reports |
@agestra/mcp-server | MCP protocol layer, 45 tools, environment-aware tool filtering, dispatch |
Design Principles
- Provider abstraction — All backends implement
AIProvider(chat,healthCheck,getCapabilities). Adding a new provider is isolated to a provider package plus factory registration. - Zero-config — Providers are auto-detected at startup. No manual configuration required.
- Host-native — Claude uses the plugin bundle, Codex uses
AGENTS.mdplus custom agents, and Gemini usesGEMINI.md, commands, skills, or the native extension. All hosts share the same MCP server and workflow core. - Modular dispatch — Each tool category is an independent module with
getTools()+handleTool(). The server collects and dispatches dynamically. - Atomic writes — All file operations use write-to-temp-then-rename to prevent corruption.
- Dead-end tracking — Failed approaches are recorded and injected into future prompts.
- Preflight security — CLI worker spawning includes secret scanning and array-based process args to prevent injection.
Work Modes
In multi-provider modes (consensus debate, cross-validation, review rounds), one provider's output may become part of the prompt the next provider receives.
Text work (review, QA, security, design, idea): providers available → consensus debate mode; no providers → Leader-host only. For QA, the team lead runs a QA Brigade by default while E2E/runtime checks stay host-owned.
Implementation work (team-lead orchestration):
- Leader-host only —
agestra-implementerapplies scoped code changes; the team lead still routes QA through the QA Brigade by default, with host-only review/QA available on request. - Suggested AI distribution — the team lead proposes a routing table, asks for approval, then distributes work according to the capabilities of detected models, including frontier and local models. Codex/Gemini CLI workers handle suitable autonomous code edits, and local/tool models may receive read-only or read/write AgentLoop tools according to their
executionPolicy.
Tools (45)
AI Chat (3)
| Tool | Description |
|---|---|
ai_chat | Chat with a specific provider (use "auto" for trace-assisted routing when observations exist); optionally persist replies with save_as_document |
ai_analyze_files | Read files from disk and send contents with a question to a provider |
ai_compare | Send the same prompt to multiple providers, compare responses |
Agent Orchestration (15)
| Tool | Description |
|---|---|
agent_debate_start | Start a multi-provider debate (non-blocking, optional quality loop + validator) |
agent_debate_status | Check legacy debate status or structured session progress, phase, participant activity, and document paths |
agent_debate_create | Create a turn-based debate session (returns debate ID) |
agent_debate_turn | Execute one provider's turn; supports provider: "claude" for Claude's independent participation |
agent_debate_conclude | End a debate and generate final transcript |
agent_debate_structured | Start an approval-gated structured debate in the background — individual reviews, optional alias clarification, JSON consensus rounds, status polling, and no synthesis until the leader approves or rejects |
agent_debate_approve | Leader-approve a ready-for-approval structured debate; writes the approved synthesis document and closes the session |
agent_debate_continue | Start additional background rounds on a ready-for-approval or escalated structured-debate session (3/5/10), then poll status |
agent_debate_reject | Reject a structured-debate session; writes a rejected synthesis document and optionally an issue document |
agent_debate_submit_turn | Submit a native host-specialist turn when structured debate status reports phase: awaiting-host-turn; the workflow resumes after all pending host turns arrive |
agent_debate_review | Send a document to multiple providers for independent review |
agent_cross_validate | Cross-validate outputs (agent-tier validators only) |
agent_changes_review | Review file changes from an isolated task |
agent_changes_accept | Accept and merge changes from an isolated task |
agent_changes_reject | Reject changes and clean up the isolated worktree |
CLI Workers (4)
| Tool | Description |
|---|---|
cli_worker_spawn | Spawn a CLI AI (Codex/Gemini) in autonomous mode with git worktree isolation and preflight security |
cli_worker_status | Check worker FSM state, heartbeat, and output tail |
cli_worker_collect | Collect completed worker results (git diff, output, exit code) |
cli_worker_stop | Stop a running worker (SIGTERM → SIGKILL) and clean up worktree |
Environment (1)
| Tool | Description |
|---|---|
environment_check | Detect CLI tools, local model tiers, tmux, git worktree support, available modes |
Workspace (7)
| Tool | Description |
|---|---|
workspace_create_review | Create a code review document with files and rules |
workspace_request_review | Request a provider to review a document |
workspace_review_status | Check review completion status |
workspace_add_comment | Add a comment to a review |
workspace_create_document | Create a general-purpose workspace document with title, markdown content, and optional metadata |
workspace_read | Read document contents |
workspace_list | List all workspace documents |
Provider Management (2)
| Tool | Description |
|---|---|
provider_list | List providers with status and capabilities |
provider_health | Health check one or all providers |
Setup (2)
| Tool | Description |
|---|---|
setup_status | Detect available providers and show the current setup/config state |
setup_apply | Write selected providers, locale, and selection policy to providers.config.json |
Host Assets (3)
| Tool | Description |
|---|---|
host_assets_status | Check generated host-native assets such as Codex custom agents and Gemini assets |
host_assets_install | Explicitly install or refresh managed host-native assets |
host_assets_uninstall | Remove managed host-native assets tracked by Agestra |
Ollama (2)
| Tool | Description |
|---|---|
ollama_models | List installed models with sizes and tier classification |
ollama_pull | Download a model |
Jobs (2)
| Tool | Description |
|---|---|
cli_job_submit | Submit a long-running CLI task to background |
cli_job_status | Check job status and output |
QA (1)
| Tool | Description |
|---|---|
qa_run | Run vetted workspace build/test QA profiles and return a PASS/FAIL summary |
Trace / Observability (3)
| Tool | Description |
|---|---|
trace_query | Query trace records with filtering (provider, task, time range) |
trace_summary | Get optional prior quality observations and performance metrics per provider |
trace_visualize | Generate a Mermaid diagram of a traced operation's flow |
Configuration
providers.config.json
Created by /agestra setup. The default location is the host-shared ~/.agestra/providers.config.json. Resolution order is AGESTRA_CONFIG_PATH env var → existing ~/.agestra/providers.config.json → existing legacy $CLAUDE_PLUGIN_ROOT/providers.config.json → ~/.agestra/providers.config.json for new writes. It is not meant to sit in the project repo and is gitignored accordingly.
| Field | Description |
|---|---|
selectionPolicy | "default-only" (only supported value today) |
locale | UI locale for moderator narration (ko/en/ja/zh) |
providers[].id | Unique identifier |
providers[].type | ollama, gemini-cli, codex-cli, or claude-cli |
providers[].enabled | Whether to register this provider at startup — hard opt-out when false |
providers[].executionPolicy | read-only, workspace-write, or full-auto; Ollama uses this to choose read-only vs read/write AgentLoop tools |
providers[].config | Type-specific settings (host, timeout, etc.) |
Runtime Data
Stored under .agestra/ (gitignored):
| Path | Purpose |
|---|---|
.agestra/sessions/ | Debate and task session state |
.agestra/workspace/ | Workspace documents (reviews, notes, reports) |
.agestra/.jobs/ | Background job queue |
.agestra/.workers/ | CLI worker state, manifests, and output logs |
.agestra/worktrees/ | Git worktrees for isolated CLI worker execution |
.agestra/traces/ | Provider trace JSONL (auto-pruned after 30 days) |
Development
npm install # Install dependencies
npm run build # Build all packages (Turborepo)
npm test # Run all tests (Vitest)
npm run bundle # Build single-file plugin bundle (esbuild)
npm run dev # Watch mode
npm run lint # Lint (ESLint)
npm run clean # Remove dist/
Project Structure
agestra/
├── AGENTS.md # Codex host instructions
├── GEMINI.md # Gemini host instructions
├── .claude-plugin/
│ ├── plugin.json # Claude Code plugin manifest
│ └── marketplace.json # Plugin marketplace metadata
├── .gemini/
│ └── commands/
│ └── agestra/
│ ├── setup.toml # /agestra:setup in Gemini CLI
│ ├── review.toml # /agestra:review in Gemini CLI
│ ├── design.toml # /agestra:design in Gemini CLI
│ ├── idea.toml # /agestra:idea in Gemini CLI
│ ├── implement.toml # /agestra:implement in Gemini CLI
│ ├── qa.toml # /agestra:qa in Gemini CLI
│ └── security.toml # /agestra:security in Gemini CLI
├── commands/
│ ├── setup.md # /agestra setup — provider setup
│ ├── review.md # /agestra review — quality verification
│ ├── qa.md # /agestra qa — PASS/FAIL verification
│ ├── security.md # /agestra security — security review
│ ├── idea.md # /agestra idea — improvement discovery
│ ├── design.md # /agestra design — architecture exploration
│ └── implement.md # /agestra implement — execution workflow
├── agents/
│ ├── agestra-reviewer.md # Strict quality verifier (Opus)
│ ├── agestra-designer.md # Architecture explorer (Opus)
│ ├── agestra-ideator.md # Improvement discoverer (Sonnet)
│ ├── agestra-implementer.md # Scoped implementation executor (Sonnet)
│ ├── agestra-e2e-writer.md # Persistent E2E test writer (Sonnet)
│ ├── agestra-moderator.md # Multi-mode facilitator (Sonnet)
│ ├── agestra-qa.md # QA verifier (Opus, no code writes)
│ ├── agestra-security.md # Security reviewer (Opus)
│ └── agestra-team-lead.md # Full orchestrator (Sonnet, no code writes)
├── skills/
│ ├── provider-guide.md # Provider routing and mode reference
│ ├── worker-manage.md # CLI worker management
│ ├── cancel.md # Graceful operation cancellation
│ ├── build-fix.md # Build error auto-repair
│ ├── trace.md # Execution timeline viewer
│ ├── setup.md # Initial provider selection
│ ├── design.md # Architecture exploration workflow
│ ├── idea.md # Improvement discovery workflow
│ ├── review.md # Code quality review workflow
│ ├── qa.md # Design-contract QA workflow
│ ├── security.md # Dedicated security review workflow
│ ├── e2e.md # Persistent E2E test-writing workflow
│ └── leader.md # Multi-AI orchestration entry router
├── hooks/
│ └── user-prompt-submit.md # Tool recommendation hook
├── dist/
│ └── bundle.js # Single-file MCP server bundle
├── scripts/
│ ├── bundle.mjs # esbuild bundle script
│ ├── install-host-mcp.mjs # Register Claude/Codex/Gemini MCP + host assets
│ └── uninstall-host-mcp.mjs # Remove host registrations and managed assets
├── packages/
│ ├── core/ # AIProvider interface, registry, security, workers
│ ├── provider-claude/ # Anthropic Claude CLI adapter
│ ├── provider-ollama/ # Ollama HTTP adapter
│ ├── provider-gemini/ # Gemini CLI adapter
│ ├── provider-codex/ # Codex CLI adapter
│ ├── agents/ # Debate engine, dispatcher, cross-validator
│ ├── workspace/ # Workspace document manager
│ └── mcp-server/ # MCP server, 45 tools, environment-aware filtering, dispatch
├── package.json # Workspace root
└── turbo.json # Turborepo pipeline
Adding a Provider
- Create
packages/provider-<name>/implementingAIProvider. - Add a factory in
packages/mcp-server/src/index.ts. npm run build && npm test
Uninstall
Claude Code:
/plugin uninstall agestra@agestra
Codex CLI:
npm run uninstall:codex
npm run uninstall:codex:assets
Gemini CLI:
npm run uninstall:gemini
npm run uninstall:gemini:assets
The *:assets uninstall commands remove both the host registration and unchanged generated host assets. Codex assets are custom-agent files. Gemini project-scope assets are managed files; Gemini user-scope assets are removed through gemini extensions uninstall agestra. If a generated asset was edited by the user, Agestra leaves it in place and reports it. For a global npm install, use agestra-uninstall codex --assets or agestra-uninstall gemini --assets --scope user.
If you also want to delete generated project data, remove the .agestra/ directory manually.