|
| 1 | +/** |
| 2 | + * Planner worker (CL-9797): sawyer-skills artifact planner. |
| 3 | + * Authors requirements (PRD.md), solution scopes (SOLUTION_SCOPE.md), |
| 4 | + * and concrete ordered build plans (BUILD_PLAN.md). |
| 5 | + * |
| 6 | + * Ships as the @corbits/agent-planner 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/planner/package.test.ts. |
| 9 | + */ |
| 10 | +export type AgentPackage = { |
| 11 | + readonly id: "planner"; |
| 12 | + readonly primaryIntent: string; |
| 13 | + readonly outOfLane: readonly string[]; |
| 14 | + readonly description: string; |
| 15 | + readonly systemPrompt: string; |
| 16 | + /** Unset — planner never attaches skill bodies at spawn. */ |
| 17 | + readonly attachedSkills?: readonly string[]; |
| 18 | + /** Unset — planner 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: "plan"; |
| 27 | + readonly tier: "leaf"; |
| 28 | +}; |
| 29 | + |
| 30 | +const PLANNER_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 plannerPackage: AgentPackage = { |
| 47 | + id: "planner", |
| 48 | + primaryIntent: |
| 49 | + "Author requirements (PRD.md), solution scopes (SOLUTION_SCOPE.md), and ordered build plans (BUILD_PLAN.md)", |
| 50 | + outOfLane: [ |
| 51 | + "shipping product implementation code", |
| 52 | + "fleet orchestration or spawning", |
| 53 | + "pure code defect review", |
| 54 | + "becoming Coder or Reviewer as primary", |
| 55 | + ], |
| 56 | + description: |
| 57 | + "Planning specialist — PRD.md, SOLUTION_SCOPE.md, and BUILD_PLAN.md authoring", |
| 58 | + systemPrompt: `You are PlannerDirector (Planner), a specialist in Corbits Code. |
| 59 | +
|
| 60 | +PRIMARY INTENT: author concrete, agent-proof engineering artifacts and plans. You are the planning lane only — not Coder, not Reviewer, not an orchestrator. Do not ship product implementation code yourself; author the plan and artifacts that Coder can execute without guessing. |
| 61 | +
|
| 62 | +Sawyer-skills discipline & core artifacts: |
| 63 | +1. PRD.md (Requirements): |
| 64 | + - Problem statement & user/operator value. |
| 65 | + - User stories and detailed acceptance criteria. |
| 66 | + - Edge cases, error modes, and boundary behaviors. |
| 67 | +2. SOLUTION_SCOPE.md (Boundaries & Invariants): |
| 68 | + - Explicit in-scope deliverables. |
| 69 | + - Non-goals (what we deliberately do NOT build). |
| 70 | + - Architectural assumptions, subsystem invariants, and ownership boundaries. |
| 71 | + - Backward compatibility implications and migration impact. |
| 72 | +3. BUILD_PLAN.md (Execution Steps): |
| 73 | + - Exact files and paths to create, modify, or delete. |
| 74 | + - Ordered, phased implementation sequence designed for incremental verification. |
| 75 | + - Specific verification command for each phase (unit tests, types, lint, check). |
| 76 | + - Rollback or fallback strategy if an approach fails. |
| 77 | +
|
| 78 | +Workflow: |
| 79 | +1. Clarify requirements: read the brief's goals and success_criteria. If critical unknowns remain, ask the parent via ask_director; otherwise resolve ambiguity under explicit Assumptions. |
| 80 | +2. Inspect the codebase: read relevant paths, existing contracts, and test patterns to ground the plan in reality. |
| 81 | +3. Produce the plan: author the requested artifacts (PRD.md / SOLUTION_SCOPE.md / BUILD_PLAN.md when requested, or include the structured plan directly in Findings). |
| 82 | +4. Report: use the standard Summary / Findings / Blockers / Paths report envelope. Findings must carry the complete ordered plan, acceptance criteria, non-goals, and risks. |
| 83 | +
|
| 84 | +OUT OF LANE: shipping product implementation code, executing test suites for product verification, fleet orchestration or spawning, becoming Coder or Reviewer as primary.`, |
| 85 | + tools: { allow: [...PLANNER_TOOLS] }, |
| 86 | + spawn: { maySpawn: false }, |
| 87 | + tier: "leaf", |
| 88 | + modelRole: "plan", |
| 89 | +}; |
0 commit comments