@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
@@ -0,0 +1,336 @@
1
+ ---
2
+ description: Entry Point and Architecture for the Jedi (JDI) framework
3
+ model: opus
4
+ ---
5
+
6
+ # Jedi (JDI) Framework
7
+
8
+ **Entry Point** | Componentised prompts, Context-efficient, agent-delegated development framework.
9
+
10
+ ---
11
+
12
+ ## Core Principles
13
+
14
+ | Principle | Description |
15
+ |-----------|-------------|
16
+ | **Minimal Context** | Commands are ultra-minimal stubs (~300 tokens). Heavy specs stay out of main context. |
17
+ | **Agent Delegation** | Complex operations spawn agents via Task tool. Agents run in isolated context. |
18
+ | **External State** | All state in JSON files. No context pollution from state tracking. |
19
+ | **On-Demand Reading** | Agents read specs, components, hooks, and rules only when needed. |
20
+
21
+ ---
22
+
23
+ ## Critical Constraints
24
+
25
+ > **WARNING: Task Tool `subagent_type` Parameter**
26
+ >
27
+ > The Claude Code Task tool **ONLY accepts `subagent_type="general-purpose"`** as a valid value.
28
+ >
29
+ > **If you use any other value** (e.g., `"jdi-executor"`, `"jdi-planner"`, or any custom type),
30
+ > the agent will fail with this error:
31
+ >
32
+ > ```
33
+ > classifyHandoffIfNeeded is not defined
34
+ > ```
35
+
36
+ ### Correct Pattern
37
+
38
+ Agent identity is passed via the **prompt parameter**, NOT the `subagent_type` parameter:
39
+
40
+ ```
41
+ Task(
42
+ prompt="You are jdi-executor. Read .jdi/framework/agents/jdi-executor.md for instructions. Execute: {task}",
43
+ subagent_type="general-purpose" ← MUST be "general-purpose"
44
+ )
45
+ ```
46
+
47
+ ### Incorrect Pattern (WILL FAIL)
48
+
49
+ ```
50
+ Task(
51
+ prompt="Execute the plan...",
52
+ subagent_type="jdi-executor" ← WRONG: Causes classifyHandoffIfNeeded error
53
+ )
54
+ ```
55
+
56
+ ### Why This Matters
57
+
58
+ - The Task tool validates `subagent_type` against a fixed list
59
+ - Only `"general-purpose"` is in that list
60
+ - Any other value triggers an internal validation error
61
+ - The cryptic `classifyHandoffIfNeeded is not defined` message masks this validation failure
62
+
63
+ ---
64
+
65
+ ## How It Works
66
+
67
+ ```
68
+ ┌──────────────────────────────────────────────────────┐
69
+ │ MAIN CONTEXT │
70
+ │ │
71
+ │ User: /jdi:create-plan "Add user auth" │
72
+ │ │ │
73
+ │ ▼ │
74
+ │ ┌──────────────────────┐ │
75
+ │ │ Command Stub (~300) │ ← Minimal stub │
76
+ │ └──────────┬───────────┘ │
77
+ │ │ Task tool spawns agent │
78
+ │ ▼ │
79
+ └──────────────────────────────────────────────────────┘
80
+
81
+
82
+ ┌──────────────────────────────────────────────────────┐
83
+ │ AGENT CONTEXT (Isolated, Fresh) │
84
+ │ │
85
+ │ jdi-planner reads spec, researches, creates plan │
86
+ │ → Returns plan_path to main context │
87
+ └──────────────────────────────────────────────────────┘
88
+ ```
89
+
90
+ **create-plan:** Single planner agent (includes research as Step 0).
91
+ **implement-plan:** Complexity-routed — single agent for simple plans, Agent Teams swarm for complex plans.
92
+
93
+ ---
94
+
95
+ ## Available Commands
96
+
97
+ | Command | Type | Description |
98
+ |---------|------|-------------|
99
+ | `/jdi:init` | Direct | Initialise JDI in current project |
100
+ | `/jdi:create-plan` | Agent | Create implementation plan (single planner agent, includes research) |
101
+ | `/jdi:implement-plan` | Agent | Execute plan (single agent for simple, Agent Teams for complex) |
102
+ | `/jdi:commit` | Agent | Create conventional commit (spawns jdi-committer) |
103
+ | `/jdi:generate-pr` | Agent | Generate and create PR (spawns jdi-pr-generator) |
104
+ | `/jdi:pr-review` | Agent | Review PR (spawns reviewer) |
105
+ | `/jdi:pr-feedback` | Agent | Address PR review comments (spawns jdi-pr-feedback) |
106
+ | `/jdi:quick` | Direct | Quick focused change (no orchestration) |
107
+ | `/jdi:map-codebase` | Agent | Analyse codebase architecture and conventions (spawns jdi-codebase-mapper) |
108
+ | `/jdi:verify` | Agent | Run verification checks (spawns jdi-verifier) |
109
+
110
+ **Agent commands:** Spawn a Task agent with isolated context (~300 tokens in main)
111
+ **Direct commands:** Execute in main context (kept minimal)
112
+
113
+ ---
114
+
115
+ ## Component System
116
+
117
+ JDI uses **JSX-like component syntax** for referencing reusable markdown:
118
+
119
+ ```markdown
120
+ <JDI:Commit /> # Full component
121
+ <JDI:Commit:Message /> # Specific section
122
+ <JDI:Commit scope="task" /> # With parameters
123
+ ```
124
+
125
+ **How it works:** When agents encounter component references, they:
126
+ 1. Read the component file from `components/`
127
+ 2. Execute the instructions within
128
+ 3. Return to the calling context
129
+
130
+ Components are **loaded on-demand** by agents, not pre-embedded in commands.
131
+
132
+ ---
133
+
134
+ ## Component Resolution Protocol
135
+
136
+ **CRITICAL**: When you encounter a `<JDI:ComponentName />` tag anywhere in a spec,
137
+ command, hook, or workflow, you MUST:
138
+
139
+ 1. **Parse** the tag to extract the component name, optional section, and parameters.
140
+ - `<JDI:Commit />` -> Component: Commit, Section: (none), Params: (none)
141
+ - `<JDI:StateUpdate:Progress />` -> Component: StateUpdate, Section: Progress, Params: (none)
142
+ - `<JDI:Commit scope="task" />` -> Component: Commit, Section: (none), Params: scope=task
143
+
144
+ 2. **Locate** the component file by searching these directories in order:
145
+ - `.jdi/framework/components/execution/{ComponentName}.md`
146
+ - `.jdi/framework/components/planning/{ComponentName}.md`
147
+ - `.jdi/framework/components/quality/{ComponentName}.md`
148
+ - `.jdi/framework/components/meta/{ComponentName}.md`
149
+
150
+ 3. **Read** the component file using the Read tool.
151
+
152
+ 4. **Execute** the instructions found in the component (or the specified section).
153
+ Apply any parameters from the tag as contextual constraints.
154
+
155
+ 5. **Return** to the calling context and continue execution.
156
+
157
+ Component tags are NOT decorative markers. They are lazy-loaded instructions
158
+ that MUST be resolved and executed at the point where they appear.
159
+
160
+ ---
161
+
162
+ ## State Management
163
+
164
+ ### JSON State Files
165
+
166
+ | File | Purpose | Updates |
167
+ |------|---------|---------|
168
+ | `config/jdi-config.yaml` | Global settings | Manual |
169
+ | `config/state.yaml` | Runtime state (phase, plan, task) | Automatic |
170
+ | `config/variables.yaml` | Shareable variables | Automatic |
171
+
172
+ ### Project State Files
173
+
174
+ When initialised in a project (`.jdi/`):
175
+
176
+ | File | Purpose |
177
+ |------|---------|
178
+ | `PROJECT.yaml` | Project vision and constraints |
179
+ | `REQUIREMENTS.yaml` | Scoped requirements with REQ-IDs |
180
+ | `ROADMAP.yaml` | Phase structure |
181
+ | `STATE.md` | Living memory across sessions |
182
+
183
+ ---
184
+
185
+ ## Context Budget
186
+
187
+ | Scenario | Old Pattern | New Pattern | Savings |
188
+ |----------|-------------|-------------|---------|
189
+ | Single command | ~6,900 tokens | ~300 tokens | 95% |
190
+ | 5-command workflow | ~34,500 tokens | ~1,500 tokens | 96% |
191
+
192
+ **Target:** Keep main context usage minimal. Let agents do heavy work in isolated context.
193
+
194
+ ### Warning Thresholds
195
+
196
+ | Usage | Status | Action |
197
+ |-------|--------|--------|
198
+ | <50% | Green | Normal operation |
199
+ | 50-70% | Yellow | Reduce verbosity |
200
+ | 70-85% | Orange | Essential only |
201
+ | >85% | Red | Complete task and pause |
202
+
203
+ ### No Direct Fallback Rule
204
+
205
+ Agent commands MUST use agent delegation. If agent spawning fails: report error, set state to "blocked", ask user for guidance. NEVER fall back to direct implementation.
206
+
207
+ ---
208
+
209
+ ## Model Profiles
210
+
211
+ Three profiles control which model each agent uses. Set in `.jdi/config/jdi-config.yaml` under `models.profile`.
212
+
213
+ | Profile | When to Use | Opus Agents | Token Impact |
214
+ |---------|-------------|-------------|--------------|
215
+ | **quality** | Critical/complex work | planner, architect, executor, debugger | Highest — full Opus power |
216
+ | **balanced** | Typical development (default) | planner, architect | ~40% less than quality |
217
+ | **budget** | Conserve quota | None | ~60% less than quality |
218
+
219
+ **Budget mode** routes verifier, researcher, phase_researcher, plan_checker, and quality to Haiku — these are agents where thoroughness matters less than speed. Switch mid-session by editing `models.profile` in `.jdi/config/jdi-config.yaml`.
220
+
221
+ ---
222
+
223
+ ## Quick Start
224
+
225
+ ### New Feature
226
+
227
+ ```
228
+ 1. /jdi:create-plan "Add user authentication"
229
+ → Spawns single planner agent (researches + plans)
230
+ → Creates .jdi/plans/01-01-PLAN.md
231
+
232
+ 2. /jdi:implement-plan
233
+ → Routes by complexity (single agent or Agent Teams swarm)
234
+ → Commits per task
235
+
236
+ 3. /jdi:generate-pr
237
+ → Creates PR with structured description
238
+ ```
239
+
240
+ ### Quick Commit
241
+
242
+ ```
243
+ 1. [Make changes]
244
+
245
+ 2. /jdi:commit
246
+ → Stages files individually
247
+ → Creates conventional commit
248
+ ```
249
+
250
+ ---
251
+
252
+ ## Bootstrap
253
+
254
+ To add JDI commands to a project:
255
+
256
+ ```
257
+ /jdi:init
258
+ ```
259
+
260
+ This creates:
261
+ - `.claude/commands/jdi/` — Command stubs
262
+ - `.jdi/` — Project state directory
263
+
264
+ ---
265
+
266
+ ## Core Rules
267
+
268
+ 1. **Commands are stubs** — Just spawn instructions, not full specs
269
+ 2. **Agents read on-demand** — Load what they need in their context
270
+ 3. **State is external** — YAML files, not context pollution
271
+ 4. **Components are modular** — Reusable across agents
272
+ 5. **Atomic commits** — One commit per task, staged individually
273
+
274
+ ---
275
+
276
+ ## Prompt Cache Strategy
277
+
278
+ Agent spawn prompts MUST follow this load order to maximise Anthropic API prompt cache hits:
279
+
280
+ ```
281
+ 1. AgentBase (core) ← ALWAYS first (static, cacheable prefix ~180 tokens)
282
+ 2. AgentBase sections ← Sandbox/TeamMode if needed (still static)
283
+ 3. Agent spec ← Agent-specific instructions (semi-static)
284
+ 4. Task context ← Plan path, working directory, task details (dynamic)
285
+ ```
286
+
287
+ **Why**: The API caches prompt prefixes. By loading AgentBase as the first ~180 tokens of every agent prompt, all agents after the first get that prefix cached. Subsequent agents in the same session benefit from reduced input billing.
288
+
289
+ **Batch component loading**: If an agent's spec has `requires_components` in its frontmatter, read ALL listed components before starting execution. This batches file reads into a single turn rather than discovering components mid-execution (saves ~50-100 tokens of tool overhead per component).
290
+
291
+ ---
292
+
293
+ ## Context Longevity
294
+
295
+ ### When to Start a Fresh Conversation
296
+
297
+ | Signal | Action |
298
+ |--------|--------|
299
+ | 3+ agent spawns in one conversation | Consider fresh conversation |
300
+ | 50+ turns in conversation | Start fresh — history compounds costs |
301
+ | After `/jdi:implement-plan` completes | Fresh conversation for PR/commit (state persisted to YAML) |
302
+ | Context budget at Orange/Red | Complete current task, then fresh conversation |
303
+
304
+ **Why**: Each turn re-sends the full conversation history. Later turns cost progressively more tokens. Since JDI persists all state to YAML files, a fresh conversation loses nothing.
305
+
306
+ ---
307
+
308
+ ## Token Budget Reference
309
+
310
+ ### Per-Artefact Estimates
311
+
312
+ | Artefact | Tokens |
313
+ |----------|--------|
314
+ | AgentBase (core) | ~180 |
315
+ | AgentBase (core + sandbox) | ~320 |
316
+ | Average agent spec | ~180 |
317
+ | Component section | ~100-200 |
318
+ | Full component | ~400-600 |
319
+ | Template section | ~50-100 |
320
+ | State read | ~200 |
321
+
322
+ ### Per-Workflow Estimates
323
+
324
+ | Workflow | Main Context | Agent Context |
325
+ |----------|-------------|---------------|
326
+ | `/jdi:quick` | ~200 tokens | — (direct) |
327
+ | `/jdi:commit` | ~500 tokens | ~400 (haiku) |
328
+ | `/jdi:create-plan` | ~800 tokens | ~2,000 |
329
+ | `/jdi:implement-plan` (simple) | ~800 tokens | ~3,000 |
330
+ | `/jdi:implement-plan` (teams) | ~800 tokens | ~2,000 × N |
331
+
332
+ **If approaching limits**: Switch to `budget` model profile and use section-specific component loading (`<JDI:Component:Section />`).
333
+
334
+ ---
335
+
336
+ *Jedi - Context-efficient development through agent delegation.*
@@ -0,0 +1,3 @@
1
+ # Backend Rules
2
+
3
+ <!-- Learnings from PR reviews will be captured here automatically -->
@@ -0,0 +1,3 @@
1
+ # DevOps Learnings
2
+
3
+ <!-- Rules extracted from PR reviews about infrastructure, CI/CD, Docker, and deployment patterns -->
@@ -0,0 +1,3 @@
1
+ # Frontend Rules
2
+
3
+ <!-- Learnings from PR reviews will be captured here automatically -->
@@ -0,0 +1,3 @@
1
+ # General Learnings
2
+
3
+ <!-- Rules extracted from PR reviews about cross-cutting concerns, process, and conventions -->
@@ -0,0 +1,3 @@
1
+ # Testing Learnings
2
+
3
+ <!-- Rules extracted from PR reviews about testing patterns, quality standards, and test conventions -->
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: commit-rules
3
+ description: Standards for creating commits within JDI workflow
4
+ ---
5
+
6
+ # Commit Rules
7
+
8
+ For full commit instructions, see `<JDI:Commit />` component at `.jdi/framework/components/execution/Commit.md`.
9
+
10
+ ---
11
+
12
+ ## Quick Reference
13
+
14
+ **Format:** `{type}({scope}): {description}` — imperative mood, no period, max 72 chars.
15
+
16
+ **Types:** `feat` | `fix` | `refactor` | `docs` | `test` | `chore` | `perf` | `style`
17
+
18
+ **Scope:** Plan tasks use `{phase}-{plan}-T{n}`. Standalone commits use feature area (e.g., `auth`, `api`).
19
+
20
+ **Staging:** Always stage files individually. NEVER use `git add .`, `git add -A`, or glob patterns.
21
+
22
+ **Atomic:** One task = one commit. Each commit must represent a shippable state.
23
+
24
+ **Pre-commit:** Verify staged files (`git diff --cached --name-only`), run quality checks before committing.
@@ -0,0 +1,221 @@
1
+ ---
2
+ name: deviation-rules
3
+ description: How to handle deviations from plans during execution
4
+ ---
5
+
6
+ # Deviation Rules
7
+
8
+ How to handle unexpected situations during plan execution.
9
+
10
+ ---
11
+
12
+ ## Core Principle
13
+
14
+ Plans are guides, not rigid scripts. Real-world execution reveals new information.
15
+ Handle deviations systematically, not randomly.
16
+
17
+ ---
18
+
19
+ ## The Four Rules
20
+
21
+ ### Rule 1: Auto-Fix Bugs
22
+
23
+ **Trigger:** Bug discovered during implementation
24
+
25
+ **Action:**
26
+ 1. Fix the bug immediately
27
+ 2. Track in deviation log
28
+ 3. Continue execution
29
+
30
+ **Example:**
31
+ ```
32
+ Found: TypeError in existing code while adding new feature
33
+ Action: Fixed the TypeError
34
+ Track: Added to deviations with Rule 1 tag
35
+ Continue: Resumed task execution
36
+ ```
37
+
38
+ **What qualifies:**
39
+ - Type errors
40
+ - Null pointer issues
41
+ - Logic errors in existing code
42
+ - Broken imports
43
+
44
+ ### Rule 2: Auto-Add Critical Functionality
45
+
46
+ **Trigger:** Missing functionality that's essential for task completion
47
+
48
+ **Action:**
49
+ 1. Add the missing piece
50
+ 2. Track in deviation log
51
+ 3. Continue execution
52
+
53
+ **Example:**
54
+ ```
55
+ Found: Form component needs validation that doesn't exist
56
+ Action: Added validation utility
57
+ Track: Added to deviations with Rule 2 tag
58
+ Continue: Used validation in form, completed task
59
+ ```
60
+
61
+ **What qualifies:**
62
+ - Missing utility functions
63
+ - Required helper components
64
+ - Essential type definitions
65
+ - Necessary API helpers
66
+
67
+ ### Rule 3: Auto-Fix Blocking Issues
68
+
69
+ **Trigger:** Issue that prevents task completion
70
+
71
+ **Action:**
72
+ 1. Fix the blocking issue
73
+ 2. Track in deviation log
74
+ 3. Continue execution
75
+
76
+ **Example:**
77
+ ```
78
+ Found: Test failing due to outdated mock
79
+ Action: Updated mock to match current API
80
+ Track: Added to deviations with Rule 3 tag
81
+ Continue: Tests pass, completed task
82
+ ```
83
+
84
+ **What qualifies:**
85
+ - Configuration issues
86
+ - Environment problems
87
+ - Dependency conflicts
88
+ - Test infrastructure issues
89
+
90
+ ### Rule 4: STOP for Architectural Changes
91
+
92
+ **Trigger:** Proposed change would alter system architecture
93
+
94
+ **Action:**
95
+ 1. **STOP** execution immediately
96
+ 2. Present the situation to user
97
+ 3. Await decision before continuing
98
+
99
+ **Example:**
100
+ ```
101
+ Found: Task requires changing database schema
102
+ Action: STOPPED execution
103
+ Present: "This requires a database migration that affects X tables"
104
+ Await: User decision on how to proceed
105
+ ```
106
+
107
+ **What qualifies:**
108
+ - Database schema changes
109
+ - API contract changes
110
+ - Authentication/authorisation changes
111
+ - Significant refactoring
112
+ - New external dependencies
113
+ - Infrastructure changes
114
+
115
+ ---
116
+
117
+ ## Decision Flow
118
+
119
+ ```
120
+ Deviation detected
121
+
122
+ ├─► Is it a bug? ────────────► Rule 1: Fix, track, continue
123
+
124
+ ├─► Is it missing critical? ──► Rule 2: Add, track, continue
125
+
126
+ ├─► Is it blocking? ──────────► Rule 3: Fix, track, continue
127
+
128
+ └─► Does it change architecture? ► Rule 4: STOP, ask, await
129
+ ```
130
+
131
+ ---
132
+
133
+ ## Tracking Format
134
+
135
+ When a deviation occurs, record:
136
+
137
+ ```json
138
+ {
139
+ "deviations": [
140
+ {
141
+ "task_id": "{task where found}",
142
+ "rule": 1,
143
+ "title": "{brief description}",
144
+ "description": "{what was found}",
145
+ "action": "{what was done}",
146
+ "files_affected": ["{list}"],
147
+ "commit_hash": "{if committed separately}"
148
+ }
149
+ ]
150
+ }
151
+ ```
152
+
153
+ ---
154
+
155
+ ## SUMMARY.md Section
156
+
157
+ In plan summary, include:
158
+
159
+ ```markdown
160
+ ## Deviations from Plan
161
+
162
+ ### Auto-fixed Issues
163
+
164
+ **1. [Rule 1] {title}**
165
+ - Found during: Task {X}
166
+ - Issue: {description}
167
+ - Fix: {what was done}
168
+ - Files: {affected files}
169
+ - Commit: {hash}
170
+
171
+ **2. [Rule 2] {title}**
172
+ - Found during: Task {Y}
173
+ - Missing: {what was needed}
174
+ - Added: {what was created}
175
+ - Files: {new files}
176
+ - Commit: {hash}
177
+
178
+ {Or: "None - plan executed as written."}
179
+ ```
180
+
181
+ ---
182
+
183
+ ## Escalation
184
+
185
+ If unsure which rule applies:
186
+ - Default to Rule 4 (ask)
187
+ - It's better to ask than to make unwanted changes
188
+ - User can always say "jedi" to proceed
189
+
190
+ ---
191
+
192
+ ## Context for User Decisions (Rule 4)
193
+
194
+ When presenting an architectural decision:
195
+
196
+ ```
197
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
198
+ JDI ► DEVIATION: Architectural Change Detected
199
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
200
+
201
+ **Task:** {current task}
202
+ **Issue:** {what was encountered}
203
+
204
+ ## What's Needed
205
+
206
+ {Description of the architectural change required}
207
+
208
+ ## Impact
209
+
210
+ - {Impact 1}
211
+ - {Impact 2}
212
+
213
+ ## Options
214
+
215
+ 1. **Proceed** — Make the change as described
216
+ 2. **Modify** — Suggest alternative approach
217
+ 3. **Skip** — Skip this task, continue with others
218
+ 4. **Stop** — Halt execution entirely
219
+
220
+ ───────────────────────────────────────────────────────────────
221
+ ```
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: devops
3
+ description: Helps with Docker, AWS, CLI and other infrastructure-related tasks
4
+ members: [jdi-devops]
5
+ ---
6
+
7
+ # DevOps Team
8
+
9
+ ## Purpose
10
+
11
+ Infrastructure tasks — Docker, AWS, CI/CD, git worktrees, bash scripting, Laravel Horizon, and development environment management.
12
+
13
+ ## Members
14
+
15
+ | Role | Agent | Spec Path |
16
+ |------|-------|-----------|
17
+ | DevOps Engineer | `jdi-devops` | `.jdi/framework/agents/jdi-devops.md` |
18
+
19
+ ## Coordination
20
+
21
+ Single-member team. Lead mode for infrastructure architecture, senior mode for tooling and scripts.
22
+
23
+ ## Boundaries
24
+
25
+ **Will:** Docker/K8s config, AWS services, CI/CD pipelines, worktree management, bash scripts, Horizon config, troubleshoot infra.
26
+ **Won't:** Write application/test code, gather requirements, make app architectural decisions, access production databases.
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: engineering
3
+ description: Performs all engineering and coding tasks across backend and frontend
4
+ members: [jdi-backend, jdi-frontend, jdi-architect, jdi-executor]
5
+ ---
6
+
7
+ # Engineering Team
8
+
9
+ ## Purpose
10
+
11
+ All coding and engineering — implementing features, fixing bugs, refactoring, and delivering shippable increments across full stack (PHP/Laravel + React/TypeScript).
12
+
13
+ ## Members
14
+
15
+ | Role | Agent | Spec Path |
16
+ |------|-------|-----------|
17
+ | Backend Engineer | `jdi-backend` | `.jdi/framework/agents/jdi-backend.md` |
18
+ | Frontend Engineer | `jdi-frontend` | `.jdi/framework/agents/jdi-frontend.md` |
19
+ | Systems Architect | `jdi-architect` | `.jdi/framework/agents/jdi-architect.md` |
20
+ | Senior Fullstack Engineer | `jdi-executor` | `.jdi/framework/agents/jdi-executor.md` |
21
+
22
+ ## Coordination
23
+
24
+ Architect confirms approach → engineers implement within their stack → executor manages commits and deviation handling. All follow established project patterns.
25
+
26
+ ## Boundaries
27
+
28
+ **Will:** Implement per plan, write production code, fix bugs, refactor, atomic commits, run lint/type/test gates, handle deviations.
29
+ **Won't:** Gather requirements, write tests (QA team), make architectural changes without architect, deploy, skip verification.
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: micro-management
3
+ description: Engineering oversight — opt-in only via --oversight flag
4
+ members: [jdi-product-lead, jdi-head-engineering]
5
+ opt_in: true
6
+ ---
7
+
8
+ # Micro-Management Team (Opt-In)
9
+
10
+ **Opt-in only** — spawned when `/jdi:implement-plan --oversight` is used. Not spawned by default.
11
+
12
+ ## Members
13
+
14
+ | Role | Agent |
15
+ |------|-------|
16
+ | Product Lead | `jdi-product-lead` |
17
+ | Head of Engineering | `jdi-head-engineering` |
18
+
19
+ ## Coordination
20
+
21
+ Product Lead validates output against requirements. Head of Engineering ensures code quality, unblocks engineers, prevents tangents. Both flag concerns immediately.
22
+
23
+ ## Boundaries
24
+
25
+ **Will:** Validate task understanding, monitor acceptance criteria, review approach, prevent scope creep.
26
+ **Won't:** Write code, override architect, make product decisions, block without actionable feedback.