Antigravity CLI reads AGENTS.md as it goes
Antigravity CLI (agy) reads AGENTS.md at the repository root and in every folder between a file it touches and the root, so Ultracite’s rules need no extra setup. There’s no Ultracite hook for it: the agent runs ultracite fix and ultracite check because the rules say to, and a command(npx ultracite) allow rule lets it do that without asking.
Antigravity CLI by GoogleChecked against Antigravity CLI 1.3.1
# Ultracite Code Standards
This project uses **Ultracite**, a zero-config preset that enforces strict code quality standards through automated formatting and linting.
## Quick Reference
- **Format code**: `npx ultracite fix`
- **Check for issues**: `npx ultracite check`
- **Diagnose setup**: `npx ultracite doctor`
Oxlint + Oxfmt (the underlying engine) provides robust linting and formatting. Most issues are automatically fixable.
…- 1
~/.gemini/AGENTS.mdYour rules for every project.~/.gemini/GEMINI.mdand the modular global rules load too. - 2
AGENTS.mdUltraciteAt the repository root, whereinitwrites Ultracite’s rules. AGEMINI.mdthere is read the same way. - 3
.agents/rules/*.mdModular rules, each with atriggerin its frontmatter that decides when it loads. - 4
src/**/AGENTS.mdWhen the agent reads or edits a file, it loads the rules in each folder between that file and the workspace root. - 5
~/.gemini/antigravity-cli/plugins/*/rules/Rules packaged with installed plugins activate automatically.
How Antigravity CLI reads the rules
Antigravity CLI combines every rule it finds, global and per directory, instead of picking one; when instructions conflict, the more specific directory wins. AGENTS.md needs no frontmatter and is always on for its directory.
- Per-file limit
- 24,000 bytes per rule file, after includes; anything past that is cut. Ultracite’s rules are about 5 KB.
- Total budget
- Global and always-on rules share 20,000 tokens. Over that, the largest files become pointers the agent reads on demand.
- Always on
AGENTS.mdandGEMINI.mdtake no frontmatter and stay active for their whole directory.- Includes
@[label](path)inlines another file before the size check; a bare@pathonly points the agent at it.- Global
~/.gemini/AGENTS.mdorGEMINI.md, plus modular rules in~/.gemini/config/rules/and~/.gemini/antigravity-cli/rules/.- Flat folder
- Only direct children of
.agents/rules/load. Nested folders need an entry in.agents/rules.json.
Allow ultracite once in your settings
The rules tell the agent to run ultracite fix and ultracite check with its run_command tool, and your permission rules decide whether it asks first. In a headless run (agy -p), a shell command that needs approval is skipped and the run still exits 0, so allow ultracite ahead of time.
{
"permissions": {
"allow": ["command(npx ultracite)"]
}
}- 01The agent writes a file with
write_to_file,replace_file_contentormulti_replace_file_content. - 02Following
AGENTS.md, it callsrun_commandwithnpx ultracite fixornpx ultracite check. - 03A
command(npx ultracite)allow rule lets it run without a prompt; without one, you’re asked, or a headless run skips it. - 04The agent reads the linter’s output and fixes what’s left.
Worth knowing about Antigravity CLI
Hooks run, but can’t report back
Antigravity CLI runs
PostToolUsehooks from.agents/hooks.json, matched against tool names such aswrite_to_file|replace_file_content|multi_replace_file_content. The documented output is an empty object, so there’s no documented way for a post-edit hook to tell the agent what’s left. Ultracite doesn’t set one up.Modular rules need a trigger
Files in
.agents/rules/need atriggerin their frontmatter:always_on,model_decision,globormanual. A missing or misspelled trigger drops the rule silently. Ultracite’s rules apply everywhere, so they stay inAGENTS.md.Headless runs for CI
agy -pexits 0 when it produces a response and non-zero when it can’t, and--output-format jsonaddsstatusanderrorfields for scripts. A denied tool doesn’t fail the run, so a CI job should read the stderr notices too.The Ultracite skill
Antigravity CLI loads workspace skills from
.agents/skills/and global ones from~/.gemini/antigravity-cli/skills/.initinstalls the Ultracite skill into.agents/skills/, so the CLI finds it.
Antigravity CLI questions, answered
- Does Antigravity CLI read AGENTS.md?
- Yes, with no setup. It reads
AGENTS.mdorGEMINI.mdat the repository root and in subdirectories, plus~/.gemini/AGENTS.mdfor every project, and combines them, with the more specific directory winning on conflicts. - Does Antigravity CLI support hooks?
- Yes:
PreToolUse,PostToolUse,PreInvocation,PostInvocationandStop, in.agents/hooks.jsonor~/.gemini/config/hooks.json, and/hookslists what’s loaded. Ultracite doesn’t configure them, because aPostToolUsehook has no documented way to hand lint results to the agent. - Why didn’t agy -p run the linter?
- In headless mode, a shell command that needs approval is soft-denied: the run carries on, exits 0 and prints a notice to stderr. Add
command(npx ultracite)topermissions.allowin~/.gemini/antigravity-cli/settings.json. - I used Ultracite with Gemini CLI. What changes?
- Nothing for the rules: Google’s migration guide says both CLIs read the same
GEMINI.mdandAGENTS.md, and Antigravity CLI doesn’t need acontext.fileNamesetting to findAGENTS.md. Workspace skills are the exception; move them from.gemini/skills/to.agents/skills/. - Is Ultracite’s AGENTS.md too big for Antigravity?
- No. Antigravity truncates a rule file past 24,000 bytes and gives global and always-on rules a shared 20,000-token budget; Ultracite’s rules are about 5 KB. Past the budget, the largest files turn into pointers the agent reads on demand.
Keep going
- AgentGemini CLIGoogle’s open-source terminal agent for Gemini models, now for paid API and enterprise users.
- AgentCodexOpenAI’s coding agent for the terminal, IDEs, the ChatGPT desktop app and cloud tasks.
- AgentJulesGoogle’s asynchronous agent that works on your repo in a cloud VM and opens pull requests.
- DocsAgent rulesWhat
initwrites for every agent, and how to keep it current.
Ship less slop
One command sets up your linter, formatter, editor and agents. Works with Oxlint, Biome and ESLint.