Communitygithub.com

ck — 上下文保持器

为 Claude Code 提供持久化的项目级记忆。在会话启动时自动加载项目上下文,通过 Git 活动追踪会话,并将信息写入原生记忆。命令运行确定性 Node.js 脚本,在不同模型版本间行为一致。当项目需要跨 Claude Code 会话保持上下文,而无需每次都重新解释时使用。

ck — 上下文保持器 是什么?

ck(Context Keeper)是一个 Claude Code 技能,旨在为开发工作流提供持久、跨会话的项目级记忆。它通过在会话启动时自动注入紧凑的项目摘要(约 100 个 token)解决了“冷启动”问题,使 AI 能够立即理解项目的背景、目标、堆栈和约束。该技能维护一个结构化的 v2 数据布局,包括一个 projects.json 文件和每个项目的专用上下文目录,其中 context.json 是事实来源。ck 提供了全面的命令,包括:用于注册新项目的 /ck:init(需要用户确认生成的 JSON)、用于保存当前会话状态(含摘要、下一步、决策和阻碍项)的 /ck:save、用于恢复完整项目简介的 /ck:resume、用于获取快速快照的 /ck:info、用于列出所有项目的 /ck:list、用于删除项目的 /ck:forget,以及用于将 v1 数据转换为 v2 格式的 /ck:migrate。所有命令都运行确定性的 Node.js 脚本,确保行为在不同模型版本间保持一致。SessionStart 钩子会自动注册,自动检测未保存的会话和 Git 活动。该技能专为 Claude Code 设计,在项目上下文复杂且需要跨多个会话保持一致性的场景中至关重要,显著提高了大型或长期项目的工作效率。

兼容平台✓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)。


数据布局 (Data Layout)

~/.claude/ck/
├── projects.json              ← 路径 → {name, contextDir, lastUpdated}
└── contexts/<name>/
    ├── context.json           ← 事实来源 (结构化 JSON, v2)
    └── CONTEXT.md             ← 生成的视图 — 请勿手动编辑

命令 (Commands)

/ck:init — 注册项目 (Register a Project)

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 — 保存会话状态 (Save Session State)

这是唯一需要 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] — 完整简报 (Full Briefing)

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

显示输出(原样)。然后询问:"要从此处继续吗?或者有什么变化?" 如果用户报告有变化 → 立即运行 /ck:save。


/ck:info [name|number] — 快速快照 (Quick Snapshot)

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

显示输出(原样)。不询问后续问题。


/ck:list — 项目列表 (Portfolio View)

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

显示输出(原样)。如果用户用数字或名称回复 → 运行 /ck:resume。


/ck:forget [name|number] — 删除项目 (Remove a Project)

首先解析项目名称(如有必要,运行 /ck:list)。 询问:"此操作将永久删除项目 '<name>' 的上下文。确定吗?(是/否)" 如果回答是:

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

显示确认信息(原样)。


/ck:migrate — 将 v1 数据转换为 v2 (Convert v1 Data to 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 — 不删除任何内容。


会话启动钩子 (SessionStart Hook)

位于 ~/.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 的目标不匹配情况。


规则 (Rules)

  • 在 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.

相关技能