Skip to content

Commit 8cc2f47

Browse files
AVADSA25Mikarina13claude
authored
fix(chat): let allowlisted skill triggers beat the conversational filter (beat 20) (#256)
_try_skill ran _is_conversational() FIRST and bailed to the LLM for any question-phrased message — so "what was I doing 1h ago?" never reached observer_recall (allowlisted since #250); the LLM answered from memory and fabricated. Now: if the message word-boundary-matches an allowlisted skill trigger, honor it (explicit intent) even if it looks conversational; only fall through to the LLM when no allowlisted skill matches. Verified: "what was I doing 1h ago?" now routes to observer_recall. Co-authored-by: Mickael Farina <farina.mickael@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 98c7e1d commit 8cc2f47

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

routes/chat.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -442,13 +442,21 @@ def _enrich_messages(messages: list, config: dict, force_search: bool = False) -
442442

443443
def _try_skill(user_text: str):
444444
"""Check if user_text matches a skill. Returns (skill_name, result) or (None, None).
445-
Skips skill matching for conversational messages to prevent false triggers."""
446-
if _is_conversational(user_text):
447-
return None, None
445+
446+
An explicit allowlisted-trigger match (e.g. "what was I doing 1h ago?" →
447+
observer_recall) is honored even for question-phrased ("conversational")
448+
messages: a word-boundary trigger match is a stronger intent signal than the
449+
chatty-phrasing heuristic. Only when NO allowlisted skill matches do
450+
conversational messages fall through to the LLM (the original behaviour).
451+
Before this, questions like "what was I doing?" were skipped entirely and the
452+
LLM answered from memory (and fabricated)."""
448453
try:
449454
from codec_dispatch import check_skill, run_skill
450455
skill = check_skill(user_text)
451-
if skill and skill.get("name") in CHAT_SKILL_ALLOWLIST:
456+
matched = bool(skill and skill.get("name") in CHAT_SKILL_ALLOWLIST)
457+
if not matched and _is_conversational(user_text):
458+
return None, None
459+
if matched:
452460
# re-audit A2: destructive skills need explicit consent (reuses the
453461
# AskUserQuestion PWA panel; blocks this worker thread until answered).
454462
import codec_consent

0 commit comments

Comments
 (0)