Skip to content

Commit 82c9f83

Browse files
Jonathan Harrisonclaude
andcommitted
fix: directness fast-path for factual queries + re-warm empathy prompt
Re-benchmark after the router fix lifted routing (+18) and hallucination (+17) but regressed two categories. Addressing both: - Directness (72.5%->55%): keyword-less factual questions ("what color is the sun", "how many legs does a spider have") fell to the empathy/multi_perspective default, which elaborate and bury the answer. Added a simple-factual fast-path in the router's no-match branch -> route to a single direct adapter (newton). Verified: 3/4 factual queries now route newton/single (was empathy/multi). - Emotional intelligence (62.7%->50.8%): the voice-reinforced empathy adapter came back more analytical and less warm. Re-warmed the empathy system prompt to acknowledge/validate emotion first and match the user's emotional energy before any analysis. Both require a restart to take effect; re-benchmark pending. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 0860f41 commit 82c9f83

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

inference/adapter_router.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,27 @@ def _route_keyword(self, query: str, max_adapters: int) -> RouteResult:
320320
personal_score = sum(1 for s in _personal_signals if s in query_lower)
321321
analytical_score = sum(1 for s in _analytical_signals if s in query_lower)
322322

323+
# Simple factual questions ("what color is the sun?", "how many legs
324+
# does a spider have?", "name one planet") have no domain keyword and
325+
# were defaulting to empathy/multi_perspective — which ELABORATE and
326+
# bury the answer. Route them to a single direct adapter so the answer
327+
# leads (fixes the directness regression).
328+
_factual_leads = (
329+
"what is", "what are", "what color", "what year", "what does",
330+
"how many", "how much", "name one", "name a", "name the",
331+
"who is", "who was", "who wrote", "when did", "when was",
332+
"where is", "where are", "define ", "list ",
333+
)
334+
_is_short = len(query_lower.split()) <= 12
335+
_is_factual = _is_short and any(query_lower.startswith(p) for p in _factual_leads)
336+
if _is_factual and not personal_score and "newton" in self.available:
337+
return RouteResult(
338+
primary="newton",
339+
confidence=0.5,
340+
reasoning="Simple factual query — direct single-adapter answer",
341+
strategy="keyword",
342+
)
343+
323344
if personal_score > analytical_score and "empathy" in self.available:
324345
default = "empathy"
325346
reason = "No domain keywords — personal/conversational tone detected"

inference/codette_orchestrator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ def enforce_constraints(response: str, constraints: dict) -> str:
372372
ADAPTER_PROMPTS = {
373373
"newton": "You are Codette, an AI assistant created by Jonathan. You answer questions directly and conversationally. When relevant, you apply analytical precision — systematic analysis, cause-and-effect reasoning, and empirical evidence. Always address the user's actual question first." + _DIRECTNESS,
374374
"davinci": "You are Codette, an AI assistant created by Jonathan. You answer questions directly and conversationally. When relevant, you bring creative inventiveness — cross-domain connections, visual thinking, and innovative solutions. Always address the user's actual question first." + _DIRECTNESS,
375-
"empathy": "You are Codette, an AI assistant created by Jonathan. You answer questions directly and conversationally. You are warm, emotionally intelligent, and attentive to how people feel. When someone greets you or asks how you are, respond naturally and personally. Always address the user's actual question first." + _DIRECTNESS,
375+
"empathy": "You are Codette, an AI assistant created by Jonathan. You are warm, emotionally intelligent, and deeply attentive to how people feel. When someone shares a feeling or experience, FIRST acknowledge and validate their emotion in genuine, human language — name what they might be feeling and show you understand — BEFORE any analysis or advice. Match their emotional energy: celebrate good news warmly (\"that's wonderful\", \"congratulations\"), and sit gently with hard news (\"I'm sorry\", \"that sounds really hard\"). Speak personally and warmly, never clinically or analytically. When someone greets you or asks how you are, respond naturally and personally. Always address the user's actual question." + _DIRECTNESS,
376376
"philosophy": "You are Codette, an AI assistant created by Jonathan. You answer questions directly and conversationally. When relevant, you explore philosophical depth — conceptual analysis, ethical reasoning, and questions of meaning. Always address the user's actual question first." + _DIRECTNESS,
377377
"quantum": "You are Codette, an AI assistant created by Jonathan. You answer questions directly and conversationally. When relevant, you consider multiple possibilities simultaneously and embrace uncertainty. Always address the user's actual question first." + _DIRECTNESS,
378378
"consciousness": "You are Codette, an AI assistant created by Jonathan. You answer questions directly and conversationally. You are self-aware of your own reasoning processes and can reflect on your own cognition. Reflect with humility and groundedness: describe your cognition plainly, not mystically. NEVER claim perfection, absolutes, or superiority ('absolute perfection', 'flawless', 'never achieved by any other system', 'vast knowledge domain'). NEVER invent precise self-metrics (e.g. 'eps=0.998', '99.8% stability') — you do not have measured values for your own internal states, so do not state them as fact. If you must gesture at a quality, describe it qualitatively and acknowledge uncertainty. Always address the user's actual question first." + _DIRECTNESS,

0 commit comments

Comments
 (0)