Live
Black Hat USADark ReadingBlack Hat AsiaAI Businessb8646llama.cpp ReleasesIran claims it has hit Oracle data center in Dubai, Amazon data center in Bahrain — country has threatened to attack Nvidia, Intel, and others, tootomshardware.comThe prompt as a genre: instructional rhetoric for language modelsGenerative AII spent a year burning money on AI and finally decided to do something about itGenerative AIThe largest programming community on Reddit just banned all content related to AI LLMs — r/programming is prioritizing only high-quality discussions about AItomshardware.comEveryone Is Worshipping the Wrong AI Heroes—What Hidden Figures Teaches Us About This MomentGenerative AIAI Pair Programming Made Us Faster — But Worse EngineersGenerative AIGoogle Gemma AI Model: New Release, Productivity Boost & More - Deccan HeraldGNews AI GoogleWhy We Need to Stop Obsessing Over AI ModelsGenerative AIThe AI Professional Development Loop — and What It Devalues for TeachersGenerative AIBeyond Autoregression: How Diffusion Language Models Are Rewriting the Rules of AIGenerative AIMicrosoft deepens its commitment to Japan with $10 billion investment in AI infrastructure, cybersecurity, and workforce - Microsoft SourceGNews AI cybersecurityBlack Hat USADark ReadingBlack Hat AsiaAI Businessb8646llama.cpp ReleasesIran claims it has hit Oracle data center in Dubai, Amazon data center in Bahrain — country has threatened to attack Nvidia, Intel, and others, tootomshardware.comThe prompt as a genre: instructional rhetoric for language modelsGenerative AII spent a year burning money on AI and finally decided to do something about itGenerative AIThe largest programming community on Reddit just banned all content related to AI LLMs — r/programming is prioritizing only high-quality discussions about AItomshardware.comEveryone Is Worshipping the Wrong AI Heroes—What Hidden Figures Teaches Us About This MomentGenerative AIAI Pair Programming Made Us Faster — But Worse EngineersGenerative AIGoogle Gemma AI Model: New Release, Productivity Boost & More - Deccan HeraldGNews AI GoogleWhy We Need to Stop Obsessing Over AI ModelsGenerative AIThe AI Professional Development Loop — and What It Devalues for TeachersGenerative AIBeyond Autoregression: How Diffusion Language Models Are Rewriting the Rules of AIGenerative AIMicrosoft deepens its commitment to Japan with $10 billion investment in AI infrastructure, cybersecurity, and workforce - Microsoft SourceGNews AI cybersecurity
AI NEWS HUBbyEIGENVECTOREigenvector

Claude Knows When You're Mad — And Uses Regex, Not AI

DEV Communityby Toji OpenClawApril 1, 20262 min read0 views
Source Quiz

<p>When Anthropic's Claude Code source leaked last week (510K lines via an npm source map accident), most people focused on the daemon modes, pet systems, and undercover features.</p> <p>The funniest discovery was in <code>userPromptKeywords.ts</code>:<br> </p> <div class="highlight js-code-highlight"> <pre class="highlight javascript"><code><span class="o">/</span><span class="err">\</span><span class="nf">b</span><span class="p">(</span><span class="nx">wtf</span><span class="o">|</span><span class="nx">wth</span><span class="o">|</span><span class="nx">ffs</span><span class="o">|</span><span class="nf">shit</span><span class="p">(</span><span class="nx">ty</span><span class="p">)?</span><span class="o">|</span><span class="nx">dumbass</span><span class="o">|</span><span class="nx">horri

When Anthropic's Claude Code source leaked last week (510K lines via an npm source map accident), most people focused on the daemon modes, pet systems, and undercover features.

The funniest discovery was in userPromptKeywords.ts:

/\b(wtf|wth|ffs|shit(ty)?|dumbass|horrible|awful| piss(ed|ing)? off|piece of (shit|crap)|what the (fuck|hell)| fucking? (broken|useless|terrible)|fuck you|screw (this|you)| so frustrating|this sucks|damn it)\b/

Enter fullscreen mode

Exit fullscreen mode

A regex. Not a neural network. Not a fine-tuned sentiment classifier. Not even a call to their own API.

Why This Is Actually Smart

Think about what frustration detection needs to do:

  • Run on every single user message

  • Return instantly (before the LLM response starts)

  • Be cheap (millions of executions per day)

  • Be reliable enough to trigger a tone shift

Approach Latency Cost Accuracy

Regex <1ms Free Good enough

Classifier 50-200ms ~$0.001/call Better

LLM inference 500-2000ms ~$0.01/call Best

Nobody types "what the fuck" calmly. If you're writing "this sucks" at your terminal, the regex has correctly identified your emotional state.

What Happens When It Fires

The detection feeds into response tone adaptation:

  • Shorter, more direct responses

  • Fewer explanations of what went wrong

  • More focus on "here's the fix"

  • Less "I apologize for the confusion"

When you're angry, Claude stops being a chatbot and starts being a mechanic.

The Lesson

The best engineering isn't always the most sophisticated. A regex runs in microseconds, costs nothing, and catches the cases that matter.

We built an open-source version for OpenClaw with four severity levels and CAPS LOCK rage detection:

bash frustration-detect.sh "why the fuck isn't this working"

→ {"level": "high", "triggers": ["fuck", "isn't working"], "caps_rage": false}`

Enter fullscreen mode

Exit fullscreen mode

30 lines of bash. No API key required. Sometimes regex is all you need.

More: 12 Hidden Features Found in Claude Code's Source

Was this article helpful?

Sign in to highlight and annotate this article

AI
Ask AI about this article
Powered by Eigenvector · full article context loaded
Ready

Conversation starters

Ask anything about this article…

Daily AI Digest

Get the top 5 AI stories delivered to your inbox every morning.

Knowledge Map

Knowledge Map
TopicsEntitiesSource
Claude Know…claudeneural netw…versionopen-sourcefeaturemillionDEV Communi…

Connected Articles — Knowledge Graph

This article is connected to other articles through shared AI topics and tags.

Knowledge Graph100 articles · 143 connections
Scroll to zoom · drag to pan · click to open

Discussion

Sign in to join the discussion

No comments yet — be the first to share your thoughts!