From dd62a7ac13752c6b81d87794666871f1e981b647 Mon Sep 17 00:00:00 2001 From: catlog22 Date: Mon, 29 Dec 2025 19:14:13 +0800 Subject: [PATCH] refactor(issue/new): make ACE search conditional on clarity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ACE only for medium clarity (score 1-2), skip for: - GitHub URLs (score 3): already has context - Vague inputs (score 0): needs clarification first - Limit to quick search: max 3 keywords, max 3 files - Non-blocking: ACE failure continues without hints - Note: Deep exploration deferred to /issue:plan 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .claude/commands/issue/new.md | 37 +++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/.claude/commands/issue/new.md b/.claude/commands/issue/new.md index 477c8e88..3d9d6e74 100644 --- a/.claude/commands/issue/new.md +++ b/.claude/commands/issue/new.md @@ -76,22 +76,28 @@ if (isGitHubUrl || isGitHubShort) { } ``` -### Phase 3: Smart Context Discovery (ACE) +### Phase 3: Lightweight Context Hint (Conditional) ```javascript -// Use ACE to find affected components if not specified -if (!issueData.affected_components?.length && issueData.problem_statement) { +// ACE search ONLY for medium clarity (1-2) AND missing components +// Skip for: GitHub (has context), vague (needs clarification first) +// Note: Deep exploration happens in /issue:plan, this is just a quick hint + +if (clarityScore >= 1 && clarityScore <= 2 && !issueData.affected_components?.length) { const keywords = extractKeywords(issueData.problem_statement); - if (keywords.length > 0) { - const aceResult = mcp__ace-tool__search_context({ - project_root_path: process.cwd(), - query: `Find code related to: ${keywords.join(', ')}` - }); + if (keywords.length >= 2) { // Need at least 2 keywords for meaningful search + try { + const aceResult = mcp__ace-tool__search_context({ + project_root_path: process.cwd(), + query: keywords.slice(0, 3).join(' ') // Quick search, max 3 keywords + }); - // Extract file paths from ACE results - issueData.affected_components = aceResult.files?.slice(0, 5) || []; - issueData.extended_context = { ace_suggestions: aceResult.summary }; + // Only take top 3 files as hints + issueData.affected_components = aceResult.files?.slice(0, 3) || []; + } catch { + // ACE failure is non-blocking, continue without hints + } } } ``` @@ -235,8 +241,11 @@ if (proceed) { GitHub URL Structured Text Vague Input │ │ │ ▼ ▼ ▼ - Parse Parse AskUserQuestion - Direct + ACE (1 question) + Parse Parse + AskUserQuestion + Direct ACE (quick) (1 question) + │ │ │ + │ max 3 files │ + │ max 3 keywords │ │ │ │ └───────────────┼───────────────┘ │ @@ -251,6 +260,8 @@ if (proceed) { │ Create Issue │ │ (confirm only if <2) │ └────────────────────────┘ + +Note: Deep exploration → /issue:plan (not here) ``` ## Helper Functions