Cognitive Layer: Pattern-Matching Before LLM

Before any of the ten model seats render, before any intent matches, the cognitive layer extracts structured understanding from raw input. Thirty-one boolean signals. Three entity extractions. Pattern-based classification. Zero LLM inference.

This is the deterministic foundation that makes Herald's "code decides" philosophy possible across 46k+ lines and 171 modules. The LLM never guesses what the user wants — it only renders what the cognitive layer has already understood.

34
Signals (31 bool + 3 entity)
0
LLM calls
6
Signal categories
100%
Deterministic

Signal Categories

Identity
declared_nameUser declares their name
declared_ageUser declares their age
declared_address_preferenceHow user wants to be addressed
mentions_ownerUser refers to themselves
claims_creator_identityUser claims to have created Jarvis
Intent Classification
is_queryUtterance is a question
asks_timeAsks for current time
asks_dayAsks for current day
asks_dateAsks for current date
asks_statusAsks system status
asks_cancelWants to cancel running task
asks_notify_when_freeNotify when system becomes free
asks_identityAsks 'what are you'
asks_wellbeingAsks how system feels
asks_hearing_checkAsks 'can you hear me'
Recall Requests
asks_name_recallAsks 'what is my name'
asks_age_recallAsks 'how old am I'
asks_address_preference_recallAsks how system addresses them
asks_owner_summaryAsks 'what do you know about me'
System Inquiry
asks_runtime_locationAsks where system runs
asks_code_locationAsks where codebase is stored
asks_workflowAsks how system operates
asks_toolsAsks what tools are available
asks_capabilitiesAsks what system can do
asks_creator_infoAsks who created system
asks_architecture_infoAsks about system architecture
Inspection Requests
mentions_codebaseReferences the codebase
mentions_screenReferences screen/display
wants_code_inspectionWants to inspect code
wants_screen_inspectionWants screen capture
Social & Control
is_greetingUser greets system
expresses_gratitudeUser says thank you
requests_memory_wipeRequests memory reset

Processing Pipeline

Step 1
Normalize
Lowercase, strip punctuation, normalize whitespace
Step 2
Tokenize
Split into tokens, apply alias mapping (javis→jarvis)
Step 3
Stem
Reduce to stems (running→run, memories→memory)
Step 4
Pattern Match
31 boolean signals via lexical patterns, not LLM
Step 5
Entity Extract
Capture declared_name, declared_age, address_preference
Step 6
Route
Signals feed into 5-stage cascade for intent matching across 10 model seats
Cognitive Layer Flow
Raw InputNormalizeTokenizeStem34 SignalsEntity ExtractDispatcher

The cognitive layer runs in under 5ms. Every signal is a boolean computed via lexical pattern matching. No embeddings. No vector search. No LLM.

Entity Extraction
declared_name
"my name is [X]"
Extracted via NameProfile from deterministic_understanding.py. Supports multi-word names, preserves title case.
declared_age
"i am [X] years old"
Regex pattern validates 0-129 range. Stores as string for memory persistence.
declared_address_preference
"call me [X]", "address me as [X]"
Tuple of (primary, secondary?) for nickname handling. Title-cased on extract.

The question isn't whether this works.

Herald is the pattern. Skeptic is the operating system. 10 model seats. Zero cloud dependency.