0xGondarxyz/claude-code-mods/tree/main/save-game
save-game
アイドル時、深夜、/save、セッション終了時に 3 行のセーブカード(doing、next step、open question)を書き、次回その repo でプロンプトの上に Continue ボタン付きで表示する Claude Code mod です。
この mod について
save-game は、作業を止めるときの負担を減らす Claude Code mod です。アイドル時、深夜、/save、セッション終了時に 3 行のセーブカードを書きます。カードには Doing(自分と Claude が扱っていること)、Next(次のステップ)、Open(未解決の質問やブロッカー、または none)が入ります。カードは repo ごとに保存され(session フォルダーの git toplevel 基準)、各 repo では最新の 5 枚を保持します。同じ session の新しいカードは古いカードを置き換えます。
カードを作るタイミング:(1) アイドル:メインスレッドのターン終了から 4 分後。(2) 深夜 01:00 以降:直近 30 分にターンがあれば、毎晩 1 回 toast で知らせます。(3) /save の実行:すぐに作成します。(4) セッション終了:未保存のターンがあればモデルを呼ばず、session をキューに入れます。次にどの repo で session が開かれたときも、バックグラウンドで Sonnet が transcript の末尾からカードを作ります。1 から 3 のカードは live session の fork を使い、prompt cache を再利用するため安価ですが、cache が温まっている間(最短 5 分)でなければ動作しません。
コマンド:/save はカードをすぐ作り、resume コマンドも付けます。/save list はこの repo の直近 5 枚を一覧表示します。セッション開始時、この repo に 14 日以内のカードがあれば、プロンプト上の band に Doing/Next/Open と Continue、Dismiss ボタンが表示されます。Continue は 3 行の内容を付けて「Continue where I stopped. Save card:」を最初のプロンプトとして送ります。
claude -p と SDK の headless 実行中は mod は何もしません。設定オプションはありません。制限は、mod の再読み込みで状態がリセットされること、session 開始時にキューを読み取って消去すること、transcript のパスが session フォルダーと id から導出されること、transcript の末尾 3 MB だけを読み最後の 30,000 文字に切り詰めること、マシンに tail が必要なことです。ライセンスは MIT です。
注意:この mod はサンドボックス分離を行わず Claude Code と同じ権限を持ちます。インストール前にソースを読んでください。
インストール
まず作者の README で marketplace とプラグイン名を確認してください。コマンドはリポジトリの構成によって変わる場合があります。
claude plugin marketplace add 0xGondarxyz/claude-code-mods claude plugin install save-game
原文 / README
save-game
A Claude Code mod that makes stopping painless. It writes a 3 line save card when you stop. The next time a session opens in that repo, the card shows above the prompt with a Continue button.
Install
/plugin marketplace add 0xGondarxyz/claude-code-mods
/plugin install save-game@claude-code-mods
Or try it without installing:
git clone https://github.com/0xGondarxyz/claude-code-mods
claude --plugin-dir claude-code-mods/save-game
Mods are not sandboxed. They run with the same access as Claude Code. Read the source before you install any mod, including this one.
The card
Doing: <what you and Claude were working on: files, feature, bug>
Next: <the single next step>
Open: <the open question or blocker, or "none">
Cards are kept per repo (the git toplevel of the session folder, else the folder). The store holds the 5 newest per repo. A newer card of the same session replaces the older one.
When a card is made
- Idle: 4 minutes after a main thread turn ends. A new prompt or turn cancels the timer. No new turn since the last card means no card.
- Past 01:00 local time: once per night, if the session had a turn in the last 30 minutes. A toast says it is a good point to stop.
/save: makes a card now.- Session end: if there were turns since the last card, the mod does not call a model (exit time is short). It queues the session. The next session that starts, in any repo, turns the queue into cards in the background with Sonnet, from the tail of the transcript file (your prompts and Claude's text only).
Cards from 1 to 3 use a fork of the live session. It reuses the prompt cache, so it is cheap. The fork only works while the cache is warm (the shortest cache lifetime is 5 minutes, hence 4).
Commands
/save: make a card now and print it withfull context: claude --resume <session id>. With no new turns it prints the newest card again./save list: the last 5 cards of this repo, each with its age, its 3 lines and its resume line.
The band
At session start, if this repo has a card younger than 14 days, a band shows above the prompt:
Saved 3h ago (session ab12cd3)
Doing: ...
Next: ...
Open: ...
[ Continue ] [ Dismiss ]
Continue sends Continue where I stopped. Save card: and the 3 lines as your first prompt. Dismiss hides the band. The band also hides after the first prompt you send. If a queued card for this repo finishes during startup, the band updates to it.
Headless runs
In claude -p and SDK runs the mod does nothing: no timers, no queue, no band, no /save.
Options
None.
Limits
- Module state (turn counts, timers) resets when the mod reloads. Cards and the queue live in the plugin store and stay.
- The queue is read and cleared at session start. Two sessions that start in the same instant can both process the same entry.
- The transcript path is derived from the session folder and id. If the file is missing, the queued session is skipped without a message.
- Only the last 3 MB of the transcript file is read, then cut to the last 30,000 characters of text.
- Needs
tailon the machine for the queue step (Linux and macOS have it).
License
MIT
