Communitygithub.com

ck — Context Keeper(環境記憶管理)

為 Claude Code 提供持續性的專案記憶。在每次工作階段開始時自動載入專案上下文,透過 Git 活動追蹤工作階段,並將記錄寫入原生記憶。

ck — Context Keeper(環境記憶管理) 是什麼?

Context Keeper(ck)是一套專為 Claude Code 設計的技能,解決了每次新工作階段都需要重新解釋專案上下文的痛點。它透過本地檔案系統(位於 ~/.claude/ck/)儲存結構化的專案資訊、對話摘要與決策記錄,並在每次工作階段啟動時自動注入約 100 個 token 的簡潔摘要,讓 AI 助手立即掌握專案狀態。ck 支援多個指令:init(註冊新專案)、save(儲存目前對話狀態與進展)、resume(取得完整簡報)、info(快速檢視)、list(列出所有專案)、forget(刪除專案)以及 migrate(從 v1 資料格式升級至 v2)。所有指令皆由固定的 Node.js 指令碼執行,確保行為在不同模型版本間一致。ck 特別適合需要長期維護、多人協作或複雜決策記錄的開發專案,可大幅減少重複說明並提升 AI 輔助的連貫性。

相容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/ECC/tree/main/skills/ck

在你喜歡的 AI 中提問

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

說明文件

ck — Context Keeper(環境記憶管理) 是做什麼的?

您是 Context Keeper 助理。當使用者呼叫任何 /ck:* 指令時, 請執行對應的 Node.js 指令碼,並將其 stdout 內容完整呈現給使用者。 指令碼存放位置:~/.claude/skills/ck/commands/(將 ~ 展開為 $HOME)。


資料結構

~/.claude/ck/
├── projects.json              ← 路徑 → {name, contextDir, lastUpdated}
└── contexts/<name>/
    ├── context.json           ← 最終依據(結構化 JSON,v2 格式)
    └── CONTEXT.md             ← 自動產生的檢視檔,請勿手動編輯

指令

/ck:init — 註冊專案

node "$HOME/.claude/skills/ck/commands/init.mjs"

該指令碼會輸出包含自動偵測資訊的 JSON。請將其呈現為確認草稿:

以下是偵測到的資訊 — 請確認或編輯:
專案名稱:     <name>
描述:         <description>
技術棧:       <stack>
目標:         <goal>
禁止事項:     <constraints 或 "無">
儲存庫:       <repo 或 "無">

等待使用者批准。接受任何編輯。然後將確認後的 JSON 透過管道傳給 save.mjs --init:

echo '<confirmed-json>' | node "$HOME/.claude/skills/ck/commands/save.mjs" --init

確認後的 JSON 結構:{"name":"...","path":"...","description":"...","stack":["..."],"goal":"...","constraints":["..."],"repo":"..." }


/ck:save — 儲存工作階段狀態

這是唯一需要 LLM 分析的指令。 分析目前對話:

  • summary:一句話,最多 10 個字,說明完成了什麼
  • leftOff:目前正積極處理的工作(特定檔案/功能/錯誤)
  • nextSteps:有序的具體下一步動作陣列
  • decisions:決策陣列,每項包含 {what, why}
  • blockers:目前的阻礙陣列(若無則為空陣列)
  • goal:僅在本次工作階段中目標有變更時才包含更新後的目標字串,否則省略

向使用者顯示草稿摘要:「工作階段:'<summary>' — 要儲存嗎?(是 / 編輯)」 等待確認。然後透過管道傳給 save.mjs:

echo '<json>' | node "$HOME/.claude/skills/ck/commands/save.mjs"

JSON 結構(必須嚴格符合):{"summary":"...","leftOff":"...","nextSteps":["..."],"decisions":[{"what":"...","why":"..."}],"blockers":["..."]}

顯示指令碼 stdout 的確認訊息(原樣呈現)。


/ck:resume [name|number] — 完整簡報

node "$HOME/.claude/skills/ck/commands/resume.mjs" [arg]

原樣顯示輸出。然後詢問:「要從這裡繼續嗎?或者有什麼變更?」 如果使用者回報有變更 → 立即執行 /ck:save。


/ck:info [name|number] — 快速檢視

node "$HOME/.claude/skills/ck/commands/info.mjs" [arg]

原樣顯示輸出。不需追問。


/ck:list — 專案清單

node "$HOME/.claude/skills/ck/commands/list.mjs"

原樣顯示輸出。如果使用者回覆編號或名稱 → 執行 /ck:resume。


/ck:forget [name|number] — 刪除專案

先解析專案名稱(必要時執行 /ck:list)。 詢問:「這將永久刪除 '' 的上下文。確定嗎?(是 / 否)」 如果確定:

node "$HOME/.claude/skills/ck/commands/forget.mjs" [name]

原樣顯示確認訊息。


/ck:migrate — 將 v1 資料轉換為 v2

node "$HOME/.claude/skills/ck/commands/migrate.mjs"

建議先執行預覽模式:

node "$HOME/.claude/skills/ck/commands/migrate.mjs" --dry-run

原樣顯示輸出。將所有 v1 的 CONTEXT.md 和 meta.json 檔案轉換為 v2 的 context.json。 原始檔案會備份為 meta.json.v1-backup — 不會刪除任何檔案。


工作階段啟動掛鉤

位於 ~/.claude/skills/ck/hooks/session-start.mjs 的掛鉤必須在 ~/.claude/settings.json 中註冊,以便在工作階段啟動時自動載入專案上下文:

{
  "hooks": {
    "SessionStart": [
      { "hooks": [{ "type": "command", "command": "node \"~/.claude/skills/ck/hooks/session-start.mjs\"" }] }
    ]
  }
}

該掛鉤每次工作階段僅注入約 100 個 token(精簡的 5 行摘要)。它也能偵測 未儲存的工作階段、自上次儲存以來的 Git 活動,以及與 CLAUDE.md 之間的目標不一致。


規則

  • 在 Bash 呼叫中始終將 ~ 展開為 $HOME。
  • 指令不區分大小寫:/CK:SAVE、/ck:save、/Ck:Save 均有效。
  • 如果指令碼以狀態碼 1 結束,請將其 stdout 顯示為錯誤訊息。
  • 永遠不要直接編輯 context.json 或 CONTEXT.md — 一律透過指令碼操作。
  • 如果 projects.json 格式錯誤,請告知使用者並提供將其重置為 {} 的選項。

Individual skills in this repo

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

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/content-engine

Create platform-native content systems for X, LinkedIn, TikTok, YouTube, newsletters, and repurposed multi-platform campaigns. Use when the user wants social posts, threads, scripts, content calendars, or one source asset adapted cleanly across platforms.

affaan-m/ECC

Multi-platform content distribution across X, LinkedIn, Threads, and Bluesky. Adapts content per platform using content-engine patterns. Never posts identical content cross-platform. Use when the user wants to distribute content across social platforms.

affaan-m/fal-ai-media

Unified media generation via fal.ai MCP — image, video, and audio. Covers text-to-image (Nano Banana), text/image-to-video (Seedance, Kling, Veo 3), text-to-speech (CSM-1B), and video-to-audio (ThinkSound). Use when the user wants to generate images, videos, or audio with AI.

affaan-m/manim-video

日本語翻訳:このファイルは manim-video 用の日本語翻訳が必要です

affaan-m/remotion-video-creation

Remotion のベストプラクティス - React で動画を作成する。3D、アニメーション、音声、字幕、チャート、トランジションなどをカバーするドメイン固有の29のルール。

affaan-m/video-editing

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

agent-self-evaluation

Use after completing any non-trivial task. The agent self-rates its output on 5 axes — accuracy, completeness, clarity, actionability, conciseness — with concrete evidence per criterion. Produces a structured 1-5 scorecard with specific improvement suggestions.

agent-sort

Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.

ai-first-engineering

Engineering operating model for teams where AI agents generate a large share of implementation output. Use when setting team process, review gates, or ownership rules for a codebase largely written by agents.

ai-regression-testing

Regression testing strategies for AI-assisted development. Sandbox-mode API testing without database dependencies, automated bug-check workflows, and patterns to catch AI blind spots where the same model writes and reviews code. Use when adding regression coverage to AI-assisted code, or when the same model both wrote and reviewed a change.

android-clean-architecture

Clean Architecture patterns for Android and Kotlin Multiplatform projects — module structure, dependency rules, UseCases, Repositories, and data layer patterns. Use when structuring modules, layers, or data flow in an Android or KMP project.

angular-developer

Generates Angular code and provides architectural guidance. Trigger when creating projects, components, or services, or for best practices on reactivity (signals, linkedSignal, resource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, or CLI tooling.

相關技能