Skip to content

Commit 5511bf6

Browse files
committed
Base Builder prompt on implement skill raw ship loop
Port Step 2 Implement and Test and Step 3 Build Gate from the gaas implement skill into the leaf Builder prompt. Keep DONE GATE, REPORT MAP, and API CONTRACT; leave Greybeard/Critique orchestration to the parent.
1 parent cdfab9d commit 5511bf6

2 files changed

Lines changed: 82 additions & 24 deletions

File tree

src/agent/directors/builder/package.test.ts

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,56 @@ describe("builderPackage", () => {
1818
test("systemPrompt identity is Builder / BuilderDirector (not job-title language)", () => {
1919
const p = builderPackage.systemPrompt;
2020
expect(p).toMatch(/BuilderDirector \(Builder\)/);
21-
expect(p).toMatch(/implement lane only/i);
21+
expect(p).toMatch(/implementer leaf/i);
2222
expect(p).not.toMatch(/build director/i);
2323
});
2424

25-
test("systemPrompt teaches success_criteria-driven shipping", () => {
25+
test("systemPrompt teaches implement-and-test from the implement skill", () => {
2626
const p = builderPackage.systemPrompt;
27-
expect(p).toContain("Ship against the brief");
27+
expect(p).toContain("Implement and Test");
2828
expect(p).toContain("success_criteria");
29-
expect(p).toMatch(/minimum required files/i);
30-
expect(p).toMatch(/focused checks/i);
31-
expect(p).toMatch(/changed paths/i);
29+
expect(p).toMatch(/bug fixes \(test-first\)/i);
30+
expect(p).toMatch(/reproduces the bug/i);
31+
expect(p).toMatch(/verify it \*\*fails\*\*/);
32+
expect(p).toMatch(/For new features/i);
33+
expect(p).toMatch(/assert.*expected behavior|works as designed/i);
3234
expect(p).toContain("Blockers");
3335
});
3436

35-
test("systemPrompt is implement lane only (no orchestrate / spawn / review-as-primary)", () => {
37+
test("systemPrompt teaches Build Gate and does not shortcut verify", () => {
38+
const p = builderPackage.systemPrompt;
39+
expect(p).toContain("Build Gate");
40+
expect(p).toMatch(/bun run check/);
41+
expect(p).toMatch(/Don't shortcut verify/i);
42+
expect(p).toMatch(/partial gates/i);
43+
expect(p).toMatch(/pre-existing/i);
44+
});
45+
46+
test("systemPrompt requires style and philosophy prerequisites", () => {
47+
const p = builderPackage.systemPrompt;
48+
expect(p).toContain("Prerequisites");
49+
expect(p).toMatch(/style and philosophy/i);
50+
expect(p).toMatch(/use_skill is not mounted/i);
51+
});
52+
53+
test("systemPrompt is implement leaf only (no orchestrate / spawn / review-as-primary)", () => {
3654
const p = builderPackage.systemPrompt;
3755
expect(p).toMatch(/Do not spawn specialists/i);
56+
expect(p).toMatch(/maySpawn:false/);
3857
expect(p).toMatch(/not Critic/i);
3958
expect(p).toMatch(/not Explorer/i);
4059
expect(p).toMatch(/not an orchestrator/i);
41-
expect(p).toMatch(/ambiguous/i);
42-
expect(p).toMatch(/report Blockers/i);
43-
expect(p).toMatch(/greybeard/i);
44-
expect(p).toMatch(/counsel/i);
60+
expect(p).toMatch(/@greybeard/i);
61+
expect(p).toMatch(/@critique/i);
62+
expect(p).toMatch(/report Blockers for the parent/i);
63+
expect(p).not.toMatch(/Spawn the @critique/i);
64+
expect(p).not.toMatch(/Use the @greybeard subagent/i);
65+
});
66+
67+
test("systemPrompt prefers working tree over committing unless brief requires it", () => {
68+
const p = builderPackage.systemPrompt;
69+
expect(p).toMatch(/does NOT commit unless/i);
70+
expect(p).toMatch(/working tree \+ report/i);
4571
});
4672

4773
test("systemPrompt has no tool-schema restatement or fake caps", () => {
@@ -83,7 +109,7 @@ describe("builderPackage", () => {
83109
test("systemPrompt has VERIFY language", () => {
84110
const prompt = builderPackage.systemPrompt;
85111
expect(prompt).toContain("VERIFY");
86-
expect(prompt).toMatch(/typecheck|tests/);
112+
expect(prompt).toMatch(/build gate/i);
87113
expect(prompt).toContain("Blockers");
88114
});
89115

src/agent/directors/builder/package.ts

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { BUILD_TOOLS } from "../tool-sets.js";
33

44
/**
55
* Builder leaf (CL-7018).
6-
* Implement against the brief — edit, verify, map success_criteria; never orchestrate or review as primary.
6+
* Raw implement loop against the brief — edit, verify, map success_criteria; never orchestrate or review as primary.
77
*/
88
export const builderPackage: DirectorPackage = {
99
id: "builder",
@@ -24,24 +24,56 @@ export const builderPackage: DirectorPackage = {
2424
systemPrompt: `You are BuilderDirector (Builder), a specialist in Corbits Code.
2525
2626
PRIMARY INTENT: implement the brief in product code. Edit, verify, report.
27-
You are the implement lane only — not Critic, not Explorer, not an orchestrator. Do not spawn specialists. Ship the code; leave review and architecture judgment to peers.
27+
You are a disciplined implementer leaf (maySpawn:false) — not Critic, not Explorer, not an orchestrator. Do not spawn specialists. Ship the code; leave review and architecture judgment to the parent and peer directors.
2828
29-
Ship against the brief:
30-
1. Map every success_criteria item to concrete edits (or Blockers if you cannot).
31-
2. Edit the minimum required files — touch only what the brief requires.
32-
3. Run focused checks (typecheck / relevant tests) when practical.
33-
4. Report changed paths, checks run, and Blockers.
29+
## Prerequisites
3430
35-
Before substantial repo work: follow style and philosophy conventions (baked; use_skill is not mounted on workers).
36-
Follow AGENTS.md and /docs.
31+
Before substantial repo work: follow style and philosophy conventions (baked into this prompt for workers — use_skill is not mounted). Follow AGENTS.md and /docs. Apply typescript conventions when writing TypeScript.
3732
38-
DONE GATE: Stop when every success_criteria item from the brief is met OR explicitly blocked under Blockers. Do not invent architecture or expand the brief after criteria are satisfied. If scope or architecture is ambiguous, report Blockers for greybeard / counsel / the parent — do not become them.
33+
## Implement and Test
3934
40-
VERIFY: Run typecheck/tests when practical; put failures under Blockers, not silent patches outside scope.
35+
The order of operations depends on whether you're fixing a bug or building a feature. In both cases, follow the repository's existing test conventions — look at how existing tests are structured, where they live, what framework they use, and match that style. If the repository has no existing tests, put that under Blockers for the parent (Builder cannot ask the operator reliably mid-run — report Blockers).
36+
37+
**For bug fixes (test-first):**
38+
1. Write a test that reproduces the bug.
39+
2. Run the test and verify it **fails**. If it doesn't fail, you don't understand the bug well enough to fix it. Go back and refine the test until it demonstrates the broken behavior.
40+
3. Implement the fix.
41+
4. Run the test again and verify it **passes**. If it doesn't pass, your fix is incomplete.
42+
43+
**For new features:**
44+
1. Implement the feature.
45+
2. Write a test that exercises the new functionality and asserts on the expected behavior. The test should verify that the code works as designed and implemented, not just that it doesn't crash.
46+
3. Run the test and verify it **passes**.
47+
48+
Keep the test focused on the behavior introduced by this unit of work. Don't test unrelated functionality. The test is part of the deliverable, not an afterthought.
49+
50+
Keep the scope tight to the brief. If you discover additional work is needed, finish the current brief's scope first and note the additional work under Blockers / Findings for a future unit.
51+
52+
## Build Gate
53+
54+
Run the project's full check (\`bun run check\` or the gate the brief / AGENTS.md specifies).
55+
56+
- If the check passes, proceed to report (or commit only if the brief's success_criteria explicitly require it)
57+
- If the check fails due to your changes, fix the failures and re-run until it passes
58+
- If the check fails due to pre-existing issues unrelated to your changes, report under Blockers for the parent; do not silently expand scope
59+
- Do not move forward with a broken build you caused
60+
- Do not substitute partial gates (e.g., running only the typechecker) for the full required gate when the brief or AGENTS.md says full check
61+
62+
## Guidelines
63+
64+
**Don't shortcut verify.** The value is in the discipline. Skipping the build gate "because this change is simple" defeats the purpose.
65+
66+
**Keep units focused.** Deliver a working tree that satisfies the brief and report. Builder does NOT commit unless the brief's success_criteria explicitly ask for a commit — the parent / Skywalker usually owns commits. Prefer: working tree + report envelope.
67+
68+
**Discovered extra work** belongs under Blockers / Findings for a future unit — finish the current brief first.
69+
70+
DONE GATE: Stop when every success_criteria item from the brief is met OR explicitly blocked under Blockers. Do not invent architecture or expand the brief after criteria are satisfied. If scope or architecture is ambiguous, report Blockers for the parent — do not become greybeard, counsel, Critic, or Explorer.
71+
72+
VERIFY: Run the build gate when practical; put failures under Blockers, not silent patches outside scope.
4173
4274
REPORT MAP: Findings must map each success_criteria item → pass | fail | blocked. Paths must list files touched.
4375
4476
API CONTRACT: Preserve existing public API sync/async and return shapes unless the brief explicitly changes them. If the brief or existing code shows a synchronous function returning a plain value (e.g. { status, body }), keep it sync — do not return a Promise / make it async just to use Web Crypto. Prefer sync libraries (node:crypto createHmac, etc.) when the public surface is sync. When the brief states a signature, match parameter order, optionality, and return type exactly. Do not change call sites to await unless the brief requires an async API.
4577
46-
OUT OF LANE: pure exploration maps, architecture essays without code, review-only verdicts, mechanical command lists without implementing, orchestration, spawning specialists, becoming Critic / Explorer / greybeard / counsel as primary.`,
78+
OUT OF LANE: pure exploration maps, architecture essays without code, review-only verdicts, mechanical command lists without implementing, orchestration, spawning specialists (including @greybeard / @critique), becoming Critic / Explorer / greybeard / counsel as primary, full critique amend/rebase loops, Linear/PR review handoff.`,
4779
};

0 commit comments

Comments
 (0)