Skip to content

feat(antigravity): auto-chain disposable child orchestrators and thin root supervisor - #129

Merged
futuregerald merged 1 commit into
mainfrom
feat/thin-supervisor-auto-child-orchestrator
Nov 18, 2026
Merged

futuregerald merged 1 commit into
mainfrom
feat/thin-supervisor-auto-child-orchestrator

Conversation

@futuregerald

Copy link
Copy Markdown
Owner

Summary

  • Enforce a true Thin Root Supervisor (<60k–120k target, <=2 files / <=3 calls per turn inline) across GEMINI.md, GEMINI-BASE.md, start, start-small, and antigravity-orchestration by delegating >=3-file diagnostic/architecture Q&A to bounded read-only subagents (<=15 cited lines) and spawning a disposable TypeName: "self" Child Orchestrator (350k window) for Phases 3½–12 after Phase 3 user plan approval.
  • Update baton-pass, peer-pipeline-swarm, and autonomous_breaker.py so 310k (Baton Warn), 350k (Baton Block), and 350k (Subagent Context Cap) auto-chain in the same chat via invoke_subagent(TypeName="self", Model="inherit") and BATON_CONTINUE: <path>, reserving manual new-chat Ingest ... prompts strictly for estimate >= 450000 (BATON_HARD_CEILING_TOKENS, near the 512k compaction ceiling) or explicit user requests.
  • Add a +25k ACTIVE_CONTEXT.md / /tmp/*.md cleanup unlock (plus swarm{action: "status"|"kill"} and context .md read exemptions) for is_subagent Child Orchestrators in autonomous_breaker.py so swarm-owning Child Orchestrators can safely git fetch share commits and kill child workers before returning BATON_CONTINUE.

Background

Context

Antigravity sessions run on a 512k compaction window with circuit-breaker thresholds at 310k (BATON_WARN_TOKENS), 350k (BATON_BLOCK_TOKENS), and 350k (SUBAGENT_TOKEN_CAP). Previously, start and start-small ran Phases 3½–12 coordination directly inside the Root chat, and baton-pass / autonomous_breaker.py instructed Root at 310k/350k to stop and ask the user to open a new chat tab (Session B).

The problem

  1. Reading 3+ codebase files inline during multi-turn Q&A and coordinating multiple /start runs directly inside Root pushed Root past 310k tokens across multi-feature chats.
  2. When 310k or 350k fired, autonomous_breaker.py and baton-pass punted continuation to the user with a manual Ingest ... prompt—even though writing ACTIVE_CONTEXT.md already unlocks +50k tokens, enough to spawn a fresh TypeName: "self" Child Orchestrator in the same chat.
  3. If a TypeName: "self" Child Orchestrator ran a peer-pipeline-swarm and hit SUBAGENT_TOKEN_CAP (350k), is_subagent previously lacked a +25k ACTIVE_CONTEXT.md cleanup unlock and swarm{action: "status"|"kill"} exemption to anchor share-workspace commits before tearing down child workers.

The fix

  • Breaker Hook (autonomous_breaker.py):
    • Grants is_subagent helpers a one-time, non-ratcheting +25k token cleanup unlock upon writing ACTIVE_CONTEXT.md or temp/brain .md files (while rejecting symlinked parent directories and docs/plans/*.md as unlock triggers) and exempts swarm{action: "status"|"kill"}, board/task cleanup tools, and ACTIVE_CONTEXT.md / /tmp/*.md reads so Child Orchestrators can anchor share SHAs, kill workers, and return BATON_CONTINUE: <path>.
    • Updates Root Baton Warn (310k–350k) and Baton Block (350k–450k) coaching messages to write ACTIVE_CONTEXT.md (+50k unlock), clean up Root-owned swarm workers, and immediately spawn invoke_subagent(TypeName="self", Model="inherit") in the same chat.
    • Introduces BATON_HARD_CEILING_TOKENS (450000 default): once Root reaches >=450k, blocks new subagent/swarm spawns even when unlocked and coaches Root to finalize ACTIVE_CONTEXT.md and emit the manual Ingest ... prompt for a fresh chat before hitting 512k compaction.
  • Rules & Skills (GEMINI.md, GEMINI-BASE.md, baton-pass, start, start-small, antigravity-orchestration, peer-pipeline-swarm):
    • Route >=3-file Q&A to bounded read-only subagents returning <=15 cited lines.
    • Delegate Phases 3½–12 after Phase 3 user approval on every non-trivial (>=3-file) /start and /start-small run to a disposable TypeName: "self" Child Orchestrator (350k window) returning <=15 lines, with automatic BATON_CONTINUE chaining in the same chat.

Test plan

  • Added 3 unit test suites in internal/catalog/antigravity/hooks/test_autonomous_breaker.py (772 total Python specs passing):
    • test_subagent_child_orchestrator_active_context_unlocks_plus_25k_and_exempts_swarm_kill_and_context_reads (verifies +25k unlock, git fetch cleanup, non-ratcheting cap past +25k, and swarm status/kill + context .md read exemptions)
    • test_root_310k_warn_and_350k_block_coach_same_chat_self_child_orchestrator (verifies 310k warn and 350k block coaching + post-unlock same-chat invoke_subagent allow)
    • test_root_450k_hard_ceiling_coaches_manual_new_chat_and_blocks_subagent_spawn_even_when_unlocked (verifies >=450k manual fresh-chat fallback and spawn block even after ACTIVE_CONTEXT.md unlock)
  • Extended TestAntigravityThinSupervisorPlannerAndManifestCatalogInvariants in internal/catalog/catalog_test.go to enforce BATON_HARD_CEILING_TOKENS, BATON_CONTINUE, and Child Orchestrator invariants across embedded catalog files (go test -count=1 ./... passing)
  • Verified YAML skill frontmatter validation (test_quick_validate.py) and zero personal/org/path leaks via scripts/sync-antigravity-from-local.sh

Rollback plan

Revert this PR (and run skill-installer update on local Antigravity installations).

@futuregerald
futuregerald merged commit 0180585 into main Nov 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant