Repository navigation
feat(antigravity): adopt 512k context window and 350k baton/breaker thresholds - #128
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Carbon,Argon,Hydrogen) andgemini-3.8-flashcompaction window from256kto512kacross the Antigravity catalog, global/projectGEMINI.mdtemplates, subagent prompts, andtracks.yaml.autonomous_breaker.pycontext thresholds so sessions do not hard-block until350ktokens (BATON_WARN_TOKENS = 310000,BATON_BLOCK_TOKENS = 350000for Coordinator and Swarm Worker caps, andSUBAGENT_TOKEN_CAP = 350000with<320kpeak-context guidance), and updatessession_metrics.py's zero-compaction fallback to match (310000/350000).internal/catalog/catalog_test.goand updates all Python unit/replay suites and Go-tags=e2elive hook sandbox scenarios to verify the310k/350kboundaries.Background
Context
Antigravity's PreToolUse circuit-breaker hook (
internal/catalog/antigravity/hooks/autonomous_breaker.py) partitions token estimates into three budgets before model auto-compaction degrades reasoning:BATON_WARN_TOKENS/BATON_BLOCK_TOKENS): Issues a one-time warning ahead of compaction (with a+10kbuffer on authorized autonomous runs before normal commands warn) and blocks non-exempt calls atBATON_BLOCK_TOKENSuntilACTIVE_CONTEXT.mdis written (+50kunlock window).BATON_BLOCK_TOKENS): Exempt from the early Coordinator warning, blocking atBATON_BLOCK_TOKENSwith a+25k/tmp/*.mdunlock soshare-workspace workers can commit WIP and postSHARE_ROOT+SHA.SUBAGENT_TOKEN_CAP): Capsinvoke_subagentplannerandimplementerhelpers, allowing only wrap-up.mdwrites andsend_messageonce reached.The problem
Gemini's maximum context window doubled from
256kto512k, leaving the previous205kwarn,235kCoordinator/worker block, and200ksubagent cap prematurely interrupting multi-fileplannertraces,implementerTDD runs, and Coordinator orchestration well below350ktokens.The fix
autonomous_breaker.py,session_metrics.py): Updated default thresholds toBATON_WARN_TOKENS = 310000(40krunway before block;320kauthorized+10kcommand threshold),BATON_BLOCK_TOKENS = 350000(leaving>110kheadroom even after the+50kACTIVE_CONTEXT.mdhandoff unlock inside the512kwindow), andSUBAGENT_TOKEN_CAP = 350000(with<320kpeak-context prompt guidance). Retained the Stage-3~120kWarm Root wrap-up proxy and the 1-phase-per-implementer reuse rule, since re-billing warm subagent histories across phases remains a token-cost concern independent of the512kceiling.tracks.yaml: Updatedbaton-pass,antigravity-orchestration,peer-pipeline-swarm,future-model-router(SKILL.md+references/model-map.md),subagent-driven-development,lifecycle,planner.md,implementer.md,GEMINI.md,templates/GEMINI-BASE.md,antigravity/README.md, andtracks.yamlto reflect512k/310k/350k.catalog_test.go): Added an embeddedFSwalk across allantigravity/**/*.{md,py}files andtracks.yamlasserting zero stale256k,205k,235k,200kcap, or<185kstrings and verifying the new310000/350000defaults inautonomous_breaker.py.Test plan
PYTHONDONTWRITEBYTECODE=1 pytest -p no:cacheprovider -q internal/catalog/antigravity/hooks—131 passed(covering<310kallow,[310k, 320k)authorized delegation/SYSTEM_MESSAGEwarn vs normalrun_commandallow,[320k, 350k)+10kwarn,>=350kCoordinator/Swarm/Subagent blocks,360kWindows backslashACTIVE_CONTEXT.mdunlock,310krefresh_flooranti-ratchet,replay_breakerhelper block accounting, andsession_metricszero-compaction310k/350kfallback)HOME=$(mktemp -d) go test -race ./...— all 9 Go packages passing (including newcatalog_test.gostale-threshold walk and zero-comment hook invariants)HOME=$(mktemp -d) go test -tags=e2e ./e2e -run '^TestHostDesktopAppsCompatibilitySandbox$' -v— liveskill-installer+autonomous-breaker.shsandbox verification passing (315k >= 310kwarn,355k >= 350kblock ++50kunlock, and355k >= 350ksubagent cap)./scripts/sync-antigravity-from-local.sh,test -z "$(gofmt -l .)", andgo vet ./...— clean (exit 0)Rollback plan
Revert this PR and re-run
skill-installer --target=antigravity --global --force --yes(or setBATON_WARN_TOKENS=205000 BATON_BLOCK_TOKENS=235000 SUBAGENT_TOKEN_CAP=200000in the environment for immediate rollback without reinstalling).