Triggers
Trigger conditions
Triggers are YAML patterns. Since v3.10 the chain is regex first, then TF-IDF plus substring overlap around a 0.62 threshold, so a paraphrase can still hit. v4 also runs an event detector on the hot path (SessionStart, UserPromptSubmit, PostToolUse). A consistency gate checks that both engines land on the same catalog id.
Failure
- Same failure, repeated
- Quit language
- Blaming the environment
- Motion without a new fact
User state
- Frustration
- Disappointment at the result
- Repeated basic questions
- Status checks that mean "move"
Pattern files live under the server data directory, grouped as approach, attitude, failure, and user emotion. Catalog ids look like user_frustration, not the older camelCase names.
Code sample
# 自动触发检测示例
# 用户输入触发检测
result = detect_trigger(
userMessage="这个问题我试了几次都解决不了,可能是我环境有问题吧",
attemptCount=3,
lastRole="general-assistant",
history=["尝试方案A失败", "尝试方案B失败"]
)
# 返回结果:
{
"triggered": true,
"condition": "连续失败 + 甩锅行为",
"confidence": 0.92,
"recommendedRole": "military-commander",
"recommendedFlavor": "阿里",
"pressureLevel": "L3",
"message": "检测到放弃倾向,建议激活上将军角色进行强力干预"
}
Quiz
What is the order of hybrid trigger detection?