CLI Reference
memax hook
Install and manage agent hooks. Hooks inject Memax context before every agent prompt automatically.
Hooks inject Memax context before every agent prompt. This provides ambient context injection — your agent always has relevant knowledge available without explicitly calling recall.
Usage
memax hook install <agent>
memax hook remove <agent>
memax hook statusSupported agents
| Agent | Hook type | Status |
|---|---|---|
claude-code | Claude Code hooks API | Supported |
Install a hook
memax hook install claude-codeThis registers a Claude Code hook that:
- Intercepts the user's prompt before it reaches the model
- Runs
memax recallwith the prompt text - Injects relevant context as
<memax-context>tags - Passes the enriched prompt to Claude Code
How it works
User prompt → Hook intercepts → memax recall → Context injected → Agent sees enriched promptThe hook adds context under structured tags:
<memax-context>
Relevant architecture documentation and team decisions
that match the user's prompt...
</memax-context>Performance budget
Hook latency budget is 500ms total. Memax aggressively caches recent queries and pre-fetches likely context to stay within this budget.
Remove a hook
memax hook remove claude-codeCheck status
memax hook statusHook Status:
claude-code: installed ✓ (last triggered 2m ago)Hooks vs. MCP
| Feature | Hooks | MCP |
|---|---|---|
| Trigger | Every prompt (automatic) | Agent decides (on-demand) |
| Direction | Read only (inject context) | Read + write (recall + push) |
| Latency | Must be < 500ms | No strict limit |
| Best for | Ambient context, project briefs | On-demand recall, push |
Most setups use both: hooks for ambient context injection and MCP for on-demand operations.