设计智能体实现与审查循环
围绕代码实现与独立审查设计协作流程,产出审查提示词、反馈模板、停止规则及效果评估方案。
完整提示词
<context>
A second agent reviewing the first catches real problems only under a few conditions. The reviewer needs fresh context (not the implementer's reasoning, which it will tend to agree with), a different brief focused on finding faults, the requirement and the diff, and the authority to run checks. Its criteria must be concrete and ranked, or it fills every round with style nits that the implementer dutifully "fixes" while the real issue survives. Without an iteration cap, loops run until the budget is gone; without an oscillation check, the implementer flips between two versions to satisfy alternating comments. Only blocking findings should go back automatically; the rest belong in a note for the human. The human steps in when the reviewer and implementer disagree twice on the same point, when a finding touches security or data, or when the cap is reached.
</context>
<task>
Design the loop for this use case.
<use_case>
{{use_case}}
</use_case>
{{#problems}}
<problems>
{{problems}}
</problems>
{{/problems}}
1. Loop design: the roles, what each receives as input (requirement, diff, check results, previous findings), what each may do (the reviewer reads and runs checks, does not edit), and the sequence with deterministic checks (tests, lint, type-check) before any review round.
2. Review criteria ranked: requirement met, correctness and edge cases, tests real and not weakened, scope, security-sensitive changes, then maintainability. Define blocking versus non-blocking.
3. Write the reviewer prompt: under about 30 lines, with the criteria, the rule to cite file and line and evidence for each finding, and the return format.
4. Feedback format: what goes back to the implementer (blocking findings only, each with evidence and the expected outcome, not a dictated fix).
5. Stop rules: iteration cap (two or three rounds is typical), oscillation detection (a finding reappears or a change reverts an earlier one), disagreement escalation, and conditions that always need a human.
6. Cost and risks: rough cost per round relative to one implementation, failure modes of the loop itself (reviewer and implementer sharing a blind spot, rubber-stamping), and how to measure whether the loop beats a single agent with human review.
</task>
<constraints>
- The loop never merges or deploys by itself; the final step is a human review.
- Do not claim a specific accuracy gain; propose how to measure it.
- If the agent tool's syntax for subagents or scripting is uncertain, mark it "check against the tool's documentation".
</constraints>
<output_format>
## Loop design
Numbered sequence with inputs and permissions per role.
## Reviewer prompt
Fenced block.
## Feedback format
Fenced template.
## Stop rules
Bullets.
## Cost and risks
Bullets and the measurement plan.
</output_format>可替换内容
- {{use_case}}
- {{#problems}}
- {{problems}}
- {{/problems}}
分类与标签
编程开发、智能体协作、代码审查、审查提示词、迭代控制、开发流程