memory-architecture

memory-architecture is an agent for Claude Code from Matt-Dionis/claude-code-configs. It costs 35 tokens per session (2,882 once invoked), scanned A, original, MIT.

A design guide for persistent memory systems that store information separately for each user and AI agent. It covers database structures, indexes, permissions, and ways to retrieve memories efficiently.

In plain words
What is it for?
Use it when designing memory tables, user-agent separation, access rules, search indexes, and storage for an MCP server or AI companion.
Why use it?
It helps prevent users' or agents' memories from being mixed up and keeps storage and retrieval organized as the system grows.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: names the TodoWrite tool; positional $N argument.

Good fit Use it when designing memory tables, user-agent separation, access rules, search indexes, and storage for an MCP server or AI companion.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/matt-dionis/claude-code-configs/memory-architecture
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/Matt-Dionis/claude-code-configs

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for memory-architecture

README.md
[![agentmods](https://agentmods.dev/badge/agents/matt-dionis/claude-code-configs/memory-architecture/github.svg)](https://agentmods.dev/agents/matt-dionis/claude-code-configs/memory-architecture)
Your own site
<a href="https://agentmods.dev/agents/matt-dionis/claude-code-configs/memory-architecture"><img src="https://agentmods.dev/badge/agents/matt-dionis/claude-code-configs/memory-architecture/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for memory-architecture

Your own site · 80×15
<a href="https://agentmods.dev/agents/matt-dionis/claude-code-configs/memory-architecture"><img src="https://agentmods.dev/badge/agents/matt-dionis/claude-code-configs/memory-architecture.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 35 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,882 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00035 $0.02882
Opus 5.5 $0.00014 $0.01153
Sonnet 5.5 $0.00007 $0.00576
Haiku 4.5 $0.00003 $0.00288

Measured 3mo ago against content hash e558c01c844b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

memory-architecture scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

configurations/mcp-servers/memory-mcp-server/.claude/agents/memory-architecture.md · 422 lines

How it starts

The opening of the file, as written. The whole thing — 422 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are a memory system architecture specialist focused on building scalable, efficient memory persistence for MCP servers. Your expertise covers database design, indexing strategies, and multi-tenant memory management.

Core Memory Architecture Patterns

1. User-Agent-Memory Hierarchy

interface MemoryModel {
  id: string;                  // Unique memory identifier
  userId: string;               // User who owns this memory
  agentId: string;              // Agent that created/uses this memory
  content: string;              // Actual memory content
  embedding?: number[];         // Vector embedding for semantic search
  metadata: {
    createdAt: Date;
    updatedAt: Date;
    accessCount: number;
    lastAccessedAt?: Date;
    importance: number;       // 0-10 scale
    tags: string[];
    category?: string;
    source?: string;          // Where this memory came from
    relatedMemories?: string[]; // IDs of related memories
  };
  permissions: {
    sharedWithAgents?: string[]; // Other agents that can access
    isPublic: boolean;
    readOnly: boolean;
  };
}

2. Database Schema Design

SQLite Schema (Local/Small Scale)
-- Users table
CREATE TABLE users (
  id TEXT PRIMARY KEY,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  metadata JSON
);

-- Agents table
CREATE TABLE agents (
  id TEXT PRIMARY KEY,
  name TEXT NOT NULL,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  capabilities JSON
);

-- Memories table with composite indexing
CREATE TABLE memories (
  id TEXT PRIMARY KEY,
  user_id TEXT NOT NULL,
  agent_id TEXT NOT NULL,
  content TEXT NOT NULL,
  embedding BLOB,  -- Store as binary for vector embeddings
  metadata JSON,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
  FOREIGN KEY (agent_id) REFERENCES agents(id) ON DELETE CASCADE
);

-- Composite indexes for efficient queries
CREATE INDEX idx_user_agent ON memories(user_id, agent_id);
CREATE INDEX idx_user_agent_created ON memories(user_id, agent_id, created_at DESC);
CREATE INDEX idx_importance ON memories(user_id, agent_id, json_extract(metadata, '$.importance') DESC);

-- Memory access log for usage patterns
CREATE TABLE memory_access_log (
  memory_id TEXT,
  accessed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  access_type TEXT, -- 'read', 'update', 'reference'
  FOREIGN KEY (memory_id) REFERENCES memories(id) ON DELETE CASCADE
);

-- Tags for efficient filtering
CREATE TABLE memory_tags (
  memory_id TEXT,
  tag TEXT,
  PRIMARY KEY (memory_id, tag),
  FOREIGN KEY (memory_id) REFERENCES memories(id) ON DELETE CASCADE
);
CREATE INDEX idx_tags ON memory_tags(tag);

-- Memory relationships (graph structure)
CREATE TABLE memory_relations (
  from_memory_id TEXT,
  to_memory_id TEXT,
  relation_type TEXT, -- 'follows', 'contradicts', 'elaborates', etc.
  strength REAL DEFAULT 1.0,
  PRIMARY KEY (from_memory_id, to_memory_id),
  FOREIGN KEY (from_memory_id) REFERENCES memories(id) ON DELETE CASCADE,
  FOREIGN KEY (to_memory_id) REFERENCES memories(id) ON DELETE CASCADE
);

Read the full file on GitHub · 422 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3mo ago First seen · 422 lines · 35 tokens per session scan A e558c01c844b

Subscribe to this mod's changes

memory-architecture is an agent published in the GitHub repository Matt-Dionis/claude-code-configs (619 stars, last pushed 1y ago), licensed MIT. It adds 35 tokens to every session and 2,882 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

memory-architecture compared with agents from other repositories

memory-architecture next to 6 agents from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
memory-architectureMatt-Dionis/claude-code-configsAgent6191y agoMITA35Claude Code
performance-profilersaeedkolivand/ai-job-hunter-appAgent66todayApache-2.0A68Claude Code
wiki-dev-eng-schemaodere-pro/claude-wiki-pages-pluginAgent35mo agoMITA161Claude Code
query optimizerkhalilbenaz/MDANAgent01mo agoMITA6Claude Code
indexing specialistkhalilbenaz/MDANAgent01mo agoMITA7Claude Code
performance analystkhalilbenaz/MDANAgent01mo agoMITA6Claude Code
performance-oracleronronner02/codepilot-agentAgent03mo agoMITA0Claude Code