Update Agent Docs (Antigravity Edition)
Purpose
Refresh the repository's agent-facing documentation so future sessions can find the right modules, packages, files, workflows, and tests without rediscovering the project from scratch.
Keep AGENTS.md (or GEMINI.md / .agents/rules/) as the token-efficient routing index. Put longer detail under docs/agent/ and make AGENTS.md point agents to those files on demand.
Required Workflow
Resolve the writable docs target.
- Run the bundled resolver:
<skill-dir>/scripts/resolve_agent_docs_target.py <repo-root>. - Set
agent_docs_target = result.target_path; every later instruction to editAGENTS.mdmeans edit this resolved target when it differs fromresult.agents_path. - If
AGENTS.mdis a symlink, edit the resolved target. - If
AGENTS.mdor its symlink target is a single include directive such as@CLAUDE.md, edit the included file. - If
result.requires_confirmationis true, get explicit user confirmation usingask_questionbefore editing because the resolved target is outside the repository. - If no
AGENTS.mdorGEMINI.mdexists, create<repo-root>/AGENTS.md.
- Run the bundled resolver:
Read existing instructions before changing them.
- Read the resolved target and any existing
docs/agent/files usingview_file. - Preserve durable user preferences, repo-specific rules, and tool-routing rules.
- Treat any recorded library, dependency, framework, runtime, or toolchain version as stale-prone guidance to replace with source-of-truth file routing.
- If the target already has substantial content, use a refresh stance: identify missing, stale, bloated, and duplicated guidance before rewriting.
- Do not replace user-authored guidance wholesale unless it is demonstrably stale or the user asked to start fresh.
- Read the resolved target and any existing
Use repository-aware retrieval.
- Use Antigravity search tools:
find_by_name,grep_search,list_dir.
- Use Antigravity search tools:
Launch multiple agents in parallel.
- When project discovery requires broad inspection, launch independent subagents using Antigravity's
invoke_subagent:- Dispatch subagents with
TypeName: 'research'and distinct roles:Role: 'Architecture Mapper',Role: 'Workflow & Test Mapper',Role: 'Frontend & UI Mapper',Role: 'Backend & Data Mapper',Role: 'Infra & CI Mapper',Role: 'Doc Gap Reviewer'. - Prompts should follow subagent-prompts.md.
- Dispatch subagents with
- If subagent delegation is unavailable, perform sequential discovery locally.
- When project discovery requires broad inspection, launch independent subagents using Antigravity's
Explore beyond current docs.
- Use discovery-checklist.md to cover manifests, source roots, entrypoints, scripts, tests, config, CI, deploy, generated assets, migrations, docs, and package boundaries.
- Compare findings against the existing
agent_docs_target; add missing categories even if previous docs did not mention them. - Ask the user (via
ask_question) only for practices the repo cannot reveal: non-obvious team conventions, required local services, branch/PR etiquette, test quirks, or changed workflows.
Write token-efficient docs.
- Use doc-structure.md.
- Before keeping a line in
agent_docs_target, test it: would removing this cause a future agent to make a likely mistake? If not, cut or move it todocs/agent/. - Keep
agent_docs_targetconcise but specific: mention exact folders/files to read for each common task. - Put detailed maps, workflow notes, and inventories in
docs/agent/. - Prefer "When working on X, read Y first" guidance over prose summaries.
- Do not write specific library or tool versions in docs; point agents to manifest/lockfile sources of truth.
- Apply edits with
replace_file_contentorwrite_to_file.
Verify.
- Re-read changed docs for broken links, stale paths, duplicated sections, and unclear routing.
- Run
git diff --checkviarun_command.
Ask about commit and push.
- After verification, ask whether the user wants to commit and push to
originusingask_question(or chat fallback). - If the user agrees, follow commit-push-policy.md.
- Do not add
Co-Worker,Co-Authored-By, or similar attribution trailers to the commit message.
- After verification, ask whether the user wants to commit and push to
Output Expectations
AGENTS.md(orGEMINI.md) is updated or created.docs/agent/contains detailed supporting docs when detail would makeAGENTS.mdtoo large.- The final response summarizes changed files, verification performed, and asks about commit/push when changes are complete.