/delegate
Ordinary implementation work may be handed to the Gemini CLI on
gemini-3.1-flash-lite and reviewed afterwards. The loop is fixed.
For exploration, running builds or test you can also use gemini or
Sonet 5 sub-agent.
Running it
Clean tree first. git status --short must be empty, on main. What
git diff shows afterwards is then exactly what the delegate wrote.
Run it headless, task in a file to avoid quoting problems, and always
with the workspace-trust variable exported:
GEMINI_CLI_TRUST_WORKSPACE=true gemini -m gemini-3.1-flash-lite \
--approval-mode yolo -p "$(cat task.txt)"
yolo is required - a headless run has nobody to answer a prompt, and
auto_edit stalls on the first shell command.
The env var is not optional. Without it the CLI first downgrades the mode
("Approval mode overridden to "default" because the current folder is not
trusted") and then refuses to run at all: "Gemini CLI is not running in a
trusted directory". Every headless run in an untrusted checkout dies there,
before reading the task. --skip-trust is the flag-shaped equivalent;
trusting the folder interactively does not carry into a headless run.
The workspace is the only writable root. An output path outside the repo
- a session scratchpad under
/tmp, for instance - is refused with "Path not
in workspace" and the delegate quietly retargets the write to
~/.gemini/tmp/<project>/<name>, reporting success. So either name an output
file inside the repo, or read the result back from that fallback directory
instead of concluding the run produced nothing.
Re-index from the dashboard, so the review reads a graph
that matches the tree rather than the one from before the edit.
What the task file must always carry
Do not commit or run any writing git command; the repository's language and
encoding policy; edits must pass pre-commit run --files <paths>; an
acceptance test the delegate has to check itself; and the name of any tree that
is off limits.
Give the delegate the facts already established rather than letting it
rediscover them - the free tier throttles by requests per minute, and every
wasted turn costs a minute of backoff.
Two failure modes seen repeatedly, worth pre-empting in the prompt:
- A test that measured nothing. Where the thing being changed runs from a
container image, the source is baked in by
COPY, so the edit does nothing
until the image is rebuilt - in this repository, a change under
graphify/src/ needs make -C graphify build. A delegate that skips the
rebuild is measuring the previous version.
- A substituted acceptance criterion. Asked for nodes in the graph, it
answers with a file count, a log line, or a promise that they "should
persist". Ask for the node list, and query it yourself regardless.
Reviewing what it wrote
Opus 5 reviews, and it reviews the actual changes - never the delegate's own
summary, which is a claim rather than a result.
- Take the real changes from
git diff: the files, classes, defines, functions
and parameters that actually moved.
- For every changed entity, query the graph (
search_code_nodes,
get_code_graph_neighbors) for everything attached to it - callers, imports,
includes, templates, data keys, whatever relations that language has - and
check whether the change breaks any of them. Re-index first, or the sweep
reads the tree as it was before the edit.
- That impact sweep is exploration, so it runs on Sonnet 5. Sonnet gathers
evidence; it does not rule.
- The verdict - accept, fix on top, or revert - is Opus 5's alone, taken on the
evidence gathered.
Then fix on top and commit with the commit skill. Local commit only; pushing
is the user's call.
Recap
Say what was handed over, inside the recap the enggraph skill defines -
counts, not adjectives.
- Delegations - one line each: which model ran, what it was asked for,
what came back.
- Verdict - accepted, fixed on top, or reverted, and on which evidence.
The delegate's own summary is a claim, so cite the diff or the graph.
1---2name: delegate3description: Hand ordinary implementation work to the Gemini CLI headless, then review what it actually wrote against the code graph. Use before launching gemini or judging its output.4---56# /delegate78Ordinary implementation work may be handed to the Gemini CLI on9`gemini-3.1-flash-lite` and reviewed afterwards. The loop is fixed.1011For exploration, running builds or test you can also use gemini or12Sonet 5 sub-agent.1314## Running it15161. **Clean tree first.** `git status --short` must be empty, on `main`. What17 `git diff` shows afterwards is then exactly what the delegate wrote.182. **Run it headless**, task in a file to avoid quoting problems, and always19 with the workspace-trust variable exported:2021 ```bash22 GEMINI_CLI_TRUST_WORKSPACE=true gemini -m gemini-3.1-flash-lite \23 --approval-mode yolo -p "$(cat task.txt)"24 ```2526 `yolo` is required - a headless run has nobody to answer a prompt, and27 `auto_edit` stalls on the first shell command.28293. **The env var is not optional.** Without it the CLI first downgrades the mode30 ("Approval mode overridden to \"default\" because the current folder is not31 trusted") and then refuses to run at all: "Gemini CLI is not running in a32 trusted directory". Every headless run in an untrusted checkout dies there,33 before reading the task. `--skip-trust` is the flag-shaped equivalent;34 trusting the folder interactively does not carry into a headless run.354. **The workspace is the only writable root.** An output path outside the repo36 - a session scratchpad under `/tmp`, for instance - is refused with "Path not37 in workspace" and the delegate quietly retargets the write to38 `~/.gemini/tmp/<project>/<name>`, reporting success. So either name an output39 file inside the repo, or read the result back from that fallback directory40 instead of concluding the run produced nothing.415. **Re-index** from the dashboard, so the review reads a graph42 that matches the tree rather than the one from before the edit.4344## What the task file must always carry4546Do not commit or run any writing git command; the repository's language and47encoding policy; edits must pass `pre-commit run --files <paths>`; an48acceptance test the delegate has to check itself; and the name of any tree that49is off limits.5051Give the delegate the facts already established rather than letting it52rediscover them - the free tier throttles by requests per minute, and every53wasted turn costs a minute of backoff.5455Two failure modes seen repeatedly, worth pre-empting in the prompt:5657- **A test that measured nothing.** Where the thing being changed runs from a58 container image, the source is baked in by `COPY`, so the edit does nothing59 until the image is rebuilt - in this repository, a change under60 `graphify/src/` needs `make -C graphify build`. A delegate that skips the61 rebuild is measuring the previous version.62- **A substituted acceptance criterion.** Asked for nodes in the graph, it63 answers with a file count, a log line, or a promise that they "should64 persist". Ask for the node list, and query it yourself regardless.6566## Reviewing what it wrote6768Opus 5 reviews, and it reviews the **actual changes** - never the delegate's own69summary, which is a claim rather than a result.70711. Take the real changes from `git diff`: the files, classes, defines, functions72 and parameters that actually moved.732. For every changed entity, query the graph (`search_code_nodes`,74 `get_code_graph_neighbors`) for everything attached to it - callers, imports,75 includes, templates, data keys, whatever relations that language has - and76 check whether the change breaks any of them. Re-index first, or the sweep77 reads the tree as it was before the edit.783. That impact sweep is exploration, so it runs on Sonnet 5. Sonnet gathers79 evidence; it does not rule.804. The verdict - accept, fix on top, or revert - is Opus 5's alone, taken on the81 evidence gathered.8283Then fix on top and commit with the `commit` skill. Local commit only; pushing84is the user's call.8586## Recap8788Say what was handed over, inside the recap the `enggraph` skill defines -89counts, not adjectives.9091- **Delegations** - one line each: which model ran, what it was asked for,92 what came back.93- **Verdict** - accepted, fixed on top, or reverted, and on which evidence.94 The delegate's own summary is a claim, so cite the diff or the graph.