Agent Integrations (GXT wrapper)
OpenGantry is tool-agnostic and vendor-neutral — any agent that can run shell commands can participate in the GXT loop. Governance is local-first: missions, gates, and Gantry Git hook enforcement run in your repository, not through a hosted agent dashboard.
Audience: adopters wiring agents into their own repos. For contributing to OpenGantry itself, see docs/DEVELOPMENT.md.
Universal rule
- Planner legislates a mission under
.gitagent/missions/(IDE chat:.gitagent/planner/MISSION-ARCHITECT.md— one copy-pastegantry legislatecommand). - Bootstrap mission-scoped runtime env before executor execution.
- Append trace evidence to
EXECUTOR_LOG.md. - Finish with
gantry verify --mission <path>(full verify before merge / claiming done).
# Process-boundary wrap (subprocess executors — strongest TMVC trap)
gantry runtime exec --mission .gitagent/missions/MSN-0001.<slug>.yaml -- <your-agent-command>
# IDE terminal / manual shell (any tool)
source scripts/gxt-runtime-env.sh .gitagent/missions/MSN-0001.<slug>.yaml
# Orchestrator / CI JSON bootstrap
gantry runtime env --mission .gitagent/missions/MSN-0001.<slug>.yaml --json
On failure, read GXT_LAST_ERROR_FILE (from runtime env) for machine-oriented remediation. gxt_verify returns structured error_code, fix_hints, and next_actions for IDE agents. After gantry verify failures, consume gantry context-feed --json (or read .gitagent/tmp/NEXT_REMEDIATION.json directly) for the latest structured remediation snapshot — atomic swap writes; eventual consistency under concurrent repair loops. See .gitagent/planner/RUNTIME.md.
MCP tools (Cursor and other MCP clients)
| Tool | Purpose |
|---|---|
gxt_interrogate | Deterministic gap analysis; returns halt (one question) or clear + interrogation_sha256 |
gxt_draft_legislation / gxt_execute_legislation | Two-step mission legislation with chat approval (requires complete interrogation) |
gxt_check_signature / gxt_pin_mission | Planner stamp check + pin active mission |
gxt_start_orchestration | Goal-first flow: triage → legislate stub → optional pin/runtime env |
gxt_runtime_env / gxt_runtime_exec | Executor bootstrap + process-boundary enforcement |
gxt_verify | Structured verify phases with fix_hints on failure |
gxt_resolve_mission / gxt_last_error | Mission resolution + last runtime exec error |
Kernel library (v3.2.2+)
External runtimes (iii workers, daemons, custom middleware) can call OpenGantry in-process without deep-importing dist/cli/lib/*:
import {
evaluateScope,
verifyMission,
mintVerdictToken,
verifyVerdictToken,
} from "@jeger-ai/opengantry/kernel";
| Export | Purpose |
|---|---|
evaluateScope | TMVC + forbidden-zone check for a repo-relative path |
verifyMission | Full verify phases → structured JSON payload |
mintVerdictToken / verifyVerdictToken | HMAC verdict tokens (pepper keyring) for hot-path promotion gates |
Breaking in v3.2.2: only . (CLI) and ./kernel resolve from the package. Migrate any deep imports before upgrading. Reference integration: examples/iii-integration/.
Enforcement boundary (where the cage is ironclad)
| Tier | Mechanism | What it actually traps |
|---|---|---|
| Process-boundary | gantry runtime exec | TMVC roots + forbidden zones for subprocess executors |
| Deterministic hook | Tool hooks (today: Cursor beforeShellExecution on law/manifest paths) | Shell writes to .gitagent/foreman/, .gitagent/planner/RULES.md |
| Advisory | Rules / AGENTS.md / tool memory | IDE Agent Write/Edit — LLM compliance, not kernel enforcement |
IDE agent file edits are not TMVC-trapped unless the tool runs inside runtime exec. Docs here optimize context injection and workflow — not generic “be careful” advice.
External IDE skills (edge quarantine)
Third-party agent skill packs (Cursor SKILL.md, community rule collections, dependency-aware generators) are local IDE preferences — not OpenGantry routing skills and not GXT law.
| Layer | What belongs | Enforcement |
|---|---|---|
| GXT core | RULES.md, MANIFEST.json, mission YAML, deterministic gates | gantry verify, hooks, CI |
| IDE edge | Optional local rules/skills (gitignored) | None — advisory to the IDE only |
| Result state | Files on disk after any edit | Compile, tests, import layers, KPI gates |
Zero-trust: Git cannot attest how a line was produced. All incoming diffs are validated the same way. Do not add subjective coding-style packs to AGENTS.md, .gitagent/, or gantry init templates.
Local wiring (adopters): copy tool-specific examples only on the developer machine — e.g. Cursor: .cursor/external-skills.local.mdc (see specimen .cursor/external-skills.local.example.mdc). Cline: .clinerules/*.local.md. Keep GXT pointer files (gxt.md, CLAUDE.md) linking canonical law only.
Optional [SKILL-EXEC] stamps: executors may append one-line context to EXECUTOR_LOG.md for human PR triage:
[SKILL-EXEC] skill_key=<provider::skill> tool=<tool_name> scope=<path_or_glob>
Missing stamps are not verify failures. Stamps are not cryptographic proof and must not replace mission trace PASS quotes.
Remote handoff (Planner push → remote agent)
Enterprise async pattern:
- Planner (local):
gantry legislate … --msn MSN-NNNN→ tune mission →git commit -m "[MSN-NNNN] legislate …"(must modify mission file). - Planner push: pre-push runs
gantry verify --mission … --pre-push— legislative stubs pass after git-proof only (placeholdertrace_rowsor empty). - Remote worker:
source scripts/gxt-runtime-env.sh <mission>→ execute → append gate output toEXECUTOR_LOG.md. - Verifier (before merge): full
gantry verify --mission <path>(gate + trace).
Unlegislated mission files (no Planner [MSN-NNNN] stamp) still fail pre-push.
CI receipt ingestion (GitHub Actions)
M1 control-plane ingestion uses gantry verify --export to emit a hub envelope after verify completes (pass or fail). The workflow ingests the envelope before failing the job so failed gates still land in the ledger (ADR-0037).
Copy templates/.github/workflows/gxt-attest-ingest.yml to .github/workflows/ in your spoke repo.
Repository settings
| Name | Type | Purpose |
|---|---|---|
GANTRY_ORG_ID | variable | Must match the plane ingestion token org |
GANTRY_ORG_PEPPER | secret | Customer-held pepper (never sent to the plane) |
GANTRY_ORG_PEPPER_VERSION | variable | Optional; default 1 |
PLANE_INGEST_URL | variable | Public HTTPS base of the control plane |
PLANE_INGEST_TOKEN | secret | From planectl token-create on the plane |
Execution order (critical)
- Checkout PR head with
fetch-depth: 0(git-proof + planner stamp need history). - Set runner-verified identity — never
git logcommitter email:GANTRY_SIGNER_PRINCIPAL=github:<user_id>:<login>fromgithub.event.pull_request.userGANTRY_SIGNER_PRINCIPAL_KIND=github_actorGANTRY_BRANCH_NAMEfromgithub.event.pull_request.head.ref
gantry verify --mission … --ci --export envelope.jsonwithcontinue-on-error: truePOST $PLANE_INGEST_URL/api/v1/attestations/ingestwith Bearer token- Fail the job if verify failed (ingestion already recorded)
Local export (debug)
export GANTRY_ORG_ID=org-example
export GANTRY_ORG_PEPPER='<secret>'
gantry verify --mission .gitagent/missions/MSN-NNNN.<slug>.yaml --export /tmp/envelope.json
See opengantry-plane docs/DEPLOYMENT.md for plane provisioning.
Canonical context files
Point every tool at the same GXT law — do not duplicate prose:
| File | Role |
|---|---|
AGENTS.md | Cross-tool entry: read RULES + MANIFEST before acting |
.gitagent/planner/RULES.md | Governance law |
.gitagent/foreman/MANIFEST.json | Routing map (TMVC roots, forbidden zones) |
gantry init scaffolds AGENTS.md, .gitagent/ARCHITECTURE.pointer.json (agent discovery for code layout), docs/ARCHITECTURE.md (default file target), selected IDE pointer files, runtime scripts, and composes docs/INTEGRATIONS.md (human adopter IDE setup — not LLM context) from shipped recipe fragments.
Shared session variables
| Variable | Purpose |
|---|---|
GANTRY_PLANNER_EMAILS | Comma-separated Git author emails allowed to legislate (git-proof) |
GANTRY_MISSION | Optional mission path for gxt-runtime-env.sh when no arg passed |
GXT_* | Emitted by gantry runtime env — TMVC roots, forbidden zones, executor log path |
Deprecated compat: scripts/gxt-cursor-env.sh sources gxt-runtime-env.sh with a stderr notice.
Closed-loop checklist (all tools)
gantry init+export GANTRY_PLANNER_EMAILS="$(git config user.email)"+gantry doctorgantry legislate "<intent>" --msn MSN-NNNN --skill-key <key>→ Planner[MSN-NNNN]commit- Bootstrap:
source scripts/gxt-runtime-env.sh .gitagent/missions/<file>.yaml - Executor executes; append PASS quotes to
EXECUTOR_LOG.md gantry verify --mission .gitagent/missions/<file>.yamlgit push(pre-push uses--pre-pushhandoff semantics)
Diagnostic context feed (verify repair loops)
When gantry verify fails, OpenGantry writes a machine-readable snapshot to .gitagent/tmp/NEXT_REMEDIATION.json (gitignored). IDE wrappers and agent rules can read this before the next prompt cycle:
gantry context-feed --json # latest failure payload (empty when none)
gantry context-feed --clear # atomic tombstone clear after remediation
Writes use temp-file + rename swap to avoid read/write races during automated test-and-repair loops.
Compatibility matrix
| Tool | Context injection | Wrap / bootstrap |
|---|---|---|
| Cursor | .cursor/rules/opengantry-gxt-substrate.mdc + .cursor/hooks.json + .cursor/mcp.json (gxt_* tools) | Hook: sessionStart auto-inject · scripts/gxt-pin-mission.sh <mission> · source scripts/gxt-runtime-env.sh |
| Claude Code | CLAUDE.md or .claude/CLAUDE.md → link canonical files | Shell wrapper: scripts/gxt-shell-agent.sh claude <mission> · gantry runtime exec … -- claude "<task>" |
| OpenAI Codex CLI | Root AGENTS.md (native); optional .codex/config.toml | Shell wrapper: scripts/gxt-shell-agent.sh codex <mission> · gantry runtime exec … -- codex exec "<task>" |
| OpenCode | AGENTS.md (native); optional opencode.json instructions | Shell wrapper: scripts/gxt-shell-agent.sh opencode <mission> · gantry runtime exec … -- opencode run "<task>" |
| JetBrains Junie | .junie/AGENTS.md or .junie/guidelines.md | Manual: Terminal → source scripts/gxt-runtime-env.sh <mission> |
| Google Antigravity | AGENTS.md + .agent/rules/gxt.md (always_on) | Manual: gantry runtime exec … -- <agent-command> |
| Cline | .clinerules/gxt.md + root AGENTS.md | Manual: Terminal → source scripts/gxt-runtime-env.sh <mission> |
| Aider | .aider.conf.yml read: list | Manual: gantry runtime exec … -- aider --message "<task>" |
| OpenHands | .openhands/microagents/gxt.md + root AGENTS.md | Manual: Terminal → source scripts/gxt-runtime-env.sh <mission> |
Related tools (not duplicate matrix rows):
- Gemini Code Assist — VS Code/JetBrains plugin; use the same three canonical files; distinct from the Antigravity agent-first IDE.
- OpenAI Codex API (2021–2023) — deprecated code-completion API; not OpenAI Codex CLI (2025+ terminal/IDE agent documented above).
Vendor CLIs change; the wrap line and context files do not.
Per-tool closed loop
Cursor
- Context injection:
.cursor/rules/opengantry-gxt-substrate.mdc(alwaysApply: true);.cursor/hooks.json—sessionStartmission scope +beforeShellExecutionfallback guard. - MCP bridge:
.cursor/mcp.json—gantry mcp serveexposesgxt_*tools for zero-copy-paste legislation. - Mission Architect:
/gantrymacro (do not use/plan— Cursor native Plan Mode); implicit activation when user asks to write/edit code with no pinned mission. Follow.gitagent/planner/MISSION-ARCHITECT.md. - Two-step legislation (Yolo-safe):
gxt_interrogate→ operator answers in chat →gxt_draft_legislation(server recomputes gaps) → human chat approval →gxt_execute_legislation→ Plannergit commit→gxt_check_signature→gxt_pin_mission.gxt_start_orchestrationhalts withINTERROGATION_REQUIREDuntil interrogation is complete (seeGXT_LAST_ERROR_FILE). - Host tool policy: Cursor may require approval per tool call or auto-run all tools (“Yolo mode”). MCP draft/execute is the primary governance gate — not host settings alone.
- Session bootstrap:
scripts/gxt-pin-mission.sh .gitagent/missions/MSN-0001.<slug>.yaml # once per feature
source scripts/gxt-runtime-env.sh # integrated terminal (uses pinned mission)
- Enforcement: Advisory for Agent edits; MCP two-step gate for legislation; shell hook fallback for raw
gantry legislate/ law/manifest writes; useruntime execfor headless CLI/SDK runs. - Gotcha: Enable hooks and MCP in Cursor Settings; restart if they do not load (Output → Hooks). Pin a mission before starting Agent work — unpinned sessions get a legislate reminder only.
Substrate lifecycle: After npm install @jeger-ai/opengantry@latest, run gantry upgrade → review .gitagent/.upgrade-tmp/ → Planner-commit the upgrade mission YAML → gantry upgrade --apply --mission …. MCP: gxt_upgrade_plan / gxt_upgrade_apply.
Headless:
gantry runtime exec --mission .gitagent/missions/MSN-0001.<slug>.yaml -- cursor agent "<task>"
Claude Code
- Context injection: Minimal
CLAUDE.mdpointing atAGENTS.md,RULES.md,MANIFEST.json(keep under ~200 lines). - Session bootstrap (shell wrapper — no project hooks):
scripts/gxt-pin-mission.sh .gitagent/missions/MSN-0001.<slug>.yaml
scripts/gxt-shell-agent.sh claude .gitagent/missions/MSN-0001.<slug>.yaml
gantry runtime exec --mission .gitagent/missions/MSN-0001.<slug>.yaml -- claude "<task>"
- Enforcement: Advisory in interactive session; process-boundary when wrapped with
runtime execorgxt-shell-agent.sh. - Gotcha: Claude Code does not execute project hook directories — use the shell wrapper. Link canonical files — do not copy full RULES into
CLAUDE.md.
OpenAI Codex CLI
- Context injection: Root
AGENTS.md(loaded automatically aftergantry init). Optional.codex/config.tomlfor project defaults (sandbox, approval policy). Do not duplicate RULES/MANIFEST — link viaAGENTS.md. - Session bootstrap (shell wrapper — no project hooks):
scripts/gxt-pin-mission.sh .gitagent/missions/MSN-0001.<slug>.yaml
scripts/gxt-shell-agent.sh codex .gitagent/missions/MSN-0001.<slug>.yaml
# headless / CI:
gantry runtime exec --mission .gitagent/missions/MSN-0001.<slug>.yaml -- codex exec "<task>"
- Enforcement: Advisory in interactive TUI/IDE extension; process-boundary when wrapped with
runtime execorgxt-shell-agent.sh. Codex’s own sandbox is separate from GXT TMVC. - Gotcha: Codex CLI does not scan project hook folders. Codex sandbox/approval settings govern Codex — not GXT forbidden zones.
OpenCode
- Context injection: Repo-root
AGENTS.md(native aftergantry init); optional:
{ "instructions": ["AGENTS.md", ".gitagent/planner/RULES.md"] }
- Session bootstrap (shell wrapper — no project hooks):
scripts/gxt-pin-mission.sh .gitagent/missions/MSN-0001.<slug>.yaml
scripts/gxt-shell-agent.sh opencode .gitagent/missions/MSN-0001.<slug>.yaml
- Enforcement: Advisory;
opencode.jsonpermissions are separate from GXT TMVC. - Gotcha: OpenCode does not execute project hook directories. OpenCode prefers
AGENTS.mdoverCLAUDE.mdwhen both exist.
JetBrains Junie
- Context injection:
.junie/AGENTS.md(same bullets as rootAGENTS.md). - Session bootstrap: IDE terminal →
source scripts/gxt-runtime-env.sh <mission>. - Enforcement: Advisory (guidelines); no process trap for in-IDE edits.
- Gotcha: Use
.junie/AGENTS.md, not generic AI Assistant project rules, for Junie-specific loading.
Google Antigravity
- Context injection: Root
AGENTS.md; optional.agent/rules/gxt.mdwithalways_onpointing at canonical files. - Session bootstrap:
source scripts/gxt-runtime-env.sh <mission>organtry runtime exec … -- <command>. - Enforcement: Advisory for Editor/Manager views; process-boundary for wrapped CLI runs.
- Gotcha: Rules load order includes
GEMINI.md→AGENTS.md→.agent/rules/— keep GXT pointers inAGENTS.md.
Cline
- Context injection:
.clinerules/gxt.md; rootAGENTS.mdappears in Rules panel. - Session bootstrap: VS Code terminal →
source scripts/gxt-runtime-env.sh <mission>. - Enforcement: Advisory; toggle rules in Cline panel without deleting files.
- Gotcha: Cline also reads
.cursorruleslegacy paths — prefer.clinerules/gxt.mdfor GXT-specific policy.
Aider
- Context injection:
.aider.conf.yml:
read:
- AGENTS.md
- .gitagent/planner/RULES.md
- .gitagent/foreman/MANIFEST.json
- Session bootstrap:
gantry runtime exec --mission .gitagent/missions/MSN-0001.<slug>.yaml -- aider --message "<task>"
- Enforcement: Process-boundary when wrapped — strongest TMVC trap among common IDE-adjacent tools.
- Gotcha: Run from repo root;
read:paths resolve from CWD.
OpenHands
- Context injection:
.openhands/microagents/gxt.mdpointing at canonical GXT files. - Session bootstrap:
source scripts/gxt-runtime-env.sh <mission>then run OpenHands against the repo. - Enforcement: Advisory for in-IDE edits; process-boundary when wrapped with
runtime exec. - Gotcha: Keep microagent prose minimal — link
AGENTS.md, do not duplicate RULES.
Troubleshooting
| Symptom | Meaning | Fix |
|---|---|---|
NO_MSN_COMMITS on push | Mission changed but never Planner-stamped | git commit -m "[MSN-NNNN] …" modifying the mission file; set GANTRY_PLANNER_EMAILS |
| Pre-push OK, full verify fails trace | Legislative handoff succeeded; execution incomplete | Remote executor fills EXECUTOR_LOG.md; align trace_rows; re-run full verify |
PLANNER_IDENTITY_UNCONFIGURED | Missing Planner allowlist | export GANTRY_PLANNER_EMAILS="$(git config user.email)" |
| Full verify fails after execution | Corrupt trace or gate failure | Fix quotes in EXECUTOR_LOG.md or gate command output |
Mission git-proof details: .gitagent/missions/README.md.
Adopter bootstrap: docs/ADOPTION.md. Runtime contract: .gitagent/planner/RUNTIME.md.