A shared, harness-agnostic memory layer for AI coding agents can be built using hooks and Neo4j as the persistent store. Hooks fire deterministically on lifecycle events (session start, prompt submission, tool use, session end) across Claude Code, OpenAI Codex, and Cursor — without relying on the model to decide what to remember. Events are logged passively to Neo4j as a linked timeline per session. A separate 'dream phase' batch job periodically reads accumulated events, asks Claude to distill them into structured markdown memory files organized by topic, and writes them back. On the next session start in any harness, these memories are injected into the system prompt automatically. The result is portable, agent-owned memory that persists across harness switches.
Table of contents
MCP tools can only get you so far with memoryEnter hooksShared memory layerDream phaseAccessing the memoryGetting it to workSummarySort: