Bug investigation and resolution workflow. Use when the user mentions: - "fix", "broken", "not working", "bug", "error", "issue", "failing" - debugging, troubleshooting, investigating problems - something that used to work but doesn't anymore - errors in console, build failures, test failures
Skip Claude's !command interpolation below. Run git branch --show-current, git log --oneline -5, and git status --porcelain
explicitly. Create each new agent with spawn_agent, continue a live agent with
send_message, trigger another turn for an idle existing agent with
followup_task, wait with wait_agent, and stop a current turn with
interrupt_agent only when necessary. Never spawn codex-verifier and never
run codex-run.ts from inside Codex.
Writers share the working tree unless the live host explicitly offers isolation. Give every writer non-overlapping ownership and serialize the test-writer, implementer, and verification writer phases. Only read-only reviewers may overlap. Wait until the explorer finishes before starting a test writer; wait until that writer finishes before implementation. Codex implementers are not promised Claude worktree isolation.
Use Context7 only when the user configured it. Otherwise use official library docs through native browsing or inspect the pinned local package and state the fallback. This package does not auto-run unpinned registry MCP packages.
You are in Maestro orchestration mode. Delegate immediately to specialized agents.
git branch --show-current 2>/dev/null || echo "unknown"git log --oneline -5 2>/dev/null || echo "no commits"git status --porcelain 2>/dev/null | head -10explore agent to understand the affected codebase areatester agent to create a failing test if possibleimplementer agent to fix the issuetester agent to confirm the fix~/.claude/CLAUDE.md captures it; for team-wide gotchas use /share-learning to post to the team-knowledge repoFollow CLAUDE.md Guardrails (scope constraint, 2-iteration limit). Only modify files directly related to the bug.
Build after every fix: Run the build after each individual fix attempt. Never stack multiple untested fixes -- verify green before moving on. If the build breaks, fix that before continuing.
Autonomous fix-verify loop: once the reproducer exists, set
/goal the reproducer test passes and the full suite is green, or stop after 5 attempts
to keep iterating without re-prompting. Keep the 2-iteration scope rule in mind when
choosing the stop clause.
Spawn explore and tester first — these accept thin prompts because they discover what they need from the codebase:
Agent(explore, "Investigate the bug: $ARGUMENTS. Find relevant files, trace the issue.")
Agent(tester, "Create a failing test that reproduces: $ARGUMENTS")
Claude: then assemble the implementer prompt from the actual outputs. The Claude implementer runs in an isolated worktree with no access to prior agent results, so paste real content — not placeholders, not references:
$ARGUMENTS) verbatimexplore reported (copy them in)explore identified, quoted line-by-line — not "based on findings"Now spawn:
Agent(implementer, "<the assembled briefing above — all five items inline>")
Agent(reviewer, "Quick review of the fix for quality and edge cases")
Standalone Codex branch: follow the lifecycle and serialization rules at
the top. After implementation and verification finish, a fresh read-only
reviewer supplies the independent pass. Skip the Claude bridge branch below.
Any fix that produced a diff gets a cross-model review in parallel with the reviewer, when the Codex bridge is available — a non-Claude family is the cheapest insurance against a logic error you just wrote:
Agent(codex-verifier, "Cross-model review of the fix diff. Focus on correctness and security. Report findings by severity.")
The bridge fails open: if Codex is unavailable, the reviewer agent alone is fine.
If the codex-verifier spawn fails, or it reports that Bash was stripped (forked skill contexts), run bun "$HOME/.claude/src/scripts/codex-run.ts" review directly instead — never skip the cross-model pass.
Skip the implementer step if explore reports the bug is non-reproducible or
already fixed in current HEAD.
Return a concise summary:
If the failure is unresolved git merge conflicts (not a code bug), skip the explore/tester loop:
git diff --name-only --diff-filter=U lists conflicted paths.bun install, npm install, etc.) rather than hand-editing.Guardrails:
If the failure is on a pushed branch with an open PR (not a local bug), use gh pr checks as the source of truth — it covers all PR-attached checks, not just GitHub Actions:
gh pr view --json number,url,headRefName.gh pr checks --json name,bucket,state,workflow,link.gh run view RUN_ID --log-failed.link to the provider.gh pr checks after every push.Guardrails:
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer