memaxdocs
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 status

Supported agents

AgentHook typeStatus
claude-codeClaude Code hooks APISupported

Install a hook

memax hook install claude-code

This registers a Claude Code hook that:

  1. Intercepts the user's prompt before it reaches the model
  2. Runs memax recall with the prompt text
  3. Injects relevant context as <memax-context> tags
  4. Passes the enriched prompt to Claude Code

How it works

User prompt → Hook intercepts → memax recall → Context injected → Agent sees enriched prompt

The 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-code

Check status

memax hook status
Hook Status:
  claude-code: installed ✓ (last triggered 2m ago)

Hooks vs. MCP

FeatureHooksMCP
TriggerEvery prompt (automatic)Agent decides (on-demand)
DirectionRead only (inject context)Read + write (recall + push)
LatencyMust be < 500msNo strict limit
Best forAmbient context, project briefsOn-demand recall, push

Most setups use both: hooks for ambient context injection and MCP for on-demand operations.