Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 43 additions & 3 deletions src/agent/directors/greybeard/package.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,52 @@ describe("greybeardPackage", () => {
expect(p).not.toMatch(/architecture director/i);
});

test("systemPrompt teaches judgment for architecture approach", () => {
test("systemPrompt frames value as analysis via Corbits read tools", () => {
const p = greybeardPackage.systemPrompt;
expect(p).toContain("Judge the approach");
expect(p).toMatch(/value is analysis/i);
expect(p).toContain("read_file");
expect(p).toContain("grep");
expect(p).toContain("ask_director");
});

test("systemPrompt carries an ordered review checklist", () => {
const p = greybeardPackage.systemPrompt;
expect(p).toMatch(/Review checklist/);
expect(p).toMatch(/architectural claim/);
expect(p).toMatch(/constraint ownership|owns constraints/i);
expect(p).toMatch(/hold \/ revise \/ block|verdict/i);
expect(p).toMatch(/anti-patterns/);
expect(p).toMatch(/Rank risks/);
const checklistIdx = p.search(/Review checklist/);
expect(checklistIdx).toBeGreaterThan(-1);
const checklist = p.slice(checklistIdx);
const claimIdx = checklist.search(/architectural claim/);
const ownershipIdx = checklist.search(/constraint ownership|owns constraints/i);
const holesIdx = checklist.search(/anti-patterns/);
const risksIdx = checklist.search(/Rank risks/);
const verdictIdx = checklist.search(/hold \/ revise \/ block/);
expect(claimIdx).toBeGreaterThan(-1);
expect(ownershipIdx).toBeGreaterThan(claimIdx);
expect(holesIdx).toBeGreaterThan(ownershipIdx);
expect(risksIdx).toBeGreaterThan(holesIdx);
expect(verdictIdx).toBeGreaterThan(risksIdx);
});

test("systemPrompt ends the checklist with the hold/revise/block verdict triad", () => {
const p = greybeardPackage.systemPrompt;
expect(p).toMatch(/hold \/ revise \/ block/);
expect(p).toMatch(/backward-compatibility|backward compatibility/i);
const risksIdx = p.search(/Rank risks/);
const triadIdx = p.search(/hold \/ revise \/ block/);
expect(risksIdx).toBeGreaterThan(-1);
expect(triadIdx).toBeGreaterThan(risksIdx);
});

test("systemPrompt has no self-spawn language", () => {
const p = greybeardPackage.systemPrompt;
expect(p).not.toMatch(/spawn.*greybeard/i);
expect(p).not.toContain('agent="greybeard"');
expect(p).not.toMatch(/spawn yourself/i);
expect(p).not.toMatch(/spawn a (greybeard|reviewer)/i);
});

test("systemPrompt allows limited spawn without fake caps or scheduler language", () => {
Expand Down
14 changes: 11 additions & 3 deletions src/agent/directors/greybeard/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { ORCHESTRATOR_TOOLS } from "../tool-sets.js";

/**
* Greybeard nested orchestrator (CL-7019).
* Architecture judgment with limited spawn — never ships product code.
* Review checklist ported from the GaaS greybeard original (CL-7662) — the
* GaaS source was unavailable locally, so this is a Corbits-idiom restoration
* rather than a 1:1 copy. Self-read deviation: the GaaS delegate-for-review
* shape becomes read_file/grep/ask_director first, spawn only on a concrete
* unknown. Architecture judgment with limited spawn — never ships product code.
*/
export const greybeardPackage: DirectorPackage = {
id: "greybeard",
Expand All @@ -26,12 +30,16 @@ You are Greybeard — not a second Skywalker, not Critic (code defects with evid

Follow style and philosophy conventions (baked into this prompt) when reviewing plans or approaches — skills are active constraints, not background docs.

Judge the approach:
Your value is analysis, not delegation: reach the judgment yourself with
targeted reads (read_file, grep) and pointed questions (ask_director)
before considering a spawn.

Review checklist — work the list in order:
1. Name the architectural claim under review (boundary, ownership, invariant, or BC surface).
2. Decide whether the proposed approach owns constraints at the right layer — or only chases symptoms.
3. Call out holes, anti-patterns, missing invariants, product/architecture/implementation misalignment, and duplication that should be refactor or API expansion instead.
4. Rank risks for long-term maintainability and backward compatibility.
5. Report a clear verdict: hold / revise / block — with the why, not a checklist theater.
5. Report a clear verdict: hold / revise / block — with the why, not checklist theater.

Spawn only when a concrete unknown blocks that judgment. Package spawn rules allow intern (mechanical shell), explorer (map/read), and critic (code evidence). When spawning critic, pass non-empty success_criteria (runtime fail-closes without it). intern and explorer remain optional. Prefer doing the review yourself with mounted read/search tools. Do not invent numeric spawn caps or act as a scheduler — width follows the unknown, not a soft ladder. Nested orchestrators collect with wait_agents — mailbox mail is the primary parent path.

Expand Down
Loading