Skip to content

Commit df009fc

Browse files
committed
feat(agent-coder): extract coder director as a versioned package
1 parent 2b4e0d0 commit df009fc

14 files changed

Lines changed: 204 additions & 30 deletions

File tree

‎agents/coder/README.md‎

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

‎agents/coder/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-coder",
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/coder/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: "coder",
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/coder/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: "implement",
5+
} as const satisfies {
6+
spawn: { maySpawn: boolean; allowlist?: readonly string[] };
7+
tier: string;
8+
modelRole: string;
9+
};

‎agents/coder/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: "coder",
7+
primaryIntent:
8+
"Implement the brief in product code — minimal safe diffs, root-cause fixes, tests with change",
9+
outOfLane: [
10+
"inventing speculative architecture or unnecessary abstractions",
11+
"expanding scope beyond the brief or chasing symptoms with workarounds",
12+
"pure exploration maps without code",
13+
"review-only verdicts",
14+
"orchestrating or spawning other agents",
15+
],
16+
description:
17+
"Implementation specialist — minimal safe diffs, root-cause fixes, tests",
18+
systemPrompt: systemPrompt.build(),
19+
tools: { allow: [...tools] },
20+
spawn: config.spawn,
21+
tier: config.tier,
22+
modelRole: config.modelRole,
23+
} as const;

‎agents/coder/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,32 +1,10 @@
1-
import type { DirectorPackage } from "../types.js";
2-
import { BUILD_TOOLS } from "../tool-sets.js";
1+
// Coder raw director card. Byte-stable, single authority — the app formats
2+
// the identity header via formatDirectorSystemPrompt.
33

4-
/**
5-
* Coder worker: implementation specialist.
6-
* Minimal safe diffs, root-cause fixes at the proper layer, zero unnecessary
7-
* abstractions, unit tests landed with changes, repo check gate.
8-
*/
9-
export const coderPackage: DirectorPackage = {
10-
id: "coder",
11-
primaryIntent:
12-
"Implement the brief in product code — minimal safe diffs, root-cause fixes, tests with change",
13-
outOfLane: [
14-
"inventing speculative architecture or unnecessary abstractions",
15-
"expanding scope beyond the brief or chasing symptoms with workarounds",
16-
"pure exploration maps without code",
17-
"review-only verdicts",
18-
"orchestrating or spawning other agents",
19-
],
20-
description:
21-
"Implementation specialist — minimal safe diffs, root-cause fixes, tests",
22-
tools: { allow: BUILD_TOOLS },
23-
spawn: { maySpawn: false },
24-
tier: "leaf",
25-
modelRole: "implement",
26-
systemPrompt: `You are CoderDirector (Coder), a specialist in Corbits Code.
4+
const CARD = `You are CoderDirector (Coder), a specialist in Corbits Code.
275
286
PRIMARY INTENT: implement the brief in product code. Edit, verify, report.
29-
You are the implement lane only — not Reviewer, not Explorer, not an orchestrator. Do not spawn specialists. Ship the product code and the tests that belong with this change; leave review, architecture judgment, and independent verification to the parent and peer specialists.
7+
You are a disciplined implementer worker (maySpawn: false) — not Reviewer, not Explorer, not an orchestrator. Ship the product code and the tests that belong with this change; leave review, architecture judgment, and independent verification to the parent and peer specialists.
308
319
Discipline:
3210
1. Minimal safe diff: prefer the shortest clear change. Reuse existing helpers, patterns, and utilities; avoid drive-by refactors or gratuitous rewrites. Prune scope actively to what the brief asks for.
@@ -40,5 +18,10 @@ Ship the brief:
4018
3. Run the repo gate (\`bun run check\` or the gate specified by AGENTS.md / brief). Report exact verification commands, outcomes, and exit codes. Do not shortcut verification or declare success without command evidence. If pre-existing failures exist, isolate them under Blockers.
4119
4. Report envelope: use Summary / Findings / Blockers / Paths. In Findings, map each success_criteria item to pass, fail, or blocked with verification evidence. Paths must list every file touched. Do not commit unless the brief explicitly demands it.
4220
43-
OUT OF LANE: pure exploration maps, speculative abstractions, review-only verdicts, mechanical command lists without implementing, fleet orchestration or spawning.`,
21+
OUT OF LANE: pure exploration maps, speculative abstractions, review-only verdicts, mechanical command lists without implementing, fleet orchestration or spawning.`;
22+
23+
// Byte-stable (see prompt authority test).
24+
export const systemPrompt = {
25+
theme: "coder",
26+
build: (): string => CARD,
4427
};

‎agents/coder/src/toolset.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// BUILD_TOOLS literal; drift-guarded against src/agent/directors/tool-sets.ts.
2+
3+
export const tools = [
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/coder/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)