fix(keyword-detector): narrow ULW auto-start to leading keyword position only

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-04-08 17:17:14 +09:00
parent 06b825dd74
commit 917ae4dfc3
2 changed files with 53 additions and 0 deletions
+15
View File
@@ -16,11 +16,16 @@ import type { RalphLoopHook } from "../ralph-loop"
import { parseRalphLoopArguments } from "../ralph-loop/command-arguments"
const ULTRAWORK_KEYWORD_PATTERN = /\b(ultrawork|ulw)\b/i
const LEADING_ULTRAWORK_PATTERN = /^\s*(ultrawork|ulw)\b/i
function extractUltraworkTask(cleanText: string): string {
return cleanText.replace(ULTRAWORK_KEYWORD_PATTERN, "").trim()
}
function hasLeadingUltraworkKeyword(cleanText: string): boolean {
return LEADING_ULTRAWORK_PATTERN.test(cleanText)
}
export function createKeywordDetectorHook(
ctx: PluginInput,
_collector?: ContextCollector,
@@ -76,6 +81,16 @@ export function createKeywordDetectorHook(
}
}
if (!hasLeadingUltraworkKeyword(cleanText)) {
const preFilterCount = detectedKeywords.length
detectedKeywords = detectedKeywords.filter((k) => k.type !== "ultrawork")
if (preFilterCount > detectedKeywords.length) {
log(`[keyword-detector] Filtered non-leading ultrawork keyword`, {
sessionID: input.sessionID,
})
}
}
if (detectedKeywords.length === 0) {
return
}