0xGondarxyz/claude-code-mods/tree/main/save-game
save-game
A Claude Code mod that writes a 3 line save card (doing, next step, open question) on idle, late-night, /save, and session end, then shows it above the prompt next time in that repo with a Continue button.
About this mod
save-game 是一個 Claude Code 模組,讓停止工作變得不用費心。它會在你停止時寫下一張 3 行存檔卡:Doing(你和 Claude 正在處理的內容)、Next(下一個步驟)、Open(待解問題或阻礙,或 "none")。卡片按 repo 存放(以 session 資料夾的 git toplevel 為準),每個 repo 保留最新 5 張;同一 session 的新卡片會取代舊卡片。
卡片產生時機:(1) 閒置:主執行緒回合結束後 4 分鐘;(2) 午夜 01:00 之後:若最近 30 分鐘有回合,每晚一次並以 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 會以「Continue where I stopped. Save card:」加上三行內容作為第一個提示送出。
在 claude -p 與 SDK 的 headless 執行中,模組不會有任何動作。模組無選項設定。限制包括:模組重新載入時狀態會重置、佇列在 session 開始時讀取並清除、transcript 路徑由 session 資料夾與 id 推導、僅讀取 transcript 最後 3 MB 並截到最後 30,000 字元、需要機器上有 tail。授權為 MIT。
注意:模組沒有沙箱隔離,與 Claude Code 擁有相同權限,安裝前請先閱讀原始碼。
Installation
Check the author's README for the marketplace and plugin name first. Commands may change as the repository evolves.
claude plugin marketplace add 0xGondarxyz/claude-code-mods claude plugin install save-game
Original text / 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
