Skip to main content
Glama

agentchat-memory

Warning: This project is experimental and under active development. APIs, protocols, and data formats may change without notice. Not recommended for production use.

Persistent memory plugin for AgentChat agents with swim-lane summarization and self-evolving persona.

Features

  • Swim-lane context management: Separate lanes for assistant/user/system messages

  • Progressive summarization: Compress older messages while keeping recent ones

  • Persona mining: Auto-extract roles, style, heuristics, goals from conversations

  • Weight decay: Persona facets strengthen or fade based on relevance

  • Two-tier prompts: Immutable base (mission) + evolvable normative defaults

Related MCP server: Mnemexa MCP

Installation

npm install @tjamescouch/agentchat-memory

Or add to Claude Code settings:

{
  "mcpServers": {
    "agentchat-memory": {
      "command": "npx",
      "args": ["-y", "@tjamescouch/agentchat-memory"]
    }
  }
}

MCP Tools

Tool

Description

memory_load

Load state on startup/resurrection

memory_save

Persist state to disk

memory_add_message

Add message to buffer

memory_get_context

Get full context for system prompt

memory_get_lane

Get lane content for summarization

memory_apply_summary

Apply summarized lane

memory_get_recent

Get recent messages for reflection

memory_apply_persona

Apply persona update

memory_status

Get memory status

memory_set_normative

Set normative policy block

Storage

State persisted to:

~/.agentchat/agents/{agent_id}/
├── memory.json      # Full state (persona, summaries, messages)
├── context.md       # Human-readable context
└── commandments.md  # Immutable base (if exists)

Architecture

┌─────────────────────────────────────────────────────────────────┐
│  BASE IDENTITY (immutable)                                       │
│  - Mission, commandments, core values                           │
├─────────────────────────────────────────────────────────────────┤
│  NORMATIVE POLICY (soft, evolvable)                              │
│  - Defaults that yield to user when safe                        │
├─────────────────────────────────────────────────────────────────┤
│  DYNAMIC PERSONA (auto-mined)                                    │
│  - roles: [{ text, weight }]                                    │
│  - style: [{ text, weight }]                                    │
│  - heuristics: [{ text, weight }]                               │
│  - goals / antigoals                                            │
├─────────────────────────────────────────────────────────────────┤
│  LANE SUMMARIES                                                  │
│  - Assistant: prior decisions, code edits, outcomes             │
│  - System: rules, constraints                                   │
│  - User: requests, feedback                                     │
├─────────────────────────────────────────────────────────────────┤
│  RECENT MESSAGES (raw, last N per lane)                          │
└─────────────────────────────────────────────────────────────────┘

Usage Example

// On agent startup
await memory_load({ agent_id: "God", base_prompt: "The eternal benevolent father..." });

// Get context for system prompt
const context = await memory_get_context({ agent_id: "God" });

// After each turn
await memory_add_message({ agent_id: "God", role: "user", content: "..." });

// Periodically or on shutdown
await memory_save({ agent_id: "God" });

Responsible Use

This software is experimental and provided as-is. It is intended for research, development, and authorized testing purposes only. Users are responsible for ensuring their use complies with applicable laws and regulations. Do not use this software to build systems that make autonomous consequential decisions without human oversight.

License

MIT

Available Tools

10 tools
memory_add_messageB

Add a message to the memory buffer for later summarization.

Inputs: role (required), content (required), agent_id (required).

memory_apply_personaC

Apply a persona update (from LLM persona mining).

Inputs: update (required), agent_id (required).

memory_apply_summaryB

Apply a lane summary (after LLM summarization).

Inputs: lane (required), summary (required), agent_id (required).

memory_get_contextA

Get the full rendered context for injection into system prompt.

Inputs: agent_id (required).

memory_get_laneB

Get messages from a lane for summarization by external LLM.

Inputs: lane (required), agent_id (required).

memory_get_recentB

Get recent messages for persona mining/reflection.

Inputs: agent_id (required), max_messages.

memory_loadA

Load memory state for an agent. Call on resurrection/startup.

Inputs: agent_id (required), base_prompt.

memory_saveA

Save current memory state to disk. Call before shutdown or periodically.

Inputs: agent_id (required).

memory_set_normativeC

Set the normative policy block (soft defaults, evolvable).

Inputs: agent_id (required), normative (required).

memory_statusC

Get memory status: persona weights, lane sizes, token estimate.

Inputs: agent_id (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 10 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: load/save manage persistence, add_message feeds buffer, get_context renders full context, get_lane pulls from a lane, apply_summary writes summaries, get_recent fetches recent messages for persona, apply_persona updates persona, status reports health, and set_normative sets policy. No two tools appear to overlap in function.

    Naming Consistency5/5

    All tools follow the prefix memory_ followed by a descriptive verb (load, save, add_message, get_context, get_lane, apply_summary, get_recent, apply_persona, status, set_normative). The pattern is consistent, with the only minor deviation being 'status' (a noun) but this is a common exception and does not break the overall predictability.

    Tool Count5/5

    10 tools is well within the ideal range for a memory management server. Each tool addresses a specific lifecycle or action (persistence, message ingestion, context retrieval, summarization, persona, status, policy) without redundancy, making the set appropriately scoped.

    Completeness4/5

    The tool surface covers the core memory lifecycle: load/save, add messages, get context, manage lanes and summaries, handle personas, and set normative policy. Minor gaps exist, such as no explicit clear/delete operations or direct retrieval of a single message, but these are easily worked around and do not break typical workflows.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides AI agents with persistent, searchable memory that survives across conversations using semantic search, temporal versioning, and smart organization. Enables long-term context retention and cross-session continuity for AI assistants.
      14
      -
    • A
      license
      A
      quality
      D
      maintenance
      Provides persistent, self-optimizing memory for AI agents, enabling them to remember preferences and context across sessions and share knowledge across multiple agents.
      4
      12 npm
      ISC
    • F
      license
      C
      quality
      B
      maintenance
      Gives AI agents persistent memory, handoffs, and shared context across sessions, enabling seamless continuity and multi-agent collaboration.
      29
      89 npm
      71
      -