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
50 changes: 47 additions & 3 deletions src/agent/directors/explore/package.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,53 @@ describe("explorePackage", () => {

test("systemPrompt states PRIMARY INTENT", () => {
expect(explorePackage.systemPrompt).toMatch(/PRIMARY INTENT/i);
expect(explorePackage.systemPrompt).toContain(
"naming the right director: build, plan, critique, greybeard, intern",
);
expect(explorePackage.systemPrompt).toMatch(/map and read/i);
});

test("systemPrompt identity is Explorer / ExplorerDirector (not job-title language)", () => {
const p = explorePackage.systemPrompt;
expect(p).toMatch(/ExplorerDirector \(Explorer\)/);
expect(p).toMatch(/explore lane only/i);
expect(p).not.toMatch(/ExploreDirector(?! \(Explorer\))/);
expect(p).not.toMatch(/explore director/i);
});

test("systemPrompt teaches success_criteria-driven mapping", () => {
const p = explorePackage.systemPrompt;
expect(p).toContain("Map against the brief");
expect(p).toContain("success_criteria");
expect(p).toMatch(/scannable map/i);
expect(p).toMatch(/Paths read/i);
expect(p).toContain("Blockers");
});

test("systemPrompt is explore lane only (map/read; no implement / spawn / fleet discovery)", () => {
const p = explorePackage.systemPrompt;
expect(p).toMatch(/Do not spawn specialists/i);
expect(p).toMatch(/not Builder/i);
expect(p).toMatch(/not Critic/i);
expect(p).toMatch(/not an orchestrator/i);
expect(p).toMatch(/Blinders on/i);
expect(p).toMatch(/fleet/i);
expect(p).toMatch(/report Blockers/i);
});

test("systemPrompt has no tool-schema restatement or fake caps", () => {
const p = explorePackage.systemPrompt;
expect(p).not.toMatch(/parameters?:/i);
expect(p).not.toMatch(/fan-out/i);
expect(p).not.toMatch(/at most \d+/i);
expect(p).not.toMatch(/turn budget/i);
expect(p).not.toMatch(/scheduler/i);
expect(p).not.toMatch(/grep\/search_files\/lsp/i);
expect(p).not.toMatch(/Shell find/i);
});

test("systemPrompt has DONE GATE for success_criteria", () => {
const prompt = explorePackage.systemPrompt;
expect(prompt).toContain("DONE GATE");
expect(prompt).toContain("success_criteria");
expect(prompt).toMatch(/[Ss]top when/);
});

test("systemPrompt has finish bias against re-reading the same paths", () => {
Expand Down
21 changes: 16 additions & 5 deletions src/agent/directors/explore/package.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import type { DirectorPackage } from "../types.js";
import { READ_TOOLS } from "../tool-sets.js";

/**
* Explorer leaf (CL-7020).
* Map/read against the brief — scannable findings only; never implement, review, or discover the fleet.
*/
export const explorePackage: DirectorPackage = {
id: "explore",
primaryIntent: "Map and read the codebase; no product edits",
Expand All @@ -11,17 +15,24 @@ export const explorePackage: DirectorPackage = {
"review severity theater",
],
description: "Read-only exploration leaf",
systemPrompt: `You are ExploreDirector, a specialist in Corbits Code.
systemPrompt: `You are ExplorerDirector (Explorer), a specialist in Corbits Code.

PRIMARY INTENT: explore and map the codebase to answer the brief. Read, search, lsp. Do not implement product changes.
PRIMARY INTENT: map and read the codebase to answer the brief. Read, search, report. Do not implement product changes.
You are the explore lane only — not Builder, not Critic, not an orchestrator. Do not spawn specialists. Blinders on: do not discover or enumerate the fleet; stay inside the brief's question.

Prefer grep/search_files/lsp over shell walks. Shell find/rg -r are blocked by harness — do not work around.
Map against the brief:
1. Map every success_criteria item to facts you will gather (or Blockers if you cannot).
2. Read and search only what the brief requires — cite paths, symbols, call flow / ownership.
3. Prefer one thorough pass; expand Findings or change approach rather than re-reading the same paths.
4. Report a scannable map, Paths read, and Blockers.

FINISH BIAS: Prefer one thorough pass then report. Expand Findings, change approach, or write the final report — do not keep re-reading the same paths.
DONE GATE: Stop when every success_criteria item from the brief is answered OR explicitly blocked under Blockers. Do not invent architecture, ship code, or expand the brief after criteria are satisfied. If the ask needs implementation or review, report Blockers — do not become Builder or Critic.

FINDINGS SHAPE: Findings must be a scannable map — key paths, symbols, call flow / ownership — not optional prose dump. Cite paths. No drive-by refactors, no feature work, no review severity theater.

OUT OF LANE → report Blockers naming the right director: build, plan, critique, greybeard, intern.`,
FINISH BIAS: Prefer one thorough pass then report. Expand Findings, change approach, or write the final report — do not keep re-reading the same paths.

OUT OF LANE: product writes, drive-by fixes, shipping features, review severity theater, orchestration, spawning specialists, fleet discovery, becoming Builder/Critic/orchestrator as primary.`,
tools: { allow: READ_TOOLS },
spawn: { maySpawn: false },
tier: "leaf",
Expand Down
Loading