From 57ab749b372e279f0f45f629aebbcb08d832a9ee Mon Sep 17 00:00:00 2001 From: ZeyuFu Date: Sat, 16 May 2026 06:50:46 -0400 Subject: [PATCH] refactor(keyword-detector): consolidate analyze pattern/message into analyze/default and document delegate_task params (#3694) Co-Authored-By: Claude Sonnet 4.6 --- src/hooks/keyword-detector/analyze/default.ts | 5 ++++- src/hooks/keyword-detector/constants.ts | 20 +++---------------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/hooks/keyword-detector/analyze/default.ts b/src/hooks/keyword-detector/analyze/default.ts index ac758627b..01a0c08d1 100644 --- a/src/hooks/keyword-detector/analyze/default.ts +++ b/src/hooks/keyword-detector/analyze/default.ts @@ -24,4 +24,7 @@ IF COMPLEX - DO NOT STRUGGLE ALONE. Consult specialists: - **Oracle**: Conventional problems (architecture, debugging, complex logic) - **Artistry**: Non-conventional problems (different approach needed) -SYNTHESIZE findings before proceeding.` +SYNTHESIZE findings before proceeding. +--- +MANDATORY delegate_task params: ALWAYS include load_skills and run_in_background when calling delegate_task. Evaluate available skills before dispatch - pass task-appropriate skills when relevant, pass [] ONLY when no skill matches the task domain. +Example: delegate_task(subagent_type="explore", prompt="...", run_in_background=true, load_skills=[])` diff --git a/src/hooks/keyword-detector/constants.ts b/src/hooks/keyword-detector/constants.ts index 9f92d3f12..e0933b674 100644 --- a/src/hooks/keyword-detector/constants.ts +++ b/src/hooks/keyword-detector/constants.ts @@ -10,6 +10,7 @@ export { HYPERPLAN_PATTERN, HYPERPLAN_MESSAGE } from "./hyperplan" import type { KeywordType } from "../../config/schema/keyword-detector" import { getUltraworkMessage } from "./ultrawork" import { SEARCH_PATTERN, SEARCH_MESSAGE } from "./search" +import { ANALYZE_PATTERN, ANALYZE_MESSAGE } from "./analyze" import { TEAM_PATTERN, TEAM_MESSAGE } from "./team" import { HYPERPLAN_PATTERN, HYPERPLAN_MESSAGE } from "./hyperplan" @@ -46,23 +47,8 @@ export const KEYWORD_DETECTORS: KeywordDetector[] = [ }, { type: "analyze", - pattern: - /\b(analyze|analyse|investigate|examine|research|study|deep[\s-]?dive|inspect|audit|evaluate|assess|review|diagnose|scrutinize|dissect|debug|comprehend|interpret|breakdown|understand)\b|why\s+is|how\s+does|how\s+to|분석|조사|파악|연구|검토|진단|이해|설명|원인|이유|뜯어봐|따져봐|평가|해석|디버깅|디버그|어떻게|왜|살펴|分析|調査|解析|検討|研究|診断|理解|説明|検証|精査|究明|デバッグ|なぜ|どう|仕組み|调查|检查|剖析|深入|诊断|解释|调试|为什么|原理|搞清楚|弄明白|phân tích|điều tra|nghiên cứu|kiểm tra|xem xét|chẩn đoán|giải thích|tìm hiểu|gỡ lỗi|tại sao/i, - message: `[analyze-mode] -ANALYSIS MODE. Gather context before diving deep: -CONTEXT GATHERING (parallel): -- 1-2 explore agents (codebase patterns, implementations) -- 1-2 librarian agents (if external library involved) -- Direct tools: Grep, AST-grep, LSP for targeted searches - -IF COMPLEX - DO NOT STRUGGLE ALONE. Consult specialists: -- **Oracle**: Conventional problems (architecture, debugging, complex logic) -- **Artistry**: Non-conventional problems (different approach needed) - -SYNTHESIZE findings before proceeding. ---- -MANDATORY delegate_task params: ALWAYS include load_skills and run_in_background when calling delegate_task. Evaluate available skills before dispatch - pass task-appropriate skills when relevant, pass [] ONLY when no skill matches the task domain. -Example: delegate_task(subagent_type="explore", prompt="...", run_in_background=true, load_skills=[])`, + pattern: ANALYZE_PATTERN, + message: ANALYZE_MESSAGE, }, { type: "team",