Skip to content

AI MEMORY FOR AGENTS · AG2

Give your AG2 workflows knowledge they can build on.

We keep useful project knowledge available beyond a single run. Save a decision worth keeping, find it again and read the evidence behind it through AG2’s native memory tools.

Explicit save and recall through your local Claude-Mem worker.

KNOWLEDGE THAT LASTS

Your next run can start with what you learned.

Keep the decision beyond the run.

We store the project notes you choose to save, so the next workflow can build on what you already learned.

Connect your existing tools.

Our example uses AG2’s native MCPToolkit and your existing Claude-Mem worker. Keep one memory store for the knowledge your workflows need.

Go back to the evidence.

Search the project, inspect its timeline and retrieve the original record. The example checks the ID confirmed by the save receipt.

ILLUSTRATIVE NOTE · REAL TOOL SEQUENCE

A decision today. A reference for the next run.

“Run the smoke suite before release.”

An illustrative release decision using the actual example’s tool sequence. Choose the note, save it, keep its receipt and read it back before relying on it.

  1. 01

    Choose the knowledge

    Supply the project, title and text your workflow should retain.

  2. 02

    Save and keep the receipt

    Our worker confirms an observation ID. Identical example inputs reuse the existing fingerprint.

  3. 03

    Find the context

    Search the selected project and inspect the saved observation’s timeline.

  4. 04

    Read the original

    Retrieve the receipt’s exact record, even when newer notes move it out of the first search results.

START WITH ONE PROJECT

Connect. Save one decision. Read it back.

  1. Install Claude-Mem and start its worker. Follow the installation guide, then check npx claude-mem doctor. Keep your existing worker settings.
  2. Use the example from a source checkout. You need Node.js on PATH, Python 3.11 or later and the installed MCP bundle. If using a source-built bundle, run npm run build first.
  3. Set your path and project. Replace the MCP script path and choose your project, title and text. Match custom CLAUDE_MEM_DATA_DIR and CLAUDE_MEM_WORKER_PORT values to the running worker.
python3 -m venv .venv-ag2-memory
.venv-ag2-memory/bin/python -m pip install -r examples/ag2/requirements.txt

export CLAUDE_MEM_MCP_SERVER="/absolute/path/to/claude-mem/plugin/scripts/mcp-server.cjs"
.venv-ag2-memory/bin/python examples/ag2/memory_workflow.py --project "my-project" --title "Release decision" --text "Run the smoke suite before release."

Check the result. The command returns JSON containing id, project, index and details with your note. Repeat the same command: the observation ID should remain the same.

Use ProjectMemory from your own explicit workflow to keep the fixed-project behavior. Passing its raw underlying toolkit directly to a model bypasses the helper’s project binding.

AI memory in production

70 days of work. One searchable memory.

Alessandro used our open-source engine across three machines for 70 days. His customized deployment captured the decisions, fixes and discoveries behind the work—and published the data.

Observations captured
22,718
Bug fixes recorded
1,262
Decisions recorded
757

See how he made that knowledge searchable. Then give your own agents a memory to build on.

Claude-Mem’s mascot files a note in a shared card catalogue connected to three computers.
Alessandro’s published field study · March–May 2026

Before you connect

Does this capture every conversation automatically?

This example saves the notes your workflow explicitly supplies. It does not install capture hooks or inject startup context. Call the memory tools when your workflow needs them.

Do I need Pro or a model API key?

Neither is required for this local demonstration. The command exercises memory tools without a model request. Your own model-driven application needs its chosen provider and credentials.

Can I connect a hosted worker?

This example connects to your running local worker over the installed stdio MCP bundle. It does not configure hosted authentication or a cloud-runtime connection. Your worker’s existing sync settings still apply.

How do I keep projects separate?

ProjectMemory binds each read and write to the project you supply. Those filters are not account authorization; use separate authorized worker data directories across trust boundaries.

What if a save times out or the worker stops?

The example reports failure and queues no automatic retry. Check the worker and repeat the exact same project, title and text to recover its existing receipt when a write may have completed. Worker auto-start is disabled.

Which version should I install?

Use the checked-in requirements: AG2 with MCP support 1.3.1 and MCP 2.3.0. The source guide documents Linux verification and requires Python 3.11 or later. It does not establish Windows or macOS acceptance. AG2 uses the current ag2 namespace; this is not the earlier Microsoft AutoGen package API.

How do I disconnect?

Stop using the helper and remove the example environment if no longer needed. It adds no capture hook or user MCP configuration. Existing memories remain in your worker.

Build on a working example.

Source reviewed November 20, 2026. The published fixture checks explicit save/recall, repeated-save identity, selected-project reads and offline failure with harmless notes. Its model-free verification is separate from a model-driven agent run.

Give the next workflow a useful starting point.

Keep the decision. Find its source. Build from there.