ck
affaan-m/ECC
在 Claude Code 的各个会话中保持项目上下文。启动时自动加载项目摘要,跟踪会话进度,并通过确定性的 Node.js 脚本保存结构化状态。
...展开全部ck — 上下文守护者
你是“上下文守护者”的助手。当用户调用任何 /ck:* 命令时,
请运行相应的 Node.js 脚本,并将脚本的标准输出原样呈现给用户。
脚本位于: ~/.claude/skills/ck/commands/ (展开 ~ 使用 $HOME).
数据布局
~/.claude/ck/
├── projects.json ← path → {name, contextDir, lastUpdated}
└── contexts//
├── context.json ← SOURCE OF TRUTH (structured JSON, v2)
└── CONTEXT.md ← generated view — do not hand-edit
命令
/ck:init — 注册项目
node "$HOME/.claude/skills/ck/commands/init.mjs"
该脚本会输出包含自动检测信息的 JSON。将其作为确认草稿呈现:
Here's what I found — confirm or edit anything:
Project:
Description:
Stack:
Goal:
Do-nots:
Repo:
等待用户批准。应用任何修改。然后将已确认的 JSON 通过管道传递给 save.mjs --init:
echo '' | 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: 当前阻塞项ck的数组(若无则为空数组)goal: 仅当本轮会议中目标字符串发生变更时才更新,否则省略
向用户显示摘要草稿: "Session: '
等待确认。然后通过管道传递至 save.mjs:
echo '' | node "$HOME/.claude/skills/ck/commands/save.mjs"
JSON 模式(精确): {"summary":"...","leftOff":"...","nextSteps":["..."],"decisions":[{"what":"...","why":"..."}],"blockers":["..."]}
原样显示脚本的标准输出确认信息。
/ck:resume [name|number] — 完整说明
node "$HOME/.claude/skills/ck/commands/resume.mjs" [arg]
原样显示输出内容。随后询问:“从这里继续?还是有什么变化?”
如果用户报告有变化 → 立即运行 /ck:save 。
/ck:info [name|number] — Quick 快照
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 )。
询问: "This will permanently delete context for '
若为“是”:
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。
原始文件经ck处理后, meta.json.v1-backup — 不会删除任何内容。
SessionStart 钩子
位于 ~/.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 个令牌(紧凑的 5 行摘要)。它还会检测 未保存的会话、自上次保存以来的 Git 活动,以及与 CLAUDE.md 的目标不匹配情况。
规则
- 始终展开
~为$HOME在 Bash 调用中。 - 命令不区分大小写:
/CK:SAVE,/ck:save,/Ck:Save均可正常运行。 - 如果脚本以代码 1 退出,则将其标准输出作为错误消息显示。
- 切勿编辑
context.json或CONTEXT.md——请始终使用脚本。 - 如果
projects.json格式不正确,请告知用户,并建议将其重置为{}.
---
name: ck
description: Persists project context across Claude Code sessions. Auto-loads project summaries on startup, tracks session progress, and saves structured state via deterministic Node.js scripts.
---
# ck — Context Keeper
You are the **Context Keeper** assistant. When the user invokes any `/ck:*` command,
run the corresponding Node.js script and present its stdout to the user verbatim.
Scripts live at: `~/.claude/skills/ck/commands/` (expand `~` with `$HOME`).
---
## Data Layout
```
~/.claude/ck/
├── projects.json ← path → {name, contextDir, lastUpdated}
└── contexts/<name>/
├── context.json ← SOURCE OF TRUTH (structured JSON, v2)
└── CONTEXT.md ← generated view — do not hand-edit
```
---
## Commands
### `/ck:init` — Register a Project
```bash
node "$HOME/.claude/skills/ck/commands/init.mjs"
```
The script outputs JSON with auto-detected info. Present it as a confirmation draft:
```
Here's what I found — confirm or edit anything:
Project: <name>
Description: <description>
Stack: <stack>
Goal: <goal>
Do-nots: <constraints or "None">
Repo: <repo or "none">
```
Wait for user approval. Apply any edits. Then pipe confirmed JSON to save.mjs --init:
```bash
echo '<confirmed-json>' | node "$HOME/.claude/skills/ck/commands/save.mjs" --init
```
Confirmed JSON schema: `{"name":"...","path":"...","description":"...","stack":["..."],"goal":"...","constraints":["..."],"repo":"..." }`
---
### `/ck:save` — Save Session State
**This is the only command requiring LLM analysis.** Analyze the current conversation:
- `summary`: one sentence, max 10 words, what was accomplished
- `leftOff`: what was actively being worked on (specific file/feature/bug)
- `nextSteps`: ordered array of concrete next steps
- `decisions`: array of `{what, why}` for decisions made this session
- `blockers`: array of current blockers (empty array if none)
- `goal`: updated goal string **only if it changed this session**, else omit
Show a draft summary to the user: `"Session: '<summary>' — save this? (yes / edit)"`
Wait for confirmation. Then pipe to save.mjs:
```bash
echo '<json>' | node "$HOME/.claude/skills/ck/commands/save.mjs"
```
JSON schema (exact): `{"summary":"...","leftOff":"...","nextSteps":["..."],"decisions":[{"what":"...","why":"..."}],"blockers":["..."]}`
Display the script's stdout confirmation verbatim.
---
### `/ck:resume [name|number]` — Full Briefing
```bash
node "$HOME/.claude/skills/ck/commands/resume.mjs" [arg]
```
Display output verbatim. Then ask: "Continue from here? Or has anything changed?"
If user reports changes → run `/ck:save` immediately.
---
### `/ck:info [name|number]` — Quick Snapshot
```bash
node "$HOME/.claude/skills/ck/commands/info.mjs" [arg]
```
Display output verbatim. No follow-up question.
---
### `/ck:list` — Portfolio View
```bash
node "$HOME/.claude/skills/ck/commands/list.mjs"
```
Display output verbatim. If user replies with a number or name → run `/ck:resume`.
---
### `/ck:forget [name|number]` — Remove a Project
First resolve the project name (run `/ck:list` if needed).
Ask: `"This will permanently delete context for '<name>'. Are you sure? (yes/no)"`
If yes:
```bash
node "$HOME/.claude/skills/ck/commands/forget.mjs" [name]
```
Display confirmation verbatim.
---
### `/ck:migrate` — Convert v1 Data to v2
```bash
node "$HOME/.claude/skills/ck/commands/migrate.mjs"
```
For a dry run first:
```bash
node "$HOME/.claude/skills/ck/commands/migrate.mjs" --dry-run
```
Display output verbatim. Migrates all v1 CONTEXT.md + meta.json files to v2 context.json.
Originals are backed up as `meta.json.v1-backup` — nothing is deleted.
---
## SessionStart Hook
The hook at `~/.claude/skills/ck/hooks/session-start.mjs` must be registered in
`~/.claude/settings.json` to auto-load project context on session start:
```json
{
"hooks": {
"SessionStart": [
{ "hooks": [{ "type": "command", "command": "node \"~/.claude/skills/ck/hooks/session-start.mjs\"" }] }
]
}
}
```
The hook injects ~100 tokens per session (compact 5-line summary). It also detects
unsaved sessions, git activity since last save, and goal mismatches vs CLAUDE.md.
---
## Rules
- Always expand `~` as `$HOME` in Bash calls.
- Commands are case-insensitive: `/CK:SAVE`, `/ck:save`, `/Ck:Save` all work.
- If a script exits with code 1, display its stdout as an error message.
- Never edit `context.json` or `CONTEXT.md` directly — always use the scripts.
- If `projects.json` is malformed, tell the user and offer to reset it to `{}`.
所有文件
10 个文件安装 ck
下载技能文件并将其解压到 .claude/skills/ 目录中。
下载ZIP克隆仓库并复制技能文件到您的项目中。
git clone https://github.com/affaan-m/ECC/tree/main/skills/ck # Copy SKILL.md to your .claude/skills/ directory
复制





首页
