mirror of
https://github.com/obra/superpowers
synced 2026-07-25 12:04:31 +00:00
4c3e7e5e8a
README gains the hook install step for Codex users (hooks.json merge, one-time trust prompt, --dangerously-bypass-hook-trust for headless automation). codex-tools.md aligns its claims with the mechanism — the dispatch rules bind every spawn, the printed hints appear at scripted boundaries, and the hook covers post-compaction re-grounding — and adds a section telling controllers compaction sheds these instructions and to treat every printed hint as authoritative. The hints file gains a drift-cure footer both scripts print after the role line: in the instrumented run that broke post-compaction, reprinted hints alone did not heal the already-broken dispatch pattern across three subsequent boundaries — recovery text must name the drift and prescribe the re-read. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
61 lines
2.0 KiB
Bash
Executable File
61 lines
2.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Extract one task's full text from an implementation plan into a file the
|
|
# implementer reads in one call, so the task text never has to be pasted
|
|
# through the controller's context.
|
|
#
|
|
# Usage: task-brief PLAN_FILE TASK_NUMBER [OUTFILE]
|
|
# Default OUTFILE: <repo-root>/.superpowers/sdd/<plan-basename>/task-<N>-brief.md
|
|
# (per plan and per worktree; concurrent runs of the SAME plan in the same
|
|
# working tree share it).
|
|
set -euo pipefail
|
|
|
|
if [ $# -lt 2 ] || [ $# -gt 3 ]; then
|
|
echo "usage: task-brief PLAN_FILE TASK_NUMBER [OUTFILE]" >&2
|
|
exit 2
|
|
fi
|
|
|
|
plan=$1
|
|
n=$2
|
|
[ -f "$plan" ] || { echo "no such plan file: $plan" >&2; exit 2; }
|
|
|
|
script_dir=$(cd "$(dirname "$0")" && pwd)
|
|
|
|
if [ $# -eq 3 ]; then
|
|
out=$3
|
|
else
|
|
dir=$("$script_dir/sdd-workspace" "$plan")
|
|
out="$dir/task-${n}-brief.md"
|
|
fi
|
|
|
|
awk -v n="$n" '
|
|
/^```/ { infence = !infence }
|
|
!infence && /^#+[ \t]+Task[ \t]+[0-9]+/ {
|
|
intask = ($0 ~ ("^#+[ \t]+Task[ \t]+" n "([^0-9]|$)"))
|
|
}
|
|
intask { print }
|
|
' "$plan" > "$out"
|
|
|
|
if [ ! -s "$out" ]; then
|
|
echo "task ${n} not found in ${plan} (no heading matching 'Task ${n}')" >&2
|
|
exit 3
|
|
fi
|
|
|
|
echo "wrote ${out}: $(wc -l < "$out" | tr -d ' ') lines"
|
|
|
|
# Platform dispatch hints ride this output because the controller reads it
|
|
# immediately before spawning; the lines themselves are owned by the platform
|
|
# reference layer (using-superpowers/references/*-dispatch.hints), not this
|
|
# script. Claude Code's dispatch templates carry model selection already, so
|
|
# the relay is suppressed there and on any harness without a hints file.
|
|
hints_file="$script_dir/../../using-superpowers/references/codex-dispatch.hints"
|
|
if [ -z "${CLAUDECODE:-}" ] && [ -f "$hints_file" ]; then
|
|
hint_line=$(grep "^implementer:" "$hints_file" | head -1 | cut -d: -f2- | sed 's/^ *//') || true
|
|
if [ -n "$hint_line" ]; then
|
|
echo "$hint_line"
|
|
footer_line=$(grep "^footer:" "$hints_file" | head -1 | cut -d: -f2- | sed 's/^ *//') || true
|
|
if [ -n "$footer_line" ]; then
|
|
echo "$footer_line"
|
|
fi
|
|
fi
|
|
fi
|