Uh oh!
There was an error while loading. Please reload this page.
feat(ENG-593): defender-antigravity - sibling plugin for Google Antigravity CLI - #26
Conversation
Ports the Claude Code StackOne Defender plugin to Antigravity CLI as a PostToolUse hook. Reuses the existing Node daemon + ONNX model verbatim over the same `~/.claude/defender.sock`; the only divergences are stdin parsing (Antigravity's PostToolHookArgs proto3-JSON) and the stdout envelope (`inject_steps[].system_message` instead of Claude Code's `hookSpecificOutput.additionalContext`). Same silent-cue UX, same SKILL.md contract, same 12-fixture regression test. Validated on a live `agy` install: `agy plugin validate`/`install`/ `uninstall` all clean; `npm test` 12/12 green. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
This PR adds a new stackone-defender-antigravity plugin that ports the existing StackOne Defender “PostToolUse” scanning flow to Google’s Antigravity CLI (agy), reusing the same local daemon/socket and classifier configuration while adapting stdin/stdout envelopes to Antigravity’s hook protocol.
Changes:
- Introduces an Antigravity-specific
scan-tool-result.mjshook that parsesPostToolHookArgs-style stdin and emitsinject_stepson flagged scans. - Adds a detached Unix-socket daemon (
defender-daemon.mjs) plus shared config (defender-daemon.config.json) and the StackOne Defender skill file. - Adds a 12-fixture regression suite (benign/realistic/tricky) and plugin packaging files (
plugin.json,hooks/hooks.json, npm metadata/lockfile).
Reviewed changes
Copilot reviewed 22 out of 23 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| plugins/security/stackone-defender-antigravity/.gitignore | Ignores local node_modules/ for the plugin. |
| plugins/security/stackone-defender-antigravity/hooks/hooks.json | Registers the PostToolUse hook for Antigravity. |
| plugins/security/stackone-defender-antigravity/package-lock.json | Locks npm dependency graph for the plugin. |
| plugins/security/stackone-defender-antigravity/package.json | Defines plugin npm metadata and dependencies. |
| plugins/security/stackone-defender-antigravity/plugin.json | Declares Antigravity plugin manifest (name/version/description). |
| plugins/security/stackone-defender-antigravity/README.md | Documents install/behavior/config for the Antigravity variant. |
| plugins/security/stackone-defender-antigravity/scripts/defender-daemon.config.json | Provides default PromptDefense/threshold/model configuration. |
| plugins/security/stackone-defender-antigravity/scripts/defender-daemon.mjs | Implements long-running local scanning daemon over UDS. |
| plugins/security/stackone-defender-antigravity/scripts/scan-tool-result.mjs | Implements Antigravity hook client (stdin parse, daemon IPC, inject_steps output). |
| plugins/security/stackone-defender-antigravity/skills/stackone-defender/SKILL.md | Adds agent behavioral guidance when Defender flags tool output. |
| plugins/security/stackone-defender-antigravity/tests/qa-fixtures.test.mjs | Adds regression test runner for fixture corpus vs live classifier. |
| plugins/security/stackone-defender-antigravity/tests/fixtures/benign/git-log.txt | Benign fixture: git log shaped output. |
| plugins/security/stackone-defender-antigravity/tests/fixtures/benign/hiking-trail.md | Benign fixture: prose content. |
| plugins/security/stackone-defender-antigravity/tests/fixtures/benign/lms-training-modules.txt | Benign fixture: LMS/training listing content. |
| plugins/security/stackone-defender-antigravity/tests/fixtures/benign/sourdough-recipe.md | Benign fixture: prose content. |
| plugins/security/stackone-defender-antigravity/tests/fixtures/realistic/document-summary.md | Realistic fixture: injected DAN-style directive in summary. |
| plugins/security/stackone-defender-antigravity/tests/fixtures/realistic/slack-thread.txt | Realistic fixture: “system override” prompt injection in chat thread. |
| plugins/security/stackone-defender-antigravity/tests/fixtures/realistic/support-ticket.txt | Realistic fixture: “SYSTEM NOTE TO ASSISTANT” injection in ticket. |
| plugins/security/stackone-defender-antigravity/tests/fixtures/tricky/api-response-listing.json | Tricky fixture: structured JSON listing likely to FP. |
| plugins/security/stackone-defender-antigravity/tests/fixtures/tricky/employee-policy.md | Tricky fixture: policy text containing “disregard” phrasing. |
| plugins/security/stackone-defender-antigravity/tests/fixtures/tricky/incident-postmortem.md | Tricky fixture: incident writeup quoting injection language. |
| plugins/security/stackone-defender-antigravity/tests/fixtures/tricky/release-notes-2.5.md | Tricky fixture: security-focused release notes. |
| plugins/security/stackone-defender-antigravity/tests/fixtures/tricky/research-note-on-injection.md | Tricky fixture: research prose quoting canonical injection strings. |
Files not reviewed (1)
- plugins/security/stackone-defender-antigravity/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- README: drop broken `../../../../stackone-redteaming/...` link, keep the benchmark figure inline - SKILL.md: make platform-neutral (frontmatter + `additionalContext` wording now name both Claude Code and Antigravity transports) - scan-tool-result.mjs (both plugins): fix socket.setTimeout misuse. Node's net.Socket.setTimeout is an idle timer that also applies post-connect, so the 1500ms setting was aborting any scan that took >1.5s without producing data — narrowing the budget below SCAN_TIMEOUT_MS. Apply it only pre-connect; clear (`setTimeout(0)`) on the connect event so the outer 5s scan budget governs. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
0 issues found across 4 files (changes from recent commits).
Requires human review: This PR adds an entirely new security plugin with a daemon, hooks, and ONNX model inference totaling 2,699 lines; despite the AI review finding no issues, the blast radius and risk of breaking core functionality or the shared daemon are too high for unsupervised auto-approval.
Re-trigger cubic
There was a problem hiding this comment.
2 issues found across 24 files
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Re-trigger cubic
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- "No network calls" → "no network egress during scanning" + note that first-run install fetches deps from npm - Troubleshooting `cd $CLAUDE_PLUGIN_ROOT` step replaced with the actual install path (host-specific) and a note that the env var is only defined at hook-runtime, not in the user's shell Applied to both plugins. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
0 issues found across 2 files (changes from recent commits).
Auto-approved: This PR adds an isolated new plugin for Antigravity CLI that ports the existing Claude Code Defender plugin, reusing the same daemon and test fixtures; the changes are additive, well-tested, and confined to a new directory with no modifications to existing code, so the risk of breakage is very low.
Re-trigger cubic
Uh oh!
There was an error while loading. Please reload this page.
…sters the hook Critical regression in the original sibling-plugin PR (#26): hooks.json was placed in a `hooks/` subdirectory, which Antigravity's `agy plugin install` silently skips with "hooks: skipped (not found)". The PostToolUse hook was never wired up. Plugin installs as components=["skills"] only — the SKILL file is registered but the scan hook never fires on tool results. Confirmed by reading the agy binary's customization layer (looks for `hooks.json` at the plugin root) and validated empirically: - Before: agy plugin list → components: ["skills"] - After: agy plugin list → components: ["skills", "hooks"] - Install log changes from "hooks: skipped (not found)" to "✔ hooks : 1 processed" Tested transcript from ~/.gemini/antigravity-cli/brain/<session>/.../ transcript.jsonl on a known-injection fixture: zero inject_steps events were emitted into the model's turn before this fix. With the fix, the daemon will actually be queried on every tool result and emit the cue + SKILL contract where appropriate. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Summary
plugins/security/stackone-defender-antigravity/that ports the Claude Code StackOne Defender to Google's Antigravity CLI (agy)~/.claude/defender.socksocket — if both plugins are installed, they share one in-memory classifierPostToolUse, inject a one-line system message into the agent's next turn on high-risk findings; silent-pass otherwiseWhat's different from the Claude Code plugin
.claude-plugin/plugin.jsonplugin.json{tool_name, tool_output, …}PostToolHookArgsproto3-JSON (toolName,toolResult, …) — accepts snake_case fallback{hookSpecificOutput: {hookEventName, additionalContext}}{inject_steps: [{system_message: {text}}]}.*(Antigravity's tool surface is less stable)The daemon, config, SKILL.md, and the 12-fixture regression suite are byte-identical to the Claude Code plugin.
Why now
Our Gemini 2.5 Flash read-exfil probe measured baseline 25.8% attack success halved to 12.5% by the exact Defender hint this plugin emits — the largest absolute risk reduction we've measured. That's the model class Antigravity ships on.
Validation
agy plugin validate→ ok (skills: 1, hooks: 1)agy plugin install/uninstall→ cleannpm test→ 12/12 fixtures green (benign / realistic / tricky buckets, same corpus as sibling plugin)node --checkTest plan
agysession:agy plugin install plugins/security/stackone-defender-antigravityagyand confirm theinject_stepspayload lands in the model's next turn.Known limitations
agybinary's protobuf tags, not from a live capture. The hook accepts both proto3-camelCase and snake_case defensively. If the live shape diverges, capture the stdin via a wrapper script and open an issue.~/.claude/(historical path, shared with the Claude Code plugin). Consider migrating to a neutral path in a future major version.Summary by cubic
Add
stackone-defender-antigravity, aPostToolUsesecurity plugin for Google’s Antigravity CLI that scans tool results on-device and injects a one-line system cue on high‑risk findings. Also fixes a socket timeout bug in the client scan path and clarifies docs about offline scanning; addresses ENG-593.New Features
plugins/security/stackone-defender-antigravity/for Antigravity CLI (agy)PostToolUse.PostToolHookArgsproto3‑JSON (camelCase or snake_case). Stdout:inject_steps[].system_message.~/.claude/defender.sock; single in-memory classifier across plugins.node --test, plus README and SKILL.Bug Fixes
socket.setTimeoutonly pre-connect and clear onconnectso the outer scan budget governs; applied to both the Antigravity plugin and the sibling Claude Code plugin.$CLAUDE_PLUGIN_ROOTshell usage and add host‑specific install path; keep SKILL wording platform‑neutral and mention both Claude Code and Antigravity transports; remove a broken README link.Written for commit 65c92c2. Summary will update on new commits.