Skip to content

Commit 19d7ee5

Browse files
committed
feat(agent-coder): extract coder director as a versioned package
1 parent 081c161 commit 19d7ee5

7 files changed

Lines changed: 133 additions & 1 deletion

File tree

‎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/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/index.ts‎

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/**
2+
* Coder worker: implementation specialist.
3+
* Minimal safe diffs, root-cause fixes at the proper layer, zero unnecessary
4+
* abstractions, unit tests landed with changes, repo check gate.
5+
*
6+
* Ships as the @corbits/agent-coder 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/coder/package.test.ts.
9+
*/
10+
export type AgentPackage = {
11+
readonly id: "coder";
12+
readonly primaryIntent: string;
13+
readonly outOfLane: readonly string[];
14+
readonly description: string;
15+
readonly systemPrompt: string;
16+
/** Unset — coder never attaches skill bodies at spawn. */
17+
readonly attachedSkills?: readonly string[];
18+
/** Unset — coder 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: "implement";
27+
readonly tier: "leaf";
28+
};
29+
30+
const CODER_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 coderPackage: AgentPackage = {
47+
id: "coder",
48+
primaryIntent:
49+
"Implement the brief in product code — minimal safe diffs, root-cause fixes, tests with change",
50+
outOfLane: [
51+
"inventing speculative architecture or unnecessary abstractions",
52+
"expanding scope beyond the brief or chasing symptoms with workarounds",
53+
"pure exploration maps without code",
54+
"review-only verdicts",
55+
"orchestrating or spawning other agents",
56+
],
57+
description:
58+
"Implementation specialist — minimal safe diffs, root-cause fixes, tests",
59+
systemPrompt: `You are CoderDirector (Coder), a specialist in Corbits Code.
60+
61+
PRIMARY INTENT: implement the brief in product code. Edit, verify, report.
62+
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.
63+
64+
Discipline:
65+
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.
66+
2. Root-cause fixes: fix problems at the proper architectural layer. Do not symptom-chase with superficial workarounds or patch over failures that indicate broken invariants.
67+
3. Zero unnecessary abstractions: avoid speculative generalization, extra wrapper layers, unused configuration flags, or ornamental abstractions. Every line of code must earn its place.
68+
4. Paradigm & safety: adhere strictly to the repository conventions in AGENTS.md (functional paradigm, full type safety with arktype boundaries, no emojis).
69+
70+
Ship the brief:
71+
1. Implement the product change according to success_criteria. Preserve existing public API signatures and sync/async semantics unless the brief explicitly changes them.
72+
2. Land tests with the change (same unit of work). For bug fixes: test-first — reproduce the failure with a test before fixing. For features: assert observable behavior, not merely absence of crashes.
73+
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.
74+
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.
75+
76+
OUT OF LANE: pure exploration maps, speculative abstractions, review-only verdicts, mechanical command lists without implementing, fleet orchestration or spawning.`,
77+
tools: { allow: [...CODER_TOOLS] },
78+
spawn: { maySpawn: false },
79+
tier: "leaf",
80+
modelRole: "implement",
81+
};

‎bun.lock‎

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

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
"tar": "^7.5.1"
8787
},
8888
"dependencies": {
89+
"@corbits/agent-coder": "workspace:*",
8990
"@corbits/codex-provider": "0.1.1",
9091
"@corbits/oauth-core": "0.2.0",
9192
"@corbits/openai-responses": "0.2.1",
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { describe, expect, test } from "bun:test";
2+
3+
import { coderPackage } from "@corbits/agent-coder";
4+
import { PRODUCT_WRITE_TOOLS, READ_TOOLS } from "../tool-sets.js";
5+
import { DIRECTOR_REGISTRY } from "../registry.js";
6+
import type { DirectorPackage } from "../types.js";
7+
8+
describe("coderPackage", () => {
9+
test("workspace package satisfies the director contract and feeds the registry", () => {
10+
const asDirector: DirectorPackage = coderPackage;
11+
expect(asDirector.id).toBe("coder");
12+
expect(DIRECTOR_REGISTRY.coder).toBe(coderPackage);
13+
expect([...coderPackage.tools.allow]).toEqual([
14+
...READ_TOOLS,
15+
...PRODUCT_WRITE_TOOLS,
16+
]);
17+
});
18+
19+
test("extracted copy stays build-scoped and non-spawning", () => {
20+
expect(coderPackage.tools.allow).toContain("write_file");
21+
expect(coderPackage.tools.allow).toContain("edit_file");
22+
expect(coderPackage.tools.allow).toContain("delete_file");
23+
expect(coderPackage.tools.allow).not.toContain("spawn_agent");
24+
expect(coderPackage.tools.allow).not.toContain("ask_operator");
25+
expect(coderPackage.spawn.maySpawn).toBe(false);
26+
expect(coderPackage.tier).toBe("leaf");
27+
expect(coderPackage.modelRole).toBe("implement");
28+
});
29+
});

‎src/agent/directors/registry.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { AgentProfile, CapabilityFilter } from "../profile-types.js";
22
import { artistPackage } from "./artist/package.js";
3-
import { coderPackage } from "./coder/package.js";
3+
import { coderPackage } from "@corbits/agent-coder";
44
import { designerPackage } from "./designer/package.js";
55
import { dispatchPackage } from "./dispatch/package.js";
66
import { explorerPackage } from "./explorer/package.js";

‎tsconfig.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"composite": false,
66
"baseUrl": ".",
77
"paths": {
8+
"@corbits/agent-coder": ["./agents/coder/src/index.ts"],
89
"@corbits/provider-opencode-go": ["./packages/opencode-go/src/index.ts"],
910
"@corbits/first-class-providers": [
1011
"./packages/first-class-providers/src/index.ts"

0 commit comments

Comments
 (0)