[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6ES3DZKWWHKKMPTFSPSCE93":3,"skill-same:01M6ES3DZKWWHKKMPTFSPSCE93":77},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":43,"linkOnly":44,"markdownContent":45,"markdownBody":46,"frontMatter":47,"refName":48,"commitSha":49,"skillDirectory":50,"forksCount":51,"repositoryHtmlUrl":52,"repositoryHomepageUrl":53,"ownerHtmlUrl":54,"ownerBlogUrl":6,"ownerDescription":55,"updatedAt":56,"install":57,"resources":70},"01M6ES3DZKWWHKKMPTFSPSCE93","cm",null,"CASS 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\u002FTypeScript CLI.","ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",66,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fdicklesworthstone\u002Fcm\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[5,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42],"system","cass","with","cognitive architecture","memory system","pattern","three","knowledge transfer","coding","cli","knowledge","learning","guard","Safety","ai coding agents","architecture","memory","coding agents","typescript","2026-11-10 10:12:30",false,"---\nname: cm\ndescription: \"CASS 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\u002FTypeScript CLI.\"\n---\n\n# CM - CASS Memory System\n\nProcedural memory for AI coding agents. Transforms scattered sessions into persistent, cross-agent memory. Uses a three-layer cognitive architecture that mirrors human expertise development.\n\n## Why This Exists\n\nAI coding agents accumulate valuable knowledge but it's:\n- **Trapped in sessions** - Context lost when session ends\n- **Agent-specific** - Claude doesn't know what Cursor learned\n- **Unstructured** - Raw logs aren't actionable guidance\n- **Subject to collapse** - Naive summarization loses critical details\n\nYou've solved auth bugs three times this month across different agents. Each time you started from scratch.\n\nCM solves this with cross-agent learning: a pattern discovered in Cursor is immediately available to Claude Code.\n\n---\n\n## Three-Layer Cognitive Architecture\n\n```\n┌─────────────────────────────────────────────────────────────────────┐\n│                    EPISODIC MEMORY (cass)                           │\n│   Raw session logs from all agents — the \"ground truth\"             │\n│   Claude Code │ Codex │ Cursor │ Aider │ PI │ Gemini │ ChatGPT │ ...│\n└───────────────────────────┬─────────────────────────────────────────┘\n                            │ cass search\n                            ▼\n┌─────────────────────────────────────────────────────────────────────┐\n│                    WORKING MEMORY (Diary)                           │\n│   Structured session summaries: accomplishments, decisions, etc.    │\n└───────────────────────────┬─────────────────────────────────────────┘\n                            │ reflect + curate (automated)\n                            ▼\n┌─────────────────────────────────────────────────────────────────────┐\n│                    PROCEDURAL MEMORY (Playbook)                     │\n│   Distilled rules with confidence tracking and decay                │\n└─────────────────────────────────────────────────────────────────────┘\n```\n\nEvery agent's sessions feed the shared memory. A pattern discovered in Cursor **automatically** helps Claude Code on the next session.\n\n---\n\n## The One Command You Need\n\n```bash\ncm context \"\u003Cyour task>\" --json\n```\n\n**Run this before starting any non-trivial task.** Returns:\n- **relevantBullets** - Rules from playbook scored by task relevance\n- **antiPatterns** - Things that have caused problems\n- **historySnippets** - Past sessions (yours and other agents')\n- **suggestedCassQueries** - Deeper investigation searches\n\n### Filtering History by Source\n\n`historySnippets[].origin.kind` is `\"local\"` or `\"remote\"`. Remote hits include `origin.host`:\n\n```json\n{\n  \"historySnippets\": [\n    {\n      \"source_path\": \"~\u002F.claude\u002Fsessions\u002Fsession-001.jsonl\",\n      \"origin\": { \"kind\": \"local\" }\n    },\n    {\n      \"source_path\": \"\u002Fhome\u002Fuser\u002F.codex\u002Fsessions\u002Fsession.jsonl\",\n      \"origin\": { \"kind\": \"remote\", \"host\": \"workstation\" }\n    }\n  ]\n}\n```\n\n---\n\n## Confidence Decay System\n\nRules aren't immortal. Confidence decays without revalidation:\n\n| Mechanism | Effect |\n|-----------|--------|\n| **90-day half-life** | Confidence halves every 90 days without feedback |\n| **4x harmful multiplier** | One mistake counts 4× as much as one success |\n| **Maturity progression** | `candidate` → `established` → `proven` |\n\n### Score Decay Visualization\n\n```\nInitial score: 10.0 (10 helpful marks today)\n\nAfter 90 days (half-life):   5.0\nAfter 180 days:              2.5\nAfter 270 days:              1.25\nAfter 365 days:              0.78\n```\n\n### Effective Score Formula\n\n```typescript\neffectiveScore = decayedHelpful - (4 × decayedHarmful)\n\n\u002F\u002F Where decay factor = 0.5 ^ (daysSinceFeedback \u002F 90)\n```\n\n### Maturity State Machine\n\n```\n  ┌──────────┐       ┌─────────────┐    ┌────────┐\n  │ candidate│──────▶│ established │───▶│ proven │\n  └──────────┘       └─────────────┘    └────────┘\n       │                   │                  │\n       │                   │ (harmful >25%)   │\n       │                   ▼                  │\n       │             ┌─────────────┐          │\n       └────────────▶│ deprecated  │◀─────────┘\n                     └─────────────┘\n```\n\n**Transition Rules:**\n\n| Transition | Criteria |\n|------------|----------|\n| `candidate` → `established` | 3+ helpful, harmful ratio \u003C25% |\n| `established` → `proven` | 10+ helpful, harmful ratio \u003C10% |\n| `any` → `deprecated` | Harmful ratio >25% OR explicit deprecation |\n\n---\n\n## Anti-Pattern Learning\n\nBad rules don't just get deleted. They become warnings:\n\n```\n\"Cache auth tokens for performance\"\n    ↓ (3 harmful marks)\n\"PITFALL: Don't cache auth tokens without expiry validation\"\n```\n\nWhen a rule is marked harmful multiple times (>50% harmful ratio with 3+ marks), it's automatically inverted into an anti-pattern.\n\n---\n\n## ACE Pipeline (How Rules Are Created)\n\n```\nGenerator → Reflector → Validator → Curator\n```\n\n| Stage | Role | LLM? |\n|-------|------|------|\n| **Generator** | Pre-task context hydration (`cm context`) | No |\n| **Reflector** | Extract patterns from sessions (`cm reflect`) | Yes |\n| **Validator** | Evidence gate against cass history | Yes |\n| **Curator** | Deterministic delta merge | **No** |\n\n**Critical:** Curator has NO LLM to prevent context collapse from iterative drift. LLMs propose patterns; deterministic logic manages them.\n\n### Scientific Validation\n\nBefore a rule joins your playbook, it's validated against cass history:\n\n```\nProposed rule: \"Always check token expiry before auth debugging\"\n    ↓\nEvidence gate: Search cass for sessions where this applied\n    ↓\nResult: 5 sessions found, 4 successful outcomes → ACCEPT\n```\n\nRules without historical evidence are flagged as candidates until proven.\n\n---\n\n## Commands Reference\n\n### Context Retrieval (Primary Workflow)\n\n```bash\n# THE MAIN COMMAND - run before non-trivial tasks\ncm context \"implement user authentication\" --json\n\n# Limit results for token budget\ncm context \"fix bug\" --json --limit 5 --no-history\n\n# With workspace filter\ncm context \"refactor\" --json --workspace \u002Fpath\u002Fto\u002Fproject\n\n# Self-documenting explanation\ncm quickstart --json\n\n# System health\ncm doctor --json\ncm doctor --fix  # Auto-fix issues\n\n# Find similar rules\ncm similar \"error handling best practices\"\n```\n\n### Playbook Management\n\n```bash\ncm playbook list                              # All rules\ncm playbook get b-8f3a2c                      # Rule details\ncm playbook add \"Always run tests first\"      # Add rule\ncm playbook add --file rules.json             # Batch add from file\ncm playbook add --file rules.json --session \u002Fpath\u002Fsession.jsonl  # Track source\ncm playbook remove b-xyz --reason \"Outdated\"  # Remove\ncm playbook export > backup.yaml              # Export\ncm playbook import shared.yaml                # Import\ncm playbook bootstrap react                   # Apply starter to existing\n\ncm top 10                                     # Top effective rules\ncm stale --days 60                            # Rules without recent feedback\ncm why b-8f3a2c                               # Rule provenance\ncm stats --json                               # Playbook health metrics\n```\n\n### Learning & Feedback\n\n```bash\n# Manual feedback\ncm mark b-8f3a2c --helpful\ncm mark b-xyz789 --harmful --reason \"Caused regression\"\ncm undo b-xyz789                              # Revert feedback\n\n# Session outcomes (positional: status, rules)\ncm outcome success b-8f3a2c,b-def456\ncm outcome failure b-x7k9p1 --summary \"Auth approach failed\"\ncm outcome-apply                              # Apply to playbook\n\n# Reflection (usually automated)\ncm reflect --days 7 --json\ncm reflect --session \u002Fpath\u002Fto\u002Fsession.jsonl   # Single session\ncm reflect --workspace \u002Fpath\u002Fto\u002Fproject       # Project-specific\n\n# Validation\ncm validate \"Always check null before dereferencing\"\n\n# Audit sessions against rules\ncm audit --days 30\n\n# Deprecate permanently\ncm forget b-xyz789 --reason \"Superseded by better pattern\"\n```\n\n### Onboarding (Agent-Native)\n\nZero-cost playbook building using your existing agent:\n\n```bash\ncm onboard status                             # Check progress\ncm onboard gaps                               # Category gaps\ncm onboard sample --fill-gaps                 # Prioritized sessions\ncm onboard sample --agent claude --days 14    # Filter by agent\u002Ftime\ncm onboard sample --workspace \u002Fpath\u002Fproject   # Filter by workspace\ncm onboard sample --include-processed         # Re-analyze sessions\ncm onboard read \u002Fpath\u002Fsession.jsonl --template  # Rich context\ncm onboard mark-done \u002Fpath\u002Fsession.jsonl      # Mark processed\ncm onboard reset                              # Start fresh\n```\n\n### Trauma Guard (Safety System)\n\n```bash\ncm trauma list                                # Active patterns\ncm trauma add \"DROP TABLE\" --description \"Mass deletion\" --severity critical\ncm trauma heal t-abc --reason \"Intentional migration\"\ncm trauma remove t-abc\ncm trauma scan --days 30                      # Scan for traumas\ncm trauma import shared-traumas.yaml\n\ncm guard --install                            # Claude Code hook\ncm guard --git                                # Git pre-commit hook\ncm guard --install --git                      # Both\ncm guard --status                             # Check installation\n```\n\n### System Commands\n\n```bash\ncm init                                       # Initialize\ncm init --starter typescript                  # With template\ncm init --force                               # Reinitialize (creates backup)\ncm starters                                   # List templates\ncm serve --port 3001                          # MCP server\ncm usage                                      # LLM cost stats\ncm privacy status                             # Privacy settings\ncm privacy enable                             # Enable cross-agent enrichment\ncm privacy disable                            # Disable enrichment\ncm project --format agents.md                 # Export for AGENTS.md\n```\n\n---\n\n## Starter Playbooks\n\nStarting with an empty playbook is daunting. Starters provide curated best practices:\n\n```bash\ncm starters                    # List available\ncm init --starter typescript   # Initialize with starter\ncm playbook bootstrap react    # Apply to existing playbook\n```\n\n### Built-in Starters\n\n| Starter | Focus | Rules |\n|---------|-------|-------|\n| **general** | Universal best practices | 5 |\n| **typescript** | TypeScript\u002FNode.js patterns | 4 |\n| **react** | React\u002FNext.js development | 4 |\n| **python** | Python\u002FFastAPI\u002FDjango | 4 |\n| **node** | Node.js\u002FExpress services | 4 |\n| **rust** | Rust service patterns | 4 |\n\n### Custom Starters\n\nCreate YAML files in `~\u002F.cass-memory\u002Fstarters\u002F`:\n\n```yaml\n# ~\u002F.cass-memory\u002Fstarters\u002Fdjango.yaml\nname: django\ndescription: Django web framework best practices\nbullets:\n  - content: \"Always use Django's ORM for database operations\"\n    category: database\n    maturity: established\n    tags: [django, orm]\n```\n\n---\n\n## Inline Feedback (During Work)\n\nLeave feedback in code comments. Parsed during reflection:\n\n```typescript\n\u002F\u002F [cass: helpful b-8f3a2c] - this rule saved me from a rabbit hole\n\n\u002F\u002F [cass: harmful b-x7k9p1] - this advice was wrong for our use case\n```\n\n---\n\n## Agent Protocol\n\n```\n1. START:    cm context \"\u003Ctask>\" --json\n2. WORK:     Reference rule IDs when following them (e.g., \"Following b-8f3a2c...\")\n3. FEEDBACK: Leave inline comments when rules help\u002Fhurt\n4. END:      Just finish. Learning happens automatically.\n```\n\n**You do NOT need to:**\n- Run `cm reflect` (automation handles this)\n- Run `cm mark` manually (use inline comments)\n- Manually add rules to the playbook\n\n---\n\n## Gap Analysis Categories\n\n| Category | Keywords |\n|----------|----------|\n| `debugging` | error, fix, bug, trace, stack |\n| `testing` | test, mock, assert, expect, jest |\n| `architecture` | design, pattern, module, abstraction |\n| `workflow` | task, CI\u002FCD, deployment |\n| `documentation` | comment, README, API doc |\n| `integration` | API, HTTP, JSON, endpoint |\n| `collaboration` | review, PR, team |\n| `git` | branch, merge, commit |\n| `security` | auth, token, encrypt, permission |\n| `performance` | optimize, cache, profile |\n\n**Category Status Thresholds:**\n\n| Status | Rule Count | Priority |\n|--------|------------|----------|\n| `critical` | 0 rules | High |\n| `underrepresented` | 1-2 rules | Medium |\n| `adequate` | 3-10 rules | Low |\n| `well-covered` | 11+ rules | None |\n\n---\n\n## Trauma Guard: Safety System\n\nThe \"hot stove\" principle—learn from past incidents and prevent recurrence.\n\n### How It Works\n\n```\nSession History              Trauma Registry              Runtime Guard\n┌─────────────────┐         ┌─────────────────┐         ┌─────────────────┐\n│ rm -rf \u002F* (oops)│ ──────▶ │ Pattern: rm -rf │ ──────▶ │ BLOCKED: This   │\n│ \"sorry, I made  │  scan   │ Severity: FATAL │  hook   │ command matches │\n│  a mistake...\"  │         │ Session: abc123 │         │ a trauma pattern│\n└─────────────────┘         └─────────────────┘         └─────────────────┘\n```\n\n### Built-in Doom Patterns (20+)\n\n| Category | Examples |\n|----------|----------|\n| **Filesystem** | `rm -rf \u002F`, `rm -rf ~`, recursive deletes |\n| **Database** | `DROP DATABASE`, `TRUNCATE`, `DELETE FROM` without WHERE |\n| **Git** | `git push --force` to main\u002Fmaster, `git reset --hard` |\n| **Infrastructure** | `terraform destroy -auto-approve`, `kubectl delete namespace` |\n| **Cloud** | `aws s3 rm --recursive`, destructive CloudFormation |\n\n### Pattern Storage\n\n| Scope | Location | Purpose |\n|-------|----------|---------|\n| **Global** | `~\u002F.cass-memory\u002Ftraumas.jsonl` | Personal patterns |\n| **Project** | `.cass\u002Ftraumas.jsonl` | Commit to repo for team |\n\n### Pattern Lifecycle\n\n- **Active**: Blocks matching commands\n- **Healed**: Temporarily bypassed (with reason and timestamp)\n- **Deleted**: Removed (can be re-added)\n\n---\n\n## MCP Server\n\nRun as MCP server for agent integration:\n\n```bash\n# Local-only (recommended)\ncm serve --port 3001\n\n# With auth token (for non-loopback)\nMCP_HTTP_TOKEN=\"\u003Crandom>\" cm serve --host 0.0.0.0 --port 3001\n```\n\n### Tools Exposed\n\n| Tool | Purpose | Parameters |\n|------|---------|------------|\n| `cm_context` | Get rules + history | `task, limit?, history?, days?, workspace?` |\n| `cm_feedback` | Record feedback | `bulletId, helpful?, harmful?, reason?` |\n| `cm_outcome` | Record session outcome | `sessionId, outcome, rulesUsed?` |\n| `memory_search` | Search playbook\u002Fcass | `query, scope?, limit?, days?` |\n| `memory_reflect` | Trigger reflection | `days?, maxSessions?, dryRun?` |\n\n### Resources Exposed\n\n| URI | Purpose |\n|-----|---------|\n| `cm:\u002F\u002Fplaybook` | Current playbook state |\n| `cm:\u002F\u002Fdiary` | Recent diary entries |\n| `cm:\u002F\u002Foutcomes` | Session outcomes |\n| `cm:\u002F\u002Fstats` | Playbook health metrics |\n\n### Client Configuration\n\n**Claude Code** (`~\u002F.config\u002Fclaude\u002Fmcp.json`):\n```json\n{\n  \"mcpServers\": {\n    \"cm\": {\n      \"command\": \"cm\",\n      \"args\": [\"serve\"]\n    }\n  }\n}\n```\n\n---\n\n## Graceful Degradation\n\n| Condition | Behavior |\n|-----------|----------|\n| No cass | Playbook-only scoring, no history snippets |\n| No playbook | Empty playbook, commands still work |\n| No LLM | Deterministic reflection, no semantic enhancement |\n| Offline | Cached playbook + local diary |\n\n---\n\n## Output Format\n\nAll commands support `--json` for machine-readable output.\n\n**Design principle:** stdout = JSON only; diagnostics go to stderr.\n\n### Success Response\n\n```json\n{\n  \"success\": true,\n  \"task\": \"fix the auth timeout bug\",\n  \"relevantBullets\": [\n    {\n      \"id\": \"b-8f3a2c\",\n      \"content\": \"Always check token expiry before auth debugging\",\n      \"effectiveScore\": 8.5,\n      \"maturity\": \"proven\",\n      \"relevanceScore\": 0.92,\n      \"reasoning\": \"Extracted from 5 successful sessions\"\n    }\n  ],\n  \"antiPatterns\": [...],\n  \"historySnippets\": [...],\n  \"suggestedCassQueries\": [...],\n  \"degraded\": null\n}\n```\n\n### Error Response\n\n```json\n{\n  \"success\": false,\n  \"code\": \"PLAYBOOK_NOT_FOUND\",\n  \"error\": \"Playbook file not found\",\n  \"hint\": \"Run 'cm init' to create a new playbook\",\n  \"retryable\": false,\n  \"recovery\": [\"cm init\", \"cm doctor --fix\"],\n  \"docs\": \"README.md#-troubleshooting\"\n}\n```\n\n### Exit Codes\n\n| Code | Meaning |\n|------|---------|\n| 1 | Internal error |\n| 2 | User input\u002Fusage |\n| 3 | Configuration |\n| 4 | Filesystem |\n| 5 | Network |\n| 6 | cass error |\n| 7 | LLM\u002Fprovider error |\n\n---\n\n## Token Budget Management\n\n| Flag | Effect |\n|------|--------|\n| `--limit N` | Cap number of rules |\n| `--min-score N` | Only rules above threshold |\n| `--no-history` | Skip historical snippets (faster) |\n| `--json` | Structured output |\n\n---\n\n## Configuration\n\nConfig lives at `~\u002F.cass-memory\u002Fconfig.json` (global) and `.cass\u002Fconfig.json` (repo).\n\n**Precedence:** CLI flags > Repo config > Global config > Defaults\n\n**Security:** Repo config cannot override sensitive paths or user-level consent settings.\n\n### Key Options\n\n```json\n{\n  \"provider\": \"anthropic\",\n  \"model\": \"claude-sonnet-4-20250514\",\n  \"budget\": {\n    \"dailyLimit\": 0.10,\n    \"monthlyLimit\": 2.00\n  },\n  \"scoring\": {\n    \"decayHalfLifeDays\": 90,\n    \"harmfulMultiplier\": 4\n  },\n  \"maxBulletsInContext\": 50,\n  \"maxHistoryInContext\": 10,\n  \"sessionLookbackDays\": 7,\n  \"crossAgent\": {\n    \"enabled\": false,\n    \"consentGiven\": false,\n    \"auditLog\": true\n  },\n  \"remoteCass\": {\n    \"enabled\": false,\n    \"hosts\": [{\"host\": \"workstation\", \"label\": \"work\"}]\n  },\n  \"semanticSearchEnabled\": false,\n  \"embeddingModel\": \"Xenova\u002Fall-MiniLM-L6-v2\",\n  \"dedupSimilarityThreshold\": 0.85\n}\n```\n\n### Environment Variables\n\n| Variable | Purpose |\n|----------|---------|\n| `ANTHROPIC_API_KEY` | API key for Anthropic (Claude) |\n| `OPENAI_API_KEY` | API key for OpenAI |\n| `GOOGLE_GENERATIVE_AI_API_KEY` | API key for Google Gemini |\n| `CASS_PATH` | Path to cass binary |\n| `CASS_MEMORY_LLM` | Set to `none` for LLM-free mode |\n| `MCP_HTTP_TOKEN` | Auth token for non-loopback MCP server |\n\n---\n\n## Data Locations\n\n```\n~\u002F.cass-memory\u002F                  # Global (user-level)\n├── config.json                  # Configuration\n├── playbook.yaml                # Personal playbook\n├── diary\u002F                       # Session summaries\n├── outcomes\u002F                    # Session outcomes\n├── traumas.jsonl                # Trauma patterns\n├── starters\u002F                    # Custom starter playbooks\n├── onboarding-state.json        # Onboarding progress\n├── privacy-audit.jsonl          # Cross-agent audit trail\n├── processed-sessions.jsonl     # Reflection progress\n└── usage.jsonl                  # LLM cost tracking\n\n.cass\u002F                           # Project-level (in repo)\n├── config.json                  # Project-specific overrides\n├── playbook.yaml                # Project-specific rules\n├── traumas.jsonl                # Project-specific patterns\n└── blocked.yaml                 # Anti-patterns to block\n```\n\n---\n\n## Automating Reflection\n\n### Cron Job\n\n```bash\n# Daily at 2am\n0 2 * * * \u002Fusr\u002Flocal\u002Fbin\u002Fcm reflect --days 7 >> ~\u002F.cass-memory\u002Freflect.log 2>&1\n```\n\n### Claude Code Hook\n\n`.claude\u002Fhooks.json`:\n```json\n{\n  \"post-session\": [\"cm reflect --days 1\"]\n}\n```\n\n---\n\n## Privacy & Security\n\n### Local-First Design\n\n- All data stays on your machine\n- No cloud sync, no telemetry\n- Cross-agent enrichment is opt-in with explicit consent\n- Audit log for enrichment events\n\n### Secret Sanitization\n\nBefore processing, content is sanitized:\n- OpenAI\u002FAnthropic\u002FAWS\u002FGoogle API keys\n- GitHub tokens\n- JWTs\n- Passwords and secrets in config patterns\n\n### Privacy Controls\n\n```bash\ncm privacy status    # Check settings\ncm privacy enable    # Enable cross-agent enrichment\ncm privacy disable   # Disable enrichment\n```\n\n---\n\n## Performance Characteristics\n\n| Operation | Typical Latency |\n|-----------|-----------------|\n| `cm context` (cached) | 50-150ms |\n| `cm context` (cold) | 200-500ms |\n| `cm context` (no cass) | 30-80ms |\n| `cm reflect` (1 session) | 5-15s |\n| `cm reflect` (5 sessions) | 20-60s |\n| `cm playbook list` | \u003C50ms |\n| `cm similar` (keyword) | 20-50ms |\n| `cm similar` (semantic) | 100-300ms |\n\n### LLM Cost Estimates\n\n| Operation | Typical Cost |\n|-----------|--------------|\n| Reflect (1 session) | $0.01-0.05 |\n| Reflect (7 days) | $0.05-0.20 |\n| Validate (1 rule) | $0.005-0.01 |\n\nWith default budget ($0.10\u002Fday, $2.00\u002Fmonth): ~5-10 sessions\u002Fday.\n\n---\n\n## Batch Rule Addition\n\nAfter analyzing a session, add multiple rules at once:\n\n```bash\n# Create JSON file\ncat > rules.json \u003C\u003C 'EOF'\n[\n  {\"content\": \"Always run tests before committing\", \"category\": \"testing\"},\n  {\"content\": \"Check token expiry before auth debugging\", \"category\": \"debugging\"},\n  {\"content\": \"AVOID: Mocking entire modules in tests\", \"category\": \"testing\"}\n]\nEOF\n\n# Add all rules\ncm playbook add --file rules.json\n\n# Track which session they came from\ncm playbook add --file rules.json --session \u002Fpath\u002Fto\u002Fsession.jsonl\n\n# Or pipe from stdin\necho '[{\"content\": \"Rule\", \"category\": \"workflow\"}]' | cm playbook add --file -\n```\n\n---\n\n## Template Output for Onboarding\n\n`--template` provides rich context for rule extraction:\n\n```bash\ncm onboard read \u002Fpath\u002Fto\u002Fsession.jsonl --template --json\n```\n\nReturns:\n- **metadata**: path, workspace, message count, topic hints\n- **context**: related rules, playbook gaps, suggested focus\n- **extractionFormat**: schema, categories, examples\n- **sessionContent**: actual session data\n\n---\n\n## Integration with CASS\n\nCASS provides **episodic memory** (raw sessions).\nCM extracts **procedural memory** (rules and playbooks).\n\n```bash\n# CASS: Search raw sessions\ncass search \"authentication timeout\" --robot\n\n# CM: Get distilled rules for a task\ncm context \"authentication timeout\" --json\n```\n\n---\n\n## Troubleshooting\n\n| Error | Solution |\n|-------|----------|\n| `cass not found` | Install from [cass repo](https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fcoding_agent_session_search) |\n| `cass search failed` | Run `cass index --full` |\n| `API key missing` | Set `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, or `GOOGLE_GENERATIVE_AI_API_KEY` |\n| `Playbook corrupt` | Run `cm doctor --fix` |\n| `Budget exceeded` | Check `cm usage`, adjust limits |\n\n### Diagnostic Commands\n\n```bash\ncm doctor --json           # System health\ncm doctor --fix            # Auto-fix issues\ncm usage                   # LLM budget status\ncm stats --json            # Playbook health\ncm why \u003Cbullet-id>         # Rule provenance\n```\n\n### LLM-Free Mode\n\n```bash\nCASS_MEMORY_LLM=none cm context \"task\" --json\n```\n\n---\n\n## Installation\n\n```bash\n# One-liner (recommended)\ncurl -fsSL https:\u002F\u002Fraw.githubusercontent.com\u002FDicklesworthstone\u002Fcass_memory_system\u002Fmain\u002Finstall.sh \\\n  | bash -s -- --easy-mode --verify\n\n# Specific version\ninstall.sh --version v0.2.2 --verify\n\n# System-wide\ninstall.sh --system --verify\n\n# From source\ngit clone https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fcass_memory_system.git\ncd cass_memory_system\nbun install && bun run build\nsudo mv .\u002Fdist\u002Fcass-memory \u002Fusr\u002Flocal\u002Fbin\u002Fcm\n```\n\n---\n\n## Integration with Flywheel\n\n| Tool | Integration |\n|------|-------------|\n| **CASS** | CM reads from cass episodic memory, writes procedural memory |\n| **NTM** | Robot mode integrates with cm for context before agent work |\n| **Agent Mail** | Rules can reference mail threads as provenance |\n| **BV** | Task context enriched with relevant playbook rules |\n","# CM - CASS Memory System\n\nProcedural memory for AI coding agents. Transforms scattered sessions into persistent, cross-agent memory. Uses a three-layer cognitive architecture that mirrors human expertise development.\n\n## Why This Exists\n\nAI coding agents accumulate valuable knowledge but it's:\n- **Trapped in sessions** - Context lost when session ends\n- **Agent-specific** - Claude doesn't know what Cursor learned\n- **Unstructured** - Raw logs aren't actionable guidance\n- **Subject to collapse** - Naive summarization loses critical details\n\nYou've solved auth bugs three times this month across different agents. Each time you started from scratch.\n\nCM solves this with cross-agent learning: a pattern discovered in Cursor is immediately available to Claude Code.\n\n---\n\n## Three-Layer Cognitive Architecture\n\n```\n┌─────────────────────────────────────────────────────────────────────┐\n│                    EPISODIC MEMORY (cass)                           │\n│   Raw session logs from all agents — the \"ground truth\"             │\n│   Claude Code │ Codex │ Cursor │ Aider │ PI │ Gemini │ ChatGPT │ ...│\n└───────────────────────────┬─────────────────────────────────────────┘\n                            │ cass search\n                            ▼\n┌─────────────────────────────────────────────────────────────────────┐\n│                    WORKING MEMORY (Diary)                           │\n│   Structured session summaries: accomplishments, decisions, etc.    │\n└───────────────────────────┬─────────────────────────────────────────┘\n                            │ reflect + curate (automated)\n                            ▼\n┌─────────────────────────────────────────────────────────────────────┐\n│                    PROCEDURAL MEMORY (Playbook)                     │\n│   Distilled rules with confidence tracking and decay                │\n└─────────────────────────────────────────────────────────────────────┘\n```\n\nEvery agent's sessions feed the shared memory. A pattern discovered in Cursor **automatically** helps Claude Code on the next session.\n\n---\n\n## The One Command You Need\n\n```bash\ncm context \"\u003Cyour task>\" --json\n```\n\n**Run this before starting any non-trivial task.** Returns:\n- **relevantBullets** - Rules from playbook scored by task relevance\n- **antiPatterns** - Things that have caused problems\n- **historySnippets** - Past sessions (yours and other agents')\n- **suggestedCassQueries** - Deeper investigation searches\n\n### Filtering History by Source\n\n`historySnippets[].origin.kind` is `\"local\"` or `\"remote\"`. Remote hits include `origin.host`:\n\n```json\n{\n  \"historySnippets\": [\n    {\n      \"source_path\": \"~\u002F.claude\u002Fsessions\u002Fsession-001.jsonl\",\n      \"origin\": { \"kind\": \"local\" }\n    },\n    {\n      \"source_path\": \"\u002Fhome\u002Fuser\u002F.codex\u002Fsessions\u002Fsession.jsonl\",\n      \"origin\": { \"kind\": \"remote\", \"host\": \"workstation\" }\n    }\n  ]\n}\n```\n\n---\n\n## Confidence Decay System\n\nRules aren't immortal. Confidence decays without revalidation:\n\n| Mechanism | Effect |\n|-----------|--------|\n| **90-day half-life** | Confidence halves every 90 days without feedback |\n| **4x harmful multiplier** | One mistake counts 4× as much as one success |\n| **Maturity progression** | `candidate` → `established` → `proven` |\n\n### Score Decay Visualization\n\n```\nInitial score: 10.0 (10 helpful marks today)\n\nAfter 90 days (half-life):   5.0\nAfter 180 days:              2.5\nAfter 270 days:              1.25\nAfter 365 days:              0.78\n```\n\n### Effective Score Formula\n\n```typescript\neffectiveScore = decayedHelpful - (4 × decayedHarmful)\n\n\u002F\u002F Where decay factor = 0.5 ^ (daysSinceFeedback \u002F 90)\n```\n\n### Maturity State Machine\n\n```\n  ┌──────────┐       ┌─────────────┐    ┌────────┐\n  │ candidate│──────▶│ established │───▶│ proven │\n  └──────────┘       └─────────────┘    └────────┘\n       │                   │                  │\n       │                   │ (harmful >25%)   │\n       │                   ▼                  │\n       │             ┌─────────────┐          │\n       └────────────▶│ deprecated  │◀─────────┘\n                     └─────────────┘\n```\n\n**Transition Rules:**\n\n| Transition | Criteria |\n|------------|----------|\n| `candidate` → `established` | 3+ helpful, harmful ratio \u003C25% |\n| `established` → `proven` | 10+ helpful, harmful ratio \u003C10% |\n| `any` → `deprecated` | Harmful ratio >25% OR explicit deprecation |\n\n---\n\n## Anti-Pattern Learning\n\nBad rules don't just get deleted. They become warnings:\n\n```\n\"Cache auth tokens for performance\"\n    ↓ (3 harmful marks)\n\"PITFALL: Don't cache auth tokens without expiry validation\"\n```\n\nWhen a rule is marked harmful multiple times (>50% harmful ratio with 3+ marks), it's automatically inverted into an anti-pattern.\n\n---\n\n## ACE Pipeline (How Rules Are Created)\n\n```\nGenerator → Reflector → Validator → Curator\n```\n\n| Stage | Role | LLM? |\n|-------|------|------|\n| **Generator** | Pre-task context hydration (`cm context`) | No |\n| **Reflector** | Extract patterns from sessions (`cm reflect`) | Yes |\n| **Validator** | Evidence gate against cass history | Yes |\n| **Curator** | Deterministic delta merge | **No** |\n\n**Critical:** Curator has NO LLM to prevent context collapse from iterative drift. LLMs propose patterns; deterministic logic manages them.\n\n### Scientific Validation\n\nBefore a rule joins your playbook, it's validated against cass history:\n\n```\nProposed rule: \"Always check token expiry before auth debugging\"\n    ↓\nEvidence gate: Search cass for sessions where this applied\n    ↓\nResult: 5 sessions found, 4 successful outcomes → ACCEPT\n```\n\nRules without historical evidence are flagged as candidates until proven.\n\n---\n\n## Commands Reference\n\n### Context Retrieval (Primary Workflow)\n\n```bash\n# THE MAIN COMMAND - run before non-trivial tasks\ncm context \"implement user authentication\" --json\n\n# Limit results for token budget\ncm context \"fix bug\" --json --limit 5 --no-history\n\n# With workspace filter\ncm context \"refactor\" --json --workspace \u002Fpath\u002Fto\u002Fproject\n\n# Self-documenting explanation\ncm quickstart --json\n\n# System health\ncm doctor --json\ncm doctor --fix  # Auto-fix issues\n\n# Find similar rules\ncm similar \"error handling best practices\"\n```\n\n### Playbook Management\n\n```bash\ncm playbook list                              # All rules\ncm playbook get b-8f3a2c                      # Rule details\ncm playbook add \"Always run tests first\"      # Add rule\ncm playbook add --file rules.json             # Batch add from file\ncm playbook add --file rules.json --session \u002Fpath\u002Fsession.jsonl  # Track source\ncm playbook remove b-xyz --reason \"Outdated\"  # Remove\ncm playbook export > backup.yaml              # Export\ncm playbook import shared.yaml                # Import\ncm playbook bootstrap react                   # Apply starter to existing\n\ncm top 10                                     # Top effective rules\ncm stale --days 60                            # Rules without recent feedback\ncm why b-8f3a2c                               # Rule provenance\ncm stats --json                               # Playbook health metrics\n```\n\n### Learning & Feedback\n\n```bash\n# Manual feedback\ncm mark b-8f3a2c --helpful\ncm mark b-xyz789 --harmful --reason \"Caused regression\"\ncm undo b-xyz789                              # Revert feedback\n\n# Session outcomes (positional: status, rules)\ncm outcome success b-8f3a2c,b-def456\ncm outcome failure b-x7k9p1 --summary \"Auth approach failed\"\ncm outcome-apply                              # Apply to playbook\n\n# Reflection (usually automated)\ncm reflect --days 7 --json\ncm reflect --session \u002Fpath\u002Fto\u002Fsession.jsonl   # Single session\ncm reflect --workspace \u002Fpath\u002Fto\u002Fproject       # Project-specific\n\n# Validation\ncm validate \"Always check null before dereferencing\"\n\n# Audit sessions against rules\ncm audit --days 30\n\n# Deprecate permanently\ncm forget b-xyz789 --reason \"Superseded by better pattern\"\n```\n\n### Onboarding (Agent-Native)\n\nZero-cost playbook building using your existing agent:\n\n```bash\ncm onboard status                             # Check progress\ncm onboard gaps                               # Category gaps\ncm onboard sample --fill-gaps                 # Prioritized sessions\ncm onboard sample --agent claude --days 14    # Filter by agent\u002Ftime\ncm onboard sample --workspace \u002Fpath\u002Fproject   # Filter by workspace\ncm onboard sample --include-processed         # Re-analyze sessions\ncm onboard read \u002Fpath\u002Fsession.jsonl --template  # Rich context\ncm onboard mark-done \u002Fpath\u002Fsession.jsonl      # Mark processed\ncm onboard reset                              # Start fresh\n```\n\n### Trauma Guard (Safety System)\n\n```bash\ncm trauma list                                # Active patterns\ncm trauma add \"DROP TABLE\" --description \"Mass deletion\" --severity critical\ncm trauma heal t-abc --reason \"Intentional migration\"\ncm trauma remove t-abc\ncm trauma scan --days 30                      # Scan for traumas\ncm trauma import shared-traumas.yaml\n\ncm guard --install                            # Claude Code hook\ncm guard --git                                # Git pre-commit hook\ncm guard --install --git                      # Both\ncm guard --status                             # Check installation\n```\n\n### System Commands\n\n```bash\ncm init                                       # Initialize\ncm init --starter typescript                  # With template\ncm init --force                               # Reinitialize (creates backup)\ncm starters                                   # List templates\ncm serve --port 3001                          # MCP server\ncm usage                                      # LLM cost stats\ncm privacy status                             # Privacy settings\ncm privacy enable                             # Enable cross-agent enrichment\ncm privacy disable                            # Disable enrichment\ncm project --format agents.md                 # Export for AGENTS.md\n```\n\n---\n\n## Starter Playbooks\n\nStarting with an empty playbook is daunting. Starters provide curated best practices:\n\n```bash\ncm starters                    # List available\ncm init --starter typescript   # Initialize with starter\ncm playbook bootstrap react    # Apply to existing playbook\n```\n\n### Built-in Starters\n\n| Starter | Focus | Rules |\n|---------|-------|-------|\n| **general** | Universal best practices | 5 |\n| **typescript** | TypeScript\u002FNode.js patterns | 4 |\n| **react** | React\u002FNext.js development | 4 |\n| **python** | Python\u002FFastAPI\u002FDjango | 4 |\n| **node** | Node.js\u002FExpress services | 4 |\n| **rust** | Rust service patterns | 4 |\n\n### Custom Starters\n\nCreate YAML files in `~\u002F.cass-memory\u002Fstarters\u002F`:\n\n```yaml\n# ~\u002F.cass-memory\u002Fstarters\u002Fdjango.yaml\nname: django\ndescription: Django web framework best practices\nbullets:\n  - content: \"Always use Django's ORM for database operations\"\n    category: database\n    maturity: established\n    tags: [django, orm]\n```\n\n---\n\n## Inline Feedback (During Work)\n\nLeave feedback in code comments. Parsed during reflection:\n\n```typescript\n\u002F\u002F [cass: helpful b-8f3a2c] - this rule saved me from a rabbit hole\n\n\u002F\u002F [cass: harmful b-x7k9p1] - this advice was wrong for our use case\n```\n\n---\n\n## Agent Protocol\n\n```\n1. START:    cm context \"\u003Ctask>\" --json\n2. WORK:     Reference rule IDs when following them (e.g., \"Following b-8f3a2c...\")\n3. FEEDBACK: Leave inline comments when rules help\u002Fhurt\n4. END:      Just finish. Learning happens automatically.\n```\n\n**You do NOT need to:**\n- Run `cm reflect` (automation handles this)\n- Run `cm mark` manually (use inline comments)\n- Manually add rules to the playbook\n\n---\n\n## Gap Analysis Categories\n\n| Category | Keywords |\n|----------|----------|\n| `debugging` | error, fix, bug, trace, stack |\n| `testing` | test, mock, assert, expect, jest |\n| `architecture` | design, pattern, module, abstraction |\n| `workflow` | task, CI\u002FCD, deployment |\n| `documentation` | comment, README, API doc |\n| `integration` | API, HTTP, JSON, endpoint |\n| `collaboration` | review, PR, team |\n| `git` | branch, merge, commit |\n| `security` | auth, token, encrypt, permission |\n| `performance` | optimize, cache, profile |\n\n**Category Status Thresholds:**\n\n| Status | Rule Count | Priority |\n|--------|------------|----------|\n| `critical` | 0 rules | High |\n| `underrepresented` | 1-2 rules | Medium |\n| `adequate` | 3-10 rules | Low |\n| `well-covered` | 11+ rules | None |\n\n---\n\n## Trauma Guard: Safety System\n\nThe \"hot stove\" principle—learn from past incidents and prevent recurrence.\n\n### How It Works\n\n```\nSession History              Trauma Registry              Runtime Guard\n┌─────────────────┐         ┌─────────────────┐         ┌─────────────────┐\n│ rm -rf \u002F* (oops)│ ──────▶ │ Pattern: rm -rf │ ──────▶ │ BLOCKED: This   │\n│ \"sorry, I made  │  scan   │ Severity: FATAL │  hook   │ command matches │\n│  a mistake...\"  │         │ Session: abc123 │         │ a trauma pattern│\n└─────────────────┘         └─────────────────┘         └─────────────────┘\n```\n\n### Built-in Doom Patterns (20+)\n\n| Category | Examples |\n|----------|----------|\n| **Filesystem** | `rm -rf \u002F`, `rm -rf ~`, recursive deletes |\n| **Database** | `DROP DATABASE`, `TRUNCATE`, `DELETE FROM` without WHERE |\n| **Git** | `git push --force` to main\u002Fmaster, `git reset --hard` |\n| **Infrastructure** | `terraform destroy -auto-approve`, `kubectl delete namespace` |\n| **Cloud** | `aws s3 rm --recursive`, destructive CloudFormation |\n\n### Pattern Storage\n\n| Scope | Location | Purpose |\n|-------|----------|---------|\n| **Global** | `~\u002F.cass-memory\u002Ftraumas.jsonl` | Personal patterns |\n| **Project** | `.cass\u002Ftraumas.jsonl` | Commit to repo for team |\n\n### Pattern Lifecycle\n\n- **Active**: Blocks matching commands\n- **Healed**: Temporarily bypassed (with reason and timestamp)\n- **Deleted**: Removed (can be re-added)\n\n---\n\n## MCP Server\n\nRun as MCP server for agent integration:\n\n```bash\n# Local-only (recommended)\ncm serve --port 3001\n\n# With auth token (for non-loopback)\nMCP_HTTP_TOKEN=\"\u003Crandom>\" cm serve --host 0.0.0.0 --port 3001\n```\n\n### Tools Exposed\n\n| Tool | Purpose | Parameters |\n|------|---------|------------|\n| `cm_context` | Get rules + history | `task, limit?, history?, days?, workspace?` |\n| `cm_feedback` | Record feedback | `bulletId, helpful?, harmful?, reason?` |\n| `cm_outcome` | Record session outcome | `sessionId, outcome, rulesUsed?` |\n| `memory_search` | Search playbook\u002Fcass | `query, scope?, limit?, days?` |\n| `memory_reflect` | Trigger reflection | `days?, maxSessions?, dryRun?` |\n\n### Resources Exposed\n\n| URI | Purpose |\n|-----|---------|\n| `cm:\u002F\u002Fplaybook` | Current playbook state |\n| `cm:\u002F\u002Fdiary` | Recent diary entries |\n| `cm:\u002F\u002Foutcomes` | Session outcomes |\n| `cm:\u002F\u002Fstats` | Playbook health metrics |\n\n### Client Configuration\n\n**Claude Code** (`~\u002F.config\u002Fclaude\u002Fmcp.json`):\n```json\n{\n  \"mcpServers\": {\n    \"cm\": {\n      \"command\": \"cm\",\n      \"args\": [\"serve\"]\n    }\n  }\n}\n```\n\n---\n\n## Graceful Degradation\n\n| Condition | Behavior |\n|-----------|----------|\n| No cass | Playbook-only scoring, no history snippets |\n| No playbook | Empty playbook, commands still work |\n| No LLM | Deterministic reflection, no semantic enhancement |\n| Offline | Cached playbook + local diary |\n\n---\n\n## Output Format\n\nAll commands support `--json` for machine-readable output.\n\n**Design principle:** stdout = JSON only; diagnostics go to stderr.\n\n### Success Response\n\n```json\n{\n  \"success\": true,\n  \"task\": \"fix the auth timeout bug\",\n  \"relevantBullets\": [\n    {\n      \"id\": \"b-8f3a2c\",\n      \"content\": \"Always check token expiry before auth debugging\",\n      \"effectiveScore\": 8.5,\n      \"maturity\": \"proven\",\n      \"relevanceScore\": 0.92,\n      \"reasoning\": \"Extracted from 5 successful sessions\"\n    }\n  ],\n  \"antiPatterns\": [...],\n  \"historySnippets\": [...],\n  \"suggestedCassQueries\": [...],\n  \"degraded\": null\n}\n```\n\n### Error Response\n\n```json\n{\n  \"success\": false,\n  \"code\": \"PLAYBOOK_NOT_FOUND\",\n  \"error\": \"Playbook file not found\",\n  \"hint\": \"Run 'cm init' to create a new playbook\",\n  \"retryable\": false,\n  \"recovery\": [\"cm init\", \"cm doctor --fix\"],\n  \"docs\": \"README.md#-troubleshooting\"\n}\n```\n\n### Exit Codes\n\n| Code | Meaning |\n|------|---------|\n| 1 | Internal error |\n| 2 | User input\u002Fusage |\n| 3 | Configuration |\n| 4 | Filesystem |\n| 5 | Network |\n| 6 | cass error |\n| 7 | LLM\u002Fprovider error |\n\n---\n\n## Token Budget Management\n\n| Flag | Effect |\n|------|--------|\n| `--limit N` | Cap number of rules |\n| `--min-score N` | Only rules above threshold |\n| `--no-history` | Skip historical snippets (faster) |\n| `--json` | Structured output |\n\n---\n\n## Configuration\n\nConfig lives at `~\u002F.cass-memory\u002Fconfig.json` (global) and `.cass\u002Fconfig.json` (repo).\n\n**Precedence:** CLI flags > Repo config > Global config > Defaults\n\n**Security:** Repo config cannot override sensitive paths or user-level consent settings.\n\n### Key Options\n\n```json\n{\n  \"provider\": \"anthropic\",\n  \"model\": \"claude-sonnet-4-20250514\",\n  \"budget\": {\n    \"dailyLimit\": 0.10,\n    \"monthlyLimit\": 2.00\n  },\n  \"scoring\": {\n    \"decayHalfLifeDays\": 90,\n    \"harmfulMultiplier\": 4\n  },\n  \"maxBulletsInContext\": 50,\n  \"maxHistoryInContext\": 10,\n  \"sessionLookbackDays\": 7,\n  \"crossAgent\": {\n    \"enabled\": false,\n    \"consentGiven\": false,\n    \"auditLog\": true\n  },\n  \"remoteCass\": {\n    \"enabled\": false,\n    \"hosts\": [{\"host\": \"workstation\", \"label\": \"work\"}]\n  },\n  \"semanticSearchEnabled\": false,\n  \"embeddingModel\": \"Xenova\u002Fall-MiniLM-L6-v2\",\n  \"dedupSimilarityThreshold\": 0.85\n}\n```\n\n### Environment Variables\n\n| Variable | Purpose |\n|----------|---------|\n| `ANTHROPIC_API_KEY` | API key for Anthropic (Claude) |\n| `OPENAI_API_KEY` | API key for OpenAI |\n| `GOOGLE_GENERATIVE_AI_API_KEY` | API key for Google Gemini |\n| `CASS_PATH` | Path to cass binary |\n| `CASS_MEMORY_LLM` | Set to `none` for LLM-free mode |\n| `MCP_HTTP_TOKEN` | Auth token for non-loopback MCP server |\n\n---\n\n## Data Locations\n\n```\n~\u002F.cass-memory\u002F                  # Global (user-level)\n├── config.json                  # Configuration\n├── playbook.yaml                # Personal playbook\n├── diary\u002F                       # Session summaries\n├── outcomes\u002F                    # Session outcomes\n├── traumas.jsonl                # Trauma patterns\n├── starters\u002F                    # Custom starter playbooks\n├── onboarding-state.json        # Onboarding progress\n├── privacy-audit.jsonl          # Cross-agent audit trail\n├── processed-sessions.jsonl     # Reflection progress\n└── usage.jsonl                  # LLM cost tracking\n\n.cass\u002F                           # Project-level (in repo)\n├── config.json                  # Project-specific overrides\n├── playbook.yaml                # Project-specific rules\n├── traumas.jsonl                # Project-specific patterns\n└── blocked.yaml                 # Anti-patterns to block\n```\n\n---\n\n## Automating Reflection\n\n### Cron Job\n\n```bash\n# Daily at 2am\n0 2 * * * \u002Fusr\u002Flocal\u002Fbin\u002Fcm reflect --days 7 >> ~\u002F.cass-memory\u002Freflect.log 2>&1\n```\n\n### Claude Code Hook\n\n`.claude\u002Fhooks.json`:\n```json\n{\n  \"post-session\": [\"cm reflect --days 1\"]\n}\n```\n\n---\n\n## Privacy & Security\n\n### Local-First Design\n\n- All data stays on your machine\n- No cloud sync, no telemetry\n- Cross-agent enrichment is opt-in with explicit consent\n- Audit log for enrichment events\n\n### Secret Sanitization\n\nBefore processing, content is sanitized:\n- OpenAI\u002FAnthropic\u002FAWS\u002FGoogle API keys\n- GitHub tokens\n- JWTs\n- Passwords and secrets in config patterns\n\n### Privacy Controls\n\n```bash\ncm privacy status    # Check settings\ncm privacy enable    # Enable cross-agent enrichment\ncm privacy disable   # Disable enrichment\n```\n\n---\n\n## Performance Characteristics\n\n| Operation | Typical Latency |\n|-----------|-----------------|\n| `cm context` (cached) | 50-150ms |\n| `cm context` (cold) | 200-500ms |\n| `cm context` (no cass) | 30-80ms |\n| `cm reflect` (1 session) | 5-15s |\n| `cm reflect` (5 sessions) | 20-60s |\n| `cm playbook list` | \u003C50ms |\n| `cm similar` (keyword) | 20-50ms |\n| `cm similar` (semantic) | 100-300ms |\n\n### LLM Cost Estimates\n\n| Operation | Typical Cost |\n|-----------|--------------|\n| Reflect (1 session) | $0.01-0.05 |\n| Reflect (7 days) | $0.05-0.20 |\n| Validate (1 rule) | $0.005-0.01 |\n\nWith default budget ($0.10\u002Fday, $2.00\u002Fmonth): ~5-10 sessions\u002Fday.\n\n---\n\n## Batch Rule Addition\n\nAfter analyzing a session, add multiple rules at once:\n\n```bash\n# Create JSON file\ncat > rules.json \u003C\u003C 'EOF'\n[\n  {\"content\": \"Always run tests before committing\", \"category\": \"testing\"},\n  {\"content\": \"Check token expiry before auth debugging\", \"category\": \"debugging\"},\n  {\"content\": \"AVOID: Mocking entire modules in tests\", \"category\": \"testing\"}\n]\nEOF\n\n# Add all rules\ncm playbook add --file rules.json\n\n# Track which session they came from\ncm playbook add --file rules.json --session \u002Fpath\u002Fto\u002Fsession.jsonl\n\n# Or pipe from stdin\necho '[{\"content\": \"Rule\", \"category\": \"workflow\"}]' | cm playbook add --file -\n```\n\n---\n\n## Template Output for Onboarding\n\n`--template` provides rich context for rule extraction:\n\n```bash\ncm onboard read \u002Fpath\u002Fto\u002Fsession.jsonl --template --json\n```\n\nReturns:\n- **metadata**: path, workspace, message count, topic hints\n- **context**: related rules, playbook gaps, suggested focus\n- **extractionFormat**: schema, categories, examples\n- **sessionContent**: actual session data\n\n---\n\n## Integration with CASS\n\nCASS provides **episodic memory** (raw sessions).\nCM extracts **procedural memory** (rules and playbooks).\n\n```bash\n# CASS: Search raw sessions\ncass search \"authentication timeout\" --robot\n\n# CM: Get distilled rules for a task\ncm context \"authentication timeout\" --json\n```\n\n---\n\n## Troubleshooting\n\n| Error | Solution |\n|-------|----------|\n| `cass not found` | Install from [cass repo](https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fcoding_agent_session_search) |\n| `cass search failed` | Run `cass index --full` |\n| `API key missing` | Set `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, or `GOOGLE_GENERATIVE_AI_API_KEY` |\n| `Playbook corrupt` | Run `cm doctor --fix` |\n| `Budget exceeded` | Check `cm usage`, adjust limits |\n\n### Diagnostic Commands\n\n```bash\ncm doctor --json           # System health\ncm doctor --fix            # Auto-fix issues\ncm usage                   # LLM budget status\ncm stats --json            # Playbook health\ncm why \u003Cbullet-id>         # Rule provenance\n```\n\n### LLM-Free Mode\n\n```bash\nCASS_MEMORY_LLM=none cm context \"task\" --json\n```\n\n---\n\n## Installation\n\n```bash\n# One-liner (recommended)\ncurl -fsSL https:\u002F\u002Fraw.githubusercontent.com\u002FDicklesworthstone\u002Fcass_memory_system\u002Fmain\u002Finstall.sh \\\n  | bash -s -- --easy-mode --verify\n\n# Specific version\ninstall.sh --version v0.2.2 --verify\n\n# System-wide\ninstall.sh --system --verify\n\n# From source\ngit clone https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fcass_memory_system.git\ncd cass_memory_system\nbun install && bun run build\nsudo mv .\u002Fdist\u002Fcass-memory \u002Fusr\u002Flocal\u002Fbin\u002Fcm\n```\n\n---\n\n## Integration with Flywheel\n\n| Tool | Integration |\n|------|-------------|\n| **CASS** | CM reads from cass episodic memory, writes procedural memory |\n| **NTM** | Robot mode integrates with cm for context before agent work |\n| **Agent Mail** | Rules can reference mail threads as provenance |\n| **BV** | Task context enriched with relevant playbook rules |\n",{"name":5,"description":7},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Faiskillstore\u002Fmarketplace\u002Fdicklesworthstone\u002Fcm",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":8,"skillName":5,"commands":58,"prompt":68,"zipAvailable":69},[59,62,65],{"tool":60,"command":61},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill cm",{"tool":63,"command":64},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill cm",{"tool":66,"command":67},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill cm","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fdicklesworthstone\u002Fcm\u002FSKILL.md",true,[71],{"path":72,"resourceType":73,"resourceTypeDesc":74,"sizeBytes":75,"sourceHtmlUrl":76},"skill-report.json","REFERENCE","参考文档",8592,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fdicklesworthstone\u002Fcm\u002Fskill-report.json",[78,88,98,107,113,120],{"skillNo":79,"name":80,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":84,"publishedAt":43},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[83],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[85,86,87],"model","model hierarchy","model hierarchy skill",{"skillNo":89,"name":90,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":94,"publishedAt":43},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[93],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[95,96,97],"MCP","zoom","zoom mcp",{"skillNo":99,"name":100,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":43},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[104,105,106,96],"sdk","zoom apps sdk","apps",{"skillNo":108,"name":109,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":43},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[109],{"skillNo":114,"name":115,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":116,"categories":117,"keywords":119,"publishedAt":43},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[118],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[115],{"skillNo":121,"name":122,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":123,"categories":124,"keywords":125,"publishedAt":43},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[122]]