@benzotti/jdi 0.1.46
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 +431 -0
- package/action/action.yml +116 -0
- package/action/workflow-template.yml +242 -0
- package/dist/index.js +12860 -0
- package/framework/adapters/generic.yaml +23 -0
- package/framework/adapters/laravel.yaml +46 -0
- package/framework/adapters/nextjs.yaml +36 -0
- package/framework/adapters/node.yaml +29 -0
- package/framework/agents/jdi-architect.md +147 -0
- package/framework/agents/jdi-backend.md +79 -0
- package/framework/agents/jdi-codebase-mapper.md +59 -0
- package/framework/agents/jdi-committer.md +83 -0
- package/framework/agents/jdi-debugger.md +73 -0
- package/framework/agents/jdi-devops.md +78 -0
- package/framework/agents/jdi-feedback-learner.md +93 -0
- package/framework/agents/jdi-frontend.md +78 -0
- package/framework/agents/jdi-head-engineering.md +30 -0
- package/framework/agents/jdi-perf-analyst.md +116 -0
- package/framework/agents/jdi-phase-researcher.md +59 -0
- package/framework/agents/jdi-plan-checker.md +80 -0
- package/framework/agents/jdi-planner.md +271 -0
- package/framework/agents/jdi-pr-feedback.md +120 -0
- package/framework/agents/jdi-pr-generator.md +100 -0
- package/framework/agents/jdi-producer.md +196 -0
- package/framework/agents/jdi-product-lead.md +44 -0
- package/framework/agents/jdi-programmer.md +104 -0
- package/framework/agents/jdi-qa-tester.md +113 -0
- package/framework/agents/jdi-quality.md +106 -0
- package/framework/agents/jdi-researcher.md +70 -0
- package/framework/agents/jdi-security.md +118 -0
- package/framework/agents/jdi-ux-designer.md +78 -0
- package/framework/agents/jdi-verifier.md +80 -0
- package/framework/commands/build.md +148 -0
- package/framework/commands/commit.md +71 -0
- package/framework/commands/create-plan.md +192 -0
- package/framework/commands/generate-pr.md +91 -0
- package/framework/commands/implement-plan.md +218 -0
- package/framework/commands/init.md +65 -0
- package/framework/commands/pr-feedback.md +75 -0
- package/framework/commands/pr-review.md +92 -0
- package/framework/commands/quick.md +124 -0
- package/framework/commands/status.md +13 -0
- package/framework/commands/worktree-remove.md +32 -0
- package/framework/commands/worktree.md +52 -0
- package/framework/components/execution/CodebaseContext.md +36 -0
- package/framework/components/execution/Commit.md +121 -0
- package/framework/components/execution/Verify.md +140 -0
- package/framework/components/execution/VerifyAdvanced.md +43 -0
- package/framework/components/meta/AgentBase.md +121 -0
- package/framework/components/meta/AgentRouter.md +318 -0
- package/framework/components/meta/AgentTeamsOrchestration.md +115 -0
- package/framework/components/meta/ComplexityRouter.md +116 -0
- package/framework/components/meta/SilentDiscovery.md +79 -0
- package/framework/components/meta/StateUpdate.md +56 -0
- package/framework/components/meta/StrictnessProtocol.md +60 -0
- package/framework/components/meta/TeamRouter.md +86 -0
- package/framework/components/planning/TaskBreakdown.md +95 -0
- package/framework/components/planning/WaveComputation.md +59 -0
- package/framework/components/quality/PRReview.md +225 -0
- package/framework/config/jdi-config.yaml +159 -0
- package/framework/config/state.yaml +72 -0
- package/framework/config/variables.yaml +43 -0
- package/framework/hooks/checkpoint.md +196 -0
- package/framework/hooks/jdi-worktree-cleanup.md +123 -0
- package/framework/hooks/lint-fix-frontend.md +59 -0
- package/framework/hooks/on-pause.md +213 -0
- package/framework/hooks/pre-commit.md +143 -0
- package/framework/jdi.md +336 -0
- package/framework/learnings/backend.md +3 -0
- package/framework/learnings/devops.md +3 -0
- package/framework/learnings/frontend.md +3 -0
- package/framework/learnings/general.md +3 -0
- package/framework/learnings/testing.md +3 -0
- package/framework/rules/commit-rules.md +24 -0
- package/framework/rules/deviation-rules.md +221 -0
- package/framework/teams/devops.md +26 -0
- package/framework/teams/engineering.md +29 -0
- package/framework/teams/micro-management.md +26 -0
- package/framework/teams/product-research.md +29 -0
- package/framework/teams/quality-assurance.md +27 -0
- package/framework/templates/CLAUDE-SHARED.md +60 -0
- package/framework/templates/PLAN-TASK.md +35 -0
- package/framework/templates/PLAN.md +158 -0
- package/framework/templates/PROJECT.yaml +16 -0
- package/framework/templates/REQUIREMENTS.yaml +27 -0
- package/framework/templates/ROADMAP.yaml +24 -0
- package/framework/templates/SUMMARY.md +201 -0
- package/framework/workflows/README.md +87 -0
- package/package.json +40 -0
|
@@ -0,0 +1,318 @@
|
|
|
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. JDI specialists live
|
|
26
|
+
in the framework itself, not in Claude Code's subagent registry — the
|
|
27
|
+
orchestrator reads their specs and injects identity via prompt text when
|
|
28
|
+
spawning (see `framework/jdi.md` Critical Constraints).
|
|
29
|
+
|
|
30
|
+
Merge these roots in order (earlier roots override later ones on name
|
|
31
|
+
collision):
|
|
32
|
+
|
|
33
|
+
1. `.jdi/framework/agents/jdi-*.md` — JDI specialists installed in the project
|
|
34
|
+
(primary source for any project using JDI). When working on the JDI repo
|
|
35
|
+
itself, fall back to `framework/agents/jdi-*.md` in the repo root.
|
|
36
|
+
2. `.claude/agents/*.md` — project-local Claude Code subagents (user-added
|
|
37
|
+
specialists, takes precedence over user-global)
|
|
38
|
+
3. `~/.claude/agents/*.md` — user-global Claude Code subagents
|
|
39
|
+
|
|
40
|
+
For each `.md` file, read the YAML frontmatter and extract:
|
|
41
|
+
|
|
42
|
+
- `name` — identity used in the spawn prompt (JDI agents) or as the
|
|
43
|
+
`subagent_type` value (Claude Code registered subagents)
|
|
44
|
+
- `description` — the one-line capability blurb used for routing decisions
|
|
45
|
+
- `model` (optional) — preferred model if specified
|
|
46
|
+
- `tools` (optional) — tool allowlist if the agent is tool-restricted
|
|
47
|
+
|
|
48
|
+
Record each entry with a `source:` field so `implement-plan` knows how to spawn
|
|
49
|
+
it: `jdi` for JDI framework specialists, `claude-code` for registered
|
|
50
|
+
subagents. Agents whose frontmatter is unreadable or missing `name` are skipped.
|
|
51
|
+
|
|
52
|
+
Discovery commands (reference — the planner uses `Glob` + `Read`):
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
ls .jdi/framework/agents/jdi-*.md 2>/dev/null || ls framework/agents/jdi-*.md 2>/dev/null
|
|
56
|
+
ls .claude/agents/ 2>/dev/null
|
|
57
|
+
ls ~/.claude/agents/ 2>/dev/null
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The resulting catalogue MUST be written into the plan index frontmatter as
|
|
61
|
+
`available_agents:` (see `framework/templates/PLAN.md`) so reviewers and the
|
|
62
|
+
implement-plan pass can see exactly which agents were visible at plan time.
|
|
63
|
+
|
|
64
|
+
```yaml
|
|
65
|
+
available_agents:
|
|
66
|
+
- name: jdi-backend
|
|
67
|
+
source: jdi
|
|
68
|
+
description: PHP/Laravel backend specialist — APIs, migrations, contracts
|
|
69
|
+
- name: jdi-frontend
|
|
70
|
+
source: jdi
|
|
71
|
+
description: TS/React frontend specialist — components, types, client code
|
|
72
|
+
- name: jdi-qa-tester
|
|
73
|
+
source: jdi
|
|
74
|
+
description: Post-task verification, a11y, contract checks
|
|
75
|
+
- name: unity-specialist
|
|
76
|
+
source: claude-code
|
|
77
|
+
description: Unity API patterns and optimisation (user-added)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
If discovery returns zero agents (no JDI install and no `.claude/agents/`),
|
|
81
|
+
the planner records `available_agents: []` and falls back to the legacy
|
|
82
|
+
tech-stack default (`jdi-backend` / `jdi-frontend` / `general-purpose`) so
|
|
83
|
+
the empty state is explicit rather than silent.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## 2. Task-to-Agent Matching (at plan time)
|
|
88
|
+
|
|
89
|
+
For each task in the plan, the planner selects ONE primary agent using this
|
|
90
|
+
signal hierarchy (highest to lowest):
|
|
91
|
+
|
|
92
|
+
| Priority | Signal | Example |
|
|
93
|
+
|----------|--------|---------|
|
|
94
|
+
| 1 | Explicit user instruction | "use the unity-specialist for this task" |
|
|
95
|
+
| 2 | Files touched by the task | `Assets/Scripts/UI/**` → `unity-ui-specialist` |
|
|
96
|
+
| 3 | Task type + tech_stack | Unity C# gameplay → `gameplay-programmer` or `unity-specialist` |
|
|
97
|
+
| 4 | Task objective keywords | "shader", "VFX", "render pipeline" → `unity-shader-specialist` |
|
|
98
|
+
| 5 | Checkpoint type | `checkpoint:human-verify` → `qa-tester` |
|
|
99
|
+
| 6 | Tech-stack default | PHP → `jdi-backend`, TS/React → `jdi-frontend`, C#/Unity → `unity-specialist` |
|
|
100
|
+
| 7 | Fallback | `general-purpose` (only if no specialists exist) |
|
|
101
|
+
|
|
102
|
+
### Unity routing cheat sheet (common case for game projects)
|
|
103
|
+
|
|
104
|
+
| Signal | Preferred agent |
|
|
105
|
+
|--------|-----------------|
|
|
106
|
+
| `Assets/Scripts/**/UI/**` or TMPro/UGUI/UI Toolkit references | `unity-ui-specialist` |
|
|
107
|
+
| `Assets/Scripts/**/DOTS/**` or Jobs/Burst/ECS references | `unity-dots-specialist` |
|
|
108
|
+
| Shader Graph, HLSL, VFX Graph, render pipeline | `unity-shader-specialist` |
|
|
109
|
+
| Addressables, asset bundles, memory budgets | `unity-addressables-specialist` |
|
|
110
|
+
| Gameplay mechanics, combat, movement, abilities | `gameplay-programmer` |
|
|
111
|
+
| AI, behaviour trees, pathfinding, perception | `ai-programmer` |
|
|
112
|
+
| Core engine/framework, performance-critical systems | `engine-programmer` or `performance-analyst` |
|
|
113
|
+
| General Unity API guidance, bootstrapping, subsystem integration | `unity-specialist` |
|
|
114
|
+
| Tests, QA checklists, regression scripts | `qa-tester` |
|
|
115
|
+
| Any task that edits code — no better specialist available | `gameplay-programmer` (games) or `general-purpose` (non-game) |
|
|
116
|
+
|
|
117
|
+
### Unreal routing cheat sheet
|
|
118
|
+
|
|
119
|
+
| Signal | Preferred agent |
|
|
120
|
+
|--------|-----------------|
|
|
121
|
+
| Blueprints and Blueprint architecture | `ue-blueprint-specialist` |
|
|
122
|
+
| UMG / CommonUI widgets | `ue-umg-specialist` |
|
|
123
|
+
| Gameplay Ability System, abilities, attribute sets | `ue-gas-specialist` |
|
|
124
|
+
| Replication, RPCs, prediction | `ue-replication-specialist` |
|
|
125
|
+
| General UE API and subsystem guidance | `unreal-specialist` |
|
|
126
|
+
|
|
127
|
+
### Godot routing cheat sheet
|
|
128
|
+
|
|
129
|
+
| Signal | Preferred agent |
|
|
130
|
+
|--------|-----------------|
|
|
131
|
+
| GDScript code, typed signals, node architecture | `godot-gdscript-specialist` |
|
|
132
|
+
| GDExtension / C++ / Rust bindings | `godot-gdextension-specialist` |
|
|
133
|
+
| Godot shading language, visual shaders, particles | `godot-shader-specialist` |
|
|
134
|
+
| General Godot API and node/scene guidance | `godot-specialist` |
|
|
135
|
+
|
|
136
|
+
### Non-game defaults
|
|
137
|
+
|
|
138
|
+
| Signal | Preferred agent |
|
|
139
|
+
|--------|-----------------|
|
|
140
|
+
| PHP backend | `jdi-backend` |
|
|
141
|
+
| TypeScript / React frontend | `jdi-frontend` |
|
|
142
|
+
| Full-stack | `jdi-backend` + `jdi-frontend` |
|
|
143
|
+
| Orchestration / sprint / risk / scope | `jdi-producer` |
|
|
144
|
+
| Performance profiling / budgets / regression | `jdi-perf-analyst` |
|
|
145
|
+
| Security review / vuln audit / secrets / privacy | `jdi-security` |
|
|
146
|
+
| Test case writing / regression checklist / post-task verify | `jdi-qa-tester` |
|
|
147
|
+
|
|
148
|
+
### JDI meta-framework routing
|
|
149
|
+
|
|
150
|
+
Use these pins when the work being done is on the JDI framework itself
|
|
151
|
+
(editing files under `framework/`, writing plans about JDI, etc.).
|
|
152
|
+
|
|
153
|
+
| Signal | Preferred agent |
|
|
154
|
+
|--------|-----------------|
|
|
155
|
+
| Framework design | `jdi-architect` |
|
|
156
|
+
| Framework edits | `jdi-programmer` |
|
|
157
|
+
| Framework tests | `jdi-quality` |
|
|
158
|
+
| Plan creation | `jdi-planner` |
|
|
159
|
+
| Sprint / risk / scope | `jdi-producer` |
|
|
160
|
+
| Perf profiling | `jdi-perf-analyst` |
|
|
161
|
+
| Security audit | `jdi-security` |
|
|
162
|
+
| Post-task verify | `jdi-qa-tester` |
|
|
163
|
+
|
|
164
|
+
> **Note:** `jdi-qa-tester` is automatically invoked by `implement-plan` after
|
|
165
|
+
> every code-touching task — it does not need to be explicitly pinned per task.
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## 3. Output Format (written into plan files)
|
|
170
|
+
|
|
171
|
+
### Plan index (`{phase}-{plan}-{slug}.plan.md`) frontmatter
|
|
172
|
+
|
|
173
|
+
```yaml
|
|
174
|
+
available_agents:
|
|
175
|
+
- name: unity-specialist
|
|
176
|
+
description: ...
|
|
177
|
+
- name: gameplay-programmer
|
|
178
|
+
description: ...
|
|
179
|
+
|
|
180
|
+
# Primary agent for single-agent mode (first task's agent, or most common)
|
|
181
|
+
primary_agent: unity-specialist
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Task file (`{phase}-{plan}-{slug}.T{n}.md`) frontmatter
|
|
185
|
+
|
|
186
|
+
```yaml
|
|
187
|
+
agent: unity-ui-specialist # REQUIRED when available_agents is non-empty
|
|
188
|
+
agent_rationale: "Edits Canvas-based HUD — UI Toolkit expertise needed"
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
`agent_rationale` is a short free-text note explaining WHY the planner picked
|
|
192
|
+
this specialist. Reviewers can use it to challenge bad routings.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## 4. Execution (at implement-plan time)
|
|
197
|
+
|
|
198
|
+
`implement-plan` MUST read the task's `agent:` field and the corresponding
|
|
199
|
+
`source:` from `available_agents`, then spawn via the Task tool using the
|
|
200
|
+
correct pattern for that source.
|
|
201
|
+
|
|
202
|
+
> **Non-negotiable platform constraint:** Claude Code's Task tool only accepts
|
|
203
|
+
> `subagent_type` values that are registered in its subagent list. JDI's
|
|
204
|
+
> specialists live in `framework/agents/` — NOT in `.claude/agents/` — so they
|
|
205
|
+
> are NOT registered subagent types. Passing `subagent_type="jdi-backend"`
|
|
206
|
+
> (or any other JDI agent name) errors with `classifyHandoffIfNeeded is not
|
|
207
|
+
> defined`. See `framework/jdi.md` Critical Constraints.
|
|
208
|
+
>
|
|
209
|
+
> The workaround: spawn `subagent_type="general-purpose"` and inject the JDI
|
|
210
|
+
> agent's identity via the prompt text. Registered Claude Code specialists
|
|
211
|
+
> (found under `.claude/agents/`) can still be spawned directly by name.
|
|
212
|
+
|
|
213
|
+
### Source-aware spawn pattern
|
|
214
|
+
|
|
215
|
+
| `source` in catalogue | `subagent_type` | Identity mechanism |
|
|
216
|
+
|----------------------|-----------------|--------------------|
|
|
217
|
+
| `jdi` | `"general-purpose"` | Prompt text: `"You are {task.agent}. Read .jdi/framework/agents/{task.agent}.md for instructions."` |
|
|
218
|
+
| `claude-code` | `"{task.agent}"` | Native — Claude Code loads the agent spec from `.claude/agents/` |
|
|
219
|
+
|
|
220
|
+
### Single-agent mode
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
# source: jdi (JDI framework specialist)
|
|
224
|
+
Task(
|
|
225
|
+
subagent_type: "general-purpose",
|
|
226
|
+
name: "{plan.primary_agent}",
|
|
227
|
+
prompt: "You are {plan.primary_agent}. Read .jdi/framework/agents/{plan.primary_agent}.md
|
|
228
|
+
for your full role and instructions. Also read .jdi/framework/components/meta/AgentBase.md
|
|
229
|
+
for the JDI base protocol.
|
|
230
|
+
|
|
231
|
+
<standard single-agent spawn prompt from ComplexityRouter>"
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
# source: claude-code (user-added registered specialist)
|
|
235
|
+
Task(
|
|
236
|
+
subagent_type: "{plan.primary_agent}", # e.g. unity-specialist
|
|
237
|
+
name: "{plan.primary_agent}",
|
|
238
|
+
prompt: "<standard single-agent spawn prompt from ComplexityRouter>"
|
|
239
|
+
)
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
If `plan.primary_agent` is missing (legacy plan or empty `available_agents`),
|
|
243
|
+
fall back to `subagent_type="general-purpose"` with a `jdi-backend` /
|
|
244
|
+
`jdi-frontend` spec load in the prompt.
|
|
245
|
+
|
|
246
|
+
### Agent-teams mode
|
|
247
|
+
|
|
248
|
+
For each task, read its `agent:` frontmatter field and the matching `source:`
|
|
249
|
+
from the plan's `available_agents` catalogue. Spawn ONE Task tool call per task
|
|
250
|
+
using the pattern that matches its source (see table above).
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
# JDI specialist (source: jdi)
|
|
254
|
+
Task(
|
|
255
|
+
subagent_type: "general-purpose",
|
|
256
|
+
name: "{task.agent}-{task_id}",
|
|
257
|
+
prompt: "You are {task.agent}. Read .jdi/framework/agents/{task.agent}.md for instructions.
|
|
258
|
+
<spawn prompt from AgentTeamsOrchestration with TASK_FILE: {task file}>"
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
# Claude Code registered specialist (source: claude-code)
|
|
262
|
+
Task(
|
|
263
|
+
subagent_type: "{task.agent}",
|
|
264
|
+
name: "{task.agent}-{task_id}",
|
|
265
|
+
prompt: "<spawn prompt from AgentTeamsOrchestration with TASK_FILE: {task file}>"
|
|
266
|
+
)
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
Tasks with no `agent:` field fall back to the tech-stack default
|
|
270
|
+
(`jdi-backend` / `jdi-frontend`) spawned via the `source: jdi` pattern.
|
|
271
|
+
|
|
272
|
+
### Mixed fallbacks
|
|
273
|
+
|
|
274
|
+
- If a pinned `source: jdi` agent's spec file is not found at
|
|
275
|
+
`.jdi/framework/agents/{name}.md` (or `framework/agents/{name}.md` in the
|
|
276
|
+
self-hosting repo), downgrade to `general-purpose` with a `jdi-backend` /
|
|
277
|
+
`jdi-frontend` spec load. Record `agent_downgrade: {planned} → general-purpose
|
|
278
|
+
(spec not found)` in the summary.
|
|
279
|
+
- If a pinned `source: claude-code` agent is not registered in the current
|
|
280
|
+
session (e.g. plan was created on a different machine), downgrade the same
|
|
281
|
+
way. Record `agent_downgrade: {planned} → general-purpose (not installed)`.
|
|
282
|
+
- Never silently change the pin; always surface downgrades in the summary.
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## 5. Validation Rules
|
|
287
|
+
|
|
288
|
+
The planner MUST NOT:
|
|
289
|
+
|
|
290
|
+
1. Invent agent names that are not in `available_agents`.
|
|
291
|
+
2. Route a task to an agent whose description clearly does not match the task
|
|
292
|
+
(e.g. `narrative-director` for a shader task).
|
|
293
|
+
3. Leave `agent:` blank when `available_agents` is non-empty.
|
|
294
|
+
|
|
295
|
+
The implement-plan pass MUST:
|
|
296
|
+
|
|
297
|
+
1. Read `agent:` from every task file before spawning.
|
|
298
|
+
2. Read the matching `source:` from the plan's `available_agents` catalogue to
|
|
299
|
+
pick the correct spawn pattern (see §4).
|
|
300
|
+
3. Surface any downgrade in the summary.
|
|
301
|
+
4. Prefer `.jdi/framework/agents/` (or `framework/agents/` in the JDI repo)
|
|
302
|
+
over `.claude/agents/` over `~/.claude/agents/` on name collision.
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
## Usage
|
|
307
|
+
|
|
308
|
+
```
|
|
309
|
+
<JDI:AgentRouter mode="discover" /> # at plan time — enumerate + match
|
|
310
|
+
<JDI:AgentRouter mode="spawn" /> # at implement time — honour pins
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
Referenced by:
|
|
314
|
+
- `framework/agents/jdi-planner.md` (discover + match)
|
|
315
|
+
- `framework/components/meta/ComplexityRouter.md` (spawn)
|
|
316
|
+
- `framework/components/meta/AgentTeamsOrchestration.md` (spawn)
|
|
317
|
+
- `framework/commands/create-plan.md` (discover)
|
|
318
|
+
- `framework/commands/implement-plan.md` (spawn)
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: AgentTeamsOrchestration
|
|
3
|
+
category: meta
|
|
4
|
+
description: Agent Teams orchestration quick-reference
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# AgentTeamsOrchestration
|
|
8
|
+
|
|
9
|
+
## Core Pattern (6 Steps)
|
|
10
|
+
|
|
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
|
+
2. **Create Team** — `TeamCreate(team_name: "{team-name}")`
|
|
13
|
+
3. **Create Tasks** — TaskCreate per work unit, set `addBlockedBy` dependencies
|
|
14
|
+
4. **Spawn Teammates** — Task tool, one call per task. The spawn pattern depends on the `source:` field in `available_agents` (see `AgentRouter.md` §4):
|
|
15
|
+
- **`source: jdi`** (JDI framework specialists like `jdi-backend`, `jdi-frontend`, `jdi-qa-tester`) — `subagent_type: "general-purpose"` and inject identity via prompt text: `"You are {task.agent}. Read .jdi/framework/agents/{task.agent}.md for instructions."` This is the common case.
|
|
16
|
+
- **`source: claude-code`** (user-added registered subagents like `unity-ui-specialist`) — `subagent_type: "{task.agent}"` directly; Claude Code loads the spec natively.
|
|
17
|
+
- Verify the agent exists before spawning. For `jdi`, check `.jdi/framework/agents/{name}.md`. For `claude-code`, check `.claude/agents/{name}.md` or `~/.claude/agents/{name}.md`. Missing spec → downgrade to `general-purpose` and record `agent_downgrade:` in the summary.
|
|
18
|
+
- 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.
|
|
19
|
+
5. **Coordinate** — Automatic message delivery for results, TaskList to monitor, SendMessage to guide/unblock
|
|
20
|
+
6. **Cleanup** — shutdown_request to all → TeamDelete → set status "complete" → report (include which specialist ran which task and any downgrade events)
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Task Routing Table
|
|
25
|
+
|
|
26
|
+
**Primary source of truth:** each task's `agent:` frontmatter field, assigned
|
|
27
|
+
by `jdi-planner` via `AgentRouter` at plan time. The table below is the
|
|
28
|
+
**fallback** used only when a task has no pin (legacy plans or empty
|
|
29
|
+
`available_agents`).
|
|
30
|
+
|
|
31
|
+
| Task Stack (fallback) | Agent(s) | Spawn Count |
|
|
32
|
+
|-----------|----------|-------------|
|
|
33
|
+
| PHP only | jdi-backend | 1 |
|
|
34
|
+
| TS/React only | jdi-frontend | 1 |
|
|
35
|
+
| Full-stack | jdi-backend + jdi-frontend | 2 |
|
|
36
|
+
| Config/docs | jdi-backend (default) | 1 |
|
|
37
|
+
|
|
38
|
+
**Examples of honouring pins** (real values — not fallbacks):
|
|
39
|
+
|
|
40
|
+
| Task pin | Subagent type passed to Task tool |
|
|
41
|
+
|----------|-----------------------------------|
|
|
42
|
+
| `agent: unity-specialist` | `unity-specialist` |
|
|
43
|
+
| `agent: unity-ui-specialist` | `unity-ui-specialist` |
|
|
44
|
+
| `agent: gameplay-programmer` | `gameplay-programmer` |
|
|
45
|
+
| `agent: qa-tester` | `qa-tester` |
|
|
46
|
+
| `agent: ue-gas-specialist` | `ue-gas-specialist` |
|
|
47
|
+
| `agent: godot-gdscript-specialist` | `godot-gdscript-specialist` |
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Specialist Spawn Prompt Templates (~200 tokens)
|
|
52
|
+
|
|
53
|
+
### `source: jdi` — JDI framework specialist (common case)
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
You are {task.agent}. Read .jdi/framework/agents/{task.agent}.md for your
|
|
57
|
+
full role and instructions. Also read .jdi/framework/components/meta/AgentBase.md
|
|
58
|
+
for the JDI base protocol. If your spec has requires_components in frontmatter,
|
|
59
|
+
batch-read them before starting.
|
|
60
|
+
|
|
61
|
+
TEAM: {team-name}
|
|
62
|
+
PLAN: {plan-path}
|
|
63
|
+
TASK_FILE: {task-file-path}
|
|
64
|
+
WORKING_DIR: {working-directory}
|
|
65
|
+
|
|
66
|
+
Read your TASK_FILE for task details (objective, files, steps, verification,
|
|
67
|
+
and the `agent_rationale` explaining why you were picked for this task).
|
|
68
|
+
If TASK_FILE is not provided (legacy plan), claim tasks from TaskList and read
|
|
69
|
+
task details from the PLAN file.
|
|
70
|
+
|
|
71
|
+
1. Implement using Edit tool
|
|
72
|
+
2. SendMessage to coordinator with structured return
|
|
73
|
+
3. Mark task completed via TaskUpdate
|
|
74
|
+
|
|
75
|
+
Report: files_modified, files_to_create, commits_pending.
|
|
76
|
+
No git commit (use commits_pending).
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Spawned via `Task(subagent_type="general-purpose", ...)` — see
|
|
80
|
+
`.jdi/framework/jdi.md` Critical Constraints for why.
|
|
81
|
+
|
|
82
|
+
### `source: claude-code` — registered Claude Code subagent
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
Your agent definition has already been loaded by Claude Code from
|
|
86
|
+
.claude/agents/{task.agent}.md — follow it. Also read
|
|
87
|
+
.jdi/framework/components/meta/AgentBase.md for the JDI base protocol.
|
|
88
|
+
|
|
89
|
+
<same TEAM / PLAN / TASK_FILE / WORKING_DIR block + steps + report as above>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Spawned via `Task(subagent_type="{task.agent}", ...)` — Claude Code validates
|
|
93
|
+
the subagent type against its registered list. See
|
|
94
|
+
`.jdi/framework/components/meta/AgentRouter.md` §4 for full rules.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Deferred Operations Checklist
|
|
99
|
+
|
|
100
|
+
After all specialist tasks complete:
|
|
101
|
+
|
|
102
|
+
1. **Collect** — Aggregate `files_modified`, `files_to_create`, `commits_pending` from all SendMessage results
|
|
103
|
+
2. **Create files** — Write tool for each `files_to_create` entry
|
|
104
|
+
3. **Execute commits** — `git add` + `git commit` for each `commits_pending` entry
|
|
105
|
+
4. **Record hashes** — Store real commit hashes in state.yaml
|
|
106
|
+
5. **Verify** — Confirm all `files_modified` are present in working tree
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Team Lifecycle
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
TeamCreate → Spawn agents → Monitor (auto message delivery) →
|
|
114
|
+
Collect results → Deferred ops → shutdown_request → TeamDelete
|
|
115
|
+
```
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# ComplexityRouter Component
|
|
2
|
+
|
|
3
|
+
Evaluates plan complexity and returns the routing decision for implement-plan.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Decision Matrix
|
|
8
|
+
|
|
9
|
+
Read the plan index file (frontmatter + task manifest table) and extract these signals:
|
|
10
|
+
|
|
11
|
+
| Signal | Simple | Complex |
|
|
12
|
+
|--------|--------|---------|
|
|
13
|
+
| Task count | ≤3 | >3 |
|
|
14
|
+
| Tech stacks | Single (PHP-only OR TS-only) | Mixed (PHP + TS/React) |
|
|
15
|
+
| Wave count | 1 (all tasks parallel or sequential) | >1 (multi-wave dependencies) |
|
|
16
|
+
|
|
17
|
+
**Routing rule:** If ANY signal is "Complex" → use Agent Teams mode. All signals must be "Simple" for single-agent mode.
|
|
18
|
+
|
|
19
|
+
**Override flags:**
|
|
20
|
+
- `--team` in command arguments → force Agent Teams mode
|
|
21
|
+
- `--single` in command arguments → force single-agent mode
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Output
|
|
26
|
+
|
|
27
|
+
After evaluation, set the routing decision:
|
|
28
|
+
|
|
29
|
+
```yaml
|
|
30
|
+
mode: single-agent | agent-teams
|
|
31
|
+
primary_agent: jdi-backend | jdi-frontend # based on tech stack
|
|
32
|
+
secondary_agents: [] # only populated in agent-teams mode
|
|
33
|
+
reasoning: "{why this mode was chosen}"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Single-Agent Mode
|
|
39
|
+
|
|
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 and the
|
|
44
|
+
matching `source:` from `available_agents`. Verify the agent exists:
|
|
45
|
+
|
|
46
|
+
- `source: jdi` → check `.jdi/framework/agents/{name}.md` (or
|
|
47
|
+
`framework/agents/{name}.md` in the self-hosting JDI repo)
|
|
48
|
+
- `source: claude-code` → check `.claude/agents/{name}.md` or
|
|
49
|
+
`~/.claude/agents/{name}.md`
|
|
50
|
+
|
|
51
|
+
If unset or not found, fall back to `general-purpose` and record an
|
|
52
|
+
`agent_downgrade:` note in the summary. Never silently default to
|
|
53
|
+
`general-purpose` when a pin exists.
|
|
54
|
+
See `.jdi/framework/components/meta/AgentRouter.md` §4 for full spawn rules.
|
|
55
|
+
|
|
56
|
+
### JDI specialist (source: jdi — the common case)
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
Task(
|
|
60
|
+
subagent_type: "general-purpose", # MUST be general-purpose for JDI agents
|
|
61
|
+
name: "{plan.primary_agent}",
|
|
62
|
+
prompt: "You are {plan.primary_agent}. Read .jdi/framework/agents/{plan.primary_agent}.md
|
|
63
|
+
for your full role and instructions. Also read
|
|
64
|
+
.jdi/framework/components/meta/AgentBase.md for the JDI base protocol.
|
|
65
|
+
|
|
66
|
+
## Project Context
|
|
67
|
+
- Type: {project_type}
|
|
68
|
+
- Tech stack: {tech_stack}
|
|
69
|
+
- Quality gates: {quality_gates}
|
|
70
|
+
- Working directory: {cwd}
|
|
71
|
+
|
|
72
|
+
## Task
|
|
73
|
+
Execute all tasks in the plan sequentially. PLAN: {plan-path}.
|
|
74
|
+
For split plans (task_files in frontmatter), read each task file one at a time
|
|
75
|
+
from the file: field in state.yaml.
|
|
76
|
+
Report: files_modified, files_to_create, commits_pending."
|
|
77
|
+
)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Claude Code registered specialist (source: claude-code)
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
Task(
|
|
84
|
+
subagent_type: "{plan.primary_agent}", # e.g. unity-specialist
|
|
85
|
+
name: "{plan.primary_agent}",
|
|
86
|
+
prompt: "Your agent definition has already been loaded from .claude/agents/.
|
|
87
|
+
Also read .jdi/framework/components/meta/AgentBase.md for the JDI base protocol.
|
|
88
|
+
|
|
89
|
+
<same Project Context + Task sections as above>"
|
|
90
|
+
)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
No TeamCreate, no TaskCreate, no cross-agent coordination.
|
|
94
|
+
|
|
95
|
+
### Legacy fallback (no pins)
|
|
96
|
+
|
|
97
|
+
When `primary_agent` is missing or empty (legacy plan with no AgentRouter
|
|
98
|
+
discovery), use `subagent_type: "general-purpose"` and load the jdi-backend /
|
|
99
|
+
jdi-frontend spec inside the prompt as before.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Agent Teams Mode
|
|
104
|
+
|
|
105
|
+
Follow full orchestration from `.jdi/framework/components/meta/AgentTeamsOrchestration.md`:
|
|
106
|
+
TeamCreate → TaskCreate per plan task → spawn specialists per tech-stack routing → wave-based coordination → collect deferred ops → shutdown → TeamDelete.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Usage
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
<JDI:ComplexityRouter />
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Referenced by implement-plan command stub. Evaluates at orchestration time, before any agents are spawned.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# SilentDiscovery Component
|
|
2
|
+
|
|
3
|
+
The mandatory state-reading preamble that runs before any user-facing prompt in a JDI skill. Its purpose: make sure you never re-ask the user for facts that are already on disk.
|
|
4
|
+
|
|
5
|
+
When a command references `<JDI:SilentDiscovery />`, you MUST gather context from the filesystem before presenting any question, routing decision, or recommendation. Store what you find internally as `DISCOVERED_STATE` — do NOT print discovery output to the user unless a later step explicitly calls for it.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## What to Read
|
|
10
|
+
|
|
11
|
+
Read these files if they exist. If a file is missing, record that in `DISCOVERED_STATE` as `missing: true` and continue — do not error.
|
|
12
|
+
|
|
13
|
+
| File | Purpose |
|
|
14
|
+
|------|---------|
|
|
15
|
+
| `.jdi/config/state.yaml` | Current phase, plan, task, and status. Source of truth for "where are we?" |
|
|
16
|
+
| `.jdi/PROJECT.yaml` | Tech stack, project name, team configuration |
|
|
17
|
+
| `.jdi/REQUIREMENTS.yaml` | Risks, constraints, non-functional requirements |
|
|
18
|
+
| `.jdi/ROADMAP.yaml` | Phase structure, upcoming plans, milestones |
|
|
19
|
+
| `.jdi/plans/*.plan.md` (glob) | Existing plan index files — check frontmatter for `provides`, `status`, completion |
|
|
20
|
+
| `.jdi/codebase/SUMMARY.md` | Codebase index, if present |
|
|
21
|
+
|
|
22
|
+
Additionally, if the skill is worktree-aware, read:
|
|
23
|
+
|
|
24
|
+
| File | Purpose |
|
|
25
|
+
|------|---------|
|
|
26
|
+
| `.jdi/config/state.yaml → worktree` | Active worktree path and status |
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## What to Derive
|
|
31
|
+
|
|
32
|
+
From the raw reads above, compute and store these derived fields in `DISCOVERED_STATE`:
|
|
33
|
+
|
|
34
|
+
- **`active_phase`** — current phase number and name (from ROADMAP.yaml + state.yaml position)
|
|
35
|
+
- **`next_plan_number`** — next available plan id in the active phase (scan existing plan files)
|
|
36
|
+
- **`tech_stack`** — from PROJECT.yaml
|
|
37
|
+
- **`open_risks`** — from REQUIREMENTS.yaml `risks:` block (empty list if none)
|
|
38
|
+
- **`prior_provides`** — union of all `provides:` fields from completed plans (cross-phase dependency map)
|
|
39
|
+
- **`returning_user`** — true if any prior plans are completed or the current plan is in a non-initial status
|
|
40
|
+
- **`missing_scaffolding`** — list of scaffolding files that didn't exist
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Discipline Rules
|
|
45
|
+
|
|
46
|
+
These rules are non-negotiable when this component is referenced:
|
|
47
|
+
|
|
48
|
+
1. **Silent by default.** Never print `DISCOVERED_STATE` as a conversation opener. It informs your recommendations; it is not the first thing the user sees.
|
|
49
|
+
|
|
50
|
+
2. **Never re-ask what's already known.** If a fact is in `DISCOVERED_STATE`, treat it as authoritative. Do not ask "what's your tech stack?" if `DISCOVERED_STATE.tech_stack` is set.
|
|
51
|
+
|
|
52
|
+
3. **Missing ≠ empty.** A missing file means "I don't know" — not "the user has no preferences". Record `missing: true` and surface it only if a later step needs that file.
|
|
53
|
+
|
|
54
|
+
4. **Surface selectively.** When routing or recommending, pull the specific field you need and mention it briefly ("I can see you're on phase {n}, plan {id}..."). Do not dump the whole `DISCOVERED_STATE` object.
|
|
55
|
+
|
|
56
|
+
5. **Refresh, don't stale.** If the skill has multiple passes (e.g. `/jdi:build` option D re-runs discovery after user input), re-read the files — do not rely on the first pass's findings for the second pass.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Pass-Through to Spawned Agents
|
|
61
|
+
|
|
62
|
+
When a skill that uses SilentDiscovery spawns a subagent (e.g. `create-plan` spawns `jdi-planner`), pass `DISCOVERED_STATE` into the spawn prompt as a named block:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
Context already discovered: {DISCOVERED_STATE serialised as yaml}
|
|
66
|
+
Do NOT re-read these scaffolding files. Surface open questions ONLY for facts you cannot infer from this block.
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
This avoids the common failure where the orchestrator reads scaffolding, spawns an agent, and the agent reads the same scaffolding again.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Usage
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
<JDI:SilentDiscovery />
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Referenced at the top of a skill's numbered workflow, typically as step 1 or 2. Always runs before any user-facing prompt.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: StateUpdate
|
|
3
|
+
category: meta
|
|
4
|
+
description: Record decisions, deviations, and blockers in state.yaml
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# StateUpdate
|
|
8
|
+
|
|
9
|
+
> **Status transitions are handled via CLI commands.** Do NOT manually edit `position`, `progress`, `current_plan`, `review`, or `session` fields in state.yaml. Use these commands instead:
|
|
10
|
+
>
|
|
11
|
+
> - `npx jdi state plan-ready --plan-path "{path}" --plan-name "{name}"`
|
|
12
|
+
> - `npx jdi state approved`
|
|
13
|
+
> - `npx jdi state executing`
|
|
14
|
+
> - `npx jdi state complete`
|
|
15
|
+
> - `npx jdi state advance-task {task-id}`
|
|
16
|
+
|
|
17
|
+
Use state.yaml ONLY to record decisions, deviations, or blockers:
|
|
18
|
+
|
|
19
|
+
## Record Decision
|
|
20
|
+
|
|
21
|
+
Append to `decisions` array in `state.yaml`:
|
|
22
|
+
|
|
23
|
+
```yaml
|
|
24
|
+
- timestamp: "{ISO}"
|
|
25
|
+
phase: "{phase}"
|
|
26
|
+
decision: "{description}"
|
|
27
|
+
rationale: "{why}"
|
|
28
|
+
impact: "{what it affects}"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Record Blocker
|
|
32
|
+
|
|
33
|
+
Append to `blockers` array in `state.yaml`:
|
|
34
|
+
|
|
35
|
+
```yaml
|
|
36
|
+
- timestamp: "{ISO}"
|
|
37
|
+
type: "technical|external|decision"
|
|
38
|
+
description: "{what's blocked}"
|
|
39
|
+
impact: "{what can't proceed}"
|
|
40
|
+
resolution: null
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Record Deviation
|
|
44
|
+
|
|
45
|
+
Append to `deviations` array in `state.yaml`:
|
|
46
|
+
|
|
47
|
+
```yaml
|
|
48
|
+
- timestamp: "{ISO}"
|
|
49
|
+
rule: "Rule 1|Rule 2|Rule 3|Rule 4"
|
|
50
|
+
description: "{what deviated}"
|
|
51
|
+
reason: "{why}"
|
|
52
|
+
task: "{task context}"
|
|
53
|
+
files: ["{affected files}"]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Deviation rules: 1=Auto-fixed bug, 2=Auto-added critical functionality, 3=Auto-fixed blocking issue, 4=Asked about architectural change.
|