Adds first-class integration with Google's Antigravity IDE (https://antigravity.google/) as a third sibling to the existing Claude Code and Codex hook integrations. Strictly additive — no existing files in main are restructured. What ships ---------- * `.antigravity-plugin/` — verified-minimal plugin package: * `plugin.json` with `{"name": "mempalace"}` (no fabricated fields) * `mcp_config.json` registering the `mempalace-mcp` stdio server * `hooks.json.tmpl` templated with `__PLUGIN_DIR__` substitution * `skills/mempalace/SKILL.md` (real file — no symlinks) * `hooks/antigravity/`: * `lib/common.sh` — shared bash 3.2.57-compatible helpers with sentinel-guarded camelCase JSON parser, antigravity_*-namespaced state files, every existing kill switch, `MEMPAL_SAVE_INTERVAL >= 1` floor (no /0), and fail-open emitters * `mempal_save_hook_antigravity.sh` — Stop event handler: increments per-conversation counter, defers when fullyIdle=False or terminationReason=error, validates transcriptPath against `..` traversal, spawns `mempalace mine --mode convos` in a detached subprocess with a per-conversation pending marker, ALWAYS emits `{}` (never `{"decision":"continue"}` — that would force an infinite agent loop) * `mempal_wake_hook_antigravity.sh` — PreInvocation handler gated to invocationNum==1 with an atomic mkdir loop guard, runs `mempalace wake-up` with a 500ms hard timeout, emits verbatim output as `{"injectSteps":[{"ephemeralMessage":"..."}]}` or `{}` on any failure * `install.sh` — idempotent installer with cmp-gated copies, `__PLUGIN_DIR__` substitution, relative path absolutization, `--dry-run`, and basename-guarded `--uninstall` (refuses to wipe a directory whose basename isn't `mempalace`) * `INVESTIGATION.md` — verbatim quotes + URLs + dates from the five official Antigravity doc pages, recording every surface shipped and every surface deliberately omitted (PreCompact equivalent, slash-commands, rules/, plugin permissions field — the latter is third-party fabrication) * `STDIN_SHAPE.md` — exact stdin/stdout contract per event with worked examples * `README.md` — local hook docs + troubleshooting * `examples/antigravity/{hooks.json,mcp_config.json,README.md}` — standalone configs for users who don't want the full installer * `website/guide/antigravity.md` + sidebar entry — VitePress guide * Updates to `README.md`, `CHANGELOG.md` (Unreleased), `hooks/README.md` Tests (56 new, all passing) --------------------------- * `tests/test_antigravity_plugin_manifest.py` (11 tests) — schema contract on the in-repo `.antigravity-plugin/` directory, including guards against re-introducing the fabricated `permissions` field and against any symlink leak. * `tests/test_antigravity_hooks_shell.py` (31 tests) — invokes the bash hooks via subprocess with synthetic camelCase stdin, asserts `{}` on every failure path, kill-switch coverage (env vars + config.json + palace nuke), divide-by-zero floor, transcript traversal rejection, namespacing, wing inference, and the hard refusal to ever emit `decision=continue` from the Stop hook. * `tests/test_antigravity_hooks_install.py` (14 tests) — `--dry-run` side-effect-free, real install layout, executable bits preserved, byte-identical idempotent re-runs (md5 + filecmp), basename-match uninstall safety, refusal when plugin.json is missing or names a different plugin, relative path absolutization. Skipped on Windows. Verification ------------ * `uv run pytest tests/ --ignore=tests/benchmarks -v` → 2314 passed, 3 skipped (Windows), 1 unrelated warning * `uv run ruff check .` → all checks passed * `uv run ruff format --check .` → 139 files already formatted * `bash -n` clean on common.sh, both hook scripts, install.sh * Local install at `~/.gemini/config/plugins/mempalace/` verified end- to-end: layout correct, paths absolutized in hooks.json, both hooks fire with realistic camelCase JSON in <1s, wing inference picks `wing_mempalace` from workspacePaths[0], state files all `antigravity_*`-namespaced, second `install.sh` run produces byte-identical output (md5 snapshots match), uninstall removes only the mempalace plugin and leaves all 6 sibling Google plugins untouched. Constraints honoured -------------------- bash 3.2.57 (no mapfile / readarray / declare -A / `${var^^}`), verbatim guarantee on all wake injections, hooks <500ms / startup injection <100ms target (kill-switch path returns in <1.5s in CI), zero new runtime dependencies, no telemetry, no external API, strictly additive (existing Claude/Codex hooks unchanged). Refs: hooks/antigravity/INVESTIGATION.md for the full audit. |
||
|---|---|---|
| .. | ||
| README.md | ||
| hooks.json | ||
| mcp_config.json | ||
README.md
MemPalace — Antigravity examples
Two standalone configs for users who don't want to use the
hooks/antigravity/install.sh installer.
Files
| File | Purpose |
|---|---|
hooks.json |
Standalone hooks.json registering the Stop and PreInvocation hooks. |
mcp_config.json |
Standalone MCP entry registering the mempalace-mcp stdio server. |
Wire up hooks.json
The example uses placeholder absolute paths (/ABSOLUTE/PATH/TO/mempalace/...).
You must rewrite both command fields to the actual absolute paths to
the hook scripts in your cloned repo, or to whichever location holds
them. Antigravity will not resolve relative paths reliably.
Then drop the file at one of:
~/.gemini/config/hooks.json(global, applies to every workspace)<workspace>/.agents/hooks.json(workspace-scoped)
Restart Antigravity to pick the file up.
If you'd rather have the paths absolutized automatically, run the installer:
bash hooks/antigravity/install.sh
That writes a fully rendered hooks.json to
~/.gemini/config/plugins/mempalace/hooks.json.
Wire up mcp_config.json
The example registers the mempalace-mcp stdio server. Two options:
Option A — merge into the user-level Antigravity MCP config
Antigravity's user-level MCP config lives at
~/.gemini/antigravity/mcp_config.json. Merge the mcpServers.mempalace
entry from this example into that file, then restart Antigravity.
Option B — drop into a plugin directory
If you've created a custom plugin folder (per the Antigravity plugins docs),
copy this mcp_config.json directly into the plugin root:
<plugin-root>/mcp_config.json
Antigravity merges plugin-level MCP entries with the user-level config on launch.
Verify
After wiring up either or both:
mempalace-mcp --version # confirm binary is on PATH
ls ~/.mempalace/ # confirm palace exists (run `mempalace init` if not)
Restart Antigravity. The mempalace MCP server should appear in the
MCP store; the Stop and PreInvocation hooks fire automatically.
See hooks/antigravity/STDIN_SHAPE.md
for the exact wire format Antigravity uses, and
website/guide/antigravity.md
for the full user-facing guide.