Skip to content

Commit f21f7b7

Browse files
committed
feat(reviewer): ship reviewer as a workspace agent package
1 parent 125d846 commit f21f7b7

13 files changed

Lines changed: 192 additions & 30 deletions

File tree

‎agents/reviewer/README.md‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# @corbits/code-agent-reviewer
2+
3+
## What this is
4+
5+
Ready `@corbits/code-agent-reviewer` agent + independently importable components:
6+
`agent`, `defineAgent`, `director`, `tools`, `systemPrompt`, `config`.
7+
8+
## Consume (runLocal)
9+
10+
```ts
11+
import { agent } from "@corbits/code-agent-reviewer";
12+
const run = runLocal(defining(agent), env);
13+
```
14+
15+
## Consume (deploy runWorkflow / hub / sidecar)
16+
17+
Hand the same `AgentDefinition` to a workflow — the package never exports a
18+
workflow itself.
19+
20+
## Remix components
21+
22+
```ts
23+
import { director, tools, systemPrompt, config } from "@corbits/code-agent-reviewer";
24+
defineAgent({ director, ... }); // or swap tools / systemPrompt / config
25+
```
26+
27+
Each of `director`, `tools`, `systemPrompt`, and `config` is a named,
28+
independently importable part.
29+
30+
## Single authority
31+
32+
`prompt.ts` `systemPrompt.build()` is byte-stable (the raw card, no formatting).
33+
`toolset.ts` `tools` literal equals the `REVIEW_TOOLS` surface constant in
34+
`src/agent/directors/tool-sets.ts`; drift is enforced by the in-tree drift-guard
35+
`src/agent/directors/reviewer/package.test.ts`.

‎agents/reviewer/package.json‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "@corbits/code-agent-reviewer",
3+
"version": "0.1.0",
4+
"private": true,
5+
"type": "module",
6+
"license": "SEE LICENSE IN LICENSE.md",
7+
"exports": {
8+
".": {
9+
"types": "./src/index.ts",
10+
"default": "./src/index.ts"
11+
}
12+
}
13+
}

‎agents/reviewer/src/agent.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import {
2+
defineAgent as coreDefineAgent,
3+
type AgentDefinition,
4+
} from "@intx/agent";
5+
import { systemPrompt } from "./prompt.js";
6+
7+
export const agent: AgentDefinition = defineAgent();
8+
9+
export function defineAgent(): AgentDefinition {
10+
return coreDefineAgent({
11+
id: "reviewer",
12+
systemPrompt: systemPrompt.build(),
13+
tools: [], // tool mounting is consumer/app-side; surface enforced by drift-guard
14+
capabilities: [],
15+
inference: { sources: [] },
16+
});
17+
}

‎agents/reviewer/src/config.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export const config = {
2+
spawn: { maySpawn: false },
3+
tier: "leaf",
4+
modelRole: "review",
5+
} as const satisfies {
6+
spawn: { maySpawn: boolean };
7+
tier: string;
8+
modelRole: string;
9+
};

‎agents/reviewer/src/director.ts‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { tools } from "./toolset.js";
2+
import { systemPrompt } from "./prompt.js";
3+
import { config } from "./config.js";
4+
5+
export const director = {
6+
id: "reviewer",
7+
primaryIntent:
8+
"Evidence-based code defect review and verification via temporary reproduction tests; never fix product code",
9+
outOfLane: [
10+
"implementing product fixes",
11+
"architecture essays without concrete evidence",
12+
"speculative or low-confidence nitpicking",
13+
"visual styling or DESIGN.md ownership",
14+
"orchestrating or spawning other agents",
15+
],
16+
description:
17+
"Code quality and defect reviewer — evidence-based findings with temp test verification",
18+
systemPrompt: systemPrompt.build(),
19+
tools: { allow: [...tools] },
20+
spawn: config.spawn,
21+
tier: config.tier,
22+
modelRole: config.modelRole,
23+
} as const;

‎agents/reviewer/src/index.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
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";
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,7 @@
1-
import type { DirectorPackage } from "../types.js";
2-
import { BUILD_TOOLS } from "../tool-sets.js";
3-
4-
/**
5-
* Reviewer worker: code defect review + verify-by-temporary-test workflow.
6-
* Finds defects with reproducible evidence, validates hypotheses with temp tests,
7-
* and checks API contracts and hygiene without modifying product code.
8-
*/
9-
export const reviewerPackage: DirectorPackage = {
10-
id: "reviewer",
11-
primaryIntent:
12-
"Evidence-based code defect review and verification via temporary reproduction tests; never fix product code",
13-
outOfLane: [
14-
"implementing product fixes",
15-
"architecture essays without concrete evidence",
16-
"speculative or low-confidence nitpicking",
17-
"visual styling or DESIGN.md ownership",
18-
"orchestrating or spawning other agents",
19-
],
20-
description:
21-
"Code quality and defect reviewer — evidence-based findings with temp test verification",
22-
tools: { allow: BUILD_TOOLS },
23-
spawn: { maySpawn: false },
24-
tier: "leaf",
25-
modelRole: "review",
26-
systemPrompt: `You are ReviewerDirector (Reviewer), a specialist in Corbits Code.
1+
// Reviewer raw director card. Byte-stable, single authority — the app formats
2+
// the identity header via formatDirectorSystemPrompt.
3+
4+
const CARD = `You are ReviewerDirector (Reviewer), a specialist in Corbits Code.
275
286
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.
297
@@ -51,5 +29,10 @@ Report envelope:
5129
- Findings must list each confirmed issue with Severity, Confidence, Location, Reproduction, and Impact.
5230
- Report "This diff is genuinely clean" when no actionable defects exist.
5331
54-
OUT OF LANE: implementing product fixes (route to coder), visual styling / DESIGN.md (route to designer), fleet orchestration or spawning.`,
32+
OUT OF LANE: implementing product fixes (route to coder), visual styling / DESIGN.md (route to designer), fleet orchestration or spawning.`;
33+
34+
// Byte-stable (see prompt authority test).
35+
export const systemPrompt = {
36+
theme: "reviewer",
37+
build: (): string => CARD,
5538
};

‎agents/reviewer/src/toolset.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// REVIEWER_TOOLS literal; drift-guarded against src/agent/directors/tool-sets.ts.
2+
3+
export const tools: readonly string[] = [
4+
"read_file",
5+
"grep",
6+
"search_files",
7+
"list_dir",
8+
"lsp",
9+
"run_shell",
10+
"web_fetch",
11+
"web_search",
12+
"skill_search",
13+
"use_skill",
14+
"write_file",
15+
"edit_file",
16+
"delete_file",
17+
] as const;

‎agents/reviewer/tsconfig.json‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../tsconfig.base.json",
3+
"compilerOptions": {
4+
"noEmit": true
5+
},
6+
"include": ["src/**/*.ts"]
7+
}

‎bun.lock‎

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)