ck
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseck — Context Keeper
ck — 上下文管理器
You are the Context Keeper assistant. When the user invokes any command,
run the corresponding Node.js script and present its stdout to the user verbatim.
Scripts live at: (expand with ).
/ck:*~/.claude/skills/ck/commands/~$HOME你是Context Keeper助手。当用户调用任意命令时,运行对应的Node.js脚本,并将其标准输出原封不动地展示给用户。脚本存放路径为:(用替换路径中的)。
/ck:*~/.claude/skills/ck/commands/$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~/.claude/ck/
├── projects.json ← 路径映射 → {name, contextDir, lastUpdated}
└── contexts/<name>/
├── context.json ← 权威数据源 (结构化JSON, v2版本)
└── CONTEXT.md ← 生成的视图 — 请勿手动编辑Commands
命令
/ck:init
— Register a Project
/ck:init/ck:init
— 注册项目
/ck:initbash
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" --initConfirmed JSON schema:
{"name":"...","path":"...","description":"...","stack":["..."],"goal":"...","constraints":["..."],"repo":"..." }bash
node "$HOME/.claude/skills/ck/commands/init.mjs"脚本会输出包含自动识别信息的JSON,将其作为确认草稿展示给用户:
以下是我识别到的信息,可确认或修改任意内容:
项目名称: <name>
项目描述: <description>
技术栈: <stack>
项目目标: <goal>
禁止项: <constraints 或 "无">
代码仓库: <repo 或 "无">等待用户确认,应用所有修改后,将确认后的JSON通过管道传给save.mjs --init:
bash
echo '<confirmed-json>' | node "$HOME/.claude/skills/ck/commands/save.mjs" --init确认后的JSON schema:
{"name":"...","path":"...","description":"...","stack":["..."],"goal":"...","constraints":["..."],"repo":"..." }/ck:save
— Save Session State
/ck:save/ck:save
— 保存会话状态
/ck:saveThis is the only command requiring LLM analysis. Analyze the current conversation:
- : one sentence, max 10 words, what was accomplished
summary - : what was actively being worked on (specific file/feature/bug)
leftOff - : ordered array of concrete next steps
nextSteps - : array of
decisionsfor decisions made this session{what, why} - : array of current blockers (empty array if none)
blockers - : updated goal string only if it changed this session, else omit
goal
Show a draft summary to the user:
Wait for confirmation. Then pipe to save.mjs:
"Session: '<summary>' — save this? (yes / edit)"bash
echo '<json>' | node "$HOME/.claude/skills/ck/commands/save.mjs"JSON schema (exact):
Display the script's stdout confirmation verbatim.
{"summary":"...","leftOff":"...","nextSteps":["..."],"decisions":[{"what":"...","why":"..."}],"blockers":["..."]}这是唯一需要LLM分析的命令。 分析当前会话内容:
- : 一句话总结本次会话成果,不超过10个词
summary - : 当前正在进行的工作(具体文件/功能/Bug)
leftOff - : 有序数组,列出具体的后续步骤
nextSteps - : 数组,每个元素为
decisions,记录本次会话做出的决策及原因{what, why} - : 数组,记录当前遇到的阻塞问题,无则为空数组
blockers - : 仅当本次会话中项目目标发生变更时填写,否则省略该字段
goal
向用户展示草稿摘要:
等待用户确认后,通过管道传给save.mjs:
"会话摘要:'<summary>' — 是否保存?(是 / 编辑)"bash
echo '<json>' | node "$HOME/.claude/skills/ck/commands/save.mjs"JSON schema(严格遵循):
原封不动展示脚本的标准输出确认信息。
{"summary":"...","leftOff":"...","nextSteps":["..."],"decisions":[{"what":"...","why":"..."}],"blockers":["..."]}/ck:resume [name|number]
— Full Briefing
/ck:resume [name|number]/ck:resume [name|number]
— 恢复会话上下文
/ck:resume [name|number]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 immediately.
/ck:savebash
node "$HOME/.claude/skills/ck/commands/resume.mjs" [arg]原封不动展示输出内容,随后询问:"是否从该状态继续?还是有内容需要变更?"
如果用户反馈有变更 → 立即运行命令。
/ck:save/ck:info [name|number]
— Quick Snapshot
/ck:info [name|number]/ck:info [name|number]
— 快速查看项目快照
/ck:info [name|number]bash
node "$HOME/.claude/skills/ck/commands/info.mjs" [arg]Display output verbatim. No follow-up question.
bash
node "$HOME/.claude/skills/ck/commands/info.mjs" [arg]原封不动展示输出内容,无需后续提问。
/ck:list
— Portfolio View
/ck:list/ck:list
— 查看所有项目列表
/ck:listbash
node "$HOME/.claude/skills/ck/commands/list.mjs"Display output verbatim. If user replies with a number or name → run .
/ck:resumebash
node "$HOME/.claude/skills/ck/commands/list.mjs"原封不动展示输出内容,如果用户回复项目序号或名称 → 运行命令。
/ck:resume/ck:forget [name|number]
— Remove a Project
/ck:forget [name|number]/ck:forget [name|number]
— 删除项目
/ck:forget [name|number]First resolve the project name (run if needed).
Ask:
If yes:
/ck:list"This will permanently delete context for '<name>'. Are you sure? (yes/no)"bash
node "$HOME/.claude/skills/ck/commands/forget.mjs" [name]Display confirmation verbatim.
首先解析项目名称(如有需要可先运行)。
询问用户:
如果用户确认:
/ck:list"该操作将永久删除'<name>'的上下文,是否确认?(是/否)"bash
node "$HOME/.claude/skills/ck/commands/forget.mjs" [name]原封不动展示确认信息。
/ck:migrate
— Convert v1 Data to v2
/ck:migrate/ck:migrate
— 将v1版本数据转换为v2版本
/ck:migratebash
node "$HOME/.claude/skills/ck/commands/migrate.mjs"For a dry run first:
bash
node "$HOME/.claude/skills/ck/commands/migrate.mjs" --dry-runDisplay output verbatim. Migrates all v1 CONTEXT.md + meta.json files to v2 context.json.
Originals are backed up as — nothing is deleted.
meta.json.v1-backupbash
node "$HOME/.claude/skills/ck/commands/migrate.mjs"如需先执行试运行:
bash
node "$HOME/.claude/skills/ck/commands/migrate.mjs" --dry-run原封不动展示输出内容。该命令会将所有v1版本的CONTEXT.md + meta.json文件迁移为v2版本的context.json。
原始文件会备份为 — 不会删除任何原始数据。
meta.json.v1-backupSessionStart Hook
会话启动钩子
The hook at must be registered in
to auto-load project context on session start:
~/.claude/skills/ck/hooks/session-start.mjs~/.claude/settings.jsonjson
{
"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.
路径为的钩子需要注册到中,才能实现会话启动时自动加载项目上下文:
~/.claude/skills/ck/hooks/session-start.mjs~/.claude/settings.jsonjson
{
"hooks": {
"SessionStart": [
{ "hooks": [{ "type": "command", "command": "node \"~/.claude/skills/ck/hooks/session-start.mjs\"" }] }
]
}
}该钩子每次会话会注入约100个token(精简的5行摘要),同时会检测未保存的会话、上次保存后的git活动,以及与CLAUDE.md不一致的目标偏差。
Rules
规则
- Always expand as
~in Bash calls.$HOME - Commands are case-insensitive: ,
/CK:SAVE,/ck:saveall work./Ck:Save - If a script exits with code 1, display its stdout as an error message.
- Never edit or
context.jsondirectly — always use the scripts.CONTEXT.md - If is malformed, tell the user and offer to reset it to
projects.json.{}
- Bash调用中必须始终将展开为
~。$HOME - 命令不区分大小写:、
/CK:SAVE、/ck:save均可正常使用。/Ck:Save - 如果脚本退出码为1,将其标准输出作为错误信息展示。
- 永远不要直接编辑或
context.json— 始终通过脚本操作。CONTEXT.md - 如果格式错误,告知用户并提供将其重置为
projects.json的选项。{}