838b5ae216
Update root + 43 directory-level AGENTS.md files to reflect current state: - Root AGENTS.md rewritten with accurate counts (1967 TS files, 1304 source + 663 test, 278k LOC, 120 barrel index.ts), 7-step init flow, 5-tier hook composition, and full Team Mode section (12 team_* tools, eligibility, storage layout, config gate) - src/AGENTS.md adds team-mode init step, current per-subdir file/LOC table - src/tools/AGENTS.md documents conditional gates (team-mode +12, task system +4, hashline +1, interactive_bash +1, look_at +1) with always-on baseline of 20 - src/hooks/AGENTS.md splits into 5 tiers + 4 conditional team-mode hooks - src/features/team-mode/AGENTS.md surfaces 12 tools, eligible agents, spawn-race-safe invariants, and integration points - src/features/builtin-skills/AGENTS.md tracks 10 skills incl. team-mode - src/agents/AGENTS.md, src/plugin/AGENTS.md, src/config/AGENTS.md updated for team-mode awareness, accurate counts, and current schema field list - All other AGENTS.md files refreshed to 2026-05-08 generation date
2.9 KiB
2.9 KiB
src/hooks/keyword-detector/ — Mode Keyword Injection
Generated: 2026-05-08
OVERVIEW
Transform Tier hook on messages.transform. Scans first user message for mode keywords (ultrawork, search, analyze, team) and injects mode-specific system prompts.
KEYWORDS
| Keyword | Pattern | Effect |
|---|---|---|
ultrawork / ulw |
`/\b(ultrawork | ulw)\b/i` |
| Search mode | SEARCH_PATTERN (from search/) |
Web/doc search focus prompt injection |
| Analyze mode | ANALYZE_PATTERN (from analyze/) |
Deep analysis mode prompt injection |
| Team mode | TEAM_PATTERN (from team/) |
Forces orchestration via team_* tools when user invokes team mode / 팀 모드 / 팀으로; instructs user to enable team_mode.enabled if tools are absent |
STRUCTURE
keyword-detector/
├── index.ts # Barrel export
├── hook.ts # createKeywordDetectorHook() — chat.message handler
├── detector.ts # detectKeywordsWithType() + extractPromptText()
├── constants.ts # KEYWORD_DETECTORS array, re-exports from submodules
├── types.ts # KeywordDetector, DetectedKeyword types
├── ultrawork/
│ ├── index.ts
│ ├── message.ts # getUltraworkMessage() — dynamic prompt by agent/model
│ └── isPlannerAgent.ts
├── search/
│ ├── index.ts
│ ├── pattern.ts # SEARCH_PATTERN regex
│ └── message.ts # SEARCH_MESSAGE
├── analyze/
│ ├── index.ts
│ └── default.ts # ANALYZE_PATTERN + ANALYZE_MESSAGE
└── team/
├── index.ts
└── default.ts # TEAM_PATTERN + TEAM_MESSAGE
DETECTION LOGIC
chat.message (user input)
→ extractPromptText(parts)
→ isSystemDirective? → skip
→ removeSystemReminders(text) # strip <SYSTEM_REMINDER> blocks
→ detectKeywordsWithType(cleanText, agentName, modelID, disabledKeywords)
→ isPlannerAgent(agentName)? → filter out ultrawork
→ for each detected keyword: inject mode message into output
CONFIG
{
"keyword_detector": {
// Skip injection for any keyword in this list. Allowed: "ultrawork", "search", "analyze", "team".
"disabled_keywords": ["search", "analyze"]
}
}
Default: empty/missing → all four detectors active. Schema lives at src/config/schema/keyword-detector.ts.
GUARDS
- System directive skip: Messages tagged as system directives are not scanned (prevents infinite loops)
- Planner agent filter: Prometheus/plan agents do not receive
ultraworkinjection - Session agent tracking: Uses
getSessionAgent()to get actual agent (not just input hint) - Model-aware messages:
getUltraworkMessage(agentName, modelID)adapts message to active model