Custom-agy #
A couple of file editing efficiency plugins for Antigravity (agy) with an efficiency measurement script.
Description #
2 plugins, created by Gemini Neon after some back and forth with me.
file-ops #
Context-efficient file reading, targeted editing rules, AST-based structural refactoring, and an optional CLI output compression hook (plugins/file-ops/):
- Always-on rules (
rules/AGENTS.md): Guides the agent to locate target lines withrg -n/sgbefore callingread_filewith a boundedStartLine/EndLinewindow, reuse in-context reads, prefer minimal-anchoredit_filecalls over full-filewrite_fileoverwrites, and useast-grepfor bulk structural refactors. ast-grepskill (skills/ast-grep/SKILL.md): Model-invoked workflow forsgcovering CST inspection (--debug-query=cst), dry-run matching, rewrite diff previews,--update-all, metavariables ($VAR,$$$ARGS,$_,$$), andsg scan --inline-rules.- Optional
rtkhook (hooks.json+hooks/rtk-rewrite.py, disabled by default): APreToolUsehook onrun_commandthat rewrites supported CLI commands throughrtk rewriteto compress verbose terminal output. To enable it, set"enabled": trueinplugins/file-ops/hooks.json; setRTK_DISABLED=1to bypass it temporarily.
tilth #
Zero-index Tree-sitter code intelligence via the tilth MCP server (plugins/tilth/):
- MCP server (
mcp_config.json): Launchestilth --mcpvia a portableshlookup acrossPATH,$HOME/.cargo/bin/tilth,/opt/homebrew/bin/tilth, and/usr/local/bin/tilth, exposing 6 tools:tilth_read,tilth_search,tilth_grok,tilth_deps,tilth_list, andtilth_diff. - Always-on rules (
rules/AGENTS.md): Directs the agent to prefertilthtools for code navigation, outlines, callers, and blast-radius checks before falling back toread_file, while keeping nativeedit_file/write_fileandsgfor edits. - Hashline edit mode (optional): Defaults to read-only
--mcpso nativeedit_filestays conflict-free. To testtilth's hashline editing (tilth_write), change--mcpto--mcp --editinplugins/tilth/mcp_config.json.
Installation #
Prerequisites #
ast-grep(sg): e.g.brew install ast-greporcargo install ast-grep(used byfile-ops).tilth:cargo binstall tilthorcargo install tilth(used bytilth).rtk(optional): only needed if you enablertk-rewriteinplugins/file-ops/hooks.json.
Register with Antigravity #
-
Clone this repository:
git clone <repo-url> /path/to/customagy -
Point
~/.gemini/config/plugins.jsonat theplugins/directory (if the file already exists, add the object to itsentriesarray):{ "entries": [ { "path": "/path/to/customagy/plugins" } ] }
Both plugins are discovered globally from the next turn and can be toggled independently in Antigravity's Customizations UI (or filtered via "exclude" in plugins.json).
Measuring Efficiency #
scripts/measure_file_ops.py is a stdlib-only Python 3 script that scans ~/.gemini/antigravity/brain/*/.system_generated/logs/transcript_full.jsonl (falling back to transcript.jsonl) and outputs privacy-safe aggregate metrics: edit success rate, Target-echo / overwrite efficiency, read_file and same-file re-read volume, tokens and latency per successful edit, and schema break-even analysis. See benchmarks/baseline.md for an example baseline report.
Common Commands #
Capture a baseline snapshot:
python3 scripts/measure_file_ops.py \
--label baseline \
--json-out benchmarks/baseline.json \
--md-out benchmarks/baseline.md
Compare sessions after enabling a plugin or hook against the baseline:
python3 scripts/measure_file_ops.py \
--since 2026-11-29 \
--label after-tilth \
--compare benchmarks/baseline.json
Model break-even thresholds for custom per-turn schema/rule token sizes:
python3 scripts/measure_file_ops.py \
--schema-tokens 1000,2500,5000
Dry-run a PreToolUse hook script against historical tool calls before enabling it:
python3 scripts/measure_file_ops.py \
--hook-matcher 'run_command' \
--dry-run-hook './plugins/file-ops/hooks/rtk-rewrite.py'
Additional useful flags: --brain-dir, --until, --hook-limit, --hook-timeout, and --hook-samples.