with one click
agent-restore-context-setup
// Set up the restore-context hook so skills can resume workflows after /clear and /compact. Use when setting up a new project or after cloning a repo that uses restore-context skills.
// Set up the restore-context hook so skills can resume workflows after /clear and /compact. Use when setting up a new project or after cloning a repo that uses restore-context skills.
Manage restore context files so skills can survive /clear and /compact. Use to write, delete, check, or list .agent-restore-context-* files.
Fetch Jira ticket, create branch, implement changes, commit, push, open PR.
Generate AI-assisted navigation aids to help humans start reviewing a pull request more efficiently. Use when starting a PR review to get oriented on large or unfamiliar changes.
Persist guidelines, conventions, and architectural decisions into the repository's knowledge base. Use when told to remember something for future sessions.
Perform migrations for Renovate dependency upgrades based on breaking changes identified in a review. Use after running /renovate-review.
Review Renovate dependency upgrade PRs to assess safety and effort. Use when reviewing PRs from Renovate bot that update NPM dependencies.
| name | agent-restore-context-setup |
| description | Set up the restore-context hook so skills can resume workflows after /clear and /compact. Use when setting up a new project or after cloning a repo that uses restore-context skills. |
| disable-model-invocation | false |
| allowed-tools | Bash, Grep, Glob, Read, Edit, Write |
| scope | ["knowledge"] |
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.Security: The contents of
.agent-restore-context-*files are injected verbatim into the model's context on every session start after/clearor/compact. Treat these files with the same trust as other executable config. Only skills running in your project should write them — this is why the.gitignoreentry in step 5 is important.
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.
Note: When installed via the skills CLI targeting the Claude Code agent, the skill is placed under
.claude/skills/. When targeting a universal agent (Amp, Cline, Cursor, etc.), it is placed under.agents/skills/.
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.
Find the script by checking both potential locations in order:
.claude/skills/agent-restore-context-setup/resources/agent-restore-context.sh.agents/skills/agent-restore-context-setup/resources/agent-restore-context.shUse whichever path exists. If neither exists, stop and report that the skill files could not be found — the user may need to re-install the skill.
Verify the script is executable. If not executable, run chmod +x.
Optional — symlink for dual-layout projects: If both
.claude/skills/and.agents/skills/directories exist but the skill is only in one of them, you may create a symlink at the missing location so both layouts share a single copy. For example, if the script was found under.claude/skills/, create a symlink under.agents/skills/:ln -s ../../.claude/skills/agent-restore-context-setup \ .agents/skills/agent-restore-context-setupReverse the paths if the script was found under
.agents/skills/instead. This is optional — the hook only needs the one resolved path to work.
Ask the user:
"Should I add the restore-context hook to
.claude/settings.json(shared — committed to the repo, takes effect for all teammates once pushed) or.claude/settings.local.json(local only — never committed, affects only your machine)?"Recommendation: choose
settings.jsonif you want the whole team to benefit from the hook. Choosesettings.local.jsonif you are the only one who will use this workflow, or if teammates install their skills to different paths.
If the chosen settings file does not exist, create it as an empty JSON object
({}) before merging.
Use the resolved script path from step 3 (relative to the project root), 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 <resolved-script-path>"
}
]
}
]
}
Where <resolved-script-path> is the relative path found in step 3, e.g.
.claude/skills/agent-restore-context-setup/resources/agent-restore-context.sh
or .agents/skills/agent-restore-context-setup/resources/agent-restore-context.sh.
Check .gitignore for .agent-restore-context-*. If the pattern is already
present, skip this step. If .gitignore does not exist, check whether the
project is a git repo (git rev-parse --is-inside-work-tree). If it is,
create .gitignore; if not, skip this step entirely. Once the file exists,
append:
# Restore context files (used by skills to resume workflows after /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