Zero-UI native /fork for Google Antigravity
One-click denoised conversation forking · Live sidebar title sync · 0-token bloat nudges · Lossless Git-grounded handoffs · 20-class secret redaction
Quick Start · /fork vs /compact · Commands · Security · Changelog
Long AI coding sessions degrade fast: build logs, progress bars, failed retries, and repeated file reads silently bloat your context window to 300k–500k+ tokens. Summarizing in place loses exact code details, while starting from scratch wastes 10 minutes re-explaining your repo state.
Context Relay stays completely invisible until you need it — no sidecar web apps, no manual turn-checkbox forms, no cloud LLM summarization:
When a session gets heavy, Context Relay's 0-token PreInvocation hook lets you choose between two complementary native paths:
| Need | Command | How It Works |
|---|---|---|
| Compress in-place (keep the same thread) | /compact (Antigravity built-in) |
Uses an LLM to summarize earlier turns inside the current thread. |
| Lossless denoised fresh session (zero summarization degradation) | /fork (Context Relay) |
0-LLM deterministic surgery: trims bulky tool noise, grounds real git status/git diff, preserves 100% verbatim goals & conclusions with lossless transcript_full.jsonl traceback, redacts 20 secret classes, reads your live renamed sidebar title, inherits your model, and launches <Title> (fork) in one click. |
- One-Click
/fork, Zero Popups: Typing/forkopens no modals or webpages — it immediately denoises your active session in the same workspace and replies with a 2-line receipt plus a clickable[Title (fork)](conversation://<id>)instant-jump link. - Live Sidebar Title Sync (Zero SQLite): Reads Antigravity's plain-text
annotations/<id>.pbtxtso your renamed sidebar title is preserved verbatim (Auth Refactor→Auth Refactor (fork)→Auth Refactor (fork #2)). - Ultra-Clean
/Menu: Only/forkappears in Antigravity's slash-command menu (legacy aliasesrelayandcontext-relaystay hidden viadisable-slash-command: true). - 0-Token Context Bloat Nudge:
hooks/nudge.mjsinjects subtle inlinemetadata.user_markdownreminders with 0 model tokens only when noise crosses threshold (opt out anytime viaCONTEXT_RELAY_NUDGE=0). - Cross-Project & Turn-Bounded Forking: Move curated context straight into another registered workspace (
/fork <project-keyword>) or branch cleanly from an earlier turn (/fork until turn N). - Shareable Token-Savings Card (
stats --svg): Track real cumulative tokens saved with/fork statsor generate a crisp GitHub-ready SVG benchmark card via CLI. - Zero Dependencies & 100% Local: Pure Node.js ESM (
>= 22.15.0) — nonpm install, no telemetry, no external API calls.
- Node.js
>= 22.15.0(zero runtime dependencies).
git clone https://github.com/KennyMcSimpson/ContextRelay.git ~/.gemini/config/plugins/context-relayAntigravity automatically discovers plugin.json, activates the PreInvocation bloat-nudge hook and Stop incremental indexer (hooks.json), and exposes /fork in your / menu.
git clone https://github.com/KennyMcSimpson/ContextRelay.git ContextRelay
cd ContextRelay
node bin/context-relay.mjs install antigravity --data-dir <custom-dir>| What You Type in Antigravity | What Happens |
|---|---|
/fork |
0 popups — immediately denoises the current conversation in the original folder, names it <Live Sidebar Title> (fork), inherits the active model, and returns a clickable conversation://<id> link. |
/fork <folder-keyword> |
Plans target workspace match (exact → instant --go with 0 popups; ambiguous → 1 native ask_question card; not_found → explains registering the folder in left Projects or exporting). |
/fork until turn N |
Deterministically branches up to turn N (--until <N>) into a clean session without later detours. |
/fork stats |
Reports cumulative tokens saved across forks and can export a GitHub SVG war-report card (--svg). |
/fork search <keyword> |
Full-text searches indexed historical sessions (including live renamed titles) and returns clickable [<Title>](conversation://<sessionId>) links. |
| Variable | Effect |
|---|---|
CONTEXT_RELAY_NUDGE=0 |
Disable automatic 0-token PreInvocation bloat reminders completely. |
CONTEXT_RELAY_DATA_DIR=<dir> |
Override local index/archive/stats storage directory. |
# 1. One-click in-place denoised fork (original folder, live sidebar title + "(fork)")
node bin/context-relay.mjs fork --session <conversation-id> --go --json
# 2. Plan / execute cross-project or turn-bounded fork (or --export-only)
node bin/context-relay.mjs fork --session <conversation-id> --plan --to "<project-or-path>" [--until <N>] --json
node bin/context-relay.mjs fork --session <conversation-id> --go [--to "<project-id>"] [--preset smart-clean|backbone] [--until <N>] [--note "<extra-instruction>"] [--export-only] --json
# 3. View cumulative token savings & export a personal GitHub SVG card
node bin/context-relay.mjs stats --json
node bin/context-relay.mjs stats --svg ./my-savings.svg --json
# 4. Full-text search across indexed historical Antigravity sessions
node bin/context-relay.mjs search "<query>" --limit 10 --json
# 5. Inspect turns & export deterministic Git-grounded handoff bundle
node bin/context-relay.mjs inspect <conversation-id>
node bin/context-relay.mjs export <conversation-id>
# 6. Install / uninstall Antigravity plugin wiring
node bin/context-relay.mjs install antigravity --data-dir <custom-dir>
node bin/context-relay.mjs uninstall antigravityOptional: Offline Local Web Debugger (serve)
Normal Antigravity usage requires no web UI. For power users who want an offline browser inspector, an optional loopback-only server is available:
node bin/context-relay.mjs serve --port 3477
# Open http://127.0.0.1:3477- Zero Dependencies, 100% Local: Pure Node.js ESM (
>= 22.15.0). No external packages, no telemetry, no cloud LLM calls. - Strict Read-Only Boundary (Zero
.sqliteAccess): Reads only localtranscript*.jsonllogs and plain-textannotations/<id>.pbtxttitles, and interacts solely via public localagentapiinterfaces. Never opens, queries, or modifies private.sqlite/.dbfiles. - 20-Category Built-In Secret Redaction: Automatically scrubs API keys, GitHub/AWS/Slack/HF/npm tokens, bearer/basic auth headers, database URLs, and PEM private keys before exporting or forking context.
- Zero-Delete Cross-Process Locking: Uses kernel-atomic
openSync('wx', 0o600)+renameSyncrelease with stale dead-PID recovery — verified 200/200 zero lost updates across 8 concurrent Windows processes without calling destructive delete APIs. - Loopback & CSRF Hardening: Optional
servebinds strictly to127.0.0.1withHostport verification,Content-Typeenforcement,Origin/X-Context-RelayCSRF checks, and CSP headers.
ContextRelay/
├── plugin.json # Antigravity root plugin manifest (v0.2.2, strict whitelist)
├── hooks.json # Root PreInvocation (0-token nudge) + Stop (incremental sync)
├── assets/
│ ├── logo.svg # Square plugin icon
│ ├── savings-benchmark.svg # Real-world token-savings benchmark card (820×300)
│ └── workflow-preview.svg # Native zero-UI /fork experience preview (820×272)
├── hooks/
│ ├── nudge.mjs # 0-token PreInvocation context bloat reminder
│ └── sync-turn.mjs # Lightweight Stop-hook incremental transcript indexer
├── skills/
│ ├── fork/SKILL.md # Primary one-click /fork slash command
│ ├── relay/SKILL.md # Hidden backward-compatible alias
│ └── context-relay/SKILL.md # Hidden backward-compatible alias
├── adapters/ # Host adapter abstraction (Antigravity + .pbtxt live titles)
├── core/ # Turn parser, smart pruning, Git anchor, 20-class redactor, store
├── bin/context-relay.mjs # Unified CLI (fork, stats --svg, search, inspect, export, install)
├── server/ & ui/ # Optional offline loopback web debugger (serve)
└── test/ # 67 unit, redaction, concurrency, hook, CLI & manifest tests
All host-specific transcript discovery, annotation parsing, and clean-relaunch transport live cleanly inside adapters/, keeping the surgical pruning, Git grounding, secret redaction, and indexing engine host-agnostic for future coding agents.
node --test test/*.test.mjsMIT © 2026 KennyMcSimpson