opencode-delegate
Integrates Google Antigravity with OpenCode specialized models, enabling delegation of coding tasks via MCP tools and slash workflows, including model discovery, task delegation, and session continuation.
Integrates OpenAI Codex with OpenCode specialized models through a stdio MCP server, enabling delegation of coding tasks, model discovery, and session continuation.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
OpenCode Delegation Bridge & MCP Server
Zero-dependency delegation engine, stdio MCP server, and native /oc slash workflow connecting Google Antigravity and OpenAI Codex to OpenCode specialized models (DeepSeek V4.1 Flash, GLM 5.3 Flash, MiMo 2.6, and more).
ποΈ Architecture & Integration Map
Google Antigravity leverages a three-tier customization system (Rules, Workflows, and Skills) alongside Model Context Protocol (MCP) servers. OpenAI Codex shares the .agents/skills/ standard and supports stdio MCP servers.
Component Layer | Workspace Path | Role in Architecture |
1. Slash Workflow ( |
| Interactive slash commands ( |
2. Escalation Rule |
| Lightweight always-on rule enforcing the 15-line threshold and prompting escalation only upon local verification failure. |
3. Progressive Skill |
| On-demand skill teaching agents structured brief generation, status recovery, and |
4. Core Relay Engine |
| Zero-dependency Node.js CLI & library: live discovery, pre/post git snapshot isolation, scope enforcement, and auto-heal loop. |
5. Thin MCP Server |
| Zero-dependency stdio JSON-RPC 2.0 MCP server exposing |
6. Persistent State |
| Stores active default model, automatic fallbacks ( |
7. MCP Registration |
| Connects the stdio server to Antigravity and Codex. |
ββββββββββββββββββββββββββ
β Google Antigravity β
β / OpenAI Codex β
βββββββββββββ¬βββββββββββββ
β
ββββββββββββββββββββββΌβββββββββββββββββββββ
β Stdio MCP β Slash / Rules β
βΌ βΌ βΌ
[mcp-server.mjs] [.agents/rules/] [.agents/workflows/oc.md]
β
βΌ
[bridge.mjs] ββββ Persistent Config ([opencode-models.json])
βββ Model Discovery & Availability Guard (15-min cache)
βββ Quota / 429 Rate-Limit Guard
βββ Pre- & Post-Execution Git & SHA-256 Snapshot
βββ Allowed Paths Scope Guard
βββ Deterministic verify_cmd & Auto-Heal Loop
β
βΌ
[OpenCode CLI] (`opencode run --format json --auto`)Related MCP server: Pair
π Repository Structure
.
βββ .agents/
β βββ mcp_config.json # MCP registration config
β βββ opencode-models.json # Model routing, lanes & aliases
β βββ rules/
β β βββ opencode-escalation.md # Escalation policy
β βββ workflows/
β β βββ oc.md # /oc slash workflow
β βββ skills/
β βββ opencode-delegate/
β βββ SKILL.md # Agent progressive skill
β βββ references/
β β βββ brief-template.md # Task brief template
β βββ scripts/
β βββ bridge.mjs # Core engine & CLI
β βββ mcp-server.mjs # Stdio MCP server
βββ .github/
β βββ workflows/
β βββ ci.yml # Continuous integration checks
βββ .gitignore
βββ LICENSE
βββ package.json
βββ README.mdβ‘ Core Engine Capabilities
Model Auto-Discovery & Health Guard: Discovers live models via
opencode models, caches the results with configurable TTL (default: 15 minutes), and validates model availability prior to execution. If a model was deprecated, it halts withMODEL_UNAVAILABLEand presents live alternatives.Quota & Rate-Limit Guard (429): Detects API quota exhaustion and returns
QUOTA_EXCEEDEDalongside alternative models so the parent agent can prompt the user to pivot rather than failing silently.Pre- & Post-Execution Git & SHA-256 Snapshot: Computes SHA-256 hashes of untracked and modified files before invocation. Guarantees that pre-existing uncommitted changes are never attributed to OpenCode and verifies that OpenCode never makes unauthorized git commits.
Scope Guard: Restricts OpenCode edits to specified
allowedPaths. Out-of-scope file modifications are flagged inunexpectedFiles.Deterministic
verify_cmd& Auto-Heal Loop: Executes user-defined test, typecheck, or lint commands after OpenCode completes. If verification fails, it resumes the OpenCode session automatically up tomaxHealRetriestimes with compiler/test error output.
π Quickstart & Setup
Prerequisites
Node.js
>= 18.0.0OpenCode CLI (
>= 1.18.0, tested on1.19.3):npm install -g opencode-ai@latest opencode --version
1. Register MCP Server
Google Antigravity
The workspace config is ready in .agents/mcp_config.json. To register globally, append to ~/.gemini/config/mcp_config.json:
{
"mcpServers": {
"opencode-delegate": {
"command": "node",
"args": [
"/path/to/project/.agents/skills/opencode-delegate/scripts/mcp-server.mjs"
]
}
}
}OpenAI Codex
Add to ~/.codex/config.toml:
[mcp_servers.opencode_delegate]
command = "node"
args = ["/path/to/project/.agents/skills/opencode-delegate/scripts/mcp-server.mjs"]π οΈ Usage
1. Slash Command (/oc)
Inside Google Antigravity chat:
# List and discover live models
/oc models
# Set default model
/oc set default opencode/deepseek-v4.1-flash-free
# Delegate coding task (auto-fallbacks to GLM and MiMo if quota is reached)
/oc Implement email validation in src/validators.ts
# Delegate coding task with shorthand alias
/oc glm Refactor auth middleware to use JWT verification
/oc mimo Generate unit tests for utils/date.ts2. Standalone CLI (bridge.mjs)
When MCP is not connected, the bridge CLI can be called directly:
# Model Discovery & Configuration
node .agents/skills/opencode-delegate/scripts/bridge.mjs models list
node .agents/skills/opencode-delegate/scripts/bridge.mjs models refresh
node .agents/skills/opencode-delegate/scripts/bridge.mjs models set_default opencode/deepseek-v4.1-flash-free
# Delegate Task
node .agents/skills/opencode-delegate/scripts/bridge.mjs delegate '{
"brief": "Implement email validation in src/validators.ts",
"contextFiles": ["src/validators.ts"],
"allowedPaths": ["src/validators.ts", "test/validators.test.ts"],
"verifyCmd": "npm test"
}'3. Stdio MCP Tools
The MCP server exposes three JSON-RPC 2.0 tools:
opencode_models: List, refresh, and configure active default model, fallbacks, and trigger modes.opencode_delegate: Delegate tasks with context files, scope restrictions, and auto-heal verification.opencode_continue: Resume an existing session with delta instructions and review feedback.
4. Interactive UI/UX Observability Dashboard
The repository includes a modern, zero-dependency real-time observability dashboard with KPI tracking, hourly token throughput visualization, task filtering, and a live prompt token estimator.
# Launch preview server on http://localhost:3000
npm run previewπ§ͺ Verification & Testing
Run the comprehensive test suite (46 automated tests spanning bridge, MCP, rate-limiter, dashboard engine, and preview server):
# Run all unit and integration tests
npm test
# Test live model auto-discovery
npm run test:models
# Test unavailable model guard
npm run test:guard
# Test MCP server stdio handshake
npm run test:mcpπ License
This project is licensed under the MIT License.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
This server cannot be deployed
Maintenance
Related MCP Connectors
Discover, compare, route, and execute machine-accessible capabilities for AI agents.
Coordination hub for AI coding agents: message teammates, ask humans, audit every event.
The team layer for AI coding agents: shared contracts, collision alerts, E2EE sessions.
Shared control plane for AI coding agents β tasks, memory, decisions, file locks. 12 tools.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables external agents to delegate coding tasks to a local zcode/GLM coding agent, with multi-turn sessions, model selection, and task cancellation.3MIT
- AlicenseNot gradedqualityCmaintenanceEnables users to delegate coding tasks in a chosen project to the official Codex and Claude CLI agents from within an existing chat, then convene a council of configured models to gather independent opinions and review the resulting files and test runs. It also manages multi-provider API connections, model catalogs, and per-task token, time, and cost limits.MIT
- AlicenseNot gradedqualityCmaintenanceEnables Claude and Codex agents to delegate implementation, testing, research, or review tasks to each other through local MCP tools, while supporting persistent sessions, isolated editing workspaces, and reviewed integration. It also allows progress tracking, cancellation, model selection, and management handoff between providers.2MIT
- AlicenseNot gradedqualityCmaintenanceEnables delegating tasks to agents you configure yourself through OpenAI-compatible Chat Completions backends, with automatic or explicit routing, synchronous calls, persistent asynchronous jobs, and multi-step reviewed workflows. It returns proposals and analyses only, leaving file changes, command execution, and approvals under the MCP client's control.18 npmMIT