cass-memory

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

CASS Memory - Contextual Learning System

CASS Memory - 上下文学习系统

Build and use a personal playbook of coding patterns learned from your sessions.
构建并使用从你的会话中学习到的个人编码模式手册。

Prerequisites

前提条件

The
cm
CLI should be available (part of cass-memory system).
Initialize:
bash
cm init
需安装
cm
CLI(属于cass-memory系统的一部分)。
初始化:
bash
cm init

Or with a starter playbook

或使用入门手册

cm init --starter typescript cm init --starter react cm init --starter python cm init --starter go
undefined
cm init --starter typescript cm init --starter react cm init --starter python cm init --starter go
undefined

CLI Reference

CLI参考

Get Context for a Task

获取任务上下文

bash
undefined
bash
undefined

THE main command - get relevant rules before starting work

核心命令 - 开始工作前获取相关规则

cm context "Description of your task" --json

This returns:
- Relevant rules from your playbook
- Anti-patterns to avoid
- History snippets from similar past work
cm context "你的任务描述" --json

该命令返回:
- 手册中的相关规则
- 需要避免的反模式
- 类似过往工作的历史片段

Reflection (Extract Patterns)

反思(提取模式)

bash
undefined
bash
undefined

Run reflection on recent sessions

对近期会话进行反思

cm reflect --json
cm reflect --json

Specify lookback period

指定回溯周期

cm reflect --days 7 --json cm reflect --days 30 --json
undefined
cm reflect --days 7 --json cm reflect --days 30 --json
undefined

Playbook Management

手册管理

bash
undefined
bash
undefined

List all rules

列出所有规则

cm playbook list --json
cm playbook list --json

Get specific rule details

获取特定规则详情

cm playbook get b-8f3a2c --json
cm playbook get b-8f3a2c --json

Add a new rule

添加新规则

cm playbook add "Always use optional chaining for nested object access" --json
undefined
cm playbook add "嵌套对象访问始终使用可选链操作符" --json
undefined

Feedback on Rules

规则反馈

bash
undefined
bash
undefined

Mark rule as helpful

标记规则为有帮助

cm mark b-8f3a2c --helpful --json cm mark b-8f3a2c --helpful --reason "Prevented null error" --json
cm mark b-8f3a2c --helpful --json cm mark b-8f3a2c --helpful --reason "防止了空值错误" --json

Mark rule as harmful

标记规则为有害

cm mark b-8f3a2c --harmful --json cm mark b-8f3a2c --harmful --reason "Caused false positive" --json
undefined
cm mark b-8f3a2c --harmful --json cm mark b-8f3a2c --harmful --reason "导致了误判" --json
undefined

Record Session Outcomes

记录会话结果

bash
undefined
bash
undefined

Record success

记录成功

cm outcome --status success --json cm outcome --status success --rules "b-8f3a2c,b-4d2e1f" --json
cm outcome --status success --json cm outcome --status success --rules "b-8f3a2c,b-4d2e1f" --json

Record failure

记录失败

cm outcome --status failure --text "Build failed due to type error" --json
cm outcome --status failure --text "因类型错误导致构建失败" --json

Mixed results

记录混合结果

cm outcome --status mixed --text "Partial completion" --json
undefined
cm outcome --status mixed --text "部分完成" --json
undefined

Statistics

统计信息

bash
undefined
bash
undefined

Get playbook stats

获取手册统计数据

cm stats --json
undefined
cm stats --json
undefined

Top Rules

热门规则

bash
undefined
bash
undefined

Show most effective rules

显示最有效的规则

cm top --json cm top 5 --json cm top 20 --json
undefined
cm top --json cm top 5 --json cm top 20 --json
undefined

Health Check

健康检查

bash
undefined
bash
undefined

Check system health

检查系统健康状况

cm doctor --json
cm doctor --json

Auto-fix issues

自动修复问题

cm doctor --fix --json
undefined
cm doctor --fix --json
undefined

Find Stale Rules

查找过时规则

bash
undefined
bash
undefined

Rules without recent feedback

无近期反馈的规则

cm stale --json cm stale --days 30 --json cm stale --days 60 --json
undefined
cm stale --json cm stale --days 30 --json cm stale --days 60 --json
undefined

Validate Rules

验证规则

bash
undefined
bash
undefined

Validate a proposed rule against history

根据历史记录验证拟议规则

cm validate "Proposed rule text" --json
undefined
cm validate "拟议规则文本" --json
undefined

Explain Rule Origin

解释规则来源

bash
undefined
bash
undefined

Show evidence and reasoning for a rule

显示规则的依据和推理过程

cm why b-8f3a2c --json
undefined
cm why b-8f3a2c --json
undefined

Usage Statistics

使用统计

bash
cm usage --json
bash
cm usage --json

Starter Playbooks

入门手册

bash
undefined
bash
undefined

List available starters

列出可用的入门手册

cm starters --json
undefined
cm starters --json
undefined

Workflow Patterns

工作流模式

Session Start

会话开始

bash
undefined
bash
undefined

Get context before starting a task

开始任务前获取上下文

cm context "Implement user authentication with JWT" --json
undefined
cm context "使用JWT实现用户认证" --json
undefined

During Work

工作中

When a rule helps:
bash
cm mark b-8f3a2c --helpful --json
When a rule leads astray:
bash
cm mark b-8f3a2c --harmful --reason "Not applicable to this framework" --json
当规则有帮助时:
bash
cm mark b-8f3a2c --helpful --json
当规则误导时:
bash
cm mark b-8f3a2c --harmful --reason "不适用于此框架" --json

Session End

会话结束

bash
undefined
bash
undefined

Record outcome

记录结果

cm outcome --status success --rules "b-8f3a2c,b-4d2e1f" --json
undefined
cm outcome --status success --rules "b-8f3a2c,b-4d2e1f" --json
undefined

Periodic Maintenance

定期维护

bash
undefined
bash
undefined

Weekly: Run reflection to extract new patterns

每周:运行反思以提取新模式

cm reflect --days 7 --json
cm reflect --days 7 --json

Monthly: Review stale rules

每月:审核过时规则

cm stale --days 30 --json
cm stale --days 30 --json

Check system health

检查系统健康

cm doctor --json
undefined
cm doctor --json
undefined

Building Your Playbook

构建你的手册

bash
undefined
bash
undefined

Manually add a pattern you've learned

手动添加你学到的模式

cm playbook add "Use React.memo() for components receiving complex objects as props" --json
cm playbook add "为接收复杂对象作为props的组件使用React.memo()" --json

After adding, use it in context queries

添加后,在上下文查询中使用它

cm context "Create a list component with filtering" --json
undefined
cm context "创建带筛选功能的列表组件" --json
undefined

Rule Lifecycle

规则生命周期

  1. Creation - Rules emerge from reflection or manual addition
  2. Usage - Rules surface in context queries
  3. Feedback - Mark as helpful/harmful based on experience
  4. Evolution - High-feedback rules rise, low-feedback rules become stale
  5. Retirement - Stale rules get reviewed and pruned
  1. 创建 - 规则通过反思或手动添加产生
  2. 使用 - 规则在上下文查询中显示
  3. 反馈 - 根据使用体验标记为有帮助/有害
  4. 演化 - 高反馈规则优先级提升,低反馈规则变为过时
  5. 淘汰 - 过时规则被审核并移除

Best Practices

最佳实践

  1. Always get context first - Run
    cm context "task"
    before starting work
  2. Provide feedback - Mark rules as helpful/harmful
  3. Record outcomes - Track session success/failure
  4. Run reflection regularly - Weekly reflection extracts new patterns
  5. Review stale rules - Don't let old rules accumulate
  6. Add rules manually - When you learn something important
  1. 始终先获取上下文 - 开始工作前运行
    cm context "任务"
  2. 提供反馈 - 标记规则为有帮助/有害
  3. 记录结果 - 跟踪会话的成功/失败
  4. 定期运行反思 - 每周反思提取新模式
  5. 审核过时规则 - 不要积累旧规则
  6. 手动添加规则 - 当你学到重要内容时

Integration Tips

集成技巧

Pre-Task Context

任务前上下文

Before any significant coding task:
bash
CONTEXT=$(cm context "Your task description" --json)
在任何重要编码任务前:
bash
CONTEXT=$(cm context "你的任务描述" --json)

Use context to inform your approach

使用上下文指导你的方法

undefined
undefined

Post-Session Recording

会话后记录

At end of coding session:
bash
cm outcome --status success --text "Completed feature X" --json
编码会话结束时:
bash
cm outcome --status success --text "完成功能X" --json