#2611

task-brief: a task that isn't found leaves an empty task-N-brief.md behind (exit 3)

OpenEthan826opened 7d ago
  • I searched existing issues and this is not a duplicate

Who's filing this report? (required)

An agent (Claude Code, Opus 5.5) found this bug while working for Ethan Kent and is filing it at his request. His instruction was: "Please open issues if you can do it through gh."

Human-authored summary (required, under 200 words)

The task-brief script creates an empty file before checking whether the task actually exists. If an agent gets told to read its brief, it will find that empty file and fail silently, believing that it found a task with no requirements. A failed rerun will also empty out the file. The fix is to delete the file if the task isn't found.

Environment (required)

FieldValue
Superpowers versionmain at 2ce8aa1 (plugin.json 7.0.1), with the script fetched from main and run directly
Harness (Claude Code, Cursor, etc.)Claude Code ran the repro; the script itself is plain bash
Harness version2.1.309
Your model + versionClaude Opus 5.5
All plugins installedNone needed, because task-brief was run directly rather than through a plugin install
OS + shellmacOS 26.5, GNU bash 3.2.57

Is this a Superpowers issue or a platform issue?

  • I confirmed this issue does not occur without Superpowers installed

How I verified that this issue does not reproduce without Superpowers: not applicable. The bug is in skills/subagent-driven-development/scripts/task-brief, and the repro runs that script on its own.

What happened?

When task-brief PLAN N finds no heading for task N, it prints task N not found and exits 3, as it should. It also leaves an empty task-N-brief.md in the workspace. The > "$out" redirection creates that file before the [ ! -s "$out" ] check runs, and the failure branch never removes it.

The empty file sits at the path a dispatch would give for that task's brief. A step that checks for the brief, or an implementer told to "read this first", finds an empty brief with nothing to show it came from a failed run. A missing file would have failed loudly.

Steps to reproduce

mkdir /tmp/tb && cd /tmp/tb && git init -q
printf '# Plan\n\n### Task 1: one\nbody\n' > plan.md
bash <superpowers>/skills/subagent-driven-development/scripts/task-brief plan.md 3
echo "exit=$?"
ls -la .superpowers/sdd/plan/

Expected behavior

The script exits 3 with the "not found" message, and no task-3-brief.md exists afterwards.

Removing the file in the failure branch is enough:

if [ ! -s "$out" ]; then
  rm -f "$out"
  echo "task ${n} not found in ${plan} (no heading matching 'Task ${n}')" >&2
  exit 3
fi

Writing to a temp file and moving it into place only on success would also work. It has one extra benefit: if the plan is edited so that task N no longer exists, a rerun leaves the earlier brief intact instead of emptying it.

Actual behavior

task 3 not found in plan.md (no heading matching 'Task 3')
exit=3
-rw-r--r--  1 user  wheel  8 ... plan-path
-rw-r--r--  1 user  wheel  0 ... task-3-brief.md

Debug log or conversation transcript

The output above is the whole run. These task-brief issues came up in the duplicate search, and none of them covers this bug: #2175, #2242, #2405, #2406, #2436, #2459, #2493, #2496.

Activity

0

No activity yet.