@benzotti/jedi 0.1.0

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.
Files changed (83) hide show
  1. package/README.md +615 -0
  2. package/dist/index.js +10514 -0
  3. package/framework/adapters/generic.yaml +23 -0
  4. package/framework/adapters/laravel.yaml +46 -0
  5. package/framework/adapters/nextjs.yaml +36 -0
  6. package/framework/adapters/node.yaml +29 -0
  7. package/framework/agents/jdi-architect.md +118 -0
  8. package/framework/agents/jdi-backend.md +52 -0
  9. package/framework/agents/jdi-codebase-mapper.md +59 -0
  10. package/framework/agents/jdi-committer.md +83 -0
  11. package/framework/agents/jdi-debugger.md +73 -0
  12. package/framework/agents/jdi-devops.md +46 -0
  13. package/framework/agents/jdi-executor.md +89 -0
  14. package/framework/agents/jdi-feedback-learner.md +92 -0
  15. package/framework/agents/jdi-frontend.md +51 -0
  16. package/framework/agents/jdi-head-engineering.md +30 -0
  17. package/framework/agents/jdi-phase-researcher.md +59 -0
  18. package/framework/agents/jdi-plan-checker.md +80 -0
  19. package/framework/agents/jdi-planner.md +140 -0
  20. package/framework/agents/jdi-pr-feedback.md +118 -0
  21. package/framework/agents/jdi-pr-generator.md +80 -0
  22. package/framework/agents/jdi-product-lead.md +44 -0
  23. package/framework/agents/jdi-quality.md +77 -0
  24. package/framework/agents/jdi-researcher.md +70 -0
  25. package/framework/agents/jdi-ux-designer.md +40 -0
  26. package/framework/agents/jdi-verifier.md +80 -0
  27. package/framework/commands/commit.md +20 -0
  28. package/framework/commands/create-plan.md +32 -0
  29. package/framework/commands/generate-pr.md +19 -0
  30. package/framework/commands/implement-plan.md +34 -0
  31. package/framework/commands/init.md +65 -0
  32. package/framework/commands/pr-feedback.md +20 -0
  33. package/framework/commands/pr-review.md +15 -0
  34. package/framework/commands/quick.md +17 -0
  35. package/framework/commands/status.md +13 -0
  36. package/framework/commands/worktree-remove.md +32 -0
  37. package/framework/commands/worktree.md +52 -0
  38. package/framework/components/execution/CodebaseContext.md +36 -0
  39. package/framework/components/execution/Commit.md +121 -0
  40. package/framework/components/execution/Verify.md +140 -0
  41. package/framework/components/execution/VerifyAdvanced.md +43 -0
  42. package/framework/components/meta/AgentBase.md +108 -0
  43. package/framework/components/meta/AgentTeamsOrchestration.md +71 -0
  44. package/framework/components/meta/ComplexityRouter.md +80 -0
  45. package/framework/components/meta/StateUpdate.md +191 -0
  46. package/framework/components/meta/TeamRouter.md +86 -0
  47. package/framework/components/planning/TaskBreakdown.md +83 -0
  48. package/framework/components/planning/WaveComputation.md +59 -0
  49. package/framework/components/quality/PRReview.md +196 -0
  50. package/framework/components/quality/PRReviewLocal.md +99 -0
  51. package/framework/config/jdi-config.yaml +159 -0
  52. package/framework/config/state.yaml +72 -0
  53. package/framework/config/variables.yaml +43 -0
  54. package/framework/hooks/checkpoint.md +196 -0
  55. package/framework/hooks/jdi-worktree-cleanup.md +123 -0
  56. package/framework/hooks/lint-fix-frontend.md +59 -0
  57. package/framework/hooks/on-pause.md +213 -0
  58. package/framework/hooks/pre-commit.md +143 -0
  59. package/framework/jedi.md +336 -0
  60. package/framework/learnings/backend.md +3 -0
  61. package/framework/learnings/devops.md +3 -0
  62. package/framework/learnings/frontend.md +3 -0
  63. package/framework/learnings/general.md +3 -0
  64. package/framework/learnings/testing.md +3 -0
  65. package/framework/rules/commit-rules.md +24 -0
  66. package/framework/rules/deviation-rules.md +221 -0
  67. package/framework/teams/devops.md +26 -0
  68. package/framework/teams/engineering.md +29 -0
  69. package/framework/teams/micro-management.md +26 -0
  70. package/framework/teams/product-research.md +29 -0
  71. package/framework/teams/quality-assurance.md +27 -0
  72. package/framework/templates/PLAN-TASK.md +28 -0
  73. package/framework/templates/PLAN.md +127 -0
  74. package/framework/templates/PROJECT.md +104 -0
  75. package/framework/templates/PROJECT.yaml +16 -0
  76. package/framework/templates/REQUIREMENTS.md +95 -0
  77. package/framework/templates/REQUIREMENTS.yaml +27 -0
  78. package/framework/templates/ROADMAP.md +116 -0
  79. package/framework/templates/ROADMAP.yaml +24 -0
  80. package/framework/templates/STATE.md +137 -0
  81. package/framework/templates/SUMMARY.md +201 -0
  82. package/framework/workflows/README.md +87 -0
  83. package/package.json +35 -0
package/README.md ADDED
@@ -0,0 +1,615 @@
1
+ ```
2
+ ⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
3
+ ⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
4
+ ⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
5
+ ⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
6
+ ⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
7
+ ⠀⠀⠀⠀⠠⠀⠀⠀⡇⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
8
+ ⠀⠀⠀⠀⠀⠈⠳⣴⣿⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
9
+ ⠀⠒⠒⠒⠒⠒⢺⢿⣿⢗⠒⠒⠒⠒⠒⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
10
+ ⠀⠀⠀⠀⠀⠀⠁⣸⣿⣦⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
11
+ ⠀⠀⠀⠀⠀⢀⣾⡟⠋⢹⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
12
+ ⠀⠀⠀⠀⢀⣿⡟⣴⣶⡄⣿⣧⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
13
+ ⠀⠀⠀⢰⣿⣿⣧⢻⣿⣿⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
14
+ ⠀⠀⠀⠈⢻⣿⣿⣷⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
15
+ ⠀⠀⠀⠀⢸⠿⣿⣿⣿⣿⣿⣿⣦⣤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀
16
+ ⠀⠀⠀⠀⣾⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣤⡀⠀⠀⠀⠀⠀
17
+ ⠀⠀⠀⠀⣿⣏⣻⣿⣿⣿⣿⣿⠋⣿⣿⣿⣿⣿⠙⣿⣷⣶⣤⣤⡄
18
+ ⠀⠀⠀⠀⢻⢇⣿⣿⣿⣿⣿⠹⠀⢹⣿⣿⣿⡇⠀⢟⣿⣿⡿⠋⠀
19
+ ⠀⠀⠀⠀⢘⣼⣿⣿⣿⣿⣿⡆⠀⢸⣿⠛⣿⡇⠀⢸⡿⠋⠀⠀⠀
20
+ ⠀⠀⠀⠀⣾⣿⣿⣿⣿⣿⣿⣿⣦⣈⠻⠴⠟⣁⣴⣿⣿⠗⠀⠀⠀
21
+ ⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠋⠀⠀⠀⠀
22
+ ⠀⠀⢀⣿⣿⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀
23
+ ⠀⠀⣾⣿⡏⠀⠹⣿⠿⠿⠿⠿⣿⣿⣿⠿⠛⠁⠀⠀⠀⠀⠀⠀⠀
24
+ ⠀⢰⣿⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀
25
+ ⠀⣿⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀
26
+ ⣰⣿⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣿⣄⠀⠀⠀⠀⠀⠀⠀⠀
27
+ ⠉⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀
28
+ ██╗███████╗██████╗ ██╗
29
+ ██║██╔════╝██╔══██╗██║
30
+ ██║█████╗ ██║ ██║██║
31
+ ██ ██║██╔══╝ ██║ ██║██║
32
+ ╚█████╔╝███████╗██████╔╝██║
33
+ ╚════╝ ╚══════╝╚═════╝ ╚═╝
34
+ ```
35
+
36
+ # JDI Framework
37
+
38
+ A componentised, context-efficient AI development framework for Claude Code. JDI orchestrates specialised agents to plan, implement, review, and ship features — from single-file fixes to full-stack multi-wave implementations.
39
+
40
+ ---
41
+
42
+ ## Table of Contents
43
+
44
+ - [Getting Started](#getting-started)
45
+ - [Commands](#commands)
46
+ - [Features](#features)
47
+ - [Planning and Implementation](#planning-and-implementation)
48
+ - [Git Worktrees](#git-worktrees)
49
+ - [Agent Teams](#agent-teams)
50
+ - [Complexity Router](#complexity-router)
51
+ - [PR Workflow](#pr-workflow)
52
+ - [Verification and Quality Gates](#verification-and-quality-gates)
53
+ - [Component System](#component-system)
54
+ - [Model Routing](#model-routing)
55
+ - [State Management](#state-management)
56
+ - [PR Feedback Learning](#pr-feedback-learning)
57
+ - [Agents](#agents)
58
+ - [Teams](#teams)
59
+ - [Configuration](#configuration)
60
+ - [Directory Structure](#directory-structure)
61
+ - [Architecture](#architecture)
62
+
63
+ ---
64
+
65
+ ## Getting Started
66
+
67
+ ### 1. Install JDI
68
+
69
+ ```bash
70
+ bun install -g @benzotti/jedi
71
+ ```
72
+
73
+ Then initialise in your project:
74
+
75
+ ```bash
76
+ jdi init
77
+ ```
78
+
79
+ Or run the init command directly inside Claude Code:
80
+
81
+ ```
82
+ /jdi:init
83
+ ```
84
+
85
+ This creates:
86
+ - `.jdi/framework/` — Framework files (agents, components, teams, etc.)
87
+ - `.claude/commands/jdi/` — Slash command stubs for all JDI commands
88
+ - `.jdi/` — Project state directory with plans, config, and research
89
+
90
+ Use `--force` to regenerate all files (overwrites existing).
91
+
92
+ ### 2. Plan a Feature
93
+
94
+ ```
95
+ /jdi:create-plan "PROJ-1234 Add user authentication"
96
+ ```
97
+
98
+ JDI spawns a planner agent that researches your codebase, then produces a structured implementation plan at `.jdi/plans/`.
99
+
100
+ ### 3. Implement the Plan
101
+
102
+ ```
103
+ /jdi:implement-plan
104
+ ```
105
+
106
+ JDI evaluates the plan's complexity and routes it accordingly — a single agent for small changes, or a full Agent Teams swarm for multi-stack multi-wave work.
107
+
108
+ ### 4. Commit and Ship
109
+
110
+ ```
111
+ /jdi:commit
112
+ /jdi:generate-pr
113
+ ```
114
+
115
+ Create conventional commits and generate a PR with a structured description.
116
+
117
+ ### Quick Changes
118
+
119
+ For small, focused changes that don't need full orchestration:
120
+
121
+ ```
122
+ /jdi:quick "fix the broken quote calculator"
123
+ ```
124
+
125
+ Executes directly in the main context — no agent spawn, no team, no waves.
126
+
127
+ ---
128
+
129
+ ## Commands
130
+
131
+ All commands are invoked as slash commands inside Claude Code.
132
+
133
+ | Command | Type | Description |
134
+ |---------|------|-------------|
135
+ | `/jdi:init` | Direct | Initialise JDI in the current project |
136
+ | `/jdi:create-plan` | Agent | Create an implementation plan (includes codebase research) |
137
+ | `/jdi:implement-plan` | Agent | Execute a plan (single-agent or Agent Teams swarm) |
138
+ | `/jdi:quick` | Direct | Quick focused change without orchestration |
139
+ | `/jdi:commit` | Agent | Create a conventional commit |
140
+ | `/jdi:generate-pr` | Agent | Generate and create a pull request |
141
+ | `/jdi:pr-review` | Agent | Review a PR and post line comments to GitHub |
142
+ | `/jdi:pr-feedback` | Agent | Address PR review comments |
143
+ | `/jdi:worktree` | Direct | Create an isolated git worktree with full project environment |
144
+ | `/jdi:worktree-remove` | Direct | Remove a worktree and clean up all resources |
145
+ | `/jdi:status` | Direct | Show current framework state and suggest next action |
146
+
147
+ **Agent commands** spawn a Task agent with isolated context (~300 tokens in main context). **Direct commands** execute in the main context.
148
+
149
+ ### Command Flags
150
+
151
+ #### `/jdi:create-plan`
152
+
153
+ | Flag | Description |
154
+ |------|-------------|
155
+ | `--worktree` | Create an isolated git worktree with full project environment (databases, deps, migrations, seeders per adapter config) before planning |
156
+ | `--worktree-lightweight` | Create a worktree with minimal setup (deps + migrate only) |
157
+
158
+ #### `/jdi:implement-plan`
159
+
160
+ | Flag | Description |
161
+ |------|-------------|
162
+ | `--worktree` | Create a full-environment worktree before executing |
163
+ | `--worktree-lightweight` | Create a lightweight worktree before executing |
164
+ | `--team` | Force Agent Teams mode (even for simple plans) |
165
+ | `--single` | Force single-agent mode (even for complex plans) |
166
+
167
+ If `state.yaml` has `worktree.active: true` (set by `create-plan --worktree`), the implementation automatically runs inside that worktree.
168
+
169
+ #### `/jdi:worktree`
170
+
171
+ | Flag | Description |
172
+ |------|-------------|
173
+ | `--lightweight` | Skip databases, web server setup — just deps and migrate |
174
+ | `--base <branch>` | Base branch to create worktree from (default: `master`) |
175
+
176
+ #### `/jdi:worktree-remove`
177
+
178
+ | Flag | Description |
179
+ |------|-------------|
180
+ | `--force` | Skip confirmation prompt |
181
+ | `--keep-branch` | Don't delete the git branch after removal |
182
+
183
+ #### `/jdi:init`
184
+
185
+ | Flag | Description |
186
+ |------|-------------|
187
+ | `--force` | Overwrite all existing command stubs |
188
+
189
+ ---
190
+
191
+ ## Features
192
+
193
+ ### Planning and Implementation
194
+
195
+ JDI follows a plan-then-execute workflow:
196
+
197
+ 1. **Research** — The planner agent analyses your codebase, gathers context, and identifies patterns before writing the plan.
198
+ 2. **Plan** — Produces a structured `PLAN.md` with task breakdown, dependencies, wave computation, and success criteria.
199
+ 3. **Execute** — The complexity router decides whether to use a single specialist agent or a full Agent Teams swarm.
200
+ 4. **Verify** — Quality gates run automatically after execution (lint, type checking, tests).
201
+ 5. **Commit** — Each task gets its own atomic conventional commit.
202
+
203
+ Plans are written to `.jdi/plans/{phase}-{plan}-PLAN.md` and can be reviewed before execution.
204
+
205
+ ### Git Worktrees
206
+
207
+ JDI provides full-environment git worktrees for isolated development. Unlike the built-in `EnterWorktree` tool, JDI worktrees set up the complete project environment via adapter configs:
208
+
209
+ **Full worktree** (`--worktree`):
210
+ - Creates project databases per adapter config
211
+ - Configures environment files with worktree-specific settings
212
+ - Installs dependencies per adapter config
213
+ - Runs project bootstrap (migrations, seeders, post-setup)
214
+ - Configures web server per adapter config
215
+
216
+ **Lightweight worktree** (`--worktree-lightweight`):
217
+ - Installs dependencies and runs migrations only
218
+ - Skips databases, web server setup, seeders, and post-setup
219
+
220
+ Worktree names are derived from ticket IDs and task descriptions (e.g., `"PROJ-1234 Add user auth"` becomes `proj-1234-add-user-auth`). Cleanup via `/jdi:worktree-remove` reverses all setup, removes the worktree, and deletes the branch.
221
+
222
+ ### Agent Teams
223
+
224
+ For complex plans, JDI uses Claude Code's native Agent Teams to orchestrate multiple specialist agents working in parallel:
225
+
226
+ 1. **TeamCreate** — Creates a shared task list
227
+ 2. **TaskCreate** — Creates tasks with dependencies per the plan
228
+ 3. **Spawn Specialists** — Routes tasks to the right agent by tech stack
229
+ 4. **Wave Coordination** — Agents execute in dependency-ordered waves
230
+ 5. **Deferred Operations** — Orchestrator collects file creation and commits from agents, then executes them
231
+ 6. **Cleanup** — Graceful shutdown and team deletion
232
+
233
+ Agents operate in isolated sandboxed contexts. They can edit existing files but cannot create new files or make git commits directly — these are reported as `files_to_create` and `commits_pending` for the orchestrator to execute.
234
+
235
+ ### Complexity Router
236
+
237
+ The complexity router (`<JDI:ComplexityRouter />`) evaluates the plan and decides the execution mode:
238
+
239
+ | Signal | Simple | Complex |
240
+ |--------|--------|---------|
241
+ | Task count | 1-3 | >3 |
242
+ | Tech stacks | Single (PHP-only or TS-only) | Mixed (PHP + TS/React) |
243
+ | Wave count | 1 | >1 |
244
+
245
+ **If ANY signal is "Complex"**, the plan uses Agent Teams mode. All signals must be "Simple" for single-agent mode.
246
+
247
+ Override with `--team` (force swarm) or `--single` (force single-agent).
248
+
249
+ **Tech-stack routing** per task:
250
+
251
+ | Task Stack | Agent(s) |
252
+ |-----------|----------|
253
+ | PHP only | jdi-backend |
254
+ | TS/React only | jdi-frontend |
255
+ | Full-stack | jdi-backend + jdi-frontend |
256
+ | Config/docs | jdi-backend (default) |
257
+
258
+ ### PR Workflow
259
+
260
+ JDI provides a complete PR lifecycle:
261
+
262
+ **`/jdi:pr-review <number>`** — Structured code review with severity-classified findings:
263
+ - Checks out the PR branch and reads all changed files in full
264
+ - Applies a comprehensive checklist (correctness, security, performance, architecture, style, testing, type safety)
265
+ - Classifies findings by severity (blocker, major, minor, suggestion, question, praise)
266
+ - Posts all findings as line comments in a single atomic GitHub review
267
+ - Supports `--no-comments` for local-only review (writes to `.jdi/reviews/`)
268
+ - Supports focus areas and ClickUp context via additional arguments
269
+
270
+ **`/jdi:pr-feedback <number>`** — Addresses review comments systematically, learning from team patterns.
271
+
272
+ **`/jdi:generate-pr`** — Creates a PR with a structured description derived from the implementation plan and commits.
273
+
274
+ ### Verification and Quality Gates
275
+
276
+ JDI runs multi-level verification after implementation:
277
+
278
+ **Three-level verification** for every artefact:
279
+ 1. **Existence** — Does it exist at the expected path?
280
+ 2. **Substantive** — Is it real implementation, not a stub?
281
+ 3. **Wired** — Is it connected to the system (imported, registered, routed)?
282
+
283
+ **Verification scopes:**
284
+
285
+ | Scope | Verifies |
286
+ |-------|----------|
287
+ | `task` | Current task criteria and done conditions |
288
+ | `plan` | All tasks + plan success criteria |
289
+ | `phase` | All plans + phase must-haves |
290
+ | `requirements` | All v1 requirements coverage |
291
+
292
+ **Quality gates** run automatically:
293
+ - `composer check-style` / `composer stan` / `composer test` (PHP)
294
+ - `bun run lint` / `bun run typecheck` / `bun run test:vitest` (TypeScript)
295
+
296
+ Backend tests are a **mandatory blocking gate** — verification fails if `composer test` fails.
297
+
298
+ ### Component System
299
+
300
+ JDI uses a JSX-like component syntax for reusable instructions:
301
+
302
+ ```markdown
303
+ <JDI:Commit /> # Full component
304
+ <JDI:Commit:Message /> # Specific section
305
+ <JDI:Verify scope="plan" /> # With parameters
306
+ <JDI:PRReview post="false" /> # Boolean parameter
307
+ ```
308
+
309
+ Components are **lazy-loaded on-demand** by agents — not pre-embedded in commands. When an agent encounters a `<JDI:*>` tag, it reads the component file, executes the instructions, and returns to the calling context.
310
+
311
+ **Available components:**
312
+
313
+ | Component | Category | Purpose |
314
+ |-----------|----------|---------|
315
+ | `Commit` | execution | Create conventional commits |
316
+ | `Verify` | execution | Multi-level verification |
317
+ | `VerifyAdvanced` | execution | Phase and requirements verification |
318
+ | `CodebaseContext` | execution | Load and cache codebase analysis |
319
+ | `PRReview` | quality | Structured PR review with line comments |
320
+ | `PRReviewLocal` | quality | Write review to local file |
321
+ | `TaskBreakdown` | planning | Break features into tasks |
322
+ | `WaveComputation` | planning | Compute dependency-ordered waves |
323
+ | `AgentBase` | meta | Base protocol for all agents |
324
+ | `AgentTeamsOrchestration` | meta | Agent Teams lifecycle management |
325
+ | `ComplexityRouter` | meta | Route plans to single-agent or swarm |
326
+ | `TeamRouter` | meta | Route commands to teams |
327
+ | `StateUpdate` | meta | Update state.yaml fields |
328
+
329
+ ### Model Routing
330
+
331
+ JDI routes different agents to different Claude models based on a configurable profile:
332
+
333
+ | Profile | Description | Planner | Executor | Researcher | Verifier |
334
+ |---------|-------------|---------|----------|------------|----------|
335
+ | `quality` | Maximum reasoning power | Opus | Opus | Sonnet | Sonnet |
336
+ | `balanced` | Smart allocation (default) | Opus | Sonnet | Sonnet | Sonnet |
337
+ | `budget` | Conserve quota | Sonnet | Sonnet | Haiku | Haiku |
338
+
339
+ Individual agents can be overridden in `jdi-config.yaml` regardless of the active profile.
340
+
341
+ ### State Management
342
+
343
+ JDI tracks all progress in external YAML files (no context pollution):
344
+
345
+ | File | Purpose |
346
+ |------|---------|
347
+ | `.jdi/config/state.yaml` | Runtime state — current phase, plan, task, progress, commits, blockers |
348
+ | `.jdi/config/variables.yaml` | Shareable variables across agents |
349
+ | `.jdi/config/jdi-config.yaml` | Global configuration (workflow, models, quality gates) |
350
+ | `.jdi/PROJECT.yaml` | Project vision and constraints |
351
+ | `.jdi/REQUIREMENTS.yaml` | Scoped requirements with REQ-IDs |
352
+ | `.jdi/ROADMAP.yaml` | Phase structure and plan statuses |
353
+
354
+ ### PR Feedback Learning
355
+
356
+ When processing PR comments, JDI detects learning phrases like:
357
+ - "we usually do this"
358
+ - "we prefer to"
359
+ - "convention is"
360
+
361
+ These patterns are automatically captured to learnings files in `.jdi/framework/learnings/` (categorised by backend, frontend, testing, devops, general) for future reference.
362
+
363
+ ---
364
+
365
+ ## Agents
366
+
367
+ JDI has 16 specialised agents, each with a defined spec and clear boundaries:
368
+
369
+ ### Engineering
370
+
371
+ | Agent | Role | Spec |
372
+ |-------|------|------|
373
+ | `jdi-backend` | Backend Engineer (PHP/Laravel) | `.jdi/framework/agents/jdi-backend.md` |
374
+ | `jdi-frontend` | Frontend Engineer (React/TypeScript) | `.jdi/framework/agents/jdi-frontend.md` |
375
+ | `jdi-architect` | Systems Architect | `.jdi/framework/agents/jdi-architect.md` |
376
+ | `jdi-executor` | Senior Fullstack Engineer | `.jdi/framework/agents/jdi-executor.md` |
377
+
378
+ ### Product and Research
379
+
380
+ | Agent | Role | Spec |
381
+ |-------|------|------|
382
+ | `jdi-planner` | Product Manager / Planner | `.jdi/framework/agents/jdi-planner.md` |
383
+ | `jdi-researcher` | Senior Analyst | `.jdi/framework/agents/jdi-researcher.md` |
384
+ | `jdi-product-lead` | Product Lead | `.jdi/framework/agents/jdi-product-lead.md` |
385
+ | `jdi-ux-designer` | Lead UI/UX Designer | `.jdi/framework/agents/jdi-ux-designer.md` |
386
+
387
+ ### Quality Assurance
388
+
389
+ | Agent | Role | Spec |
390
+ |-------|------|------|
391
+ | `jdi-quality` | Lead QA Developer | `.jdi/framework/agents/jdi-quality.md` |
392
+ | `jdi-verifier` | Senior QA Developer | `.jdi/framework/agents/jdi-verifier.md` |
393
+
394
+ ### DevOps
395
+
396
+ | Agent | Role | Spec |
397
+ |-------|------|------|
398
+ | `jdi-devops` | DevOps Engineer | `.jdi/framework/agents/jdi-devops.md` |
399
+
400
+ ### Supporting
401
+
402
+ | Agent | Role | Spec |
403
+ |-------|------|------|
404
+ | `jdi-committer` | Commit specialist | `.jdi/framework/agents/jdi-committer.md` |
405
+ | `jdi-pr-generator` | PR generation | `.jdi/framework/agents/jdi-pr-generator.md` |
406
+ | `jdi-pr-feedback` | PR feedback handler | `.jdi/framework/agents/jdi-pr-feedback.md` |
407
+ | `jdi-debugger` | Debugging specialist | `.jdi/framework/agents/jdi-debugger.md` |
408
+ | `jdi-head-engineering` | Head of Engineering (oversight) | `.jdi/framework/agents/jdi-head-engineering.md` |
409
+
410
+ All agents inherit the `<JDI:AgentBase />` protocol which defines sandbox awareness, structured returns, communication patterns, and component resolution.
411
+
412
+ ---
413
+
414
+ ## Teams
415
+
416
+ Agents are organised into 5 teams, each with defined responsibilities and boundaries:
417
+
418
+ | Team | Members | Purpose |
419
+ |------|---------|---------|
420
+ | **Engineering** | jdi-backend, jdi-frontend, jdi-architect, jdi-executor | All coding — features, bugs, refactoring across full stack |
421
+ | **Product & Research** | jdi-planner, jdi-researcher, jdi-product-lead, jdi-ux-designer | Requirements, research, planning — does NOT write code |
422
+ | **Quality Assurance** | jdi-quality, jdi-verifier | Testing (Pest/Vitest), verification, quality gates |
423
+ | **DevOps** | jdi-devops | Docker, AWS, CI/CD, worktrees, infrastructure |
424
+ | **Micro-Management** | jdi-product-lead, jdi-head-engineering | Engineering oversight — **opt-in only** via `--oversight` |
425
+
426
+ ### Team Routing
427
+
428
+ Commands are automatically routed to the appropriate team:
429
+
430
+ | Command | Primary Team | Pattern |
431
+ |---------|-------------|---------|
432
+ | `create-plan` | Product & Research | Sequential |
433
+ | `implement-plan` | Engineering | Parallel |
434
+ | `pr-review` | Quality Assurance | Parallel (with Engineering context) |
435
+ | `pr-feedback` | Engineering | Sequential |
436
+ | `commit` | Engineering | Direct (no team) |
437
+ | `generate-pr` | Engineering | Direct (no team) |
438
+
439
+ ### Collaboration Patterns
440
+
441
+ | Pattern | Description |
442
+ |---------|-------------|
443
+ | **Sequential** | Primary team executes, writes state, next team reads state |
444
+ | **Parallel (Oversight)** | Engineering executes; Micro-Management monitors and flags concerns |
445
+ | **Parallel (Context)** | QA reviews code; Engineering provides context |
446
+ | **Direct** | Single agent, single Task invocation, no team coordination |
447
+
448
+ ---
449
+
450
+ ## Configuration
451
+
452
+ Global configuration lives in `.jdi/config/jdi-config.yaml`:
453
+
454
+ ```yaml
455
+ # Workflow mode
456
+ workflow:
457
+ mode: yolo # yolo (autonomous) | interactive (confirm gates) | strict (all confirmations)
458
+ depth: standard # shallow | standard | deep (task granularity)
459
+ parallelisation: true
460
+ commit_docs: true
461
+
462
+ # Agent toggles
463
+ agents:
464
+ research: true # Run research before planning
465
+ plan_check: true # Validate plans before execution
466
+ verifier: true # Verify outcomes after execution
467
+
468
+ # Model routing profile
469
+ models:
470
+ profile: balanced # quality | balanced | budget
471
+ overrides:
472
+ planner: null # Override specific agents (opus | sonnet | haiku | null)
473
+ executor: null
474
+
475
+ # Quality gates
476
+ quality:
477
+ run_lint_before_commit: true
478
+ run_tests_before_pr: true
479
+ require_verification: true
480
+
481
+ # Git settings
482
+ git:
483
+ auto_stage: false
484
+ require_clean_worktree: false
485
+ protected_branches: [main, master, develop]
486
+
487
+ # Context management
488
+ context:
489
+ max_files_per_task: 5
490
+ split_threshold_tasks: 3
491
+ context_budget_warning: 0.5
492
+ context_budget_critical: 0.7
493
+ ```
494
+
495
+ ---
496
+
497
+ ## Directory Structure
498
+
499
+ ### Package Source (this repo)
500
+
501
+ ```
502
+ src/ # CLI source (TypeScript)
503
+ ├── commands/ # CLI commands (init, plan, status, components)
504
+ ├── utils/ # Utilities (detect-project, state, resolve-components)
505
+ └── index.ts # Entry point
506
+
507
+ framework/ # Distributable framework (single source of truth)
508
+ ├── agents/ # Agent specifications (20 agents)
509
+ ├── commands/ # Command stub templates (copied to .claude/commands/jdi/)
510
+ ├── components/ # Reusable component instructions
511
+ │ ├── execution/ # Commit, Verify, CodebaseContext
512
+ │ ├── planning/ # TaskBreakdown, WaveComputation
513
+ │ ├── quality/ # PRReview, PRReviewLocal
514
+ │ └── meta/ # AgentBase, ComplexityRouter, TeamRouter, StateUpdate
515
+ ├── teams/ # Team definitions (5 teams)
516
+ ├── adapters/ # Project-type configs (laravel, nextjs, node, generic)
517
+ ├── config/ # Configuration templates
518
+ ├── hooks/ # Pre-commit, checkpoint, worktree cleanup
519
+ ├── rules/ # Commit rules, deviation rules
520
+ ├── templates/ # PLAN, PROJECT, REQUIREMENTS, ROADMAP templates
521
+ ├── learnings/ # Empty category shells for PR review learnings
522
+ └── jedi.md # Full framework architecture doc
523
+ ```
524
+
525
+ ### Installed in User Projects (via `jdi init`)
526
+
527
+ ```
528
+ .jdi/framework/ # Framework files (installed by jdi init)
529
+ ├── agents/ # Agent specifications
530
+ ├── components/ # Reusable component instructions
531
+ ├── teams/ # Team definitions
532
+ ├── config/ # Configuration templates
533
+ ├── hooks/ # Pre-commit, checkpoint, worktree cleanup
534
+ ├── rules/ # Commit rules, deviation rules
535
+ ├── templates/ # Scaffolding templates
536
+ ├── learnings/ # Patterns learned from PR reviews
537
+ └── jedi.md # Full framework architecture doc
538
+
539
+ .claude/commands/jdi/ # Slash command stubs (~300 tokens each)
540
+ ├── create-plan.md
541
+ ├── implement-plan.md
542
+ ├── quick.md
543
+ ├── commit.md
544
+ ├── generate-pr.md
545
+ ├── pr-review.md
546
+ ├── pr-feedback.md
547
+ ├── worktree.md
548
+ ├── worktree-remove.md
549
+ ├── init.md
550
+ └── status.md
551
+
552
+ .jdi/ # Project state (created by /jdi:init)
553
+ ├── plans/ # Implementation plans
554
+ ├── research/ # Research documentation
555
+ ├── codebase/ # Codebase analysis (SUMMARY.md)
556
+ ├── reviews/ # Local PR reviews (when --no-comments)
557
+ ├── config/
558
+ │ ├── state.yaml # Runtime state
559
+ │ ├── variables.yaml # Shared variables
560
+ │ ├── jdi-config.yaml # Global config
561
+ │ └── adapter.yaml # Project-type adapter config
562
+ ├── PROJECT.yaml # Project context
563
+ ├── REQUIREMENTS.yaml # Scoped requirements
564
+ └── ROADMAP.yaml # Phase structure
565
+ ```
566
+
567
+ ---
568
+
569
+ ## Architecture
570
+
571
+ JDI is built on three core principles:
572
+
573
+ ### Minimal Context
574
+
575
+ Commands are ultra-minimal stubs (~300 tokens). Heavy specs, components, and rules stay out of the main context window. Agents read what they need on-demand in their isolated context.
576
+
577
+ | Scenario | Without JDI | With JDI | Savings |
578
+ |----------|-------------|----------|---------|
579
+ | Single command | ~6,900 tokens | ~300 tokens | 95% |
580
+ | 5-command workflow | ~34,500 tokens | ~1,500 tokens | 96% |
581
+
582
+ ### Agent Delegation
583
+
584
+ Complex operations spawn agents via the Task tool. Each agent runs in an isolated context with its own spec, components, and rules. The orchestrator stays lightweight.
585
+
586
+ ```
587
+ ┌─────────────────────────────────────────────┐
588
+ │ MAIN CONTEXT │
589
+ │ │
590
+ │ User: /jdi:create-plan "Add user auth" │
591
+ │ │ │
592
+ │ ▼ │
593
+ │ ┌──────────────────────┐ │
594
+ │ │ Command Stub (~300) │ │
595
+ │ └──────────┬───────────┘ │
596
+ │ │ Task tool spawns agent │
597
+ │ ▼ │
598
+ └─────────────────────────────────────────────┘
599
+
600
+
601
+ ┌─────────────────────────────────────────────┐
602
+ │ AGENT CONTEXT (Isolated, Fresh) │
603
+ │ │
604
+ │ jdi-planner reads spec, researches, │
605
+ │ creates plan → Returns result to main │
606
+ └─────────────────────────────────────────────┘
607
+ ```
608
+
609
+ ### External State
610
+
611
+ All state lives in YAML files on disk. No context pollution from state tracking. Agents read state when they need it and report updates for the orchestrator to write.
612
+
613
+ ---
614
+
615
+ *Jedi — Context-efficient development through agent delegation.*