A wrapper that lets any shell-capable orchestrator delegate bounded,
mechanical work to Antigravity (agy) and act
as reviewer.
Raw agy -p "..." calls fail in repeatable ways: they exit 0 having written
nothing, write a generator script instead of the answer, accept a model name
they don't have and silently substitute another, burn a whole batch queue
against an exhausted quota, stall on headless permission prompts, and edit
files the plan never named. agy-delegate turns each of those into a
detected, named, non-zero exit.
| Guard | Failure it catches |
|---|---|
Master switch (agy-enabled) |
Delegation running when you meant it off |
Model validation against agy models |
A typo'd name silently replaced by a default |
| Quota block with recorded reset time | A batch queue burned against an open 429 window |
| Failure classification (quota, capacity, network, auth, permission) | Retrying errors that cannot succeed |
| Headless-denial detection on exit 0 | Auto-denied tool ending the run with nothing written |
--allow-web grant gate |
A web plan launched without read_url(*) or equivalent |
| Pre/post directory snapshot (mtime plus size) | Coverage you'd otherwise take from agy's self-report |
--expect-created / --expect-modified |
The summary being a report instead of an assertion |
--expect-words / --min-urls |
Wrong length or unchecked sources passing silently |
--protect <glob> |
agy tidying a state file the plan never named |
| Stray-script detection | agy writing a generator it cannot run, delivering nothing |
| Silent-partial retry (batches and single runs) | Exit 0 having written nothing |
| Timeout as exit 124 | A hung run retried in full instead of once or never |
file:line citation check |
Fabricated line numbers presented as evidence |
| Template-collapse heuristic | The same generic skeleton returned across many files |
--- verdict --- block |
One exit code blurring backend, files, and meaning |
doctor / stats |
Setup drift and delegation that costs more than it saves |
A non-zero exit means one of those is unclean. Every run appends a JSON line
to agy-runs.jsonl with orchestrator, model, byte accounting, backend exits,
and problems.
One limit no guard fixes: agy does not emit uncertainty. An explicitly-invited
"no answer" token comes back zero times across runs that include genuinely
ambiguous inputs. Never read its absence as confidence. See INCIDENT-LOG.md.
Needs Python 3.8+ (standard library only) and the agy CLI on PATH,
already authenticated — this wrapper never handles login, so run agy once
interactively first.
install -m 755 agy-delegate ~/.local/bin/agy-delegate # or anywhere on PATH
mkdir -p ~/.agents/agy-delegate
touch ~/.agents/agy-delegate/agy-enabled # master switch, off by defaultSet AGY_DELEGATE_DIR to move state elsewhere. Older installs used
~/.claude/; agy-delegate doctor flags the legacy flag and tells you how
to migrate. Private working notes stay out of the repo (see .gitignore).
Three defaults are examples, not yours. DEFAULT_PROTECTED names generic agent
files (MEMORY.md, AGENTS.md, CLAUDE.md, .claude/*) — add whatever in
your project should never be silently edited. TIERS maps default and
simple to Gemini Flash tiers; run agy models for what your account
reaches. DEFAULT_WEB_GRANTS is read_url(*); add MCP fetch grants with
--web-grant if your setup uses them.
agy-delegate run PLAN.md --add-dir ./scratch --expect-created 8 --expect-modified 0
agy-delegate doctor
agy-delegate stats --last 20--dry-run prints the resolved agy command without running it. AGY.md
has the full flag reference and the rules for what's worth delegating.
TESTING.md has the acceptance procedure; run it after changing the wrapper,
upgrading agy, or editing a tier.
The coverage summary is a starting point for verification, not a substitute. Read the files a run touched against the plan and the source before anything delegated reaches a deliverable.
MIT — see LICENSE.