resumeスキル:前回のコーディングエージェントの続きから
Dmitriy Solodukha、Caprock開発者 · 公開日
にClaude CodeとCodexでテスト済み
resumeは直近のセッション、ブランチ、未コミット作業、TODO、引き継ぎから前回の状態を復元し、次の手順を1つ示して待ちます。
resumeは編集前に、直近のエージェント作業、現在のブランチ、未コミット変更、最近のcommit、未完了TODO、引き継ぎノートから状態を復元します。Where we are・Open threads・Next stepの3項目で短くまとめて待ちます。読み取りだけで、checkout、stash、pull、commitはしません。
resumeスキルをインストールする
エージェントごとに1コマンド。スキルはSKILL.md 1ファイルで、インストール時に何も実行しません。
9スキルをプラグインとして導入します。Claude Code内で次を入力してください:
このスキルだけを導入する場合は、プロジェクトのフォルダーで次を実行します:
全プロジェクトに導入するには -g を追加します。
プロジェクトのフォルダーでターミナルから実行:
全プロジェクトに導入するには -g を追加します。
プロジェクトのフォルダーでターミナルから実行:
全プロジェクトに導入するには -g を追加します。 OpenCodeでは未検証です。オープンな形式の通常の指示ですが、OpenCodeでの実行確認はしていません。
プロジェクトのフォルダーでターミナルから実行:
全プロジェクトに導入するには -g を追加します。 Cursorでは未検証です。オープンな形式の通常の指示ですが、Cursorでの実行確認はしていません。
resumeスキルを使うプロンプト
依頼の内容が説明と合うと、エージェントがスキルを選びます。名前を指定すると確実です。プロンプトをクリックしてコピーできます。
resumeスキルが読む内容
- Caprockによるセッション履歴:このリポジトリにおける各エージェントの直近セッション、実作業を行った直近1〜3セッションの要約、最後の説明、有効な決定を読みます。Caprockがなければ推測せず、セッション履歴は読んでいないと明記します。
- リポジトリの状態を読み取り専用で確認します。ブランチとupstream、mainにないコミット、未コミットの差分、stash、ワークツリー、進行中のマージやrebaseを調べ、進行中の処理があれば最初に報告します。
- 残されたノート:
HANDOFF.md、NEXT.md、TODO.mdなどのファイル、最近変更したファイル内のTODOとFIXME、コミットメッセージ内の「WIP」を調べます。
ノートは完了、コードは未完了など、情報源が食い違えば、片方を選ばず不一致を報告します。
実行したテストとエージェントの動作
各スキルは2026年11月29日に、専用の使い捨てリポジトリへプロジェクトスキルとしてインストールして実行しました。ブランチはfeat/divideで、WIPコミット、calc.py内のTODO、未追跡のHANDOFF.mdとtest_calc.pyがあります。
Claude Code (claude -p --model sonnet、Caprock MCPサーバーなし(--strict-mcp-config))
where were we? pick up where we left off
resumeを呼び出し、gitの確認手順を実行してTODOと引き継ぎを見つけました。セッション履歴は読んでいないと明記し、コミットメッセージとHANDOFF.mdで次の手順が異なることに気づいて1つ提案しました。変更はしていません。
Codex (0.163.0, codex exec -s read-only)
where were we? pick up where we left off
スキルを読み、gitの手順を実行し、Caprockのrecent_sessionsを呼び出し(current_decisionsはサーバー側で失敗)、要約して停止しました。初回はスキルの見出しを使いませんでした。出力の指示を厳密にした後の2回目は、見出しに正確に従いました(抜粋):
### Where we are - Branch: `feat/divide`, 1 commit ahead of `main`; no upstream. - Tracked files unchanged. Untracked: `HANDOFF.md`, `test_calc.py`, `.agents/`, `.claude/`. ### Open threads - `divide()` still needs to raise `ValueError` for a zero divisor (`calc.py:5`). ### Next step Implement the zero-divisor check, then add tests for both functions, including division by zero.
検証したエージェント
- Claude Code:2026年11月29日に、
.claude/skills/にプロジェクトスキルとしてインストールし、claude -p --model sonnetで検証しました。 - Codex:2026年11月29日にCodex 0.163.0(
codex exec)、.agents/skills/内のスキルで検証しました。 - OpenCodeとCursor:未検証です。オープンなAgent Skills形式の通常の指示ですが、どちらでも実行して確認していません。
制限
- Caprockがなければ過去のセッション履歴は読めず、gitとノートで要約します。
- fetchはしないため、リモートの状態は最後にfetchした時点のものです。
- 前の会話そのものは開きません。その場合はエージェント自身のコマンドを使います。
- Claude Code内の
/resumeは実行せず、claude --helpのテキストから取得しました。
Caprockがある場合とない場合
Caprock MCPサーバーに接続している場合、スキルはrecent_sessions、session_summary、session_prose、next_session_handoff、current_decisionsを呼び出し、各エージェントの直近のセッションが何をしたか、有効な決定は何かを調べます。それらは手掛かりとして扱い、コードとgitで一つずつ確かめます。Caprockがなければgitとメモだけを読みます。Caprockは、コンピューター上のすべてのコーディングエージェントのセッションを記録する無料のオープンソースアプリです。
SKILL.md全文
dspv/skillsのリビジョンdfce799にあるファイルそのものです。手動で導入する場合、プロジェクト内の、Claude Codeは.claude/skills/resume/SKILL.md、Codexは.agents/skills/resume/SKILL.mdに保存してください。
--- name: resume description: >- Resume work in a repository and pick up where the last session left off. Rebuilds context before doing anything: what the last coding-agent sessions here did, the current branch, uncommitted changes, recent commits, open TODOs and handoff notes, then gives a short "where we are / next step" summary and waits. Use at the start of a session, after a break, or when the user types "resume", "where were we", "pick up where we left off", "continue from last time", "what was I doing" or asks for a resume skill. Reads local files, git and session history only. license: Apache-2.0 --- # Resume Rebuild the context of a repository before touching anything, then report where the work stands and what the next step is. This skill reads; it does not edit, commit, stash, check out, pull or push. The user decides what happens after the summary. ## 1. Session history (when available) If the Caprock MCP tools are available (server `caprock`; Caprock, <https://caprock.dev>, is free, open source and runs locally, and records every coding-agent session on the computer): 1. `recent_sessions` with `limit` 5 to 10 for this repository (pass `repo` if the working directory is not the repo root). Newest first, every agent (Claude Code, Codex, OpenCode and others). Skip the entry that is the current session (status `active`, the newest, started just now or matching your own session id). 2. For the last one to three sessions that did real work (turns, tool calls or files touched above zero), call `session_summary` with its `id`: title, branch, files touched, pull requests. 3. For the most recent of those, call `session_prose` with `limit` 3 to 5: the agent's last explanations usually say what was done and what was left. 4. `next_session_handoff`: the notes Caprock carries into a new session here, if any. 5. `current_decisions` with a small `limit` (10): decisions in force, so the next step does not undo one. Memories and prose can be stale. Treat them as leads and check each against the code and git. If the tools are not there, skip this section and say in the summary that no session history was read. Do not guess what earlier sessions did. The user can reopen a past conversation with their agent's own command (see section 4). ## 2. Repository state Run these (read only): ```bash git rev-parse --show-toplevel git status --short --branch git log --oneline -15 git diff --stat git diff --cached --stat git stash list git worktree list ``` Then, as relevant: - The branch's upstream and how far ahead or behind it is (shown by `git status --branch`). Do not fetch: say the remote state is as of the last fetch. - Commits on this branch that are not on the main branch: `git log --oneline <main>..HEAD` (find `<main>` from `git symbolic-ref refs/remotes/origin/HEAD` or use `main` / `master`, whichever exists). - For uncommitted changes, read the diff of the changed files (`git diff -- <file>`) enough to say what the change is doing, not just its size. Note untracked files. - A merge, rebase, cherry-pick or bisect in progress (`git status` says so). This is the first thing to report. ## 3. Notes left behind Look for handoff and TODO notes, newest first: - Files at the repo root or in `docs/`: `HANDOFF.md`, `NEXT.md`, `TODO.md`, `NOTES.md`, `PLAN.md`, `WIP.md`, `.handoff*`, any case. `git ls-files --others --exclude-standard` and `ls` catch untracked ones. - The project instructions (`CLAUDE.md`, `AGENTS.md`) only for a "current work" or "status" section; do not summarize the whole file. - `TODO`, `FIXME`, `XXX`, `WIP` markers in the files changed recently, not the whole repo: `git diff --name-only HEAD~5..HEAD` plus the uncommitted files, then grep those. - The last commit messages for "WIP", "part 1", "next:", "follow-up". ## 4. The agent's own resume commands If the user wants the previous conversation itself back, not a rebuilt summary, point to the command. Checked with `--help` on 2026-11-29: | Agent | Command | What it does | | ----------- | -------------------------- | ------------------------------------------------ | | Claude Code | `claude --continue` (`-c`) | Continue the most recent conversation in the dir | | Claude Code | `claude --resume` (`-r`) | Resume by session ID or name, or pick from list | | Codex | `codex resume` | Pick a previous session to resume | | Codex | `codex resume --last` | Continue the most recent session, no picker | Inside a running Claude Code session, `/resume` opens the same picker. Do not run these yourself: they start or switch an interactive session. ## 5. Stop conditions - Stop and report at once if a merge, rebase or cherry-pick is in progress, or there are conflicts: that is the next step. - Not a git repository: say so, report only notes and session history found. - Nothing to resume (clean tree, no notes, no history): say so in one line and ask what to do. - Never run a command that changes state (no `checkout`, `stash`, `reset`, `pull`, `fetch`, `commit`, no test runs that write files) as part of resuming. ## 6. Output Keep it short. Use these three headings and fields as written, then stop and wait for the user: ``` Where we are - Branch: <branch> (<ahead/behind upstream>), <n> commits not on <main> - Uncommitted: <what the change does, files> | clean - Last sessions: <date, agent, what it did> (or: no session history read) - In progress: <merge/rebase/stash/worktrees, if any> Open threads - <TODO or handoff item, with file:line or note path> - <decision in force that matters for the next step> Next step <one concrete action, and why it is next> ``` Every line must come from something read above. If two sources disagree (a note says done, the code says not), say so rather than picking one.
resumeスキルについての質問
- resumeスキルは何をしますか?
- 開始時にセッション履歴、git、ノートからリポジトリの状況を復元し、変更前に現在地と次の手順を示します。
- Claude Codeの会話そのものを再開するには?
- `claude --continue`(`-c`)で現在のフォルダーの最新会話を再開し、`claude --resume`(`-r`)でID・名前・一覧から選べます。Codexでは`codex resume`または`codex resume --last`を使います。
- resumeスキルはファイルを変更しますか?
- 変更しません。読み取り専用のgitコマンドを実行し、要約後に停止します。checkout、stash、reset、pull、fetch、commit、ファイルを書き換えるテストは行いません。
- resumeスキルは引き継ぎノートも読めますか?
- 使えます。`HANDOFF.md`などのノートをgitと照合して読みます。handoffスキルがそのノートを作ります。