بنقرة واحدة
go
Execute the current phase plan (subagent or Agent Teams mode)
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Execute the current phase plan (subagent or Agent Teams mode)
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Initialize a Megazord project with configuration and planning structure
Systematic four-phase debugging (reproduce, isolate, root-cause, fix)
Socratic brainstorming to explore approaches before implementation
Show all available Megazord skills with descriptions and usage examples
Complete milestone lifecycle -- audit, archive, deferred items, and next version preparation
Plan a phase into executable tasks with dependencies and waves
| name | go |
| description | Execute the current phase plan (subagent or Agent Teams mode) |
| disable-model-invocation | false |
Execute the current phase plan by orchestrating executor agents. Supports two execution modes: subagent delegation (Task tool, fire-and-forget) and Agent Teams (TeamCreate, SendMessage, shared TaskList with real-time coordination). Auto-detects the optimal mode per wave based on plan complexity, with --teams/--no-teams overrides.
Reference @skills/init/design-system.md for visual output formatting.
Reference @skills/shared/presentation-standards.md for content formatting rules.
Reference @skills/shared/terminology.md for official term definitions.
Reference @skills/go/executor.md for execution protocol and spawning patterns.
Reference @skills/go/teams.md for Agent Teams execution protocol.
Output the stage banner:
+===============================================+
| MEGAZORD > EXECUTE |
+===============================================+
Read .planning/megazord.config.json. If missing, display error and stop:
## Error
Project not initialized — no megazord.config.json found.
`/mz:init`
If config exists, continue loading:
.planning/STATE.md for current position..planning/ROADMAP.md for phase details.Determine review configuration from the config:
config.quality.review === "auto": review_enabled = true, review_mode = "auto"config.quality.review === "manual": review_enabled = true, review_mode = "manual"config.quality.review === "off": review_enabled = falseIf review is disabled, display a one-time notice:
> Note: Code review is disabled (quality.review: "off"). Tasks will not be reviewed.
Determine TDD configuration:
config.quality.tdd === true: tdd_enabled = truetdd_enabled = falseDetermine CORTEX configuration:
config.quality.cortex === true: cortex_enabled = truecortex_enabled = falseDisplay activation notices (same pattern as the review disabled notice):
> TDD mode active: RED-GREEN-REFACTOR enforced per task> CORTEX classification active: tasks classified before executionIf CORTEX is enabled (cortex_enabled = true):
{plugin_path}/skills/cortex/SKILL.md content using the Read tool.<cortex_protocol> block.Parse the user's message (text after /mz:go) for arguments:
--tasks N,M -- execute only specific plan numbers (e.g., --tasks 1,3)--from N -- start from plan N, skip earlier plans (e.g., --from 2)--dry-run -- show execution plan without running--teams -- force Agent Teams mode (requires experimental flag)--no-teams -- force subagent mode (skip Agent Teams detection)Determine the plugin path for CLI commands:
plugin_path from the config JSON.plugin_path is not set in config, try ~/.claude/plugins/mz. Check if ~/.claude/plugins/mz/bin/megazord.mjs exists.## Error
Plugin path not configured.
`/mz:settings` to set plugin_path, or `/mz:init` to re-initialize.
Load the Agent Teams configuration from config:
config.agent_teams.enabled: "auto" (default), "always", or "never"config.agent_teams.strict_ownership: true or false (default: false)Use the resolved plugin path for all node {plugin_path}/bin/megazord.mjs commands below:
node {plugin_path}/bin/megazord.mjs tools plan list --phase-dir {dir}
Determine the current phase from STATE.md position. Compute the phase directory path (e.g., .planning/phases/04-subagent-execution-and-atomic-commits).
List all plans:
node {plugin_path}/bin/megazord.mjs tools plan list --phase-dir {phase_dir}
If no plans returned, display error and stop:
## Error
No plans found for Phase {N}: {Name}.
`/mz:plan {N}`
Get incomplete plans:
node {plugin_path}/bin/megazord.mjs tools plan incomplete --phase-dir {phase_dir}
If all plans are complete (empty incomplete list), display info and stop:
> Phase Status
Phase {N}: {Name} — {functional_sentence_from_goal}
All plans complete. Run /mz:verify to validate.
Compute wave execution order:
node {plugin_path}/bin/megazord.mjs tools plan waves --phase-dir {phase_dir}
Check for file conflicts between plans:
node {plugin_path}/bin/megazord.mjs tools plan conflicts --phase-dir {phase_dir}
Display the execution plan:
> Execution Plan
Phase {N}: {Name} — {functional_sentence_from_goal}
Plans: {total} ({incomplete} remaining)
Waves: {wave_count}
Wave 1: {plan_list} — {functional_summary} (parallel)
Wave 2: {plan_list} — {functional_summary} (sequential)
Extract the functional sentence from the phase Goal in ROADMAP.md. Wave functional summaries are derived from the plans' objectives — e.g., "foundation and shared references" not just plan numbers.
If conflicts are detected, note which plans will be serialized and why.
If --tasks N,M was provided:
If --from N was provided:
If --dry-run was provided:
If neither flag was provided:
For each wave, determine whether to use subagents or Agent Teams.
Detection logic (check in order):
--teams flag provided: mode = "teams" (forced)--no-teams flag provided: mode = "subagents" (forced)config.agent_teams.enabled === "always": mode = "teams"config.agent_teams.enabled === "never": mode = "subagents"config.agent_teams.enabled === "auto": auto-detect per wave:
"teams" (review loops benefit from peer communication)"teams""subagents"Display the chosen mode:
> Execution Mode: {Agent Teams | Subagents}
{Reason: auto-detect / --teams flag / config}
If Agent Teams mode selected, verify availability:
Check if CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS environment variable is set:
echo $CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS
If not set or empty: silently fall back to subagents. Display:
> Mode: Subagents (Agent Teams not available)
For each wave (waves execute sequentially):
Display:
> Wave {N}/{total_waves} — {wave_plan_count} tasks {parallel_note}
The execution path depends on the mode determined in Step 5.
This is the existing Task tool delegation path. Used when mode = "subagents".
Determine plan execution order within the wave:
For each plan in the wave:
Display (with progress bar showing plans completed so far within the wave):
████░░░░░░ Plan {NN}: {functional_objective}...
After each plan completes:
██████████ Plan {NN}: {functional_objective} ✓ ({duration})
████░░░░░░ Plan {MM}: {functional_objective}...
The progress bar (10 chars, █ filled / ░ empty) updates as plans complete within the wave. Use round(completed/total * 10) filled characters.
Before spawning, determine models for this wave's agents:
model_profile and model_overrides from the loaded config.model_overrides.executor, fall back to profile mapping (quality->opus, balanced->sonnet, budget->haiku).{plugin_path}/agents/mz-executor.md frontmatter model field to the resolved value.model_overrides.reviewer, fall back to profile mapping.{plugin_path}/agents/mz-reviewer.md frontmatter model field to the resolved value.Note: Model resolution is done ONCE per wave (before the first plan spawn), not per-plan.
{plugin_path}/agents/mz-executor.md content using the Read tool..planning/megazord.config.json content using the Read tool.review_enabled is true: Read {plugin_path}/agents/mz-reviewer.md content using the Read tool.cortex_enabled is true (see @skills/go/executor.md for prompt structure):<agent_role>
{content of agents/mz-executor.md}
</agent_role>
<plan>
{full content of PLAN.md}
</plan>
<config>
{content of megazord.config.json}
</config>
<reviewer_agent>
{content of agents/mz-reviewer.md -- only included if review_enabled is true}
</reviewer_agent>
<execution_rules>
- Phase: {phase_number}
- Plan: {plan_number}
- Phase directory: {phase_dir}
- Commit format: {type}({phase}-{plan}): {description}
- Do NOT add Co-Authored-By lines to commits
- Stage files individually (never git add . or git add -A)
- One commit per task, no exceptions
- Create SUMMARY.md at {phase_dir}/{padded}-{plan}-SUMMARY.md
- Do NOT update STATE.md or ROADMAP.md
- Use bun/bunx for all JS/TS operations (never npm/npx)
- Review enabled: {true|false}
- Review mode: {auto|manual} (only present if review_enabled is true)
- TDD enabled: {true|false}
- CORTEX enabled: {true|false}
</execution_rules>
<cortex_protocol>
{Content of skills/cortex/SKILL.md -- only included if cortex_enabled is true}
</cortex_protocol>
Note: The <reviewer_agent> section is only included when review_enabled is true. When review is disabled, omit this section entirely to save context budget. The <cortex_protocol> section is only included when cortex_enabled is true.
Spawn the executor via the Task tool:
subagent_type: "mz-executor"description: "Execute Plan {phase}-{plan}: {brief objective}"subagent_type='mz-executor' fails, fall back to subagent_type='general-purpose' with the agent definition embedded inline in <agent_role> tags.Wait for completion.
Parse the structured result. Look for ## PLAN COMPLETE in the response to extract:
Display result:
> Plan {NN}: {functional_objective} — ✓ {duration}, {N} tasks, {commit_count} commits
For each completed plan in this wave, update state via CLI tools:
Advance plan counter:
node {plugin_path}/bin/megazord.mjs tools state advance-plan
Record execution metric:
node {plugin_path}/bin/megazord.mjs tools state record-metric --phase {phase} --plan {plan} --duration {duration} --tasks {count} --files {count}
Add decisions (extract key decisions from the plan's SUMMARY.md):
node {plugin_path}/bin/megazord.mjs tools state add-decision --phase {phase} --decision "{decision text}"
Update session continuity:
node {plugin_path}/bin/megazord.mjs tools state update-session --last-session {date} --stopped-at "Completed {phase}-{plan}" --resume-file "{next_plan_path or phase_dir}"
If a plan FAILS in this wave (executor returns without ## PLAN COMPLETE):
✗ Plan {NN}: {functional_objective} — FAILED: {error description}
Recovery: /mz:go to resume from this plan
Save the error output:
Write the error output to {phase_dir}/{padded}-{plan}-ERROR.md using the Write tool.
Update session with error:
node {plugin_path}/bin/megazord.mjs tools state update-session --last-error "Plan {NN} failed: {brief error}"
Wait for other plans in the wave to finish (they may still succeed).
STOP after this wave. Do NOT start the next wave.
Display:
## Error
Execution stopped after Wave {N} — Plan {NN}: {functional_objective} failed.
{brief error description}
`/mz:go` to resume from the first incomplete plan.
This is the Agent Teams coordination path. Used when mode = "teams". Reference @skills/go/teams.md for the full protocol.
For each wave in Agent Teams mode:
For each plan in the wave, create an isolated worktree:
node {plugin_path}/bin/megazord.mjs tools worktree create --team {team_name} --agent exec-{plan_id}
Team name format: mz-{phase}-w{wave} (e.g., mz-06-w1).
Read each plan's files_modified frontmatter. Build the ownership manifest mapping each agent name to its declared files. Write to a temporary file that the hook can read:
{
"exec-06-01": ["src/lib/worktree.ts", "src/cli/commands/worktree-tools.ts"],
"exec-06-02": ["agents/mz-executor.md", "agents/mz-reviewer.md"]
}
For each worktree, write .mz-agent-context.json inside the worktree directory:
{
"agent_name": "exec-{plan_id}",
"team_name": "{team_name}",
"team_lead": "mz-lead",
"owned_files": ["file1.ts", "file2.ts"],
"strict_ownership": false
}
The strict_ownership field reflects config.agent_teams.strict_ownership. This file is read by the ownership enforcement hook (since environment variables cannot be set for teammates).
TeamCreate({ team_name: "{team_name}", description: "Phase {N} Wave {W}" })
For each plan in the wave, create a task:
TaskCreate({
subject: "Execute Plan {NN}: {objective}",
description: "{full plan content with execution rules}",
activeForm: "Executing Plan {NN}"
})
Before spawning, determine models for this wave's agents:
{plugin_path}/agents/mz-executor.md frontmatter model field based on config profile/overrides.{plugin_path}/agents/mz-reviewer.md frontmatter model field.For each plan, spawn an executor teammate. If review is enabled, also spawn a reviewer teammate.
{plugin_path}/agents/mz-executor.md, {plugin_path}/agents/mz-reviewer.md) and embed inline.subagent_type="mz-executor" and team_name parameter. If named subagent spawning does not work for teammates, use "general-purpose" with inline embedding as fallback.Task({
description: "<agent_role>{mz-executor.md content}</agent_role>
<plan>{PLAN.md content}</plan>
<config>{megazord.config.json}</config>
<reviewer_agent>{mz-reviewer.md content -- if review enabled}</reviewer_agent>
<execution_rules>
- execution_mode: teammate
- Phase: {phase_number}
- Plan: {plan_number}
- Phase directory: {phase_dir}
- worktree_path: {worktree_path}
- owned_files: {file list from plan frontmatter}
- team_lead: mz-lead
- reviewer_name: reviewer-{plan_id} (if review enabled)
- task_id: {task_id from TaskCreate}
- Commit format: {type}({phase}-{plan}): {description}
- Do NOT add Co-Authored-By lines to commits
- Stage files individually (never git add . or git add -A)
- One commit per task, no exceptions
- Create SUMMARY.md at {phase_dir}/{padded}-{plan}-SUMMARY.md
- Do NOT update STATE.md or ROADMAP.md
- Use bun/bunx for all JS/TS operations (never npm/npx)
- Review enabled: {true|false}
- Review mode: {auto|manual}
- TDD enabled: {true|false}
- CORTEX enabled: {true|false}
</execution_rules>
<cortex_protocol>
{Content of skills/cortex/SKILL.md -- only included if cortex_enabled is true}
</cortex_protocol>",
team_name: "{team_name}",
name: "exec-{plan_id}"
})
subagent_type="mz-reviewer". If named subagent spawning does not work for teammates, use "general-purpose" with inline embedding as fallback:Task({
description: "<agent_role>{mz-reviewer.md content}</agent_role>
<review_rules>
- review_mode_type: teammate
- worktree_paths: {map of agent names to worktree paths}
- team_lead: mz-lead
- Phase: {phase_number}
- Plan scope: {plan numbers in this wave}
</review_rules>",
team_name: "{team_name}",
name: "reviewer-{plan_id}"
})
IMPORTANT: Spawn ALL teammates before entering coordination mode. Do NOT use API-level permissionMode: "delegate" -- this causes a known bug where teammates lose file system tools. Enforce delegate behavior through instructions only.
After spawning, the lead enters coordination-only mode:
After all tasks complete, merge worktrees sequentially in plan order:
For each completed plan:
node {plugin_path}/bin/megazord.mjs tools worktree merge --team {team_name} --agent exec-{plan_id} --strategy merge
If merge fails (conflicts): stop the wave, leave worktree for inspection, log the conflict.
For each teammate:
SendMessage({ type: "shutdown_request", recipient: "{name}", content: "Wave complete" })
Wait for responses (timeout 60s, proceed anyway if no response).
node {plugin_path}/bin/megazord.mjs tools worktree prune --team {team_name}
Then TeamDelete() to remove team resources.
Same as subagent path: advance plan counter, record metrics, add decisions, update session for each completed plan in the wave.
If ANY of steps 1-7 fail (TeamCreate fails, worktree creation fails, API error), catch the error and fall back to subagent execution (Path A) for this wave:
[TEAMS FALLBACK] {reason}. Using subagent mode for wave {N}.
This is logged but does not prompt the user. Execution continues normally via the subagent path.
After all waves complete (or after stopping due to failure):
- [ ] to - [x] for plans that now have SUMMARY.md files.After all waves complete, check each completed plan's SUMMARY.md for "Unresolved Review Findings". If any plan mentions unresolved review findings, display a warning:
> Warning: Some tasks have unresolved review findings.
Run /mz:review for manual review, or check the SUMMARY.md files for details.
Display summary using heading-based layout (action boxes are reserved for important banners per presentation-standards.md — execution summaries use headings):
### Execution Complete
Phase {N}: {Name} — {functional_sentence}
Mode: {Subagents | Agent Teams | Mixed}
Plans: {completed}/{total}
Commits: {total_commits}
Duration: {total_time}
Wave 1 [Subagents]: Plan 01 — {functional_obj} ({time})
Wave 2 [Agent Teams]: Plan 02 — {functional_obj} ({time}), Plan 03 — {functional_obj} ({time})
Display the Next Up block. Determine verifier suggestion based on config:
config.workflow.verifier is true:## Next Up
**Verify Phase {N}: {Name}** — validate deliverables before advancing
`/mz:verify {N}`
<sub>`/clear` — start fresh context for the next step</sub>
config.workflow.verifier is false:## Next Up
**Phase {N}: {Name} — execution complete.** Verifier is disabled in config.
`/mz:plan {N+1}`
- Or verify manually: `/mz:verify {N}`
<sub>`/clear` — start fresh context for the next step</sub>
IMPORTANT: The /mz:verify skill itself is NEVER gated. It always works when manually invoked. Only the automated suggestion in /mz:go changes based on config.
## Next Up
**Resume execution** — fix failure and continue
`/mz:go`
<sub>`/clear` — start fresh context for the next step</sub>
## Next Up
**Project complete** — all phases delivered
| Error | Step | Action |
|---|---|---|
| Config missing | Step 2 | Error box, suggest /mz:init. Stop. |
| No plans found | Step 3 | Error box, suggest /mz:plan. Stop. |
| All plans complete | Step 3 | Info message, suggest /mz:verify. Stop. |
| Plan execution fails | Step 6 | Save error, stop after wave, suggest /mz:go. |
| State update fails | Step 6 | Log warning, do not block (plans already committed). |
| Agent Teams unavailable | Step 5 | Silent fallback to subagents. |
| TeamCreate fails | Step 6B | Silent fallback to subagents for this wave. |
| Worktree merge conflict | Step 6B | Stop wave, leave worktree for inspection. |
{plugin_path}/agents/mz-executor.md) enforces per-task atomic commits with conventional commit format.{plugin_path} for CLI commands and agent files is resolved from config.plugin_path, falling back to ~/.claude/plugins/mz.{plugin_path}/skills/cortex/SKILL.md and embeds it as <cortex_protocol> in the executor prompt. This keeps the authoritative CORTEX content in one file while ensuring the executor receives it inline (required by the Task boundary constraint)./mz:go Execute all incomplete plans (auto-detect mode)
/mz:go --dry-run Preview execution plan without running
/mz:go --from 2 Start from plan 2, skip earlier plans
/mz:go --tasks 1,3 Execute only specific plans
/mz:go --teams Force Agent Teams mode (requires experimental flag)
/mz:go --no-teams Force subagent mode (skip Agent Teams)