name: mailbox-same-task-lifecycle description: Use when a mailbox task says to claim it, execute it, and finish the SAME task with done/fail. Covers claim/peek/inspect, same-task completion, and common Redis/running-state pitfalls. argument-hint: "[task-id] [workdir-or-scope]" disable-model-invocation: false user-invocable: false allowed-tools: - Read - Grep - Bash
Mailbox same-task lifecycle
When to use
- Use when the task payload says some variant of:
Claim with node ~/.claude/scripts/mailbox claim <task_id>finish the SAME task with ... done <same_task_id> ... or failDo not reply with ... send unless you are delegating a brand-new task
- Use for queued mailbox work where the reply must close the existing task.
Non-goals
- Do not use this when you are intentionally creating a brand-new delegated task.
- Do not assume every mailbox task needs
send; this skill is specifically for same-task closure.
Inputs / context to gather
- The mailbox task id.
- The working directory / project scope the task belongs to.
- Whether the task is already claimed/running.
- Whether the work touches local Redis-backed mailbox state.
Procedure
- Read the task wording carefully.
- If it says to finish the SAME task, plan around
done/fail, notsend.
- If it says to finish the SAME task, plan around
- Claim the task.
node ~/.claude/scripts/mailbox claim $1
- If claim fails because the task is already running, inspect instead of re-claiming blindly.
- Use
peekand any project/run inspect tooling to understand the scope.
- Use
- Execute only the requested work.
- For investigation/review slots, keep the work diagnostic.
- For implementation slots, verify before claiming success.
- Build the result payload for the same task id.
- Complete the task with the same id.
CCB_CALLER=codex node ~/.claude/scripts/mailbox done $1 '<result_json>'- Or use
failif the task truly failed.
- Record verification evidence and keep the result scoped to the actual task.
Efficiency plan
- Read the payload once and extract the protocol requirements up front.
- If the task is already running, pivot to
peek/inspection immediately instead of looping onclaim. - For OPS/home-directory work, prefer focused file inspection and targeted tests over broad repo workflows.
- Cache the exact verification commands you will cite in the result payload.
- Stop once the same task id is closed successfully; do not open a new mailbox thread unless you are explicitly delegating.
Pitfalls and fixes
- Symptom: you are about to use
mailbox sendas a reply.- Likely cause: treating a same-task completion like a new delegation.
- Fix: switch back to
done/failon the original task id.
- Symptom:
claimreturns an invalid state transition likerunning -> running.- Likely cause: the task is already claimed.
- Fix: use
peek/ inspection and continue from the current state.
- Symptom: Redis connection errors such as
Could not connect to Redis at 127.0.0.1:6379: Operation not permitted.- Likely cause: the current execution context cannot access local Redis.
- Fix: rerun in a context that can reach local Redis instead of debugging mailbox logic first.
- Symptom: duplicate mailbox result notifications across projects.
- Likely cause: project routing metadata / watcher behavior is involved.
- Fix: inspect
mailbox_routingand project scope before assuming the task itself is wrong.
Verification checklist
- The task id you complete matches the task id you were asked to claim.
- You used
doneorfail, notsend, unless you truly delegated a new task. - The result payload includes concrete evidence from the work you actually ran.
- Any requested investigation/review stayed within scope and did not mutate files unnecessarily.
- If the work touched Redis/mailbox watcher behavior, you confirmed the relevant routing/claim behavior rather than assuming.