Skip to content

Commit 2f3d43f

Browse files
committed
feat(planner): ship planner as a workspace agent package
1 parent c188b3e commit 2f3d43f

14 files changed

Lines changed: 195 additions & 29 deletions

File tree

‎agents/planner/README.md‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# @corbits/code-agent-planner
2+
3+
## What this is
4+
5+
Ready `@corbits/code-agent-planner` agent + independently importable components:
6+
`agent`, `defineAgent`, `director`, `tools`, `systemPrompt`, `config`.
7+
8+
## Consume (runLocal)
9+
10+
```ts
11+
import { agent } from "@corbits/code-agent-planner";
12+
const run = runLocal(defining(agent), env);
13+
```
14+
15+
## Consume (deploy runWorkflow / hub / sidecar)
16+
17+
Hand the same `AgentDefinition` to a workflow — the package never exports a
18+
workflow itself.
19+
20+
## Remix components
21+
22+
```ts
23+
import { director, tools, systemPrompt, config } from "@corbits/code-agent-planner";
24+
defineAgent({ director, ... }); // or swap tools / systemPrompt / config
25+
```
26+
27+
Each of `director`, `tools`, `systemPrompt`, and `config` is a named,
28+
independently importable part.
29+
30+
## Single authority
31+
32+
`prompt.ts` `systemPrompt.build()` is byte-stable (the raw card, no formatting).
33+
`toolset.ts` `tools` literal equals the `REVIEW_TOOLS` surface constant in
34+
`src/agent/directors/tool-sets.ts`; drift is enforced by the in-tree drift-guard
35+
`src/agent/directors/planner/package.test.ts`.

‎agents/planner/package.json‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "@corbits/code-agent-planner",
3+
"version": "0.1.0",
4+
"private": true,
5+
"type": "module",
6+
"license": "SEE LICENSE IN LICENSE.md",
7+
"exports": {
8+
".": {
9+
"types": "./src/index.ts",
10+
"default": "./src/index.ts"
11+
}
12+
}
13+
}

‎agents/planner/src/agent.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import {
2+
defineAgent as coreDefineAgent,
3+
type AgentDefinition,
4+
} from "@intx/agent";
5+
import { systemPrompt } from "./prompt.js";
6+
7+
export const agent: AgentDefinition = defineAgent();
8+
9+
export function defineAgent(): AgentDefinition {
10+
return coreDefineAgent({
11+
id: "planner",
12+
systemPrompt: systemPrompt.build(),
13+
tools: [],
14+
capabilities: [],
15+
inference: { sources: [] },
16+
});
17+
}

‎agents/planner/src/config.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export const config = {
2+
spawn: { maySpawn: false },
3+
tier: "leaf",
4+
modelRole: "plan",
5+
} as const satisfies {
6+
spawn: { maySpawn: boolean };
7+
tier: string;
8+
modelRole: string;
9+
};

‎agents/planner/src/director.ts‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { tools } from "./toolset.js";
2+
import { systemPrompt } from "./prompt.js";
3+
import { config } from "./config.js";
4+
5+
export const director = {
6+
id: "planner",
7+
primaryIntent:
8+
"Author requirements (PRD.md), solution scopes (SOLUTION_SCOPE.md), and ordered build plans (BUILD_PLAN.md)",
9+
outOfLane: [
10+
"shipping product implementation code",
11+
"fleet orchestration or spawning",
12+
"pure code defect review",
13+
"becoming Coder or Reviewer as primary",
14+
],
15+
description:
16+
"Planning specialist — PRD.md, SOLUTION_SCOPE.md, and BUILD_PLAN.md authoring",
17+
systemPrompt: systemPrompt.build(),
18+
tools: { allow: [...tools] },
19+
spawn: config.spawn,
20+
tier: config.tier,
21+
modelRole: config.modelRole,
22+
} as const;

‎agents/planner/src/index.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export { agent, defineAgent } from "./agent.js";
2+
export { director } from "./director.js";
3+
export { tools } from "./toolset.js";
4+
export { systemPrompt } from "./prompt.js";
5+
export { config } from "./config.js";
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,10 @@
1-
import type { DirectorPackage } from "../types.js";
2-
import { BUILD_TOOLS } from "../tool-sets.js";
1+
// The app formats the identity header via formatDirectorSystemPrompt.
32

4-
/**
5-
* Planner worker: PRD / solution-scope / build-plan author.
6-
* Produces requirements (PRD.md), solution scopes (SOLUTION_SCOPE.md),
7-
* and concrete ordered build plans (BUILD_PLAN.md).
8-
*/
9-
export const plannerPackage: DirectorPackage = {
10-
id: "planner",
11-
primaryIntent:
12-
"Author requirements (PRD.md), solution scopes (SOLUTION_SCOPE.md), and ordered build plans (BUILD_PLAN.md)",
13-
outOfLane: [
14-
"shipping product implementation code",
15-
"fleet orchestration or spawning",
16-
"pure code defect review",
17-
"becoming Coder or Reviewer as primary",
18-
],
19-
description:
20-
"Planning specialist — PRD.md, SOLUTION_SCOPE.md, and BUILD_PLAN.md authoring",
21-
tools: { allow: BUILD_TOOLS },
22-
spawn: { maySpawn: false },
23-
tier: "leaf",
24-
modelRole: "plan",
25-
systemPrompt: `You are PlannerDirector (Planner), a specialist in Corbits Code.
3+
const CARD = `You are PlannerDirector (Planner), a specialist in Corbits Code.
264
275
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.
286
29-
Core artifacts:
7+
Sawyer-skills discipline & core artifacts:
308
1. PRD.md (Requirements):
319
- Problem statement & user/operator value.
3210
- User stories and detailed acceptance criteria.
@@ -48,5 +26,9 @@ Workflow:
4826
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).
4927
4. Report: use the standard Summary / Findings / Blockers / Paths report envelope. Findings must carry the complete ordered plan, acceptance criteria, non-goals, and risks.
5028
51-
OUT OF LANE: shipping product implementation code, executing test suites for product verification, fleet orchestration or spawning, becoming Coder or Reviewer as primary.`,
29+
OUT OF LANE: shipping product implementation code, executing test suites for product verification, fleet orchestration or spawning, becoming Coder or Reviewer as primary.`;
30+
31+
export const systemPrompt = {
32+
theme: "planner",
33+
build: (): string => CARD,
5234
};

‎agents/planner/src/toolset.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
export const tools: readonly string[] = [
2+
"read_file",
3+
"grep",
4+
"search_files",
5+
"list_dir",
6+
"lsp",
7+
"run_shell",
8+
"web_fetch",
9+
"web_search",
10+
"skill_search",
11+
"use_skill",
12+
"write_file",
13+
"edit_file",
14+
"delete_file",
15+
] as const;

‎agents/planner/tsconfig.json‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../../tsconfig.base.json",
3+
"compilerOptions": {
4+
"noEmit": true
5+
},
6+
"include": ["src/**/*.ts"]
7+
}

‎bun.lock‎

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)