上篇 Codex-app更新后偷偷打开了自动建议,里面佬友提到了Claude Code里的/recap,相比Codex-app的自动建议它耗token没这么夸张,也提示了禁用方法。这里也分析下它的原理。
/recap是在v2.1.108更新后默认开启的设置。作用是离开 session 一段时间再回来,界面上会自动弹出一段摘要,告诉你"你之前在做什么、下一步是什么"。也可以手动输入 /recap 触发。
触发时其中可能有缓存参数判断,大部分时间缓存命中,但我也观测到好几次缓存命中率低于10%的情况(可能是我用的中转切号了)。这对于我这种token掰两半算的用户来说也是不小的消耗.
工作方式
未关闭 Claude 大概 5 分钟后会触发 recap:把整个当前 session 的对话历史全部打包成 messages,追加一条 recap prompt:
The user stepped away and is coming back. Recap in under 40 words, 1-2 plain sentences,
no markdown. Lead with the overall goal and current task, then the one next action.
Skip root-cause narrative, fix internals, secondary to-dos, and em-dash tangents.
使用 sonnet 模型获取摘要然后展示。
关闭方法
/config找到 Session recap,设置为False。或者直接写配置文件~/.claude/config.json:
"awaySummaryEnabled": false
- 环境变量:
CLAUDE_CODE_ENABLE_AWAY_SUMMARY=0
5 个帖子 - 4 位参与者