Back
15/61
Lesson 15
8 min

The Memory System

Build procedural memory for agents

New to ACFS?

Complete the setup wizard first to get the most from these lessons.

Go to Choose Your OS
Goal

Build procedural memory for agents that improves over time.

What Is CM?

CM (CASS Memory System) gives AI agents effective memory by extracting lessons from past sessions and making them retrievable for future work.

Think of it like how humans learn: you encounter a problem, solve it, and remember the solution. CM does this for your agents automatically.

Lesson Extraction

Automatically extract rules from past sessions

Context Retrieval

Get relevant rules before starting tasks

Anti-Patterns

Learn what NOT to do from past mistakes

Continuous Learning

Memory improves with every session

How It Works

Memory System Dashboard
Session Archive8 sessions
Analysis Engine
Extract
Correlate
Synthesize
Store

Click a session or run auto-demo to see analysis

Memory Bank8 rules
Code Patterns

Always use connection pooling with max 20 connections

Use strict: true in tsconfig from project start

Debugging Tips

Check for circular refs before debugging memory leaks

Token refresh needs mutex to prevent race conditions

Architecture Rules

Rate limiters need both IP and user-level buckets

CI must run type-check before tests to fail fast

Cache invalidation via TTL + event-driven hybrid

Team Preferences

PRs need at least one approval plus passing CI

Describe your task to find relevant memories...
Note
CM builds a "playbook" of rules over time. The more sessions you analyze, the smarter your agents become!

Onboarding: Building Your Playbook

The cm onboard command guides you through analyzing past sessions and extracting valuable rules:

1
cm onboard status

Check status and see recommendations

2
cm onboard sample --fill-gaps

Get sessions filtered by playbook gaps

3
cm onboard read /path/session.jsonl --template

Read session with rich context

4
cm playbook add "rule" --category "category"

Add extracted rules

5
cm onboard mark-done /path/session.jsonl

Mark session as processed

Essential Commands

Check playbook status and recommendations
Get sessions to analyze (filtered by gaps)
Read a session with rich context
Add an extracted rule
Mark session as processed
Get relevant context for a task

Using Context Before Tasks

Before starting complex tasks, retrieve relevant context from your playbook:

json
$ cm context "implement user authentication" --json
{
"relevantBullets": [
{
"id": "b-8f3a2c",
"rule": "Always use bcrypt with cost factor ≥12 for password hashing",
"category": "security"
},
{
"id": "b-2d4e1f",
"rule": "Store JWT secrets in environment variables, never in code",
"category": "security"
}
],
"antiPatterns": [
{
"id": "ap-9c7b3d",
"pattern": "Using MD5 for password storage",
"consequence": "Trivially reversible, security vulnerability"
}
],
"historySnippets": [
{
"session": "2025-01-10.jsonl",
"summary": "Implemented OAuth2 flow with refresh tokens"
}
],
"suggestedCassQueries": [
"authentication error handling",
"JWT refresh token"
]
}
Pro Tip
Reference rule IDs in your work. For example: "Following b-8f3a2c, using bcrypt with cost 12..."

The Memory Protocol

1

START

Run cm context "<task>" --json before non-trivial work

2

WORK

Reference rule IDs when following them (e.g., "Following b-8f3a2c...")

3

FEEDBACK

Leave inline comments when rules help or hurt

4

END

Just finish your work. Learning happens automatically.

typescript
// Feedback format in code:
// [cass: helpful b-8f3a2c] - bcrypt recommendation prevented weak hashing
// [cass: harmful b-xyz123] - this rule didn't apply to async context

Rule Categories

debugging

Problem-solving techniques

security

Security best practices

performance

Optimization patterns

architecture

Design decisions

testing

Test strategies

tooling

Tool-specific knowledge

Best Practices

Run cm context before complex tasks

Don't reinvent the wheel—check what you've learned

Extract specific, actionable rules

'Use bcrypt cost ≥12' is better than 'be secure'

Include anti-patterns

What NOT to do is as valuable as what to do

Categorize rules properly

Makes retrieval more accurate

Provide feedback on rules

Helps the system learn which rules are actually useful

Try It Now

bash
1# Check your playbook status
2$ cm onboard status
3
4# Get context for your current task
5$ cm context "refactor database queries" --json
6
7# See what sessions need analysis
8$ cm onboard sample --fill-gaps

Ready to level up?

Mark complete to track your learning progress.