export const meta = {
name: 'quick-review',
description: 'Review a diff from two angles and have two skeptics vote on each finding',
phases: [{ title: 'Find' }, { title: 'Verify' }],
maxAgents: 40,
}
const FINDINGS = { type: 'object', required: ['findings'], properties: { findings: { type: 'array', items: {
type: 'object', required: ['file', 'claim'], properties: { file: { type: 'string' }, claim: { type: 'string' } } } } } }
const VERDICT = { type: 'object', required: ['refuted'], properties: { refuted: { type: 'boolean' } } }
const perAngle = await pipeline(
['correctness', 'security'],
angle => agent(`Look only for ${angle} problems in the change \`git diff ${args.diffRef}\`.`,
{ label: `find:${angle}`, phase: 'Find', schema: FINDINGS }),
async (found, angle) => {
if (!found) { log(`${angle}: the finder returned nothing`); return [] }
return parallel(found.findings.map(f => async () => {
const votes = await parallel([0, 1].map(i => () =>
agent(`Try to refute this claim: ${f.claim} (${f.file}). If you are not sure, set refuted=true. View ${i}.`,
{ label: `verify:${f.file}#${i}`, phase: 'Verify', schema: VERDICT, effort: 'high' })))
return votes.filter(Boolean).every(v => !v.refuted) ? { ...f, angle } : null
}))
})
const confirmed = perAngle.flat().filter(Boolean)
log(`${confirmed.length} findings confirmed`)
return confirmed