Skip to content

Commit 203ab71

Browse files
ZviBaratzclaude
andcommitted
fix: have headless Claude write review report via Write tool
claude -p only captures the final text response to stdout, not intermediate tool output. 7/9 reviews produced summaries instead of full reports. Fix: instruct Claude to write the report to a specific file path via the Write tool, which reliably captures the full content. - Add {{REVIEW_OUTPUT_PATH}} placeholder to prompt template - Add --review-output arg to hydrate-review-prompt.py - Redirect claude stdout to .review.out (debug), report comes from file Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c11c4f6 commit 203ab71

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

scripts/field-test-runner.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ if [[ "$OPT_REVIEW" == true || "$OPT_REVIEW_CHANGED" == true ]]; then
387387
--lint-json "$local_lint"
388388
--plugin-dir "$PLUGIN_DIR"
389389
--template "$REVIEW_TEMPLATE"
390+
--review-output "$review_file"
390391
)
391392
[[ -f "$local_diff" ]] && hydrate_args+=(--diff-json "$local_diff")
392393
[[ -f "$local_ann" ]] && hydrate_args+=(--annotations "$local_ann")
@@ -403,13 +404,15 @@ if [[ "$OPT_REVIEW" == true || "$OPT_REVIEW_CHANGED" == true ]]; then
403404
echo " Launching review: $name"
404405

405406
# Launch claude -p in background subshell
407+
# Claude writes the report to $review_file via Write tool (instructed in prompt).
408+
# Stdout goes to .review.out for debugging; stderr to .review.err.
406409
(
407410
timeout 600 claude -p \
408411
--plugin-dir "$PLUGIN_DIR" \
409412
--add-dir "$ext_path" \
410413
--dangerously-skip-permissions \
411414
--max-budget-usd 2.00 \
412-
"$prompt" > "$review_file" 2>"$err_file"
415+
"$prompt" > "$RESULTS_DIR/$name.review.out" 2>"$err_file"
413416
) &
414417
REVIEW_PIDS+=($!)
415418
REVIEW_NAMES+=("$name")

scripts/hydrate-review-prompt.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def main():
3030
parser.add_argument("--plugin-dir", required=True, help="Plugin directory path")
3131
parser.add_argument("--diff-json", default="", help="Path to diff results JSON")
3232
parser.add_argument("--annotations", default="", help="Path to annotations YAML")
33+
parser.add_argument("--review-output", default="", help="Path for review output file")
3334
parser.add_argument("--template", required=True, help="Path to prompt template")
3435
args = parser.parse_args()
3536

@@ -80,6 +81,7 @@ def main():
8081
output = output.replace("{{DIFF_JSON_SECTION}}", diff_section)
8182
output = output.replace("{{ANNOTATIONS_SECTION}}", ann_section)
8283
output = output.replace("{{PLUGIN_DIR}}", args.plugin_dir)
84+
output = output.replace("{{REVIEW_OUTPUT_PATH}}", args.review_output)
8385

8486
sys.stdout.write(output)
8587

scripts/review-prompt.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Run /ego-review on the extension at {{EXT_PATH}}.
22

3-
Your ENTIRE text output will be saved as the review report file. Do NOT summarize at the end — your full output IS the deliverable. Write the complete report inline as you go, with all six sections in full detail. Every word you output goes into the report.
3+
After completing the review, you MUST write the full report to a file using the Write tool:
4+
5+
Write the report to: {{REVIEW_OUTPUT_PATH}}
6+
7+
The report MUST contain ALL six sections in full detail. Do NOT summarize. Do NOT abbreviate. If a section has no findings, write "None" under it — do not omit the section.
48

59
## Phase 0 Override
610

@@ -14,11 +18,10 @@ Skip Phase 0 (ego-lint). It has already been run. Use these pre-computed results
1418

1519
{{ANNOTATIONS_SECTION}}
1620

17-
## Required Output
21+
## Required Report Format
1822

19-
Write the FULL ego-review report with ALL sections below. Do NOT abbreviate or skip any section. If a section has no findings, write "None" under it — do not omit it.
23+
The report file MUST start with:
2024

21-
Start your output with:
2225
```
2326
## EGO Review Report — {{NAME}}
2427
```

0 commit comments

Comments
 (0)