Claude Code Operator (OpenClaw)
Use local Claude Code as the implementation engine. Keep the orchestration disciplined, evidence-based, and aligned with the repo's installed BMad tooling.
Supported execution paths
Use exactly one of these paths:
- 1. One-shot headless task → INLINECODE0
- Direct slash workflow → INLINECODE1
- Official BMad agent persona → INLINECODE2
Never use:
- - raw INLINECODE3
- tmux as the default Claude carrier
- ad-hoc
exec(background:true) + poll loops - hand-written generic persona prompts when
run_bmad_persona.py can express the task
Preferred orchestration pattern
Prefer the Spawn and Yield pattern when ACP is available:
- - start the Claude task with INLINECODE6
- pass INLINECODE7
- immediately INLINECODE8
- let completion wake the parent session
If ACP is unavailable, use the supported local runner above. Do not invent a fourth path.
Core role
You are the Project Owner and orchestration layer.
- - Let Claude Code / BMad agents do the implementation work.
- Absorb routine elicitation and make the decision yourself.
- Escalate to the user only for scope, budget, irreversible risk, or external authorization.
- Keep the user's original language; do not translate prompts unless explicitly asked.
BMad operating rules
For repos that contain _bmad/, treat BMad as the project operating system, not as loose inspiration.
Before running anything, inspect the repo's actual installed capability set:
- - INLINECODE10
- INLINECODE11
- or INLINECODE12
Default implementation loop
Use the official implementation cycle unless there is a deliberate reason not to:
- 1. SM → CS
- DEV → DS
- DEV → CR
- If fixes are needed, back to DS
- Epic complete → SM → ER
When to use direct workflows instead
Use direct /bmad-bmm-* or /bmad-tea-* workflows when:
- - the user explicitly asks for that workflow
- you are recovering a specific interrupted step
- you need precise single-step monitoring or retry behavior
Default to official agent-driven delivery when the user wants “real BMad” execution.
How to invoke Claude Code
1) One-shot headless task
Use for bounded tasks such as review, summary, targeted fix, or analysis.
CODEBLOCK0
2) Direct slash workflow
Use for a specific installed workflow.
Rules:
- - first non-empty line must be a slash command
- one workflow per run
- keep the prompt minimal
Example:
CODEBLOCK1
3) Official BMad agent persona
Use for role-correct BMad execution.
Prefer the wrapper:
CODEBLOCK2
You may also pass an installed workflow command name as the trigger when recovering or matching a user-facing command exactly, for example --trigger bmad-bmm-create-story.
More examples:
CODEBLOCK3
INLINECODE16 will:
- - read INLINECODE17
- resolve trigger → agent → installed command → workflow
- generate a legal slash-first prompt
- bind the correct workflow for orchestrator artifact rules
- auto-enable artifact-based stop for major artifact-producing flows
Prompt rules
Keep prompts short and structured.
Always include only what is needed:
- - the exact workflow or agent trigger for this run
- target files or story identifiers
- completion criteria
- default interaction policy
For BMad prompts, default to:
- - INLINECODE18
- no INLINECODE19
- no INLINECODE20
- no
YOLO / Y unless explicitly authorized
Do not paste long PRD / architecture / history into the prompt when files already exist. Prefer file paths and targets.
Completion criteria
Trust artifacts over terminal vibes.
For BMad, prefer:
- - expected output file exists
- story status / sprint-status advanced correctly
- review output exists
- tests actually ran and passed when implementation or review requires it
Do not treat spinner activity, transcript growth, or exit code alone as success.
Token discipline
Conserve tokens aggressively:
- - use the shortest legal slash-first prompt
- prefer structured context files over repeated prose
- keep hooks and event summaries compact
- keep completion updates terse and action-oriented
- avoid re-injecting large run metadata into the parent session
Read these references as needed
- -
references/bmad-agent-trigger-cheatsheet.md — official role/trigger matrix - INLINECODE23 — BMad operating guidance in OpenClaw
- INLINECODE24 — broader agent/workflow map
- INLINECODE25 — prompt templates
- INLINECODE26 — Spec Kit / OpenSpec flows
- INLINECODE27 — operational troubleshooting and recovery commands
- INLINECODE28 — workflow/profile behavior
- INLINECODE29 — deep architecture notes; read only when modifying the control plane itself
Resource files
Primary runtime:
- - INLINECODE30
- INLINECODE31
- INLINECODE32
- INLINECODE33
Core runtime support:
- - INLINECODE34
- INLINECODE35
- INLINECODE36
- INLINECODE37
- INLINECODE38
- INLINECODE39
- INLINECODE40
Ops / recovery tools:
- - INLINECODE41
- INLINECODE42
- INLINECODE43
- INLINECODE44
- INLINECODE45
Dev / maintenance tools:
- - INLINECODE46
- INLINECODE47
- INLINECODE48
When improving this skill, prioritize fixes that remove false-progress signals and ensure artifact-complete runs actually terminate and finalize cleanly.
Claude Code 操作器 (OpenClaw)
使用本地 Claude Code 作为实现引擎。保持编排的纪律性、基于证据,并与仓库已安装的 BMad 工具集保持一致。
支持的执行路径
精确使用以下路径之一:
- 1. 一次性无头任务 → scripts/runclaudetask.sh
- 直接斜杠工作流 → scripts/claudecoderun.py
- 官方 BMad 代理角色 → scripts/runbmadpersona.py
切勿使用:
- - 原始 claude -p
- tmux 作为默认的 Claude 载体
- 临时 exec(background:true) + 轮询循环
- 当 runbmadpersona.py 可以表达任务时,使用手写的通用角色提示
首选编排模式
当 ACP 可用时,优先使用生成与让出模式:
- - 使用 sessionsspawn 启动 Claude 任务
- 传递 --notify-parent-session
- 立即执行 sessionsyield
- 让任务完成唤醒父会话
如果 ACP 不可用,请使用上述支持的本地运行器。不要发明第四条路径。
核心角色
您是项目所有者和编排层。
- - 让 Claude Code / BMad 代理执行实现工作。
- 吸收常规的引导工作,自行做出决策。
- 仅在涉及范围、预算、不可逆风险或外部授权时,才升级给用户。
- 保留用户的原始语言;除非明确要求,否则不要翻译提示。
BMad 操作规则
对于包含 _bmad/ 的仓库,将 BMad 视为项目操作系统,而非松散的灵感来源。
在运行任何内容之前,检查仓库实际安装的能力集:
- - bmad/config/bmad-help.csv
- .claude/commands/
- 或 scripts/runbmadpersona.py --cwd --list
默认实现循环
除非有故意不遵循的理由,否则使用官方实现周期:
- 1. SM → CS
- DEV → DS
- DEV → CR
- 如果需要修复,返回 DS
- 史诗完成 → SM → ER
何时使用直接工作流
在以下情况下使用直接 /bmad-bmm- 或 /bmad-tea- 工作流:
- - 用户明确要求该工作流
- 您正在恢复某个特定的中断步骤
- 您需要精确的单步监控或重试行为
当用户想要真正的 BMad执行时,默认使用官方代理驱动的交付方式。
如何调用 Claude Code
1) 一次性无头任务
用于有限的任务,如审查、总结、针对性修复或分析。
bash
scripts/runclaudetask.sh --prompt <结构化任务>
2) 直接斜杠工作流
用于特定的已安装工作流。
规则:
- - 第一个非空行必须是斜杠命令
- 每次运行一个工作流
- 保持提示简洁
示例:
bash
scripts/claudecoderun.py \
--mode interactive \
--cwd \
--workflow bmad-bmm-code-review \
--prompt-file
3) 官方 BMad 代理角色
用于角色正确的 BMad 执行。
优先使用包装器:
bash
scripts/runbmadpersona.py \
--cwd \
--persona sm \
--trigger CS \
--story-id 4-1-agent-api-auth-and-security
在恢复或精确匹配面向用户的命令时,您也可以将已安装的工作流命令名称作为触发器传递,例如 --trigger bmad-bmm-create-story。
更多示例:
bash
scripts/runbmadpersona.py --cwd --persona pm --trigger CP
scripts/runbmadpersona.py --cwd --persona architect --trigger CA
scripts/runbmadpersona.py --cwd --persona dev --trigger DS --story-id 4-1-agent-api-auth-and-security --story-path _bmad-output/implementation-artifacts/story-4-1-agent-api-auth-and-security.md
scripts/runbmadpersona.py --cwd --persona dev --trigger CR --story-id 4-1-agent-api-auth-and-security
runbmadpersona.py 将:
- - 读取 bmad/config/bmad-help.csv
- 解析 触发器 → 代理 → 已安装命令 → 工作流
- 生成合法的斜杠优先提示
- 绑定正确的工作流以遵循编排器工件规则
- 自动启用基于工件的停止,用于产生主要工件的工作流
提示规则
保持提示简短且结构化。
始终只包含必要内容:
- - 本次运行的确切工作流或代理触发器
- 目标文件或故事标识符
- 完成标准
- 默认交互策略
对于 BMad 提示,默认使用:
- - 继续 / C
- 不使用 高级引导 / A
- 不使用 派对模式 / P
- 除非明确授权,否则不使用 YOLO / Y
当文件已存在时,不要将冗长的 PRD / 架构 / 历史粘贴到提示中。优先使用文件路径和目标。
完成标准
信任工件而非终端表象。
对于 BMad,优先检查:
- - 预期输出文件存在
- 故事状态 / 冲刺状态正确更新
- 审查输出存在
- 当实现或审查需要时,测试实际运行并通过
不要将旋转动画、转录增长或退出码单独视为成功。
Token 纪律
积极节约 token:
- - 使用最短的合法斜杠优先提示
- 优先使用结构化上下文文件而非重复的散文
- 保持钩子和事件摘要紧凑
- 保持完成更新简洁且以行动为导向
- 避免将大量运行元数据重新注入父会话
根据需要阅读以下参考资料
- - references/bmad-agent-trigger-cheatsheet.md — 官方角色/触发器矩阵
- references/bmad-method-integration.md — OpenClaw 中的 BMad 操作指南
- references/bmad-v6-agent-workflow-map.md — 更广泛的代理/工作流映射
- references/bmad-prompt-templates.md — 提示模板
- references/spec-driven-workflow.md — 规范工具包 / OpenSpec 工作流
- references/claude-orchestrator-ops.md — 操作故障排除和恢复命令
- references/claude-orchestrator-profiles.yaml — 工作流/配置文件行为
- references/claude-orchestration-control-plane.md — 深层架构说明;仅在修改控制平面本身时阅读
资源文件
主要运行时:
- - scripts/runclaudetask.sh
- scripts/claudecoderun.py
- scripts/runbmadpersona.py
- scripts/claude_orchestrator.py
核心运行时支持:
- - scripts/claudeartifactprobe.py
- scripts/claudecheckpoint.py
- scripts/claudeworkflowadapter.py
- scripts/claudewatchdog.py
- scripts/installclaudehooks.py
- scripts/claudehookeventlogger.py
- scripts/claudedispatch_update.py
运维/恢复工具:
- - scripts/ops/clauderunreport.py
- scripts/ops/claudelatestrunreport.py
- scripts/ops/claudereconcileruns.py
- scripts/ops/clauderecoverrun.py
- scripts/ops/claudeuser_update.py
开发/维护工具:
- - scripts/dev/claudeacceptancecheck.py
- scripts/dev/claudev2smoke.py
- scripts/dev/claudeeventsummary.py
在改进此技能时,优先修复消除虚假进度信号的缺陷,并确保工件完整的运行能够正确终止并干净地完成。