Communitygithub.com

bg-szy/TOP-SKILLS

CASS 記憶系統 — AI 編碼代理的程序性記憶。三層認知架構,具備信心衰減、反模式學習、跨代理知識傳遞與創傷防護安全系統。基於 Bun/TypeScript 的 CLI 工具。

TOP-SKILLS 是什麼?

CASS 記憶系統(CM)是一個專為 AI 編碼代理設計的程序性記憶系統,能將分散的工作階段轉化為持久、跨代理的知識庫。它採用三層認知架構:原始會話日誌(情節記憶)、結構化摘要(工作記憶)以及經提煉且帶信心追蹤的規則(程序記憶)。此系統解決了 AI 代理工作流程中的關鍵痛點 —— 工作階段間上下文遺失、代理特定知識隔離(如 Claude Code 無法得知 Cursor 學到的內容),以及單純摘要導致的資訊遺失。其核心功能包括信心衰減機制(90 天半衰期)、自動化反模式學習(將有害規則轉化為警告)、跨代理知識轉移(Cursor 發現的模式可立即供 Claude Code 使用),以及「創傷防護」安全系統,可防範如 `rm -rf /` 或 `DROP DATABASE` 等災難性指令。系統透過 CLI 命令 `cm context` 進行操作,並支援 MCP 伺服器整合,適用於 Claude Code、Cursor、Codex、Aider 等多種代理平台。

相容平台✓Claude Code✓Codex CLI✓Cursor✓Gemini CLI
npx skills add https://github.com/bg-szy/TOP-SKILLS/tree/HEAD/skills/marketplace/cm

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

CM - CASS 記憶系統

為 AI 編碼代理提供程序性記憶。將分散的工作階段轉化為持久、跨代理的記憶。採用三層認知架構,模擬人類專業技能的發展過程。

為何存在

AI 編碼代理積累了寶貴的知識,但這些知識往往:

  • 被困在工作階段中 — 工作階段結束後上下文即遺失
  • 僅限單一代理 — Claude 不知道 Cursor 學到了什麼
  • 缺乏結構化 — 原始日誌無法作為可操作指南
  • 面臨崩塌風險 — 單純摘要會遺失關鍵細節

一個月內,您可能已在不同代理中解決了三次同樣的認證錯誤,每次都從頭開始。

CM 透過跨代理學習解決此問題:在 Cursor 中發現的模式,可立即供 Claude Code 使用。


三層認知架構

┌─────────────────────────────────────────────────────────────────────┐
│                    情節記憶 (cass)                                  │
│   來自所有代理的原始工作階段日誌 — 即「基本事實」                     │
│   Claude Code │ Codex │ Cursor │ Aider │ PI │ Gemini │ ChatGPT │ ...│
└───────────────────────────┬─────────────────────────────────────────┘
                            │ cass search
                            ▼
┌─────────────────────────────────────────────────────────────────────┐
│                    工作記憶 (Diary)                                 │
│   結構化的工作階段摘要:成就、決策等                                  │
└───────────────────────────┬─────────────────────────────────────────┘
                            │ reflect + curate (自動化)
                            ▼
┌─────────────────────────────────────────────────────────────────────┐
│                    程序性記憶 (Playbook)                            │
│   經提煉的規則,附帶信心追蹤與衰減機制                                │
└─────────────────────────────────────────────────────────────────────┘

每個代理的工作階段都會餵養共享記憶。在 Cursor 中發現的模式會自動在下次工作階段中幫助 Claude Code。


你只需要一個指令

cm context "<你的任務>" --json

在開始任何非瑣碎任務前執行此指令。 會回傳:

  • relevantBullets — 根據任務相關性評分的 Playbook 規則
  • antiPatterns — 曾導致問題的事物
  • historySnippets — 過去的工作階段(你自己的和其他代理的)
  • suggestedCassQueries — 更深入調查的搜尋建議

按來源過濾歷史記錄

historySnippets[].origin.kind 為 "local" 或 "remote"。遠端命中包含 origin.host:

{
  "historySnippets": [
    {
      "source_path": "~/.claude/sessions/session-001.jsonl",
      "origin": { "kind": "local" }
    },
    {
      "source_path": "/home/user/.codex/sessions/session.jsonl",
      "origin": { "kind": "remote", "host": "workstation" }
    }
  ]
}

信心衰減系統

規則並非不朽。若無重新驗證,信心會衰減:

機制效果
90 天半衰期若無回饋,信心每 90 天減半
有害 4 倍乘數一次錯誤的影響等同於四次成功
成熟度進展candidate → established → proven

分數衰減可視化

初始分數:10.0 (今天有 10 次幫助標記)

90 天後 (半衰期):   5.0
180 天後:           2.5
270 天後:           1.25
365 天後:           0.78

有效分數公式

effectiveScore = decayedHelpful - (4 × decayedHarmful)

// 其中衰減因子 = 0.5 ^ (daysSinceFeedback / 90)

成熟度狀態機

  ┌──────────┐       ┌─────────────┐    ┌────────┐
  │ candidate│──────▶│ established │───▶│ proven │
  └──────────┘       └─────────────┘    └────────┘
       │                   │                  │
       │                   │ (harmful >25%)   │
       │                   ▼                  │
       │             ┌─────────────┐          │
       └────────────▶│ deprecated  │◀─────────┘
                     └─────────────┘

轉換規則:

轉換條件
candidate → established3+ 次幫助,有害比率 <25%
established → proven10+ 次幫助,有害比率 <10%
any → deprecated有害比率 >25% 或明確棄用

反模式學習

不好的規則不只是被刪除,它們會變成警告:

"快取認證令牌以提升效能"
    ↓ (3 次有害標記)
"陷阱:不要快取未經驗證有效期的認證令牌"

當一個規則被多次標記為有害(>50% 有害比率且 3+ 次標記),它會自動轉化為反模式。


ACE 管線 (規則的創建方式)

Generator → Reflector → Validator → Curator
階段角色使用 LLM?
Generator任務前上下文注入 (cm context)否
Reflector從工作階段中提取模式 (cm reflect)是
Validator對照 cass 歷史的證據關卡是
Curator確定性差異合併否

關鍵: Curator 不使用 LLM,以防止因迭代漂移導致的上下文崩塌。LLM 提出模式;確定性邏輯負責管理它們。

科學驗證

在規則加入你的 Playbook 之前,它會經過 cass 歷史的驗證:

提議規則:"在進行認證除錯前,務必檢查令牌有效期"
    ↓
證據關卡:搜尋 cass 中此規則適用的工作階段
    ↓
結果:找到 5 個工作階段,4 次成功結果 → 接受

沒有歷史證據的規則會被標記為候選,直到被證明為止。


指令參考

上下文檢索 (主要工作流程)

# 主要指令 - 在非瑣碎任務前執行
cm context "實作使用者認證" --json

# 限制結果以節省 token 預算
cm context "修復錯誤" --json --limit 5 --no-history

# 搭配工作區過濾
cm context "重構" --json --workspace /path/to/project

# 自我說明
cm quickstart --json

# 系統健康檢查
cm doctor --json
cm doctor --fix  # 自動修復問題

# 尋找相似規則
cm similar "錯誤處理最佳實踐"

Playbook 管理

cm playbook list                              # 所有規則
cm playbook get b-8f3a2c                      # 規則詳情
cm playbook add "永遠先執行測試"               # 新增規則
cm playbook add --file rules.json             # 從檔案批次新增
cm playbook add --file rules.json --session /path/session.jsonl  # 追蹤來源
cm playbook remove b-xyz --reason "已過時"    # 刪除
cm playbook export > backup.yaml              # 匯出
cm playbook import shared.yaml                # 匯入
cm playbook bootstrap react                   # 將入門套用至現有 Playbook

cm top 10                                     # 最有效的規則
cm stale --days 60                            # 近期無回饋的規則
cm why b-8f3a2c                               # 規則來源
cm stats --json                               # Playbook 健康指標

學習與回饋

# 手動回饋
cm mark b-8f3a2c --helpful
cm mark b-xyz789 --harmful --reason "造成回歸"
cm undo b-xyz789                              # 復原回饋

# 工作階段結果 (位置參數:狀態,規則)
cm outcome success b-8f3a2c,b-def456
cm outcome failure b-x7k9p1 --summary "認證方法失敗"
cm outcome-apply                              # 套用至 Playbook

# 反思 (通常為自動化)
cm reflect --days 7 --json
cm reflect --session /path/to/session.jsonl   # 單一工作階段
cm reflect --workspace /path/to/project       # 特定專案

# 驗證
cm validate "在取值前務必檢查 null"

# 審計工作階段與規則的比對情況
cm audit --days 30

# 永久棄用
cm forget b-xyz789 --reason "已被更好的模式取代"

入門引導 (代理原生)

使用你現有的代理以零成本建立 Playbook:

cm onboard status                             # 檢查進度
cm onboard gaps                               # 類別缺口
cm onboard sample --fill-gaps                 # 優先處理的工作階段
cm onboard sample --agent claude --days 14    # 按代理/時間過濾
cm onboard sample --workspace /path/project   # 按工作區過濾
cm onboard sample --include-processed         # 重新分析工作階段
cm onboard read /path/session.jsonl --template  # 豐富上下文
cm onboard mark-done /path/session.jsonl      # 標記為已處理
cm onboard reset                              # 重新開始

創傷防護 (安全系統)

cm trauma list                                # 活躍模式
cm trauma add "DROP TABLE" --description "大量刪除" --severity critical
cm trauma heal t-abc --reason "有意的遷移"
cm trauma remove t-abc
cm trauma scan --days 30                      # 掃描創傷
cm trauma import shared-traumas.yaml

cm guard --install                            # Claude Code 鉤子
cm guard --git                                # Git pre-commit 鉤子
cm guard --install --git                      # 兩者
cm guard --status                             # 檢查安裝狀態

系統指令

cm init                                       # 初始化
cm init --starter typescript                  # 使用範本
cm init --force                               # 重新初始化 (建立備份)
cm starters                                   # 列出範本
cm serve --port 3001                          # MCP 伺服器
cm usage                                      # LLM 成本統計
cm privacy status                             # 隱私設定
cm privacy enable                             # 啟用跨代理知識增強
cm privacy disable                            # 停用知識增強
cm project --format agents.md                 # 匯出至 AGENTS.md

入門 Playbook

從空的 Playbook 開始可能令人却步。入門套件提供了精選的最佳實踐:

cm starters                    # 列出可用的
cm init --starter typescript   # 使用入門套件初始化
cm playbook bootstrap react    # 套用至現有 Playbook

內建入門套件

入門套件焦點規則數
general通用最佳實踐5
typescriptTypeScript/Node.js 模式4
reactReact/Next.js 開發4
pythonPython/FastAPI/Django4
nodeNode.js/Express 服務4
rustRust 服務模式4

自訂入門套件

在 ~/.cass-memory/starters/ 中建立 YAML 檔案:

# ~/.cass-memory/starters/django.yaml
name: django
description: Django 網頁框架最佳實踐
bullets:
  - content: "始終使用 Django 的 ORM 進行資料庫操作"
    category: database
    maturity: established
    tags: [django, orm]

內聯回饋 (工作期間)

在程式碼註解中留下回饋。反思時會解析:

// [cass: helpful b-8f3a2c] - 這條規則讓我免於陷入死胡同

// [cass: harmful b-x7k9p1] - 這個建議不適合我們的用例

代理協定

1. 開始:    cm context "<任務>" --json
2. 工作:    遵循規則時引用其 ID (例如「遵循 b-8f3a2c...」)
3. 回饋:    當規則有幫助或造成傷害時,留下內聯註解
4. 結束:    直接完成即可。學習會自動進行。

你不需要:

  • 執行 cm reflect (自動化會處理)
  • 手動執行 cm mark (使用內聯註解)
  • 手動新增規則至 Playbook

缺口分析類別

類別關鍵字
debuggingerror, fix, bug, trace, stack
testingtest, mock, assert, expect, jest
architecturedesign, pattern, module, abstraction
workflowtask, CI/CD, deployment
documentationcomment, README, API doc
integrationAPI, HTTP, JSON, endpoint
collaborationreview, PR, team
gitbranch, merge, commit
securityauth, token, encrypt, permission
performanceoptimize, cache, profile

類別狀態閾值:

狀態規則數優先級
critical0 條規則高
underrepresented1-2 條規則中
adequate3-10 條規則低
well-covered11+ 條規則無

創傷防護:安全系統

「熱爐灶」原則 — 從過往事件中學習並防止再次發生。

運作方式

工作階段歷史                   創傷註冊表                   執行時防護
┌─────────────────┐         ┌─────────────────┐         ┌─────────────────┐
│ rm -rf /* (哎唷) │ ──────▶ │ 模式:rm -rf     │ ──────▶ │ 已封鎖:此指令    │
│ 「抱歉,我犯了   │  scan   │ 嚴重度:致命     │  hook   │ 符合創傷模式    │
│  一個錯誤...」   │         │ 工作階段:abc123 │         │                 │
└─────────────────┘         └─────────────────┘         └─────────────────┘

內建災難模式 (20+)

類別範例
檔案系統rm -rf /, rm -rf ~, 遞迴刪除
資料庫DROP DATABASE, TRUNCATE, DELETE FROM 沒有 WHERE
Gitgit push --force 到 main/master, git reset --hard
基礎設施terraform destroy -auto-approve, kubectl delete namespace
雲端aws s3 rm --recursive, 具破壞性的 CloudFormation

模式儲存

範圍位置用途
全域~/.cass-memory/traumas.jsonl個人模式
專案.cass/traumas.jsonl提交至儲存庫供團隊使用

模式生命週期

  • 活躍: 封鎖匹配的指令
  • 已痊癒: 暫時繞過 (帶有原因和時間戳)
  • 已刪除: 移除 (可重新新增)

MCP 伺服器

作為 MCP 伺服器執行以整合代理:

# 僅限本機 (建議)
cm serve --port 3001

# 使用認證令牌 (用於非迴路介面)
MCP_HTTP_TOKEN="<random>" cm serve --host 0.0.0.0 --port 3001

公開的工具

| 工具

…

[因翻譯需求而截斷]

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

bg-szy/TOP-SKILLS

Brand-first landing page designer — runs a brand-identity interview (colors, typography, shape language), then generates and iterates on a polished landing page via Stitch with deployment-ready HTML. Use when the user asks to create, design, or build a landing page, homepage, or marketing page and has no established visual direction. Skip when they have a design mockup, need a dashboard or app UI, are working at component level, building a multi-page app, or restyling with known design tokens — use frontend-design instead.

bg-szy/TOP-SKILLS

Fill out Microsoft Azure Landing Zone (ALZ) Accelerator checklists by interviewing the user, mapping their Azure subscriptions, integrating IP addressing documentation, and applying Microsoft Cloud Adoption Framework best practices. Produces a completed Excel checklist (.xlsx) ready for ALZ deployment. Use this skill whenever the user mentions Azure Landing Zone, ALZ checklist, landing zone accelerator, platform landing zone configuration, ALZ bootstrap, hub-and-spoke setup, Azure network topology planning, or wants to fill out any ALZ-related checklist or configuration file. Also trigger when the user uploads an Excel file that contains tabs like "Accelerator - Bootstrap", "Accelerator - Bicep", or "Accelerator - Terraform".

bg-szy/TOP-SKILLS

Compose a premium, animated landing page section by section in Next.js + Tailwind + Motion (Framer Motion) — built on a real design system, with editorial copy and motion that feels human-crafted, not template-generated. Use when building or rebuilding a landing page, marketing site, or hero/feature/pricing/CTA sections that need to look production-ready and bespoke from day one.

bg-szy/TOP-SKILLS

Write high-converting landing page copy using proven frameworks like PAS (Problem-Agitate-Solution), AIDA, and StoryBrand. Creates headlines, value propositions, CTAs, and full page sections optimized for conversion. Use when users need landing page copy, sales page content, or marketing website text.

bg-szy/TOP-SKILLS

Optimize landing pages for conversions, performance, and SEO. Use when improving landing pages, increasing conversions, or optimizing page performance.

bg-szy/TOP-SKILLS

Review investment portfolios for risk, diversification, fees. Asset allocation recommendations, tax-loss harvesting, rebalancing.

bg-szy/TOP-SKILLS

Beads Viewer - Graph-aware triage engine for Beads projects. Computes PageRank, betweenness, critical path, and cycles. Use --robot-* flags for AI agents.

bg-szy/TOP-SKILLS

CI red? Call us. Pipeline fire brigade deploys. Use when user mentions CI failures, build errors, test failures, or pipeline issues. Do NOT load for: local builds, standard implementation work, reviews, or setup.

bg-szy/TOP-SKILLS

Mandatory entry point: read this first for any request to make, create, edit, animate, or render a video, animation, or motion graphic, including a promo, explainer, captioned clip, title card, overlay, slideshow or interactive deck, Remotion port, or any HyperFrames HTML composition. Also use it to inspect, diagnose, validate, preview, publish, or batch-render an existing HyperFrames project. Inputs may be a website URL, GitHub PR, Figma design or URL, text or brief, existing footage, or music. It resumes project state, captures intent when applicable, selects and installs the owning workflow, and routes domain capabilities. HyperFrames is the default output framework unless the user explicitly chooses another framework for the deliverable or asks only to record a browser session.

bg-szy/TOP-SKILLS

Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences. Covers developer portfolios, designer portfolios, creative portfolios, and portfolios that convert visitors into opportunities.

bg-szy/TOP-SKILLS

Use when the user asks to "pre-launch check the landing page", "run a Quality-Score preflight", or "verify ad-to-page message match before launch"; produces an ad↔page continuity report — message-match gaps, above-the-fold check, page-speed read, form-friction count, mobile-render flags — as a pass/fix punch list. Not for redesigning or rewriting the page — use landing-optimizer; not for scoring the account or the RQS — use ad-account-auditor. 落地页体验预检/广告落地页一致性检查

bg-szy/TOP-SKILLS

Use when the user asks to "optimize our landing page for influencer traffic", "fix our promo-code landing page", or "improve conversion from a creator campaign"; produces a message-match audit, page-structure and social-proof recommendations, a promo-code/CTA conversion plan, and an A/B test roadmap. Not for measuring campaign results after launch — use performance-analyzer.

bg-szy/TOP-SKILLS

Audit a landing page, sales page or checkout page for conversion leaks and return a fix list ordered by expected revenue impact. Use when asked to review, critique or improve a landing page, sales page, opt-in page, product page or checkout flow, when conversion rate is low, when paid traffic is not converting, or when someone asks "why isn't this page converting" or wants a CRO / landing page review.

bg-szy/TOP-SKILLS

Landing page conversion optimization with layout rules, hero section design, and CTA psychology. Covers above-the-fold formula, social proof placement, mobile design, and F-pattern reading. Use for: startup landing pages, product pages, SaaS marketing, conversion optimization. Triggers: landing page, hero section, above the fold, conversion optimization, landing page design, cta button, hero image, landing page layout, saas landing page, product page design, conversion rate, landing page best practices

bg-szy/TOP-SKILLS

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

bg-szy/TOP-SKILLS

Landing page conversion optimization with layout rules, hero section design, and CTA psychology. Covers above-the-fold formula, social proof placement, mobile design, and F-pattern reading. Use for: startup landing pages, product pages, SaaS marketing, conversion optimization. Triggers: landing page, hero section, above the fold, conversion optimization, landing page design, cta button, hero image, landing page layout, saas landing page, product page design, conversion rate, landing page best practices

bg-szy/TOP-SKILLS

Account assets, equity and fund positions, P&L, cash flow records, account statements, margin ratios, buy-power estimates, order management, and DCA recurring investments via Longbridge (most require Trade permission). Frameworks: portfolio diagnosis, rebalancing, asset allocation, risk analysis (VaR/CVaR), performance attribution, and tax-loss harvesting. Triggers: "持仓", "账户", "盈亏", "资产", "对账单", "下单", "买入", "卖出", "撤单", "定投", "组合诊断", "再平衡", "资产配置", "风险分析", "绩效归因", "税损收割", "持倉", "賬戶", "盈虧", "對賬單", "下單", "買入", "賣出", "組合診斷", "再平衡", "稅損收割", "positions", "portfolio", "P&L", "order", "buy", "sell", "DCA", "statement", "risk analysis", "rebalancing", "tax harvesting", "我的风险", "持仓风险", "风险敞口", "資產", "資產配置", "風險分析", "績效歸因", "撤單

bg-szy/TOP-SKILLS

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

bg-szy/TOP-SKILLS

Process video files with audio extraction, format conversion (mp4, webm), and Whisper transcription. Use when user mentions video conversion, audio extraction, transcription, mp4, webm, ffmpeg, or whisper transcription.

bg-szy/TOP-SKILLS

Using the Wonda CLI to generate images, videos, music, and audio from the terminal — plus LinkedIn, Reddit, and X/Twitter research and automation

相關技能