AI Architecture

AI Classification Architecture

Three-signal inference engine, confidence scoring formula, keyword dictionary, trust score system, and correction learning loop

Part 1 — Three-Signal Inference Engine
ASignal Priority Order
1
Highest priority
Correction Learning
Checks correctionHistory array first. If tweet content contains a previously corrected keyword pattern, the learned category is returned immediately. Signals 2 and 3 are skipped entirely.
Source: xrecall_corrections in localStorage. Persists across sessions. Pattern extracted from first matched keyword or first 3 words of tweet content.
Confidence: 0.88 to 0.98
2
Secondary signal
Semantic Analysis
Keyword dictionary lookup across 12 categories and 100+ domain-specific terms. Matches on full tweet content AND author name simultaneously.
Existing user folders checked first (Pass 1). Only attempts new category creation if no existing folder matches (Pass 2). Best match wins — highest keyword count.
Confidence: 0.52 to 0.87
3
Supporting signal
Author Authority
Bayesian prior from account name. ESPN = high probability of Sports. BBCNews = high probability of News. Contributes to final match score alongside semantic keywords.
Overridden by semantic analysis when the semantic signal is strong. Not a standalone signal — works in combination with Signal 2 keyword matching.
Confidence: 0.52 to 0.87
Part 2 — Confidence Scoring Formula
BHow the final score is computed
Scoring components — standard classification path
Base score (always present)
0.52
Keyword boost (matchCount x 0.12, max 0.35)
+ 0.35
Trust bonus (trustScore / 100 x 0.06)
+ 0.06
Standard classification ceiling
0.96
Learned correction ceiling
0.98
Fallback — no keyword match found
0.38
Classification routing after score is computed
Score 0.75 or above — Auto-file to matched folder. Create folder if it does not exist. Bubble to top of chip list.
Score below 0.75 — Route to Unsorted inbox. User reviews and moves manually. Moving trains the model.
Score 0.38 — Fallback. No keyword matched. Uses tweet.category field from the data. Likely to land in Unsorted.
Learned correction match — Bypass all scoring. Return corrected category at 0.88 to 0.98 confidence immediately.
Part 3 — Keyword Dictionary
C12 categories, 100+ keywords
Dev Resources
24 keywords
python · javascript · react · typescript · docker · kubernetes · graphql · jwt · lambda · serverless · mongodb · owasp · microservice · deno · node · debugging · sql · api · code · programming · dev · github · cypress · database
Crypto
17 keywords
bitcoin · ethereum · crypto · blockchain · defi · nft · web3 · solana · token · dao · coinbase · staking · ath · bull run · layer 2 · rollup · smart contract
Design
16 keywords
design · ui · ux · figma · color · typography · animation · branding · icon · micro-interaction · prototype · wireframe · conversion · user testing · neumorphism · dark mode
Automobiles
20 keywords
car · auto · vehicle · electric · ev · tesla · bmw · mercedes · porsche · engine · mustang · model s · plaid · gt3 · aero · adas · hybrid · lucid · mclaren · le mans
Sports
15 keywords
game · sport · basketball · football · soccer · championship · nfl · nba · player · team · espn · catch · overtime · season · marathon · training
Cooking
13 keywords
recipe · chef · cook · food · pasta · dinner · ingredient · kitchen · meal · ramsay · scrambled eggs · shrimp · flavor
News
8 keywords
breaking · summit · bbc · reuters · climate · global · announce · agreement
Fitness
8 keywords
workout · exercise · fitness · core strength · yoga · training · gym · morning workout
Health
7 keywords
sleep · wellness · health · mediterranean diet · doctor · nutrition · diet
Entertainment
8 keywords
movie · netflix · film · series · trailer · dune · watched · binge
Technology
12 keywords
tech · apple · chip · neural · ai · vr · headset · meta · verge · quantum · m4 · processor
Real Estate
6 keywords
home · house · zillow · property · real estate · listing
Part 4 — Trust Score System
DDynamic trust score
+2
Reward
Every accepted save where the user does not move the tweet. Every bookmark removal from Library. Max cap: 100.
-4
Penalty
Every manual folder move — the AI was wrong. Penalty is larger than reward to bias the system toward accuracy. Min floor: 0.
75
Starting value
Every session starts at 75. Trust score lives in React state only — resets on reload. Corrections are persisted, trust score is not.
Effect on confidence ceiling
Trust bonus = trustScore / 100 x 0.06. A user at trust 100 gets +0.06. A user at trust 0 gets +0.00. The ceiling moves from 0.87 to 0.93 between worst and best trust. Threshold stays fixed at 0.75 regardless.
Why corrections persist but trust does not
Correction history is the valuable signal — it contains the learned patterns. Trust score is a session-level quality indicator. Resetting trust to 75 on each session prevents stale penalty accumulation while keeping the learned vocabulary intact.
Part 5 — Correction Learning Loop
EHow the AI learns from user behavior
Full correction loop — end to end
Step 1: User bookmarks a tweet. Signal 2 classifies it as "Technology" based on keyword "ai".
Step 2: User opens Library, taps the tweet menu, selects "Move to folder", picks "Dev Resources" instead.
Step 3: CorrectionRecord is written: tweetId · oldCategory "Technology" · newCategory "Dev Resources" · keywordPattern "ai" · timestamp.
Step 4: Trust score drops by 4. Correction record persisted to xrecall_corrections in localStorage.
Step 5: User bookmarks another tweet containing "ai". Inference engine checks correctionHistory first. Finds "ai" pattern. Returns "Dev Resources" at confidence 0.88 to 0.98. Skips semantic and author signals entirely.
Result: The AI now correctly categorizes "ai" tweets into Dev Resources instead of Technology — permanently, across sessions.
keywordPattern extraction logic
First choice: the first matched keyword from bookmarkMeta.matchedKeywords. Fallback: first 3 words of tweet content joined as a string. This ensures even tweets with no keyword match have a learnable pattern stored.
Persistence across sessions
correctionHistory is written to xrecall_corrections on every move. On next app load, useState lazy initializer reads it back from localStorage. The AI has full memory of every correction the user has ever made.
Section legend
A — Three-signal inference engine
B — Confidence scoring formula
C — Keyword dictionary
D — Trust score system
E — Correction learning loop