u/cascade: pass JSON results directly to planner synthesis prompt

This commit is contained in:
Levi Neely 2026-05-17 13:32:43 +02:00
parent 04bed6189f
commit 42929b4c57
1 changed files with 6 additions and 9 deletions

View File

@ -125,29 +125,26 @@ if [ "$synthesize" -eq 0 ]; then
printf '%s\n' "$results_json" | jq .
[ "$failures" -gt 0 ] && exit 1
else
# Render results as readable text for the planner prompt.
results_text=$(printf '%s\n' "$results_json" | jq -r '.[] | "--- \(.id) [STATUS: \(.status)] ---\n\(.output)\n"')
synth_flags=(-backend "$PB" -model "$PM")
if [ "$json_output" -eq 1 ]; then
synth_flags+=(-json)
synth_prompt="Synthesize these worker results into a structured JSON response for the original task. Note: workers marked [STATUS: failed] did not complete successfully — include them in errors.
synth_prompt="Synthesize these worker results into a structured JSON response for the original task. Note: workers with status \"failed\" did not complete successfully — include them in errors.
Output schema: {\"summary\": \"<one-line summary>\", \"answer\": \"<full synthesized answer>\", \"worker_results\": [{\"id\": \"<worker-id>\", \"status\": \"done|failed\", \"output\": \"<worker output>\"}], \"errors\": [\"<description of any failures>\"]}
ORIGINAL TASK:
$task
WORKER RESULTS:
$results_text"
WORKER RESULTS (JSON):
$results_json"
else
synth_prompt="Synthesize these worker results into a final, coherent answer to the original task. Note: workers marked [STATUS: failed] did not complete successfully — account for this in your synthesis.
synth_prompt="Synthesize these worker results into a final, coherent answer to the original task. Note: workers with status \"failed\" did not complete successfully — account for this in your synthesis.
ORIGINAL TASK:
$task
WORKER RESULTS:
$results_text"
WORKER RESULTS (JSON):
$results_json"
fi
"$B" "${synth_flags[@]}" "$synth_prompt"
fi