Use Antigravity as a subagent in Claude Code / Codex / Kimi Code.
English | 简体中文
sub-agy turns the Antigravity CLI (agy) into an asynchronous code-execution backend for your planning agent. The planner writes a plan and reviews results; the heavy lifting runs in the background on your Gemini quota, inside an isolated git worktree, and comes back as a structured acceptance report.
flowchart LR
P["Plan<br/>Claude Code · Codex · Kimi Code"] -- "sub-agy run" --> S["Detached supervisor<br/>(FIFO slot queue)"]
S --> W["agy · Gemini<br/>isolated git worktree"]
W -- "--json-schema" --> R["result.json<br/>structured acceptance"]
R -- "watcher wakes the agent" --> V{Review}
V -- pass --> M["git merge agy/<job-id><br/>(always human)"]
V -- fail --> F["feedback<br/>same conversation, next round"] --> S
- Async dispatch, background execution —
runreturns ajob_idimmediately; a detached supervisor keepsagygoing even after the caller exits. Jobs beyondmax_concurrentqueue up FIFO. - git worktree isolation — every job runs on its own branch (
agy/<job-id>) in its own worktree; your main branch stays clean. - Structured acceptance contract —
--json-schemamakesagyreportsummary/files_changed/tests_passedand more. - Proactive completion notification — one background watcher per job: whichever job finishes first gets reviewed first. A Stop-hook safety net (
sub-agy pending) catches anything left unharvested. - Automatic feedback loop — failed acceptance triggers
feedback, which keeps the conversation and starts the next repair round. - 0-token quota check —
quotareads the Antigravity 5h/weekly windows for free.
- agy CLI ≥ 1.1.8, logged in once interactively (run
agyonce to complete OAuth) - Python ≥ 3.11
- uv (recommended) or pipx
- git (needed for worktree isolation; non-git projects fall back to in-place execution)
- Claude Code, Codex desktop, or Kimi Code CLI (at least one)
The CLI is required — plugins alone do not work. The Claude Code / Codex / Kimi Code plugins are thin orchestration layers: every plugin command shells out to the
sub-agybinary and fails with exit 127 if it is missing. If you prefer not to install it globally, the only fallback is cloning the repo and settingexport SUB_AGY_HOME=<repo path>— the plugins then run it from source viauv run --project, which still requires uv.Since v0.1.1,
/subagy:doctordetects a missing CLI and offers to install it for you (one confirmation, thenuv tool install). Theagybinary and its OAuth login always remain manual.
uv tool install git+https://github.com/Besty0728/sub-agyVerify:
sub-agy doctor/plugin marketplace add Besty0728/sub-agy
/plugin install subagy@subagy
/reload-plugins
No clone needed — add a git marketplace to ~/.codex/config.toml:
[marketplaces.subagy]
source_type = "git"
source = "https://github.com/Besty0728/sub-agy"Restart Codex and install subagy from the plugin panel.
For offline/development use, a local marketplace works too:
[marketplaces.subagy]
source_type = "local"
source = "<path to clone>"/plugins install https://github.com/Besty0728/sub-agy
/reload
Commands are namespaced: /subagy:dispatch, /subagy:harvest, etc. After dispatch, each job is watched by a background subagy-watcher subagent that returns to the main agent the moment the job finishes. For local development use /plugins install <path to clone> (the plugin is copied to $KIMI_CODE_HOME/plugins/managed/; reinstall after editing sources).
sub-agy runs fine with zero configuration. To change defaults, create ~/.config/sub-agy/config.toml (override the location with the SUB_AGY_CONFIG environment variable). Every key is optional; the values below are the built-in defaults:
default_model = "gemini-3.7-flash" # model slug passed to agy
default_effort = "medium" # low | medium | high
default_timeout = "30m" # per-job timeout, Go duration (Ns/Nm/Nh)
max_concurrent = 3 # jobs running at once per project; extras queue FIFO
max_retries = 1 # extra attempts after a timeout
queue_timeout = "2h" # max wait for a run slot before the job errors
agy_bin = "agy" # agy binary name or absolute pathA missing file simply means the defaults above. Per-job CLI flags (--model / --effort / --timeout) override the config.
cat > plan.md <<'EOF'
---
scope: [src/**/*.py]
acceptance:
- pytest tests/ -q passes
constraints:
- no new dependencies
---
Add type annotations to the login function and fix the type errors this exposes.
EOFIn Claude Code (the main agent defaults to gemini-3.7-flash + medium effort, auto-raising to high for complex plans and lowering to low for trivial ones):
/subagy:dispatch plan.md
Or straight from the CLI (with explicit --effort / --model if you like):
sub-agy run --plan plan.md --cwd ./my-projectWhen a watcher wakes the main agent, it reviews the result following the /subagy:harvest rules: accept, fail, or send it back for another round.
Once acceptance passes, merge the execution branch yourself:
git merge agy/<job-id>sub-agy quota --onelineSample output (currently localized in Chinese):
Gemini 模型:5h 限额剩余 99.8%(32分钟后重置),7d 限额剩余 99.8%(6天11小时后重置);Claude/GPT 模型:7d 限额剩余 100.0%
| Command | Description |
|---|---|
sub-agy run --plan <plan.md> |
Dispatch a plan, returns job_id immediately |
sub-agy status [--all] |
Show job status, queue position, tokens, elapsed |
sub-agy result <job-id> |
Harvest the structured result of a finished job |
sub-agy feedback <job-id> "..." |
Send feedback, start the next repair round |
sub-agy watch <job-id> |
Block until the job reaches a terminal state |
sub-agy cancel <job-id> |
Cancel a job |
sub-agy list |
List jobs in the current project |
sub-agy pending [--under <dir>] |
List finished-but-unharvested jobs (data source for the Stop-hook safety net) |
sub-agy cleanup <job-id> |
Remove the job worktree and branch |
sub-agy quota [--oneline] [--pretty] |
Query Antigravity quota (0 tokens) |
sub-agy doctor |
Environment diagnostics |
- Official-CLI process orchestration only — sub-agy never touches model APIs and never stores or proxies API keys.
- Fully autonomous + worktree isolation + human merge —
agyalways starts with--dangerously-skip-permissionsfor unattended execution; the safety boundary is the isolated git worktree, the plan's scope/constraints, and the fact thatgit mergeis always triggered by a human. - Automatic feedback, manual merge —
feedbackre-runs with full context preserved;git merge agy/<job-id>is always yours to run.