Unified Agentic Memory Across Harnesses Using Hooks

· Source: Towards Data Science · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Software Development & Engineering, Robotics & Autonomous Systems · Depth: Intermediate, medium

Summary

This article proposes a unified agentic memory design that allows Large Language Model (LLM) agents to share memory across different "harnesses" like Claude Code, OpenAI's Codex, and Cursor, thereby preventing vendor lock-in. The core idea involves keeping the memory layer external to the harness and integrating it via standardized "hooks" that fire on lifecycle events such as session start, prompt submission, and tool use. Unlike agent-initiated Model Context Protocol (MCP) tools, hooks enable passive, deterministic logging of all session events into a Neo4j graph database. A separate "dream phase" batch job processes these events, distilling them into durable, semantically organized markdown memories using an LLM like Claude, which are then injected back into new agent sessions via hooks or accessed on demand through MCP tools.

Key takeaway

For AI Architects and MLOps Engineers designing LLM agent systems, adopting an external, unified memory layer is crucial to avoid vendor lock-in and ensure data portability. Your team should prioritize integrating memory via standardized hooks and a dedicated persistence layer like Neo4j, rather than relying solely on agent-initiated tools. This approach guarantees consistent, deterministic logging and allows your agent's context and preferences to follow you across different LLM harnesses, preserving your operational continuity and data ownership.

Key insights

A shared, external memory layer using standardized hooks prevents LLM agent vendor lock-in.

Principles

Method

Implement hooks for passive event logging to Neo4j, process events in an offline "dream phase" to distill memories, and inject relevant memories into agent context via hooks or MCP tools.

In practice

Topics

Code references

Best for: AI Engineer, AI Architect, MLOps Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by Towards Data Science.