Skip to content

Commit 2d3a26a

Browse files
committed
feature: add smart questioning and impact analysis to /cat:add
1 parent e6d6fd5 commit 2d3a26a

2 files changed

Lines changed: 242 additions & 18 deletions

File tree

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# State
22

3-
- **Status:** open
4-
- **Progress:** 0%
3+
- **Status:** closed
4+
- **Progress:** 100%
55
- **Dependencies:** [refactor-curiosity-to-effort]
66
- **Blocks:** []
7-
- **Last Updated:** 2026-02-25
7+
- **Last Updated:** 2026-02-27

plugin/skills/add/first-use.md

Lines changed: 239 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ If `planning_valid` is false in HANDLER_DATA:
5151

5252
If the command was invoked with arguments (e.g., `/cat:add make installation easier`):
5353
- Capture the full argument string as ISSUE_DESCRIPTION
54-
- Skip directly to step: issue_ask_type_and_criteria (bypassing select_type and the freeform description question)
54+
- Skip directly to step: issue_read_config (bypassing select_type and the freeform description question)
5555

5656
If no arguments provided:
5757
- Continue to step: select_type
@@ -105,13 +105,43 @@ version it belongs to.
105105

106106
**If ISSUE_DESCRIPTION already set (from command args):**
107107
- Skip the freeform question
108-
- Continue directly to step: issue_ask_type_and_criteria
108+
- Continue directly to step: issue_read_config
109109

110110
**Otherwise, ask for description (FREEFORM):**
111111

112112
Ask inline: "What do you want to accomplish? Describe the issue you have in mind."
113113

114-
Capture as ISSUE_DESCRIPTION, then continue to step: issue_clarify_intent.
114+
Capture as ISSUE_DESCRIPTION, then continue to step: issue_read_config.
115+
116+
</step>
117+
118+
<step name="issue_read_config">
119+
120+
**Read and validate configuration:**
121+
122+
Read the `effort` value from cat-config.json and store it for all downstream steps:
123+
124+
```bash
125+
CONFIG_FILE="${CLAUDE_PROJECT_DIR}/.claude/cat/cat-config.json"
126+
if [[ ! -f "$CONFIG_FILE" ]]; then
127+
echo "ERROR: cat-config.json not found: $CONFIG_FILE" >&2
128+
echo "Solution: Run /cat:init to initialize the project." >&2
129+
exit 1
130+
fi
131+
EFFORT=$(grep '"effort"' "$CONFIG_FILE" | sed 's/.*"effort"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/')
132+
if [[ -z "$EFFORT" ]]; then
133+
echo "ERROR: 'effort' key not found in $CONFIG_FILE." >&2
134+
echo "Add: \"effort\": \"low|medium|high\" to cat-config.json" >&2
135+
exit 1
136+
fi
137+
if [[ "$EFFORT" != "low" && "$EFFORT" != "medium" && "$EFFORT" != "high" ]]; then
138+
echo "ERROR: Invalid effort value '$EFFORT' in $CONFIG_FILE." >&2
139+
echo "Valid values: low, medium, high" >&2
140+
exit 1
141+
fi
142+
```
143+
144+
Store EFFORT for use in issue_smart_questioning, issue_impact_analysis, and issue_create.
115145

116146
</step>
117147

@@ -143,6 +173,80 @@ Continue to next step.
143173

144174
</step>
145175

176+
<step name="issue_smart_questioning">
177+
178+
**Probe for ambiguities in the issue description (effort-scaled):**
179+
180+
Use the EFFORT value set in issue_read_config.
181+
182+
**If EFFORT is "low":**
183+
184+
Skip this step entirely. Continue to step: issue_analyze_versions.
185+
186+
**If EFFORT is "medium":**
187+
188+
Analyze ISSUE_DESCRIPTION for the following ambiguity indicators:
189+
- **Scope ambiguity:** The description could apply to multiple subsystems, layers, or components without specifying which
190+
- **Conflicting requirements:** The description implies goals that are difficult to achieve simultaneously (e.g., "faster and more thorough")
191+
- **Unclear success criteria:** No observable outcome is described (e.g., "improve the UX" without saying what "improved" looks like)
192+
193+
If one or more ambiguities are detected, use AskUserQuestion to present them. Ask only the ambiguities that were
194+
actually detected (omit questions where no ambiguity exists). Batch all detected ambiguities into a single
195+
AskUserQuestion call.
196+
197+
Example questions (adapt to the specific ambiguity found):
198+
199+
- **Scope ambiguity detected:**
200+
- question: "Your description could apply to multiple areas. Which scope is intended?"
201+
- options: [Two or three concrete scope interpretations derived from the description] + "Covers all of the above"
202+
203+
- **Conflicting requirements detected:**
204+
- question: "The description implies [goal A] and [goal B], which may be in tension. Which takes priority?"
205+
- options: ["Prioritize [goal A]", "Prioritize [goal B]", "Balance both — I understand the trade-off", "Clarify description"]
206+
207+
- **Unclear success criteria detected:**
208+
- question: "How will we know this issue is complete? What should a user observe?"
209+
- options: [Two or three concrete observable outcomes derived from context] + "I'll describe it: (free text)"
210+
211+
If user provides clarification, append it to ISSUE_DESCRIPTION.
212+
213+
If no ambiguities are detected, skip to step: issue_analyze_versions.
214+
215+
**If EFFORT is "high":**
216+
217+
Perform a deeper analysis of ISSUE_DESCRIPTION covering:
218+
- All medium-level checks above
219+
- **Edge cases:** Are there boundary conditions or unusual inputs the description does not address?
220+
- **Trade-offs:** Does the approach imply architectural trade-offs (e.g., memory vs. speed, simplicity vs. flexibility)?
221+
- **Alternative interpretations:** Are there materially different ways to read the description?
222+
- **Missing context:** Are there referenced systems, components, or dependencies that are not named?
223+
224+
For each detected concern, batch into AskUserQuestion calls (up to 4 questions per call).
225+
226+
In addition to the medium-level questions, include:
227+
228+
- **Edge case gap detected:**
229+
- question: "The description doesn't address [specific edge case]. Should it?"
230+
- options: ["Yes, include edge case handling", "No, out of scope for this issue", "Add to UNKNOWNS for research"]
231+
232+
- **Trade-off detected:**
233+
- question: "This approach implies a trade-off between [A] and [B]. Which is preferred?"
234+
- options: ["Prioritize [A]", "Prioritize [B]", "Document the trade-off and decide during implementation"]
235+
236+
- **Alternative interpretation detected:**
237+
- question: "The description could mean [interpretation 1] or [interpretation 2]. Which is correct?"
238+
- options: ["[Interpretation 1]", "[Interpretation 2]", "Both — describe the full scope", "Neither — clarify description"]
239+
240+
- **Missing context detected:**
241+
- question: "The description references [component/system] without specifying [what's missing]. Please clarify:"
242+
- options: [Two or three reasonable defaults derived from context] + "I'll describe it: (free text)"
243+
244+
If user provides clarification, append it to ISSUE_DESCRIPTION.
245+
246+
If no concerns are detected at any level, skip silently to step: issue_analyze_versions.
247+
248+
</step>
249+
146250
<step name="issue_analyze_versions">
147251

148252
**Analyze existing versions and suggest best fit:**
@@ -526,7 +630,7 @@ Capture the subagent's response.
526630

527631
If the subagent fails to return output, times out, or returns unparseable output:
528632
- Display: "Requirements validation could not be completed. Proceeding with existing criteria."
529-
- Skip validation processing and proceed to next step (issue_create)
633+
- Skip validation processing and proceed to next step (issue_impact_analysis)
530634

531635
If the subagent returns output but individual fields are missing or unparseable:
532636
- Treat missing fields as PASS (no issues detected for that check)
@@ -567,7 +671,124 @@ Parse the subagent response to extract:
567671

568672
**If all checks PASS:**
569673

570-
Proceed silently to next step (no user interaction needed).
674+
Proceed silently to step: issue_impact_analysis (no user interaction needed).
675+
676+
</step>
677+
678+
<step name="issue_impact_analysis">
679+
680+
**Analyze potential impact of the proposed issue on existing features (effort-scaled):**
681+
682+
Initialize IMPACT_NOTES="".
683+
684+
Use the EFFORT value set in issue_read_config.
685+
686+
**If EFFORT is "low":**
687+
688+
Skip this step entirely. Continue to step: issue_create.
689+
690+
**If EFFORT is "medium":**
691+
692+
Load existing issues from the selected version using HANDLER_DATA.versions[selected_version].existing_issues.
693+
694+
For each existing issue in the version, compare its name and any available STATE.md/PLAN.md summary against
695+
ISSUE_DESCRIPTION. Identify:
696+
- **Direct conflicts:** The new issue modifies or removes something an existing issue depends on
697+
- **Overlap:** The new issue covers ground already addressed by an existing issue
698+
- **Ordering constraints:** The new issue should logically precede or follow an existing issue but no dependency
699+
is currently declared
700+
701+
If one or more concerns are found, use AskUserQuestion:
702+
- header: "Impact Concerns"
703+
- question: "The following potential impacts were detected with existing issues in v{major}.{minor}. How would you like to proceed?"
704+
- Present each concern as context above the question (not as a selectable option):
705+
- "[existing-issue-name]: {brief description of the conflict or overlap}"
706+
- options:
707+
- "Proceed as described" — Create the issue without changes
708+
- "Revise description" — I want to adjust the scope to avoid the conflict
709+
- "Split into multiple issues" — Separate the conflicting parts
710+
- "Add impact notes to plan" — Document the impact relationship in PLAN.md
711+
712+
**If "Revise description":**
713+
714+
Ask inline: "Please provide the revised issue description:"
715+
716+
Capture revised input and replace ISSUE_DESCRIPTION.
717+
718+
<!-- Note: Smart questioning (issue_smart_questioning) is not re-run after description revision here.
719+
The revised description goes through re-evaluation within impact_analysis only. Re-running the full
720+
smart questioning loop would require returning to issue_smart_questioning and re-traversing the entire
721+
pipeline, which is deferred as a future enhancement. -->
722+
723+
Loop back to the start of issue_impact_analysis to re-evaluate the revised description for impact concerns.
724+
725+
**If "Split into multiple issues":**
726+
727+
Inform user: "Restart `/cat:add` for each sub-issue. You may use the current description as a starting point for
728+
each." Then STOP execution.
729+
730+
**If "Add impact notes to plan":**
731+
732+
Set IMPACT_NOTES to the concern descriptions. These will be appended to the PLAN.md in the issue_create step.
733+
734+
**If no concerns are detected:**
735+
736+
Skip silently to step: issue_create.
737+
738+
**If EFFORT is "high":**
739+
740+
Perform a broader impact analysis covering multiple dimensions:
741+
742+
**1. Same-version conflict check (same as medium):**
743+
744+
Apply the medium-level check against existing issues in the selected version.
745+
746+
**2. Cross-version dependency analysis:**
747+
748+
Scan HANDLER_DATA for other open versions. For each, check if ISSUE_DESCRIPTION touches areas those versions depend
749+
on. Flag potential backward compatibility breaks or API changes that downstream versions consume.
750+
751+
**3. Feature interaction analysis:**
752+
753+
Based on ISSUE_DESCRIPTION and ISSUE_TYPE, reason about which existing system behaviors the change might
754+
implicitly alter:
755+
- If ISSUE_TYPE is "Refactor": flag tests that exercise the refactored area as potentially needing updates
756+
- If ISSUE_TYPE is "Feature": flag additive changes that could conflict with planned features in other open versions
757+
- If ISSUE_TYPE is "Bugfix": flag whether the fix is a targeted correction or requires broader behavioral change
758+
759+
**4. Present consolidated impact report:**
760+
761+
If any concerns were found across dimensions, use AskUserQuestion:
762+
- header: "Impact Analysis"
763+
- question: "Impact analysis found the following concerns. How would you like to proceed?"
764+
- Present each concern with its dimension label (e.g., "Same-version overlap:", "Cross-version compatibility:",
765+
"Feature interaction:") as context above the question
766+
- options:
767+
- "Proceed as described" — Create the issue without changes
768+
- "Revise description" — I want to adjust the scope
769+
- "Split into multiple issues" — Separate the impacted parts
770+
- "Add impact notes to plan" — Document the relationships in PLAN.md
771+
772+
**If "Revise description":**
773+
774+
Ask inline: "Please provide the revised issue description:"
775+
776+
Capture revised input and replace ISSUE_DESCRIPTION.
777+
778+
Loop back to the start of issue_impact_analysis to re-evaluate the revised description for impact concerns.
779+
780+
**If "Split into multiple issues":**
781+
782+
Inform user: "Restart `/cat:add` for each sub-issue. You may use the current description as a starting point for
783+
each." Then STOP execution.
784+
785+
**If "Add impact notes to plan":**
786+
787+
Set IMPACT_NOTES to the concern descriptions. These will be appended to the PLAN.md in the issue_create step.
788+
789+
**If no concerns are detected at any level:**
790+
791+
Skip silently to step: issue_create.
571792

572793
</step>
573794

@@ -618,16 +839,7 @@ is not detailed enough. The subagent should only decide "how to write the code",
618839

619840
**Effort-Based Planning Depth:**
620841

621-
Read the `effort` value from cat-config.json to calibrate planning thoroughness:
622-
623-
```bash
624-
CONFIG_FILE="${CLAUDE_PROJECT_DIR}/.claude/cat/cat-config.json"
625-
EFFORT="medium" # default
626-
if [[ -f "$CONFIG_FILE" ]]; then
627-
EFFORT=$(grep '"effort"' "$CONFIG_FILE" | sed 's/.*"effort"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/')
628-
EFFORT="${EFFORT:-medium}"
629-
fi
630-
```
842+
Use the EFFORT value set in issue_read_config to calibrate planning thoroughness.
631843

632844
Apply the following depth to PLAN.md content based on `$EFFORT`:
633845

@@ -658,6 +870,18 @@ Add a Research Findings section to PLAN.md after the Goal/Problem section:
658870

659871
This section should appear before the "Satisfies" section in all templates.
660872

873+
**If IMPACT_NOTES is non-empty:**
874+
875+
Add an Impact Notes section to PLAN.md after the Research Findings section (or after the Goal/Problem section if no
876+
Research Findings):
877+
878+
```markdown
879+
## Impact Notes
880+
{IMPACT_NOTES}
881+
```
882+
883+
This section documents the potential impact of this issue on existing features, identified during issue creation.
884+
661885
**After generating STATE.md and PLAN.md content, create the issue:**
662886

663887
Call the create-issue binary with JSON input:

0 commit comments

Comments
 (0)