Work a ba task to completion in a branch, including review follow-ups, then PR for human review
Autonomously completes a ba task in an isolated branch, handling all code review findings and descendant tasks before creating a PR for human review. Use when you need to work a task to completion with full autonomous review cycles.
/plugin marketplace add cloud-atlas-ai/miranda/plugin install miranda@mirandaThis skill inherits all available tools. When active, it can use any tool Claude has access to.
A small autonomous worker from the Mouse Army. Claims a task, works it to completion in an isolated branch, PR for human review.
/mouse <task-id> [--base <branch>]
<task-id> - the ba task to work on--base <branch> - optional base branch (default: origin/main)Use --base for stacked PRs where this task depends on another in-flight PR.
git fetch origin
git pull origin main # or <base-branch> if using --base
ba claim <task-id> --session $$git add .ba/
git commit -m "claim: <task-id>"
git push origin main
cat .wm/dive_context.md 2>/dev/null || echo "No dive context"
This provides architecture decisions, conventions, and session intent.ba show <task-id> to get full detailsgit fetch origin
git worktree add .worktrees/<task-id> -b ba/<task-id> --no-track <base-branch>
cd .worktrees/<task-id>
sg init
Where <base-branch> is --base argument or origin/main if not specified.git add)sg review on staged changes (do NOT use code-reviewer agent)ba create as descendant taskba finish <task-id>
Commit code + .ba/ changes together (task closure travels with code)
CRITICAL: Complete ALL descendant tasks before PR.
Any ba create during this session = descendant that blocks PR.
No "follow-ups" - if you create it, you work it now.
While ANY unclosed tasks created in this session:
ba claim <next-task>sg review (each task gets its own review!)ba finish, commit code + .ba/ALL tasks closed → push and create PR:
git push -u origin ba/<task-id>
gh pr create --base <base-branch> --title "<original-task-title>" --body "$(cat <<'EOF'
## Completed Tasks
- <task-id>: <title>
- <descendant-1>: <title>
- ...
## Summary
<brief description of changes>
EOF
)"
Where --base is main (default) or the branch specified via --base arg.
For stacked PRs, this creates a chain: task-2 PR targets ba/task-1, etc.
Wait for CodeRabbit review, then iterate:
gh pr view <pr-number> --comments to check for CodeRabbit feedbackba create as descendantsg review (CodeRabbit fixes get sg reviewed too!)ba finish if task, commit code + .ba/Cleanup worktree:
cd <original-dir>
git worktree remove .worktrees/<task-id>
Signal completion to Miranda (if $MIRANDA_PORT is set):
curl -sS -X POST "http://localhost:${MIRANDA_PORT}/complete" \
-H "Content-Type: application/json" \
-d "{\"session\": \"$TMUX_SESSION\", \"status\": \"success\", \"pr\": \"<pr-url>\"}"
Exit and report PR URL
.worktrees/<task-id>ba/<task-id> branchThe PR is the only human review point. Everything before is autonomous.
CRITICAL: You MUST signal completion when done. If $MIRANDA_PORT is set, you are running under Miranda and MUST curl the completion endpoint. This is the LAST thing you do.
# Run this as your FINAL action:
curl -sS -X POST "http://localhost:${MIRANDA_PORT}/complete" \
-H "Content-Type: application/json" \
-d "{\"session\": \"$TMUX_SESSION\", \"status\": \"success\", \"pr\": \"<pr-url>\"}"
Signal based on outcome:
| Outcome | Status | Payload |
|---|---|---|
| PR created & reviewed | success | "pr": "<url>" |
| Unrecoverable failure | error | "error": "<reason>" |
| Needs human decision | error | "error": "Blocked: <reason>" |
If you don't signal, Miranda won't know you're done and the session becomes orphaned.
$ /mouse abc-123
Claiming abc-123: "Fix validation bug"
Pushing claim to main...
Reading task details...
Task: Input validation fails silently on empty strings
Approach: Add explicit empty string check before processing
No clarifying questions needed, proceeding.
Creating worktree .worktrees/abc-123 on branch ba/abc-123
Initializing superego...
Working on task...
Staging changes...
Running sg review...
Found 2 issues:
- P3: Add test for edge case → non-trivial, created abc-456
- P4: Consider renaming variable → discarded (nitpick)
Review clean (P3 spawned as task, P4 discarded)
Finished abc-123
[commit] fix: validate input before processing (includes .ba/ closure)
Working on descendant abc-456...
Staging changes...
Running sg review...
No issues found.
Finished abc-456
[commit] test: add edge case coverage (includes .ba/ closure)
All tasks complete.
Pushing ba/abc-123...
Creating PR...
PR created: https://github.com/org/repo/pull/42
Waiting for CodeRabbit review...
CodeRabbit found 2 issues:
- "Add nil check before dereferencing" → trivial, fixing inline
- "Consider refactoring to reduce complexity" → nit, ignoring
[commit] fix: add nil check per CodeRabbit
Pushing...
CodeRabbit review passed.
Cleaning up worktree...
Signaling completion to Miranda...
Done.
$ /mouse abc-123
# Creates PR #42: ba/abc-123 → main
$ /mouse abc-456 --base ba/abc-123
# Creates PR #43: ba/abc-456 → ba/abc-123
$ /mouse abc-789 --base ba/abc-456
# Creates PR #44: ba/abc-789 → ba/abc-456
$ /drummer
# Merges in order: #42 → main, rebases #43 → main, rebases #44 → main
Use when working with Payload CMS projects (payload.config.ts, collections, fields, hooks, access control, Payload API). Use when debugging validation errors, security issues, relationship queries, transactions, or hook behavior.