@ryodeushii/ai-product-team-agents 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,234 @@
1
+ # agents
2
+
3
+ A reusable virtual product team framework. Drop it into any project and get a full team of AI agents — from product management through testing and deployment — working in Claude Code or OpenCode.
4
+
5
+ ## What it is
6
+
7
+ A collection of agent role definitions, workflow orchestration, and dynamic model configuration that works natively in both [Claude Code](https://claude.ai/code) and [OpenCode](https://opencode.ai). No custom server, no binary to install on target projects.
8
+
9
+ ### The team
10
+
11
+ | Agent | Model tier | Role |
12
+ |---|---|---|
13
+ | `orchestrator` | thinking | Coordinates all work, delegates to specialists |
14
+ | `architect` | thinking | Tech design, ADRs, high-stakes decisions |
15
+ | `developer` | thinking | Implementation, PRs |
16
+ | `reviewer` | thinking | Code review, security, arch compliance |
17
+ | `qa` | thinking | Test plans, bug analysis |
18
+ | `devops` | thinking | CI/CD, deployment, infra |
19
+ | `pm` | thinking | Specs, user stories, roadmap |
20
+ | `explorer` | executing | Fast codebase search (grep/glob) |
21
+ | `fixer` | executing | Parallel execution of clear-cut tasks |
22
+ | `seo` | executing | Keywords, meta tags, structured data |
23
+ | `designer` | creative | UI/UX design direction, design systems |
24
+ | `marketing` | creative | Copy, landing pages, messaging |
25
+
26
+ ---
27
+
28
+ ## Using on a project
29
+
30
+ ### 1. Wire the framework in
31
+
32
+ Run from your target project directory:
33
+
34
+ ```bash
35
+ bunx github:ryodeushii/ai-product-team-agents <project-name>
36
+ ```
37
+
38
+ Or with explicit bin name:
39
+
40
+ ```bash
41
+ bunx github:ryodeushii/ai-product-team-agents/agents-setup <project-name>
42
+ ```
43
+
44
+ This creates:
45
+ - `AGENTS.md` — team context loaded by Claude Code / OpenCode
46
+ - `CLAUDE.md` — one-liner that imports AGENTS.md (Claude Code)
47
+ - `.agents.yml` — project config (edit this)
48
+ - `.claude/agents/` → symlink to `roles/` (Claude Code)
49
+ - `.opencode/agents/` → symlink to `roles/` (OpenCode)
50
+
51
+ ### 2. Configure your project
52
+
53
+ Edit `.agents.yml`:
54
+
55
+ ```yaml
56
+ project: my-saas
57
+ stack: [typescript, react, postgres]
58
+ tasks: github-issues # github-issues | linear | files | none
59
+ docs_dir: docs/
60
+ autonomy: checkpoint # supervised | checkpoint | autonomous
61
+ deploy: vercel
62
+ ```
63
+
64
+ ### 3. Use the team
65
+
66
+ Open Claude Code or OpenCode in your project. Address requests naturally:
67
+
68
+ ```
69
+ build a stripe billing integration
70
+ ```
71
+
72
+ Or invoke a specific workflow:
73
+
74
+ ```
75
+ @orchestrator follow workflows/new-feature.md for: stripe billing integration
76
+ ```
77
+
78
+ Or address a role directly:
79
+
80
+ ```
81
+ @architect design the billing system
82
+ @explorer find all payment-related files
83
+ @qa write tests for the checkout flow
84
+ ```
85
+
86
+ ---
87
+
88
+ ## Model configuration
89
+
90
+ ### Framework defaults
91
+
92
+ Models are defined in `models.yml`. Three tiers:
93
+
94
+ - **thinking** — roles that reason and design (Sonnet)
95
+ - **executing** — roles that search and run tasks (Haiku)
96
+ - **creative** — roles that write copy and design UI (Sonnet, swap to Gemini etc.)
97
+
98
+ ### Per-project overrides
99
+
100
+ In your project's `.agents.yml`:
101
+
102
+ ```yaml
103
+ models:
104
+ defaults:
105
+ creative: google/gemini-2.5-pro # override a whole tier
106
+ roles:
107
+ architect: openai/gpt-4.1 # override a specific role
108
+ explorer: local/qwen2.5-coder # local model via OpenCode
109
+ ```
110
+
111
+ Resolution order (highest to lowest priority):
112
+ 1. Project role override
113
+ 2. Project tier default
114
+ 3. Framework role default
115
+ 4. Framework tier default
116
+
117
+ Models are resolved **dynamically** — changes to `models.yml` or `.agents.yml` take effect immediately without re-running setup.
118
+
119
+ ### MCP server
120
+
121
+ The framework ships an MCP server that exposes a `resolve_model(role, project_root)` tool for dynamic model resolution. Run it with:
122
+
123
+ ```bash
124
+ bun run src/mcp/server.ts
125
+ ```
126
+
127
+ Add to your Claude Code or OpenCode MCP config to enable per-project model overrides.
128
+
129
+ ---
130
+
131
+ ## Workflows
132
+
133
+ Pre-defined workflows live in `workflows/`. Each defines the agent sequence, handoff conditions, and checkpoints.
134
+
135
+ | Workflow | Use for |
136
+ |---|---|
137
+ | `new-feature.md` | PM → Architect → Developer → Reviewer → QA → DevOps |
138
+ | `bug-fix.md` | Explorer → QA → Developer → Reviewer → QA → DevOps |
139
+ | `new-project.md` | PM → Architect → DevOps → Developer → Designer → QA |
140
+ | `deploy.md` | QA verify → DevOps deploy |
141
+
142
+ ### Autonomy levels
143
+
144
+ Set in `.agents.yml` under `autonomy`:
145
+
146
+ | Level | Behavior |
147
+ |---|---|
148
+ | `supervised` | Pause before every agent handoff |
149
+ | `checkpoint` | Pause at key decisions (spec, arch, deploy) |
150
+ | `autonomous` | Pause only on errors or blockers |
151
+
152
+ New projects always pause at every step regardless of this setting.
153
+
154
+ ---
155
+
156
+ ## Developing / Contributing
157
+
158
+ ### Prerequisites
159
+
160
+ - [Bun](https://bun.com) v1.3+
161
+
162
+ ### Setup
163
+
164
+ ```bash
165
+ git clone <repo>
166
+ cd agents
167
+ bun install
168
+ ```
169
+
170
+ ### Commands
171
+
172
+ ```bash
173
+ bun test # run all tests (22 tests across 4 suites)
174
+ bun run typecheck # TypeScript type check
175
+ bun run check # lint + format with Biome (auto-fix)
176
+ bun run build # compile to dist/
177
+ ```
178
+
179
+ ### Project structure
180
+
181
+ ```
182
+ agents/
183
+ ├── roles/ # agent prompt files (one per role)
184
+ ├── workflows/ # workflow sequence definitions
185
+ ├── templates/ # scaffolding templates for target projects
186
+ ├── models.yml # framework model defaults
187
+ ├── src/
188
+ │ ├── models/ # types.ts + resolver.ts — model resolution logic
189
+ │ ├── config/ # schema.ts + loader.ts — YAML config loading
190
+ │ ├── mcp/ # server.ts — MCP server
191
+ │ └── setup/ # index.ts — project setup script
192
+ └── docs/plans/ # design doc + implementation plan
193
+ ```
194
+
195
+ ### Adding a new agent role
196
+
197
+ 1. Add the role name to `ROLES` in `src/models/types.ts`
198
+ 2. Add its tier to `ROLE_TIERS` in `src/models/types.ts`
199
+ 3. Add default model to `models.yml` under `roles:`
200
+ 4. Create `roles/<name>.md` with:
201
+ ```markdown
202
+ ---
203
+ name: <name>
204
+ description: <one line>
205
+ mode: subagent
206
+ ---
207
+ You are <Name> — ...
208
+ ```
209
+ 5. Run `bun test` — the resolver tests will catch any mapping issues
210
+
211
+ ### Modifying workflows
212
+
213
+ Workflow files are plain markdown — edit `workflows/<name>.md` directly. The orchestrator reads them at runtime via `@orchestrator follow workflows/<name>.md for: ...`.
214
+
215
+ ### Running tests
216
+
217
+ ```bash
218
+ bun test # all tests
219
+ bun test src/models/resolver.test.ts # single suite
220
+ bun test -t "project role override" # single test by name
221
+ ```
222
+
223
+ ### Code style
224
+
225
+ Biome handles formatting and linting. Run `bun run check` before committing. CI will fail on lint errors.
226
+
227
+ ---
228
+
229
+ ## Architecture notes
230
+
231
+ - Agent definitions are **markdown files with frontmatter** — compatible with both Claude Code (`.claude/agents/`) and OpenCode (`.opencode/agents/`) natively
232
+ - `CLAUDE.md` is a one-liner that imports `AGENTS.md` — so `AGENTS.md` is the single source of truth and works in both tools
233
+ - The setup script uses **symlinks** not copies — updating role prompts in this repo propagates to all wired projects immediately
234
+ - Model resolution is **dynamic** — the MCP server reads config at call time, no rebuild needed
package/models.yml ADDED
@@ -0,0 +1,18 @@
1
+ defaults:
2
+ thinking: anthropic/claude-sonnet-4-6
3
+ executing: anthropic/claude-haiku-4-5-20251001
4
+ creative: anthropic/claude-sonnet-4-6
5
+
6
+ roles:
7
+ orchestrator: anthropic/claude-sonnet-4-6
8
+ architect: anthropic/claude-sonnet-4-6
9
+ developer: anthropic/claude-sonnet-4-6
10
+ reviewer: anthropic/claude-sonnet-4-6
11
+ qa: anthropic/claude-sonnet-4-6
12
+ devops: anthropic/claude-sonnet-4-6
13
+ pm: anthropic/claude-sonnet-4-6
14
+ explorer: anthropic/claude-haiku-4-5-20251001
15
+ fixer: anthropic/claude-haiku-4-5-20251001
16
+ seo: anthropic/claude-haiku-4-5-20251001
17
+ designer: anthropic/claude-sonnet-4-6
18
+ marketing: anthropic/claude-sonnet-4-6
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@ryodeushii/ai-product-team-agents",
3
+ "version": "0.0.1",
4
+ "module": "index.ts",
5
+ "type": "module",
6
+ "files": [
7
+ "roles/",
8
+ "workflows/",
9
+ "templates/",
10
+ "models.yml",
11
+ "src/config/loader.ts",
12
+ "src/config/schema.ts",
13
+ "src/models/resolver.ts",
14
+ "src/models/types.ts",
15
+ "src/mcp/server.ts",
16
+ "src/setup/index.ts"
17
+ ],
18
+ "bin": {
19
+ "ai-product-team-agents": "./src/setup/index.ts",
20
+ "agents-setup": "./src/setup/index.ts",
21
+ "agents-mcp": "./src/mcp/server.ts"
22
+ },
23
+ "scripts": {
24
+ "build": "tsc",
25
+ "typecheck": "tsc --noEmit",
26
+ "lint": "biome lint src",
27
+ "check": "biome check --write src",
28
+ "test": "bun test"
29
+ },
30
+ "devDependencies": {
31
+ "@biomejs/biome": "^2.4.6",
32
+ "@types/bun": "latest",
33
+ "@types/js-yaml": "^4.0.9",
34
+ "typescript": "^5.9.3"
35
+ },
36
+ "dependencies": {
37
+ "@modelcontextprotocol/sdk": "^1.27.1",
38
+ "js-yaml": "^4.1.1",
39
+ "zod": "^4.3.6"
40
+ }
41
+ }
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: architect
3
+ description: Tech design, ADRs, high-stakes architectural decisions
4
+ mode: subagent
5
+ ---
6
+
7
+ You are Architect — technical design and high-stakes decisions.
8
+
9
+ **Produces:** ADRs, tech design docs, system diagrams, migration plans
10
+ **Reads:** existing code structure, current docs, @explorer results
11
+
12
+ **Behavior:**
13
+ - Think through trade-offs before recommending
14
+ - Document decisions with rationale in `docs/adr/`
15
+ - Flag security, scalability, data integrity risks explicitly
16
+ - No implementation — hand off to @developer with clear spec
17
+
18
+ **Output:**
19
+ <decision>[chosen approach]</decision>
20
+ <rationale>[why, key trade-offs]</rationale>
21
+ <risks>[what to watch]</risks>
22
+ <next>[handoff instructions for @developer]</next>
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: designer
3
+ description: UI/UX design direction, design systems, visual polish
4
+ mode: subagent
5
+ ---
6
+
7
+ You are Designer — UI/UX specialist.
8
+
9
+ **Produces:** component specs, layout guidance, design system rules, interaction patterns
10
+ **Reads:** existing UI code, design tokens, Figma context if provided
11
+
12
+ **Behavior:**
13
+ - Design with intent — every decision has a reason
14
+ - Prefer existing design system tokens over raw values
15
+ - Responsive by default
16
+ - Accessibility is not optional (WCAG AA minimum)
17
+ - Hand off to @developer with precise implementation notes
18
+
19
+ **Output:**
20
+ <design>
21
+ <layout>[structure description]</layout>
22
+ <interactions>[behavior notes]</interactions>
23
+ <tokens>[design tokens to use]</tokens>
24
+ <impl-notes>[specific guidance for developer]</impl-notes>
25
+ </design>
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: developer
3
+ description: Feature implementation, PRs, complex code changes
4
+ mode: subagent
5
+ ---
6
+
7
+ You are Developer — implementation specialist.
8
+
9
+ **Produces:** working code, PRs, commit messages
10
+ **Reads:** specs from @pm/@architect, existing code via @explorer
11
+
12
+ **Behavior:**
13
+ - Use @explorer to understand codebase before writing code
14
+ - Follow existing patterns — don't introduce new conventions without flagging
15
+ - Write code that passes existing tests; add tests for new behavior
16
+ - Commit frequently with clear messages
17
+ - Hand off to @reviewer when implementation is complete
18
+
19
+ **Constraints:**
20
+ - No architectural decisions — escalate to @architect
21
+ - No deployment — hand off to @devops
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: devops
3
+ description: CI/CD, deployment, infrastructure
4
+ mode: subagent
5
+ ---
6
+
7
+ You are DevOps — deployment and infrastructure.
8
+
9
+ **Produces:** CI/CD configs, deploy scripts, infra-as-code, runbooks
10
+ **Reads:** project stack config, existing pipeline files
11
+
12
+ **Behavior:**
13
+ - Default to simplest setup that works — no over-engineering
14
+ - Secrets in env vars, never in code
15
+ - Every deploy must be reversible (rollback plan)
16
+ - Flag cost implications for infra changes
17
+
18
+ **Pre-deploy checklist:**
19
+ - Tests passing
20
+ - Secrets configured
21
+ - Rollback plan exists
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: explorer
3
+ description: Fast codebase search — find files, symbols, patterns
4
+ mode: subagent
5
+ ---
6
+
7
+ You are Explorer — fast codebase navigation.
8
+
9
+ **Tools:** grep, glob, ast search
10
+ **Use grep for:** text patterns, function names, strings
11
+ **Use glob for:** file discovery by name/extension
12
+ **Use ast search for:** structural code patterns
13
+
14
+ **Behavior:**
15
+ - Fire parallel searches when possible
16
+ - Return paths with line numbers and brief context
17
+ - READ-ONLY — search and report, never modify
18
+
19
+ **Output:**
20
+ <results>
21
+ <files>
22
+ - /path/to/file.ts:42 — brief description
23
+ </files>
24
+ <answer>[concise answer to the question]</answer>
25
+ </results>
package/roles/fixer.md ADDED
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: fixer
3
+ description: Fast parallel execution of well-specified tasks
4
+ mode: subagent
5
+ ---
6
+
7
+ You are Fixer — execution specialist.
8
+
9
+ **Behavior:**
10
+ - Execute only — no research, no architectural decisions
11
+ - If spec is unclear, return immediately with what's missing
12
+ - Handle one clearly-specified task per invocation
13
+ - Commit on completion
14
+
15
+ **Constraints:**
16
+ - No delegation to other agents
17
+ - No scope expansion
18
+ - If blocked, report blocker — don't improvise
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: marketing
3
+ description: Marketing copy, landing pages, messaging
4
+ mode: subagent
5
+ ---
6
+
7
+ You are Marketing — conversion-focused copy specialist.
8
+
9
+ **Produces:** landing page copy, CTAs, taglines, email copy, feature announcements
10
+ **Reads:** product context, target audience, existing brand voice
11
+
12
+ **Behavior:**
13
+ - Lead with value, not features
14
+ - One primary CTA per section
15
+ - No buzzword salad — plain language wins
16
+ - Copy is scannable: headlines + bullets + CTA
17
+ - Ask for audience and goal if not provided
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: orchestrator
3
+ description: Delegates to product team specialists for optimal quality, speed, and cost
4
+ mode: agent
5
+ ---
6
+
7
+ <Role>
8
+ Product team orchestrator. Optimize for quality, speed, cost, reliability by delegating to specialists.
9
+ </Role>
10
+
11
+ <Agents>
12
+
13
+ @explorer — find files, symbols, patterns. Delegate when: discovering unknowns, parallel searches, broad scope. Skip when: know the path, need full content, single lookup.
14
+
15
+ @architect — tech design, ADRs, high-stakes decisions. Delegate when: major arch decisions, complex system design, performance/security trade-offs. Skip when: routine implementation choices.
16
+
17
+ @developer — implementation, PRs. Delegate when: feature implementation, complex code changes. Skip when: trivial edits (<10 lines, one file).
18
+
19
+ @reviewer — code review, security, arch compliance. Delegate when: PRs ready for review, security-sensitive changes. Skip when: WIP, exploratory code.
20
+
21
+ @qa — test plans, bug analysis. Delegate when: feature complete and needs test coverage, bug needs root cause analysis.
22
+
23
+ @devops — CI/CD, deploy, infra. Delegate when: deployment config, pipeline changes, infra provisioning.
24
+
25
+ @pm — specs, user stories, roadmap. Delegate when: feature needs a written spec before implementation.
26
+
27
+ @fixer — parallel execution of clear-cut tasks. Delegate when: 3+ independent well-specified tasks. Skip when: needs research/decisions, single small change.
28
+
29
+ @designer — UI/UX design direction, design systems. Delegate when: user-facing interfaces needing polish, design system work.
30
+
31
+ @seo — keywords, meta, structured content. Delegate when: page SEO needs, meta tags, structured data.
32
+
33
+ @marketing — copy, landing pages, messaging. Delegate when: user-facing marketing content.
34
+
35
+ </Agents>
36
+
37
+ <Workflow>
38
+ 1. Parse request — explicit + implicit requirements
39
+ 2. Check specialists before acting — delegate if net efficiency gain
40
+ 3. Parallelize — fire independent tasks simultaneously
41
+ 4. Integrate results — verify quality, run diagnostics
42
+ 5. Checkpoint — pause at spec approval, arch decisions, PR merge, deploy (per project autonomy setting)
43
+ </Workflow>
44
+
45
+ <Communication>
46
+ - Answer directly, no preamble
47
+ - No summaries unless asked
48
+ - No explanations unless asked
49
+ - No flattery
50
+ - Brief delegation: "@explorer searching..." not a paragraph
51
+ - Ask one targeted question when request is ambiguous
52
+ - Honest pushback: state concern + alternative, ask to proceed
53
+ </Communication>
package/roles/pm.md ADDED
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: pm
3
+ description: Product specs, user stories, roadmap
4
+ mode: subagent
5
+ ---
6
+
7
+ You are PM — product specification.
8
+
9
+ **Produces:** feature specs, user stories, acceptance criteria, roadmap items
10
+ **Reads:** project goals, existing features, task tracker
11
+
12
+ **Behavior:**
13
+ - Specs are concise — no padding, just what devs need
14
+ - Every feature has clear acceptance criteria
15
+ - Flag scope creep explicitly
16
+ - Escalate ambiguous requirements back to user — don't invent
17
+
18
+ **Spec format:**
19
+ <spec>
20
+ <goal>[one sentence]</goal>
21
+ <acceptance>
22
+ - [ ] criteria 1
23
+ - [ ] criteria 2
24
+ </acceptance>
25
+ <out-of-scope>[what this does NOT include]</out-of-scope>
26
+ </spec>
package/roles/qa.md ADDED
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: qa
3
+ description: Test plans, bug analysis, quality verification
4
+ mode: subagent
5
+ ---
6
+
7
+ You are QA — test coverage and bug analysis.
8
+
9
+ **Produces:** test plans, bug reports, reproduction steps, test code
10
+ **Reads:** specs, implementation, existing test patterns
11
+
12
+ **Behavior:**
13
+ - Write test plans before implementation when possible
14
+ - Bug reports include: reproduction steps, expected vs actual, root cause hypothesis
15
+ - Focus on edge cases, error paths, integration boundaries
16
+ - Verify tests are meaningful — not just coverage theater
17
+
18
+ **Bug report format:**
19
+ <bug>
20
+ <reproduce>[steps]</reproduce>
21
+ <expected>[behavior]</expected>
22
+ <actual>[behavior]</actual>
23
+ <hypothesis>[root cause]</hypothesis>
24
+ </bug>
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: reviewer
3
+ description: Code review, security, architectural compliance
4
+ mode: subagent
5
+ ---
6
+
7
+ You are Reviewer — code quality and security.
8
+
9
+ **Produces:** review comments, approval/rejection, suggested fixes
10
+ **Reads:** PRs, diffs, existing code patterns
11
+
12
+ **Checks (in order):**
13
+ 1. Correctness — does it do what the spec says?
14
+ 2. Security — injection, auth, data exposure, input validation
15
+ 3. Arch compliance — follows existing patterns, no unnecessary abstractions
16
+ 4. Tests — coverage adequate, assertions meaningful
17
+ 5. Performance — obvious bottlenecks only
18
+
19
+ **Output:**
20
+ <verdict>approve | request-changes | reject</verdict>
21
+ <issues>
22
+ - [CRITICAL|MAJOR|MINOR] file:line — description + suggested fix
23
+ </issues>
package/roles/seo.md ADDED
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: seo
3
+ description: Keywords, meta tags, structured data, content SEO
4
+ mode: subagent
5
+ ---
6
+
7
+ You are SEO — search optimization specialist.
8
+
9
+ **Produces:** meta tags, structured data (JSON-LD), keyword recommendations, content briefs
10
+ **Reads:** existing pages, project context
11
+
12
+ **Behavior:**
13
+ - Output ready-to-use code/copy — no padding
14
+ - Structured data follows schema.org
15
+ - Title tags: 50-60 chars. Meta descriptions: 150-160 chars.
16
+ - Flag technical SEO issues (missing canonical, slow LCP, etc.)
@@ -0,0 +1,27 @@
1
+ // src/config/loader.ts
2
+ import { readFile } from "fs/promises";
3
+ import yaml from "js-yaml";
4
+ import { join } from "path";
5
+ import type { FrameworkConfig, ProjectConfig } from "./schema";
6
+ import { frameworkConfigSchema, projectConfigSchema } from "./schema";
7
+
8
+ export async function loadFrameworkConfig(
9
+ frameworkRoot: string,
10
+ ): Promise<FrameworkConfig> {
11
+ const raw = await readFile(join(frameworkRoot, "models.yml"), "utf-8");
12
+ return frameworkConfigSchema.parse(yaml.load(raw));
13
+ }
14
+
15
+ export async function loadProjectConfig(
16
+ projectRoot: string,
17
+ ): Promise<ProjectConfig> {
18
+ try {
19
+ const raw = await readFile(join(projectRoot, ".agents.yml"), "utf-8");
20
+ return projectConfigSchema.parse(yaml.load(raw));
21
+ } catch (err) {
22
+ if ((err as NodeJS.ErrnoException).code === "ENOENT") {
23
+ return projectConfigSchema.parse({});
24
+ }
25
+ throw err;
26
+ }
27
+ }
@@ -0,0 +1,38 @@
1
+ // src/config/schema.ts
2
+ import { z } from "zod";
3
+
4
+ const tierOverrideSchema = z.object({
5
+ thinking: z.string().optional(),
6
+ executing: z.string().optional(),
7
+ creative: z.string().optional(),
8
+ });
9
+
10
+ export const frameworkConfigSchema = z.object({
11
+ defaults: z.object({
12
+ thinking: z.string(),
13
+ executing: z.string(),
14
+ creative: z.string(),
15
+ }),
16
+ roles: z.record(z.string(), z.string()).default({}),
17
+ });
18
+
19
+ export const projectConfigSchema = z.object({
20
+ project: z.string().optional(),
21
+ stack: z.array(z.string()).default([]),
22
+ tasks: z.enum(["github-issues", "linear", "files", "none"]).default("none"),
23
+ docs_dir: z.string().default("docs/"),
24
+ autonomy: z
25
+ .enum(["supervised", "checkpoint", "autonomous"])
26
+ .default("checkpoint"),
27
+ deploy: z.string().optional(),
28
+ models: z
29
+ .object({
30
+ defaults: tierOverrideSchema.optional(),
31
+ roles: z.record(z.string(), z.string()).optional(),
32
+ })
33
+ .optional(),
34
+ roles: z.record(z.string(), z.enum(["disabled"])).optional(),
35
+ });
36
+
37
+ export type FrameworkConfig = z.infer<typeof frameworkConfigSchema>;
38
+ export type ProjectConfig = z.infer<typeof projectConfigSchema>;
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env bun
2
+ // src/mcp/server.ts
3
+
4
+ import { fileURLToPath } from "node:url";
5
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
6
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
7
+ import { z } from "zod";
8
+ import { loadFrameworkConfig, loadProjectConfig } from "../config/loader";
9
+ import { resolveModel } from "../models/resolver";
10
+ import type { Role } from "../models/types";
11
+ import { ROLES } from "../models/types";
12
+
13
+ const FRAMEWORK_ROOT = fileURLToPath(new URL("../../", import.meta.url));
14
+
15
+ export async function resolveModelForProject(
16
+ role: string,
17
+ projectRoot: string,
18
+ frameworkRoot = FRAMEWORK_ROOT,
19
+ ): Promise<string> {
20
+ if (!ROLES.includes(role as Role)) throw new Error(`Unknown role: ${role}`);
21
+ const [framework, project] = await Promise.all([
22
+ loadFrameworkConfig(frameworkRoot),
23
+ loadProjectConfig(projectRoot),
24
+ ]);
25
+ return resolveModel(role as Role, framework, project.models ?? {});
26
+ }
27
+
28
+ export function createMcpServer(): McpServer {
29
+ const server = new McpServer({
30
+ name: "agents-framework",
31
+ version: "0.1.0",
32
+ });
33
+
34
+ server.tool(
35
+ "resolve_model",
36
+ "Resolve the model for an agent role, applying project overrides",
37
+ {
38
+ role: z.string().describe("Agent role name"),
39
+ project_root: z.string().describe("Absolute path to target project root"),
40
+ },
41
+ async ({ role, project_root }) => {
42
+ try {
43
+ const model = await resolveModelForProject(role, project_root);
44
+ return { content: [{ type: "text", text: model }] };
45
+ } catch (err) {
46
+ const message = err instanceof Error ? err.message : String(err);
47
+ return { content: [{ type: "text", text: message }], isError: true };
48
+ }
49
+ },
50
+ );
51
+
52
+ return server;
53
+ }
54
+
55
+ // entrypoint when run directly
56
+ if (import.meta.main) {
57
+ const server = createMcpServer();
58
+ const transport = new StdioServerTransport();
59
+ await server.connect(transport);
60
+ }
@@ -0,0 +1,26 @@
1
+ // src/models/resolver.ts
2
+
3
+ import type { ModelsConfig, ProjectModelsOverride, Role } from "./types";
4
+ import { ROLE_TIERS } from "./types";
5
+
6
+ export function resolveModel(
7
+ role: Role,
8
+ framework: ModelsConfig,
9
+ project: ProjectModelsOverride = {},
10
+ ): string {
11
+ // 1. project role override
12
+ if (project.roles?.[role] !== undefined) return project.roles[role]!;
13
+
14
+ // 2. project tier default override
15
+ const tier = ROLE_TIERS[role];
16
+ if (project.defaults?.[tier] !== undefined) return project.defaults[tier]!;
17
+
18
+ // 3. framework role default
19
+ if (framework.roles[role] !== undefined) return framework.roles[role]!;
20
+
21
+ // 4. framework tier default
22
+ const result = framework.defaults[tier];
23
+ if (result === undefined)
24
+ throw new Error(`No model configured for tier "${tier}"`);
25
+ return result;
26
+ }
@@ -0,0 +1,44 @@
1
+ // src/models/types.ts
2
+ export const TIERS = ["thinking", "executing", "creative"] as const;
3
+ export type Tier = (typeof TIERS)[number];
4
+
5
+ export const ROLES = [
6
+ "orchestrator",
7
+ "architect",
8
+ "developer",
9
+ "reviewer",
10
+ "qa",
11
+ "devops",
12
+ "pm",
13
+ "explorer",
14
+ "fixer",
15
+ "seo",
16
+ "designer",
17
+ "marketing",
18
+ ] as const;
19
+ export type Role = (typeof ROLES)[number];
20
+
21
+ export const ROLE_TIERS: Record<Role, Tier> = {
22
+ orchestrator: "thinking",
23
+ architect: "thinking",
24
+ developer: "thinking",
25
+ reviewer: "thinking",
26
+ qa: "thinking",
27
+ devops: "thinking",
28
+ pm: "thinking",
29
+ explorer: "executing",
30
+ fixer: "executing",
31
+ seo: "executing",
32
+ designer: "creative",
33
+ marketing: "creative",
34
+ };
35
+
36
+ export interface ModelsConfig {
37
+ defaults: Record<Tier, string>;
38
+ roles: Partial<Record<Role, string>>;
39
+ }
40
+
41
+ export interface ProjectModelsOverride {
42
+ defaults?: Partial<Record<Tier, string>>;
43
+ roles?: Partial<Record<Role, string>>;
44
+ }
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env bun
2
+ // src/setup/index.ts
3
+
4
+ import { fileURLToPath } from "node:url";
5
+ import {
6
+ copyFile,
7
+ lstat,
8
+ mkdir,
9
+ readFile,
10
+ symlink,
11
+ writeFile,
12
+ } from "fs/promises";
13
+ import { join } from "path";
14
+
15
+ interface SetupOptions {
16
+ projectName: string;
17
+ stack?: string;
18
+ tasks?: string;
19
+ docsDir?: string;
20
+ autonomy?: string;
21
+ overwrite?: boolean;
22
+ }
23
+
24
+ export async function setupProject(
25
+ projectRoot: string,
26
+ frameworkRoot: string,
27
+ options: SetupOptions,
28
+ ): Promise<void> {
29
+ const { projectName, overwrite = false } = options;
30
+
31
+ const write = async (dest: string, content: string) => {
32
+ if (
33
+ !overwrite &&
34
+ (await lstat(dest).then(
35
+ () => true,
36
+ () => false,
37
+ ))
38
+ )
39
+ return;
40
+ await writeFile(dest, content, "utf-8");
41
+ };
42
+
43
+ const link = async (target: string, linkPath: string) => {
44
+ try {
45
+ await lstat(linkPath); // throws ENOENT if nothing exists at path
46
+ return; // something already exists (file, dir, or symlink) — skip
47
+ } catch (err) {
48
+ if ((err as NodeJS.ErrnoException).code !== "ENOENT") throw err;
49
+ }
50
+ await mkdir(join(linkPath, ".."), { recursive: true });
51
+ await symlink(target, linkPath);
52
+ };
53
+
54
+ // CLAUDE.md — one-liner import
55
+ await write(join(projectRoot, "CLAUDE.md"), "@./AGENTS.md\n");
56
+
57
+ // AGENTS.md — fill template
58
+ let agentsTpl: string;
59
+ let agentsYml: string;
60
+ try {
61
+ agentsTpl = await readFile(
62
+ join(frameworkRoot, "templates/AGENTS.md"),
63
+ "utf-8",
64
+ );
65
+ agentsYml = await readFile(
66
+ join(frameworkRoot, "templates/.agents.yml"),
67
+ "utf-8",
68
+ );
69
+ } catch (err) {
70
+ if ((err as NodeJS.ErrnoException).code === "ENOENT") {
71
+ throw new Error(
72
+ `agents framework templates not found at ${frameworkRoot}. Is FRAMEWORK_ROOT correct?`,
73
+ );
74
+ }
75
+ throw err;
76
+ }
77
+
78
+ agentsTpl = agentsTpl
79
+ .replaceAll("{{project_name}}", projectName)
80
+ .replaceAll("{{stack}}", options.stack ?? "")
81
+ .replaceAll("{{tasks}}", options.tasks ?? "none")
82
+ .replaceAll("{{docs_dir}}", options.docsDir ?? "docs/")
83
+ .replaceAll("{{autonomy}}", options.autonomy ?? "checkpoint");
84
+ await write(join(projectRoot, "AGENTS.md"), agentsTpl);
85
+
86
+ // .agents.yml — fill template
87
+ agentsYml = agentsYml.replaceAll("{{project_name}}", projectName);
88
+ await write(join(projectRoot, ".agents.yml"), agentsYml);
89
+
90
+ // symlink roles into .claude/agents and .opencode/agents
91
+ const rolesPath = join(frameworkRoot, "roles");
92
+ await link(rolesPath, join(projectRoot, ".claude/agents"));
93
+ await link(rolesPath, join(projectRoot, ".opencode/agents"));
94
+ }
95
+
96
+ // CLI entrypoint
97
+ if (import.meta.main) {
98
+ const projectRoot = process.cwd();
99
+ const projectName =
100
+ process.argv[2] ?? projectRoot.split("/").pop() ?? "project";
101
+ const frameworkRoot = fileURLToPath(new URL("../../", import.meta.url));
102
+ await setupProject(projectRoot, frameworkRoot, { projectName });
103
+ console.log(`agents framework set up in ${projectRoot}`);
104
+ }
@@ -0,0 +1,17 @@
1
+ project: {{project_name}}
2
+ stack: []
3
+ tasks: none # github-issues | linear | files | none
4
+ docs_dir: docs/
5
+ autonomy: checkpoint # supervised | checkpoint | autonomous
6
+ # deploy: vercel
7
+
8
+ # models:
9
+ # defaults:
10
+ # creative: google/gemini-2.5-pro
11
+ # roles:
12
+ # architect: openai/gpt-4.1
13
+ # explorer: local/qwen2.5-coder
14
+
15
+ # roles:
16
+ # seo: disabled
17
+ # marketing: disabled
@@ -0,0 +1,36 @@
1
+ # Agent Team
2
+
3
+ This project uses the agents framework. The full product team is available.
4
+
5
+ ## Project context
6
+ Project: {{project_name}}
7
+ Stack: {{stack}}
8
+ Tasks: {{tasks}}
9
+ Docs: {{docs_dir}}
10
+ Autonomy: {{autonomy}}
11
+
12
+ ## Team
13
+
14
+ @orchestrator coordinates all work. Address requests naturally — orchestrator delegates to the right specialists.
15
+
16
+ Invoke specialists directly when you know what you need:
17
+ - @explorer — find code
18
+ - @architect — design decisions
19
+ - @developer — implementation
20
+ - @reviewer — code review
21
+ - @qa — testing
22
+ - @devops — deployment
23
+ - @pm — specs
24
+ - @fixer — parallel tasks
25
+ - @designer — UI/UX
26
+ - @seo — search optimization
27
+ - @marketing — copy
28
+
29
+ ## Workflows
30
+ - New feature: `@orchestrator follow workflows/new-feature.md for: [description]`
31
+ - Bug fix: `@orchestrator follow workflows/bug-fix.md for: [description]`
32
+ - Deploy: `@orchestrator follow workflows/deploy.md`
33
+
34
+ ## Model resolution
35
+ Models configured in `.agents.yml`, resolved dynamically.
36
+ Override any role: add to `.agents.yml` under `models.roles`.
@@ -0,0 +1 @@
1
+ @./AGENTS.md
@@ -0,0 +1,18 @@
1
+ # Workflow: Bug Fix
2
+
3
+ ## Sequence
4
+ Explorer → QA (reproduce) → Developer → Reviewer → QA (verify) → DevOps
5
+
6
+ ## Steps
7
+
8
+ 1. **Explorer** locates relevant code
9
+ 2. **QA** reproduces bug, documents root cause hypothesis
10
+ 3. **Developer** implements fix
11
+ 4. **Reviewer** reviews fix (security-sensitive bugs get extra scrutiny)
12
+ 5. **QA** verifies fix, adds regression test
13
+ 6. **DevOps** deploys hotfix if critical
14
+
15
+ ## Checkpoint behavior
16
+ - `supervised`: pause at every step
17
+ - `checkpoint`: pause before deploy
18
+ - `autonomous`: pause only on errors
@@ -0,0 +1,22 @@
1
+ # Workflow: Deploy
2
+
3
+ ## Sequence
4
+ QA (verify) → [checkpoint] → DevOps
5
+
6
+ ## Steps
7
+
8
+ 1. **QA** confirms tests passing, acceptance criteria met
9
+ 2. **[checkpoint]** user confirms deploy
10
+ 3. **DevOps** executes deployment, monitors for errors, confirms success
11
+
12
+ ## Checkpoint behavior
13
+ - `supervised`: pause at every step
14
+ - `checkpoint`: pause at step 2 (user confirms deploy)
15
+ - `autonomous`: pause at step 2 (deploy always requires confirmation)
16
+
17
+ ## Pre-deploy checklist (DevOps verifies)
18
+ - [ ] All tests passing
19
+ - [ ] No secrets in code
20
+ - [ ] Rollback plan documented
21
+ - [ ] Env vars configured in target environment
22
+ - [ ] Migration scripts ready (if DB changes)
@@ -0,0 +1,23 @@
1
+ # Workflow: New Feature
2
+
3
+ ## Sequence
4
+ PM → [checkpoint] → Architect → [checkpoint] → Developer + Explorer (parallel) → Fixer (parallel tasks) → Reviewer → QA → [checkpoint] → DevOps
5
+
6
+ ## Steps
7
+
8
+ 1. **PM** writes spec with acceptance criteria
9
+ 2. **[checkpoint]** user approves spec
10
+ 3. **Architect** reviews spec, produces tech design + ADR if needed
11
+ 4. **[checkpoint]** user approves tech design
12
+ 5. **Explorer** maps relevant codebase areas (parallel with step 6 if safe)
13
+ 6. **Developer** implements against spec + tech design
14
+ 7. **Fixer** handles parallel well-defined subtasks (if any)
15
+ 8. **Reviewer** reviews PR
16
+ 9. **QA** verifies acceptance criteria, writes/runs tests
17
+ 10. **[checkpoint]** user approves for deploy
18
+ 11. **DevOps** deploys
19
+
20
+ ## Checkpoint behavior
21
+ - `supervised`: pause at every step
22
+ - `checkpoint`: pause at steps 2, 4, 10
23
+ - `autonomous`: pause only on errors
@@ -0,0 +1,22 @@
1
+ # Workflow: New Project
2
+
3
+ ## Sequence
4
+ PM → Architect → DevOps → Developer → Designer (if UI) → QA
5
+
6
+ ## Steps
7
+
8
+ 1. **PM** writes project spec, defines MVP scope
9
+ 2. **Architect** designs system architecture, chooses stack, documents ADRs
10
+ 3. **DevOps** sets up repo structure, CI/CD, environments
11
+ 4. **Developer** implements core scaffolding
12
+ 5. **Designer** establishes design system + component library (if UI project)
13
+ 6. **QA** sets up test infrastructure, writes first integration tests
14
+
15
+ ## Checkpoint behavior
16
+ - `supervised`: pause at every step
17
+ - `checkpoint`: pause after every step (new projects always fully checkpointed)
18
+ - `autonomous`: pause after every step (new projects always fully checkpointed)
19
+
20
+ ## Notes
21
+ - New projects bypass autonomy setting — all steps require approval
22
+ - Stack decisions require explicit user approval