Skip to content

feat(cli): carry a session-start context to the model on Antigravity - #1353

Merged
blafourcade merged 1 commit into
nextfrom
feat/session-start-context-antigravity
Nov 25, 2026
Merged

blafourcade merged 1 commit into
nextfrom
feat/session-start-context-antigravity

Conversation

@blafourcade

Copy link
Copy Markdown
Contributor

🎯 What & why

Antigravity (agy) hands the model an injectSteps system message returned by a SessionStart hook. The adapter now answers SessionStart with it, so a session-start context reaches the model on Antigravity. Partial work for #1348.

🛠️ How it works

  • cli/assets/hooks-runtime/host-antigravity.cjs: answer prints {"injectSteps":[{"systemMessage":{"systemMessage":"<text>"}}]} at SessionStart, for levels 1 and 2 alike. It prints nothing on empty text, still continues the turn at Stop, and still prints nothing at PostToolUse.
  • PreInvocation is not wired. It fires before every model call, and the docs warn that repeated injections fill the context.
  • Probe (agy 1.5.17, throwaway project, project .agents/hooks.json only): a SessionStart hook printing a passphrase made the model repeat it; the same shape at PreInvocation did too. Docs: https://antigravity.google/docs/hooks. A hook command runs from .agents, so a relative path from the project root did not fire on the first attempt. The probe sessions were deleted.
  • Fixture antigravity-SessionStart.json gains a sample answer, captured verbatim from the probe run (paths and session id scrubbed). hook-payloads/README.md gains one line on it.
  • No golden moved.

🧪 How to verify

  • cd cli && pnpm exec vitest run tests/contexts/tools/hooks-runtime.integration.test.ts
  • Red line before the change: AssertionError: expected [] to have a length of 1 but got +0.
  • Mutation proof, each restored afterwards:
    • Removing the SessionStart guard turns prints nothing for a PostToolUse answer and prints nothing for an answer to no event red.
    • Dropping the empty-text check turns prints nothing for the text "" red.
    • Flattening the injectSteps shape turns the captured-run match and the level 1 and level 2 cases red.
  • Gates on 583868bf1: make validate exit 0; pre-commit --all-files exit 0 (first run hit the known scripts-tests flake, rerun passed); pre-push exit 0, 9907 passed, 1 expected fail, 15 skipped; pnpm build exit 0, 879.4 KB of the 897 KB budget (+0.2 KB, no raise).

⚠️ Heads-up

Limits, not verified:

  • No shipped SessionStart hook answers with text today, so no end-to-end run through a framework hook was made. The wrapper passes non-empty stdout through and adds {} only when stdout is empty.
  • PostToolUse and PostInvocation injection are not probed.
  • The docs say injected steps stay in the conversation. Whether a resumed session injects twice was not probed.
  • docs/COMPATIBILITY.md and the 08-hook-generate host tables are not edited; another PR owns them.

🔗 Linked issue

Refs #1348

✅ I certify

  • I DO CERTIFY I READ EACH LINE OF THE PULL REQUEST BECAUSE I AM A SOFTWARE ENGINEER, NOT A AI PUPPY.

🤖 Generated with Claude Code

agy hands the model an injectSteps system message returned by a SessionStart
hook (probed: the model repeated the injected passphrase). The adapter now
answers SessionStart with it; PostToolUse stays unanswered.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@blafourcade
blafourcade marked this pull request as ready for review November 25, 2026 18:58
@blafourcade
blafourcade requested a review from a team as a code owner November 25, 2026 18:58
@blafourcade
blafourcade merged commit e2d1eb8 into next Nov 25, 2026
36 of 38 checks passed
@blafourcade
blafourcade deleted the feat/session-start-context-antigravity branch November 25, 2026 18:58
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