cass-memory

Procedural memory for AI coding agents.
Transforms scattered agent sessions into persistent, cross-agent memory—so every agent learns from every other agent's experience.
One-liner install (Linux/macOS):
curl -fsSL "https://raw.githubusercontent.com/Dicklesworthstone/cass_memory_system/main/install.sh?$(date +%s)" \
| bash -s -- --easy-mode --verify
Or via package managers:
# macOS/Linux (Homebrew)
brew install dicklesworthstone/tap/cm
# Windows (Scoop)
scoop bucket add dicklesworthstone https://github.com/Dicklesworthstone/scoop-bucket
scoop install dicklesworthstone/cm
🤖 Agent Quickstart (JSON)
Always use --json in agent contexts. stdout = data, stderr = diagnostics, exit 0 = success.
# 1) Get task-specific memory before you start
cm context "implement auth rate limiting" --json
# 2) See the minimum viable workflow
cm quickstart --json
# 3) Build the playbook (memory onboarding)
cm onboard status --json
cm onboard sample --fill-gaps --json
cm onboard read /path/to/session.jsonl --template --json
cm onboard mark-done /path/to/session.jsonl
Table of Contents
- Why This Exists
- How It Works
- Key Features
- For AI Agents
- Installation
- CLI Reference
- The ACE Pipeline
- Data Models
- Scoring Algorithm
- Configuration
- MCP Server
- Architecture & Engineering
- Deep Dive: Core Algorithms
- Privacy & Security
- Trauma Guard: Safety System
- Performance Characteristics
- Starter Playbooks
- Extensibility
- Troubleshooting
- Design Philosophy
- Comparison with Alternatives
- Roadmap
💡 Why This Exists
The Problem
AI coding agents accumulate valuable knowledge through sessions: debugging strategies, code patterns, user preferences, project-specific insights. But this knowledge is:
- Trapped in sessions — Each session ends, context is lost forever
- Agent-specific — Claude Code doesn't know what Cursor learned yesterday
- Unstructured — Raw conversation logs aren't actionable as guidance
- Subject to collapse — Naive summarization loses critical nuances and details
You've solved authentication bugs three times this month across different agents. Each time, you started from scratch because the knowledge from previous sessions was inaccessible.
The Solution
cass-memory implements a three-layer cognitive architecture that transforms raw session logs into actionable, confidence-tracked rules:
| Layer | Role | Implementation |
|---|
| Episodic Memory | Raw ground truth from all agents | cass search engine |
| Working Memory | Structured session summaries | Diary entries |
| Procedural Memory | Distilled rules with tracking | Playbook bullets |
This mirrors how human expertise develops: raw experiences (episodic) are consolidated into structured memories (working), which eventually become automatic knowledge (procedural).
Who Benefits
- AI Agents: Get relevant rules and historical context before starting any task
- Developers: Build institutional memory that persists across tools and sessions
- Teams: Share patterns discovered by any team member's AI assistant
- Power Users: Create sophisticated workflows that leverage cross-agent learning
🔄 How It Works
┌─────────────────────────────────────────────────────────────────────┐
│ EPISODIC MEMORY (cass) │
│ Raw session logs from all agents — the "ground truth" │
│ Claude Code │ Codex │ Cursor │ Aider │ PI │ Gemini │ ChatGPT │ ... │
└───────────────────────────┬─────────────────────────────────────────┘
│ cass search
▼
┌─────────────────────────────────────────────────────────────────────┐
│ WORKING MEMORY (Diary) │
│ Structured session summaries bridging raw logs to rules │
│ accomplishments │ decisions │ challenges │ outcomes │
└───────────────────────────┬─────────────────────────────────────────┘
│ reflect + curate (automated)
▼
┌─────────────────────────────────────────────────────────────────────┐
│ PROCEDURAL MEMORY (Playbook) │
│ Distilled rules with confidence tracking │
│ Rules │ Anti-patterns │ Feedback │ Decay │
└─────────────────────────────────────────────────────────────────────┘
Every agent's sessions feed the shared memory. A pattern discovered in Cursor automatically helps Claude Code on the next session.
✨ Key Features
Cross-Agent Learning
Sessions from all your AI coding agents feed a unified knowledge base:
Claude Code session → ┐
Cursor session → │→ Unified Playbook → All agents benefit
Codex session → │
Aider session → │
PI session → ┘
A debugging technique discovered in Cursor is immediately available to Claude Code. No manual knowledge transfer required.
Confidence Decay System
Rules aren't immortal. A rule helpful 8 times in January but never validated since loses confidence over time:
- 90-day half-life: Confidence halves every 90 days without revalidation
- 4x harmful multiplier: One mistake counts 4× as much as one success
- Maturity progression:
candidate → established → proven
This prevents stale rules from polluting your playbook while rewarding consistently helpful guidance.
Anti-Pattern Learning
Bad rules don't just get deleted—they become warnings:
"Cache auth tokens for performance"
↓ (3 harmful marks)
"PITFALL: Don't cache auth tokens without expiry validation"
When a rule is marked harmful multiple times, it's automatically inverted into an anti-pattern that warns future agents away from the same mistake.
Scientific Validation
New rules aren't blindly accepted. Before a rule joins your playbook, it's validated against your cass history:
Proposed rule: "Always check token expiry before auth debugging"
↓
Evidence gate: Search cass for sessions where this applied
↓
Result: 5 sessions found, 4 successful outcomes → ACCEPT
Rules without historical evidence are flagged as candidates until proven.
Graceful Degradation
The system works even when components are missing:
| Condition | Behavior |
|---|
| No cass | Playbook-only scoring, no history snippets |
| No playbook | Empty playbook, commands still work |
| No LLM | Deterministic reflection, no semantic enhancement |
| Offline | Cached playbook + local diary |
You always get value, even in degraded conditions.
🤖 For AI Agents: The Most Important Section
cass-memory is designed specifically for AI coding agents—not just as an afterthought, but as a first-class design goal. When you're an AI agent working on a codebase, cross-agent memory becomes invaluable: rules learned by other agents, context about design decisions, debugging approaches that worked, and institutional memory that would otherwise be lost.
Why Cross-Agent Memory Matters
Imagine you're Claude Code working on a React authentication bug. With cass-memory, you can instantly access:
- Rules extracted from previous Claude sessions about auth patterns
- Debugging strategies discovered by Cursor last week
- Anti-patterns identified when Codex hit the same issue
- Historical context from Aider about the codebase's auth architecture
This cross-pollination of knowledge across different AI agents is transformative. Each agent has different strengths, different context windows, and encounters different problems. cass-memory unifies all this collective intelligence into a single, searchable, actionable knowledge base.
The One Command You Need
cm context "<your task>" --json
Run this command before starting any non-trivial task. It returns:
- Relevant rules from the playbook (scored by task relevance)
- Historical context from past sessions (yours and other agents')
- Anti-patterns to avoid (things that have caused problems)
- Suggested searches for deeper investigation
Self-Documenting API
cass-memory teaches agents how to use it—no external documentation required:
# Quick capability check and self-explanation
cm quickstart --json
# → Returns complete explanation of the system and how to use it
# System health and available features
cm doctor --json
# → { checks: [...], recommendations: [...], ... }
# Get relevant context for a task
cm context "implement user authentication" --json
# → { relevantBullets: [...], antiPatterns: [...], historySnippets: [...] }
Structured Output Format
Every command supports --json for machine-readable output:
cm context "fix the auth timeout bug" --json
{
"success": true,
"task": "fix the auth timeout bug",
"relevantBullets": [
{
"id": "b-8f3a2c",
"content": "Always check token expiry before other auth debugging",
"effectiveScore": 8.5,
"maturity": "proven",
"relevanceScore": 0.92,
"reasoning": "Extracted from 5 successful sessions"
}
],
"antiPatterns": [
{
"id": "b-x7k9p1",
"content": "Don't cache auth tokens without expiry validation",
"effectiveScore": 3.2
}
],
"historySnippets": [
{
"source_path": "~/.claude/sessions/session-001.jsonl",
"agent": "claude",
"origin": { "kind": "local" },
"snippet": "Fixed timeout by increasing token refresh interval...",
"score": 0.87
}
],
"suggestedCassQueries": [
"cass search 'authentication timeout' --robot --days 30"
],
"degraded": null
}
Design principle: stdout contains only parseable JSON data; all diagnostics go to stderr.
Filtering remote vs local history: historySnippets[].origin.kind is "local" or "remote"; remote hits include origin.host.
Error Handling for Agents
Errors are structured and include recovery hints:
{
"success": false,
"code": "PLAYBOOK_NOT_FOUND",
"error": "Playbook file not found at ~/.cass-memory/playbook.yaml",
"hint": "Run 'cm init' to create a new playbook",
"retryable": false
}
Token Budget Management
AI agents have context limits. cass-memory provides controls to manage output size:
| Flag | Effect |
|---|
--limit N | Cap number of rules returned |
--min-score N | Only return rules above score threshold |
--no-history | Skip historical snippets (faster, smaller) |
--json | Structured output for parsing |
Inline Feedback (During Work)
When a rule helps or hurts during your work, leave inline feedback:
// [cass: helpful b-8f3a2c] - this rule saved me from a rabbit hole
// [cass: harmful b-x7k9p1] - this advice was wrong for our use case