@doidor/agentrig 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -27
- package/dist/agent/copilot.js +46 -5
- package/dist/agent/copilot.js.map +1 -1
- package/dist/cli.js +30 -5
- package/dist/cli.js.map +1 -1
- package/dist/commands/doctor.js +53 -8
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/eval-dynamic.js +316 -0
- package/dist/commands/eval-dynamic.js.map +1 -0
- package/dist/commands/eval-scaffold.js +173 -0
- package/dist/commands/eval-scaffold.js.map +1 -0
- package/dist/commands/eval.js +184 -55
- package/dist/commands/eval.js.map +1 -1
- package/dist/core/audit.js +237 -9
- package/dist/core/audit.js.map +1 -1
- package/dist/core/model-family.js +31 -0
- package/dist/core/model-family.js.map +1 -0
- package/dist/core/scenario-runner.js +298 -0
- package/dist/core/scenario-runner.js.map +1 -0
- package/dist/prompts/index.js +121 -30
- package/dist/prompts/index.js.map +1 -1
- package/knowledge/PRINCIPLES.md +2 -2
- package/knowledge/manifest.json +16 -1
- package/knowledge/templates/AGENTS.md +7 -6
- package/knowledge/templates/agents/README.md +4 -4
- package/knowledge/templates/agents/developer.yml +1 -1
- package/knowledge/templates/agents/judge.yml +1 -1
- package/knowledge/templates/agents/reviewer.yml +1 -1
- package/knowledge/templates/agents/triager.yml +5 -4
- package/knowledge/templates/dashboard/dashboard.mjs +12 -5
- package/knowledge/templates/eval/RUBRIC.md +87 -64
- package/knowledge/templates/eval/axes.json +25 -25
- package/knowledge/templates/eval/calibration/README.md +54 -0
- package/knowledge/templates/eval/calibration/review/seed-correct.yml +43 -0
- package/knowledge/templates/eval/calibration/run/seed-correct.yml +35 -0
- package/knowledge/templates/eval/calibration/run/seed-no-verify.yml +34 -0
- package/knowledge/templates/eval/checks.json +88 -11
- package/knowledge/templates/eval/scenarios/add-small-feature/README.md +17 -0
- package/knowledge/templates/eval/scenarios/add-small-feature/fixture/SPEC.md +25 -0
- package/knowledge/templates/eval/scenarios/add-small-feature/fixture/package.json +9 -0
- package/knowledge/templates/eval/scenarios/add-small-feature/fixture/src/slugify.js +5 -0
- package/knowledge/templates/eval/scenarios/add-small-feature/fixture/tests/feature.test.js +31 -0
- package/knowledge/templates/eval/scenarios/add-small-feature/judge_brief.md +25 -0
- package/knowledge/templates/eval/scenarios/add-small-feature/oracle.yml +41 -0
- package/knowledge/templates/eval/scenarios/add-small-feature/prompt.md +17 -0
- package/knowledge/templates/eval/scenarios/add-small-feature/scenario.yml +22 -0
- package/knowledge/templates/eval/scenarios/fix-failing-test/README.md +18 -0
- package/knowledge/templates/eval/scenarios/fix-failing-test/fixture/package.json +9 -0
- package/knowledge/templates/eval/scenarios/fix-failing-test/fixture/src/math.js +13 -0
- package/knowledge/templates/eval/scenarios/fix-failing-test/fixture/tests/add.test.js +7 -0
- package/knowledge/templates/eval/scenarios/fix-failing-test/fixture/tests/divide.test.js +11 -0
- package/knowledge/templates/eval/scenarios/fix-failing-test/fixture/tests/multiply.test.js +7 -0
- package/knowledge/templates/eval/scenarios/fix-failing-test/judge_brief.md +20 -0
- package/knowledge/templates/eval/scenarios/fix-failing-test/oracle.yml +33 -0
- package/knowledge/templates/eval/scenarios/fix-failing-test/prompt.md +12 -0
- package/knowledge/templates/eval/scenarios/fix-failing-test/scenario.yml +23 -0
- package/knowledge/templates/eval/scenarios/review-catches-bug/README.md +17 -0
- package/knowledge/templates/eval/scenarios/review-catches-bug/fixture/baseline/package.json +6 -0
- package/knowledge/templates/eval/scenarios/review-catches-bug/fixture/baseline/src/format.js +4 -0
- package/knowledge/templates/eval/scenarios/review-catches-bug/fixture/baseline/src/pagination.js +7 -0
- package/knowledge/templates/eval/scenarios/review-catches-bug/fixture/change/src/format.js +6 -0
- package/knowledge/templates/eval/scenarios/review-catches-bug/fixture/change/src/pagination.js +7 -0
- package/knowledge/templates/eval/scenarios/review-catches-bug/judge_brief.md +38 -0
- package/knowledge/templates/eval/scenarios/review-catches-bug/oracle.yml +29 -0
- package/knowledge/templates/eval/scenarios/review-catches-bug/prompt.md +33 -0
- package/knowledge/templates/eval/scenarios/review-catches-bug/scenario.yml +23 -0
- package/knowledge/templates/eval/score.mjs +368 -42
- package/knowledge/templates/eval/static-audit.mjs +204 -17
- package/knowledge/templates/harness/state-machine.yml +18 -12
- package/knowledge/templates/skills/harness-eval/SKILL.md +59 -54
- package/knowledge/templates/skills/log-gotcha/SKILL.md +68 -0
- package/knowledge/templates/skills/self-verify/SKILL.md +32 -8
- package/package.json +4 -3
- package/knowledge/templates/eval/scenarios/README.md +0 -24
- package/knowledge/templates/eval/scenarios/add-small-feature.md +0 -28
- package/knowledge/templates/eval/scenarios/fix-failing-test.md +0 -27
- package/knowledge/templates/eval/scenarios/review-catches-bug.md +0 -30
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import { existsSync, readFileSync, mkdirSync, writeFileSync, statSync, readdirSync, cpSync, rmSync } from "node:fs";
|
|
2
|
+
import { join, resolve, relative } from "node:path";
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import YAML from "yaml";
|
|
6
|
+
import { sameFamily } from "./model-family.js";
|
|
7
|
+
export function locateScenario(repoRoot, id) {
|
|
8
|
+
const root = resolve(repoRoot, ".agentrig", "eval", "scenarios", id);
|
|
9
|
+
if (!existsSync(root) || !statSync(root).isDirectory())
|
|
10
|
+
return null;
|
|
11
|
+
return {
|
|
12
|
+
root,
|
|
13
|
+
scenarioYml: join(root, "scenario.yml"),
|
|
14
|
+
promptMd: join(root, "prompt.md"),
|
|
15
|
+
oracleYml: join(root, "oracle.yml"),
|
|
16
|
+
fixtureDir: join(root, "fixture"),
|
|
17
|
+
readmeMd: join(root, "README.md"),
|
|
18
|
+
judgeBriefMd: existsSync(join(root, "judge_brief.md")) ? join(root, "judge_brief.md") : null,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function listScenarios(repoRoot) {
|
|
22
|
+
const dir = resolve(repoRoot, ".agentrig", "eval", "scenarios");
|
|
23
|
+
if (!existsSync(dir))
|
|
24
|
+
return [];
|
|
25
|
+
const out = [];
|
|
26
|
+
for (const entry of readdirSync(dir)) {
|
|
27
|
+
if (entry.startsWith(".") || entry.startsWith("_"))
|
|
28
|
+
continue;
|
|
29
|
+
const abs = join(dir, entry);
|
|
30
|
+
if (!statSync(abs).isDirectory())
|
|
31
|
+
continue;
|
|
32
|
+
if (existsSync(join(abs, "scenario.yml")))
|
|
33
|
+
out.push(entry);
|
|
34
|
+
}
|
|
35
|
+
return out.sort();
|
|
36
|
+
}
|
|
37
|
+
export function loadScenario(paths) {
|
|
38
|
+
if (!existsSync(paths.scenarioYml)) {
|
|
39
|
+
throw new Error(`scenario.yml missing in ${paths.root}`);
|
|
40
|
+
}
|
|
41
|
+
// Accept both plain YAML and "--- ... ---" frontmatter-style wrappers (for consistency
|
|
42
|
+
// with skill files). Strip the wrapper before parsing so we get a single document.
|
|
43
|
+
let text = readFileSync(paths.scenarioYml, "utf8").trim();
|
|
44
|
+
if (text.startsWith("---")) {
|
|
45
|
+
const end = text.indexOf("\n---", 3);
|
|
46
|
+
if (end > 0)
|
|
47
|
+
text = text.slice(4, end).trim();
|
|
48
|
+
}
|
|
49
|
+
const fm = YAML.parse(text);
|
|
50
|
+
if (!fm?.id)
|
|
51
|
+
throw new Error(`scenario.yml in ${paths.root} missing required 'id'`);
|
|
52
|
+
return fm;
|
|
53
|
+
}
|
|
54
|
+
export function loadOracle(paths) {
|
|
55
|
+
if (!existsSync(paths.oracleYml))
|
|
56
|
+
return { checks: [] };
|
|
57
|
+
const spec = YAML.parse(readFileSync(paths.oracleYml, "utf8"));
|
|
58
|
+
return { checks: Array.isArray(spec?.checks) ? spec.checks : [] };
|
|
59
|
+
}
|
|
60
|
+
/** Seed a throwaway worktree from a scenario fixture and `git init` it so we can take diffs.
|
|
61
|
+
*
|
|
62
|
+
* Layouts supported:
|
|
63
|
+
* 1. `fixture/` directly — single baseline commit.
|
|
64
|
+
* 2. `fixture/baseline/` (+ optional `fixture/change/`) — for review scenarios:
|
|
65
|
+
* commit baseline first, then overlay change as a second commit so the producer
|
|
66
|
+
* reviewer sees a real `HEAD vs HEAD~1` diff.
|
|
67
|
+
*/
|
|
68
|
+
export function seedWorktree(fixtureDir, runId, scenarioId) {
|
|
69
|
+
if (!existsSync(fixtureDir))
|
|
70
|
+
throw new Error(`fixture missing: ${fixtureDir}`);
|
|
71
|
+
const wt = join(tmpdir(), "agentrig-eval", runId, scenarioId);
|
|
72
|
+
if (existsSync(wt))
|
|
73
|
+
rmSync(wt, { recursive: true, force: true });
|
|
74
|
+
mkdirSync(wt, { recursive: true });
|
|
75
|
+
const baselineDir = join(fixtureDir, "baseline");
|
|
76
|
+
const changeDir = join(fixtureDir, "change");
|
|
77
|
+
const hasBaselineLayout = existsSync(baselineDir) && statSync(baselineDir).isDirectory();
|
|
78
|
+
if (hasBaselineLayout) {
|
|
79
|
+
cpSync(baselineDir, wt, { recursive: true });
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
cpSync(fixtureDir, wt, { recursive: true });
|
|
83
|
+
}
|
|
84
|
+
// Make it a git repo so we can diff the agent's work against the fixture baseline.
|
|
85
|
+
spawnSync("git", ["init", "-q"], { cwd: wt });
|
|
86
|
+
spawnSync("git", ["config", "user.email", "eval@agentrig.local"], { cwd: wt });
|
|
87
|
+
spawnSync("git", ["config", "user.name", "AgentRig Eval"], { cwd: wt });
|
|
88
|
+
spawnSync("git", ["add", "-A"], { cwd: wt });
|
|
89
|
+
spawnSync("git", ["commit", "-q", "-m", "fixture baseline"], { cwd: wt });
|
|
90
|
+
// For the two-commit layout, overlay `change/` and commit again.
|
|
91
|
+
if (hasBaselineLayout && existsSync(changeDir) && statSync(changeDir).isDirectory()) {
|
|
92
|
+
cpSync(changeDir, wt, { recursive: true, force: true });
|
|
93
|
+
spawnSync("git", ["add", "-A"], { cwd: wt });
|
|
94
|
+
spawnSync("git", ["commit", "-q", "-m", "fixture change (under review)"], { cwd: wt });
|
|
95
|
+
}
|
|
96
|
+
return wt;
|
|
97
|
+
}
|
|
98
|
+
/** Capture the unified diff (vs baseline) the producer left in the worktree. */
|
|
99
|
+
export function captureDiff(worktree) {
|
|
100
|
+
// git diff HEAD picks up tracked + staged changes; we also need to include untracked files.
|
|
101
|
+
spawnSync("git", ["add", "-A"], { cwd: worktree });
|
|
102
|
+
const res = spawnSync("git", ["diff", "--cached"], { cwd: worktree, encoding: "utf8" });
|
|
103
|
+
return res.stdout || "";
|
|
104
|
+
}
|
|
105
|
+
export function parseDiffStats(diff) {
|
|
106
|
+
const files = new Map();
|
|
107
|
+
let cur = null;
|
|
108
|
+
for (const line of diff.split(/\r?\n/)) {
|
|
109
|
+
const fileHeader = line.match(/^\+\+\+ b\/(.+)$/);
|
|
110
|
+
if (fileHeader) {
|
|
111
|
+
const path = fileHeader[1];
|
|
112
|
+
cur = files.get(path) ?? { path, added: 0, removed: 0 };
|
|
113
|
+
files.set(path, cur);
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
if (!cur)
|
|
117
|
+
continue;
|
|
118
|
+
if (line.startsWith("+") && !line.startsWith("+++"))
|
|
119
|
+
cur.added++;
|
|
120
|
+
else if (line.startsWith("-") && !line.startsWith("---"))
|
|
121
|
+
cur.removed++;
|
|
122
|
+
}
|
|
123
|
+
return [...files.values()];
|
|
124
|
+
}
|
|
125
|
+
/** Run the deterministic oracle. Returns one result per check.
|
|
126
|
+
* `env` is merged into the child process environment for `cmd`-type checks —
|
|
127
|
+
* the scenario-runner uses this to inject `AGENTRIG_CLI` for the dogfood scenario.
|
|
128
|
+
*/
|
|
129
|
+
export function runOracle(worktree, oracle, env = {}) {
|
|
130
|
+
const diff = captureDiff(worktree);
|
|
131
|
+
const stats = parseDiffStats(diff);
|
|
132
|
+
const out = [];
|
|
133
|
+
for (const c of oracle.checks) {
|
|
134
|
+
out.push(runOracleCheck(worktree, c, diff, stats, env));
|
|
135
|
+
}
|
|
136
|
+
return out;
|
|
137
|
+
}
|
|
138
|
+
function runOracleCheck(worktree, c, diff, stats, env) {
|
|
139
|
+
switch (c.type) {
|
|
140
|
+
case "cmd": {
|
|
141
|
+
if (!c.cmd)
|
|
142
|
+
return { id: c.id, axis: c.axis, score: 0, evidence: "cmd: missing" };
|
|
143
|
+
// Scrub NODE_TEST_CONTEXT: when the runner is itself executed inside `node --test`
|
|
144
|
+
// (which the unit tests do), nested `node --test` invocations from oracle cmd
|
|
145
|
+
// checks see that env var and behave as silent subprocesses. Delete it so the
|
|
146
|
+
// oracle's nested tests run as a fresh, independent test process.
|
|
147
|
+
const childEnv = { ...process.env, ...env };
|
|
148
|
+
delete childEnv.NODE_TEST_CONTEXT;
|
|
149
|
+
const res = spawnSync(c.cmd, {
|
|
150
|
+
cwd: worktree,
|
|
151
|
+
shell: true,
|
|
152
|
+
encoding: "utf8",
|
|
153
|
+
timeout: 120_000,
|
|
154
|
+
env: childEnv,
|
|
155
|
+
});
|
|
156
|
+
const wantZero = c.expect !== "exit_nonzero";
|
|
157
|
+
const ok = wantZero ? res.status === 0 : res.status !== 0;
|
|
158
|
+
const tail = (res.stdout + res.stderr).split(/\r?\n/).filter(Boolean).slice(-3).join(" | ");
|
|
159
|
+
return ok
|
|
160
|
+
? { id: c.id, axis: c.axis, score: 1, evidence: "" }
|
|
161
|
+
: { id: c.id, axis: c.axis, score: 0, evidence: `exit=${res.status}${tail ? `: ${tail}` : ""}` };
|
|
162
|
+
}
|
|
163
|
+
case "diff_stats": {
|
|
164
|
+
const totalAdded = stats.reduce((s, x) => s + x.added, 0);
|
|
165
|
+
const totalRemoved = stats.reduce((s, x) => s + x.removed, 0);
|
|
166
|
+
const problems = [];
|
|
167
|
+
if (c.max_added_lines != null && totalAdded > c.max_added_lines)
|
|
168
|
+
problems.push(`added ${totalAdded} > ${c.max_added_lines}`);
|
|
169
|
+
if (c.max_removed_lines != null && totalRemoved > c.max_removed_lines)
|
|
170
|
+
problems.push(`removed ${totalRemoved} > ${c.max_removed_lines}`);
|
|
171
|
+
if (c.max_files != null && stats.length > c.max_files)
|
|
172
|
+
problems.push(`touched ${stats.length} files > ${c.max_files}`);
|
|
173
|
+
return problems.length === 0
|
|
174
|
+
? { id: c.id, axis: c.axis, score: 1, evidence: "" }
|
|
175
|
+
: { id: c.id, axis: c.axis, score: 0.5, evidence: problems.join("; ") };
|
|
176
|
+
}
|
|
177
|
+
case "diff_files": {
|
|
178
|
+
const touched = stats.map((s) => s.path);
|
|
179
|
+
const problems = [];
|
|
180
|
+
if (c.allowed) {
|
|
181
|
+
const extras = touched.filter((p) => !c.allowed.some((a) => matchGlob(p, a)));
|
|
182
|
+
if (extras.length)
|
|
183
|
+
problems.push(`unexpected files: ${extras.join(", ")}`);
|
|
184
|
+
}
|
|
185
|
+
if (c.forbidden) {
|
|
186
|
+
const hits = touched.filter((p) => c.forbidden.some((a) => matchGlob(p, a)));
|
|
187
|
+
if (hits.length)
|
|
188
|
+
problems.push(`touched forbidden: ${hits.join(", ")}`);
|
|
189
|
+
}
|
|
190
|
+
return problems.length === 0
|
|
191
|
+
? { id: c.id, axis: c.axis, score: 1, evidence: "" }
|
|
192
|
+
: { id: c.id, axis: c.axis, score: 0, evidence: problems.join("; ") };
|
|
193
|
+
}
|
|
194
|
+
case "file_contains": {
|
|
195
|
+
if (!c.path || !c.pattern)
|
|
196
|
+
return { id: c.id, axis: c.axis, score: 0, evidence: "missing path/pattern" };
|
|
197
|
+
const abs = join(worktree, c.path);
|
|
198
|
+
if (!existsSync(abs))
|
|
199
|
+
return { id: c.id, axis: c.axis, score: 0, evidence: `missing ${c.path}` };
|
|
200
|
+
const text = readFileSync(abs, "utf8");
|
|
201
|
+
return new RegExp(c.pattern).test(text)
|
|
202
|
+
? { id: c.id, axis: c.axis, score: 1, evidence: "" }
|
|
203
|
+
: { id: c.id, axis: c.axis, score: 0, evidence: `pattern not found in ${c.path}` };
|
|
204
|
+
}
|
|
205
|
+
case "file_missing": {
|
|
206
|
+
if (!c.path)
|
|
207
|
+
return { id: c.id, axis: c.axis, score: 0, evidence: "missing path" };
|
|
208
|
+
return existsSync(join(worktree, c.path))
|
|
209
|
+
? { id: c.id, axis: c.axis, score: 0, evidence: `${c.path} still present` }
|
|
210
|
+
: { id: c.id, axis: c.axis, score: 1, evidence: "" };
|
|
211
|
+
}
|
|
212
|
+
default:
|
|
213
|
+
return { id: c.id, axis: c.axis, score: 0, evidence: `unknown oracle check type "${c.type}"` };
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/** Trivial glob: supports `*` (single segment) and `**` (any segments). No regex pass-through. */
|
|
217
|
+
function matchGlob(path, pattern) {
|
|
218
|
+
if (pattern === path)
|
|
219
|
+
return true;
|
|
220
|
+
const escaped = pattern
|
|
221
|
+
.replace(/[.+^${}()|[\]\\]/g, "\\$&")
|
|
222
|
+
.replace(/\*\*/g, "::DOUBLE::")
|
|
223
|
+
.replace(/\*/g, "[^/]*")
|
|
224
|
+
.replace(/::DOUBLE::/g, ".*");
|
|
225
|
+
return new RegExp("^" + escaped + "$").test(path);
|
|
226
|
+
}
|
|
227
|
+
/** Aggregate oracle results into per-axis scores (when an axis has multiple checks, min wins). */
|
|
228
|
+
export function oracleAxisScores(results) {
|
|
229
|
+
const byAxis = new Map();
|
|
230
|
+
for (const r of results) {
|
|
231
|
+
if (!byAxis.has(r.axis))
|
|
232
|
+
byAxis.set(r.axis, []);
|
|
233
|
+
byAxis.get(r.axis).push(r);
|
|
234
|
+
}
|
|
235
|
+
const out = [];
|
|
236
|
+
for (const [axis, rs] of byAxis) {
|
|
237
|
+
const score = Math.min(...rs.map((r) => r.score));
|
|
238
|
+
const evidence = rs.filter((r) => r.score < 1).map((r) => `${r.id}: ${r.evidence}`).join("; ");
|
|
239
|
+
out.push({ axis, score, evidence });
|
|
240
|
+
}
|
|
241
|
+
return out;
|
|
242
|
+
}
|
|
243
|
+
/** Convert oracle output into the --axis flag form score.mjs save expects. */
|
|
244
|
+
export function oracleAxesToFlags(scores, type) {
|
|
245
|
+
const codeMap = {
|
|
246
|
+
run: {
|
|
247
|
+
correctness: "OQ-CORRECT-WRONG",
|
|
248
|
+
scope: "OQ-SCOPE-UNRELATED",
|
|
249
|
+
tests: "OQ-TESTS-BROKEN",
|
|
250
|
+
clarity: "OQ-CLARITY-COMPLEXITY",
|
|
251
|
+
self_verification: "AB-VERIFY-SKIPPED",
|
|
252
|
+
gate_compliance: "AB-GATE-SKIPPED",
|
|
253
|
+
tool_discipline: "AB-TOOLS-OVERLIMIT",
|
|
254
|
+
escalation: "AB-ESCALATE-NONE",
|
|
255
|
+
memory: "LT-MEMORY-NOLOG",
|
|
256
|
+
regression_risk: "LT-REGRESS-UNTESTED",
|
|
257
|
+
maintainability: "LT-MAINTAIN-DEBT",
|
|
258
|
+
},
|
|
259
|
+
spec: {
|
|
260
|
+
clarity: "SP-CLARITY-VAGUE",
|
|
261
|
+
acceptance_criteria: "SP-AC-MISSING",
|
|
262
|
+
scope_bounded: "SP-SCOPE-TOOBIG",
|
|
263
|
+
testability: "SP-TEST-NOORACLE",
|
|
264
|
+
context: "SP-CONTEXT-MISSING",
|
|
265
|
+
},
|
|
266
|
+
review: {
|
|
267
|
+
finding_correctness: "RV-FIND-WRONG",
|
|
268
|
+
severity_calibration: "RV-SEV-UNDER",
|
|
269
|
+
false_positive_rate: "RV-FP-NOISE",
|
|
270
|
+
coverage: "RV-COV-MISSEDBUG",
|
|
271
|
+
actionability: "RV-ACT-VAGUE",
|
|
272
|
+
independence: "RV-IND-SAMEMODEL",
|
|
273
|
+
blocking_decision: "RV-BLOCK-WRONGFAIL",
|
|
274
|
+
},
|
|
275
|
+
};
|
|
276
|
+
const codes = codeMap[type] ?? {};
|
|
277
|
+
return scores.map((s) => {
|
|
278
|
+
if (s.score === 1)
|
|
279
|
+
return `${s.axis}=1.0`;
|
|
280
|
+
const code = codes[s.axis] ?? "";
|
|
281
|
+
const ev = s.evidence.replace(/:/g, ";").slice(0, 200) || "oracle check failed";
|
|
282
|
+
return `${s.axis}=${s.score}:${code}:${ev}`;
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
/** Re-export for the eval command to enforce producer ≠ judge family at run time. */
|
|
286
|
+
export { sameFamily };
|
|
287
|
+
/** Convenience: pretty-print a relative path (for log lines that mention worktree files). */
|
|
288
|
+
export function relPath(repoRoot, abs) {
|
|
289
|
+
return relative(repoRoot, abs) || abs;
|
|
290
|
+
}
|
|
291
|
+
/** Persist a per-scenario artifact bundle next to a run's meta.json. */
|
|
292
|
+
export function saveArtifacts(artifactsDir, scenarioId, kv) {
|
|
293
|
+
mkdirSync(artifactsDir, { recursive: true });
|
|
294
|
+
for (const [name, content] of Object.entries(kv)) {
|
|
295
|
+
writeFileSync(join(artifactsDir, `${scenarioId}.${name}`), content);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
//# sourceMappingURL=scenario-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenario-runner.js","sourceRoot":"","sources":["../../src/core/scenario-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACpH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AA4E/C,MAAM,UAAU,cAAc,CAAC,QAAgB,EAAE,EAAU;IACzD,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,CAAC,CAA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.agentrig/context.md\` first for repo context. Summarize what you merged and any conflicts
|
|
82
82
|
you resolved.`;
|
|
83
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* @deprecated Replaced by buildProducerPrompt + buildJudgePrompt in the P3 producer/judge
|
|
86
|
+
* split. Kept temporarily so legacy callers don't break during the migration.
|
|
87
|
+
*/
|
|
84
88
|
export function buildDynamicEvalPrompt(scenarioId, run) {
|
|
85
89
|
const scope = scenarioId
|
|
86
|
-
? `the single scenario \`.agentrig/eval/scenarios/${scenarioId}
|
|
87
|
-
: "each scenario in \`.agentrig/eval/scenarios
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
? `\
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
90
|
+
? `the single scenario \`.agentrig/eval/scenarios/${scenarioId}/\``
|
|
91
|
+
: "each scenario in \`.agentrig/eval/scenarios/*/\`";
|
|
92
|
+
return `# Task — Run the harness dynamic evaluation\n\nLegacy entry point — agentrig now drives producer + judge separately via the\nscenario runner. Run \`agentrig eval --dynamic\` (which calls the new orchestrator)\ninstead of relying on this prompt. Scope: ${scope}. Run id: ${run?.runId ?? "n/a"}.\n`;
|
|
93
|
+
}
|
|
94
|
+
/** Producer prompt — handed to the agent running in the scenario worktree.
|
|
95
|
+
* Inlines the scenario's own prompt.md so the producer doesn't need to find it. */
|
|
96
|
+
export function buildProducerPrompt(scenarioPrompt, variant) {
|
|
97
|
+
const isBaseline = variant === "baseline";
|
|
98
|
+
const baselineNote = isBaseline
|
|
99
|
+
? `\n**This is a BASELINE trial — harness OFF.** Do NOT read or follow \`AGENTS.md\`, \`.agents/rules/\`, \`.agents/skills/\`, or any AgentRig-installed instruction surface, even if they happen to be present in this worktree. Behave as a bare agent with only your training-data priors.\n`
|
|
100
|
+
: `\n**This is a HARNESS trial — harness ON.** Follow \`AGENTS.md\`, the rules in \`.agents/rules/\`, and the skills in \`.agents/skills/\` if they are present in this worktree.\n`;
|
|
101
|
+
// Harness-on variant gets an explicit pre-handoff checklist rendered as text at the END of
|
|
102
|
+
// the prompt (LLMs weight end-of-prompt instructions more heavily than buried skill bodies).
|
|
103
|
+
// This is the same checklist the self-verify and log-gotcha skills describe, but inlined so
|
|
104
|
+
// the agent can't miss it. The baseline variant deliberately does NOT include this — that's
|
|
105
|
+
// what makes the harness-on vs baseline A/B measure something real.
|
|
106
|
+
const handoffChecklist = isBaseline ? "" : `
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Pre-handoff checklist (read before you reply)
|
|
111
|
+
|
|
112
|
+
You are running with the AgentRig harness ON. Before declaring done, walk this checklist out loud
|
|
113
|
+
in your transcript. The harness eval scores you on each item; vague reassurances ("tests pass")
|
|
114
|
+
without the underlying evidence cost half-credit or more.
|
|
115
|
+
|
|
116
|
+
- [ ] **Baseline captured.** Did you run the project's test command BEFORE editing related code,
|
|
117
|
+
and surface the result in your transcript? For a fix scenario: explicitly note the failing
|
|
118
|
+
test name and the error. For a feature scenario: note the suite was green.
|
|
119
|
+
*Bad:* "All tests pass."
|
|
120
|
+
*Good:* "baseline: \`npm test\` → 1 fail (divide-by-zero); after fix: 0 fails, all 4 tests pass."
|
|
121
|
+
|
|
122
|
+
- [ ] **After captured.** Did you re-run the full test command at the end and surface the new
|
|
123
|
+
state? The transition baseline → after is the evidence that your edit did what you claim.
|
|
124
|
+
|
|
125
|
+
- [ ] **Wiki entry committed for any non-obvious lesson.** If your work revealed something
|
|
126
|
+
surprising (silent failure, library default, framework quirk, AGENTS.md rule that almost
|
|
127
|
+
bit you), use the \`log-gotcha\` skill to write a \`.agents/wiki/<topic>.md\` entry IN THE
|
|
128
|
+
SAME DIFF. Acknowledging the lesson only in your summary is half-credit. Silent is zero.
|
|
129
|
+
Run \`git diff --cached --stat\` to confirm the wiki file is staged.
|
|
130
|
+
|
|
131
|
+
- [ ] **Diff is on-target.** \`git diff --stat\` should show only files you intentionally changed.
|
|
132
|
+
|
|
133
|
+
If you can't honestly check a box, fix it before replying — that's cheaper than a re-roll.
|
|
134
|
+
`;
|
|
135
|
+
return `# Scenario task\n${baselineNote}\nYour entire job is described below. Work inside the current directory (this is a\nthrowaway worktree dedicated to your trial). When done, simply finish — the\nscenario runner captures your diff, your transcript, and runs the deterministic\noracle automatically.\n\n---\n\n${scenarioPrompt}${handoffChecklist}\n`;
|
|
136
|
+
}
|
|
137
|
+
/** Judge prompt — handed to a DIFFERENT model than the producer. The judge runs in a
|
|
138
|
+
* dedicated cwd containing prompt.md, diff.patch, transcript.md, oracle.json, judge_brief.md.
|
|
139
|
+
* Writes scores to outputJsonPath; the orchestrator reads + validates them. */
|
|
140
|
+
export function buildJudgePrompt(ctx) {
|
|
141
|
+
const axesList = ctx.judgeAxes.length
|
|
142
|
+
? ctx.judgeAxes.map((a) => `- \`${a}\``).join("\n")
|
|
143
|
+
: "(no soft axes for this scenario — write an empty axes array)";
|
|
144
|
+
return `# Task — Score a completed scenario as an INDEPENDENT JUDGE\n\nYou are the **judge** for scenario \`${ctx.scenario}\` (type: \`${ctx.type}\`). The producer\nagent has already finished. Read these files in your cwd to do your scoring:\n\n- \`prompt.md\` — the exact task the producer was given\n- \`diff.patch\` — the change the producer produced\n- \`transcript.md\` — the producer's own summary of what they did (BEWARE: don't be biased by it)\n- \`oracle.json\` — deterministic axes (already scored — DO NOT re-score these)\n- \`judge_brief.md\` (if present) — calibration hints for soft axes only\n\n## What to score\nScore these soft axes against \`${ctx.rubricPath}\`:\n${axesList}\n\nTiers are strict: \`0\` / \`0.5\` / \`1.0\`. Any score < 1.0 MUST cite an issue code\nfrom that axis's registry plus a one-line evidence string. Use \`confidence: 0\` for\naxes you genuinely cannot observe.\n\n## How to submit\nWrite your scores to \`${ctx.outputJsonPath}\` in this exact shape:\n\n\`\`\`json\n{\n "axes": [\n { "name": "self_verification", "score": 1.0, "confidence": 1 },\n { "name": "clarity", "score": 0.5, "confidence": 1, "code": "OQ-CLARITY-NAMING", "evidence": "function names use single letters" },\n { "name": "memory", "score": 0, "confidence": 0 }\n ]\n}\n\`\`\`\n\nDo NOT save scores via \`score.mjs\` yourself — the orchestrator does that.\n\n## Independence\nDo NOT defer to the producer's reasoning. Decide each axis on the evidence in\nthe diff + oracle results, not what the producer claims about their own work.\nIf the diff contradicts the transcript, the diff wins.\n`;
|
|
145
|
+
}
|
|
146
|
+
/** Scaffold-scenarios prompt — handed to an agent during `agentrig eval --scaffold`. The agent
|
|
147
|
+
* reads the repo investigation + the 3 generic scenarios as templates, then writes N new
|
|
148
|
+
* repo-tailored scenarios under .agentrig/eval/scenarios/. */
|
|
149
|
+
export function buildScaffoldScenariosPrompt(ctx) {
|
|
150
|
+
const examplesText = ctx.examples.map((e) => `### Example: \`${e.id}\`\n\n**scenario.yml**\n\`\`\`yaml\n${e.scenarioYml.trim()}\n\`\`\`\n\n**prompt.md** (first 800 chars)\n\`\`\`markdown\n${e.promptMd.slice(0, 800)}\n\`\`\`\n\n**oracle.yml**\n\`\`\`yaml\n${e.oracleYml.trim()}\n\`\`\``).join("\n\n");
|
|
151
|
+
return `# Task — Generate repository-specific eval scenarios
|
|
152
|
+
|
|
153
|
+
The 3 scenarios under \`.agentrig/eval/scenarios/\` are language-agnostic JS micro-fixtures. They
|
|
154
|
+
test a generic agent loop, but they do NOT exercise *this* repo's actual stack (test runner,
|
|
155
|
+
package manager, language idioms, common defect patterns). Your job: write ${ctx.count} new
|
|
156
|
+
scenario(s) that ARE specific to this repo.
|
|
157
|
+
|
|
158
|
+
## Repo investigation (from \`.agentrig/context.md\`)
|
|
159
|
+
|
|
160
|
+
\`\`\`
|
|
161
|
+
${ctx.contextMd.trim() || "(no context.md found — investigate the repo yourself before writing scenarios)"}
|
|
162
|
+
\`\`\`
|
|
163
|
+
|
|
164
|
+
## What a scenario looks like (templates)
|
|
165
|
+
|
|
166
|
+
${examplesText}
|
|
167
|
+
|
|
168
|
+
## What to produce
|
|
169
|
+
|
|
170
|
+
For each new scenario:
|
|
171
|
+
|
|
172
|
+
1. Create a directory \`.agentrig/eval/scenarios/<id>/\` with an id that names a concrete
|
|
173
|
+
task in THIS repo's stack (e.g. \`fix-pytest-failure\`, \`refactor-typescript-module\`,
|
|
174
|
+
\`review-django-migration\`, \`add-cargo-feature\`). NO generic ids — \`fix-failing-test\` is taken.
|
|
175
|
+
2. Write \`scenario.yml\` with YAML frontmatter:
|
|
176
|
+
- \`id\`: matches the directory name
|
|
177
|
+
- \`type\`: one of \`run\` | \`spec\` | \`review\`
|
|
178
|
+
- \`scope\`: \`patch\` | \`feature\` | \`epic\`
|
|
179
|
+
- \`principle_focus\`: array of 1-3 principle numbers (1-12)
|
|
180
|
+
- \`oracle_axes\`: array of axis names (deterministic-scored)
|
|
181
|
+
- \`judge_axes\`: array of axis names (LLM-scored)
|
|
182
|
+
3. Write \`prompt.md\` — the exact task handed to the producer agent. NO ambiguity, NO "invent your own spec."
|
|
183
|
+
4. Build \`fixture/\` — a tiny synthetic mini-repo using THIS repo's actual stack:
|
|
184
|
+
- Use the **real** package manager (\`requirements.txt\` / \`go.mod\` / \`package.json\` / \`Cargo.toml\`)
|
|
185
|
+
- Use the **real** test runner (\`pytest\` / \`go test\` / \`vitest\` / \`cargo test\`)
|
|
186
|
+
- Keep it ≤10 files total; one file should be the planted defect / spec / patch under review
|
|
187
|
+
5. Write \`oracle.yml\` — deterministic checks (cmd, diff_stats, diff_files, file_contains, file_missing).
|
|
188
|
+
The \`cmd\` checks MUST use this repo's actual test command, not \`npm test\`.
|
|
189
|
+
6. Write \`README.md\` — 1-2 paragraphs describing what the scenario tests + what a defect looks like.
|
|
190
|
+
7. Write \`judge_brief.md\` (optional but recommended) — calibration hints for soft axes the
|
|
191
|
+
judge will score (e.g. "1.0 = wrote a wiki entry, 0.5 = mentioned in summary, 0 = silent").
|
|
192
|
+
|
|
193
|
+
## Hard constraints
|
|
194
|
+
|
|
195
|
+
- **DO NOT modify the existing generic scenarios** (\`fix-failing-test\`, \`add-small-feature\`,
|
|
196
|
+
\`review-catches-bug\`, \`agentrig-init-on-empty-repo\`). They stay as both templates AND running scenarios.
|
|
197
|
+
- **DO NOT touch any file outside \`.agentrig/eval/scenarios/\`.**
|
|
198
|
+
- **Axis names must come from the live registry.** Valid types: ${ctx.axesAvailable.types.join(", ")}.
|
|
199
|
+
Valid axis names (use only these): ${ctx.axesAvailable.axisNames.join(", ")}.
|
|
200
|
+
- The fixture's package manager + test runner must be **the same toolchain this repo uses**.
|
|
201
|
+
Check \`AGENTS.md\` for the install/test commands.
|
|
202
|
+
- Each oracle \`cmd\` must be runnable from inside the worktree (\`cwd: worktree, shell: true\`) without
|
|
203
|
+
any \`npm install\` / \`pip install\` / equivalent first — i.e., the fixture should be self-contained
|
|
204
|
+
or rely on stdlib only. If the test command needs deps, include a tiny dependency-free alternative.
|
|
205
|
+
|
|
206
|
+
When done, summarize each new scenario id, its type, and what defect or task it exercises.`;
|
|
116
207
|
}
|
|
117
208
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAG;;;;6BAID,CAAC;AAE9B,MAAM,UAAU,sBAAsB;IACpC,OAAO;;;;;;;;;;;;;;;;;;uEAkB8D,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,QAAkB;IAClD,MAAM,YAAY,GAAG,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,iBAAiB,CAAC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AAM,YAAY,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAC1C,kBAAkB,CAAC,CAAC,EAAE,uCAAuC,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,gEAAgE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,2CAA2C,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,UAAU,CACjP,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEf,OAAO;;;;6EAIoE,GAAG,CAAC,KAAK;;;;;;EAMpF,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,gFAAgF;;;;;EAKxG,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kEAgCoD,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;uCAC7D,GAAG,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;;2FAOc,CAAC;AAC5F,CAAC"}
|
package/knowledge/PRINCIPLES.md
CHANGED
|
@@ -10,8 +10,8 @@ that lets autonomous coding agents reliably **triage → implement → review
|
|
|
10
10
|
minimal human babysitting. AgentRig installs an opinionated harness into any repo, keeps context of
|
|
11
11
|
what the repo is about, and ships a way to **evaluate the harness itself**.
|
|
12
12
|
|
|
13
|
-
Each principle below names the concrete artifact(s) AgentRig installs and how the
|
|
14
|
-
(`agentrig eval --static`)
|
|
13
|
+
Each principle below names the concrete artifact(s) AgentRig installs and how the install-completeness
|
|
14
|
+
audit and quality probes (`agentrig eval --static`) score it.
|
|
15
15
|
|
|
16
16
|
---
|
|
17
17
|
|
package/knowledge/manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "agentrig-manifest/1",
|
|
3
|
-
"knowledgeVersion": "0.
|
|
3
|
+
"knowledgeVersion": "0.5.0",
|
|
4
4
|
"description": "Declares which best-practice artifacts AgentRig installs into a target repo and where. `src` is relative to the knowledge/ root; `dest` is relative to the target repo root. `kind`: file | dir | template. Templates contain {{PLACEHOLDERS}} the agent fills from its investigation; deterministic installs substitute known values and leave the rest for the agent.",
|
|
5
5
|
"artifacts": [
|
|
6
6
|
{
|
|
@@ -119,6 +119,13 @@
|
|
|
119
119
|
"dest": ".agents/skills/self-verify",
|
|
120
120
|
"kind": "dir"
|
|
121
121
|
},
|
|
122
|
+
{
|
|
123
|
+
"id": "skill-log-gotcha",
|
|
124
|
+
"principle": 8,
|
|
125
|
+
"src": "templates/skills/log-gotcha",
|
|
126
|
+
"dest": ".agents/skills/log-gotcha",
|
|
127
|
+
"kind": "dir"
|
|
128
|
+
},
|
|
122
129
|
{
|
|
123
130
|
"id": "skill-fix-ci",
|
|
124
131
|
"principle": 4,
|
|
@@ -228,6 +235,14 @@
|
|
|
228
235
|
"dest": ".agentrig/eval/scenarios",
|
|
229
236
|
"kind": "dir"
|
|
230
237
|
},
|
|
238
|
+
{
|
|
239
|
+
"id": "eval-calibration",
|
|
240
|
+
"principle": 6,
|
|
241
|
+
"src": "templates/eval/calibration",
|
|
242
|
+
"dest": ".agentrig/eval/calibration",
|
|
243
|
+
"kind": "dir",
|
|
244
|
+
"refresh": "preserve"
|
|
245
|
+
},
|
|
231
246
|
{
|
|
232
247
|
"id": "eval-sandbox",
|
|
233
248
|
"principle": 6,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# {{REPO_NAME}} — Agent instructions
|
|
2
2
|
|
|
3
|
-
> Managed in part by [AgentRig](https://github.com/). Sections between AgentRig markers are
|
|
3
|
+
> Managed in part by [AgentRig](https://github.com/doidor/agentrig). Sections between AgentRig markers are
|
|
4
4
|
> refreshed by `agentrig update`; edit outside the markers (and the repo-specific context) freely.
|
|
5
5
|
|
|
6
6
|
## Critical Rules (read first, every time)
|
|
@@ -8,13 +8,14 @@
|
|
|
8
8
|
1. **Instructions are the source of truth, not existing code.** This repo may contain legacy
|
|
9
9
|
patterns that predate current standards. When code and these instructions disagree, follow the
|
|
10
10
|
instructions and flag the discrepancy.
|
|
11
|
-
2. **
|
|
11
|
+
2. **Log every gotcha to `.agents/wiki/` the moment you hit it — not at the end, not in passing.**
|
|
12
|
+
Every mistake is a prompt bug; the wiki is how the harness learns. If a skill or rule should
|
|
13
|
+
have prevented the gotcha, run `skill-improver` so the next agent doesn't repeat it.
|
|
14
|
+
3. **Self-verify before handoff.** Run the project's build/test/lint and the `self-verify` skill
|
|
12
15
|
before you mark work ready. Never hand a red build to a reviewer.
|
|
13
|
-
|
|
16
|
+
4. **Never skip a state-machine gate** (`.agentrig/harness/state-machine.yml`) and never apply a
|
|
14
17
|
human-only label. Low-reversibility actions are recommend-then-apply.
|
|
15
|
-
|
|
16
|
-
5. **Every mistake is a prompt bug.** When you hit a gotcha, record it in `.agents/wiki/` and, if a
|
|
17
|
-
skill or rule should have prevented it, run `skill-improver`.
|
|
18
|
+
5. **Respect hard limits** (diff size, review iterations, token cap) declared in the state machine.
|
|
18
19
|
<!-- AGENTRIG:critical-rules:end -->
|
|
19
20
|
|
|
20
21
|
## What this repository is
|
|
@@ -8,10 +8,10 @@ single-model-bias mitigation surfaces problems no single model would catch alone
|
|
|
8
8
|
|
|
9
9
|
| Role | File | Default model | Drives state |
|
|
10
10
|
|------|------|---------------|--------------|
|
|
11
|
-
| **triager** | `triager.{yml,md}` | `gpt-5
|
|
12
|
-
| **developer**| `developer.{yml,md}`| `claude-
|
|
13
|
-
| **reviewer** | `reviewer.{yml,md}` | `gpt-5` (high)
|
|
14
|
-
| **judge** | `judge.{yml,md}` | `claude-opus-4.
|
|
11
|
+
| **triager** | `triager.{yml,md}` | `gpt-5.5` (high) | `ingested → queued` |
|
|
12
|
+
| **developer**| `developer.{yml,md}`| `claude-opus-4.8` (high) | `queued → implementing → reviewing` |
|
|
13
|
+
| **reviewer** | `reviewer.{yml,md}` | `gpt-5.5` (high) | `reviewing` |
|
|
14
|
+
| **judge** | `judge.{yml,md}` | `claude-opus-4.8` (high) | `judging → ready_to_merge` |
|
|
15
15
|
|
|
16
16
|
> Keep the **reviewer on a different model family than the developer**. The audit
|
|
17
17
|
> (`agentrig eval --static`) checks for this.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Developer role (principle 2). Implements the change in the `implementing` state.
|
|
2
2
|
role: developer
|
|
3
|
-
model: claude-
|
|
3
|
+
model: claude-opus-4.8
|
|
4
4
|
model_tier: high
|
|
5
5
|
# Skills are auto-discovered from .agents/skills; no explicit list needed.
|
|
6
6
|
allowed_tools: [read, write, edit, bash, grep, glob]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Reviewer role (principle 2). Deliberately a DIFFERENT model family than the developer
|
|
2
2
|
# to mitigate single-model bias — divergent verdicts surface problems neither model alone catches.
|
|
3
3
|
role: reviewer
|
|
4
|
-
model: gpt-5
|
|
4
|
+
model: gpt-5.5
|
|
5
5
|
model_tier: high
|
|
6
6
|
allowed_tools: [read, grep, glob, bash]
|
|
7
7
|
prompt: agents/reviewer.md
|