marcsstevenson/claude-mods/tree/main/src/better-recap
better-recap
用結構化卡片取代 /recap,顯示 Goal / Done / Open / Next、工作階段名稱、模型和上下文使用量列。
關於這個 mod
better-recap 是以 TypeScript 打造的 Claude Code hooks API 外掛集合中的 mod。它將 /recap 取代為包含 Goal / Done / Open / Next 的結構化卡片,並在卡片標題顯示工作階段名稱、模型和上下文使用量列;離開後自動顯示的 recap: 列也帶有相同資訊。可用 claude --plugin-dir path/to/claude-mods/src/better-recap 單次載入,或在 ~/.claude/settings.json 的 CLAUDE_CODE_PLUGIN_DIRS 中為每個工作階段載入,並透過 claude plugin validate、claude plugin test 與 npx tsc 驗證。
安裝
請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。
claude plugin marketplace add marcsstevenson/claude-mods claude plugin install better-recap
原文 / README
claude-mods
Mods for Claude Code: plugins of function hooks that change what Claude Code does and draws, written in TypeScript against the engine's hooks API (early access, Claude Code 2.1.289+).
Mods
| Mod | What it does |
| --- | --- |
| better-recap | Replaces /recap with a structured recap (Goal / Done / Open / Next) drawn as a card headed by the session name, the model and a context-use bar. Prefixes the automatic "recap:" line shown after being away with the same facts. |
Using a mod
Each folder under src/ is a self-contained mod. Load one for a single session:
claude --plugin-dir path/to/claude-mods/src/better-recap
Or load it in every session by naming it in CLAUDE_CODE_PLUGIN_DIRS, in the env block of ~/.claude/settings.json. Separate several folders with the platform's path separator (; on Windows, : elsewhere):
{
"env": {
"CLAUDE_CODE_PLUGIN_DIRS": "D:\\git\\claude-mods\\src\\better-recap"
}
}
A folder loaded either way is watched: saving a file reloads the mod.
Layout of a mod
src/<mod>/
.claude-plugin/plugin.json manifest: name, version, description, types
hooks/hooks.json { "modules": ["./register.tsx"] }
hooks/register.tsx the hooks module: export const register: Register = on => { ... }
hooks/*.test.ts tests, run by `claude plugin test`
types/index.d.ts the mod's $.state contract, when it keeps state
tsconfig.json extends the types Claude Code lays in .claude-plugin/types/
.claude-plugin/types/ is written by Claude Code each time it loads the mod and is not committed.
Checking a mod
claude plugin validate src/<mod> # what the engine would load or refuse
claude plugin test src/<mod> # runs hooks/*.test.ts against the engine
npx tsc -p src/<mod> # type-check, once the mod has loaded once
