Files
clawdbot-memory/claude-config/README.md
pp 8915fa2898 config(claude): 角色路由 hook (dev/test/pm) + role-router 单测
- claude-config/hooks/role-router.mjs
  按 user prompt 关键词检测当前角色,注入推荐 agent hint
  - dev: 开发/实现/重构/修(复|bug)/dev/implement/refactor/fix/feature → executor/debugger
  - test: 测试/单测/回归/QA/test/regression/spec → qa-tester/test-engineer/verifier
  - pm: 产品/需求/排期/规划/PM/product/PRD/roadmap → planner/analyst/scientist
  支持多角色同时命中
- claude-config/hooks/role-router.test.mjs
  10 fixture 单测 (含 subprocess pipe integration), 10/10 PASS
- claude-config/settings.json.snapshot.20260426
  全局 settings.json 快照, hooks.UserPromptSubmit 接 keyword-detector + role-router
- claude-config/README.md
  设计/安装/测试 文档

来源: ralph US-3, a+b 融合方案 (211 中文 agents + 关键词 hook)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-26 21:36:34 +08:00

45 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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
## 安装到新机器
```bash
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" }
```
## 测试
```bash
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