Skip to content

Agent Integrations

Jose Meira edited this page Sep 20, 2026 · 4 revisions

Agent integrations

mnemo supports Claude Code, Codex, Cursor, OpenCode and Pi. Every integration reads the project ID from .mnemo; the controller combines that ID with the agent and its native execution ID to bind one canonical execution session. Hooks and extensions publish events and may inject context, but never write SQLite.

Agent Memory tools Native execution identity Runtime surface
Claude Code MCP CLAUDE_CODE_SESSION_ID Plugin hooks, or MCP and instructions via installer
Codex MCP tools/call metadata x-codex-turn-metadata.session_id Session hooks and global instructions
Cursor MCP conversation_id written by its prompt hook ~/.cursor/hooks/ and hooks config
OpenCode MCP session_id written by its plugin ~/.config/opencode/plugins/mnemo.ts
Pi Native tools ctx.sessionManager.getSessionId() ~/.pi/agent/extensions/mnemo.ts

Cursor and OpenCode use a local side-channel file for their native ID because their MCP calls do not carry it directly. A missing carrier is an error, not a reason to use a process ID, directory, or recent session. Pi invokes controller tools through its native extension; a static Pi MCP entry cannot convey its session identity and is removed during setup.

mnemo init --agent=<agent> creates the .mnemo marker and managed project rules. Global instructions and the canonical mnemo-memory skill are installed by setup. The skill lives at ~/.agents/skills/mnemo-memory/; integrations that need an agent-specific skill path use a link to it.

OpenCode's session.created publishes execution.started, its system-transform hook requests memory context, and its compaction hook publishes session.compacted before refreshing context. Claude Code and Codex session hooks correlate their native session IDs with controller events. Agent-specific coverage may vary, but equivalent events have the same memory semantics once published.

The .mnemo marker is local project identity, not an agent session ID. MCP memory-writing calls explicitly supply project and directory; callers do not supply a mnemo session ID. See Durable Events for the controller boundary.

Codex hook trust

Codex protects every hook in ~/.codex/hooks.json with an interactive trust review. mnemo currently installs Codex SessionStart and Stop hooks; the same Codex trust mechanism applies whenever a mnemo-owned hook is added or its command changes.

If Codex says a mnemo hook needs review, or if mnemo setup status --agent=codex shows the Codex Hooks column as review, open Codex normally and approve the interactive hook prompt (press a or follow the prompt shown by Codex). Codex will then write the matching trusted_hash entries under [hooks.state] in ~/.codex/config.toml. Re-run:

mnemo setup status --agent=codex
mnemo doctor --agent=codex --path=.

to confirm the Codex hooks are trusted and active. Do not manually copy hashes between machines; approve hooks in the Codex UI so the hash matches the local hook command.

Clone this wiki locally