Skip to content

chore(agents): rework auditor/architect prompts and drop impact-reviewer subagent - #93

Merged
chriswritescode-dev merged 1 commit into
mainfrom
refactor/remove-impact-reviewer
Aug 10, 2026
Merged

chore(agents): rework auditor/architect prompts and drop impact-reviewer subagent#93
chriswritescode-dev merged 1 commit into
mainfrom
refactor/remove-impact-reviewer

Conversation

@chriswritescode-dev

@chriswritescode-devchriswritescode-dev commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Summary

Removes the dedicated impact-reviewer subagent and folds whole-change impact analysis directly into the auditor-loop audit workflow. Auditor and architect agent prompts are tightened around the minimal-design ladder and single-source-of-truth planning.

Impact-reviewer removal

  • src/agents/impact-reviewer.ts and src/prompts/agents/impact-reviewer.md deleted; registration and AgentRole updated in src/agents/index.ts and src/agents/types.ts.
  • README.md agents table updated (7 → 6 bundled agents).

Auditor prompt rework

  • Auditor-loop final audit rules now require a direct "Whole-Change Impact Analysis" covering duplication, parallel implementations, missed callers/companion updates, and unreachable/superseded code — no separate impact agent.
  • Findings lifecycle simplified (read → manifest → reconcile → inspect → validate → persist); review-write fields documented; resolved findings deleted immediately.
  • Loop and final-audit addenda updated to match.

Architect prompt rework

  • Research/design steps mandate the minimal design ladder (reuse existing code, stdlib, native, installed dependency before new code), a single named owner for shared behavior, and no parallel implementations.
  • Plan requirements demand explicit caller migrations and removal of obsolete code paths, plus targeted reference/search assertions in verification.

Tests

  • test/agents.test.ts updated: 6-agent count, impact-reviewer tests removed, new auditor-loop impact-analysis assertions.

Validation

pnpm build, pnpm typecheck, pnpm lint clean; test/agents.test.ts (33 tests) passes.

Summary by CodeRabbit

  • Improvements

    • Auditing now performs direct whole-change analysis, including scope, duplication, missed callers, unreachable code, and repository guidance checks.
    • Planning workflows now require broader repository research, reuse of existing solutions, clear ownership, affected callers, obsolete paths, and targeted verification.
    • Audit findings and plan phases now include clearer remediation, acceptance criteria, and verification details.
  • Changes

    • Removed the separate impact-reviewer agent and related documentation.

@coderabbitai

coderabbitaiBot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR removes the impact-reviewer agent and updates agent registration, documentation, types, tests, planning prompts, and audit prompts. Auditing now performs direct whole-change analysis with structured finding verification and persistence.

Changes

Agent and workflow consolidation

Layer / File(s)Summary
Remove impact-reviewer registration
README.md, src/agents/index.ts, src/agents/types.ts, test/agents.test.ts
Removes the impact-reviewer definition, registration, public role, documentation, and related registry expectation.
Strengthen planning contracts
src/prompts/agents/architect.md, src/prompts/agents/architect-auto.md, test/agents.test.ts
Requires repository research, shared ownership, caller convergence, obsolete-path removal, precise phase edits, acceptance criteria, and targeted verification.
Replace delegated auditing with direct analysis
src/prompts/agents/auditor.md, src/prompts/agents/auditor-final-audit-addendum.md, src/prompts/agents/auditor-loop-addendum.md, test/agents.test.ts
Replaces delegated impact review with direct scope reconciliation, whole-change analysis, finding verification, and structured persistence rules.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
participant Auditor
participant Repository
participant FindingsStore
Auditor->>Repository: Establish scope and changed-file manifest
Auditor->>Repository: Inspect files, callers, duplication, and superseded code
Auditor->>FindingsStore: Reconcile and persist verified findings
FindingsStore-->>Auditor: Return finding state
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly summarizes the main changes: reworking auditor and architect prompts and removing the impact-reviewer subagent.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/remove-impact-reviewer

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chriswritescode-dev
chriswritescode-dev merged commit 72e141a into mainAug 10, 2026
1 of 2 checks passed
@chriswritescode-dev
chriswritescode-dev deleted the refactor/remove-impact-reviewer branch August 10, 2026 01:23

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/prompts/agents/architect.md`:
- Around line 15-16: Resolve the contract mismatch between the architect
prompt’s conclusion in “Conclude” and the Loop-mode behavior documented in
README.md. Either update README.md to state that the architect never invokes
execute-plan and execution is user-directed, or revise the prompt and its
related test to preserve Loop-mode dispatch; keep the documentation, prompt, and
test consistent.
In `@src/prompts/agents/auditor.md`:
- Around line 73-91: Update the “Verification” guidance in the auditor prompt to
explicitly prioritize the final-audit requirement from
auditor-final-audit-addendum over the generic rule allowing reliable earlier
verification evidence to skip checks. Require every top-level verification
command to run against the final state unless an explicit technical reason
prevents it.
- Around line 5-10: Update the review-scope instructions so every invocation
mode runs git status --short and reads the contents of each untracked file,
including commit-hash, branch, and PR modes. Ensure untracked files are included
in both the generated manifest and whole-change/final-audit analysis, while
preserving the existing tracked-change commands and unknown-base handling.
- Line 25: Add crossSection to the documented review-write arguments in the
prompt contract, alongside sectionIndex, so it matches the supported inputs and
sectioned-loop behavior implemented by review-write.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 37d46558-8328-46fa-8a06-9e9c202540c0

📥 Commits

Reviewing files that changed from the base of the PR and between f6f3393 and 5ca348c.

📒 Files selected for processing (11)
  • README.md
  • src/agents/impact-reviewer.ts
  • src/agents/index.ts
  • src/agents/types.ts
  • src/prompts/agents/architect-auto.md
  • src/prompts/agents/architect.md
  • src/prompts/agents/auditor-final-audit-addendum.md
  • src/prompts/agents/auditor-loop-addendum.md
  • src/prompts/agents/auditor.md
  • src/prompts/agents/impact-reviewer.md
  • test/agents.test.ts
💤 Files with no reviewable changes (3)
  • src/prompts/agents/impact-reviewer.md
  • src/agents/impact-reviewer.ts
  • src/agents/index.ts

Comment on lines 15 to 16
5. **Conclude** — Only after the stored plan is complete and warning-free, end by summarizing the plan in chat — the intention, goal, approach, and key findings; do not emit the full plan. Stop there: do not call `execute-plan`, do not call the `question` tool, and do not ask how to launch. The user decides whether and how to execute.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Align the architect execution contract with the documentation.

Line 15 forbids the architect from calling execute-plan and defers execution to the user. README.md Line 133 still says that Loop mode is an exception where the interactive architect invokes execute-plan. These contracts conflict.

Update README.md to describe the new dispatch path, or change the prompt and its test to preserve the documented Loop behavior.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/prompts/agents/architect.md` around lines 15 - 16, Resolve the contract
mismatch between the architect prompt’s conclusion in “Conclude” and the
Loop-mode behavior documented in README.md. Either update README.md to state
that the architect never invokes execute-plan and execution is user-directed, or
revise the prompt and its related test to preserve Loop-mode dispatch; keep the
documentation, prompt, and test consistent.

Comment on lines +5 to +10
Determine the review scope from the invocation input:

1. **Uncommitted changes**: Run `git diff` for unstaged, `git diff --cached` for staged, `git status --short` for untracked files
2. **Commit hash**: Run `git show <hash>`
3. **Branch name**: Run `git diff <branch>...HEAD`
4. **PR URL or number**: Run `gh pr view <input>` and `gh pr diff <input>`
1. **Uncommitted changes**: `git diff` for unstaged tracked changes, `git diff --cached` for staged changes, and `git status --short` to list untracked files. Read every untracked file because `git diff` omits them.
2. **Commit hash**: `git show <hash>`.
3. **Branch**: `git merge-base <base-ref> HEAD` to obtain the merge base, then `git diff <merge-base>` — this covers all committed, staged, and unstaged tracked changes since the branch diverged. Also run `git status --short` and read every untracked file. If the base ref is missing or unknown, do not guess; report that the review scope cannot be established.
4. **PR URL or number**: `gh pr view <input>` and `gh pr diff <input>`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Enumerate and read untracked files for every invocation mode.

The uncommitted path lists untracked files but does not say to read them. The commit and PR paths do not run git status --short or read untracked files. src/prompts/agents/auditor-final-audit-addendum.md Line 8 requires the final audit to cover every tracked and untracked worktree change.

A new untracked file can therefore be absent from the manifest and from whole-change analysis. Add one common status-and-read step to all scope modes, or restrict final audits to scopes that include the complete worktree.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/prompts/agents/auditor.md` around lines 5 - 10, Update the review-scope
instructions so every invocation mode runs git status --short and reads the
contents of each untracked file, including commit-hash, branch, and PR modes.
Ensure untracked files are included in both the generated manifest and
whole-change/final-audit analysis, while preserving the existing tracked-change
commands and unknown-base handling.

6. **Persist**: Store each new **bug** and **warning** with `review-write`. Do NOT store suggestions. Do not re-store resolved findings.

When reporting, include any still-open previous findings under a "### Previously Identified Issues" heading before presenting new findings.
Use `review-write` with: `file`, `line`, `severity` ("bug" or "warning"), `description`, `scenario`, and `status` ("open" by default). Put the required fix, acceptance criterion, and narrow verification in `description`; they are not separate tool arguments.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bashset -euo pipefail
rg -n -C 4 '\breview-write\b|\bsectionIndex\b|\bcrossSection\b' src test

Repository: chriswritescode-dev/opencode-forge

Length of output: 50391


🏁 Script executed:

#!/bin/bashset -euo pipefail
printf'--- src/prompts/agents/auditor.md relevant lines ---\n'
sed -n '1,50p' src/prompts/agents/auditor.md
printf'\n--- src/tools/review.ts review-write args / execute ---\n'
sed -n '35,95p' src/tools/review.ts
printf'\n--- auditor addendum lines ---\n'forfin src/prompts/agents/auditor-loop-addendum.md src/prompts/agents/auditor-final-audit-addendum;doif [ -f"$f" ];thenprintf'\n### %s\n'"$f"
sed -n '15,35p'"$f"fidone

Repository: chriswritescode-dev/opencode-forge

Length of output: 263


🏁 Script executed:

#!/bin/bashset -euo pipefail
printf'%s\n''--- src/prompts/agents/auditor.md relevant lines ---'
sed -n '1,50p' src/prompts/agents/auditor.md
printf'%s\n'''printf'%s\n''--- src/tools/review.ts review-write args / execute ---'
sed -n '35,95p' src/tools/review.ts
printf'%s\n'''printf'%s\n''--- auditor addendum lines ---'
sed -n '15,35p' src/prompts/agents/auditor-loop-addendum.md
sed -n '15,35p' src/prompts/agents/auditor-final-audit-addendum.md

Repository: chriswritescode-dev/opencode-forge

Length of output: 12587


Add crossSection to the review-write contract.

review-write supports sectionIndex and crossSection and defaults sectioned loop findings to the current section, so those addendum usages are valid. This line still omits crossSection, which makes the prompt contract disagree with src/tools/review.ts.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/prompts/agents/auditor.md` at line 25, Add crossSection to the documented
review-write arguments in the prompt contract, alongside sectionIndex, so it
matches the supported inputs and sectioned-loop behavior implemented by
review-write.

Comment on lines 73 to 91
## Before You Flag Something

Be certain. If you're going to call something a bug, you need to be confident it actually is one.

- Focus your review on the changes and code directly related to them
- If you discover a bug in pre-existing code that affects the correctness of the current changes, report it — do not dismiss it as "out of scope"
- Don't flag something as a bug if you're unsure — investigate first
- Don't invent hypothetical problems — if an edge case matters, explain the realistic scenario where it breaks
- Don't be a zealot about style: verify the code is actually in violation before flagging; some "violations" are acceptable when they're the simplest option; don't flag style preferences unless they clearly violate established project conventions
- Focus on the changes and code directly related to them.
- If you discover a bug in pre-existing code that affects the correctness of the current changes, report it — do not dismiss it as "out of scope".
- Don't flag something as a bug if you're unsure — investigate first.
- Don't invent hypothetical problems — if an edge case matters, explain the realistic scenario where it breaks.
- Verify the code is actually in violation before flagging style; some "violations" are acceptable when they're the simplest option. Don't flag style preferences unless they clearly violate established project conventions.
- If you can't verify something, say "I'm not sure about X" rather than flagging it as a definite issue.

If you're uncertain about something and can't verify it, say "I'm not sure about X" rather than flagging it as a definite issue.
## Verification

## Tool Usage
Run the narrowest relevant validation — not an unconditional full typecheck.

1. Determine the repository- or plan-mandated checks (package.json scripts, Makefile, pyproject.toml, or other build config). If the plan lists verification commands, prefer those.
2. Run them. When reliable evidence proves a check already passed (e.g., documented coder verification notes), do not re-run redundant full checks.
3. Report validation failures only when they are caused by or affect the reviewed change. Failures confined to unrelated files go under Observations, not as blocking findings.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Exclude final integration audits from the generic check-skip rule.

This section permits skipping a full check when reliable earlier evidence shows that it passed. src/prompts/agents/auditor-final-audit-addendum.md Line 12 requires every top-level verification command to run against the final state, except for an explicit technical reason.

Add an explicit final-audit exception or precedence rule. Otherwise an auditor can skip a required final check because coder notes show an earlier pass.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/prompts/agents/auditor.md` around lines 73 - 91, Update the
“Verification” guidance in the auditor prompt to explicitly prioritize the
final-audit requirement from auditor-final-audit-addendum over the generic rule
allowing reliable earlier verification evidence to skip checks. Require every
top-level verification command to run against the final state unless an explicit
technical reason prevents it.

Sign up for freeto 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.

1 participant

@chriswritescode-dev