按 critic + 3 reviewer agent 反馈:
- HIGH: bare catch {} 改 catch(e){console.error(...)} 暴露 bug
- MED: regex 去重复 (develop|develops? → develops?, fix|fixes → fixes?, requirement|requirements? → requirements?)
- MED: 4 处 {continue:true,suppressOutput:true} 抽 NOOP 常量
- MED: test JSON.stringify(.sort()) → 不可变的 sortKey helper
- skip: createHookOutput 抽 lib (违反"不改 OMC keyword-detector" 决策)
- skip: ROLES enum (3 值 over-engineering)
post-deslop 回归: 10/10 PASS
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
claude-config snapshot
存放 ~/.claude/ 下的私人 hook + settings 快照,用于跨机器同步和版本回溯。
文件
settings.json.snapshot.20260426— 全局 settings.json 快照(含 hooks 配置)hooks/role-router.mjs— 角色路由 hook(开发/测试/PM 自动注入推荐 agent)hooks/role-router.test.mjs— role-router 单元测试(10 fixture)
角色路由设计
按 user prompt 关键词检测当前角色,注入推荐 agent hint:
| 角色 | 关键词(含中英) | 推荐 agent |
|---|---|---|
| dev | 开发/实现/重构/修(复|bug)/写代码/dev/implement/refactor/fix/feature | executor / debugger / code-simplifier + engineering-* 中文 agent |
| test | 测试/单测/回归/QA/test/regression/e2e/spec | qa-tester / test-engineer / verifier + testing-* |
| pm | 产品/需求/排期/规划/PM/product/spec/PRD/roadmap | planner / analyst / scientist + product-* / project-management-* |
支持多角色同时命中(注入多段 hint)。
安装到新机器
cp claude-config/hooks/role-router.mjs ~/.claude/hooks/
cp claude-config/hooks/role-router.test.mjs ~/.claude/hooks/
chmod +x ~/.claude/hooks/role-router.mjs ~/.claude/hooks/role-router.test.mjs
# 在 ~/.claude/settings.json 的 hooks.UserPromptSubmit 加入:
# { "type": "command", "command": "sh ${CLAUDE_CONFIG_DIR:-$HOME/.claude}/hooks/find-node.sh ${CLAUDE_CONFIG_DIR:-$HOME/.claude}/hooks/role-router.mjs" }
测试
cd ~/.claude/hooks && node role-router.test.mjs
# 期望 10 pass 0 fail
关联
- agency-agents-zh (211 中文 agents) 装到 ~/.claude/agents/,跟 OMC 19 个原生 agent 共存(共 230)
- 项目内有 hook 时优先项目 hook;这里的是全局 fallback