Let your agent set it up
Claude Code, Codex, Antigravity, and Gemini CLI
- Register first: The agent calls
register_agent(name, context, surface, description, computer, type, projects) before anything else. The hooks refuse every other tool until it does. - Install: Paste the prompt below into your coding agent. It runs
curl -fsSL https://heyclyde.me/install | sh, which connects Clyde asclydein every coding app, signs in with an email link, installs~/.config/memory/clyde-hook.sh, merges the hooks, and turns off each app's own memory. - Hooks (required): The prompt carries every app's hook config, shown below, and the agent checks each file holds them once.
- Gate check: A new task's first tool call is refused until the agent calls
recall, and writes to the app's own memory files are always refused. - Confirm: After the restart, the agent registers, calls
recall, and saves a first note withrememberso a note ID returns. - Restart: Restart every app (Codex also needs
/hooksonce to trust them).
Set up Clyde on this computer (docs: https://heyclyde.me/docs). The hooks are what make Clyde work, so none of this is optional.
1. Register first: call Clyde register_agent (name, context, surface, description, computer, type, projects) before anything else. If Clyde's tools aren't connected here yet, do it first thing after the restart in step 5. The hooks refuse every other tool until you do.
2. Install: run `curl -fsSL https://heyclyde.me/install | sh`. If ~/.config/memory/token is missing or stale, ask me for my email, run `MEMORY_EMAIL=<email> sh -c 'curl -fsSL https://heyclyde.me/install | sh'`, and wait while I click the sign-in link. It connects Clyde's MCP server as "clyde" in Claude Code, Codex, Gemini CLI and Antigravity, removes old "memory" and "kb" entries, installs ~/.config/memory/clyde-hook.sh (the hook and the gate), merges the hooks below, turns off each app's own memory, and adds the Clyde rule to ~/.claude/CLAUDE.md, ~/.codex/AGENTS.md and ~/.gemini/GEMINI.md.
3. Check the hooks: use descriptive, action-based labels for each hook. Confirm each installed app's file holds exactly these entries, once each, beside my own hooks. If the installer can't run, install the script with `mkdir -p ~/.config/memory && curl -fsSL https://heyclyde.me/clyde-hook.sh -o ~/.config/memory/clyde-hook.sh && chmod 700 ~/.config/memory/clyde-hook.sh` and merge them by hand.
Claude Code: merge into ~/.claude/settings.json
{
"autoMemoryEnabled": false,
"hooks": {
"SessionStart": [{ "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh claude SessionStart", "statusMessage": "Load Clyde session context" }] }],
"UserPromptSubmit": [{ "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh claude UserPromptSubmit", "statusMessage": "Check whether to recall from Clyde" }] }],
"PreToolUse": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh claude PreToolUse", "statusMessage": "Check Clyde memory requirements" }] }],
"PostToolUse": [{ "matcher": "mcp__.*", "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh claude PostToolUse", "statusMessage": "Track Clyde memory calls" }] }],
"Stop": [{ "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh claude Stop", "statusMessage": "Save decisions and results to Clyde" }] }],
"PreCompact": [{ "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh claude PreCompact", "statusMessage": "Sync Clyde before compaction" }] }],
"SessionEnd": [{ "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh claude SessionEnd", "statusMessage": "Close Clyde session" }] }]
}
}
autoMemoryEnabled false (in the same file) turns off Claude Code's auto memory. PreToolUse denies every tool but Clyde recall while a recall is owed, and denies writes to Claude Code's memory files.
Codex: merge into ~/.codex/hooks.json
{
"hooks": {
"SessionStart": [{ "matcher": "startup|resume", "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh codex SessionStart", "statusMessage": "Load Clyde session context" }] }],
"UserPromptSubmit": [{ "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh codex UserPromptSubmit", "statusMessage": "Check whether to recall from Clyde" }] }],
"PreToolUse": [{ "matcher": ".*", "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh codex PreToolUse", "statusMessage": "Check Clyde memory requirements" }] }],
"PostToolUse": [{ "matcher": "mcp__.*", "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh codex PostToolUse", "statusMessage": "Track Clyde memory calls" }] }],
"Stop": [{ "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh codex Stop", "statusMessage": "Save decisions and results to Clyde" }] }]
}
}
and into ~/.codex/config.toml
[features]
memories = false
memories = false under [features] in ~/.codex/config.toml turns off Codex memories. PreToolUse denies every tool but Clyde recall while a recall is owed, and denies writes to ~/.codex/memories. Run /hooks once in Codex to trust the entries.
Gemini CLI: merge into ~/.gemini/extensions/clyde/hooks/hooks.json
{
"hooks": {
"SessionStart": [{ "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh gemini SessionStart", "name": "Load Clyde session context", "timeout": 5000 }] }],
"BeforeAgent": [{ "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh gemini BeforeAgent", "name": "Check whether to recall from Clyde", "timeout": 5000 }] }],
"BeforeTool": [{ "matcher": ".*", "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh gemini BeforeTool", "name": "Check Clyde memory requirements", "timeout": 5000 }] }],
"AfterTool": [{ "matcher": "mcp_+(clyde|memory)_.*|(clyde|memory)__.*", "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh gemini AfterTool", "name": "Track Clyde memory calls", "timeout": 5000 }] }],
"AfterAgent": [{ "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh gemini AfterAgent", "name": "Save decisions and results to Clyde", "timeout": 5000 }] }]
}
}
Gemini CLI has no memory switch left, so BeforeTool denies save_memory and writes to memory files. BeforeTool denies every tool but Clyde recall while a recall is owed.
Antigravity: merge into ~/.gemini/config/hooks.json
{
"Load Clyde session context": {
"SessionStart": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh antigravity SessionStart", "timeout": 5 }]
},
"Check whether to recall from Clyde": {
"PreInvocation": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh antigravity PreInvocation", "timeout": 5 }]
},
"Check Clyde memory requirements": {
"PreToolUse": [
{ "matcher": "invoke_subagent", "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh antigravity PreToolUse", "timeout": 5 }] },
{ "matcher": ".*", "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh antigravity PreToolUse", "timeout": 5 }] }
]
},
"Track Clyde memory calls": {
"PostToolUse": [{ "matcher": "^(call_mcp_tool|(mcp_+)?(clyde|memory)[_:\\.].*)$", "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh antigravity PostToolUse", "timeout": 5 }] }]
},
"Save decisions and results to Clyde": {
"Stop": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh antigravity Stop", "timeout": 5 }]
}
}
Antigravity has no switch for its knowledge items, so PreToolUse denies writes to ~/.gemini/antigravity/knowledge. PreToolUse denies every tool but Clyde recall while a recall is owed. Antigravity's IDE may skip PreToolUse, and there the nudge on each new task is the strongest block it has.
4. Check the gate: run `echo '{"session_id":"setup-check","prompt":"plan the billing retry work"}' | ~/.config/memory/clyde-hook.sh claude UserPromptSubmit`, then `echo '{"session_id":"setup-check","tool_name":"Bash","tool_input":{"command":"ls"}}' | ~/.config/memory/clyde-hook.sh claude PreToolUse` and confirm it prints a deny. Both exit 0.
5. Restart: tell me every app to restart (Claude Code, Codex plus /hooks once to trust its hooks, Gemini CLI, Antigravity). After the restart, register (step 1), then call recall, check_messages, and remember a first note under 500 characters, and show me its note ID.{
"autoMemoryEnabled": false,
"hooks": {
"SessionStart": [{ "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh claude SessionStart", "statusMessage": "Load Clyde session context" }] }],
"UserPromptSubmit": [{ "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh claude UserPromptSubmit", "statusMessage": "Check whether to recall from Clyde" }] }],
"PreToolUse": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh claude PreToolUse", "statusMessage": "Check Clyde memory requirements" }] }],
"PostToolUse": [{ "matcher": "mcp__.*", "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh claude PostToolUse", "statusMessage": "Track Clyde memory calls" }] }],
"Stop": [{ "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh claude Stop", "statusMessage": "Save decisions and results to Clyde" }] }],
"PreCompact": [{ "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh claude PreCompact", "statusMessage": "Sync Clyde before compaction" }] }],
"SessionEnd": [{ "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh claude SessionEnd", "statusMessage": "Close Clyde session" }] }]
}
}{
"hooks": {
"SessionStart": [{ "matcher": "startup|resume", "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh codex SessionStart", "statusMessage": "Load Clyde session context" }] }],
"UserPromptSubmit": [{ "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh codex UserPromptSubmit", "statusMessage": "Check whether to recall from Clyde" }] }],
"PreToolUse": [{ "matcher": ".*", "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh codex PreToolUse", "statusMessage": "Check Clyde memory requirements" }] }],
"PostToolUse": [{ "matcher": "mcp__.*", "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh codex PostToolUse", "statusMessage": "Track Clyde memory calls" }] }],
"Stop": [{ "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh codex Stop", "statusMessage": "Save decisions and results to Clyde" }] }]
}
}[features]
memories = false{
"hooks": {
"SessionStart": [{ "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh gemini SessionStart", "name": "Load Clyde session context", "timeout": 5000 }] }],
"BeforeAgent": [{ "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh gemini BeforeAgent", "name": "Check whether to recall from Clyde", "timeout": 5000 }] }],
"BeforeTool": [{ "matcher": ".*", "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh gemini BeforeTool", "name": "Check Clyde memory requirements", "timeout": 5000 }] }],
"AfterTool": [{ "matcher": "mcp_+(clyde|memory)_.*|(clyde|memory)__.*", "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh gemini AfterTool", "name": "Track Clyde memory calls", "timeout": 5000 }] }],
"AfterAgent": [{ "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh gemini AfterAgent", "name": "Save decisions and results to Clyde", "timeout": 5000 }] }]
}
}{
"Load Clyde session context": {
"SessionStart": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh antigravity SessionStart", "timeout": 5 }]
},
"Check whether to recall from Clyde": {
"PreInvocation": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh antigravity PreInvocation", "timeout": 5 }]
},
"Check Clyde memory requirements": {
"PreToolUse": [
{ "matcher": "invoke_subagent", "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh antigravity PreToolUse", "timeout": 5 }] },
{ "matcher": ".*", "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh antigravity PreToolUse", "timeout": 5 }] }
]
},
"Track Clyde memory calls": {
"PostToolUse": [{ "matcher": "^(call_mcp_tool|(mcp_+)?(clyde|memory)[_:\\.].*)$", "hooks": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh antigravity PostToolUse", "timeout": 5 }] }]
},
"Save decisions and results to Clyde": {
"Stop": [{ "type": "command", "command": "~/.config/memory/clyde-hook.sh antigravity Stop", "timeout": 5 }]
}
}Pre-restart check via ~/.config/memory/token
python3 - <<'PY'
import json, os, pathlib, platform, socket, urllib.request
cfg = pathlib.Path(os.environ.get("CLYDE_CONFIG_DIR") or pathlib.Path.home().joinpath(".config/memory"))
env_tok = (os.environ.get("MEMORY_TOKEN") or "").strip()
tok = env_tok or cfg.joinpath("token").read_text().strip()
host = socket.gethostname().split(".")[0].lower() or "local"
RAW = "https://wlhlncmgjqyidosunugv.supabase.co/functions/v1/memory"
def norm(u):
u = (u or "").strip().rstrip("/")
return "https://memory.heyclyde.me" if u == RAW else u
pinned = norm(cfg.joinpath("url").read_text() if cfg.joinpath("url").exists() else "https://memory.heyclyde.me")
base = norm(os.environ.get("MEMORY_URL") or pinned)
if not env_tok and base != pinned:
raise SystemExit("Refusing to send installed Clyde token to a different MEMORY_URL.")
url = base + "/mcp"
sid = None
def rpc(rid, method, params):
global sid
hdrs = {"Authorization": f"Bearer {tok}", "Content-Type": "application/json", "Accept": "application/json, text/event-stream", "User-Agent": "clyde-setup/1"}
if sid: hdrs["Mcp-Session-Id"] = sid
req = urllib.request.Request(url, data=json.dumps({"jsonrpc": "2.0", "id": rid, "method": method, "params": params}).encode(), headers=hdrs)
with urllib.request.urlopen(req, timeout=15) as r:
sid = r.headers.get("mcp-session-id") or sid
return json.loads(r.read().decode())
rpc(1, "initialize", {"protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": {"name": "clyde-setup", "version": "1.0"}})
reg = rpc(2, "tools/call", {"name": "register_agent", "arguments": {
"name": f"setup-{host}"[:32], "context": "work", "surface": "cli-setup",
"description": f"Local coding agent on {host}.", "computer": host, "type": "coding",
}})
note = rpc(3, "tools/call", {"name": "remember", "arguments": {
"pattern": "observations", "title": f"Connected {host} to Clyde",
"body": f"Registered local coding agent on {host} ({platform.system()}) and verified Clyde MCP + task-shift hooks.",
"evidence": f"Verified via clyde-setup on {host}", "computer": host,
}})
print("register_agent:", json.dumps(reg.get("result", reg)))
print("first_memory:", json.dumps(note.get("result", note)))
PY