Files
oh-my-opencode/src/hooks/keyword-detector/team/default.ts
T
YeonGyu-Kim 25d9437513 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.
2026-05-06 14:19:40 +09:00

18 lines
898 B
TypeScript

/**
* Team mode keyword detector.
*
* Triggers when the user explicitly invokes team-mode work:
* - English: team mode, team-mode, team_mode, teammode (case-insensitive)
* - Korean: 팀 모드, 팀모드, 팀으로
*
* The Korean variants use a negative lookbehind on Hangul syllables (가-힣)
* to prevent false positives like "스팀으로" matching "팀으로", or
* "스팀모드" matching "팀모드".
*/
export const TEAM_PATTERN =
/\bteam[\s_-]?mode\b|(?<![가-힣])(?:팀\s*모드|팀으로)/i
export const TEAM_MESSAGE = `[team-mode]
Team mode reference detected. If user wants team-mode work, MUST orchestrate via team_* tools (team_create -> team_task_create + team_send_message). NEVER substitute with delegate_task - it is not equivalent. If team_* tools are unavailable (team_mode disabled in config), instruct user to set team_mode.enabled=true and restart opencode.`