ClaudeMods
☰
ZH-CN
● 0 人在线 · 浏览 0 次
赞助提交作品
GitHub 仓库 · 发布者 marcsstevenson

better-recap

用结构化卡片替换 /recap,显示 Goal / Done / Open / Next、会话名称、模型和上下文使用条。

marcsstevenson@marcsstevenson

marcsstevenson/claude-mods/tree/main/src/better-recap

已翻译

关于这个 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

更多类似作品