Skip to content

feat(antigravity): add planner subagent, turn-1 manifest, and 200k subagent cap - #127

Merged
futuregerald merged 1 commit into
mainfrom
feat/thin-supervisor-and-skill-injection
Nov 16, 2026
Merged

futuregerald merged 1 commit into
mainfrom
feat/thin-supervisor-and-skill-injection

Conversation

@futuregerald

Copy link
Copy Markdown
Owner

Summary

  • Offload 3+-file Phase 2–3 codebase tracing and planning in Antigravity to a dedicated planner subagent (antigravity-subagents v1.3.0) and define a Stage-3 ~120k-token (plus observable multi-stream / 5+-caller) hybrid Phase 10–12 wrap-up rule so the Root Supervisor stays lean across multi-task sessions.
  • Extend build_subagent_context.py pre-code with --touch and --skills-dir to deterministically emit canonical absolute paths for matching active v4 catalog skills, explicit <skill>/SKILL.md references, and in-root product/brief/design docs under ## Turn-1 Parallel Read Manifest without pasting skill bodies into /tmp/subagent-context-*.md.
  • Refactor autonomous_breaker.py and breaker_rules.py into an exhaustive 3-way BATON partition (is_swarm_worker 235k / is_subagent SUBAGENT_TOKEN_CAP=200000 / Coordinator 205k–235k) that recognizes <SYSTEM_MESSAGE> swarm board assignments pre-post_message and enforces leaf-symlink / ..-free .md wrap-up writes while preserving symlinked dotfile HOME ancestors.

Background

Context

In Antigravity multi-phase sessions, Root Supervisor context grows primarily during wide Phase 2–3 file tracing and late Phase 10–12 blast-radius checks, while invoke_subagent helpers previously lacked a pre-compaction token guard (if not is_subagent: skipped BATON entirely) and had to discover domain skills ad hoc rather than receiving exact resolved SKILL.md paths in their Turn-1 read batch.

The problem

  1. Root context growth on 3+-file planning and late wrap-up: Running wide caller traces and untouched-caller audits inline in Root consumes context budget needed for multi-stream supervision and user-voice synthesis.
  2. Ad-hoc skill & uncommitted doc discovery in isolated worktrees: Implementers in workspace: "share" or isolated worktrees could miss relevant domain skills or uncommitted Phase 0/0½ product/design docs unless pointed at canonical absolute paths on Turn 1.
  3. Uncapped invoke_subagent helpers vs. SYSTEM_MESSAGE swarm workers: Simply enabling a 200k BATON cap on is_subagent would misclassify swarm workers before their first post_message (when transcripts contain only <SYSTEM_MESSAGE> board assignments and zero USER_INPUT steps), while ancestor symlink checks on handoff paths would deadlock users whose ~/.gemini dotfiles live behind a symlink.

The fix

  1. Stage-1 planner subagent & Stage-3 ~120k hybrid wrap-up: Added agents/planner.md (tools: [read_file, write_file, edit_file, run_command], forbidden from mutating source/test files or guessing UX ambiguity — returns ### Open Questions for User, writes git-ignored docs/plans/<slug>.md + /tmp/plan-*.md, and runs build_subagent_context.py pre-code). Documented lean (<~120k) vs. warm (>=~120k or observable multi-stream/>=25-turn/5+-caller proxies) Phase 10–12 wrap-up routing across Antigravity guides and lifecycle skills.
  2. Deterministic ## Turn-1 Parallel Read Manifest: build_subagent_context.py pre-code maps --slice, --touch, and safe in-root PLAN.md paths to active v4 catalog skills (excluding bare prose mentions of orchestration/meta skills unless written <skill>/SKILL.md) plus in-root product/brief/design docs (capping docs/decisions/*.md to 4), resolving paths with Path.resolve(strict=True) for macOS /private/var compatibility and wiring manifest batch reads across Antigravity, Claude, OpenCode, and shared implementer prompts.
  3. Anchored 3-way BATON partition: breaker_rules.classify_swarm_steps detects anchored <SYSTEM_MESSAGE> [swarm] / [board] / board-assignment headers (stopping at the first content= token to prevent prompt spoofing) when not has_user_input, feeding an exhaustive if is_swarm_worker (235k) / elif is_subagent (SUBAGENT_TOKEN_CAP=200000) / else Coordinator (205k/235k) partition with _is_safe_leaf_md_path validation.

Pre-existing fixes

  • Tightened _is_h2_handoff_path and _is_temp_or_brain_md_path in autonomous_breaker.py to require .md suffixes, reject .. segments and leaf symlinks (closing src/handoff.py and /tmp/ctx.md -> src/secret.go), and verify resolved temp-root containment while still permitting symlinked HOME / ~/.gemini dotfile ancestors.
  • Updated test_baton_helper_agent_exempt (test_autonomous_breaker.py) from an 800k-byte (~200k-token) fixture to test 195k helper exemption from the 150k Coordinator warning alongside 205k enforcement of Subagent Context Cap.

Test plan

  • Python unit & regression tests (make test-python — 768 passed):
    • test_build_subagent_context.py: autouse HOME isolation fixture; --touch + --skills-dir macOS /private/var resolution; Go/TSX/SQL/SKILL.md/Datadog skill mapping; docs/prd.md, docs/decisions/*.md cap, docs/point-of-view/*.md, and direction-approved.md discovery; bare orchestration slug exclusion vs. explicit <skill>/SKILL.md inclusion; symlink escape and .. --touch rejection; post-code manifest preservation; zero tokenize.COMMENT tokens.
    • test_breaker_rules.py, test_autonomous_breaker.py, test_replay_breaker.py: real <SYSTEM_MESSAGE> envelope swarm worker classification pre-post_message (205k allowed, 240k hits 235k worker cap); double-content= prompt-spoof resistance on Coordinator and invoke_subagent; SUBAGENT_TOKEN_CAP=200000 (199k allowed; 205k denies read_file, run_command, src/handoff.py, .., and leaf symlinks while allowing non-symlink PLAN.md, docs/plans/*.md, /tmp/*.md, brain .md, and send_message); symlinked HOME dotfile ACTIVE_CONTEXT.md unlock; STRIKES wrap-up .md edit exemption.
  • Go catalog, installer & live sandbox E2E suites (go test -race ./... & go test -tags=e2e ./e2e):
    • Added TestAntigravityThinSupervisorPlannerAndManifestCatalogInvariants in internal/catalog/catalog_test.go (plugin 1.3.0, planner.md frontmatter/grants, cross-harness implementer.md manifest wiring, zero comments, zero harness/retired-v3 leaks).
    • Updated e2e/e2e_test.go to verify all 7 installed antigravity-subagents agent files and exercise live >=200k subagent autonomous-breaker.sh deny/allow behavior in the sandbox.
  • Two-way live sync check: Installed via skill-installer -t antigravity -g --track opinionated --backup --force -y, ran ./scripts/sync-antigravity-from-local.sh (including PII scrubber), and verified git diff --exit-code (0).

Rollback plan

Revert this PR and re-run skill-installer -t antigravity -g --track opinionated --force -y (or skill-installer restore -t antigravity -g -y).

…bagent cap

- Extend build_subagent_context.py pre-code with --touch and --skills-dir
  to emit canonical macOS-safe absolute paths for active v4 catalog skills
  (plus explicit <skill>/SKILL.md references) and in-root product/brief/
  design docs under ## Turn-1 Parallel Read Manifest without pasting skill
  bodies or matching bare prose orchestration slugs.
- Extend breaker_rules.classify_swarm_steps to recognize anchored
  Antigravity <SYSTEM_MESSAGE> swarm board assignments pre-post_message
  when no USER_INPUT exists, and refactor autonomous_breaker.py into an
  exhaustive 3-way BATON partition (is_swarm_worker 235k / is_subagent
  SUBAGENT_TOKEN_CAP=200000 / Coordinator 205k-235k) with dotdot and
  leaf-symlink guards that preserve symlinked dotfile HOME ancestors.
- Ship agents/planner.md in antigravity-subagents v1.3.0 (all 7 agents
  verified in E2E), wire Turn-1 Parallel Read Manifest across Antigravity,
  Claude, OpenCode, and shared implementers, and document Stage-1 planner
  dispatch (3+ files) and Stage-3 ~120k hybrid wrap-up.
@futuregerald
futuregerald merged commit 5686c3d into main Nov 16, 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