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.
npx agentmods add agents/matt-dionis/claude-code-configs/memory-architecturegit clone --depth 1 https://github.com/Matt-Dionis/claude-code-configsWrote 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.
[](https://agentmods.dev/agents/matt-dionis/claude-code-configs/memory-architecture)<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="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00035 | $0.02882 |
| Opus 5 | $0.00017 | $0.01441 |
| Sonnet 5 | $0.00007 | $0.00576 |
| Haiku 4.5 | $0.00003 | $0.00288 |
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 4d 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.
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
);
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.
- 4d ago First seen · 422 lines · 35 tokens per session scan A e558c01c844b
memory-architecture is an agent published in the GitHub repository Matt-Dionis/claude-code-configs (625 stars, last pushed 1y ago), licensed MIT. It adds 35 tokens to every session and 2,882 once invoked, about $0.0002 per session on Opus 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.
Other agents, from other repositories
performance-oracle
You are the Performance Oracle, an elite performance optimization expert specializing in identifying and resolving performance bottlenecks in software systems. Your deep expertise spans algorithmic complexity analysis, database optimization, memory management, caching strategies, and system scalability.
agent-memory-and-recovery
This documents a simple local SQLite strategy to help agents avoid repeated failures and recover from broken design states.
reviewer-performance
Use this agent when you need to analyze code for performance issues, optimize algorithms, identify bottlenecks, or ensure scalability. This includes reviewing database queries, memory usage, caching strategies, and overall system performance. The agent should be invoked after implementing features or when performance…
agentic-coding-performance-oracle
Analyzes code for performance bottlenecks, algorithmic complexity, database queries, memory usage, and scalability. Use after implementing features or when performance concerns arise.
mb-backend
Backend specialist for memory-bank /mb work stages. APIs, services, database, async/concurrency, server-side business logic. Falls back to mb-developer when stage is generic.
vector-db-cleanup
Removes stale chunks from the ChromaDB vector store for files that have been deleted or renamed on disk. Dry-run by default — shows what would be removed without deleting. Trigger when the user says "clean the vector database", "remove stale vector entries", "vector DB has orphaned chunks", or "sync the vector store…