@benzotti/jedi 0.1.41 → 0.1.43
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/dist/index.js +1 -1
- package/framework/agents/jdi-planner.md +59 -1
- package/framework/commands/create-plan.md +8 -7
- package/framework/commands/implement-plan.md +15 -12
- package/framework/components/meta/AgentBase.md +13 -0
- package/framework/components/meta/AgentRouter.md +230 -0
- package/framework/components/meta/AgentTeamsOrchestration.md +33 -7
- package/framework/components/meta/ComplexityRouter.md +23 -7
- package/framework/templates/PLAN-TASK.md +7 -0
- package/framework/templates/PLAN.md +7 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12791,7 +12791,7 @@ var stateCommand = defineCommand({
|
|
|
12791
12791
|
// package.json
|
|
12792
12792
|
var package_default = {
|
|
12793
12793
|
name: "@benzotti/jedi",
|
|
12794
|
-
version: "0.1.
|
|
12794
|
+
version: "0.1.43",
|
|
12795
12795
|
description: "JDI - Context-efficient AI development framework for Claude Code",
|
|
12796
12796
|
type: "module",
|
|
12797
12797
|
bin: {
|
|
@@ -4,7 +4,7 @@ description: Creates executable phase plans with task breakdown and dependency m
|
|
|
4
4
|
category: workflow
|
|
5
5
|
team: Product & Research
|
|
6
6
|
model: opus
|
|
7
|
-
requires_components: [TaskBreakdown, WaveComputation]
|
|
7
|
+
requires_components: [TaskBreakdown, WaveComputation, AgentRouter]
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# JDI Planner Agent
|
|
@@ -94,6 +94,28 @@ Never use time estimates. Use S/M/L sizing in task manifests and plan summaries.
|
|
|
94
94
|
4. Research: standard stack, architecture patterns, common pitfalls
|
|
95
95
|
5. Findings feed directly into planning (no separate RESEARCH.md)
|
|
96
96
|
|
|
97
|
+
### Step 0a: Agent Discovery (MANDATORY — read AgentRouter first)
|
|
98
|
+
|
|
99
|
+
<JDI:AgentRouter mode="discover" />
|
|
100
|
+
|
|
101
|
+
Before breaking down tasks, you MUST enumerate the Claude Code agents
|
|
102
|
+
available to this session by listing `.claude/agents/` (project-local, if it
|
|
103
|
+
exists) and `~/.claude/agents/` (user-global). Read each `.md` file's YAML
|
|
104
|
+
frontmatter and extract `name` and `description`. Project-local agents
|
|
105
|
+
override user-global agents on name collision.
|
|
106
|
+
|
|
107
|
+
This catalogue is written into the plan index frontmatter as `available_agents`
|
|
108
|
+
and is used in Step 3 to pin each task to a specialist via the `agent:` field
|
|
109
|
+
in its task file frontmatter.
|
|
110
|
+
|
|
111
|
+
If discovery returns zero specialists (no `.claude/agents/` on either root),
|
|
112
|
+
record `available_agents: []`, set `primary_agent: general-purpose`, and use
|
|
113
|
+
tech-stack defaults. Never silently skip this step — `available_agents` MUST
|
|
114
|
+
appear in the plan index even when empty.
|
|
115
|
+
|
|
116
|
+
See `.jdi/framework/components/meta/AgentRouter.md` for the full routing tables
|
|
117
|
+
(Unity / Unreal / Godot / non-game).
|
|
118
|
+
|
|
97
119
|
### Step 0b: Reference Analysis (when provided)
|
|
98
120
|
|
|
99
121
|
If the user provides reference PRs, tickets, or example implementations:
|
|
@@ -130,8 +152,35 @@ implementation_steps:
|
|
|
130
152
|
verification:
|
|
131
153
|
- {How to verify completion}
|
|
132
154
|
done_when: {Specific completion criterion}
|
|
155
|
+
agent: {specialist chosen via AgentRouter — e.g. unity-ui-specialist}
|
|
156
|
+
agent_rationale: {One sentence explaining why this specialist is the best fit}
|
|
133
157
|
```
|
|
134
158
|
|
|
159
|
+
### Step 3a: Agent Assignment (MANDATORY when available_agents is non-empty)
|
|
160
|
+
|
|
161
|
+
<JDI:AgentRouter mode="match" />
|
|
162
|
+
|
|
163
|
+
For every task produced in Step 3, pick exactly one specialist from the
|
|
164
|
+
`available_agents` catalogue discovered in Step 0a. Use the priority hierarchy
|
|
165
|
+
from `AgentRouter.md`:
|
|
166
|
+
|
|
167
|
+
1. Explicit user instruction
|
|
168
|
+
2. Files touched by the task (path patterns — e.g. `Assets/Scripts/UI/**`)
|
|
169
|
+
3. Task type + tech_stack
|
|
170
|
+
4. Task objective keywords
|
|
171
|
+
5. Checkpoint type (`checkpoint:human-verify` → `qa-tester`)
|
|
172
|
+
6. Tech-stack default
|
|
173
|
+
7. Fallback to `general-purpose`
|
|
174
|
+
|
|
175
|
+
Write the selection into each task file's frontmatter as `agent:` and a short
|
|
176
|
+
`agent_rationale:` explaining the choice. Also set `primary_agent` in the plan
|
|
177
|
+
index frontmatter to the first task's agent (or the most common one across all
|
|
178
|
+
tasks in single-agent mode).
|
|
179
|
+
|
|
180
|
+
**Forbidden:** inventing agent names not present in `available_agents`; routing
|
|
181
|
+
a task to an agent whose description clearly does not match (e.g. a shader
|
|
182
|
+
task to `narrative-director`); leaving `agent:` blank when specialists exist.
|
|
183
|
+
|
|
135
184
|
### Step 4: Dependency Analysis
|
|
136
185
|
|
|
137
186
|
<JDI:TaskBreakdown mode="dependencies" />
|
|
@@ -181,4 +230,13 @@ task_count: {n}
|
|
|
181
230
|
overall_size: S | M | L
|
|
182
231
|
wave: {assigned_wave}
|
|
183
232
|
provides: [what this plan delivers]
|
|
233
|
+
available_agents: [list of discovered Claude Code agents with name+description]
|
|
234
|
+
primary_agent: {agent chosen for single-agent mode}
|
|
235
|
+
task_agents:
|
|
236
|
+
- task_id: T1
|
|
237
|
+
agent: unity-ui-specialist
|
|
238
|
+
rationale: "Edits Canvas HUD — UI Toolkit expertise needed"
|
|
239
|
+
- task_id: T2
|
|
240
|
+
agent: gameplay-programmer
|
|
241
|
+
rationale: "Combat state machine work in Assets/Scripts/Combat"
|
|
184
242
|
```
|
|
@@ -19,20 +19,21 @@ Create an implementation plan using a single planner agent (includes research).
|
|
|
19
19
|
1. **Worktree** (if flagged): derive name from task, follow worktree.md steps, `cd` into `.worktrees/<name>`
|
|
20
20
|
2. Read codebase context (`.jdi/codebase/SUMMARY.md` if exists)
|
|
21
21
|
3. Read scaffolding (.jdi/PROJECT.yaml, REQUIREMENTS.yaml, ROADMAP.yaml) — create from templates if missing
|
|
22
|
-
4.
|
|
23
|
-
5.
|
|
24
|
-
6.
|
|
25
|
-
7.
|
|
22
|
+
4. **Agent Discovery (MANDATORY)** — before spawning the planner, enumerate available Claude Code agents by listing `.claude/agents/` (project-local) and `~/.claude/agents/` (user-global). Read each `.md` file's frontmatter for `name` and `description`. Pass the resulting catalogue into the planner's spawn prompt as `AVAILABLE_AGENTS` so it can pin specialists per task. If neither directory exists, pass an empty list. See `.jdi/framework/components/meta/AgentRouter.md` for the full routing rules.
|
|
23
|
+
5. Quick Mode Detection — suggest /jdi:quick for trivial tasks
|
|
24
|
+
6. Spawn `jdi-planner` agent (subagent_type="general-purpose") — creates split plan files (index .plan.md + per-task .T{n}.md files). The planner MUST write these files directly via Write tool (sandbox override for plan files). The planner MUST write the `available_agents` catalogue into the plan index frontmatter and pin an `agent:` field in every task file via AgentRouter.
|
|
25
|
+
7. Collect and execute deferred ops — if the agent returned `files_to_create`, create them now using Write tool. Verify split plan files exist: index `.plan.md` + individual `.T{n}.md` task files. Verify each task file's frontmatter contains an `agent:` field (unless `available_agents` is empty).
|
|
26
|
+
8. **Update state via CLI** — do NOT manually edit state.yaml. Run:
|
|
26
27
|
```bash
|
|
27
28
|
npx jdi state plan-ready --plan-path ".jdi/plans/{plan-file}" --plan-name "{plan name}"
|
|
28
29
|
```
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
9. **Present summary** (name, objective, task table including the assigned `agent:` per task, files) then ask: _"Provide feedback to refine, or say **approved** to finalise."_
|
|
31
|
+
10. **Review loop**: Feedback → revise plan in-place, increment revision, re-present summary. Repeat until approved. Approval → run `npx jdi state approved`, then **STOP**.
|
|
31
32
|
|
|
32
33
|
## HARD STOP — Planning Gate
|
|
33
34
|
|
|
34
35
|
After the user approves the plan, your work is **DONE**. Output: _"Plan approved and locked in. Let me know when you want to implement."_ Then **STOP completely**. Do NOT invoke `/jdi:implement-plan`, do NOT spawn implementation agents, do NOT begin writing source code. Planning and implementation are separate human-gated phases.
|
|
35
36
|
|
|
36
|
-
Agent base (read FIRST for cache): .jdi/framework/components/meta/AgentBase.md | Agent spec: .jdi/framework/agents/jdi-planner.md
|
|
37
|
+
Agent base (read FIRST for cache): .jdi/framework/components/meta/AgentBase.md | Agent spec: .jdi/framework/agents/jdi-planner.md | Agent routing: .jdi/framework/components/meta/AgentRouter.md
|
|
37
38
|
|
|
38
39
|
Feature to plan: $ARGUMENTS
|
|
@@ -14,22 +14,25 @@ Execute a PLAN.md with complexity-based routing.
|
|
|
14
14
|
## Orchestration
|
|
15
15
|
|
|
16
16
|
1. Read codebase context (`.jdi/codebase/SUMMARY.md` if exists)
|
|
17
|
-
2. Read plan index file and state.yaml — parse frontmatter for tasks, deps, waves, tech_stack
|
|
17
|
+
2. Read plan index file and state.yaml — parse frontmatter for tasks, deps, waves, tech_stack, `available_agents`, and `primary_agent`
|
|
18
18
|
3. **Read learnings:** Always read `.jdi/framework/learnings/general.md`. Then read domain-specific learnings based on tech_stack from plan frontmatter: PHP → `backend.md`, TS/React → `frontend.md`. Follow any conventions found — learnings override defaults.
|
|
19
19
|
4. **Format detection:** If frontmatter contains `task_files:`, this is a split plan — task details are in separate files. If absent, legacy monolithic plan — all tasks inline.
|
|
20
|
-
5. **
|
|
21
|
-
6. **
|
|
22
|
-
7.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
5. **Read per-task agents (MANDATORY for split plans)** — for every task file listed in `task_files`, read its frontmatter and record the `agent:` field. This is the `subagent_type` you will pass to the Task tool when spawning. Missing `agent:` → fall back to `primary_agent` → fall back to tech-stack default (`jdi-backend` / `jdi-frontend` / `general-purpose`). NEVER default everything to `general-purpose` silently. See `.jdi/framework/components/meta/AgentRouter.md`.
|
|
21
|
+
6. **Agent existence check** — for each pinned agent, confirm it is actually installed (`.claude/agents/{name}.md` project-local, or `~/.claude/agents/{name}.md` user-global). If it is NOT installed, downgrade to `general-purpose` and record a `agent_downgrade:` entry to surface in the summary. Never silently change the pin.
|
|
22
|
+
7. **Complexity routing** (`<JDI:ComplexityRouter />`): Simple (≤3 tasks, single stack/wave) → single agent. Complex → Agent Teams swarm. Override: `--team` / `--single`
|
|
23
|
+
8. **Tech routing (fallback only when no pins exist)**: PHP → jdi-backend | TS/React → jdi-frontend | Full-stack → both. Pins ALWAYS override this fallback.
|
|
24
|
+
9. Execute:
|
|
25
|
+
- **Single agent:** Spawn with `subagent_type: {plan.primary_agent}` (NOT `general-purpose`). Pass `PLAN: {index-path}`. For split plans, the agent reads task files one at a time via `file:` field in state.yaml.
|
|
26
|
+
- **Agent Teams:** For split plans, spawn ONE Task tool call per task with `subagent_type: {task.agent}` (the pin from the task file frontmatter), passing `TASK_FILE: {task-file-path}` so it loads only its assigned task. For legacy plans, pass `PLAN: {plan-path}` and use `primary_agent`.
|
|
27
|
+
- **Prompt scoping** — one task = one spawn. Never bundle multiple tasks into one prompt. Give exact file paths, cap exploration ("read only your TASK_FILE + its named targets"), and request short reports (<400 words). Agents can be truncated mid-task; scoped prompts survive the budget ceiling.
|
|
28
|
+
10. Collect and execute deferred ops (files, commits)
|
|
29
|
+
11. Run verification (tests, lint, typecheck)
|
|
30
|
+
12. **Update state via CLI** — do NOT manually edit state.yaml. Run `npx jdi state executing` before execution and `npx jdi state complete` after. Use `npx jdi state advance-task {task-id}` after each task completes.
|
|
31
|
+
13. **Present summary** (tasks completed, files changed, verification results, **which specialist ran which task**, any `agent_downgrade` events, deviations) then ask: _"Provide feedback to adjust, or say **approved** to finalise."_
|
|
32
|
+
14. **Review loop**: Feedback → apply code changes, run tests, increment revision, re-present. Approval → suggest commit/PR. Natural conversation — no separate command needed.
|
|
30
33
|
|
|
31
34
|
Agent base (read FIRST for cache): .jdi/framework/components/meta/AgentBase.md | Agent specs: .jdi/framework/agents/jdi-backend.md, .jdi/framework/agents/jdi-frontend.md
|
|
32
|
-
Orchestration: .jdi/framework/components/meta/AgentTeamsOrchestration.md | Routing: .jdi/framework/components/meta/ComplexityRouter.md
|
|
35
|
+
Orchestration: .jdi/framework/components/meta/AgentTeamsOrchestration.md | Routing: .jdi/framework/components/meta/ComplexityRouter.md | Agent routing: .jdi/framework/components/meta/AgentRouter.md
|
|
33
36
|
|
|
34
37
|
When spawning agents, detect project type and include a `## Project Context` block (type, tech stack, quality gates, working directory) in the spawn prompt. This saves agents 2-3 discovery tool calls.
|
|
35
38
|
|
|
@@ -11,6 +11,19 @@ Standards inherited by all JDI agents via `<JDI:AgentBase />`. Default loads Cor
|
|
|
11
11
|
- Batch file reads: issue all Read calls in a single turn rather than sequentially.
|
|
12
12
|
- Batch git operations: combine related commands into a single Bash call where possible.
|
|
13
13
|
|
|
14
|
+
## Budget Discipline
|
|
15
|
+
|
|
16
|
+
You have a finite per-invocation budget (tokens, tool calls, wall time). Long runs can be terminated mid-task before you produce your final report. To survive:
|
|
17
|
+
|
|
18
|
+
1. **Batch reads in parallel** — one turn with all Read calls, not sequential.
|
|
19
|
+
2. **Cap exploration** — read only the files your spawn prompt names. If more are needed, report what you need and stop rather than wandering.
|
|
20
|
+
3. **Write fixes before verifying** — Edit calls persist even if you are later truncated. Save the report for last.
|
|
21
|
+
4. **Short reports (<400 words)** — terse file list + one sentence per change. Long formal reports are where truncation bites.
|
|
22
|
+
5. **One concern per invocation** — address what was asked, do not expand scope.
|
|
23
|
+
6. **Don't re-read files you just edited** — the harness tracks state.
|
|
24
|
+
|
|
25
|
+
If your work exceeds one invocation, complete what you can, return a progress report naming exactly what remains, and let the orchestrator re-spawn you.
|
|
26
|
+
|
|
14
27
|
## Component Resolution
|
|
15
28
|
|
|
16
29
|
When a spec contains `<JDI:*>` tags:
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: AgentRouter
|
|
3
|
+
category: meta
|
|
4
|
+
description: Enumerate Claude Code agents and route tasks to the best specialist
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# AgentRouter
|
|
8
|
+
|
|
9
|
+
Enumerates the Claude Code agents available to the current session and routes
|
|
10
|
+
individual plan tasks to the most appropriate specialist. Used by `jdi-planner`
|
|
11
|
+
at plan-creation time to pin `agent:` into each task's frontmatter, and by
|
|
12
|
+
`implement-plan` (via `ComplexityRouter` and `AgentTeamsOrchestration`) at
|
|
13
|
+
execution time to honour those pins when spawning via the Task tool.
|
|
14
|
+
|
|
15
|
+
The point of this component is simple: **stop defaulting every subagent call to
|
|
16
|
+
`general-purpose`**. If the user has installed domain specialists (e.g.
|
|
17
|
+
`unity-specialist`, `unity-ui-specialist`, `gameplay-programmer`,
|
|
18
|
+
`godot-gdscript-specialist`, `ue-gas-specialist`), JDI plans must surface them
|
|
19
|
+
into the plan and implement-plan must use them.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 1. Agent Discovery (at plan time)
|
|
24
|
+
|
|
25
|
+
The planner MUST perform discovery before task breakdown. Merge two roots (the
|
|
26
|
+
project-local list overrides the user-global list on name collision):
|
|
27
|
+
|
|
28
|
+
1. `.claude/agents/*.md` — project-local specialists (highest priority)
|
|
29
|
+
2. `~/.claude/agents/*.md` — user-global specialists
|
|
30
|
+
|
|
31
|
+
For each `.md` file, read the YAML frontmatter and extract:
|
|
32
|
+
|
|
33
|
+
- `name` — the subagent_type value passed to the Task tool
|
|
34
|
+
- `description` — the one-line capability blurb used for routing decisions
|
|
35
|
+
- `model` (optional) — preferred model if specified
|
|
36
|
+
- `tools` (optional) — tool allowlist if the agent is tool-restricted
|
|
37
|
+
|
|
38
|
+
Agents whose frontmatter is unreadable or missing `name` are skipped.
|
|
39
|
+
|
|
40
|
+
Discovery command (reference — the planner may use `Glob` + `Read`):
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
ls ~/.claude/agents/ 2>/dev/null
|
|
44
|
+
ls .claude/agents/ 2>/dev/null
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The resulting catalogue MUST be written into the plan index frontmatter as
|
|
48
|
+
`available_agents:` (see `framework/templates/PLAN.md`) so reviewers and the
|
|
49
|
+
implement-plan pass can see exactly which agents were visible at plan time.
|
|
50
|
+
|
|
51
|
+
```yaml
|
|
52
|
+
available_agents:
|
|
53
|
+
- name: unity-specialist
|
|
54
|
+
description: Authority on Unity-specific patterns, APIs, and optimisation
|
|
55
|
+
- name: unity-ui-specialist
|
|
56
|
+
description: Unity UI Toolkit / UGUI / runtime UI performance
|
|
57
|
+
- name: gameplay-programmer
|
|
58
|
+
description: Implements game mechanics, player systems, combat
|
|
59
|
+
- name: qa-tester
|
|
60
|
+
description: Writes test cases, bug reports, regression checklists
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
If discovery returns zero agents (or `.claude/agents/` doesn't exist on either
|
|
64
|
+
root), the planner falls back to the legacy routing (tech-stack default:
|
|
65
|
+
`jdi-backend` or `jdi-frontend`) and records `available_agents: []` so it is
|
|
66
|
+
explicit rather than silent.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 2. Task-to-Agent Matching (at plan time)
|
|
71
|
+
|
|
72
|
+
For each task in the plan, the planner selects ONE primary agent using this
|
|
73
|
+
signal hierarchy (highest to lowest):
|
|
74
|
+
|
|
75
|
+
| Priority | Signal | Example |
|
|
76
|
+
|----------|--------|---------|
|
|
77
|
+
| 1 | Explicit user instruction | "use the unity-specialist for this task" |
|
|
78
|
+
| 2 | Files touched by the task | `Assets/Scripts/UI/**` → `unity-ui-specialist` |
|
|
79
|
+
| 3 | Task type + tech_stack | Unity C# gameplay → `gameplay-programmer` or `unity-specialist` |
|
|
80
|
+
| 4 | Task objective keywords | "shader", "VFX", "render pipeline" → `unity-shader-specialist` |
|
|
81
|
+
| 5 | Checkpoint type | `checkpoint:human-verify` → `qa-tester` |
|
|
82
|
+
| 6 | Tech-stack default | PHP → `jdi-backend`, TS/React → `jdi-frontend`, C#/Unity → `unity-specialist` |
|
|
83
|
+
| 7 | Fallback | `general-purpose` (only if no specialists exist) |
|
|
84
|
+
|
|
85
|
+
### Unity routing cheat sheet (common case for game projects)
|
|
86
|
+
|
|
87
|
+
| Signal | Preferred agent |
|
|
88
|
+
|--------|-----------------|
|
|
89
|
+
| `Assets/Scripts/**/UI/**` or TMPro/UGUI/UI Toolkit references | `unity-ui-specialist` |
|
|
90
|
+
| `Assets/Scripts/**/DOTS/**` or Jobs/Burst/ECS references | `unity-dots-specialist` |
|
|
91
|
+
| Shader Graph, HLSL, VFX Graph, render pipeline | `unity-shader-specialist` |
|
|
92
|
+
| Addressables, asset bundles, memory budgets | `unity-addressables-specialist` |
|
|
93
|
+
| Gameplay mechanics, combat, movement, abilities | `gameplay-programmer` |
|
|
94
|
+
| AI, behaviour trees, pathfinding, perception | `ai-programmer` |
|
|
95
|
+
| Core engine/framework, performance-critical systems | `engine-programmer` or `performance-analyst` |
|
|
96
|
+
| General Unity API guidance, bootstrapping, subsystem integration | `unity-specialist` |
|
|
97
|
+
| Tests, QA checklists, regression scripts | `qa-tester` |
|
|
98
|
+
| Any task that edits code — no better specialist available | `gameplay-programmer` (games) or `general-purpose` (non-game) |
|
|
99
|
+
|
|
100
|
+
### Unreal routing cheat sheet
|
|
101
|
+
|
|
102
|
+
| Signal | Preferred agent |
|
|
103
|
+
|--------|-----------------|
|
|
104
|
+
| Blueprints and Blueprint architecture | `ue-blueprint-specialist` |
|
|
105
|
+
| UMG / CommonUI widgets | `ue-umg-specialist` |
|
|
106
|
+
| Gameplay Ability System, abilities, attribute sets | `ue-gas-specialist` |
|
|
107
|
+
| Replication, RPCs, prediction | `ue-replication-specialist` |
|
|
108
|
+
| General UE API and subsystem guidance | `unreal-specialist` |
|
|
109
|
+
|
|
110
|
+
### Godot routing cheat sheet
|
|
111
|
+
|
|
112
|
+
| Signal | Preferred agent |
|
|
113
|
+
|--------|-----------------|
|
|
114
|
+
| GDScript code, typed signals, node architecture | `godot-gdscript-specialist` |
|
|
115
|
+
| GDExtension / C++ / Rust bindings | `godot-gdextension-specialist` |
|
|
116
|
+
| Godot shading language, visual shaders, particles | `godot-shader-specialist` |
|
|
117
|
+
| General Godot API and node/scene guidance | `godot-specialist` |
|
|
118
|
+
|
|
119
|
+
### Non-game defaults
|
|
120
|
+
|
|
121
|
+
| Signal | Preferred agent |
|
|
122
|
+
|--------|-----------------|
|
|
123
|
+
| PHP backend | `jdi-backend` |
|
|
124
|
+
| TypeScript / React frontend | `jdi-frontend` |
|
|
125
|
+
| Full-stack | `jdi-backend` + `jdi-frontend` |
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## 3. Output Format (written into plan files)
|
|
130
|
+
|
|
131
|
+
### Plan index (`{phase}-{plan}-{slug}.plan.md`) frontmatter
|
|
132
|
+
|
|
133
|
+
```yaml
|
|
134
|
+
available_agents:
|
|
135
|
+
- name: unity-specialist
|
|
136
|
+
description: ...
|
|
137
|
+
- name: gameplay-programmer
|
|
138
|
+
description: ...
|
|
139
|
+
|
|
140
|
+
# Primary agent for single-agent mode (first task's agent, or most common)
|
|
141
|
+
primary_agent: unity-specialist
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Task file (`{phase}-{plan}-{slug}.T{n}.md`) frontmatter
|
|
145
|
+
|
|
146
|
+
```yaml
|
|
147
|
+
agent: unity-ui-specialist # REQUIRED when available_agents is non-empty
|
|
148
|
+
agent_rationale: "Edits Canvas-based HUD — UI Toolkit expertise needed"
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`agent_rationale` is a short free-text note explaining WHY the planner picked
|
|
152
|
+
this specialist. Reviewers can use it to challenge bad routings.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## 4. Execution (at implement-plan time)
|
|
157
|
+
|
|
158
|
+
`implement-plan` MUST read the task's `agent:` field from each task file and
|
|
159
|
+
pass it as `subagent_type` when spawning via the Task tool.
|
|
160
|
+
|
|
161
|
+
### Single-agent mode
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
Task(
|
|
165
|
+
subagent_type: "{plan.primary_agent}", # NOT "general-purpose"
|
|
166
|
+
name: "{plan.primary_agent}",
|
|
167
|
+
prompt: "<standard single-agent spawn prompt from ComplexityRouter>"
|
|
168
|
+
)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
If `plan.primary_agent` is missing (legacy plan or empty `available_agents`),
|
|
172
|
+
fall back to `general-purpose` with a `jdi-backend` / `jdi-frontend` spec load.
|
|
173
|
+
|
|
174
|
+
### Agent-teams mode
|
|
175
|
+
|
|
176
|
+
For each task, read its `agent:` frontmatter field and spawn ONE Task tool call
|
|
177
|
+
per task with `subagent_type` set to that value:
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
Task(
|
|
181
|
+
subagent_type: "{task.agent}", # per-task specialist
|
|
182
|
+
name: "{task.agent}-{task_id}",
|
|
183
|
+
prompt: "<spawn prompt from AgentTeamsOrchestration with TASK_FILE: {task file}>"
|
|
184
|
+
)
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Tasks with no `agent:` field fall back to the tech-stack default
|
|
188
|
+
(`jdi-backend` / `jdi-frontend` / `general-purpose`).
|
|
189
|
+
|
|
190
|
+
### Mixed fallbacks
|
|
191
|
+
|
|
192
|
+
- If the discovered specialist name does NOT match a valid subagent type in the
|
|
193
|
+
current session (e.g. plan was created on a different machine), downgrade to
|
|
194
|
+
`general-purpose` and log a warning in the implement-plan summary: `agent
|
|
195
|
+
downgrade: {planned} → general-purpose (not installed)`.
|
|
196
|
+
- Never silently change the pin; always surface downgrades in the summary.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## 5. Validation Rules
|
|
201
|
+
|
|
202
|
+
The planner MUST NOT:
|
|
203
|
+
|
|
204
|
+
1. Invent agent names that are not in `available_agents`.
|
|
205
|
+
2. Route a task to an agent whose description clearly does not match the task
|
|
206
|
+
(e.g. `narrative-director` for a shader task).
|
|
207
|
+
3. Leave `agent:` blank when `available_agents` is non-empty.
|
|
208
|
+
|
|
209
|
+
The implement-plan pass MUST:
|
|
210
|
+
|
|
211
|
+
1. Read `agent:` from every task file before spawning.
|
|
212
|
+
2. Surface any downgrade in the summary.
|
|
213
|
+
3. Prefer project-local `.claude/agents/` over `~/.claude/agents/` on name
|
|
214
|
+
collision.
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Usage
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
<JDI:AgentRouter mode="discover" /> # at plan time — enumerate + match
|
|
222
|
+
<JDI:AgentRouter mode="spawn" /> # at implement time — honour pins
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Referenced by:
|
|
226
|
+
- `framework/agents/jdi-planner.md` (discover + match)
|
|
227
|
+
- `framework/components/meta/ComplexityRouter.md` (spawn)
|
|
228
|
+
- `framework/components/meta/AgentTeamsOrchestration.md` (spawn)
|
|
229
|
+
- `framework/commands/create-plan.md` (discover)
|
|
230
|
+
- `framework/commands/implement-plan.md` (spawn)
|
|
@@ -8,38 +8,60 @@ description: Agent Teams orchestration quick-reference
|
|
|
8
8
|
|
|
9
9
|
## Core Pattern (6 Steps)
|
|
10
10
|
|
|
11
|
-
1. **Pre-flight** — Read command spec, `<JDI:CodebaseContext />`, read state.yaml, set status to "executing"
|
|
11
|
+
1. **Pre-flight** — Read command spec, `<JDI:CodebaseContext />`, read state.yaml, set status to "executing". Read each task file's `agent:` frontmatter field so you know which specialist to spawn per task (see `.jdi/framework/components/meta/AgentRouter.md`).
|
|
12
12
|
2. **Create Team** — `TeamCreate(team_name: "{team-name}")`
|
|
13
13
|
3. **Create Tasks** — TaskCreate per work unit, set `addBlockedBy` dependencies
|
|
14
|
-
4. **Spawn Teammates** — Task tool with `subagent_type: "general-purpose
|
|
14
|
+
4. **Spawn Teammates** — Task tool with `subagent_type: "{task.agent}"` (the pin from the task file frontmatter — e.g. `unity-ui-specialist`, `gameplay-programmer`). Never hardcode `general-purpose` when a pin exists. Verify the pinned agent is installed before spawning; if not, downgrade to `general-purpose` and record `agent_downgrade:` in the summary. Include in prompt: agent spec path, team context, task assignments. **Scope tightly** — one task per spawn, exact file targets, capped exploration, short reports (<400 words). See `AgentBase.md` § Budget Discipline.
|
|
15
15
|
5. **Coordinate** — Automatic message delivery for results, TaskList to monitor, SendMessage to guide/unblock
|
|
16
|
-
6. **Cleanup** — shutdown_request to all → TeamDelete → set status "complete" → report
|
|
16
|
+
6. **Cleanup** — shutdown_request to all → TeamDelete → set status "complete" → report (include which specialist ran which task and any downgrade events)
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
20
20
|
## Task Routing Table
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
**Primary source of truth:** each task's `agent:` frontmatter field, assigned
|
|
23
|
+
by `jdi-planner` via `AgentRouter` at plan time. The table below is the
|
|
24
|
+
**fallback** used only when a task has no pin (legacy plans or empty
|
|
25
|
+
`available_agents`).
|
|
26
|
+
|
|
27
|
+
| Task Stack (fallback) | Agent(s) | Spawn Count |
|
|
23
28
|
|-----------|----------|-------------|
|
|
24
29
|
| PHP only | jdi-backend | 1 |
|
|
25
30
|
| TS/React only | jdi-frontend | 1 |
|
|
26
31
|
| Full-stack | jdi-backend + jdi-frontend | 2 |
|
|
27
32
|
| Config/docs | jdi-backend (default) | 1 |
|
|
28
33
|
|
|
34
|
+
**Examples of honouring pins** (real values — not fallbacks):
|
|
35
|
+
|
|
36
|
+
| Task pin | Subagent type passed to Task tool |
|
|
37
|
+
|----------|-----------------------------------|
|
|
38
|
+
| `agent: unity-specialist` | `unity-specialist` |
|
|
39
|
+
| `agent: unity-ui-specialist` | `unity-ui-specialist` |
|
|
40
|
+
| `agent: gameplay-programmer` | `gameplay-programmer` |
|
|
41
|
+
| `agent: qa-tester` | `qa-tester` |
|
|
42
|
+
| `agent: ue-gas-specialist` | `ue-gas-specialist` |
|
|
43
|
+
| `agent: godot-gdscript-specialist` | `godot-gdscript-specialist` |
|
|
44
|
+
|
|
29
45
|
---
|
|
30
46
|
|
|
31
47
|
## Specialist Spawn Prompt Template (~200 tokens)
|
|
32
48
|
|
|
33
49
|
```
|
|
34
|
-
You are {agent
|
|
50
|
+
You are {task.agent}. Your Claude Code agent definition has already been
|
|
51
|
+
loaded from .claude/agents/{task.agent}.md (or ~/.claude/agents/{task.agent}.md)
|
|
52
|
+
— follow it. Also read .jdi/framework/components/meta/AgentBase.md for the
|
|
53
|
+
JDI base protocol. If your Claude Code agent definition has requires_components
|
|
54
|
+
in frontmatter, batch-read them before starting.
|
|
35
55
|
|
|
36
56
|
TEAM: {team-name}
|
|
37
57
|
PLAN: {plan-path}
|
|
38
58
|
TASK_FILE: {task-file-path}
|
|
39
59
|
WORKING_DIR: {working-directory}
|
|
40
60
|
|
|
41
|
-
Read your TASK_FILE for task details (objective, files, steps, verification
|
|
42
|
-
|
|
61
|
+
Read your TASK_FILE for task details (objective, files, steps, verification,
|
|
62
|
+
and the `agent_rationale` explaining why you were picked for this task).
|
|
63
|
+
If TASK_FILE is not provided (legacy plan), claim tasks from TaskList and read
|
|
64
|
+
task details from the PLAN file.
|
|
43
65
|
|
|
44
66
|
1. Implement using Edit tool
|
|
45
67
|
2. SendMessage to coordinator with structured return
|
|
@@ -49,6 +71,10 @@ Report: files_modified, files_to_create, commits_pending.
|
|
|
49
71
|
No git commit (use commits_pending).
|
|
50
72
|
```
|
|
51
73
|
|
|
74
|
+
The `subagent_type` passed to the Task tool is the `agent:` pin from the task
|
|
75
|
+
file frontmatter — NOT `general-purpose`. See
|
|
76
|
+
`.jdi/framework/components/meta/AgentRouter.md` for full rules.
|
|
77
|
+
|
|
52
78
|
---
|
|
53
79
|
|
|
54
80
|
## Deferred Operations Checklist
|
|
@@ -37,15 +37,24 @@ reasoning: "{why this mode was chosen}"
|
|
|
37
37
|
|
|
38
38
|
## Single-Agent Mode
|
|
39
39
|
|
|
40
|
-
Spawn one specialist agent directly via Task tool. Follow cache-optimised load
|
|
40
|
+
Spawn one specialist agent directly via Task tool. Follow cache-optimised load
|
|
41
|
+
order (AgentBase first).
|
|
42
|
+
|
|
43
|
+
**Pinning rule:** read `primary_agent` from the plan index frontmatter. If set
|
|
44
|
+
and the agent is installed (verify against `.claude/agents/{name}.md` or
|
|
45
|
+
`~/.claude/agents/{name}.md`), use it as the `subagent_type`. If unset or not
|
|
46
|
+
installed, fall back to `general-purpose` and record a `agent_downgrade:` note
|
|
47
|
+
in the summary. Never silently default to `general-purpose` when a pin exists.
|
|
48
|
+
See `.jdi/framework/components/meta/AgentRouter.md`.
|
|
41
49
|
|
|
42
50
|
```
|
|
43
51
|
Task(
|
|
44
|
-
subagent_type: "
|
|
45
|
-
name: "{primary_agent}",
|
|
46
|
-
prompt: "
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
subagent_type: "{plan.primary_agent}", # e.g. unity-specialist — NOT hardcoded
|
|
53
|
+
name: "{plan.primary_agent}",
|
|
54
|
+
prompt: "You are {plan.primary_agent}. Your Claude Code agent definition has
|
|
55
|
+
already been loaded from .claude/agents/{name}.md (or ~/.claude/agents/{name}.md)
|
|
56
|
+
— follow it. Also read .jdi/framework/components/meta/AgentBase.md for the
|
|
57
|
+
JDI base protocol.
|
|
49
58
|
|
|
50
59
|
## Project Context
|
|
51
60
|
- Type: {project_type}
|
|
@@ -55,13 +64,20 @@ If your spec has requires_components in frontmatter, batch-read all listed compo
|
|
|
55
64
|
|
|
56
65
|
## Task
|
|
57
66
|
Execute all tasks in the plan sequentially. PLAN: {plan-path}.
|
|
58
|
-
For split plans (task_files in frontmatter), read each task file one at a time
|
|
67
|
+
For split plans (task_files in frontmatter), read each task file one at a time
|
|
68
|
+
from the file: field in state.yaml.
|
|
59
69
|
Report: files_modified, files_to_create, commits_pending."
|
|
60
70
|
)
|
|
61
71
|
```
|
|
62
72
|
|
|
63
73
|
No TeamCreate, no TaskCreate, no cross-agent coordination.
|
|
64
74
|
|
|
75
|
+
### Legacy fallback (no pins)
|
|
76
|
+
|
|
77
|
+
When `primary_agent` is missing or empty (legacy plan with no AgentRouter
|
|
78
|
+
discovery), use `subagent_type: "general-purpose"` and load the jdi-backend /
|
|
79
|
+
jdi-frontend spec inside the prompt as before.
|
|
80
|
+
|
|
65
81
|
---
|
|
66
82
|
|
|
67
83
|
## Agent Teams Mode
|
|
@@ -5,6 +5,13 @@ task_name: {Task Name}
|
|
|
5
5
|
type: auto
|
|
6
6
|
wave: 1
|
|
7
7
|
depends_on: []
|
|
8
|
+
|
|
9
|
+
# Agent routing (written by jdi-planner via AgentRouter — see
|
|
10
|
+
# framework/components/meta/AgentRouter.md). implement-plan reads `agent` and
|
|
11
|
+
# passes it as `subagent_type` when spawning via the Task tool. `agent_rationale`
|
|
12
|
+
# is a human-readable justification so reviewers can challenge the pick.
|
|
13
|
+
agent: general-purpose
|
|
14
|
+
agent_rationale: "{Why this specialist was chosen}"
|
|
8
15
|
---
|
|
9
16
|
|
|
10
17
|
# Task {n}: {Task Name}
|
|
@@ -30,6 +30,13 @@ tags: [tag1, tag2, tag3]
|
|
|
30
30
|
tech_stack:
|
|
31
31
|
added: []
|
|
32
32
|
patterns: []
|
|
33
|
+
|
|
34
|
+
# Agent Routing (populated by jdi-planner via AgentRouter)
|
|
35
|
+
# available_agents is the catalogue discovered from .claude/agents/ at plan time.
|
|
36
|
+
# primary_agent is used by single-agent mode in implement-plan.
|
|
37
|
+
# Per-task agents live in each {slug}.T{n}.md file under `agent:`.
|
|
38
|
+
available_agents: []
|
|
39
|
+
primary_agent: general-purpose
|
|
33
40
|
---
|
|
34
41
|
|
|
35
42
|
# Phase {X} Plan {YY}: {Plan Name}
|