|
1 | | -/** |
2 | | - * Reviewer worker: code defect review + verify-by-temporary-test workflow. |
3 | | - * Finds defects with reproducible evidence, validates hypotheses with temp tests, |
4 | | - * and checks API contracts and hygiene without modifying product code. |
5 | | - * |
6 | | - * Ships as the @corbits/code-agent-reviewer workspace package: the tool allowlist |
7 | | - * lives here so the package stays importable without the app. Drift against |
8 | | - * the app build surface fails src/agent/directors/reviewer/package.test.ts. |
9 | | - */ |
10 | | -export type AgentPackage = { |
11 | | - readonly id: "reviewer"; |
12 | | - readonly primaryIntent: string; |
13 | | - readonly outOfLane: readonly string[]; |
14 | | - readonly description: string; |
15 | | - readonly systemPrompt: string; |
16 | | - /** Unset — reviewer never attaches skill bodies at spawn. */ |
17 | | - readonly attachedSkills?: readonly string[]; |
18 | | - /** Unset — reviewer declares no skill scope. */ |
19 | | - readonly optionalSkills?: readonly string[]; |
20 | | - readonly tools: { |
21 | | - readonly allow: readonly string[]; |
22 | | - }; |
23 | | - readonly spawn: { |
24 | | - readonly maySpawn: false; |
25 | | - }; |
26 | | - readonly modelRole: "review"; |
27 | | - readonly tier: "leaf"; |
28 | | -}; |
29 | | - |
30 | | -const REVIEWER_TOOLS = [ |
31 | | - "read_file", |
32 | | - "grep", |
33 | | - "search_files", |
34 | | - "list_dir", |
35 | | - "lsp", |
36 | | - "run_shell", |
37 | | - "web_fetch", |
38 | | - "web_search", |
39 | | - "skill_search", |
40 | | - "use_skill", |
41 | | - "write_file", |
42 | | - "edit_file", |
43 | | - "delete_file", |
44 | | -] as const; |
45 | | - |
46 | | -export const reviewerPackage: AgentPackage = { |
47 | | - id: "reviewer", |
48 | | - primaryIntent: |
49 | | - "Evidence-based code defect review and verification via temporary reproduction tests; never fix product code", |
50 | | - outOfLane: [ |
51 | | - "implementing product fixes", |
52 | | - "architecture essays without concrete evidence", |
53 | | - "speculative or low-confidence nitpicking", |
54 | | - "visual styling or DESIGN.md ownership", |
55 | | - "orchestrating or spawning other agents", |
56 | | - ], |
57 | | - description: |
58 | | - "Code quality and defect reviewer — evidence-based findings with temp test verification", |
59 | | - systemPrompt: `You are ReviewerDirector (Reviewer), a specialist in Corbits Code. |
60 | | -
|
61 | | -PRIMARY INTENT: evidence-based code review and defect verification. Find defects with evidence; verify suspected bugs with temporary tests; never fix product code. Cite path, line or symbol, what breaks, and the concrete input or sequence that triggers the failure. |
62 | | -
|
63 | | -You are the review lane only — not Coder, not Explorer, not an orchestrator. Do not ship product fixes. |
64 | | -
|
65 | | -Evidence & confidence rules: |
66 | | -- Every finding requires: path + line/symbol + reproduction shape (trigger input, failure sequence, unhandled branch). |
67 | | -- Confidence levels: VERIFIED (proven by temporary test or live command), HIGH (strong logical evidence but untestable in sandbox), MEDIUM (plausible issue under realistic conditions). Discard LOW-confidence speculations — they are noise. |
68 | | -- Severity ranking: blocking (breaks contract, regresses behavior, fails gate), should-fix (subtle defect, hygiene hazard, leak), file-for-later (minor nit, pre-existing cleanup). |
69 | | -
|
70 | | -Verify by temporary test: |
71 | | -- Hypotheses need evidence, not vibes: explicitly state suspected defect before testing. |
72 | | -- Write focused temporary reproduction tests under \`tmp/critique-tests/\` using the repo's existing framework and run them. |
73 | | -- If a temporary test passes (disproving the defect hypothesis), discard the finding. |
74 | | -- If a temporary test fails (confirming the defect), record it as VERIFIED. Clean up temporary test files before completing. |
75 | | -- Recommend permanent regression tests that Coder should land. |
76 | | -
|
77 | | -API contract check: |
78 | | -- Compare public exports against existing call sites and the brief. |
79 | | -- Sync/async mismatch (e.g. returning Promise when callers expect sync) is a blocking defect. |
80 | | -- Signature parameter order, nullability, and return-type drift are blocking defects. |
81 | | -
|
82 | | -Report envelope: |
83 | | -- Use Summary / Findings / Blockers / Paths. |
84 | | -- Findings must list each confirmed issue with Severity, Confidence, Location, Reproduction, and Impact. |
85 | | -- Report "This diff is genuinely clean" when no actionable defects exist. |
86 | | -
|
87 | | -OUT OF LANE: implementing product fixes (route to coder), visual styling / DESIGN.md (route to designer), fleet orchestration or spawning.`, |
88 | | - tools: { allow: [...REVIEWER_TOOLS] }, |
89 | | - spawn: { maySpawn: false }, |
90 | | - tier: "leaf", |
91 | | - modelRole: "review", |
92 | | -}; |
| 1 | +export { agent, defineAgent } from "./agent.js"; |
| 2 | +export { director } from "./director.js"; |
| 3 | +export { tools } from "./toolset.js"; |
| 4 | +export { systemPrompt } from "./prompt.js"; |
| 5 | +export { config } from "./config.js"; |
| 6 | +// No workflow export. The package's `director` structurally satisfies the |
| 7 | +// app's DirectorPackage (app-side drift-guard asserts it). No type re-export |
| 8 | +// to any Corbits shared package. |
0 commit comments