Keep Antigravity coding sessions fast, cheap, and KV-cache-friendly. A standalone Antigravity skill, one small stdlib-only check script, and three lean templates for large or multi-repo projects.
Originally built for Claude Code while developing RBR-RTX (5 repositories, ~300 docs/tools), and rewritten around Antigravity's native execution model.
Antigravity already spills long run_command output to disk and lazy-loads MCP tool schemas. The remaining token and latency leaks are structural:
- KV-cache busts: Polling background tasks in a loop, unnecessary async wakeups on fast commands, or bouncing between Planner and Execution on tiny follow-ups.
- Serial turns: Issuing one
read_fileor search per turn instead of batching independent calls in parallel. - Blind file slicing: Repeated overlapping
read_filecalls on monolithic files instead of querying a symbol/call graph first. - Context bloat: Oversized
AGENTS.mdfiles full of facts instead of pointers, plus project-specific MCP servers pinned globally.
- Symbol graph first. Query CodeGraph (
codegraph_explore/codegraph_nodeor CLI) before opening files; gitignore.codegraph/. - Index non-code & multi-repo layout. Use
PROJECT_MAP.md(pointers only, never facts) on large/doc-heavy workspaces; skip on small single-purpose repos. - The map checks itself.
scripts/mapcheck.pyflags files missing fromPROJECT_MAP.mdand stale rows; install it as a pre-commit--warnhook. - Tiny always-loaded context. Keep
AGENTS.mdto a few KB of rules and pointers (templates/AGENTS_HYGIENE.md); keepSTATUS.md<=40 lines for session handoffs and pre-/compactsnapshots. - Protect the KV cache. Use
WaitMsBeforeAsync: 10000for fast commands, never pollmanage_task, batch independent tools in parallel, and/compactat feature boundaries (~120k–150k context). - Scope MCPs. Keep global
mcp_config.jsonminimal; pin project-specific MCP servers in per-project plugin configs.
Drop this repo into <project>/.agents/skills/lean-context/ (or inside a plugin's skills/ folder), then ask the agent:
"Use the lean-context skill to audit this project."
If you only want the daily rules without the audit skill or map script, copy templates/AGENTS_HYGIENE.md into your project's AGENTS.md.
python .agents/skills/lean-context/scripts/mapcheck.py # check PROJECT_MAP.md
python .agents/skills/lean-context/scripts/mapcheck.py --install-hook # warn on every commitPython 3.8+, standard library only (Windows, Linux, macOS).
| File | What |
|---|---|
SKILL.md |
Antigravity skill: principles, KV-cache hygiene, and audit checklist |
scripts/mapcheck.py |
PROJECT_MAP.md completeness check and pre-commit hook installer |
templates/AGENTS_HYGIENE.md |
Copy-pasteable AGENTS.md snippet for CodeGraph, sync/batching, and /compact hygiene |
templates/PROJECT_MAP.md |
Pointer-only map skeleton with "how to read cheaply" header |
templates/STATUS.md |
40-line session handoff / pre-/compact status template |
| Repo | Layer | When to add |
|---|---|---|
colbymchenry/codegraph |
Symbol & call-graph index | Default for any coding repo (replaces blind read_file slicing) |
rtk-ai/rtk |
Shell CLI output proxy | Noisy test suites, git diff, or build logs that flood turns |
oraios/serena |
LSP semantic navigation/edits | Heavy cross-file refactors across polyglot codebases |
mksglu/context-mode |
SQLite FTS5 output sandbox | Workflows that repeatedly query massive logs or API dumps |
Franciszek Godrecki (penkaty).