@benzotti/jdi 0.1.47 → 0.1.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -12791,7 +12791,7 @@ var stateCommand = defineCommand({
12791
12791
  // package.json
12792
12792
  var package_default = {
12793
12793
  name: "@benzotti/jdi",
12794
- version: "0.1.47",
12794
+ version: "0.1.49",
12795
12795
  description: "JDI - Context-efficient AI development framework for Claude Code",
12796
12796
  type: "module",
12797
12797
  bin: {
@@ -53,7 +53,7 @@ interactive prompts. Overriding them silently is forbidden.
53
53
 
54
54
  You MUST write files using Write/Edit tools. Returning plan content as text is NOT acceptable.
55
55
 
56
- **SANDBOX OVERRIDE:** Plan file creation is an EXCEPTION to AgentBase sandbox rules. You MUST use the Write tool to create plan files directly do NOT defer them to `files_to_create`. Plan files WILL persist when written via the Write tool. This override applies ONLY to `.jdi/plans/` and `.jdi/config/` files listed below.
56
+ You MUST use the Write tool to create plan files directly. You have full file permissions (`mode: "bypassPermissions"`).
57
57
 
58
58
  Required files (SPLIT FORMAT — one file per task):
59
59
  1. `.jdi/plans/{phase}-{plan}-{slug}.plan.md` (index file — manifest table only, NO inline task details)
@@ -73,7 +73,7 @@ For each task:
73
73
 
74
74
  ### Step 4: Plan Completion
75
75
  - Run plan-level verification
76
- - Generate SUMMARY.md (via `files_to_create`)
76
+ - Generate SUMMARY.md (via Write tool)
77
77
  - Update final state
78
78
 
79
79
  ---
@@ -91,10 +91,8 @@ one_liner: "{brief summary}"
91
91
  next_action: {what should happen next}
92
92
  files_modified:
93
93
  - path/to/edited/file1.ts
94
- files_to_create:
95
- - path: ".jdi/plans/{phase}-{plan}-{slug}.summary.md"
96
- content: |
97
- {full summary content}
94
+ files_created:
95
+ - .jdi/plans/{phase}-{plan}-{slug}.summary.md
98
96
  commits_pending:
99
97
  - message: "{conventional commit message}"
100
98
  files: [path/to/file1.ts]
@@ -37,8 +37,9 @@ If there are unstaged changes but nothing is staged, ask the user:
37
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
38
 
39
39
  ```
40
- Task(
40
+ Agent(
41
41
  subagent_type="general-purpose",
42
+ mode="bypassPermissions",
42
43
  prompt="You are jdi-committer. Read .jdi/framework/agents/jdi-committer.md for
43
44
  your full role and instructions. Also read .jdi/framework/components/meta/AgentBase.md
44
45
  for the JDI base protocol. If your spec has requires_components in frontmatter,
@@ -91,7 +91,7 @@ If the feature description looks trivial (single file, <30 minutes, no architect
91
91
 
92
92
  ### 4a. Pre-Plan Research Spawn
93
93
 
94
- Spawn `jdi-researcher` in `pre-plan-discovery` mode via `Task(subagent_type="general-purpose")`. The spawn prompt MUST include:
94
+ Spawn `jdi-researcher` in `pre-plan-discovery` mode via `Agent(subagent_type="general-purpose", mode="bypassPermissions")`. The spawn prompt MUST include:
95
95
 
96
96
  - The feature description (`$ARGUMENTS`)
97
97
  - `PRE_DISCOVERED_CONTEXT` as a YAML block
@@ -115,7 +115,7 @@ Store answers as `PRE_ANSWERED_QUESTIONS`.
115
115
 
116
116
  ### 5. Spawn Planner
117
117
 
118
- Spawn `jdi-planner` via `Task(subagent_type="general-purpose")`. The spawn prompt MUST include:
118
+ Spawn `jdi-planner` via `Agent(subagent_type="general-purpose", mode="bypassPermissions")`. The spawn prompt MUST include:
119
119
 
120
120
  - The feature description (`$ARGUMENTS`)
121
121
  - `PRE_DISCOVERED_CONTEXT` as a YAML block — planner must NOT re-read scaffolding
@@ -140,7 +140,7 @@ If any check fails, STOP and report the gap to the user. Do not advance state on
140
140
 
141
141
  ### 7. Execute Deferred Ops
142
142
 
143
- If the planner returned `files_to_create` (scaffolding it could not write inside its sandbox), create those files now via the Write tool.
143
+ The planner creates files directly (it has `bypassPermissions`). If any `files_to_create` entries were returned, create them now via the Write tool as a fallback.
144
144
 
145
145
  ### 8. Update State
146
146
 
@@ -45,8 +45,9 @@ Run `gh pr list --head {current-branch}`. If a PR already exists for this branch
45
45
  Spawn the specialist via Task tool. JDI specialists spawn as `general-purpose` with identity injected via prompt text:
46
46
 
47
47
  ```
48
- Task(
48
+ Agent(
49
49
  subagent_type="general-purpose",
50
+ mode="bypassPermissions",
50
51
  prompt="You are jdi-pr-generator. Read .jdi/framework/agents/jdi-pr-generator.md
51
52
  for your full role and instructions. Also read
52
53
  .jdi/framework/components/meta/AgentBase.md for the JDI base protocol.
@@ -101,15 +101,17 @@ Run `bun run src/index.ts state executing` (in installed projects: `npx jdi stat
101
101
 
102
102
  ### 8. Spawn and Execute
103
103
 
104
- **Platform constraint:** JDI specialists (`source: jdi`) are NOT registered Claude Code subagents and MUST be spawned via `subagent_type="general-purpose"` with identity injected via prompt text (`"You are {agent}. Read .jdi/framework/agents/{agent}.md..."`). Registered Claude Code subagents (`source: claude-code`) are spawned directly by name. See `framework/jdi.md` Critical Constraints and `framework/components/meta/AgentRouter.md` §4.
104
+ **Platform constraints:**
105
+ - JDI specialists (`source: jdi`) are NOT registered Claude Code subagents and MUST be spawned via `subagent_type="general-purpose"` with identity injected via prompt text. Registered Claude Code subagents (`source: claude-code`) are spawned directly by name. See `framework/jdi.md` Critical Constraints.
106
+ - **All agents MUST be spawned with `mode: "bypassPermissions"`** — agents run in background and cannot prompt the user for Write/Edit approval. Without this mode, agents will be blocked on permission prompts and fail silently.
105
107
 
106
108
  **Single-agent mode:**
107
- - `source: jdi` → `Task(subagent_type="general-purpose", prompt="You are {plan.primary_agent}. Read .jdi/framework/agents/{plan.primary_agent}.md... PLAN: {index-path}")`
108
- - `source: claude-code` → `Task(subagent_type="{plan.primary_agent}", prompt="<standard spawn prompt> PLAN: {index-path}")`
109
+ - `source: jdi` → `Agent(subagent_type="general-purpose", mode="bypassPermissions", prompt="You are {plan.primary_agent}. Read .jdi/framework/agents/{plan.primary_agent}.md... PLAN: {index-path}")`
110
+ - `source: claude-code` → `Agent(subagent_type="{plan.primary_agent}", mode="bypassPermissions", prompt="<standard spawn prompt> PLAN: {index-path}")`
109
111
 
110
112
  For split plans, the agent reads task files one at a time via the `file:` field in `state.yaml`.
111
113
 
112
- **Agent Teams mode:** Spawn ONE Task call per task using the source-aware pattern above. Pass `TASK_FILE: {task-file-path}` so the agent loads only its assigned task.
114
+ **Agent Teams mode:** Spawn ONE Agent call per task using the source-aware pattern above. Pass `TASK_FILE: {task-file-path}` so the agent loads only its assigned task. Every spawn MUST include `mode: "bypassPermissions"`.
113
115
 
114
116
  **Prompt scoping rules (non-negotiable):**
115
117
  - One task = one spawn. Never bundle multiple tasks into one prompt.
@@ -162,7 +164,7 @@ After each task's programmer returns, invoke `jdi-qa-tester` in `post-task-verif
162
164
 
163
165
  ### 11. Execute Deferred Ops
164
166
 
165
- Collect `files_to_create` returns from every agent and execute them via Write tool. Apply any pending commit operations. Do NOT skip this step — sandbox-returned artefacts are real work.
167
+ Agents create files directly (they have `bypassPermissions`), so `files_to_create` should be empty. If any agent does return `files_to_create` entries, create them via Write tool. Execute `commits_pending` via `git add` + `git commit`. Do NOT skip this step.
166
168
 
167
169
  ### 12. Run Verification Gates
168
170
 
@@ -32,8 +32,9 @@ Run `gh api repos/{owner}/{repo}/pulls/{number}/comments` (or equivalent) to con
32
32
  Spawn the specialist via Task tool. JDI specialists spawn as `general-purpose` with identity injected via prompt text:
33
33
 
34
34
  ```
35
- Task(
35
+ Agent(
36
36
  subagent_type="general-purpose",
37
+ mode="bypassPermissions",
37
38
  prompt="You are jdi-pr-feedback. Read .jdi/framework/agents/jdi-pr-feedback.md
38
39
  for your full role and instructions. Also read
39
40
  .jdi/framework/components/meta/AgentBase.md for the JDI base protocol.
@@ -42,8 +42,9 @@ Run `gh pr view {number}` to confirm the PR is reachable. If `gh` errors, STOP a
42
42
  Spawn the reviewer via Task tool. JDI specialists spawn as `general-purpose` with identity injected via prompt text:
43
43
 
44
44
  ```
45
- Task(
45
+ Agent(
46
46
  subagent_type="general-purpose",
47
+ mode="bypassPermissions",
47
48
  prompt="Read .jdi/framework/components/meta/AgentBase.md for the base protocol.
48
49
 
49
50
  Read learnings before reviewing — these represent the team's coding standards
@@ -55,47 +55,43 @@ Return a YAML block with `status`, agent-specific fields, and `next_action` afte
55
55
 
56
56
  <section name="Sandbox">
57
57
 
58
- ## Sandbox Awareness
58
+ ## File Operations
59
59
 
60
- You run in a sandboxed environment. Key constraints:
60
+ You are spawned with full file permissions (`mode: "bypassPermissions"`). All standard tools work:
61
61
 
62
- | Operation | Tool / Method | Persists? | Notes |
63
- |-----------|--------------|-----------|-------|
64
- | Edit existing files | Edit tool | **Yes** | Primary way to modify code |
65
- | Delete files | Bash `rm` | **Yes** | Destructive use with care |
66
- | Create new files | Write tool / Bash `cat >` | **No** | Silently fails report in `files_to_create` |
67
- | Git commits | Bash `git commit` | **No** | Silently fails — report in `commits_pending` |
68
- | Read files | Read tool | **Yes** | Works reliably |
69
- | Run commands | Bash tool | **Yes** | Output is real; side-effects vary |
62
+ | Operation | Tool / Method | Notes |
63
+ |-----------|--------------|-------|
64
+ | Edit existing files | Edit tool | Primary way to modify code |
65
+ | Create new files | Write tool | Workscreate files directly |
66
+ | Delete files | Bash `rm` | Destructiveuse with care |
67
+ | Read files | Read tool | Works reliably |
68
+ | Run commands | Bash tool | Output is real; side-effects vary |
70
69
 
71
70
  **Key Rules:**
72
- 1. **NEVER attempt `git commit`** — it will appear to succeed but produces no real commit.
73
- 2. **NEVER create new files** via Write tool or Bash redirection they will not persist.
74
- 3. **ALWAYS use the Edit tool** to modify existing files.
75
- 4. **Report pending work** in structured returns using `files_to_create` and `commits_pending`.
71
+ 1. **Use the Edit tool** to modify existing files (read first).
72
+ 2. **Use the Write tool** to create new files directlydo NOT defer to the orchestrator.
73
+ 3. **Do NOT run `git commit`** — the orchestrator handles commits after all tasks complete. Report commits needed in `commits_pending`.
76
74
 
77
- ### Structured Returns for Sandbox-Limited Operations
75
+ ### Structured Returns
78
76
 
79
77
  ```yaml
80
- files_to_create:
81
- - path: "path/to/new/file.md"
82
- content: |
83
- Full file content here...
84
78
  files_modified:
85
79
  - path/to/edited/file1.ts
80
+ files_created:
81
+ - path/to/new/file.md
86
82
  commits_pending:
87
83
  - message: |
88
84
  feat(01-01-T1): implement feature X
89
85
  files:
90
86
  - path/to/modified/file1.ts
87
+ - path/to/new/file.md
91
88
  ```
92
89
 
93
90
  ### Orchestrator Post-Agent Handling
94
91
 
95
- After a sandboxed agent completes, the orchestrator must:
96
- 1. Create files from `files_to_create` using Write tool
97
- 2. Execute commits from `commits_pending` via `git add` + `git commit`
98
- 3. Record real commit hashes in `.jdi/config/state.yaml`
92
+ After an agent completes, the orchestrator:
93
+ 1. Executes commits from `commits_pending` via `git add` + `git commit`
94
+ 2. Records real commit hashes in `.jdi/config/state.yaml`
99
95
 
100
96
  </section>
101
97
 
@@ -109,7 +105,7 @@ When operating within an Agent Team (spawned by coordinator):
109
105
 
110
106
  1. **Claim tasks**: Call TaskList, find tasks assigned to you
111
107
  2. **Execute**: Read task description, implement using Edit tool
112
- 3. **Report**: SendMessage to coordinator with structured return (include `files_modified`, `files_to_create`, `commits_pending`)
108
+ 3. **Report**: SendMessage to coordinator with structured return (include `files_modified`, `files_created`, `commits_pending`)
113
109
  4. **Complete**: TaskUpdate(status: "completed") AFTER sending results
114
110
  5. **Next**: Check TaskList for more assigned tasks. If none, go idle.
115
111
 
@@ -212,17 +212,20 @@ correct pattern for that source.
212
212
 
213
213
  ### Source-aware spawn pattern
214
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/` |
215
+ **All agents MUST be spawned with `mode: "bypassPermissions"`** so they can create and edit files without blocking on permission prompts. Agents run in background they cannot prompt the user for approval.
216
+
217
+ | `source` in catalogue | `subagent_type` | `mode` | Identity mechanism |
218
+ |----------------------|-----------------|--------|--------------------|
219
+ | `jdi` | `"general-purpose"` | `"bypassPermissions"` | Prompt text: `"You are {task.agent}. Read .jdi/framework/agents/{task.agent}.md for instructions."` |
220
+ | `claude-code` | `"{task.agent}"` | `"bypassPermissions"` | Native — Claude Code loads the agent spec from `.claude/agents/` |
219
221
 
220
222
  ### Single-agent mode
221
223
 
222
224
  ```
223
225
  # source: jdi (JDI framework specialist)
224
- Task(
226
+ Agent(
225
227
  subagent_type: "general-purpose",
228
+ mode: "bypassPermissions",
226
229
  name: "{plan.primary_agent}",
227
230
  prompt: "You are {plan.primary_agent}. Read .jdi/framework/agents/{plan.primary_agent}.md
228
231
  for your full role and instructions. Also read .jdi/framework/components/meta/AgentBase.md
@@ -232,8 +235,9 @@ Task(
232
235
  )
233
236
 
234
237
  # source: claude-code (user-added registered specialist)
235
- Task(
238
+ Agent(
236
239
  subagent_type: "{plan.primary_agent}", # e.g. unity-specialist
240
+ mode: "bypassPermissions",
237
241
  name: "{plan.primary_agent}",
238
242
  prompt: "<standard single-agent spawn prompt from ComplexityRouter>"
239
243
  )
@@ -246,21 +250,23 @@ fall back to `subagent_type="general-purpose"` with a `jdi-backend` /
246
250
  ### Agent-teams mode
247
251
 
248
252
  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
253
+ from the plan's `available_agents` catalogue. Spawn ONE Agent tool call per task
250
254
  using the pattern that matches its source (see table above).
251
255
 
252
256
  ```
253
257
  # JDI specialist (source: jdi)
254
- Task(
258
+ Agent(
255
259
  subagent_type: "general-purpose",
260
+ mode: "bypassPermissions",
256
261
  name: "{task.agent}-{task_id}",
257
262
  prompt: "You are {task.agent}. Read .jdi/framework/agents/{task.agent}.md for instructions.
258
263
  <spawn prompt from AgentTeamsOrchestration with TASK_FILE: {task file}>"
259
264
  )
260
265
 
261
266
  # Claude Code registered specialist (source: claude-code)
262
- Task(
267
+ Agent(
263
268
  subagent_type: "{task.agent}",
269
+ mode: "bypassPermissions",
264
270
  name: "{task.agent}-{task_id}",
265
271
  prompt: "<spawn prompt from AgentTeamsOrchestration with TASK_FILE: {task file}>"
266
272
  )
@@ -68,15 +68,15 @@ and the `agent_rationale` explaining why you were picked for this task).
68
68
  If TASK_FILE is not provided (legacy plan), claim tasks from TaskList and read
69
69
  task details from the PLAN file.
70
70
 
71
- 1. Implement using Edit tool
71
+ 1. Implement using Edit tool (existing files) and Write tool (new files)
72
72
  2. SendMessage to coordinator with structured return
73
73
  3. Mark task completed via TaskUpdate
74
74
 
75
- Report: files_modified, files_to_create, commits_pending.
75
+ Report: files_modified, files_created, commits_pending.
76
76
  No git commit (use commits_pending).
77
77
  ```
78
78
 
79
- Spawned via `Task(subagent_type="general-purpose", ...)` — see
79
+ Spawned via `Agent(subagent_type="general-purpose", mode="bypassPermissions", ...)` — see
80
80
  `.jdi/framework/jdi.md` Critical Constraints for why.
81
81
 
82
82
  ### `source: claude-code` — registered Claude Code subagent
@@ -89,21 +89,20 @@ Your agent definition has already been loaded by Claude Code from
89
89
  <same TEAM / PLAN / TASK_FILE / WORKING_DIR block + steps + report as above>
90
90
  ```
91
91
 
92
- Spawned via `Task(subagent_type="{task.agent}", ...)` — Claude Code validates
92
+ Spawned via `Agent(subagent_type="{task.agent}", mode="bypassPermissions", ...)` — Claude Code validates
93
93
  the subagent type against its registered list. See
94
94
  `.jdi/framework/components/meta/AgentRouter.md` §4 for full rules.
95
95
 
96
96
  ---
97
97
 
98
- ## Deferred Operations Checklist
98
+ ## Post-Agent Operations
99
99
 
100
100
  After all specialist tasks complete:
101
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
102
+ 1. **Collect** — Aggregate `files_modified`, `files_created`, `commits_pending` from all SendMessage results
103
+ 2. **Execute commits** — `git add` + `git commit` for each `commits_pending` entry
104
+ 3. **Record hashes** — Store real commit hashes in state.yaml
105
+ 4. **Verify** — Confirm all `files_modified` and `files_created` are present in working tree
107
106
 
108
107
  ---
109
108
 
@@ -56,8 +56,9 @@ See `.jdi/framework/components/meta/AgentRouter.md` §4 for full spawn rules.
56
56
  ### JDI specialist (source: jdi — the common case)
57
57
 
58
58
  ```
59
- Task(
59
+ Agent(
60
60
  subagent_type: "general-purpose", # MUST be general-purpose for JDI agents
61
+ mode: "bypassPermissions", # REQUIRED: agents need file write permissions
61
62
  name: "{plan.primary_agent}",
62
63
  prompt: "You are {plan.primary_agent}. Read .jdi/framework/agents/{plan.primary_agent}.md
63
64
  for your full role and instructions. Also read
@@ -73,15 +74,16 @@ for your full role and instructions. Also read
73
74
  Execute all tasks in the plan sequentially. PLAN: {plan-path}.
74
75
  For split plans (task_files in frontmatter), read each task file one at a time
75
76
  from the file: field in state.yaml.
76
- Report: files_modified, files_to_create, commits_pending."
77
+ Report: files_modified, files_created, commits_pending."
77
78
  )
78
79
  ```
79
80
 
80
81
  ### Claude Code registered specialist (source: claude-code)
81
82
 
82
83
  ```
83
- Task(
84
+ Agent(
84
85
  subagent_type: "{plan.primary_agent}", # e.g. unity-specialist
86
+ mode: "bypassPermissions", # REQUIRED: agents need file write permissions
85
87
  name: "{plan.primary_agent}",
86
88
  prompt: "Your agent definition has already been loaded from .claude/agents/.
87
89
  Also read .jdi/framework/components/meta/AgentBase.md for the JDI base protocol.
package/framework/jdi.md CHANGED
@@ -35,22 +35,30 @@ model: opus
35
35
 
36
36
  ### Correct Pattern
37
37
 
38
- Agent identity is passed via the **prompt parameter**, NOT the `subagent_type` parameter:
38
+ Agent identity is passed via the **prompt parameter**, NOT the `subagent_type` parameter.
39
+ **Permission mode** MUST be `"bypassPermissions"` so agents can create and edit files without blocking on approval prompts.
39
40
 
40
41
  ```
41
- Task(
42
+ Agent(
42
43
  prompt="You are jdi-programmer. Read .jdi/framework/agents/jdi-programmer.md for instructions. Execute: {task}",
43
- subagent_type="general-purpose" ← MUST be "general-purpose"
44
+ subagent_type="general-purpose", ← MUST be "general-purpose"
45
+ mode="bypassPermissions" ← REQUIRED: agents need file write permissions
44
46
  )
45
47
  ```
46
48
 
47
- ### Incorrect Pattern (WILL FAIL)
49
+ ### Incorrect Patterns (WILL FAIL)
48
50
 
49
51
  ```
50
- Task(
52
+ Agent(
51
53
  prompt="Execute the plan...",
52
54
  subagent_type="jdi-programmer" ← WRONG: Causes classifyHandoffIfNeeded error
53
55
  )
56
+
57
+ Agent(
58
+ prompt="Execute the plan...",
59
+ subagent_type="general-purpose"
60
+ # mode omitted ← WRONG: Agent blocked on Write/Edit permissions
61
+ )
54
62
  ```
55
63
 
56
64
  ### Why This Matters
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@benzotti/jdi",
3
- "version": "0.1.47",
3
+ "version": "0.1.49",
4
4
  "description": "JDI - Context-efficient AI development framework for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {