Documentation / Agents

Works with the agents you already use

Hooks are auto-detected from the event payload — pipe JSON in, get memories out. No per-agent config to maintain. Seven named agents plus a generic fallback.

Compatibility matrix

Each agent's hook protocol and the lifecycle events it emits. All seven are detected automatically — no --agent flag required.

Claude Code

Anthropic. Marker: stop_hook_active / precompact. Events: stop, precompact, session_start.

Connect via MCP

Codex CLI

OpenAI. Marker: session_id + context_dir. Events: session_start, session_stop, stop, precompact.

Connect via MCP

Gemini CLI

Google. Marker: conversation_id + extensions. Events: stop, session_start.

Connect via MCP

OpenCode

anomalyco/sst. Marker: provider dict + openCodeVersion. Events: stop, session_stop, session_start, precompact.

Hook details

Pi

kachow-compatible. Marker: event in the Pi event set. Events: session_start, session_shutdown, pre_compact, tool_call, turn_end.

Hook details

OpenClaude

Marker: OpenClaude in payload. Events: stop, precompact, session_start.

Hook details

OpenClaw

Marker: openclaw in payload. Events: stop, session_stop, precompact, session_start.

Hook details

Generic

Fallback for any unrecognized payload. Works with any agent that can pipe JSON to a hook — including custom frameworks.

Use the generic adapter

Detection priority

When multiple markers could match, the most-specific wins. Order is fixed:

OpenClaude → Claude Code → Codex → Gemini CLI → OpenClaw → OpenCode → Pi → Generic

You can override auto-detection with --agent <name> on any memorius-hook command.

Three ways to integrate

MethodBest forHow
MCP server Any MCP-compatible agent (Claude Code, Codex, Gemini, Cursor, Aider…) Point the agent at memorius serve. See MCP Server.
Agent hooks Auto-capture at session boundaries Generate per-agent hook scripts with memorius-plugin-gen. See Hooks.
Agent skill Hermes-compatible agents that should use memorius proactively One npx command. See Install the skill.

Plug in your own agent

Memorius is agent-agnostic by design. Two paths for a custom agent:

  1. Generic hook adapter. Pipe your agent's event JSON to memorius-hook. The Generic fallback handles any unrecognized payload — no marker needed.
  2. A new marker. Add a recognition rule to the hook engine's detection table so your agent gets its own adapter (events, actions) instead of the generic path.
No MCP support in your agent?
Use the REST API directly — any HTTP client can store and search memories against the same vault.

Repository

Memorius is MIT-licensed and fully open source. Star the repo, open an issue, or dig into the source on GitHub.