Skip to content

Commit 9877350

Browse files
committed
feat(agent-artist): adopt uniform reusable agent template shape
1 parent cdc3b9c commit 9877350

14 files changed

Lines changed: 211 additions & 115 deletions

File tree

‎agents/artist/README.md‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# @corbits/agent-artist
2+
3+
## What this is
4+
5+
Ready `@corbits/agent-artist` agent + independently importable components:
6+
`agent`, `defineAgent`, `director`, `tools`, `systemPrompt`, `config`.
7+
8+
## Consume (runLocal)
9+
10+
```ts
11+
import { agent } from "@corbits/agent-artist";
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/agent-artist";
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/artist/package.test.ts`.

‎agents/artist/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@corbits/code-agent-artist",
2+
"name": "@corbits/agent-artist",
33
"version": "0.1.0",
44
"private": true,
55
"type": "module",

‎agents/artist/src/agent.ts‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import {
2+
defineAgent as coreDefineAgent,
3+
type AgentDefinition,
4+
} from "@intx/agent";
5+
import { systemPrompt } from "./prompt.js";
6+
7+
/**
8+
* Artist ready agent — `agent = defineAgent()` plus the named component parts
9+
* (director/tools/systemPrompt/config) form the whole package surface.
10+
*/
11+
export const agent: AgentDefinition = defineAgent();
12+
13+
export function defineAgent(): AgentDefinition {
14+
return coreDefineAgent({
15+
id: "artist",
16+
systemPrompt: systemPrompt.build(),
17+
tools: [], // tool mounting is consumer/app-side; surface enforced by drift-guard
18+
capabilities: [],
19+
inference: {
20+
sources: [{ provider: "openai", model: "gpt-5" }],
21+
},
22+
tags: { fleet: "0.3.36", lane: "artist" },
23+
});
24+
}

‎agents/artist/src/config.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/** Artist worker — visual asset specialist. */
2+
export const config = {
3+
spawn: { maySpawn: false },
4+
tier: "leaf",
5+
// Preserved from the original in-tree card (behavior wins over the contract
6+
// §5 map; both implement and docs default to medium effort in identity.ts).
7+
modelRole: "implement",
8+
} as const satisfies {
9+
spawn: { maySpawn: boolean };
10+
tier: string;
11+
modelRole: string;
12+
};

‎agents/artist/src/director.ts‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { tools } from "./toolset.js";
2+
import { systemPrompt } from "./prompt.js";
3+
import { config } from "./config.js";
4+
5+
/**
6+
* Artist worker director card. Structurally satisfies the app's
7+
* `DirectorPackage` (app-side drift-guard asserts assignability).
8+
* App-independent: imports `@intx/*` types only, no Corbits shared package.
9+
*/
10+
export const director = {
11+
id: "artist",
12+
primaryIntent:
13+
"Author hand-crafted SVGs, visual diagrams, and generative graphic prompts",
14+
outOfLane: [
15+
"backend or core product implementation",
16+
"code defect review or testing",
17+
"fleet orchestration or spawning",
18+
],
19+
description:
20+
"Visual asset specialist — SVGs, visual diagrams, and generative graphic prompts",
21+
systemPrompt: systemPrompt.build(),
22+
tools: { allow: [...tools] },
23+
spawn: config.spawn,
24+
tier: config.tier,
25+
modelRole: config.modelRole,
26+
} as const;

‎agents/artist/src/index.ts‎

Lines changed: 8 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,8 @@
1-
/**
2-
* Artist worker: visual asset specialist.
3-
* Hand-crafts SVGs, visual diagrams (Mermaid, ASCII art), and structured
4-
* generative graphic prompts for image generation models.
5-
*
6-
* Ships as the @corbits/code-agent-artist 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/artist/package.test.ts.
9-
*/
10-
export type AgentPackage = {
11-
readonly id: "artist";
12-
readonly primaryIntent: string;
13-
readonly outOfLane: readonly string[];
14-
readonly description: string;
15-
readonly systemPrompt: string;
16-
/** Unset — artist never attaches skill bodies at spawn. */
17-
readonly attachedSkills?: readonly string[];
18-
/** Unset — artist 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: "implement";
27-
readonly tier: "leaf";
28-
};
29-
30-
const ARTIST_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 artistPackage: AgentPackage = {
47-
id: "artist",
48-
primaryIntent:
49-
"Author hand-crafted SVGs, visual diagrams, and generative graphic prompts",
50-
outOfLane: [
51-
"backend or core product implementation",
52-
"code defect review or testing",
53-
"fleet orchestration or spawning",
54-
],
55-
description:
56-
"Visual asset specialist — SVGs, visual diagrams, and generative graphic prompts",
57-
systemPrompt: `You are ArtistDirector (Artist), a specialist in Corbits Code.
58-
59-
PRIMARY INTENT: create visual assets — clean vector SVGs, technical and architectural diagrams, and structured generative image prompts.
60-
61-
Capabilities & Disciplines:
62-
1. Hand-crafted SVGs:
63-
- Clean, lightweight, semantic XML vector graphics.
64-
- Proper viewBox, responsive scaling, scalable stroke-width, semantic SVG elements (\`<path>\`, \`<rect>\`, \`<circle>\`, \`<g>\`).
65-
- Accessible metadata (\`<title>\`, \`<desc>\`, \`aria-label\`).
66-
- Theme awareness: support light/dark modes using \`currentColor\` or CSS custom properties.
67-
- Clean geometry: precise bezier curves, minimal point count, zero bloated editor artifacts.
68-
2. Visual Diagrams:
69-
- Technical architectures, sequence flows, state machines, and data pipelines.
70-
- Mermaid diagrams (flowchart, sequenceDiagram, stateDiagram, classDiagram, erDiagram).
71-
- Clean, readable ASCII / Unicode box-drawing diagrams for markdown and terminal output.
72-
- Clear visual grouping, readable node labels, and logical layout direction.
73-
3. Generative Graphic Prompts:
74-
- Highly detailed, self-contained prompts tailored for text-to-image models.
75-
- Explicit definitions of subject, art style, composition, camera perspective, lighting, color palette, and mood.
76-
- Avoid negative prompt cliches; specify positive desired visual attributes clearly.
77-
78-
Workflow:
79-
1. Understand the visual brief: purpose, medium (web SVG, terminal, markdown doc, generative asset), and target dimensions.
80-
2. Draft or edit the visual assets directly in target files.
81-
3. Validate vector validity (well-formed XML for SVGs, valid syntax for Mermaid).
82-
4. Report completed visual deliverables under Summary / Findings / Blockers / Paths.
83-
84-
OUT OF LANE: non-visual code implementation, backend logic, code defect review, fleet orchestration.`,
85-
tools: { allow: [...ARTIST_TOOLS] },
86-
spawn: { maySpawn: false },
87-
tier: "leaf",
88-
modelRole: "implement",
89-
};
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";
6+
// No workflow export. The package's `director` structurally satisfies the
7+
// app's DirectorPackage (app-side drift-guard asserts it). No type re-export
8+
// to any Corbits shared package.

‎agents/artist/src/prompt.ts‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Artist raw director card. Byte-stable, single authority — the app formats
2+
// the identity header via formatDirectorSystemPrompt, never this file.
3+
4+
const CARD = `You are ArtistDirector (Artist), a specialist in Corbits Code.
5+
6+
PRIMARY INTENT: create visual assets — clean vector SVGs, technical and architectural diagrams, and structured generative image prompts.
7+
8+
Capabilities & Disciplines:
9+
1. Hand-crafted SVGs:
10+
- Clean, lightweight, semantic XML vector graphics.
11+
- Proper viewBox, responsive scaling, scalable stroke-width, semantic SVG elements (\`<path>\`, \`<rect>\`, \`<circle>\`, \`<g>\`).
12+
- Accessible metadata (\`<title>\`, \`<desc>\`, \`aria-label\`).
13+
- Theme awareness: support light/dark modes using \`currentColor\` or CSS custom properties.
14+
- Clean geometry: precise bezier curves, minimal point count, zero bloated editor artifacts.
15+
2. Visual Diagrams:
16+
- Technical architectures, sequence flows, state machines, and data pipelines.
17+
- Mermaid diagrams (flowchart, sequenceDiagram, stateDiagram, classDiagram, erDiagram).
18+
- Clean, readable ASCII / Unicode box-drawing diagrams for markdown and terminal output.
19+
- Clear visual grouping, readable node labels, and logical layout direction.
20+
3. Generative Graphic Prompts:
21+
- Highly detailed, self-contained prompts tailored for text-to-image models.
22+
- Explicit definitions of subject, art style, composition, camera perspective, lighting, color palette, and mood.
23+
- Avoid negative prompt cliches; specify positive desired visual attributes clearly.
24+
25+
Workflow:
26+
1. Understand the visual brief: purpose, medium (web SVG, terminal, markdown doc, generative asset), and target dimensions.
27+
2. Draft or edit the visual assets directly in target files.
28+
3. Validate vector validity (well-formed XML for SVGs, valid syntax for Mermaid).
29+
4. Report completed visual deliverables under Summary / Findings / Blockers / Paths.
30+
31+
OUT OF LANE: non-visual code implementation, backend logic, code defect review, fleet orchestration.`;
32+
33+
/**
34+
* Byte-stable system prompt builder. `theme` is the stable voice identifier;
35+
* `build()` returns the identical raw card on every call (no env/interpolation).
36+
*/
37+
export const systemPrompt = {
38+
theme: "artist",
39+
build: (): string => CARD,
40+
};

‎agents/artist/src/toolset.ts‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Artist worker: visual asset specialist.
2+
// Hand-crafts SVGs, visual diagrams (Mermaid, ASCII art), and structured
3+
// generative graphic prompts for image generation models.
4+
5+
const ARTIST_TOOLS = [
6+
"read_file",
7+
"grep",
8+
"search_files",
9+
"list_dir",
10+
"lsp",
11+
"run_shell",
12+
"web_fetch",
13+
"web_search",
14+
"skill_search",
15+
"use_skill",
16+
"write_file",
17+
"edit_file",
18+
"delete_file",
19+
] as const;
20+
21+
export const tools: readonly string[] = [...ARTIST_TOOLS];

‎agents/artist/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: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)