Skip to content

About

A skill that helps an LLM keep its context lean working within large project repositories, managing its dependencies, tools and data.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lean-context

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.

Why sessions get expensive in Antigravity

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_file or search per turn instead of batching independent calls in parallel.
  • Blind file slicing: Repeated overlapping read_file calls on monolithic files instead of querying a symbol/call graph first.
  • Context bloat: Oversized AGENTS.md files full of facts instead of pointers, plus project-specific MCP servers pinned globally.

The ideas in one screen

  1. Symbol graph first. Query CodeGraph (codegraph_explore / codegraph_node or CLI) before opening files; gitignore .codegraph/.
  2. 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.
  3. The map checks itself. scripts/mapcheck.py flags files missing from PROJECT_MAP.md and stale rows; install it as a pre-commit --warn hook.
  4. Tiny always-loaded context. Keep AGENTS.md to a few KB of rules and pointers (templates/AGENTS_HYGIENE.md); keep STATUS.md <=40 lines for session handoffs and pre-/compact snapshots.
  5. Protect the KV cache. Use WaitMsBeforeAsync: 10000 for fast commands, never poll manage_task, batch independent tools in parallel, and /compact at feature boundaries (~120k–150k context).
  6. Scope MCPs. Keep global mcp_config.json minimal; pin project-specific MCP servers in per-project plugin configs.

Install

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 commit

Python 3.8+, standard library only (Windows, Linux, macOS).

Files

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

Companion tools

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

Author

Franciszek Godrecki (penkaty).

About

A skill that helps an LLM keep its context lean working within large project repositories, managing its dependencies, tools and data.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages