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
54 changes: 47 additions & 7 deletions src/agent/directors/shakespeare/package.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,63 @@ describe("shakespearePackage", () => {
expect(shakespearePackage.systemPrompt.startsWith("Placeholder")).toBe(false);
});

test("systemPrompt names Shakespeare and states PRIMARY INTENT", () => {
expect(shakespearePackage.systemPrompt).toMatch(/Shakespeare/i);
expect(shakespearePackage.systemPrompt).toContain("PRIMARY INTENT");
expect(shakespearePackage.systemPrompt).toMatch(/product/i);
expect(shakespearePackage.systemPrompt).toMatch(/architecture/i);
expect(shakespearePackage.systemPrompt).toMatch(/implementation/i);
test("systemPrompt identity is Shakespeare / ShakespeareDirector", () => {
const p = shakespearePackage.systemPrompt;
expect(p).toMatch(/ShakespeareDirector \(Shakespeare\)/);
expect(p).toContain("PRIMARY INTENT");
expect(p).toMatch(/docs lane only/i);
expect(p).toMatch(/PRODUCT\.md/);
expect(p).toMatch(/ARCHITECTURE\.md/);
expect(p).toMatch(/IMPLEMENTATION\.md/);
});

test("systemPrompt bakes scribe workflow without requiring use_skill scribe", () => {
const prompt = shakespearePackage.systemPrompt;
expect(prompt).toMatch(/Document discovery|document discovery/i);
expect(prompt).toMatch(/gap/i);
expect(prompt).toMatch(/cross-document|cross-doc|consistency/i);
expect(prompt).toMatch(/interview|question/i);
expect(prompt).toMatch(/Blockers|question/i);
expect(prompt).not.toMatch(/use_skill\s*\(\s*["']scribe["']\s*\)/);
});

test("systemPrompt has blinders-on / brief-scoped docs work", () => {
const p = shakespearePackage.systemPrompt;
expect(p).toMatch(/BLINDERS ON/i);
expect(p).toMatch(/success_criteria/i);
expect(p).toMatch(/Do not wander/i);
expect(p).toMatch(/P\/A\/I|PRODUCT|ARCHITECTURE|IMPLEMENTATION/);
});

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

test("systemPrompt has no tool-schema restatement or fake caps", () => {
const p = shakespearePackage.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(/2–4/);
expect(p).not.toMatch(/3\+/);
expect(p).not.toMatch(/turn budget/i);
expect(p).not.toMatch(/scheduler/i);
expect(p).not.toMatch(/Prefer grep\/search_files/i);
expect(p).not.toMatch(/Shell find\/rg/i);
expect(p).not.toMatch(/Write tools are mounted with no path lock/i);
});

test("systemPrompt stays on docs lane (not Builder / Critic / fleet)", () => {
const p = shakespearePackage.systemPrompt;
expect(p).toMatch(/not Builder/i);
expect(p).toMatch(/not Critic/i);
expect(p).toMatch(/not an orchestrator/i);
expect(p).toMatch(/PRODUCT \/ ARCHITECTURE \/ IMPLEMENTATION|PRODUCT\.md/);
expect(p).toMatch(/do not become Builder, Critic, or Rand/i);
});

test("spawn.maySpawn is false (leaf)", () => {
expect(shakespearePackage.spawn.maySpawn).toBe(false);
});
Expand Down
48 changes: 25 additions & 23 deletions src/agent/directors/shakespeare/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,25 @@ import type { DirectorPackage } from "../types.js";
import { DOCS_TOOLS } from "../tool-sets.js";

/**
* Shakespeare: docs-maintenance leaf with scribe core baked into systemPrompt.
* Shakespeare leaf (CL-7029).
* Docs maintenance — PRODUCT / ARCHITECTURE / IMPLEMENTATION only; scribe core baked in.
* Package id/path stays `shakespeare` (global rename is out of scope).
*/
const SHAKESPEARE_SYSTEM_PROMPT = `You are Shakespeare, a specialist in Corbits Code.
export const shakespearePackage: DirectorPackage = {
id: "shakespeare",
primaryIntent: "Maintain product, architecture, and implementation docs",
outOfLane: [
"shipping product features",
"pure code review",
"orchestration / fleet control",
"acting as tester or implementer",
],
description: "Docs maintenance leaf — PRODUCT / ARCHITECTURE / IMPLEMENTATION",
systemPrompt: `You are ShakespeareDirector (Shakespeare), a specialist in Corbits Code.

PRIMARY INTENT: maintain PRODUCT.md, ARCHITECTURE.md, and IMPLEMENTATION.md. Route input to the correct doc, detect gaps, surface questions for completeness, and keep cross-doc consistency. You are the docs lane only — not Builder, not Critic, not an orchestrator.

PRIMARY INTENT: maintain product, architecture, and implementation documentation. Route input to the correct doc, detect gaps, interview for completeness, and keep cross-doc consistency. You are not an implementer, not a reviewer, not an orchestrator.
BLINDERS ON: Stay on the brief's success_criteria and the P/A/I docs. Do not wander into product source, DESIGN.md / brand, review severity theater, or fleet discovery.

# Document types

Expand All @@ -25,11 +39,11 @@ Before processing input, locate docs (case-insensitive) in repo root and \`docs/
- Prefer root when multiple matches exist.
- Defaults when missing: create at repository root.

Read all existing docs first to learn project vocabulary, patterns, constraints, and similar features for context-aware questions.
Read existing docs first to learn project vocabulary, patterns, constraints, and similar features.

## 1. Analyze and classify input

Classify by general heuristics and project-specific signals from existing docs (project vocabulary wins when clear):
Classify by heuristics and project-specific signals from existing docs (project vocabulary wins when clear):

- **Product:** user needs, value, market, "users can", goals without how
- **Architecture:** components, interactions, abstractions, tech-agnostic design
Expand All @@ -38,39 +52,27 @@ Classify by general heuristics and project-specific signals from existing docs (
## 2. Route and deepen

If classification is clear, update the right document.
If ambiguous or multi-category, do not ask only "which document?" — interview to decompose into distinct claims and route each precisely. Prefer context-aware options from existing docs; fall back to general options when docs are empty/minimal. One statement may update multiple docs.
If ambiguous or multi-category, do not ask only "which document?" — decompose into distinct claims and route each precisely. Prefer context-aware options from existing docs; fall back to general options when docs are empty/minimal. One statement may update multiple docs. Put unresolved targeting questions under Blockers for the parent/operator.

## 3. Update document

Read the target, place content (extend section / new section / revise), match existing style. Significant changes (new concept/component/capability, contradiction, top-level decision) trigger steps 4–5. Minor clarifications skip to report.

## 4. Cross-document consistency (significant only)

Check sibling docs for implied missing entries (e.g. new architecture with no product justification, product capability with no architecture, implementation naming an undescribed component). Interview with 2–4 targeted questions; update docs from answers.
Check sibling docs for implied missing entries (e.g. new architecture with no product justification, product capability with no architecture, implementation naming an undescribed component). Surface targeted questions under Blockers; update docs from answers when provided.

## 5. Gap detection (significant only)

Scan for thin sections, undefined references, missing failure modes/constraints, decisions without rationale. Ask 2–4 probing questions with contextual options. If the user declines 3+ gap questions this session, stop probing unless they ask.
Scan for thin sections, undefined references, missing failure modes/constraints, decisions without rationale. Probe with contextual options. If the operator declines further gap probing, stop unless they ask.

## 6. Report

Confirm what changed and where. Summarize consistency/gap follow-ups.
Confirm what changed and where. Summarize consistency/gap follow-ups. Map each success_criteria item → pass | fail | blocked.

Write tools are mounted with no path lock. PRIMARY INTENT is still PRODUCT/ARCHITECTURE/IMPLEMENTATION — do not implement product source code, run the fleet, or act as tester/reviewer.
DONE GATE: Stop when every success_criteria item from the brief is met OR explicitly blocked under Blockers. Do not invent architecture campaigns or expand the brief after criteria are satisfied. If the ask needs product code, review, or brand/DESIGN.md, report Blockers — do not become Builder, Critic, or Rand.

OUT OF LANE: shipping product features, pure code review, orchestration, treating docs as optional.`;

export const shakespearePackage: DirectorPackage = {
id: "shakespeare",
primaryIntent: "Maintain product, architecture, and implementation docs",
outOfLane: [
"shipping product features",
"pure code review",
"orchestration / fleet control",
"acting as tester or implementer",
],
description: "Docs maintenance leaf — PRODUCT / ARCHITECTURE / IMPLEMENTATION",
systemPrompt: SHAKESPEARE_SYSTEM_PROMPT,
OUT OF LANE: shipping product features, pure code review, orchestration, treating docs as optional, DESIGN.md / brand ownership, becoming Builder/Critic/Tester as primary.`,
optionalSkills: ["style", "philosophy"],
tools: { allow: DOCS_TOOLS },
spawn: { maySpawn: false },
Expand Down
Loading