Close Menu
    Facebook LinkedIn YouTube WhatsApp X (Twitter) Pinterest
    Trending
    • Unified Agentic Memory Across Harnesses Using Hooks
    • Gulf Capital Meets the Cosmos.
    • Robots-Blog | Wenn Roboter stolpern: Die leisen Probleme humanoider Roboter
    • New ebike with semi-solid-state battery
    • Why you can’t build a startup ecosystem on panels and piss-ups
    • The Best Mobile Gaming Controllers for iPhone and Android (2026)
    • Datadog closed up 31%+ after reporting Q1 revenue up 32% YoY to $1B and raising its FY revenue forecast, an outlier in the software industry amid the AI boom (Mike Wheatley/SiliconANGLE)
    • Google Chrome May Have Quietly Installed a 4GB AI Model Onto Your Device
    Facebook LinkedIn WhatsApp
    Times FeaturedTimes Featured
    Friday, May 8
    • Home
    • Founders
    • Startups
    • Technology
    • Profiles
    • Entrepreneurs
    • Leaders
    • Students
    • VC Funds
    • More
      • AI
      • Robotics
      • Industries
      • Global
    Times FeaturedTimes Featured
    Home»Artificial Intelligence»Unified Agentic Memory Across Harnesses Using Hooks
    Artificial Intelligence

    Unified Agentic Memory Across Harnesses Using Hooks

    Editor Times FeaturedBy Editor Times FeaturedMay 8, 2026No Comments9 Mins Read
    Facebook Twitter Pinterest Telegram LinkedIn Tumblr WhatsApp Email
    Share
    Facebook Twitter LinkedIn Pinterest Telegram Email WhatsApp Copy Link


    that the primary debate isn’t about when the following higher mannequin drops, however about who will construct the appropriate harness round them. A harness is the scaffolding across the mannequin: the agent loop, software definitions, context administration, reminiscence, prompts, and workflows that flip a uncooked LLM right into a helpful product. The mannequin is the engine, the harness is every part that makes it really drive. Examples of harnesses are Cursor, Claude Desktop, and others.

    There’s a running debate within the AI coding software area: does committing to a particular harness imply vendor lock-in? Reminiscence is the sharpest fringe of this. In case your agent’s reminiscence lives inside a closed harness or behind a proprietary API, you don’t actually personal it, and switching prices add up quick. However it doesn’t need to be that approach.

    The concept is for this weblog put up is easy: maintain the reminiscence layer exterior the harness, and let any harness plug into it.

    Unified agentic reminiscence design.

    On this put up, I’ll present how one can construct a single, shared reminiscence layer that works throughout three completely different coding brokers — Claude Code, OpenAI’s Codex, and Cursor — utilizing hooks as the mixing mechanism and Neo4j because the persistent retailer.

    The code for hook integration is obtainable on GitHub.

    MCP instruments can solely get you to date with reminiscence

    MCP (Mannequin Context Protocol) servers are the go-to reply for giving brokers entry to exterior methods. And so they work. You’ll be able to expose a Neo4j database as an MCP software and let the agent question it when it decides to.

    However MCP instruments are agent-initiated. The mannequin has to resolve to name the software, and it has to know when and why to take action. Which means:

    • The agent must “keep in mind to recollect”, it should proactively resolve to retailer one thing price recalling later.
    • There’s no assure of consistency, one session would possibly log every part, the following would possibly log nothing.
    • You’re counting on the mannequin’s judgment about what’s necessary for reminiscence, in actual time, whereas it’s busy doing one thing else.

    What you actually need is passive, deterministic logging, which is one thing that captures each session occasion no matter what the mannequin is doing, with out consuming any of its context or consideration.

    That is precisely what hooks offer you.

    Hooks permit you to write programmatical and deterministic flows based mostly on predefined set of occasions.

    Enter hooks

    Hooks are shell instructions that fireplace mechanically on lifecycle occasions: when a session begins, when the person submits a immediate, earlier than and after each software use, and when the session ends. The agent doesn’t resolve to name them, they run programatically.

    The important thing perception is that hooks are remarkably standardized throughout suppliers. Claude Code, Codex, Cursor, and others all assist primarily the identical lifecycle occasions:

    • SessionStart for when the agent session begins
    • UserPromptSubmit (or beforeSubmitPrompt in Cursor) for when the person sends a message
    • PreToolUse / PostToolUse for earlier than and after every software name
    • Cease for when the session ends

    The hook receives a JSON payload on stdin with the session ID, occasion identify, software particulars, and person immediate. And the hook can emit JSON on stdout to inject further context again into the dialog. Similar contract, three harnesses/purchasers.

    There are different hooks too, issues like notification occasions, subagent cease, or pre-compact hooks, however we received’t be utilizing these right here.

    Shared reminiscence layer

    Now we want someplace to persist the reminiscence. Fast disclaimer: I work at Neo4j, so we will likely be utilizing it on this instance.

    Session construction.

    The mannequin is easy. Every agent session is a node, linked to a linked checklist of occasion nodes, one per hook invocation. Occasions are typed by the lifecycle occasion that triggered them: SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, Cease. A session finally ends up as an ordered timeline of every part that occurred throughout that run.

    All 5 occasion sorts are written to the shop, which provides you an entire audit path of each session throughout each harness. Two of them are additionally injection factors. SessionStart fires earlier than the agent reads its system immediate, so something the hook emits there will get prepended to the system immediate. That’s how persistent, agent-level reminiscence makes its approach into context. UserPromptSubmit fires simply earlier than the person message is distributed, and something emitted there will get appended to the person immediate. That’s the hook for turn-level context, like pulling in reminiscences related to what the person simply typed.

    So, what occurs if we begin a brand new session in any of those harnesses with energetic hooks, for instance Cursor?

    Instance interactions in Cursor

    If we examine the ends in Neo4j browser.

    Instance session continued as graph in Neo4j.

    One necessary constraint: hooks run exterior the harness’s mannequin session. You can’t reuse the LLM the agent is speaking to. If you need LLM-powered work inside a hook you must make your personal mannequin name, which provides latency to each occasion the agent fires. That’s the reason the hooks right here solely do two issues: log occasions and inject pre-computed reminiscences. They keep quick and deterministic.

    Dream part

    The precise reminiscence work occurs in a separate dream part: extracting info from classes, summarizing what occurred, updating the graph. That is only a batch job that runs each few hours, reads the occasions amassed for the reason that final run, and writes again to the reminiscence retailer. You could possibly in precept kick off a reminiscence replace asynchronously each time a session stops, however that looks like a bit an excessive amount of; a periodic batch is less complicated and works nice for this demonstration.

    The dream job pulls each occasion for the reason that session’s final watermark, arms them to Claude together with the present reminiscence retailer, and asks it to jot down again a small set of sturdy notes. The notes themselves imitate a markdown wiki, the identical form Karpathy and others have been gravitating towards for private LLM reminiscence and the identical form Anthropic’s abilities already use: every reminiscence is a file at a semantic path like profile/position.md, instruments/bash/common-flags.md, or challenge/neo4j-skills.md, with YAML frontmatter on high and prose beneath. Claude is advised to merge somewhat than append, so a path is a dwelling doc, not a log; if new occasions contradict an outdated notice, the outdated notice will get rewritten. The result’s a tree of small, self-contained markdown recordsdata a future session can learn chilly, indistinguishable in type from a talent, simply authored by the dream part as a substitute of by hand.

    If we run it on our instance, we get the next reminiscences created.

    Dream part including and enhancing reminiscences.

    And now if I opened a distinct harness, this time Claude Code Desktop with hooks activated, I’d get the next response.

    Claude code desktop utilizing the unified reminiscence layer.

    Accessing the reminiscence

    The ultimate piece of the puzzle is permitting the agent to entry the reminiscence layer. As talked about, there are two methods to inject data into the agent: hooks and MCP instruments.

    Agent interacting with the reminiscence layer via hooks and MCP instruments.

    Hooks are deterministic and run at first of each session to populate the system immediate. That is the place profile data and directions on easy methods to use reminiscence effectively ought to go. You too can append further context when a person immediate submission occasion fires, but it surely’s append-only; you’ll be able to’t manipulate different components of the immediate.

    MCP instruments, however, give the LLM direct entry to the reminiscence layer on demand. As an alternative of passively receiving context at startup, the agent can seek for related reminiscences, retailer new data, and replace or take away present entries. Basically, it’s primary CRUD over the abstracted markdown recordsdata saved in Neo4j.

    In the long run, I believe you’ll virtually at all times want each. On this challenge we solely have hooks, no MCP instruments, however you’ll be able to at all times simply plug within the official Neo4j MCP to let the agent discover the graph.

    Getting it to work

    Considerably attention-grabbing, the best way I arrange the hooks was to level the agent in any of the harnesses and requested it to put in hooks, however I’m positive there are higher approaches as nicely.

    Cursor agent putting in hooks.

    Abstract

    In the event you don’t personal your reminiscence, you don’t personal your agent. Each harness right this moment builds its personal walled backyard of context, preferences, and session historical past. Change them and also you begin from zero. That doesn’t need to be the case.

    Hooks break that sample. They allow you to write integrations that plug into any harness from the skin and the interface is remarkably constant. Claude Code, Codex, and Cursor all fireplace the identical lifecycle occasions: session begin, immediate submission, software use, session finish. The hook receives JSON on stdin, optionally emits JSON on stdout to inject context, and that’s the complete contract. As a result of hooks run deterministically on each occasion, they don’t eat mannequin consideration or depend on the agent to resolve what’s price saving. The identical two Python scripts deal with all three purchasers; skinny shell wrappers that go a --client flag are the one per-harness glue.

    The structure has three layers:

    1. Hooks (on-line) — passively log each occasion into Neo4j as a linked checklist per session. No mannequin calls, no latency value, simply append.
    2. Dream part (offline) — a batch job reads amassed occasions, asks Claude to distill them into sturdy markdown reminiscences, and writes them again. Recollections are organized by matter and merged somewhat than appended, so that they keep present as a substitute of rising eternally.
    3. Injection (on-line) — on the following session begin in any harness, profile reminiscences are loaded into context. On every person immediate, related reminiscences are searched and appended mechanically.

    The result’s a reminiscence layer that sits beneath all three harnesses, works with none of them realizing in regards to the others, and belongs totally to you. You’ll be able to swap from Cursor to Claude Code to Codex mid-project and decide up precisely the place you left off. Your agent’s understanding of who you’re, what you’re engaged on, and the way you like to work follows you, not the software.

    Code is obtainable here.

    P.s.: All photographs are created by the writer.



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Editor Times Featured
    • Website

    Related Posts

    I Rewrote a Real Data Workflow in Polars. Pandas Didn’t Stand a Chance.

    May 7, 2026

    Give Your AI Unlimited Updated Context

    May 7, 2026

    The Joy of Typing | Towards Data Science

    May 7, 2026

    How Major Reasoning Models Converge to the Same “Brain” as They Model Reality Increasingly Better

    May 7, 2026

    Deconstruct Any Metric with a Few Simple ‘What’ Questions

    May 7, 2026

    Timer-XL: A Long-Context Foundation Model for Time-Series Forecasting

    May 6, 2026
    Leave A Reply Cancel Reply

    Editors Picks

    Unified Agentic Memory Across Harnesses Using Hooks

    May 8, 2026

    Gulf Capital Meets the Cosmos.

    May 8, 2026

    Robots-Blog | Wenn Roboter stolpern: Die leisen Probleme humanoider Roboter

    May 8, 2026

    New ebike with semi-solid-state battery

    May 8, 2026
    Categories
    • Founders
    • Startups
    • Technology
    • Profiles
    • Entrepreneurs
    • Leaders
    • Students
    • VC Funds
    About Us
    About Us

    Welcome to Times Featured, an AI-driven entrepreneurship growth engine that is transforming the future of work, bridging the digital divide and encouraging younger community inclusion in the 4th Industrial Revolution, and nurturing new market leaders.

    Empowering the growth of profiles, leaders, entrepreneurs businesses, and startups on international landscape.

    Asia-Middle East-Europe-North America-Australia-Africa

    Facebook LinkedIn WhatsApp
    Featured Picks

    The Best Streaming Bundles and Streaming Deals of December 2025

    December 16, 2025

    Crypto users forced to share account details with tax officials

    January 1, 2026

    CSIRO scientists just built a tiny, world‑first quantum battery – and it could transform energy storage

    March 19, 2026
    Categories
    • Founders
    • Startups
    • Technology
    • Profiles
    • Entrepreneurs
    • Leaders
    • Students
    • VC Funds
    Copyright © 2024 Timesfeatured.com IP Limited. All Rights.
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us

    Type above and press Enter to search. Press Esc to cancel.