Skip to content

feat(review): --prompt-file flag#64

Merged
steipete merged 2 commits into
openclaw:mainfrom
dpdanpittman:feat/prompt-file
May 18, 2026
Merged

feat(review): --prompt-file flag#64
steipete merged 2 commits into
openclaw:mainfrom
dpdanpittman:feat/prompt-file

Conversation

@dpdanpittman
Copy link
Copy Markdown
Contributor

Summary

Add a --prompt-file <path> flag to clawpatch review that appends extra reviewer guidance to the prompt built by buildReviewPrompt(). The flag accepts a file path (UTF-8) or - to read from stdin.

Why

Today the review prompt is fixed inside buildReviewPrompt(). Downstream consumers that want to drive multiple specialised passes (e.g. one each for arch/sec/perf lenses) have to either fork the prompt builder or bucket findings after the fact by category. This flag is the smallest hook that lets them inject focused guidance per pass without touching the rest of the prompt.

Behavior

  • Flag omitted: customPrompt defaults to null and the additional-guidance block is skipped entirely. Default behavior is byte-identical.
  • Flag provided: contents are read once at reviewCommand entry and threaded through reviewFeaturebuildReviewPrompt as an optional argument. The block lands after the Feature JSON and before the Review-categories list / JSON-shape template, so it reads as setup, not as part of the expected response.
  • --prompt-file - reads from stdin (rejected if stdin is a TTY).
  • Bad path → `ClawpatchError` with exit 2 / `invalid-usage`.

Tests

Three new cases in `workflow.test.ts`:

  1. `injects --prompt-file content into the review prompt` — guidance block appears, lands before the JSON-shape section.
  2. `leaves the review prompt unchanged when --prompt-file is omitted` — no "Additional reviewer guidance" substring in baseline.
  3. `parses --prompt-file as a review value flag` — argv parsing test for the flag wiring.

Full suite: 463 passing locally.

Notes

  • No behavior change for any existing user.
  • Composes with `--feature`, `--limit`, `--mode`, `--since`, etc.
  • Help text updated.

Lets callers append extra reviewer guidance to the hardcoded review
prompt without forking the prompt builder. The flag accepts a file
path (read with utf8) or '-' to read from stdin, and is plumbed
through reviewCommand → reviewFeature → buildReviewPrompt as an
optional customPrompt argument. Default behavior is unchanged when the
flag is omitted: customPrompt defaults to null and the additional-
guidance block is skipped entirely.

Why: downstream consumers (e.g. Tribunal, which dispatches three
lens-specific reviews) want to drive lens-aware prompts instead of
post-hoc category bucketing. Today the prompt is fixed; this is the
smallest change that unlocks that without breaking any existing user.

Tests: three new cases in workflow.test.ts covering presence,
ordering (guidance block lands before JSON shape + file blocks), and
absence (omitting the flag leaves the prompt byte-identical to the
no-arg case).
# Conflicts:
#	src/cli.ts
#	src/workflow.test.ts
@steipete steipete merged commit ea5d3b7 into openclaw:main May 18, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants