Work a ba task to completion in a branch, including review follow-ups, then PR for human review
Claims and completes ba tasks in isolated branches, handles reviews, and creates PRs.
/plugin marketplace add open-horizon-labs/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> [branch]
<task-id> - the ba task to work on[branch] - optional base branch (default: origin/main)Use [branch] for stacked PRs where this task depends on another in-flight PR.
Determine the target branch for claiming:
[branch] specified: use that branch (strip origin/ prefix if present)mainSync with target branch from origin:
git fetch origin
git checkout -B <target-branch> origin/<target-branch>
The -B flag creates the branch if missing, or resets it to match origin.
ba claim <task-id> --session $$
Commit and push claim to target branch (makes claim visible to other workers):
git add .ba/
git commit -m "claim: <task-id>"
git push origin <target-branch>
Read dive context (if available) for project background:
cat .wm/dive_context.md 2>/dev/null || echo "No dive context"
This provides architecture decisions, conventions, and session intent.
Read and understand the task:
ba show <task-id> to get full detailsCreate worktree from base branch:
git fetch origin
git worktree add .worktrees/<task-id> -b ba/<task-id> --no-track origin/<target-branch>
cd .worktrees/<task-id>
sg init
The worktree bases off origin/<target-branch> (remote ref), where <target-branch> is what was determined in step 1.
Work until task is complete
Stage changes (git add)
Run sg review on staged changes (do NOT use code-reviewer agent)
Handle review findings:
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 <target-branch> --title "<original-task-title>" --body "$(cat <<'EOF'
## Completed Tasks
- <task-id>: <title>
- <descendant-1>: <title>
- ...
## Summary
<brief description of changes>
EOF
)"
Where <base-branch> is main (default) or the branch specified as second argument.
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/Return to main repo and signal completion (if $MIRANDA_PORT is set):
cd <original-dir>
curl -sS -X POST "http://localhost:${MIRANDA_PORT}/complete" \
-H "Content-Type: application/json" \
-d "{\"session\": \"$TMUX_SESSION\", \"status\": \"success\", \"pr\": \"<pr-url>\"}"
CRITICAL: Signal BEFORE cleanup. If still in worktree when it's deleted, curl fails.
Cleanup worktree:
git worktree remove .worktrees/<task-id>
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.
Returning to main repo...
Signaling completion to Miranda...
Cleaning up worktree...
Done.
$ /mouse abc-123
# Claims abc-123 on main, pushes to main
# Creates PR #42: ba/abc-123 → main
$ /mouse abc-456 ba/abc-123
# Checks out ba/abc-123, claims abc-456 there, pushes to ba/abc-123
# Creates PR #43: ba/abc-456 → ba/abc-123
$ /mouse abc-789 ba/abc-456
# Checks out ba/abc-456, claims abc-789 there, pushes to 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.