feat(keyword-detector): add team mode keyword detection

Detects user invocations of team-mode work across English and Korean
('team mode', '팀 모드', '팀으로') and injects a concise English directive
instructing the LLM to orchestrate via team_* tools (team_create ->
team_task_create + team_send_message), forbidding delegate_task
substitution and fallbacks.

The Korean variants use a Hangul-syllable negative lookbehind (가-힣) so
that '스팀으로 게임 켜줘' does not falsely match '팀으로' and '스팀모드' does
not falsely match '팀모드'.

Follows the existing folder pattern (mode/default.ts + mode/index.ts)
shared by ultrawork/, search/, and analyze/. The hook orchestration in
hook.ts handles the new keyword type generically through the shared
KEYWORD_DETECTORS array, so existing guards (non-OMO agent skip,
non-main session filter, system-reminder strip, code-block strip) all
apply automatically.

Adds 7 regression tests covering English/Korean trigger forms, the
Hangul-prefix false-positive guard, the bare-'team' negative case, and
non-main-session filtering.
This commit is contained in:
YeonGyu-Kim
2026-04-28 14:19:44 +09:00
parent 2ffe5afe2e
commit 25d9437513
6 changed files with 214 additions and 6 deletions
+2 -2
View File
@@ -5,7 +5,7 @@ import {
} from "./constants"
export interface DetectedKeyword {
type: "ultrawork" | "search" | "analyze"
type: "ultrawork" | "search" | "analyze" | "team"
message: string
}
@@ -33,7 +33,7 @@ export function detectKeywords(text: string, agentName?: string, modelID?: strin
export function detectKeywordsWithType(text: string, agentName?: string, modelID?: string): DetectedKeyword[] {
const textWithoutCode = removeCodeBlocks(text)
const types: Array<"ultrawork" | "search" | "analyze"> = ["ultrawork", "search", "analyze"]
const types: Array<DetectedKeyword["type"]> = ["ultrawork", "search", "analyze", "team"]
return KEYWORD_DETECTORS.map(({ pattern, message }, index) => ({
matches: pattern.test(textWithoutCode),
type: types[index],