$npx -y skills add Dicklesworthstone/agent_flywheel_clawdbot_skills_and_integrations --skill cmCASS Memory System - procedural memory for AI coding agents. Three-layer cognitive architecture with confidence decay, anti-pattern learning, cross-agent knowledge transfer, trauma guard safety system. Bun/TypeScript CLI.
| 1 | # CM - CASS Memory System |
| 2 | |
| 3 | Procedural memory for AI coding agents. Transforms scattered sessions into persistent, cross-agent memory. Uses a three-layer cognitive architecture that mirrors human expertise development. |
| 4 | |
| 5 | ## Why This Exists |
| 6 | |
| 7 | AI coding agents accumulate valuable knowledge but it's: |
| 8 | - **Trapped in sessions** - Context lost when session ends |
| 9 | - **Agent-specific** - Claude doesn't know what Cursor learned |
| 10 | - **Unstructured** - Raw logs aren't actionable guidance |
| 11 | - **Subject to collapse** - Naive summarization loses critical details |
| 12 | |
| 13 | You've solved auth bugs three times this month across different agents. Each time you started from scratch. |
| 14 | |
| 15 | CM solves this with cross-agent learning: a pattern discovered in Cursor is immediately available to Claude Code. |
| 16 | |
| 17 | --- |
| 18 | |
| 19 | ## Three-Layer Cognitive Architecture |
| 20 | |
| 21 | ``` |
| 22 | ┌─────────────────────────────────────────────────────────────────────┐ |
| 23 | │ EPISODIC MEMORY (cass) │ |
| 24 | │ Raw session logs from all agents — the "ground truth" │ |
| 25 | │ Claude Code │ Codex │ Cursor │ Aider │ PI │ Gemini │ ChatGPT │ ...│ |
| 26 | └───────────────────────────┬─────────────────────────────────────────┘ |
| 27 | │ cass search |
| 28 | ▼ |
| 29 | ┌─────────────────────────────────────────────────────────────────────┐ |
| 30 | │ WORKING MEMORY (Diary) │ |
| 31 | │ Structured session summaries: accomplishments, decisions, etc. │ |
| 32 | └───────────────────────────┬─────────────────────────────────────────┘ |
| 33 | │ reflect + curate (automated) |
| 34 | ▼ |
| 35 | ┌─────────────────────────────────────────────────────────────────────┐ |
| 36 | │ PROCEDURAL MEMORY (Playbook) │ |
| 37 | │ Distilled rules with confidence tracking and decay │ |
| 38 | └─────────────────────────────────────────────────────────────────────┘ |
| 39 | ``` |
| 40 | |
| 41 | Every agent's sessions feed the shared memory. A pattern discovered in Cursor **automatically** helps Claude Code on the next session. |
| 42 | |
| 43 | --- |
| 44 | |
| 45 | ## The One Command You Need |
| 46 | |
| 47 | ```bash |
| 48 | cm context "<your task>" --json |
| 49 | ``` |
| 50 | |
| 51 | **Run this before starting any non-trivial task.** Returns: |
| 52 | - **relevantBullets** - Rules from playbook scored by task relevance |
| 53 | - **antiPatterns** - Things that have caused problems |
| 54 | - **historySnippets** - Past sessions (yours and other agents') |
| 55 | - **suggestedCassQueries** - Deeper investigation searches |
| 56 | |
| 57 | ### Filtering History by Source |
| 58 | |
| 59 | `historySnippets[].origin.kind` is `"local"` or `"remote"`. Remote hits include `origin.host`: |
| 60 | |
| 61 | ```json |
| 62 | { |
| 63 | "historySnippets": [ |
| 64 | { |
| 65 | "source_path": "~/.claude/sessions/session-001.jsonl", |
| 66 | "origin": { "kind": "local" } |
| 67 | }, |
| 68 | { |
| 69 | "source_path": "/home/user/.codex/sessions/session.jsonl", |
| 70 | "origin": { "kind": "remote", "host": "workstation" } |
| 71 | } |
| 72 | ] |
| 73 | } |
| 74 | ``` |
| 75 | |
| 76 | --- |
| 77 | |
| 78 | ## Confidence Decay System |
| 79 | |
| 80 | Rules aren't immortal. Confidence decays without revalidation: |
| 81 | |
| 82 | | Mechanism | Effect | |
| 83 | |-----------|--------| |
| 84 | | **90-day half-life** | Confidence halves every 90 days without feedback | |
| 85 | | **4x harmful multiplier** | One mistake counts 4× as much as one success | |
| 86 | | **Maturity progression** | `candidate` → `established` → `proven` | |
| 87 | |
| 88 | ### Score Decay Visualization |
| 89 | |
| 90 | ``` |
| 91 | Initial score: 10.0 (10 helpful marks today) |
| 92 | |
| 93 | After 90 days (half-life): 5.0 |
| 94 | After 180 days: 2.5 |
| 95 | After 270 days: 1.25 |
| 96 | After 365 days: 0.78 |
| 97 | ``` |
| 98 | |
| 99 | ### Effective Score Formula |
| 100 | |
| 101 | ```typescript |
| 102 | effectiveScore = decayedHelpful - (4 × decayedHarmful) |
| 103 | |
| 104 | // Where decay factor = 0.5 ^ (daysSinceFeedback / 90) |
| 105 | ``` |
| 106 | |
| 107 | ### Maturity State Machine |
| 108 | |
| 109 | ``` |
| 110 | ┌──────────┐ ┌─────────────┐ ┌────────┐ |
| 111 | │ candidate│──────▶│ established │───▶│ proven │ |
| 112 | └──────────┘ └─────────────┘ └────────┘ |
| 113 | │ │ │ |
| 114 | │ │ (harmful >25%) │ |
| 115 | │ ▼ │ |
| 116 | │ ┌─────────────┐ │ |
| 117 | └────────────▶│ deprecated │◀─────────┘ |
| 118 | └─────────────┘ |
| 119 | ``` |
| 120 | |
| 121 | **Transition Rules:** |
| 122 | |
| 123 | | Transition | Criteria | |
| 124 | |------------|----------| |
| 125 | | `candidate` → `established` | 3+ helpful, harmful ratio <25% | |
| 126 | | `established` → `proven` | 10+ helpful, harmful ratio <10% | |
| 127 | | `any` → `deprecated` | Harmful ratio >25% OR explicit deprecation | |
| 128 | |
| 129 | --- |
| 130 | |
| 131 | ## Anti-Pattern Learning |
| 132 | |
| 133 | Bad rules don't just get deleted. They become warnings: |
| 134 | |
| 135 | ``` |
| 136 | "Cache auth tokens for performance" |
| 137 | ↓ (3 harmful marks) |
| 138 | "PITFALL: Don't cache auth tokens without expiry validation" |
| 139 | ``` |
| 140 | |
| 141 | When a rule is marked harmful multiple times (>50% harmful ratio with 3+ marks), it's automatically inverted into an anti-pattern. |
| 142 | |
| 143 | --- |
| 144 | |
| 145 | ## ACE Pipeline (How Rules Are Created) |