2.8 KiB
2.8 KiB
| name | description | diff_output | spec_file | review_mode |
|---|---|---|---|---|
| Gather Context | Determine what to review, construct the diff, and load any spec/context documents. |
Step 1: Gather Context
RULES
- YOU MUST ALWAYS SPEAK OUTPUT in your Agent communication style with the config
{communication_language} - Do not modify any files. This step is read-only.
INSTRUCTIONS
-
Ask the user: What do you want to review? Present these options:
- Uncommitted changes (staged + unstaged)
- Staged changes only
- Branch diff vs a base branch (ask which base branch)
- Specific commit range (ask for the range)
- Provided diff or file list (user pastes or provides a path)
-
Construct
{diff_output}from the chosen source.- For branch diff: verify the base branch exists before running
git diff. If it does not exist, HALT and ask the user for a valid branch. - For commit range: verify the range resolves. If it does not, HALT and ask the user for a valid range.
- For provided diff: validate the content is non-empty and parseable as a unified diff. If it is not parseable, HALT and ask the user to provide a valid diff.
- For file list: validate each path exists in the working tree. Construct
{diff_output}by runninggit diff HEAD -- <path1> <path2> .... If the diff is empty (files have no uncommitted changes), ask the user whether to review the full file contents or to specify a different baseline. - After constructing
{diff_output}, verify it is non-empty regardless of source type. If empty, HALT and tell the user there is nothing to review.
- For branch diff: verify the base branch exists before running
-
Ask the user: Is there a spec or story file that provides context for these changes?
- If yes: set
{spec_file}to the path provided, verify the file exists and is readable, then set{review_mode}="full". - If no: set
{review_mode}="no-spec".
- If yes: set
-
If
{review_mode}="full"and the file at{spec_file}has acontextfield in its frontmatter listing additional docs, load each referenced document. Warn the user about any docs that cannot be found. -
Sanity check: if
{diff_output}exceeds approximately 3000 lines, warn the user and offer to chunk the review by file group.- If the user opts to chunk: agree on the first group, narrow
{diff_output}accordingly, and list the remaining groups for the user to note for follow-up runs. - If the user declines: proceed as-is with the full diff.
- If the user opts to chunk: agree on the first group, narrow
CHECKPOINT
Present a summary before proceeding: diff stats (files changed, lines added/removed), {review_mode}, and loaded spec/context docs (if any). HALT and wait for user confirmation to proceed.
NEXT
Read fully and follow ./step-02-review.md