Prerequisites
Bug Description
Problem
src/hooks/keyword-detector/constants.ts had ANALYZE_PATTERN regex and ANALYZE_MESSAGE template string defined inline, while analyze/default.ts already exported identical ANALYZE_PATTERN and ANALYZE_MESSAGE. This created unnecessary duplication — any change to the analyze prompt or pattern required syncing two locations, risking drift.
Context
The keyword-detector module supports three detection modes (ultrawork, search, analyze) by scanning the first user message for mode-specific keywords and injecting corresponding system prompts.
The search mode already correctly imported its pattern/message from the dedicated submodule (search/pattern.ts, search/message.ts), but the analyze mode had a legacy inline definition that bypassed the already-exported constants from analyze/default.ts. Additionally, the analyze mode prompt was missing delegate_task parameter guidance that subagents need to generate proper context.
Steps to Reproduce
read the source code of keyword-detector
Expected Behavior
-
constants.ts: Delete 18 lines of inline ANALYZE_PATTERN regex and ANALYZE_MESSAGE template string; import { ANALYZE_MESSAGE, ANALYZE_PATTERN } from "./analyze" and reference them directly in KEYWORD_DETECTORS
-
analyze/default.ts: Append the following block to ANALYZE_MESSAGE:
---
MANDATORY delegate_task params: ALWAYS include load_skills=[] and run_in_background when calling delegate_task.
Example: delegate_task(subagent_type="explore", prompt="...", run_in_background=true, load_skills=[])
Actual Behavior
src/hooks/keyword-detector/constants.ts had ANALYZE_PATTERN regex and ANALYZE_MESSAGE template string defined inline
Doctor Output
Error Logs
Configuration
Additional Context
No response
Operating System
Linux
OpenCode Version
1.14.28
Prerequisites
Bug Description
Problem
src/hooks/keyword-detector/constants.tshadANALYZE_PATTERNregex andANALYZE_MESSAGEtemplate string defined inline, whileanalyze/default.tsalready exported identicalANALYZE_PATTERNandANALYZE_MESSAGE. This created unnecessary duplication — any change to the analyze prompt or pattern required syncing two locations, risking drift.Context
The keyword-detector module supports three detection modes (ultrawork, search, analyze) by scanning the first user message for mode-specific keywords and injecting corresponding system prompts.
The search mode already correctly imported its pattern/message from the dedicated submodule (
search/pattern.ts,search/message.ts), but the analyze mode had a legacy inline definition that bypassed the already-exported constants fromanalyze/default.ts. Additionally, the analyze mode prompt was missingdelegate_taskparameter guidance that subagents need to generate proper context.Steps to Reproduce
read the source code of keyword-detector
Expected Behavior
constants.ts: Delete 18 lines of inlineANALYZE_PATTERNregex andANALYZE_MESSAGEtemplate string; import{ ANALYZE_MESSAGE, ANALYZE_PATTERN }from"./analyze"and reference them directly inKEYWORD_DETECTORSanalyze/default.ts: Append the following block toANALYZE_MESSAGE:Actual Behavior
src/hooks/keyword-detector/constants.tshadANALYZE_PATTERNregex andANALYZE_MESSAGEtemplate string defined inlineDoctor Output
Error Logs
Configuration
Additional Context
No response
Operating System
Linux
OpenCode Version
1.14.28