Skip to content

feat: Worker completion signaling via RESULT.json #4

@JeremyDev87

Description

@JeremyDev87

Problem

Currently, taskMaestro detects worker completion solely by polling capture-pane output and matching prompt patterns (e.g., ⏵⏵|⏵ |❯). This approach has several limitations:

  • Fragile text parsing — prompt patterns vary across environments and Claude CLI versions
  • No structured output — no machine-readable way to know what the worker accomplished (PR number, issue closed, cost, etc.)
  • False positives — an idle prompt doesn't distinguish between "task completed successfully" vs "task failed and returned to prompt" vs "user interrupted"

Proposed Solution

Introduce a RESULT.json file-based completion signaling mechanism with a 2-tier detection strategy.

RESULT.json Schema

Workers write a RESULT.json file to their worktree root upon completion:

{
  "status": "success | failure | error",
  "issue": 123,
  "pr_number": 456,
  "pr_url": "https://github.com/owner/repo/pull/456",
  "timestamp": "2026-03-21T12:00:00Z",
  "cost": "$0.42",
  "error": null
}
Field Type Required Description
status string Yes success, failure, or error
issue number Yes GitHub issue number the worker was assigned
pr_number number No PR number if one was created
pr_url string No Full PR URL
timestamp string Yes ISO 8601 completion timestamp
cost string No Estimated API cost for the task
error string No Error message if status is failure or error

2-Tier Detection Strategy

  1. Primary: RESULT.json — Check for RESULT.json in the worker's worktree directory. If present, parse it for structured completion data.
  2. Fallback: capture-pane — If no RESULT.json exists, fall back to the current prompt-pattern matching via tmux capture-pane.

This provides backward compatibility while enabling richer completion data.

Completion Protocol in Worker Prompt

Add a [TASKMAESTRO COMPLETION PROTOCOL] section to the worker prompt template instructing the worker to write RESULT.json before exiting:

[TASKMAESTRO COMPLETION PROTOCOL]
When your task is complete, write a RESULT.json file to the worktree root with:
- status: "success" or "failure"
- issue: the issue number you were assigned
- pr_number / pr_url: if you created a PR
- timestamp: ISO 8601 completion time
- cost: estimated API cost (if available)
- error: error message (if failed)

Impact on Subcommands

  • status — Check RESULT.json first, then fall back to capture-pane
  • watch — Use RESULT.json for auto-detecting wave completion and triggering next wave
  • State file — Add result field to persist per-pane completion data

Reference

This feature was prototyped in the codingbuddy skill layer:

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions