@benzotti/jdi 0.1.46 → 0.1.47
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 +1 -1
- package/framework/agents/jdi-planner.md +17 -1
- package/framework/agents/jdi-researcher.md +72 -0
- package/framework/commands/build.md +24 -2
- package/framework/commands/create-plan.md +32 -4
- package/framework/commands/implement-plan.md +24 -2
- package/framework/components/meta/InteractiveGate.md +138 -0
- package/package.json +1 -1
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.
|
|
12794
|
+
version: "0.1.47",
|
|
12795
12795
|
description: "JDI - Context-efficient AI development framework for Claude Code",
|
|
12796
12796
|
type: "module",
|
|
12797
12797
|
bin: {
|
|
@@ -22,7 +22,7 @@ Do not add unrelated extras (tooling, testing, linting, CI) unless the user expl
|
|
|
22
22
|
2. **DO investigate the full scope of the request.** "Scope discipline" means no unrelated additions — it does NOT mean ignoring requirements that are clearly implied by the request. If the user asks for a UI view with specific columns, you must verify those columns exist in the backend response, and plan to add them if they don't.
|
|
23
23
|
3. **When reference PRs/tickets are provided, analyse them thoroughly.** Read the actual diff, files changed, patterns used, columns/fields added, routes created, and data flow. The user provides reference PRs so you follow the same pattern — extract the full pattern, don't just skim.
|
|
24
24
|
4. **When the user says "backend is already done", verify it.** Read the actual API endpoint, check what fields it returns, and confirm they match the frontend requirements. If there's a gap, include it in the plan.
|
|
25
|
-
5. **Do not make subjective decisions.** If something is ambiguous (e.g. folder structure, routing library, state management), list it as an open question and ask the user — do not guess.
|
|
25
|
+
5. **Do not make subjective decisions.** If something is ambiguous (e.g. folder structure, routing library, state management), list it as an open question and ask the user — do not guess. If pre-answered questions cover a decision point, use the pre-answered value rather than listing it as open.
|
|
26
26
|
6. **Suggest optional additions separately.** After presenting the plan, list 3-5 common additions the user might want. These are suggestions, NOT part of the plan.
|
|
27
27
|
7. **Same request = same plan.** Two identical requests must produce structurally identical plans. Achieve this by following the templates exactly and not improvising.
|
|
28
28
|
|
|
@@ -33,6 +33,22 @@ Before planning, ALWAYS:
|
|
|
33
33
|
2. Apply any team preferences found (e.g. "always use path aliases", "prefer Zustand over Redux")
|
|
34
34
|
3. Learnings override your defaults — if the team has a preference, follow it
|
|
35
35
|
|
|
36
|
+
## CRITICAL: Respect Pre-Answered Questions
|
|
37
|
+
|
|
38
|
+
When the spawn prompt includes a `PRE_ANSWERED_QUESTIONS` block:
|
|
39
|
+
|
|
40
|
+
1. Parse each question-id and chosen answer
|
|
41
|
+
2. Treat these as settled decisions — do NOT re-ask them
|
|
42
|
+
3. Do NOT surface them as "Open Questions" in the plan
|
|
43
|
+
4. Reference them in relevant task descriptions as
|
|
44
|
+
"Decision: {question} → {answer} (pre-plan gate)"
|
|
45
|
+
5. Only surface NEW questions that genuinely emerged DURING
|
|
46
|
+
planning and could not have been anticipated from the
|
|
47
|
+
feature description alone
|
|
48
|
+
|
|
49
|
+
Pre-answered questions represent explicit user choices made via
|
|
50
|
+
interactive prompts. Overriding them silently is forbidden.
|
|
51
|
+
|
|
36
52
|
## CRITICAL: File Writing is Mandatory
|
|
37
53
|
|
|
38
54
|
You MUST write files using Write/Edit tools. Returning plan content as text is NOT acceptable.
|
|
@@ -55,6 +55,78 @@ Write to `.jdi/research/{topic}-research.md`.
|
|
|
55
55
|
|
|
56
56
|
---
|
|
57
57
|
|
|
58
|
+
## Pre-Plan Discovery Mode
|
|
59
|
+
|
|
60
|
+
**Trigger:** Spawned by `create-plan` with mode flag `--pre-plan-discovery`.
|
|
61
|
+
|
|
62
|
+
This is a lightweight, fast mode — NOT a full research report. The goal is to identify decision points in the codebase that the user should resolve before planning begins.
|
|
63
|
+
|
|
64
|
+
### Constraints
|
|
65
|
+
|
|
66
|
+
- **Budget:** Read at most 15 files
|
|
67
|
+
- **Output:** Under 400 words
|
|
68
|
+
- **No file writes** — do not create `.jdi/research/` files in this mode
|
|
69
|
+
|
|
70
|
+
### Input
|
|
71
|
+
|
|
72
|
+
- Feature description
|
|
73
|
+
- `PRE_DISCOVERED_CONTEXT` (scaffolding already read by the orchestrator)
|
|
74
|
+
|
|
75
|
+
### What to Look For
|
|
76
|
+
|
|
77
|
+
Scan the codebase for decision points relevant to the feature:
|
|
78
|
+
|
|
79
|
+
- **Competing patterns** — e.g. two state management approaches, two API styles, inconsistent naming conventions
|
|
80
|
+
- **Missing data/fields** — the feature implies data that doesn't exist yet in current schemas/models
|
|
81
|
+
- **Architectural choices** — where to put new code, which module to extend, whether to create a new module
|
|
82
|
+
- **Dependency/library choices** — feature needs a capability the project doesn't have yet
|
|
83
|
+
- **Existing conventions** — patterns that constrain the approach (established test patterns, folder structure, naming)
|
|
84
|
+
|
|
85
|
+
### Output Format
|
|
86
|
+
|
|
87
|
+
Return a structured YAML `RESEARCH_QUESTIONS` block:
|
|
88
|
+
|
|
89
|
+
```yaml
|
|
90
|
+
RESEARCH_DISCOVERY:
|
|
91
|
+
research_questions:
|
|
92
|
+
- id: RQ-01
|
|
93
|
+
question: "The codebase uses both X and Y for Z — which should this feature follow?"
|
|
94
|
+
header: "PATTERN"
|
|
95
|
+
options:
|
|
96
|
+
- label: "Use X"
|
|
97
|
+
description: "Consistent with src/foo/ — the newer pattern"
|
|
98
|
+
- label: "Use Y"
|
|
99
|
+
description: "Consistent with src/bar/ — the legacy pattern"
|
|
100
|
+
context: "Found X in src/foo/*.ts (3 files), Y in src/bar/*.ts (7 files)"
|
|
101
|
+
- id: RQ-02
|
|
102
|
+
question: "..."
|
|
103
|
+
header: "..."
|
|
104
|
+
options:
|
|
105
|
+
- label: "..."
|
|
106
|
+
description: "..."
|
|
107
|
+
context: "..."
|
|
108
|
+
research_context: "Brief summary of what was found for the planner"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Each question must include:
|
|
112
|
+
- `id`: Sequential ID (`RQ-01`, `RQ-02`, ...)
|
|
113
|
+
- `question`: Clear, specific question text
|
|
114
|
+
- `header`: Category tag, max 12 chars (`PATTERN`, `STACK`, `DATA`, `APPROACH`, `BOUNDARY`)
|
|
115
|
+
- `options`: 2-4 options with `label` and `description` grounded in codebase findings
|
|
116
|
+
- `context`: Brief note on what evidence was found
|
|
117
|
+
|
|
118
|
+
### If No Questions Found
|
|
119
|
+
|
|
120
|
+
Return an empty array with a brief context summary. This is a valid outcome for clear-cut features:
|
|
121
|
+
|
|
122
|
+
```yaml
|
|
123
|
+
RESEARCH_DISCOVERY:
|
|
124
|
+
research_questions: []
|
|
125
|
+
research_context: "Scanned src/components/ and src/api/. Single pattern in use (React Query + Zustand). No competing approaches or ambiguous extension points found."
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
58
130
|
## Structured Returns
|
|
59
131
|
|
|
60
132
|
```yaml
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: build
|
|
3
3
|
description: "JDI: Guided setup and state-aware entry point for new and returning users"
|
|
4
|
-
allowed-tools: Read, Glob, Grep, Bash
|
|
4
|
+
allowed-tools: Read, Glob, Grep, Bash, AskUserQuestion
|
|
5
5
|
argument-hint: "[no arguments]"
|
|
6
6
|
context: |
|
|
7
7
|
!cat .jdi/config/state.yaml 2>/dev/null | head -20
|
|
@@ -51,6 +51,19 @@ If NEITHER condition is true, the user is new — proceed to step 3.
|
|
|
51
51
|
|
|
52
52
|
Present exactly these four options. Frame them for software projects — no game-specific language, no engine/prototype vocabulary.
|
|
53
53
|
|
|
54
|
+
**Preferred: AskUserQuestion.** Use AskUserQuestion with:
|
|
55
|
+
- **header:** `STAGE`
|
|
56
|
+
- **question:** `Which of these describes your situation best?`
|
|
57
|
+
- **options:**
|
|
58
|
+
1. label: `No idea yet` — description: `I want to figure out what to build`
|
|
59
|
+
2. label: `Vague idea` — description: `I know the problem but not the shape of the solution`
|
|
60
|
+
3. label: `Clear concept` — description: `I know what I want to build and roughly how`
|
|
61
|
+
4. label: `Existing work` — description: `There's already code or scaffolding I want to continue from`
|
|
62
|
+
|
|
63
|
+
The automatic "Other" option covers situations that don't fit. Route based on the selected option — same branch logic as step 4.
|
|
64
|
+
|
|
65
|
+
**Fallback (if AskUserQuestion is unavailable):** Present as plain markdown instead:
|
|
66
|
+
|
|
54
67
|
> **Welcome to JDI.**
|
|
55
68
|
>
|
|
56
69
|
> Before I suggest anything, I'd like to understand where you are. Which of these describes your situation best?
|
|
@@ -98,7 +111,16 @@ Each branch below is its own script. Follow the one that matches the user's choi
|
|
|
98
111
|
|
|
99
112
|
### 5. Confirm Before Handing Off
|
|
100
113
|
|
|
101
|
-
After presenting your recommendation,
|
|
114
|
+
After presenting your recommendation, confirm with the user before proceeding.
|
|
115
|
+
|
|
116
|
+
**Preferred: AskUserQuestion.** Use AskUserQuestion with:
|
|
117
|
+
- **header:** `NEXT`
|
|
118
|
+
- **question:** `Ready to proceed?`
|
|
119
|
+
- **options:**
|
|
120
|
+
1. label: `{recommended command}` — description: `Start with the recommended next step`
|
|
121
|
+
2. label: `Something else` — description: `I want to do something different`
|
|
122
|
+
|
|
123
|
+
**Fallback (if AskUserQuestion is unavailable):** Ask as plain text instead:
|
|
102
124
|
|
|
103
125
|
> "Would you like to start with **{recommended command}**, or something else?"
|
|
104
126
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: create-plan
|
|
3
3
|
description: "JDI: Create implementation plan"
|
|
4
|
-
allowed-tools: Read, Glob, Grep, Bash, Write, Edit, Task
|
|
4
|
+
allowed-tools: Read, Glob, Grep, Bash, Write, Edit, Task, AskUserQuestion
|
|
5
5
|
argument-hint: "<feature to plan> [--worktree | --worktree-lightweight | --status]"
|
|
6
6
|
context: |
|
|
7
7
|
!cat .jdi/config/state.yaml 2>/dev/null | head -25
|
|
@@ -12,7 +12,7 @@ context: |
|
|
|
12
12
|
|
|
13
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
14
|
|
|
15
|
-
**This skill follows `<JDI:StrictnessProtocol
|
|
15
|
+
**This skill follows `<JDI:StrictnessProtocol />`, `<JDI:SilentDiscovery />`, and `<JDI:InteractiveGate />`. Read those components before executing any step below.**
|
|
16
16
|
|
|
17
17
|
---
|
|
18
18
|
|
|
@@ -89,6 +89,30 @@ If the feature description looks trivial (single file, <30 minutes, no architect
|
|
|
89
89
|
|
|
90
90
|
**Wait for the user's answer. Do not proceed until they respond.** If they pick quick, STOP — do not spawn the planner.
|
|
91
91
|
|
|
92
|
+
### 4a. Pre-Plan Research Spawn
|
|
93
|
+
|
|
94
|
+
Spawn `jdi-researcher` in `pre-plan-discovery` mode 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
|
|
98
|
+
- Mode: `--pre-plan-discovery`
|
|
99
|
+
- Spec path: `.jdi/framework/agents/jdi-researcher.md`
|
|
100
|
+
- Instruction: _"Scan the codebase for decision points relevant to this feature. Return RESEARCH_QUESTIONS YAML. Budget: <=15 file reads, <400 word report."_
|
|
101
|
+
|
|
102
|
+
Store the return as `RESEARCH_DISCOVERY`.
|
|
103
|
+
|
|
104
|
+
### 4b. Pre-Planning Questions (Interactive Gate)
|
|
105
|
+
|
|
106
|
+
Execute `<JDI:InteractiveGate mode="pre-plan" />`:
|
|
107
|
+
|
|
108
|
+
1. Collect surface-level ambiguity questions from the feature description
|
|
109
|
+
2. Collect research-driven questions from `RESEARCH_DISCOVERY.research_questions`
|
|
110
|
+
3. Merge, deduplicate, prioritise (research-driven first)
|
|
111
|
+
4. If questions exist, present via `AskUserQuestion`. Wait for answers.
|
|
112
|
+
5. If zero questions from both sources, skip silently.
|
|
113
|
+
|
|
114
|
+
Store answers as `PRE_ANSWERED_QUESTIONS`.
|
|
115
|
+
|
|
92
116
|
### 5. Spawn Planner
|
|
93
117
|
|
|
94
118
|
Spawn `jdi-planner` via `Task(subagent_type="general-purpose")`. The spawn prompt MUST include:
|
|
@@ -96,7 +120,9 @@ Spawn `jdi-planner` via `Task(subagent_type="general-purpose")`. The spawn promp
|
|
|
96
120
|
- The feature description (`$ARGUMENTS`)
|
|
97
121
|
- `PRE_DISCOVERED_CONTEXT` as a YAML block — planner must NOT re-read scaffolding
|
|
98
122
|
- `AVAILABLE_AGENTS` catalogue — planner pins specialists via AgentRouter
|
|
99
|
-
-
|
|
123
|
+
- `PRE_ANSWERED_QUESTIONS` YAML block (from step 4b, if any questions were asked)
|
|
124
|
+
- `RESEARCH_DISCOVERY.research_context` (so the planner doesn't re-scan what the researcher already found)
|
|
125
|
+
- Explicit instruction: _"Do NOT re-prompt the user for anything already in PRE_DISCOVERED_CONTEXT. These questions were already answered by the user — do NOT re-ask them. The research context below summarises what was found in the codebase — use it, don't re-scan. Only surface NEW questions that emerged during planning that could not have been anticipated."_
|
|
100
126
|
- Spec path: `.jdi/framework/agents/jdi-planner.md`
|
|
101
127
|
|
|
102
128
|
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.
|
|
@@ -156,7 +182,9 @@ Pre-written responses for known deviations. When one applies, follow the scripte
|
|
|
156
182
|
|-----------|----------|
|
|
157
183
|
| 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
184
|
| `.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") |
|
|
185
|
+
| Feature description is vague ("improve X") | Steps 4a + 4b handle this: the researcher discovers codebase decision points, and the InteractiveGate surfaces ambiguity questions via AskUserQuestion. Do not waste a planner invocation on an underspecified prompt. |
|
|
186
|
+
| Pre-plan researcher returns zero questions | Skip step 4b if surface-level analysis also yields zero questions. Proceed directly to step 5. This is expected for clear features. |
|
|
187
|
+
| Pre-plan researcher returns >4 questions | Batch into multiple AskUserQuestion calls (max 4 per call). Present highest-priority questions first. |
|
|
160
188
|
| Worktree flag but worktree already exists | Ask the user: reuse the existing worktree, or pick a new name? Do not silently proceed. |
|
|
161
189
|
| `--status` with no current plan | Output "No current plan — run `/jdi:create-plan \"<feature>\"` to create one" and STOP. |
|
|
162
190
|
| Planner returns without writing any files | STOP, report the failure, do NOT advance state. Ask the user to re-invoke or debug. |
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: implement-plan
|
|
3
3
|
description: "JDI: Execute implementation plan"
|
|
4
|
-
allowed-tools: Read, Glob, Grep, Bash, Write, Edit, Task
|
|
4
|
+
allowed-tools: Read, Glob, Grep, Bash, Write, Edit, Task, AskUserQuestion
|
|
5
5
|
argument-hint: "[--team | --single | --dry-run | --skip-qa]"
|
|
6
6
|
context: |
|
|
7
7
|
!cat .jdi/config/state.yaml 2>/dev/null | head -30
|
|
@@ -120,6 +120,27 @@ For split plans, the agent reads task files one at a time via the `file:` field
|
|
|
120
120
|
|
|
121
121
|
**Wave-based execution:** honour `waves:` from the plan frontmatter. Spawn all tasks in wave N in parallel; wait for all returns before starting wave N+1.
|
|
122
122
|
|
|
123
|
+
### 8a. Blocker Resolution
|
|
124
|
+
|
|
125
|
+
When an agent returns `status: blocked`:
|
|
126
|
+
|
|
127
|
+
1. Read the blocker context from the agent's structured return
|
|
128
|
+
(blocker_reason, blocker_context, suggested_options if any)
|
|
129
|
+
2. Execute `<JDI:InteractiveGate mode="blocker-resolution" />`
|
|
130
|
+
3. Present the blocker to the user via AskUserQuestion:
|
|
131
|
+
- header: "BLOCKED"
|
|
132
|
+
- question: "{task_name} is blocked: {blocker_reason}"
|
|
133
|
+
- options (pick 2-4 based on context):
|
|
134
|
+
a) Resolve with approach X (if agent suggested options)
|
|
135
|
+
b) Skip this task and continue
|
|
136
|
+
c) Modify the task scope
|
|
137
|
+
d) Halt the plan
|
|
138
|
+
4. Route based on answer:
|
|
139
|
+
- Resolve: re-spawn the agent with the resolution context
|
|
140
|
+
- Skip: advance-task with skip status, continue to next
|
|
141
|
+
- Modify: enter inline edit of the task file, then re-spawn
|
|
142
|
+
- Halt: stop execution, enter review loop at step 14
|
|
143
|
+
|
|
123
144
|
### 9. Advance Task State
|
|
124
145
|
|
|
125
146
|
After each task's programmer returns successfully, run:
|
|
@@ -185,7 +206,8 @@ Pre-written responses for known deviations. When one applies, follow the scripte
|
|
|
185
206
|
| Plan status is not `approved` | STOP at step 2. Tell the user to approve the plan first. Do NOT force-advance. |
|
|
186
207
|
| Pinned agent not installed | Downgrade to `general-purpose`, record the downgrade, continue. Surface in the final summary. |
|
|
187
208
|
| Task file missing (listed in `task_files:` but not on disk) | STOP. Report the missing file. Do NOT advance state. |
|
|
188
|
-
| Programmer returns with `status: blocked` |
|
|
209
|
+
| Programmer returns with `status: blocked` | Enter step 8a (Blocker Resolution). Do NOT advance task state. Present the blocker interactively via AskUserQuestion and route based on user's choice. |
|
|
210
|
+
| Agent suggests resolution options in structured return | Include agent's suggestions as the first AskUserQuestion options in step 8a, before the default options (skip/modify/halt). |
|
|
189
211
|
| QA verification S1 or S2 failure | HALT the plan immediately. Record the failure in state. Wait for user direction before continuing. |
|
|
190
212
|
| Verification gate failure at step 12 | STOP before completing. Report the failure, enter review loop. Do NOT advance state to `complete`. |
|
|
191
213
|
| `--dry-run` with no changes needed | Output "no-op: plan is already at target state" and STOP. |
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# InteractiveGate Component
|
|
2
|
+
|
|
3
|
+
A reusable question gate that presents structured decisions to the user via `AskUserQuestion` before a phase transition. Questions are sourced from two channels: surface-level ambiguity detection and research-driven codebase analysis.
|
|
4
|
+
|
|
5
|
+
When a command references `<JDI:InteractiveGate mode="..." />`, execute the steps below. Do NOT skip the merge/dedup logic even if only one source produces questions.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Modes
|
|
10
|
+
|
|
11
|
+
| Mode | When | Question Sources |
|
|
12
|
+
|------|------|-----------------|
|
|
13
|
+
| `pre-plan` | Before planner spawn in `create-plan` | Surface-level analysis of feature description + `RESEARCH_QUESTIONS` from pre-plan research spawn |
|
|
14
|
+
| `blocker-resolution` | During implementation when a task is blocked | Surface-level analysis of the blocker description + context from the blocking task |
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Question Sources
|
|
19
|
+
|
|
20
|
+
### Surface-Level (Ambiguity Detection)
|
|
21
|
+
|
|
22
|
+
Analyse the feature description (or blocker description) for ambiguity signals:
|
|
23
|
+
|
|
24
|
+
- **Vague scope words** — "improve", "enhance", "refactor", "clean up", "optimise" without measurable targets
|
|
25
|
+
- **Missing tech stack specifics** — feature implies a technology choice but doesn't state one
|
|
26
|
+
- **Unclear boundaries** — "and more", "etc.", "various", "all the things"
|
|
27
|
+
- **Multiple possible approaches** — description could be solved in fundamentally different ways
|
|
28
|
+
- **Implicit assumptions** — feature assumes context the user hasn't stated
|
|
29
|
+
|
|
30
|
+
Generate questions only for genuine ambiguities. Do NOT manufacture questions for clear descriptions.
|
|
31
|
+
|
|
32
|
+
### Research-Driven
|
|
33
|
+
|
|
34
|
+
Consume the `RESEARCH_QUESTIONS` YAML block produced by the pre-plan research spawn (or equivalent). These are decision points discovered by analysing the actual codebase:
|
|
35
|
+
|
|
36
|
+
- Competing patterns (e.g. two state management approaches in use)
|
|
37
|
+
- Missing data/fields the feature will need
|
|
38
|
+
- Architectural choices (where to place new code, which module to extend)
|
|
39
|
+
- Dependency/library choices
|
|
40
|
+
- Existing conventions that constrain the approach
|
|
41
|
+
|
|
42
|
+
Research-driven questions arrive pre-formatted with `id`, `question`, `header`, `options`, and `context`.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Merge and Prioritise
|
|
47
|
+
|
|
48
|
+
1. Collect surface-level questions (assign IDs `SQ-01`, `SQ-02`, ...)
|
|
49
|
+
2. Collect research-driven questions (IDs `RQ-01`, `RQ-02`, ... from the researcher)
|
|
50
|
+
3. Deduplicate: if a surface question covers the same decision as a research question, keep the research version (it has codebase-grounded options)
|
|
51
|
+
4. Sort: research-driven questions first (higher signal), then surface-level
|
|
52
|
+
5. Cap at a reasonable total — if more than 8 questions survive, drop the lowest-priority surface-level questions
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## AskUserQuestion Format
|
|
57
|
+
|
|
58
|
+
Each question presented via `AskUserQuestion` must follow this structure:
|
|
59
|
+
|
|
60
|
+
- **`header`**: Short category tag — max 12 characters. Examples: `SCOPE`, `STACK`, `APPROACH`, `PATTERN`, `DATA`, `BOUNDARY`
|
|
61
|
+
- **`question`**: The actual question text. Clear, specific, and actionable.
|
|
62
|
+
- **`options`**: 2-4 options, each with:
|
|
63
|
+
- `label`: Short option name
|
|
64
|
+
- `description`: One-line explanation. For research-driven questions, ground this in what the researcher found in the codebase.
|
|
65
|
+
- **`multiSelect`**: Set to `true` only for non-mutually-exclusive choices. Default `false`.
|
|
66
|
+
- An automatic "Other" option is always available (built into the tool).
|
|
67
|
+
|
|
68
|
+
**Batching rule:** Maximum 4 questions per `AskUserQuestion` call (tool limit). If more than 4 questions survive merge, batch into multiple sequential calls. Present the highest-priority questions first.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Output Format
|
|
73
|
+
|
|
74
|
+
Store all answers as `PRE_ANSWERED_QUESTIONS` in YAML:
|
|
75
|
+
|
|
76
|
+
```yaml
|
|
77
|
+
PRE_ANSWERED_QUESTIONS:
|
|
78
|
+
- id: RQ-01
|
|
79
|
+
source: research
|
|
80
|
+
question: "The codebase uses both Redux and Zustand — which should this feature follow?"
|
|
81
|
+
chosen: "Use Zustand"
|
|
82
|
+
custom_text: null
|
|
83
|
+
- id: SQ-01
|
|
84
|
+
source: surface
|
|
85
|
+
question: "What does 'improve performance' mean concretely?"
|
|
86
|
+
chosen: "Reduce load time below 2s"
|
|
87
|
+
custom_text: "Specifically the dashboard page load"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Fields:
|
|
91
|
+
- `id`: Question ID (`RQ-*` for research, `SQ-*` for surface)
|
|
92
|
+
- `source`: `research` or `surface`
|
|
93
|
+
- `question`: The question text (for downstream reference)
|
|
94
|
+
- `chosen`: The selected option label (or "Other" if custom)
|
|
95
|
+
- `custom_text`: User's free-text input if they chose "Other", otherwise `null`
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Skip Condition
|
|
100
|
+
|
|
101
|
+
If BOTH sources yield zero questions after analysis, skip the gate entirely. Do NOT present an empty AskUserQuestion call. Proceed directly to the next step in the parent workflow.
|
|
102
|
+
|
|
103
|
+
Log internally: `InteractiveGate: 0 questions from surface + 0 from research — skipping gate.`
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Fallback
|
|
108
|
+
|
|
109
|
+
If `AskUserQuestion` is not available (not in the skill's `allowed-tools` list), fall back to plain markdown:
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
Before we proceed, I have a few questions:
|
|
113
|
+
|
|
114
|
+
1. **[PATTERN]** The codebase uses both X and Y for Z — which should this feature follow?
|
|
115
|
+
- A) Use X — consistent with src/foo/ (newer pattern)
|
|
116
|
+
- B) Use Y — consistent with src/bar/ (legacy pattern)
|
|
117
|
+
- C) Other (please specify)
|
|
118
|
+
|
|
119
|
+
2. **[SCOPE]** What does "improve" mean concretely?
|
|
120
|
+
- A) Reduce load time below 2s
|
|
121
|
+
- B) Reduce memory usage
|
|
122
|
+
- C) Other (please specify)
|
|
123
|
+
|
|
124
|
+
Please respond with your choices (e.g. "1A, 2B") or provide details.
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Parse the user's response and populate `PRE_ANSWERED_QUESTIONS` accordingly.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Usage
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
<JDI:InteractiveGate mode="pre-plan" />
|
|
135
|
+
<JDI:InteractiveGate mode="blocker-resolution" />
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Referenced within a skill's numbered workflow steps. Requires that question sources (surface analysis input and/or `RESEARCH_QUESTIONS` block) are available in the execution context before invocation.
|