Back
15/65
Lesson 15
8 min
The Memory System
Build procedural memory for agents
Ready to level up?
Mark complete to track your learning progress.
Build procedural memory for agents
Mark complete to track your learning progress.
Build procedural memory for agents that improves over time.
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.
Automatically extract rules from past sessions
Get relevant rules before starting tasks
Learn what NOT to do from past mistakes
Memory improves with every session
Click a session or run auto-demo to see analysis
Always use connection pooling with max 20 connections
Use strict: true in tsconfig from project start
Check for circular refs before debugging memory leaks
Token refresh needs mutex to prevent race conditions
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
PRs need at least one approval plus passing CI
The cm onboard command guides you through analyzing past sessions and extracting valuable rules:
cm onboard statusCheck status and see recommendations
cm onboard sample --fill-gapsGet sessions filtered by playbook gaps
cm onboard read /path/session.jsonl --templateRead session with rich context
cm playbook add "rule" --category "category"Add extracted rules
cm onboard mark-done /path/session.jsonlMark session as processed
Before starting complex tasks, retrieve relevant context from your playbook:
$ 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"]}
Run cm context "<task>" --json before non-trivial work
Reference rule IDs when following them (e.g., "Following b-8f3a2c...")
Leave inline comments when rules help or hurt
Just finish your work. Learning happens automatically.
// 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
debuggingProblem-solving techniques
securitySecurity best practices
performanceOptimization patterns
architectureDesign decisions
testingTest strategies
toolingTool-specific knowledge
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
1# Check your playbook status2$ cm onboard status34# Get context for your current task5$ cm context "refactor database queries" --json67# See what sessions need analysis8$ cm onboard sample --fill-gaps