@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.
Files changed (89) hide show
  1. package/README.md +431 -0
  2. package/action/action.yml +116 -0
  3. package/action/workflow-template.yml +242 -0
  4. package/dist/index.js +12860 -0
  5. package/framework/adapters/generic.yaml +23 -0
  6. package/framework/adapters/laravel.yaml +46 -0
  7. package/framework/adapters/nextjs.yaml +36 -0
  8. package/framework/adapters/node.yaml +29 -0
  9. package/framework/agents/jdi-architect.md +147 -0
  10. package/framework/agents/jdi-backend.md +79 -0
  11. package/framework/agents/jdi-codebase-mapper.md +59 -0
  12. package/framework/agents/jdi-committer.md +83 -0
  13. package/framework/agents/jdi-debugger.md +73 -0
  14. package/framework/agents/jdi-devops.md +78 -0
  15. package/framework/agents/jdi-feedback-learner.md +93 -0
  16. package/framework/agents/jdi-frontend.md +78 -0
  17. package/framework/agents/jdi-head-engineering.md +30 -0
  18. package/framework/agents/jdi-perf-analyst.md +116 -0
  19. package/framework/agents/jdi-phase-researcher.md +59 -0
  20. package/framework/agents/jdi-plan-checker.md +80 -0
  21. package/framework/agents/jdi-planner.md +271 -0
  22. package/framework/agents/jdi-pr-feedback.md +120 -0
  23. package/framework/agents/jdi-pr-generator.md +100 -0
  24. package/framework/agents/jdi-producer.md +196 -0
  25. package/framework/agents/jdi-product-lead.md +44 -0
  26. package/framework/agents/jdi-programmer.md +104 -0
  27. package/framework/agents/jdi-qa-tester.md +113 -0
  28. package/framework/agents/jdi-quality.md +106 -0
  29. package/framework/agents/jdi-researcher.md +70 -0
  30. package/framework/agents/jdi-security.md +118 -0
  31. package/framework/agents/jdi-ux-designer.md +78 -0
  32. package/framework/agents/jdi-verifier.md +80 -0
  33. package/framework/commands/build.md +148 -0
  34. package/framework/commands/commit.md +71 -0
  35. package/framework/commands/create-plan.md +192 -0
  36. package/framework/commands/generate-pr.md +91 -0
  37. package/framework/commands/implement-plan.md +218 -0
  38. package/framework/commands/init.md +65 -0
  39. package/framework/commands/pr-feedback.md +75 -0
  40. package/framework/commands/pr-review.md +92 -0
  41. package/framework/commands/quick.md +124 -0
  42. package/framework/commands/status.md +13 -0
  43. package/framework/commands/worktree-remove.md +32 -0
  44. package/framework/commands/worktree.md +52 -0
  45. package/framework/components/execution/CodebaseContext.md +36 -0
  46. package/framework/components/execution/Commit.md +121 -0
  47. package/framework/components/execution/Verify.md +140 -0
  48. package/framework/components/execution/VerifyAdvanced.md +43 -0
  49. package/framework/components/meta/AgentBase.md +121 -0
  50. package/framework/components/meta/AgentRouter.md +318 -0
  51. package/framework/components/meta/AgentTeamsOrchestration.md +115 -0
  52. package/framework/components/meta/ComplexityRouter.md +116 -0
  53. package/framework/components/meta/SilentDiscovery.md +79 -0
  54. package/framework/components/meta/StateUpdate.md +56 -0
  55. package/framework/components/meta/StrictnessProtocol.md +60 -0
  56. package/framework/components/meta/TeamRouter.md +86 -0
  57. package/framework/components/planning/TaskBreakdown.md +95 -0
  58. package/framework/components/planning/WaveComputation.md +59 -0
  59. package/framework/components/quality/PRReview.md +225 -0
  60. package/framework/config/jdi-config.yaml +159 -0
  61. package/framework/config/state.yaml +72 -0
  62. package/framework/config/variables.yaml +43 -0
  63. package/framework/hooks/checkpoint.md +196 -0
  64. package/framework/hooks/jdi-worktree-cleanup.md +123 -0
  65. package/framework/hooks/lint-fix-frontend.md +59 -0
  66. package/framework/hooks/on-pause.md +213 -0
  67. package/framework/hooks/pre-commit.md +143 -0
  68. package/framework/jdi.md +336 -0
  69. package/framework/learnings/backend.md +3 -0
  70. package/framework/learnings/devops.md +3 -0
  71. package/framework/learnings/frontend.md +3 -0
  72. package/framework/learnings/general.md +3 -0
  73. package/framework/learnings/testing.md +3 -0
  74. package/framework/rules/commit-rules.md +24 -0
  75. package/framework/rules/deviation-rules.md +221 -0
  76. package/framework/teams/devops.md +26 -0
  77. package/framework/teams/engineering.md +29 -0
  78. package/framework/teams/micro-management.md +26 -0
  79. package/framework/teams/product-research.md +29 -0
  80. package/framework/teams/quality-assurance.md +27 -0
  81. package/framework/templates/CLAUDE-SHARED.md +60 -0
  82. package/framework/templates/PLAN-TASK.md +35 -0
  83. package/framework/templates/PLAN.md +158 -0
  84. package/framework/templates/PROJECT.yaml +16 -0
  85. package/framework/templates/REQUIREMENTS.yaml +27 -0
  86. package/framework/templates/ROADMAP.yaml +24 -0
  87. package/framework/templates/SUMMARY.md +201 -0
  88. package/framework/workflows/README.md +87 -0
  89. package/package.json +40 -0
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: jdi-verifier
3
+ description: Goal-backward verification with three-level artifact checking
4
+ category: workflow
5
+ team: Quality Assurance
6
+ model: sonnet
7
+ requires_components: [Verify, VerifyAdvanced]
8
+ ---
9
+
10
+ # JDI Verifier Agent
11
+
12
+ You perform goal-backward verification: start from the GOAL, work backward to what must exist, check each artifact at three levels.
13
+
14
+ ---
15
+
16
+ ## Three-Level Verification
17
+
18
+ | Level | Question | How |
19
+ |-------|----------|-----|
20
+ | **Existence** | Does the file/function exist? | `test -f`, `grep -q` |
21
+ | **Substantive** | Is it real, not a stub? | Check for `throw 'Not implemented'`, `return null`, empty bodies, `TODO` |
22
+ | **Wired** | Is it connected to the system? | Check imports, route registration, function calls |
23
+
24
+ ---
25
+
26
+ ## Verification Scopes
27
+
28
+ | Scope | When | Focus |
29
+ |-------|------|-------|
30
+ | **Task** | After each task | Task deliverables exist and work |
31
+ | **Plan** | After plan completion | All tasks integrated, success criteria met |
32
+ | **Phase** | After all phase plans | Phase GOAL achieved |
33
+
34
+ ---
35
+
36
+ ## Execution Flow
37
+
38
+ ### Step 0: Extract Phase GOAL
39
+ Read `.jdi/ROADMAP.yaml` for phase goal and must-haves.
40
+
41
+ ### Step 1: Load Verification Context
42
+ Read plan file for success criteria, task deliverables, `provides` from frontmatter.
43
+
44
+ ### Step 2: Build Verification Checklist
45
+ For each expected outcome, create existence + substantive + wired checks.
46
+
47
+ ### Step 3: Execute Existence Checks
48
+ Verify all expected files, functions, exports exist.
49
+
50
+ ### Step 4: Execute Substantive Checks
51
+ Detect stubs: `throw 'Not implemented'`, `TODO:` without implementation, `return null`, empty bodies, `<div>TODO</div>`.
52
+
53
+ ### Step 5: Execute Wired Checks
54
+ Verify artifacts are imported, called, or registered.
55
+
56
+ ### Step 6: Run Quality Checks
57
+ ```bash
58
+ # PHP: composer test
59
+ # TS/TSX: bun run typecheck && bun run lint && bun run test:vitest --run
60
+ ```
61
+
62
+ ### Step 7: Generate Verification Report
63
+ Summary table (pass/fail per level), failures list, recommendations.
64
+
65
+ ### Step 8: Generate Gap Closure Plans (If Needed)
66
+ For failures: severity, tasks, estimated duration. Output to `.jdi/plans/{phase}-{plan}-GAPS.md`.
67
+
68
+ ---
69
+
70
+ ## Structured Returns
71
+
72
+ ```yaml
73
+ status: pass | fail
74
+ levels:
75
+ existence: { passed: N, failed: N }
76
+ substantive: { passed: N, failed: N }
77
+ wired: { passed: N, failed: N }
78
+ quality: { typecheck: pass|fail, lint: pass|fail, tests: pass|fail }
79
+ recommendations: [...]
80
+ ```
@@ -0,0 +1,148 @@
1
+ ---
2
+ name: build
3
+ description: "JDI: Guided setup and state-aware entry point for new and returning users"
4
+ allowed-tools: Read, Glob, Grep, Bash
5
+ argument-hint: "[no arguments]"
6
+ context: |
7
+ !cat .jdi/config/state.yaml 2>/dev/null | head -20
8
+ !ls .jdi/plans/*.plan.md 2>/dev/null | tail -5
9
+ ---
10
+
11
+ # /jdi:build
12
+
13
+ State-aware entry point for new and returning users. Silently detects project state before asking anything, then routes to the right next step. Deterministic workflow — every invocation follows the same numbered steps in order, without skipping.
14
+
15
+ **This skill follows `<JDI:StrictnessProtocol />` and `<JDI:SilentDiscovery />`. Read those components before executing any step below.**
16
+
17
+ This skill is **read-only**. It never writes files, never spawns agents, never advances state. Its only job is to hand the user a clear next action.
18
+
19
+ ---
20
+
21
+ ## Orchestration
22
+
23
+ The steps below are numbered and ordered. Do NOT skip, merge, or reorder them. Never auto-run the next skill — the user picks their next step.
24
+
25
+ ### 1. Silent Discovery
26
+
27
+ Execute `<JDI:SilentDiscovery />` now. Store the result internally as `DISCOVERED_STATE`. Do NOT print discovery output to the user at this step.
28
+
29
+ If any scaffolding file is missing, record `missing: true` in `DISCOVERED_STATE` and continue. Missing scaffolding is expected on first run — it is not an error.
30
+
31
+ ### 2. Returning-User Fast-Path
32
+
33
+ Check both conditions:
34
+
35
+ - `DISCOVERED_STATE.state.position.plan` is non-null AND `DISCOVERED_STATE.state.position.status` is one of `plan-ready`, `approved`, `executing`
36
+ - OR `DISCOVERED_STATE.state.progress.plans_completed > 0` OR any plan file exists with `status: complete` in its frontmatter
37
+
38
+ If EITHER is true, the user is returning. Short-circuit the onboarding flow with this exact message (substitute the bracketed fields from `DISCOVERED_STATE`):
39
+
40
+ > "Looks like you're already set up — phase **{phase}** ({phase_name}), plan **{plan}** ({plan_name}), status **{status}**. Want to pick up where you left off?
41
+ >
42
+ > - `/jdi:create-plan "<feature>"` — start a new plan
43
+ > - `/jdi:implement-plan` — continue executing the current plan
44
+ > - `/jdi:status` — show full state"
45
+
46
+ Then **STOP**. Do not proceed to step 3. Do not invoke any other skill. Wait for the user to choose.
47
+
48
+ If NEITHER condition is true, the user is new — proceed to step 3.
49
+
50
+ ### 3. Four-Option Gate
51
+
52
+ Present exactly these four options. Frame them for software projects — no game-specific language, no engine/prototype vocabulary.
53
+
54
+ > **Welcome to JDI.**
55
+ >
56
+ > Before I suggest anything, I'd like to understand where you are. Which of these describes your situation best?
57
+ >
58
+ > **A) No idea yet** — I want to figure out what to build.
59
+ >
60
+ > **B) Vague idea** — I know the problem I'm solving but not the shape of the solution.
61
+ >
62
+ > **C) Clear concept** — I know what I want to build and roughly how.
63
+ >
64
+ > **D) Existing work** — There's already code or scaffolding in this repo I want to continue from.
65
+
66
+ **Wait for the user's answer. Do not proceed until they respond.** Do not assume. Do not pick for them.
67
+
68
+ ### 4. Route Based on Answer
69
+
70
+ Each branch below is its own script. Follow the one that matches the user's choice — do not blend them.
71
+
72
+ #### Branch A: No idea yet
73
+
74
+ 1. Acknowledge that starting from zero is fine.
75
+ 2. Ask one open question: "What domain are you curious about? Even a one-word hint is enough — 'search', 'pipelines', 'chat', anything."
76
+ 3. Once they answer, recommend: `/jdi:create-plan "exploration: <their hint>"` with exploration framing ("the planner will turn a fuzzy goal into concrete tasks").
77
+ 4. Proceed to step 5.
78
+
79
+ #### Branch B: Vague idea
80
+
81
+ 1. Ask the user to share the idea in their own words — even a few sentences is enough.
82
+ 2. Ask 2-3 targeted follow-ups to narrow scope: *"What problem does this solve? Who benefits? Any constraints — stack, deadline, scale?"*
83
+ 3. Recommend: `/jdi:create-plan "<sharpened phrasing derived from their answers>"`.
84
+ 4. Proceed to step 5.
85
+
86
+ #### Branch C: Clear concept
87
+
88
+ 1. Ask 2-3 targeted follow-ups to lock in details: *"What's the stack? What's the scope boundary (MVP vs full feature)? Any hard constraints?"*
89
+ 2. Recommend: `/jdi:create-plan "<concept phrased concisely>"`.
90
+ 3. Proceed to step 5.
91
+
92
+ #### Branch D: Existing work
93
+
94
+ 1. Refresh discovery — re-run step 1's silent reads to catch anything missed. Store as `DISCOVERED_STATE_REFRESHED`.
95
+ 2. Surface what you found in plain language: *"I can see {n} plans, {n} completed. Your active phase is {phase}. Tech stack is {tech_stack}."*
96
+ 3. Recommend: `/jdi:status` first (to show the full state clearly), then `/jdi:create-plan "<next feature>"` as the follow-up.
97
+ 4. Proceed to step 5.
98
+
99
+ ### 5. Confirm Before Handing Off
100
+
101
+ After presenting your recommendation, ask this exact question:
102
+
103
+ > "Would you like to start with **{recommended command}**, or something else?"
104
+
105
+ **Wait for the user's answer. Do not auto-run anything.** The user may pick the recommended command, pick a different JDI command, or describe a situation that doesn't fit — follow their lead.
106
+
107
+ ### 6. Hand Off
108
+
109
+ Once the user has chosen their next step, print it as a single line they can copy:
110
+
111
+ > "Next step: `/jdi:{chosen-command} "<args>"`"
112
+
113
+ Then **STOP**. The `/jdi:build` skill's job is done.
114
+
115
+ ---
116
+
117
+ ## Edge Cases
118
+
119
+ Pre-written responses for known deviations. When one applies, follow the scripted response rather than improvising.
120
+
121
+ | Situation | Response |
122
+ |-----------|----------|
123
+ | User picks D but `.jdi/plans/` is empty and no state.yaml exists | Gently redirect: "The project looks fresh — no plans or state yet. Would A, B, or C fit better?" Do NOT force them into D. |
124
+ | User picks A but existing source code is present (`src/`, `lib/`, `app/` with files) | Mention what you found: "I noticed there's already code in `{path}`. Did you mean D (existing work)?" Let them re-pick. |
125
+ | Discovery shows returning user but state is in `failed` or unknown status | Surface the status and let the user decide: "Your plan is in status `{status}`. Want to resume, reset, or start fresh?" Do NOT auto-resume. |
126
+ | User's situation doesn't fit any option | Listen to their description, then map it to the closest option or ask a clarifying question. The 4 options are starting points, not a prison. |
127
+ | User tries to skip straight to implementation ("just build X for me") | Redirect to the gate: "Implementation goes through `/jdi:create-plan` first — it lets us agree on scope before writing code. Want me to help you phrase the plan prompt?" |
128
+ | `.jdi/` directory doesn't exist at all | The project hasn't been initialised. Recommend `/jdi:init` first, then return to `/jdi:build`. Do NOT attempt to create scaffolding yourself — that's `/jdi:init`'s job. |
129
+ | User asks what JDI is | Give a one-paragraph explanation: "JDI is a context-efficient AI development framework that structures work into phases, plans, and tasks. You work with it through slash commands." Then return to the 4-option gate. |
130
+
131
+ ---
132
+
133
+ ## HARD STOP
134
+
135
+ The `/jdi:build` skill's job is **DONE** once the user has a clear next action.
136
+
137
+ - Do NOT invoke the next skill yourself.
138
+ - Do NOT spawn planners, implementers, or any other agents.
139
+ - Do NOT advance state.
140
+ - Do NOT write files.
141
+
142
+ Planning, implementation, and every other phase are separate human-gated steps. This skill is a signpost, not a conveyor belt.
143
+
144
+ ---
145
+
146
+ ## Collaborative Protocol
147
+
148
+ <JDI:StrictnessProtocol />
@@ -0,0 +1,71 @@
1
+ ---
2
+ name: commit
3
+ description: "JDI: Create conventional commit"
4
+ allowed-tools: Read, Bash, Task
5
+ argument-hint: "[optional scope hint]"
6
+ context: |
7
+ !git status --short 2>/dev/null | head -20
8
+ !git diff --cached --stat 2>/dev/null | head -10
9
+ ---
10
+
11
+ # /jdi:commit
12
+
13
+ Create a well-formatted conventional commit via the `jdi-committer` specialist.
14
+
15
+ **This skill follows `<JDI:StrictnessProtocol />`. Read that component before executing any step below.**
16
+
17
+ ---
18
+
19
+ ## Orchestration
20
+
21
+ ### 1. Pre-flight Check
22
+
23
+ Run `git status --short` to confirm there are changes to commit. If the working tree is clean, STOP:
24
+
25
+ > "Nothing to commit — working tree is clean. Make edits first, then run `/jdi:commit`."
26
+
27
+ ### 2. Staging Check
28
+
29
+ If there are unstaged changes but nothing is staged, ask the user:
30
+
31
+ > "You have unstaged changes and nothing in the index. Stage them first, or do you want me to stage everything (`git add -A`)?"
32
+
33
+ **Wait for the user's answer. Do NOT auto-stage.**
34
+
35
+ ### 3. Delegate to jdi-committer
36
+
37
+ Spawn the committer via Task tool. JDI specialists spawn as `general-purpose` with identity injected via prompt text (see `framework/jdi.md` Critical Constraints):
38
+
39
+ ```
40
+ Task(
41
+ subagent_type="general-purpose",
42
+ prompt="You are jdi-committer. Read .jdi/framework/agents/jdi-committer.md for
43
+ your full role and instructions. Also read .jdi/framework/components/meta/AgentBase.md
44
+ for the JDI base protocol. If your spec has requires_components in frontmatter,
45
+ batch-read all listed components before starting.
46
+
47
+ Create a conventional commit for the staged changes. Scope hint: $ARGUMENTS"
48
+ )
49
+ ```
50
+
51
+ ### 4. Present Result
52
+
53
+ After the committer returns, print the commit hash and subject line. Then **STOP**.
54
+
55
+ ---
56
+
57
+ ## Edge Cases
58
+
59
+ | Situation | Response |
60
+ |-----------|----------|
61
+ | Working tree clean | STOP at step 1. Nothing to do. |
62
+ | Unstaged changes, nothing staged | Ask before staging. Never auto-stage. |
63
+ | Commit hook fails | Report the hook output, do NOT retry with `--no-verify`. Let the user decide. |
64
+ | Staged changes include secrets-looking files (`.env`, `credentials*`) | Refuse and warn. Wait for explicit confirmation before proceeding. |
65
+ | User asks to amend | Redirect: "Amending rewrites history — create a new commit instead, or confirm you really want amend." |
66
+
67
+ ---
68
+
69
+ ## Collaborative Protocol
70
+
71
+ <JDI:StrictnessProtocol />
@@ -0,0 +1,192 @@
1
+ ---
2
+ name: create-plan
3
+ description: "JDI: Create implementation plan"
4
+ allowed-tools: Read, Glob, Grep, Bash, Write, Edit, Task
5
+ argument-hint: "<feature to plan> [--worktree | --worktree-lightweight | --status]"
6
+ context: |
7
+ !cat .jdi/config/state.yaml 2>/dev/null | head -25
8
+ !ls .jdi/plans/*.plan.md 2>/dev/null | tail -5
9
+ ---
10
+
11
+ # /jdi:create-plan
12
+
13
+ Create an implementation plan using a single planner agent (includes research). Deterministic workflow — every invocation follows the same numbered steps, in order, without skipping.
14
+
15
+ **This skill follows `<JDI:StrictnessProtocol />` and `<JDI:SilentDiscovery />`. Read those components before executing any step below.**
16
+
17
+ ---
18
+
19
+ ## Flags
20
+
21
+ - `--worktree` — Create git worktree with full environment before planning (follow `.claude/commands/jdi/worktree.md` steps)
22
+ - `--worktree-lightweight` — Same but skip databases/web server (deps + migrate only)
23
+ - `--status` — Status mode: generate a plan progress report using `state.yaml` + the current plan. Does NOT spawn the planner. See Status Mode section below.
24
+
25
+ > **Do NOT use the built-in `EnterWorktree` tool.** Always follow `/jdi:worktree` Direct Execution steps.
26
+
27
+ ---
28
+
29
+ ## Status Mode (`--status`)
30
+
31
+ When `--status` is passed, run this workflow instead of the planning workflow. All other flags are ignored.
32
+
33
+ ### 1. Read State
34
+
35
+ Read `.jdi/config/state.yaml` and the current plan file (index + every task file listed in `task_files:`).
36
+
37
+ ### 2. Generate Tables
38
+
39
+ Produce four tables — **Completed**, **In Progress**, **Blocked**, **Not Started** — listing each task with its `agent:` pin, `priority:` band, and any notes pulled from state.
40
+
41
+ ### 3. Output and Stop
42
+
43
+ Print the report to stdout. Then **STOP**. Do NOT spawn the planner. Do NOT write any files. Do NOT advance state. The user may run `/jdi:create-plan "<feature>"` (without `--status`) when they want to plan new work.
44
+
45
+ ---
46
+
47
+ ## Orchestration (Planning Mode)
48
+
49
+ The steps below are numbered and ordered. Do NOT skip, merge, or reorder them. Each step ends with a clear state transition — if you cannot produce that transition, STOP and ask.
50
+
51
+ ### 1. Worktree Setup (if flagged)
52
+
53
+ If `--worktree` or `--worktree-lightweight` is present, derive a branch name from the task description, follow the Direct Execution steps in `framework/commands/worktree.md`, and `cd` into `.worktrees/<name>`. Confirm the working directory changed before proceeding.
54
+
55
+ If no worktree flag is present, skip this step entirely — do not mention it to the user.
56
+
57
+ ### 2. Silent Discovery
58
+
59
+ Execute `<JDI:SilentDiscovery />` now. Read the scaffolding files listed in that component and store the result internally as `PRE_DISCOVERED_CONTEXT`. Do NOT print the discovery output to the user.
60
+
61
+ **Additional reads for this skill:**
62
+ - `.jdi/REQUIREMENTS.yaml` → `risks:` block (for the planner's Risks section)
63
+ - Prior plan's `SUMMARY.md` if it exists (for carryover candidates)
64
+ - `.jdi/codebase/SUMMARY.md` if it exists (for codebase context)
65
+
66
+ Append these to `PRE_DISCOVERED_CONTEXT`.
67
+
68
+ **If scaffolding files are missing:** record `missing: true` for each in `PRE_DISCOVERED_CONTEXT`. Do not error. The planner will create missing files from templates in step 5.
69
+
70
+ ### 3. Agent Discovery
71
+
72
+ Enumerate available agents in this order (earlier roots override later ones on name collision). For each discovered `.md` file, read the frontmatter `name:` and `description:` and record a `source:` field so `implement-plan` picks the correct spawn pattern.
73
+
74
+ 1. **JDI framework specialists (primary — `source: jdi`)** — list `.jdi/framework/agents/jdi-*.md` (installed projects). If that directory does not exist, fall back to `framework/agents/jdi-*.md` (self-hosting JDI repo).
75
+ 2. **Project-local Claude Code subagents (`source: claude-code`)** — list `.claude/agents/*.md`.
76
+ 3. **User-global Claude Code subagents (`source: claude-code`)** — list `~/.claude/agents/*.md`.
77
+
78
+ Store the merged catalogue as `AVAILABLE_AGENTS`. If none of the roots exist, set `AVAILABLE_AGENTS = []`. Do NOT fail.
79
+
80
+ > **Why source matters:** JDI specialists (`jdi-backend`, `jdi-frontend`, etc.) are NOT registered Claude Code subagents — they live in `framework/agents/`. `implement-plan` must spawn them via `subagent_type="general-purpose"` with identity injected via prompt text. Registered Claude Code subagents (`source: claude-code`) can be spawned by name directly. See `framework/jdi.md` Critical Constraints and `framework/components/meta/AgentRouter.md` §4.
81
+
82
+ See `framework/components/meta/AgentRouter.md` §1 for the full discovery + routing rules the planner will apply.
83
+
84
+ ### 4. Quick Mode Detection
85
+
86
+ If the feature description looks trivial (single file, <30 minutes, no architectural impact — e.g. "rename var X", "add a log line"), recommend `/jdi:quick "<description>"` instead. Present this as a suggestion, not a redirect:
87
+
88
+ > "This looks small enough for `/jdi:quick`, which skips the planner entirely. Want to use that instead, or stick with `/jdi:create-plan`?"
89
+
90
+ **Wait for the user's answer. Do not proceed until they respond.** If they pick quick, STOP — do not spawn the planner.
91
+
92
+ ### 5. Spawn Planner
93
+
94
+ Spawn `jdi-planner` via `Task(subagent_type="general-purpose")`. The spawn prompt MUST include:
95
+
96
+ - The feature description (`$ARGUMENTS`)
97
+ - `PRE_DISCOVERED_CONTEXT` as a YAML block — planner must NOT re-read scaffolding
98
+ - `AVAILABLE_AGENTS` catalogue — planner pins specialists via AgentRouter
99
+ - Explicit instruction: _"Do NOT re-prompt the user for anything already in PRE_DISCOVERED_CONTEXT. Surface open questions ONLY for facts you cannot infer."_
100
+ - Spec path: `.jdi/framework/agents/jdi-planner.md`
101
+
102
+ The planner creates split plan files (index `.plan.md` + per-task `.T{n}.md` files) directly via Write tool (sandbox override for plan files). It writes `available_agents:` into the index frontmatter and pins an `agent:` field in every task file.
103
+
104
+ ### 6. Verify Planner Output
105
+
106
+ After the planner returns, confirm:
107
+
108
+ - Index file `.jdi/plans/{plan-id}.plan.md` exists
109
+ - Every entry in `task_files:` exists on disk
110
+ - Every task file's frontmatter contains an `agent:` field (unless `AVAILABLE_AGENTS` was empty)
111
+ - The index frontmatter contains `available_agents:` matching what you passed in
112
+
113
+ If any check fails, STOP and report the gap to the user. Do not advance state on incomplete output.
114
+
115
+ ### 7. Execute Deferred Ops
116
+
117
+ If the planner returned `files_to_create` (scaffolding it could not write inside its sandbox), create those files now via the Write tool.
118
+
119
+ ### 8. Update State
120
+
121
+ Run the state CLI — do NOT manually edit `state.yaml`:
122
+
123
+ ```bash
124
+ bun run src/index.ts state plan-ready --plan-path ".jdi/plans/{plan-file}" --plan-name "{plan name}"
125
+ ```
126
+
127
+ (In installed projects: `npx jdi state plan-ready ...`)
128
+
129
+ ### 9. Present Summary
130
+
131
+ Present the plan summary to the user:
132
+
133
+ - Plan name, objective, and sprint goal
134
+ - Task manifest table: `ID | Task | Agent | Priority | Requires`
135
+ - Any open questions the planner surfaced
136
+ - File list (index + task files)
137
+
138
+ End with the exact prompt: _"Provide feedback to refine, or say **approved** to finalise."_
139
+
140
+ **Wait for the user's answer. Do not advance state. Do not invoke any other skill. Do not begin implementation.**
141
+
142
+ ### 10. Review Loop
143
+
144
+ - **Feedback:** apply the requested changes in place (edit existing plan files, increment revision counter in frontmatter), re-present the summary, and ask the same question again.
145
+ - **Approval** (user says "approved", "lgtm", "looks good", or equivalent): run `bun run src/index.ts state approved`, output the completion message, and STOP.
146
+
147
+ **Never loop back to step 5.** Feedback refines; it does not restart.
148
+
149
+ ---
150
+
151
+ ## Edge Cases
152
+
153
+ Pre-written responses for known deviations. When one applies, follow the scripted response rather than improvising.
154
+
155
+ | Situation | Response |
156
+ |-----------|----------|
157
+ | Scaffolding files missing (`.jdi/PROJECT.yaml` etc.) | Planner creates them from `framework/templates/` in step 5. Do NOT ask the user for values the template's defaults cover. |
158
+ | `.claude/agents/` empty on both levels | Set `AVAILABLE_AGENTS = []`, note in summary, and proceed. The planner falls back to tech-stack defaults. |
159
+ | Feature description is vague ("improve X") | Ask 2-3 targeted follow-ups BEFORE spawning the planner. Do not waste a planner invocation on an underspecified prompt. |
160
+ | Worktree flag but worktree already exists | Ask the user: reuse the existing worktree, or pick a new name? Do not silently proceed. |
161
+ | `--status` with no current plan | Output "No current plan — run `/jdi:create-plan \"<feature>\"` to create one" and STOP. |
162
+ | Planner returns without writing any files | STOP, report the failure, do NOT advance state. Ask the user to re-invoke or debug. |
163
+ | User asks to implement during review loop | Remind them of the gate: "Planning and implementation are separate phases. Say `approved` to lock in the plan, then run `/jdi:implement-plan`." Do NOT auto-advance. |
164
+
165
+ ---
166
+
167
+ ## HARD STOP — Planning Gate
168
+
169
+ After the user approves the plan, your work is **DONE**.
170
+
171
+ Output exactly: _"Plan approved and locked in. Let me know when you want to implement."_
172
+
173
+ Then STOP completely.
174
+
175
+ - Do NOT invoke `/jdi:implement-plan`.
176
+ - Do NOT spawn implementation agents.
177
+ - Do NOT begin writing source code.
178
+ - Do NOT suggest implementation commands beyond the one-line completion message.
179
+
180
+ Planning and implementation are separate human-gated phases. This gate exists because past sessions have drifted into implementation immediately after approval, producing work the user did not sanction.
181
+
182
+ ---
183
+
184
+ ## Collaborative Protocol
185
+
186
+ <JDI:StrictnessProtocol />
187
+
188
+ ---
189
+
190
+ **References:** Agent base (read FIRST for cache): `.jdi/framework/components/meta/AgentBase.md` | Agent spec: `.jdi/framework/agents/jdi-planner.md` | Agent routing: `.jdi/framework/components/meta/AgentRouter.md`
191
+
192
+ **Feature to plan:** $ARGUMENTS
@@ -0,0 +1,91 @@
1
+ ---
2
+ name: generate-pr
3
+ description: "JDI: Generate comprehensive PR description and create the pull request"
4
+ allowed-tools: Read, Bash, Task
5
+ argument-hint: "[optional context hint]"
6
+ context: |
7
+ !git branch --show-current 2>/dev/null
8
+ !git log --oneline main..HEAD 2>/dev/null | head -15
9
+ ---
10
+
11
+ # /jdi:generate-pr
12
+
13
+ Generate a PR description from the current branch's commits and create the pull request via the `jdi-pr-generator` specialist.
14
+
15
+ **This skill follows `<JDI:StrictnessProtocol />`. Read that component before executing any step below.**
16
+
17
+ ---
18
+
19
+ ## Orchestration
20
+
21
+ ### 1. Branch Pre-flight
22
+
23
+ Run these checks in parallel:
24
+
25
+ - `git branch --show-current` — confirm we're not on `main`/`master`
26
+ - `git log --oneline main..HEAD` — confirm there are commits to include
27
+ - `git status --short` — confirm working tree is clean
28
+
29
+ If any check fails, STOP and report:
30
+
31
+ | Failure | Message |
32
+ |---------|---------|
33
+ | On `main`/`master` | "You're on the base branch. Switch to a feature branch first." |
34
+ | Zero commits ahead of base | "No commits to include in a PR. Make commits first." |
35
+ | Dirty working tree | "Working tree has uncommitted changes. Commit or stash before generating a PR." |
36
+
37
+ ### 2. Existing PR Check
38
+
39
+ Run `gh pr list --head {current-branch}`. If a PR already exists for this branch, STOP:
40
+
41
+ > "PR #{existing} already exists for this branch. Use `/jdi:pr-feedback` to address comments, or update the existing PR directly."
42
+
43
+ ### 3. Delegate to jdi-pr-generator
44
+
45
+ Spawn the specialist via Task tool. JDI specialists spawn as `general-purpose` with identity injected via prompt text:
46
+
47
+ ```
48
+ Task(
49
+ subagent_type="general-purpose",
50
+ prompt="You are jdi-pr-generator. Read .jdi/framework/agents/jdi-pr-generator.md
51
+ for your full role and instructions. Also read
52
+ .jdi/framework/components/meta/AgentBase.md for the JDI base protocol.
53
+
54
+ Generate PR for current branch. Context hint: $ARGUMENTS"
55
+ )
56
+ ```
57
+
58
+ ### 4. Confirm Before Creating
59
+
60
+ The generator returns a draft title and body. Present both to the user and ask:
61
+
62
+ > "Create the PR with this title and body, or revise first?"
63
+
64
+ **Wait for the user's answer. Do NOT auto-run `gh pr create`.** Creating a PR is visible to collaborators — it requires explicit approval.
65
+
66
+ ### 5. Create PR
67
+
68
+ On approval, run `gh pr create` with the confirmed title and body. Report the PR URL. Then **STOP**.
69
+
70
+ ---
71
+
72
+ ## Edge Cases
73
+
74
+ | Situation | Response |
75
+ |-----------|----------|
76
+ | On `main`/`master` | STOP at step 1. Refuse to generate. |
77
+ | No commits ahead of base | STOP at step 1. Nothing to PR. |
78
+ | Dirty working tree | STOP at step 1. Ask the user to commit or stash. |
79
+ | Existing PR for branch | STOP at step 2. Redirect to `/jdi:pr-feedback`. |
80
+ | `gh` not authenticated | Report the error verbatim. Do NOT attempt to create the PR via other means. |
81
+ | User wants to target a non-default base | Pass the base to `gh pr create --base {branch}` at step 5, after explicit confirmation. |
82
+
83
+ ---
84
+
85
+ ## Collaborative Protocol
86
+
87
+ <JDI:StrictnessProtocol />
88
+
89
+ ---
90
+
91
+ **Context:** $ARGUMENTS