Manage restore context files so skills can survive /clear and /compact. Use to write, delete, check, or list .agent-restore-context-* files.
中文简介正在准备中。当前显示原文说明。
Set up the restore-context hook so skills can survive /clear and /compact. Detects .claude/ vs .agents/ layout automatically.
中文简介正在准备中。当前显示原文说明。
查看安装方法安装前可以查看交给 AI 代理的指令内容。
Set up a generic SessionStart hook that re-injects context after /clear or
/compact. Any skill that writes a .agent-restore-context-<name> file in the
project root will have its contents automatically injected into the fresh
conversation.
.agent-restore-context-<skill-name> files with resume prompts.SessionStart hook with matcher clear|compact runs agent-restore-context.sh..agent-restore-context-* and outputs their contents.Determine which configuration layer the project uses:
| Check | Layout | Skills directory |
|---|---|---|
.agents/ directory exists | agents | .agents/skills/ |
Only .claude/ exists | claude | .claude/skills/ |
Settings files always live under .claude/ regardless of layout.
Read .claude/settings.json and .claude/settings.local.json (if it exists).
Search both for restore-context. If found in either file, report that the hook
is already configured and stop.
The script is at <skills-dir>/agent-restore-context-setup/resources/agent-restore-context.sh
(using the skills directory from step 1).
Verify the script exists and is executable. If not executable, run chmod +x.
Run gh repo view --json viewerPermission --jq '.viewerPermission'. If the
result is READ, warn the user that the repo is read-only — any changes made
to .claude/settings.json or .gitignore will need to be committed and pushed
manually. Continue with the rest of the steps as normal.
Ask the user:
"Should I add the restore-context hook to
.claude/settings.json(shared/committed) or.claude/settings.local.json(local only)?"
Compute the script path relative to the project root (from step 3), then merge
the following into the chosen file's hooks object. Do not overwrite
existing hooks — add to or create the SessionStart array:
{
"SessionStart": [
{
"matcher": "clear|compact",
"hooks": [
{
"type": "command",
"command": "bash <skills-dir>/agent-restore-context-setup/resources/agent-restore-context.sh"
}
]
}
]
}
Check .gitignore for .agent-restore-context-*. If not present, append:
# Restore context files (used by skills to survive /clear and /compact)
.agent-restore-context-*
Report to the user:
.agent-restore-context-<name> files to use
this pattern.agents/ or .agents/skills/ directories — only use them if
they already exist还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Manage restore context files so skills can survive /clear and /compact. Use to write, delete, check, or list .agent-restore-context-* files.
中文简介正在准备中。当前显示原文说明。
You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.
中文简介正在准备中。当前显示原文说明。
Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks.
中文简介正在准备中。当前显示原文说明。
Archive a completed change. Use when the user wants to finalize and archive a change after implementation is complete.
中文简介正在准备中。当前显示原文说明。
Enter explore mode - a thinking partner for exploring ideas, investigating problems, and clarifying requirements. Use when the user wants to think through something before or during a change.
中文简介正在准备中。当前显示原文说明。
Propose a new change with all artifacts generated in one step. Use when the user wants to quickly describe what they want to build and get a complete proposal with design, specs, and tasks ready for implementation.
中文简介正在准备中。当前显示原文说明。