Supported Agent Harnesses in ai-memory: Complete Integration Guide

ai-memory supports 14+ agent harnesses—including Claude Code, OpenAI Codex, Cursor, Devin, and Gemini CLI—through a unified MCP server architecture that enables seamless cross-harness memory continuity.

The ai-memory project by akitaonrails functions as a harness-agnostic memory layer for AI coding agents. By implementing lifecycle hooks and a shared MCP (Model Context Protocol) server, ai-memory allows developers to terminate a session in one supported agent and resume the exact same context in another without losing conversational history or context.

Native AI Coding Agent Harnesses

Claude Code and OpenAI Codex

The Claude Code harness integrates via MCP configuration paired with native lifecycle hooks (SessionStart, SessionEnd, …) as documented in docs/managed-workstreams.md#L4. These native hooks enforce capture exclusions automatically, ensuring sensitive data remains outside the memory store.

OpenAI Codex follows an identical integration pattern through MCP config and hooks, with auto-hand-off functionality available starting from Codex CLI version 0.145.0+. When a Codex session ends, the harness automatically triggers the hand-off protocol to make the session context available to other agents.

OpenCode and Pi

OpenCode connects through MCP configuration and lifecycle hooks, supporting both the first-generation engine and the newer OpenCode 2 beta. The Pi harness implements the same hook-based architecture, registering itself with the managed workstreams framework upon initialization.

Commercial and Enterprise Agent Support

Cursor, Devin, and Gemini CLI

According to docs/support-matrix.md#L12, ai-memory maintains a "supported profiles" matrix for commercial IDE agents including Devin, Cursor, and Gemini CLI. These harnesses utilize MCP configuration combined with custom hooks to persist session state into the shared memory store, enabling enterprise teams to switch between AI assistants without interrupting development workflows.

Specialized CLI Agents

Ai-memory provides first-class support for specialized and regional coding agents:

  • Crush – Hooks added via the standard managed workstreams interface
  • Kimi Code – Integrated through the same lifecycle hook system
  • Command Code – Supports full session persistence
  • Kiro CLI – Offers dual-engine support within a single harness wrapper
  • OMP – Implements standard SessionStart/SessionEnd hooks

Emerging and Beta Harness Integrations

The managed-workstreams framework (described in docs/managed-workstreams.md) extends support to emerging CLI tools including Grok Build CLI and Antigravity CLI. These integrations leverage the same underlying hooks infrastructure, though some require manual session finalization when native SessionEnd hooks are absent.

Technical Integration Architecture

The Managed Workstreams Framework

All supported harnesses communicate through the ai-memory MCP server using the managed-workstreams abstraction. When you execute ai-memory run <harness>, the CLI entry point in src/ai-memory-cli/main.rs inspects the host PATH for the native executable, initializes the appropriate session, and links the native session ID back to the shared memory store.

Per-harness lifecycle scripts reside in the hooks/ directory (e.g., hooks/claude-code/*.sh). The acceptance-test script in scripts/managed-workstream-acceptance.sh validates integration across the full harness matrix, ensuring cross-compatibility.

Cross-Harness Session Continuity

The core innovation lies in session hand-offs. Because each harness persists to the same memory store via standardized hooks, you can quit Claude Code mid-task and immediately continue the identical workstream in Codex or Cursor. The wrapper detects the most recent native session through the managed workstreams UI and automatically resumes the appropriate context.

Configuring and Running Agent Harnesses

Listing and Launching Harnesses

Use the CLI to discover installed agents and initiate managed sessions:


# List all harnesses currently installed on the host

ai-memory run --list

# Output: Claude Code   Codex   OpenCode   OpenCode2   Pi   Crush   Kimi Code   Command Code   Kiro   OMP   Grok Build   Antigravity   Devin   Cursor   Gemini

# Start with the auto-selected default harness

ai-memory run

# Detects the most recent native session and launches the appropriate agent.

# Explicitly select a specific harness

ai-memory run codex

# Starts Codex, records the session ID, and makes memory visible to other harnesses.

Manual Session Finalization

For harnesses lacking native SessionEnd hooks (such as Antigravity CLI), manually trigger the hand-off:

ai-memory finalize-session --agent antigravity

# Forces hand-off creation so the next harness can retrieve the context.

Summary

  • ai-memory supports 14+ agent harnesses ranging from Claude Code and Codex to Cursor and Gemini CLI through a unified MCP server architecture.
  • Integration occurs via lifecycle hooks (SessionStart, SessionEnd) documented in docs/managed-workstreams.md, enabling automatic session persistence.
  • The managed-workstreams framework in src/ai-memory-cli/main.rs automatically detects installed harnesses on PATH and manages cross-hander continuity.
  • Cross-harness hand-offs allow switching between agents (e.g., Claude Code to Codex) without losing conversational context or memory state.
  • Acceptance testing in scripts/managed-workstream-acceptance.sh validates the entire supported matrix.

Frequently Asked Questions

Which agent harnesses are officially supported by ai-memory?

Ai-memory officially supports Claude Code, OpenAI Codex, OpenCode (including v2 beta), Pi, Crush, Kimi Code, Command Code, Kiro CLI, OMP, Grok Build CLI, Antigravity CLI, Devin, Cursor, and Gemini CLI. The definitive list appears in docs/managed-workstreams.md#L4 and the compatibility matrix in docs/support-matrix.md#L12.

How does ai-memory enable switching between different agents?

Ai-memory utilizes a shared MCP server with standardized lifecycle hooks. When a session ends in one harness, the SessionEnd hook persists the context to the common memory store. When you launch a different harness via ai-memory run, the wrapper retrieves the last active session ID and restores the context, enabling seamless transitions between agents like Claude Code and Codex.

What configuration files manage agent harness integration?

The primary documentation resides in docs/managed-workstreams.md, which defines the cross-harness workflow and hook specifications. The support matrix in docs/support-matrix.md outlines specific compatibility profiles for commercial agents like Devin and Cursor. Actual hook implementations live in the hooks/ directory, organized by harness name.

How do I add support for a new agent harness to ai-memory?

To add a new harness, create lifecycle hook scripts (implementing SessionStart and SessionEnd) in a new subdirectory under hooks/. Register the harness in the managed-workstreams configuration, then update scripts/managed-workstream-acceptance.sh to include the new agent in acceptance testing. The CLI dispatcher in src/ai-memory-cli/main.rs automatically detects the harness if it exists on the system PATH.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →