Skip to main content
Glama
Hybrid SAGE

Hybrid SAGE

Official
by bioassembly

Hybrid SAGE

Hybrid SAGE coordinates Codex, Antigravity, and OpenCode through a shared MCP router. Frontier models plan, decompose, integrate, and review; free-model OpenCode workers handle separable implementation and test loops.

Default workflow

  1. The frontier harness inspects fleet_status and list_worker_models, then divides substantial work into bounded tasks with clear file ownership.

  2. It launches OpenCode workers with delegate_local(..., async_mode=true). Up to three independent jobs can run concurrently by default. Use disjoint file scopes or separate worktrees to avoid conflicting edits.

  3. It polls each job_id, reads the output artifact, checks worker verification, integrates the result, and runs the final checks before reporting completion.

  4. Workers return results to their caller. HYBRID_SAGE_CHILD blocks recursive cross-harness delegation. Trivial edits can stay in the frontier harness.

This reduces frontier context use and quota spent on repetitive implementation. Provider rate limits and availability still apply; “free” does not mean unlimited.

# In a frontier Codex or Antigravity session:
delegate_local(prompt="Implement the parser; own src/parser.py only", mode="code", async_mode=True)
delegate_local(prompt="Add behavior tests; own tests/test_parser.py only", mode="test", async_mode=True)
# Poll both returned jobs:
delegate_local(job_id="job-...")

Related MCP server: LocalForge

Tools

MCP tool

Behavior

fleet_status

Reports CLI presence, the configured OpenCode provider, worker policy, and bridge telemetry. Authentication and quota remain unverified until execution.

list_worker_models

Reads cached model metadata without starting OpenCode plugins; falls back to CLI discovery. Distinguishes advertised zero prices from verified service availability.

delegate_local

Runs an OpenCode implementation, test, review, or explanation task with an explicit model or the configured free worker. Returns bounded text plus an artifact; supports async polling.

consult_codex

Requests independent review or diagnosis from Codex using a scanned text snapshot. The child has no project tools, MCP servers, plugins, shell, or recursive agents.

escalate_task

Requests Antigravity plan-mode diagnosis and returns invariants for the caller to implement and verify.

route_task

Recommends a configured unit using capability tags, available CLIs, context estimates, and sensitive-data hints. It does not authorize provider cost.

manage_handoff

Exchanges project-scoped task notes and lessons. Recalled lessons must be checked against current code and tests.

airgap_scan

Screens text/files for configured secret and clinical-identifier patterns and can redact matches. It is a heuristic, not proof of anonymization.

configure_fleet

Persistent control plane: fleet status, paged model listing, exact model selection (paid/unknown prices need allow_paid=true), and enable/disable of new delegation. Toggles never cancel running jobs and never reset user choices.

Codex and Antigravity can summon OpenCode workers. OpenCode and Antigravity can consult Codex; OpenCode and Codex can consult Antigravity. Inside an OpenCode worker, complete the assigned task directly instead of delegating to itself.

Free worker policy

delegate_local is free-only by default. It uses the persisted assistant choice, then the fleet default, unless an exact model override is supplied. A saved allow_paid=true selection authorizes that model on later tasks; an explicit free_only=true still forces the free allowlist. Unavailable models return an error without substituting another model.

The initial preferred worker matches this setup's selected model, opencode/glm-5.3-flash-free. The initial allowlist also includes zero-price catalog entries for MiMo V2.6 Flash, Nemotron 3.5 Lightning, Nemotron 3.5 Super VL, and DeepSeek V4.1 Flash. Check current provider prices before changing policy. Cached prices and an operator allowlist cannot guarantee future prices or quota.

Override policy in gitignored configs/fleet.local.json, or select a full fleet with HYBRID_SAGE_FLEET:

{
  "worker_policy": {
    "default_model": "opencode/glm-5.3-flash-free",
    "free_model_ids": ["opencode/glm-5.3-flash-free"],
    "max_parallel_jobs": 3,
    "timeout_sec": 900
  }
}

A local CLI can use a remote provider. Free hosted workers are cloud inference; private datasets require a separately configured and verified local provider.

Persistent fleet controls

Install once with bash install.sh, then control SAGE in the harness chat:

/sage
/sage models
/sage models opencode
/sage model opencode/glm-5.3-flash-free
/sage off
/sage on
/sage status

/sage shows current mode, selected assistant, and the Models / Select model / On / Off choices. Controls call configure_fleet over the connected MCP directly; no terminal command or standalone SAGE CLI is needed. Selection persists across Codex, Antigravity, and OpenCode. Paid/unknown-price selections require explicit --allow-paid. Off blocks new delegation without cancelling running jobs; on retains the selected model. These settings are read on each call.

OpenCode registers a native /sage command. Codex's app exposes the installed sage skill in its slash menu; clients that use skill mentions can invoke $sage or select it via /skills. Antigravity loads the same control skill. The MCP also exposes a sage prompt for clients with prompt support; the exact menu label is owned by the host. MCP registration alone cannot add a custom slash menu entry in an arbitrary client. Restart the harness once after installation to discover new skills/commands. The installer retires only its own previous CLI symlinks.

Preferences remain in ~/.config/hybrid-sage/preferences.json (override with HYBRID_SAGE_PREFERENCES). Agents must honor the saved choice and never re-enable hybrid mode automatically. If assistant quality is poor, use /sage off and the frontier model continues directly.

The runtime matches the active provider exactly rather than probing an unrelated configured provider. Alternate worker selection does not depend on the default local inference endpoint being online.

Worker launches align both the operating-system working directory and logical PWD with the assigned workspace, and include its absolute path in the task contract. This avoids native CLI sessions inheriting the frontier shell's directory.

Install

Requires Python 3.10+ and the CLIs for the harnesses you use. Codex consultation and registration target Codex CLI 0.167+. The OpenCode plugin uses the native v2 setup and domain-transform API, with a v1 server adapter retained.

git clone https://github.com/bioassembly/hybrid-sage.git
cd hybrid-sage
bash install-plugin.sh

The installer registers Antigravity and OpenCode plugins, links the routing skill, installs OpenCode commands, and registers Codex when present. Existing JSON configs are backed up before edits. OpenCode v2 loads the repository as a plugin package directory through plugins; old single-file registrations are migrated while preserving unrelated entries. Restart the harnesses to load the configuration.

For Codex only:

bash install-plugin.sh --codex-only --dry-run
bash install-plugin.sh --codex-only

Codex registration uses its native config writer, preserves unrelated settings, backs up config.toml, honors CODEX_HOME, and links ~/.agents/skills/model-router. The codex-sage installer's --with-hybrid profile integration is an alternative.

[mcp_servers.hybrid-sage]
command = "python3"
args = ["/absolute/path/to/hybrid-sage/plugins/mcp_server.py"]

Execution and privacy boundaries

For async edits, specify owned file paths in the prompt and use verify_command to check required outputs and behavior. async_mode with the separate output_path argument is explicitly rejected; synchronous output_path retains backup and response-to-file handling. Local-only routing passes require_local=true end to end and never substitutes a hosted free worker, even for private text without recognized identifiers.

Async workers have persistent exit results, bounded concurrency, execution timeouts, verification results, and output artifacts. A crashed or failed worker is not reported as successful. Concurrent artifact names do not collide.

Codex consultation sends at most 20 text files, 128 KB per file and 256 KB total, through a scanned snapshot. It runs outside the project with inherited user configuration and tools disabled; authentication remains in the normal Codex home. Codex uses your subscription/API quota. No provider fallback runs on failure.

Antigravity plan-mode and OpenCode workers can inspect the project with tools; scanned excerpts alone are not a privacy boundary. Keep sensitive inputs on verified local providers and keep credentials out of task notes and shared memory.

Validate

python3 -m unittest discover -s tests -v
node --test tests/test-plugin.mjs
bash -n install-plugin.sh

Tests cover the stdio MCP interface, worker selection, failed execution, real supervisor subprocesses, async polling, concurrency, Codex context isolation, recursion guards, and OpenCode v2 registration. Model calls are mocked; passing these tests does not establish live model availability or quotas.

See architecture, routing, handoffs, and cost/privacy. Licensed under MIT.

Available Tools

9 tools
airgap_scanB

Pre-flight PII/PHI/Secret Airgap Firewall: scans text and/or files for live credentials, API keys, clinical patient identifiers (NIK, MRN), or genomic VCF headers, and optionally returns a redacted copy safe for cloud models.

Inputs: text, files, redact.

configure_fleetB

Control hybrid mode across all harnesses: inspect status, list models, select an exact catalog model, or enable/disable new delegation. Selection of paid/unknown-price models requires explicit allow_paid=true. Configuration does not invoke a model or stop running jobs.

Inputs: action (required), limit, offset, model_id, +2 more.

consult_codexA

Ask Codex for a bounded second opinion, design diagnosis, or code review. Sends a scanned context snapshot to a tool-free read-only child; never silently falls back to another provider. Uses Codex authentication and quota, not a free local model.

Inputs: prompt (required), files, redact, workdir, +2 more.

delegate_localA

Delegate a bounded coding, test, explanation, or review task through OpenCode. Select model_id explicitly for a free or alternate provider; otherwise use its configured model. Provider locality and billing vary. Returns a capped preview plus output artifact and supports async polling. No automatic model fallback.

Inputs: mode, files, job_id, prompt, +8 more.

escalate_taskA

Escalate a 2-strike bug, subtle race condition, complex architecture design, or security audit from the local workhorse to upstream frontier intelligence (Gemini 4 Argon or Gemini 3.8 Flash via Antigravity). Runs pre-flight airgap check to prevent PHI/secret leaks, records the handoff packet in NOTES.md, queries the frontier model, and returns the architectural diagnosis and solution spec so the local model can resume execution.

Inputs: prompt (required), files, redact, workdir, +5 more.

fleet_statusB

Check live OpenCode CLI & local model readiness, slot-0 idle status, configured model units, shared memory graph, and cumulative ROI savings.

Inputs: no named parameters.

list_worker_modelsB

Page through the actual cached or live OpenCode model catalog, including paid and unknown-price models. Returns exact IDs and advertised cost metadata; names do not establish pricing or availability.

Inputs: limit, offset, provider.

manage_handoffB

Inspect or update cross-unit handoff state in NOTES.md, or record/recall project invariants and pitfall lessons.

Inputs: action (required), query, symptom, workdir, +2 more.

route_taskB

Classify a prompt or task across your fleet based on privacy/airgap inspection, context scale, health, and reasoning depth.

Inputs: prompt (required), mock, files, private, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 9 tools

    Disambiguation3/5

    Four tools all mean "send this task somewhere" (route_task, delegate_local, escalate_task, consult_codex), and only careful reading of descriptions reveals that route_task classifies without executing, delegate_local runs locally, and the other two hit external providers. There is also real overlap between fleet_status, list_worker_models, and configure_fleet, each of which claims to inspect status and/or list models.

    Naming Consistency4/5

    All names are snake_case with an action-oriented prefix (escalate_task, delegate_local, manage_handoff, configure_fleet), which is predictable and readable. Minor deviation: fleet_status and airgap_scan are noun-first rather than verb_noun, but the set is otherwise consistent.

    Tool Count4/5

    Nine tools is a sensible scope for a hybrid routing/orchestration server, with each tool covering a distinct workflow stage (scan, route, delegate, escalate, consult, hand off, configure). The count is slightly inflated by configure_fleet duplicating status/model-listing responsibilities already held by fleet_status and list_worker_models.

    Completeness4/5

    The surface covers the full hybrid workflow: airgap scanning, routing, local delegation, escalation, external consultation, model discovery, config, and handoff state in NOTES.md. Gaps are minor: no explicit job status/cancel or async result-retrieval tool, despite delegate_local advertising async polling.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables hybrid agentic coding by delegating token-heavy implementation, editing, and test-debug loops to local open-source models while frontier cloud models handle architecture and review, reducing premium API token usage and keeping code private.
      1
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables coordinating local coding agents across Antigravity, DeepSeek Harness, Claude Code, and OpenCode with persistent tasks, live public events, file-change artifacts, session follow-ups, process-tree cancellation, and configurable execution permissions.
      MIT