-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreview-changes.js
More file actions
51 lines (48 loc) · 1.6 KB
/
Copy pathreview-changes.js
File metadata and controls
51 lines (48 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
export const meta = {
name: "review-changes",
description: "Review changed files across independent dimensions, then adversarially verify each review",
whenToUse: "Use after a non-trivial code change needs parallel correctness, security, and maintainability review.",
phases: [
{ title: "Review", detail: "One independent agent per review dimension" },
{ title: "Verify", detail: "A second agent challenges each review" },
],
}
phase("Review")
const dimensions = [
{
key: "correctness",
prompt: "Review the current git diff for concrete correctness bugs. Return concise findings with file paths.",
},
{
key: "security",
prompt: "Review the current git diff for concrete security or trust-boundary bugs. Return concise findings with file paths.",
},
{
key: "maintainability",
prompt: "Review the current git diff for concrete maintainability regressions. Return only actionable findings.",
},
]
const reviewed = await pipeline(
dimensions,
dimension => agent(dimension.prompt, {
label: `review:${dimension.key}`,
phase: "Review",
}),
(review, dimension) => {
if (review === null) {
log(`Dropped ${dimension.key}: the review agent did not complete.`)
return null
}
return agent(
`Adversarially verify this ${dimension.key} review against the current diff. Reject speculation and return the confirmed findings only:\n\n${review}`,
{
label: `verify:${dimension.key}`,
phase: "Verify",
},
)
},
)
return {
dimensions: dimensions.map(dimension => dimension.key),
verified: reviewed.filter(Boolean),
}