Hooks
Cross-agent hook adapters for automatic memory capture
Hooks
Use memctl hook for turn-level capture and memctl hook-adapter to generate setup templates for major coding agents.
Hook API
hook stores high-signal context from chat turns into mem/ctl and updates session logs.
# Start
npx memctl hook start --session-id my-session
# Turn capture
npx memctl hook turn --session-id my-session --user "..." --assistant "..."
# End
npx memctl hook end --session-id my-session --summary "..."JSON payload mode:
echo '{"action":"turn","sessionId":"my-session","userMessage":"...","assistantMessage":"..."}' | npx memctl hook --stdinGenerate adapters
Print templates for one agent:
npx memctl hook-adapter --agent claudeWrite templates to disk:
npx memctl hook-adapter --agent claude --write
npx memctl hook-adapter --agent cursor --write
npx memctl hook-adapter --agent codex --write
npx memctl hook-adapter --agent all --writeDefault output directory: .memctl/hooks.
Supported agent presets:
claudecursorwindsurfvscode(GitHub Copilot)continuezedcodexclinerooamazonqgenericall
Generated files include:
memctl-hook-dispatch.sh(shared dispatcher script)- Agent MCP config examples where supported
- Hook config or hook fallback notes per agent
Claude Code
Preferred, install from repository marketplace:
/plugin marketplace add memctl/memctl
/plugin install memctl@memctlIf you prefer direct hook config without plugin marketplace, generate:
npx memctl hook-adapter --agent claude --writeCursor
- Run:
npx memctl hook-adapter --agent cursor --write- Copy
.memctl/hooks/cursor.mcp.json.exampleinto.cursor/mcp.json. - Read
.memctl/hooks/cursor.hooks.md.examplefor hook fallback flow.
Other agents
- Windsurf:
windsurf.mcp_config.json.example - VS Code/Copilot:
vscode.mcp.json.example - Continue:
continue.config.yaml.example - Zed:
zed.settings.json.example - Cline:
cline.mcp.json.example - Roo:
roo.mcp.json.example - Amazon Q:
amazonq.mcp.json.example - Codex:
codex.config.toml.example+codex.hooks.md.example
For all of these, generate with:
npx memctl hook-adapter --agent <agent> --writeAgents without stable prompt/response hook APIs include a generated *.hooks.md.example fallback file. Use that flow with any command runner around your sessions.
What gets stored
hook turn stores only high-signal project memory:
- decisions
- constraints
- implementation outcomes
- failures and regressions
Low-signal generic capability notes (file scanning tips, grep reminders, pattern-search basics) are skipped by default.