Mneme HQ + Google Antigravity
A native pre-tool adapter enforces Mneme’s architectural decision corpus inside Google Antigravity. It translates Antigravity’s file-mutation tools into Mneme’s canonical gate and returns deny/no-opinion verdicts over the PreToolUse hook transport — verified live against Antigravity IDE 2.8.1.
Status: shipped, merged, tested
The adapter merged on August 24, 2026 (PR #316) and lives at mneme/integrations/antigravity/adapter.py. It carries 31 focused tests covering translation, gate verdicts, fail-open semantics, modes, no-opinion paths, invocation contract, and identity pins. Full suite at merge: 780 passed / 5 skipped versus an attached-equivalent baseline of 749/5 — +31 new tests, zero regressions.
This page describes a shipped integration. Earlier versions of this page described a conceptual “works alongside” flow. That flow no longer exists — what ships today is a concrete adapter with a tested runtime contract.
How it works: a translation layer, nothing more
The adapter implements no governance semantics of its own. Materialization, introduced-delta selection (ADR-018), memory discovery, mode resolution, verdict parsing, and reason formatting are imported from the existing Claude Code hook module — the same enforcement path, behind an Antigravity-specific normalizer:
Antigravity PreToolUse payload ↓ Normalizer: write_to_file / replace_file_content / multi_replace_file_content ↓ Canonical Write / Edit / MultiEdit ToolEvent ↓ Introduced-content materialization + mneme check ↓ {"decision": "deny", "reason": ...} or {} (no opinion)
| Antigravity tool | Canonical gate | Translated arguments |
|---|---|---|
| write_to_file | Write | TargetFile, CodeContent |
| replace_file_content | Edit | TargetFile, TargetContent → ReplacementContent |
| multi_replace_file_content | MultiEdit | ReplacementChunks[].TargetContent → .ReplacementContent |
Read-only tools never reach the gate. If mneme check changes, this adapter follows automatically — it is not a second enforcement implementation.
Setup
Create .agents/hooks.json inside a governed project (one with a committed .mneme/project_memory.json):
{
"mneme": {
"PreToolUse": [
{
"matcher": "write_to_file|replace_file_content|multi_replace_file_content",
"hooks": [
{
"type": "command",
"command": "python -m mneme.integrations.antigravity",
"timeout": 30
}
]
}
]
}
}
- The command needs
mneme-hqimportable — pointPYTHONPATHat your install or invoke an installed console wrapper. - Enforcement mode follows the shared resolution:
MNEME_HOOK_MODEenvironment variable, then"strict". - No
DecisionRetrieveror MemoryStore dependency exists in the adapter; retrieval remains a separate layer (AST-pinned by identity tests, mirroring the Agent SDK convention).
Allow/deny semantics: deny is the only active decision
Antigravity’s response contract differs from Claude Code’s in one important way: emitting "allow" auto-grants the tool call, bypassing the normal permission flow. The adapter therefore never emits it:
| Mneme outcome | Adapter output |
|---|---|
| Trusted PASS / SKIP | {} — no opinion; Antigravity’s own permission flow stays in charge |
| Trusted WARN/FAIL, strict mode | {"decision": "deny", "reason": ...} with Mneme’s violation report |
| Trusted WARN/FAIL, warn mode | {}; violation report on stderr — never blocks |
| Unparseable verdict / operational failure / incomplete evaluation | {} (fail open), reason on stderr |
Every code path emits exactly one parseable JSON object to stdout. Antigravity fails closed on hook output it cannot parse — malformed output blocks the tool call — so the adapter must always emit well-formed JSON even when it has no opinion.
Verified runtime contract (Antigravity IDE 2.8.1)
hooks.jsonlives in.agents/;PreToolUsefires before execution with the full proposed content- stdin JSON envelope:
{toolCall: {name, args}, workspacePaths, ...}→ stdout JSON decision - A live deny prevented a filesystem mutation (target verified absent); a compliant mutation landed unchanged
- Malformed hook output blocks the call — verified live, which is why every adapter path emits valid JSON
- Layer separation confirmed: in PASS cases Antigravity’s own permission layer permitted the same tool/workspace; only Mneme blocked in the FAIL case
Limitations
- Tested version: Antigravity IDE 2.8.1. Newer IDE releases may change the hooks envelope and require re-validation.
- Covered tools: the three file-mutation tools above. Shell commands are not covered — their mutations cannot be reconstructed reliably enough to check deterministically.
- No guidance surface: the adapter does no context injection and does not retrieve decisions into the model’s context. Retrieval/enforcement separation is deliberate.
- No MCP, no SDK integration, no generic adapter framework — out of scope by design in PR #316.
Evidence
- PR #316 — implementation, response policy, and test record
- docs/integrations/antigravity.md — architecture and configuration reference
- tests/integrations/antigravity/ — gate, parser, and identity test suites
FAQ
Is the Mneme Antigravity integration shipped?
Which Antigravity tools does Mneme gate?
write_to_file (translated to Write), replace_file_content (Edit), and multi_replace_file_content (MultiEdit). Read-only tools never reach the gate. Shell commands are not covered.Does Mneme ever emit an allow decision to Antigravity?
{} (no opinion) so Antigravity’s own permission layer stays in charge; only trusted WARN/FAIL in strict mode produces a deny.Which Antigravity versions are verified?
hooks.json in .agents/, PreToolUse firing before execution with the full proposed content, and a live deny preventing a filesystem mutation.Govern Antigravity sessions at the pre-tool boundary
Open-source. Repo-native. One decision corpus enforced through Antigravity’s native PreToolUse transport — with the same deterministic engine behind the Claude Code hook and CI gates.