<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: near</title>
    <description>The latest articles on DEV Community by near (@subhansh).</description>
    <link>https://dev.to/subhansh</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3932783%2Fec98af63-4dd3-4af0-85ce-d5c0b76ebf45.png</url>
      <title>DEV Community: near</title>
      <link>https://dev.to/subhansh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/subhansh"/>
    <language>en</language>
    <item>
      <title>How My AI Research Agent Proposed Novel Physics That Doesn't Exist Anywhere on the Internet</title>
      <dc:creator>near</dc:creator>
      <pubDate>Wed, 03 Jun 2026 21:11:18 +0000</pubDate>
      <link>https://dev.to/subhansh/how-my-ai-research-agent-proposed-novel-physics-that-doesnt-exist-anywhere-on-the-internet-5ce9</link>
      <guid>https://dev.to/subhansh/how-my-ai-research-agent-proposed-novel-physics-that-doesnt-exist-anywhere-on-the-internet-5ce9</guid>
      <description>&lt;h1&gt;
  
  
  How My AI Research Agent Proposed Novel Physics That Doesn't Exist Anywhere on the Internet
&lt;/h1&gt;

&lt;p&gt;As many of you know, I've been building &lt;strong&gt;Rumi&lt;/strong&gt; — an autonomous research agent that reads papers, builds knowledge graphs, and proposes novel hypotheses by combining concepts in ways no one has done before.&lt;/p&gt;

&lt;p&gt;I ran it on two unsolved problems in astrophysics. And honestly? The results surprised me.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔭 Discovery 1: Gravitational Wave Echoes from Extra Dimensions
&lt;/h2&gt;

&lt;p&gt;When black holes merge, LIGO detects gravitational waves. But some researchers have noticed something strange — faint &lt;strong&gt;echoes&lt;/strong&gt; after the main signal. Standard General Relativity doesn't predict these.&lt;/p&gt;

&lt;p&gt;Rumi analyzed &lt;strong&gt;28 arXiv papers&lt;/strong&gt; and proposed a &lt;strong&gt;three-variable framework&lt;/strong&gt; to explain them:&lt;/p&gt;

&lt;h3&gt;
  
  
  Q_brane — Brane-Induced Tidal Charge
&lt;/h3&gt;

&lt;p&gt;In Randall-Sundrum braneworlds, the 4D black hole solution acquires an effective tidal charge from the projection of the Weyl tensor onto the brane. This modifies the metric:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ds² = -(1 - 2GM/r + Q_brane/r²)dt² + ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Which in turn modifies the effective radial potential for perturbations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;V_eff(r) = (1 - 2M/r + Q_brane/r²) [l(l+1)/r² + ...]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  g_phi — Bulk Scalar-Field Leakage
&lt;/h3&gt;

&lt;p&gt;A light scalar field propagating in the extra dimension gets excited by the merger event. It leaks energy into the bulk, producing damped echoes at:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;t_n = t₀ + n·Δt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The coupling strength &lt;code&gt;g_phi&lt;/code&gt; controls the attenuation length in the bulk — stronger coupling means faster damping of the echo signal.&lt;/p&gt;

&lt;h3&gt;
  
  
  alpha_KK — Kaluza-Klein Dispersion Correction
&lt;/h3&gt;

&lt;p&gt;Kaluza-Klein modes in extra dimensions modify the graviton dispersion relation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ω² = k²c² + α_KK · m_n²c⁴/ℏ²
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This gives a frequency-dependent group velocity:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;v_g = dω/dk ≈ c[1 - (α_KK · k²)/2]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For &lt;code&gt;f ~ 200 Hz&lt;/code&gt; (typical LIGO band), the fractional shift is &lt;code&gt;Δf/f ~ 10⁻⁶&lt;/code&gt; — small but potentially detectable.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Key Insight
&lt;/h3&gt;

&lt;p&gt;Each of these variables exists independently across different papers. Nobody has combined them into a single coherent framework with testable predictions. That's what Rumi did.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Score: 76/100&lt;/strong&gt; | Own-skeptic verdict: &lt;em&gt;Promising but needs refinement&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🌟 Discovery 2: Anomalous Stellar Dimming — Beyond Exoplanets and Dust
&lt;/h2&gt;

&lt;p&gt;TESS and Kepler have found stars that dim in ways we can't fully explain. Not just Tabby's Star — there's a whole class of events with sharp, irregular dips that don't fit standard models.&lt;/p&gt;

&lt;p&gt;Rumi analyzed &lt;strong&gt;29 papers&lt;/strong&gt; and proposed another &lt;strong&gt;three-variable framework&lt;/strong&gt;:&lt;/p&gt;

&lt;h3&gt;
  
  
  SMRZ — Stellar Magnetospheric Reconnection Zone
&lt;/h3&gt;

&lt;p&gt;A localized region in the outer magnetosphere where large-scale magnetic reconnection events produce transient opacity enhancements. A reconnection event triggers when the magnetic shear angle exceeds ~30°. The outflow forms a sheet of thickness:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;L ~ v_out · Δt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;where &lt;code&gt;Δt ~ 10 min&lt;/code&gt; (typical reconnection timescale). This creates a transient opacity enhancement that blocks starlight.&lt;/p&gt;

&lt;h3&gt;
  
  
  VODC — Variable Optical-Depth Circumstellar Dust Cloud
&lt;/h3&gt;

&lt;p&gt;A clumpy, partially ionized dust structure orbiting at ~1 AU around the target star. Grain dynamics are governed by:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;∂n_d/∂t + div(n_d · v_d) = -n_d/τ_s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;where &lt;code&gt;n_d&lt;/code&gt; is grain number density, &lt;code&gt;v_d&lt;/code&gt; is drift velocity, and &lt;code&gt;τ_s&lt;/code&gt; is the sublimation time.&lt;/p&gt;

&lt;p&gt;Radiation pressure drives grain acceleration with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;β = F_rad / F_grav
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For grains of size &lt;code&gt;a ~ 0.1 μm&lt;/code&gt;, β approaches unity — meaning radiation pressure nearly balances gravity, creating highly dynamic dust configurations.&lt;/p&gt;

&lt;h3&gt;
  
  
  DP-ET — Dark Photon Mediated Energy Transport
&lt;/h3&gt;

&lt;p&gt;A hypothesized low-mass (&lt;code&gt;m_γ' &amp;lt; 10⁻¹² eV&lt;/code&gt;) dark photon that mixes kinetically with ordinary photons in the stellar radiative zone. The photon–dark-photon conversion rate is set by the kinetic mixing parameter &lt;code&gt;χ&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Integrated over the radiative zone (&lt;code&gt;M_rad ~ 0.7 M☉&lt;/code&gt;), this produces anomalous luminosity loss that looks like unexplained dimming.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Key Insight
&lt;/h3&gt;

&lt;p&gt;Same story — the individual concepts are known. But the specific way Rumi combined them into a unified cascade mechanism with testable predictions? Novel.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Score: 72/100&lt;/strong&gt; | Own-skeptic verdict: &lt;em&gt;Interesting synthesis, needs tighter modeling&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What Actually Happened Under the Hood
&lt;/h2&gt;

&lt;p&gt;Here's what Rumi's pipeline did:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Processed &lt;strong&gt;57 papers&lt;/strong&gt; (28 + 29 arXiv papers)&lt;/li&gt;
&lt;li&gt;Built knowledge graphs with &lt;strong&gt;138+ entities&lt;/strong&gt; and &lt;strong&gt;107+ relationships&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Proposed &lt;strong&gt;4 hidden variables&lt;/strong&gt; per discovery (3 shown above each)&lt;/li&gt;
&lt;li&gt;Generated &lt;strong&gt;12 falsifiable predictions&lt;/strong&gt; (6 per discovery)&lt;/li&gt;
&lt;li&gt;Ran &lt;strong&gt;theory competitions&lt;/strong&gt; against 10 alternative explanations&lt;/li&gt;
&lt;li&gt;Had a &lt;strong&gt;built-in skeptic agent&lt;/strong&gt; review its own work&lt;/li&gt;
&lt;li&gt;Completed in under &lt;strong&gt;2 minutes&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The skeptic flagged both discoveries as "REVISE" with low confidence (42% for Discovery 1, unknown for Discovery 2). And that's by design — Rumi doesn't confirm itself. It proposes and stress-tests.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Honest Take
&lt;/h2&gt;

&lt;p&gt;These are &lt;strong&gt;hypotheses, not breakthroughs&lt;/strong&gt;. The mechanisms need tighter quantitative models and the predictions need observational data. I'm not claiming Rumi solved physics.&lt;/p&gt;

&lt;p&gt;But here's what it &lt;em&gt;did&lt;/em&gt; do:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It explored a &lt;strong&gt;combinatorial space of ideas&lt;/strong&gt; that would take a human research team weeks to map out&lt;/li&gt;
&lt;li&gt;It surfaced &lt;strong&gt;novel variable combinations&lt;/strong&gt; worth investigating&lt;/li&gt;
&lt;li&gt;The individual ingredients are all &lt;strong&gt;established physics&lt;/strong&gt; — the recipes are new&lt;/li&gt;
&lt;li&gt;The specific combinations can't be found in any paper, blog, or anywhere online&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's the real power of autonomous research agents. Not replacing scientists. But giving them &lt;strong&gt;novel starting points&lt;/strong&gt; they wouldn't have found on their own.&lt;/p&gt;




&lt;h2&gt;
  
  
  What's Next
&lt;/h2&gt;

&lt;p&gt;I'm working on improving Rumi's quantitative modeling capabilities and adding observational data integration. The goal is to go from "interesting hypothesis" to "testable prediction with confidence intervals."&lt;/p&gt;

&lt;p&gt;More updates coming soon.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Built with Python, arXiv APIs, and a lot of late nights. If you're working on similar AI-for-science projects, I'd love to connect.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>astrophysics</category>
      <category>research</category>
      <category>ai</category>
    </item>
    <item>
      <title>I Built a 95K-Line Cognitive AI OS at 17 — Yoshua Bengio Reviewed It</title>
      <dc:creator>near</dc:creator>
      <pubDate>Thu, 28 May 2026 15:23:34 +0000</pubDate>
      <link>https://dev.to/subhansh/i-built-a-95k-line-cognitive-ai-os-at-17-yoshua-bengio-reviewed-it-2661</link>
      <guid>https://dev.to/subhansh/i-built-a-95k-line-cognitive-ai-os-at-17-yoshua-bengio-reviewed-it-2661</guid>
      <description>&lt;p&gt;I'm 17. Self-taught. From Vadodara, India. No university. No formal CS education. No funding.&lt;/p&gt;

&lt;p&gt;I built two autonomous cognitive systems totaling 150K+ lines of Python. Yoshua Bengio (Turing Award nominee, Mila founder) reviewed my architecture. A Princeton neuroscience professor acknowledged it.&lt;/p&gt;

&lt;p&gt;Here's what I built, how I built it, and what I learned.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Projects
&lt;/h2&gt;

&lt;h3&gt;
  
  
  F.R.I.D.A.Y. — Autonomous Cognitive AI Operating System
&lt;/h3&gt;

&lt;p&gt;FRIDAY is a 95K-line cognitive AI OS with 66 modular brain components. Not a chatbot wrapper. Not an API call. A genuine cognitive architecture.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Brain Modules Include:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Active Inference Engine (Karl Friston's free-energy principle)&lt;/li&gt;
&lt;li&gt;Hebbian Memory with synaptic strength decay (72h TTL)&lt;/li&gt;
&lt;li&gt;Episodic Memory with vector search&lt;/li&gt;
&lt;li&gt;Dreaming routines (offline consolidation during idle states)&lt;/li&gt;
&lt;li&gt;Self-Awareness meters&lt;/li&gt;
&lt;li&gt;Curiosity engine&lt;/li&gt;
&lt;li&gt;Theory of Mind&lt;/li&gt;
&lt;li&gt;Metacognitive Monitor&lt;/li&gt;
&lt;li&gt;Global Workspace (Baars' Global Workspace Theory)&lt;/li&gt;
&lt;li&gt;Causal Reasoner (Pearl's hierarchy)&lt;/li&gt;
&lt;li&gt;Analogy Engine (Gentner's structure mapping)&lt;/li&gt;
&lt;li&gt;Narrative Intelligence&lt;/li&gt;
&lt;li&gt;Transfer Learning&lt;/li&gt;
&lt;li&gt;Predictive Memory&lt;/li&gt;
&lt;li&gt;World Simulation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The Mythos Security Pipeline:&lt;/strong&gt;&lt;br&gt;
7-agent autonomous security audit system:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Recon — Maps file entry points, identifies tech stack&lt;/li&gt;
&lt;li&gt;Hunter — Scans for logic vulnerabilities, injection points&lt;/li&gt;
&lt;li&gt;Secrets — Detects hardcoded API keys, tokens, credentials&lt;/li&gt;
&lt;li&gt;DAST — Dynamic analysis, realistic attack simulations&lt;/li&gt;
&lt;li&gt;Logic Flaw — Audits authentication flows, authorization boundaries&lt;/li&gt;
&lt;li&gt;Code Quality — Flags insecure patterns, deprecated libraries&lt;/li&gt;
&lt;li&gt;Supply Chain — Checks dependencies against CVE databases&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Full CVSS scoring. Automated reports in under 60 seconds.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Smart LLM Routing:&lt;/strong&gt;&lt;br&gt;
Routes queries to the right model based on complexity:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Flash for reflexive tasks&lt;/li&gt;
&lt;li&gt;Opus for deep planning&lt;/li&gt;
&lt;li&gt;Groq for fast inference&lt;/li&gt;
&lt;li&gt;Local fallbacks for offline operation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Runs on minimal hardware:&lt;/strong&gt; 4GB RAM, i3 CPU, no GPU. Pure Python, zero native compilation.&lt;/p&gt;

&lt;h3&gt;
  
  
  R.U.M.I. — Autonomous Scientific Discovery Framework
&lt;/h3&gt;

&lt;p&gt;RUMI is an 88-module autonomous scientific cognition framework with 15 Scientist AI modules and a 10-stage hypothesis discovery pipeline.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Pipeline:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;PubMed Retrieval — Queries scientific literature databases&lt;/li&gt;
&lt;li&gt;Relevance Filter — Scores papers by domain relevance&lt;/li&gt;
&lt;li&gt;NER Entity Extraction — Identifies genes, compounds, pathways, mutations&lt;/li&gt;
&lt;li&gt;Knowledge Graph Construction — Builds semantic relationships (5K+ entities)&lt;/li&gt;
&lt;li&gt;Contradiction Mining — Detects logical conflicts across papers&lt;/li&gt;
&lt;li&gt;Hypothesis Generation — Synthesizes testable hypotheses&lt;/li&gt;
&lt;li&gt;Skeptic Review — Challenges hypotheses with counter-evidence&lt;/li&gt;
&lt;li&gt;Novelty Verification — Checks against existing literature&lt;/li&gt;
&lt;li&gt;Experiment Planning — Designs validation protocols (Western blot, qRT-PCR)&lt;/li&gt;
&lt;li&gt;Metrics Logging — Tracks confidence scores, provenance&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;15+ Scientific Database Integrations:&lt;/strong&gt;&lt;br&gt;
PubMed, Semantic Scholar, OpenAlex, arXiv, PDB, UniProt, PubChem, GBIF, NASA, NOAA, WHO, World Bank, and more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;9-Type Memory Architecture:&lt;/strong&gt;&lt;br&gt;
Neural, Episodic, Vector, Procedural, Working, Associative, Predictive, Consolidated, Global Workspace.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real Results:&lt;/strong&gt;&lt;br&gt;
Generated 2 novel testable hypotheses for KRAS G12C sotorasib resistance:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;RAC1/PAK1 reactivation pathway&lt;/li&gt;
&lt;li&gt;PI3K-AKT bypass mechanism&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are real oncology hypotheses that could guide future research.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Benchmarks
&lt;/h2&gt;

&lt;p&gt;I benchmarked FRIDAY's cognitive pipeline (not raw LLM calls) on 7 recognized AI benchmarks using Groq's free llama-3.1-8b-instant. No paid APIs. Two Groq API keys with round-robin rotation.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Benchmark&lt;/th&gt;
&lt;th&gt;Accuracy&lt;/th&gt;
&lt;th&gt;Questions&lt;/th&gt;
&lt;th&gt;Notes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;ARC-Challenge&lt;/td&gt;
&lt;td&gt;88%&lt;/td&gt;
&lt;td&gt;50&lt;/td&gt;
&lt;td&gt;Competitive with 10-100x larger models&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GSM8K (Math)&lt;/td&gt;
&lt;td&gt;85%&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;Multi-step mathematical reasoning&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TruthfulQA&lt;/td&gt;
&lt;td&gt;71%&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;Fact vs common misconceptions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MMLU&lt;/td&gt;
&lt;td&gt;61%&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;57 academic subjects&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ARC-Easy&lt;/td&gt;
&lt;td&gt;68%&lt;/td&gt;
&lt;td&gt;50&lt;/td&gt;
&lt;td&gt;Grade-school science&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPQA (PhD-level)&lt;/td&gt;
&lt;td&gt;42%&lt;/td&gt;
&lt;td&gt;50&lt;/td&gt;
&lt;td&gt;Designed for non-experts to score ~0%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Total: 535 questions. 0 errors. 0 retries. Pass@1.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The standout: ARC-Challenge at 88% on an 8B model. That's competitive with models 10-100x its size.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Proof the pipeline works:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Correct answers averaged 61.8s vs incorrect at 58.7s&lt;/li&gt;
&lt;li&gt;More reasoning time → better answers&lt;/li&gt;
&lt;li&gt;This is a real cognitive pipeline, not random guessing&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Bengio Story
&lt;/h2&gt;

&lt;p&gt;I emailed Yoshua Bengio about FRIDAY. Here's what happened:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Email 1:&lt;/strong&gt; I introduced FRIDAY and asked for feedback.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Email 2:&lt;/strong&gt; Bengio replied: "Did you evaluate its capabilities and safety on standard benchmarks?"&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Email 3:&lt;/strong&gt; I tried SWE-Bench and GAIA but hit Gemini's free tier rate limits. I explained the situation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Email 4:&lt;/strong&gt; Bengio: "You're not going to convince anyone if you don't have competitive results."&lt;/p&gt;

&lt;p&gt;He was right. So I benchmarked FRIDAY on 7 recognized benchmarks. Sent him the results.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Email 5:&lt;/strong&gt; Bengio: "Sorry but I don't have more time to discuss this. I need to focus on Scientist AI. All the best with your project."&lt;/p&gt;

&lt;p&gt;He engaged 4 times. He pushed me to benchmark properly. He acknowledged the work.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Princeton Recognition
&lt;/h2&gt;

&lt;p&gt;Michael S. Graziano, Princeton neuroscience professor (creator of Attention Schema Theory of consciousness), acknowledged FRIDAY's brain-module design.&lt;/p&gt;

&lt;p&gt;His response: "Dear Subhansh, Thank you for the email and the enthusiasm! Friday sounds like a wonderful project, and thank you for telling me about it. Best wishes with it, and with all future endeavors."&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Benchmark everything.&lt;/strong&gt; Bengio was right — without competitive results, nobody listens.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Build systems, not scripts.&lt;/strong&gt; FRIDAY isn't a script. It's a cognitive architecture with 66 brain modules. That's what makes it interesting.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Age doesn't matter.&lt;/strong&gt; What you build matters. I'm 17. I built 150K+ lines of autonomous cognitive systems. Bengio reviewed it. Princeton acknowledged it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AI augmentation is real.&lt;/strong&gt; I build with AI assistance (Cursor, Claude, Copilot). That's not cheating — it's the future of development. I ship at 10x speed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Open source builds credibility.&lt;/strong&gt; Everything is on GitHub. People can see what I built. That's more convincing than any resume.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The Code
&lt;/h2&gt;

&lt;p&gt;Both projects are open source:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;FRIDAY:&lt;/strong&gt; &lt;a href="https://github.com/subhansh-dev/Friday" rel="noopener noreferrer"&gt;https://github.com/subhansh-dev/Friday&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;RUMI:&lt;/strong&gt; &lt;a href="https://github.com/subhansh-dev/Rumi" rel="noopener noreferrer"&gt;https://github.com/subhansh-dev/Rumi&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Portfolio:&lt;/strong&gt; &lt;a href="https://subhanshh.vercel.app" rel="noopener noreferrer"&gt;https://subhanshh.vercel.app&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What's Next
&lt;/h2&gt;

&lt;p&gt;I'm looking for an AI research internship where I can ship real work. Open to anywhere worldwide. Can start immediately.&lt;/p&gt;

&lt;p&gt;If you're building something interesting and need someone who thinks in architectures, not scripts — let's talk.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Subhansh is a 17-year-old self-taught AI researcher from Vadodara, India. He builds autonomous cognitive systems and thinks the future of AI is in cognitive architectures, not just bigger models.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>research</category>
      <category>python</category>
    </item>
    <item>
      <title>Contradiction Mining in Scientific Literature: How RUMI Finds Conflicts Across Papers</title>
      <dc:creator>near</dc:creator>
      <pubDate>Thu, 28 May 2026 11:30:57 +0000</pubDate>
      <link>https://dev.to/subhansh/contradiction-mining-in-scientific-literature-how-rumi-finds-conflicts-across-papers-30fc</link>
      <guid>https://dev.to/subhansh/contradiction-mining-in-scientific-literature-how-rumi-finds-conflicts-across-papers-30fc</guid>
      <description>&lt;h1&gt;
  
  
  Contradiction Mining in Scientific Literature: How RUMI Finds Conflicts Across Papers
&lt;/h1&gt;

&lt;p&gt;One of the hardest problems in scientific research is identifying contradictions across papers. Two studies might claim opposite things about the same mechanism, and unless you read both carefully — and remember both — you'll never notice the conflict.&lt;/p&gt;

&lt;p&gt;RUMI automates this. Here's the technical approach.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Scientific literature is growing exponentially. PubMed adds ~4,000 papers per day. No human can read, remember, and cross-reference everything. This leads to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Unresolved contradictions&lt;/strong&gt;: Paper A says mechanism X causes outcome Y. Paper B says mechanism X prevents outcome Y. Neither cites the other.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hidden consensus&lt;/strong&gt;: 5 papers independently confirm the same finding, but nobody has connected them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Novel findings hiding in plain sight&lt;/strong&gt;: A new mechanism described in one paper is actually the missing piece for a puzzle described in another.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  RUMI's Contradiction Mining Pipeline
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Stage 1: Entity Normalization
&lt;/h3&gt;

&lt;p&gt;Before you can find contradictions, you need to know when two papers are talking about the same thing. RUMI normalizes entities using multiple strategies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Gene/protein names&lt;/strong&gt;: Maps aliases to canonical names (e.g., "BRAF" = "B-Raf" = "v-Raf murine sarcoma viral oncogene homolog B")&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Drug names&lt;/strong&gt;: Maps brand names to generic (e.g., "Lumakras" = "sotorasib" = "AMG 510")&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pathway names&lt;/strong&gt;: Uses KEGG and Reactome IDs to normalize pathway references&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Disease names&lt;/strong&gt;: Maps to MeSH terms and OMIM IDs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without normalization, "sotorasib" and "AMG 510" look like different entities. With it, RUMI can connect findings across papers that use different nomenclature.&lt;/p&gt;

&lt;h3&gt;
  
  
  Stage 2: Claim Extraction
&lt;/h3&gt;

&lt;p&gt;RUMI extracts structured claims from each paper using LLM-assisted parsing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@dataclass&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ScientificClaim&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;subject&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Entity&lt;/span&gt;        &lt;span class="c1"&gt;# What is being discussed
&lt;/span&gt;    &lt;span class="n"&gt;predicate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;         &lt;span class="c1"&gt;# What relationship is claimed
&lt;/span&gt;    &lt;span class="nb"&gt;object&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Entity&lt;/span&gt;         &lt;span class="c1"&gt;# What it's related to
&lt;/span&gt;    &lt;span class="n"&gt;direction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;         &lt;span class="c1"&gt;# positive / negative / neutral
&lt;/span&gt;    &lt;span class="n"&gt;confidence&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;      &lt;span class="c1"&gt;# Extraction confidence
&lt;/span&gt;    &lt;span class="n"&gt;evidence_type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;     &lt;span class="c1"&gt;# experimental / observational / computational
&lt;/span&gt;    &lt;span class="n"&gt;paper_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;          &lt;span class="c1"&gt;# Source paper
&lt;/span&gt;    &lt;span class="n"&gt;sentence&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;          &lt;span class="c1"&gt;# Original text
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example extraction:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Subject: KRAS G12C, Predicate: activates, Object: MAPK signaling, Direction: positive&lt;/li&gt;
&lt;li&gt;Subject: Sotorasib, Predicate: inhibits, Object: KRAS G12C, Direction: negative&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Stage 3: Contradiction Detection
&lt;/h3&gt;

&lt;p&gt;Two claims contradict when they have the same subject and object but opposite directions, or when one paper claims A causes B while another claims A prevents B.&lt;/p&gt;

&lt;p&gt;RUMI uses three detection methods:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Direct contradiction&lt;/strong&gt;: Same entities, opposite directions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Paper 1: "AURKA promotes KRAS inhibitor resistance"
Paper 2: "AURKA inhibition does not sensitize KRAS-mutant cells"
→ Direct contradiction on AURKA's role
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Contextual contradiction&lt;/strong&gt;: Same relationship, different conditions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Paper 1: "MET amplification drives resistance in early treatment"
Paper 2: "MET amplification is rare in acquired resistance"
→ Contextual: timing-dependent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Implicit contradiction&lt;/strong&gt;: Different mechanisms proposed for the same phenomenon.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Paper 1: "Resistance is primarily driven by MAPK reactivation"
Paper 2: "Resistance is primarily driven by PI3K/AKT activation"
→ Implicit: competing models
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Stage 4: Resolution Analysis
&lt;/h3&gt;

&lt;p&gt;Not all contradictions are real. Some are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Methodological&lt;/strong&gt;: Different cell lines, different doses, different timepoints&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Temporal&lt;/strong&gt;: The field's understanding evolved between publication dates&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Definitional&lt;/strong&gt;: Same term used with different meanings&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;RUMI classifies each contradiction and suggests resolution strategies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Contradiction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;claim_a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ScientificClaim&lt;/span&gt;
    &lt;span class="n"&gt;claim_b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ScientificClaim&lt;/span&gt;
    &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ContradictionType&lt;/span&gt;  &lt;span class="c1"&gt;# direct, contextual, implicit
&lt;/span&gt;    &lt;span class="n"&gt;resolution_strategy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;  &lt;span class="c1"&gt;# methodological, temporal, definitional, genuine
&lt;/span&gt;    &lt;span class="n"&gt;suggested_experiment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt; &lt;span class="c1"&gt;# What experiment would resolve it
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Real Example: The AURKA Paradox
&lt;/h2&gt;

&lt;p&gt;In the KRAS G12C analysis, RUMI found a genuine contradiction:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Paper A&lt;/strong&gt; (2026): AURKA is upregulated in sotorasib-resistant cells and stabilizes PHB2, activating PI3K/AKT&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Paper B&lt;/strong&gt; (2026): AURKA inhibition alone does not restore sotorasib sensitivity in resistant lines&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;RUMI classified this as a &lt;strong&gt;contextual contradiction&lt;/strong&gt;: AURKA upregulation is a real resistance mechanism, but it's part of a positive feedback loop (AURKA→PHB2→PI3K/AKT) that requires combined inhibition to break. Single-agent AURKA inhibition fails because the loop has redundancy.&lt;/p&gt;

&lt;p&gt;This resolution led to the hypothesis that dual AURKA + PI3K inhibition might be more effective — a testable prediction that neither paper explicitly made.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Knowledge Graph Approach
&lt;/h2&gt;

&lt;p&gt;All of this is powered by RUMI's knowledge graph. Each node represents an entity (gene, protein, drug, disease, pathway). Each edge represents a relationship with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Direction&lt;/strong&gt;: activation, inhibition, association&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Evidence strength&lt;/strong&gt;: number of supporting papers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Confidence&lt;/strong&gt;: based on extraction quality and paper count&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Temporal context&lt;/strong&gt;: when the finding was published&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Contradictions appear as &lt;strong&gt;negative-weight edges&lt;/strong&gt; between the same nodes. The graph makes it visually and computationally obvious where the scientific literature disagrees.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limitations
&lt;/h2&gt;

&lt;p&gt;This system is still early:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Claim extraction depends on LLM quality — complex claims with multiple qualifications are often oversimplified&lt;/li&gt;
&lt;li&gt;Some "contradictions" are actually nuanced positions that require expert interpretation&lt;/li&gt;
&lt;li&gt;The system can't evaluate experimental quality — a poorly designed study gets equal weight&lt;/li&gt;
&lt;li&gt;Publication bias means the literature itself may be contradictory for structural reasons&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/subhansh-dev/Rumi
&lt;span class="nb"&gt;cd &lt;/span&gt;rumi
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt;
playwright &lt;span class="nb"&gt;install &lt;/span&gt;chromium
rumi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run &lt;code&gt;/discover&lt;/code&gt; on a topic with active debate and see what contradictions RUMI surfaces.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href="https://github.com/subhansh-dev/Rumi" rel="noopener noreferrer"&gt;https://github.com/subhansh-dev/Rumi&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Portfolio&lt;/strong&gt;: &lt;a href="https://subhanshh.vercel.app" rel="noopener noreferrer"&gt;https://subhanshh.vercel.app&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;If you work in systematic reviews, meta-analyses, or evidence synthesis, I'd love to know: what would make a tool like this actually useful in your workflow? What's the biggest gap?&lt;/p&gt;

&lt;p&gt;— Subhansh&lt;/p&gt;

</description>
      <category>research</category>
      <category>datascience</category>
      <category>python</category>
      <category>ai</category>
    </item>
    <item>
      <title>Building Knowledge Graphs for Drug Discovery: A Technical Deep Dive with KRAS G12C</title>
      <dc:creator>near</dc:creator>
      <pubDate>Thu, 28 May 2026 11:29:13 +0000</pubDate>
      <link>https://dev.to/subhansh/building-knowledge-graphs-for-drug-discovery-a-technical-deep-dive-with-kras-g12c-3n0e</link>
      <guid>https://dev.to/subhansh/building-knowledge-graphs-for-drug-discovery-a-technical-deep-dive-with-kras-g12c-3n0e</guid>
      <description>&lt;h1&gt;
  
  
  Building Knowledge Graphs for Drug Discovery: A Technical Deep Dive with KRAS G12C
&lt;/h1&gt;

&lt;p&gt;Knowledge graphs are the backbone of modern drug discovery. But most implementations are static, manually curated, and lag behind the literature by months. RUMI builds knowledge graphs dynamically from PubMed papers, enriches them with 15+ external databases, and uses graph metrics to surface non-obvious relationships.&lt;/p&gt;

&lt;p&gt;Here's the technical architecture, using KRAS G12C cancer drug resistance as a real case study.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Pipeline
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Literature Acquisition
&lt;/h3&gt;

&lt;p&gt;RUMI searches PubMed using the NCBI E-utilities API with semantic query expansion. For "KRAS G12C resistance mechanisms", it generates multiple query variants:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;queries&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="sh"&gt;'"&lt;/span&gt;&lt;span class="s"&gt;KRAS G12C&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt; AND resistance&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;'"&lt;/span&gt;&lt;span class="s"&gt;KRAS G12C&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt; AND &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;treatment failure&lt;/span&gt;&lt;span class="sh"&gt;"'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;'"&lt;/span&gt;&lt;span class="s"&gt;sotorasib&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt; AND resistance&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;'"&lt;/span&gt;&lt;span class="s"&gt;adagrasib&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt; AND resistance&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;'"&lt;/span&gt;&lt;span class="s"&gt;KRAS G12C&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt; AND &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;adaptive resistance&lt;/span&gt;&lt;span class="sh"&gt;"'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each query returns different papers. RUMI deduplicates by PMID and filters by relevance score (cosine similarity between query and abstract embeddings).&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Entity Extraction
&lt;/h3&gt;

&lt;p&gt;RUMI extracts domain-specific entities using a combination of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Dictionary matching&lt;/strong&gt;: HGNC gene names, DrugBank drug names, MeSH disease terms&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LLM extraction&lt;/strong&gt;: For novel entities not in dictionaries (new protein names, experimental compounds)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contextual disambiguation&lt;/strong&gt;: "BRAF" could be the gene or the protein — RUMI uses context to resolve&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Entity types in the drug discovery domain:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Entity Type&lt;/th&gt;
&lt;th&gt;Examples&lt;/th&gt;
&lt;th&gt;Count in KRAS Analysis&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Gene/Protein&lt;/td&gt;
&lt;td&gt;KRAS, AURKA, PHB2, MET&lt;/td&gt;
&lt;td&gt;23&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Drug/Compound&lt;/td&gt;
&lt;td&gt;Sotorasib, Adagrasib, BBO-8520&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Disease/Condition&lt;/td&gt;
&lt;td&gt;NSCLC, CRC, pancreatic cancer&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pathway&lt;/td&gt;
&lt;td&gt;MAPK, PI3K/AKT, RAS/MAPK&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mechanism&lt;/td&gt;
&lt;td&gt;Amplification, mutation, methylation&lt;/td&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Step 3: Relationship Extraction
&lt;/h3&gt;

&lt;p&gt;For each pair of co-occurring entities, RUMI extracts the relationship type:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Activates&lt;/strong&gt;: A promotes B&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inhibits&lt;/strong&gt;: A suppresses B&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Associated&lt;/strong&gt;: A and B co-occur (direction unknown)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Causes&lt;/strong&gt;: A causally leads to B&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Treats&lt;/strong&gt;: A is a therapeutic intervention for B&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The LLM extracts relationship direction and confidence from the sentence context:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;Input:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Sotorasib-bound KRAS accumulates and reactivates MAPK signaling through DHX9 cytoplasmic retention"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;Output:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;subject:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;KRAS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;G&lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="err"&gt;C&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;(sotorasib-bound)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;predicate:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;reactivates&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;object:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;MAPK&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;signaling&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;mechanism:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;DHX&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;cytoplasmic&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;retention&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;confidence:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.85&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4: Graph Construction
&lt;/h3&gt;

&lt;p&gt;The knowledge graph is a directed multigraph where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Nodes = entities (with type, attributes, source papers)&lt;/li&gt;
&lt;li&gt;Edges = relationships (with type, confidence, evidence papers)&lt;/li&gt;
&lt;li&gt;Edge weight = number of independent papers supporting the relationship
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;KnowledgeGraph&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;nodes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;  &lt;span class="c1"&gt;# entity_id -&amp;gt; Entity
&lt;/span&gt;        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;edges&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;  &lt;span class="c1"&gt;# list of Edge
&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;add_relationship&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;subject&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;predicate&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;paper_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;confidence&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;edge_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;subject&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;predicate&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;edge_key&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;edge_index&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;edge_index&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;edge_key&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;evidence&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;paper_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;edge_index&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;edge_key&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;weight&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;edges&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Edge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;subject&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;predicate&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;paper_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;confidence&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 5: External Enrichment
&lt;/h3&gt;

&lt;p&gt;RUMI enriches the graph with data from 15+ APIs:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;API&lt;/th&gt;
&lt;th&gt;What it adds&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;PubChem&lt;/td&gt;
&lt;td&gt;Drug structures, targets, clinical trial status&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;UniProt&lt;/td&gt;
&lt;td&gt;Protein functions, domains, interactions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PDB&lt;/td&gt;
&lt;td&gt;3D structures for molecular docking context&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OpenFDA&lt;/td&gt;
&lt;td&gt;Adverse events, approved indications&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Semantic Scholar&lt;/td&gt;
&lt;td&gt;Citation networks, related papers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;KEGG&lt;/td&gt;
&lt;td&gt;Pathway membership, metabolic context&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reactome&lt;/td&gt;
&lt;td&gt;Detailed biological pathway diagrams&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ClinicalTrials.gov&lt;/td&gt;
&lt;td&gt;Active trials for compounds in the graph&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This enrichment adds hundreds of additional edges and attributes to the graph.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 6: Graph Metrics
&lt;/h3&gt;

&lt;p&gt;RUMI computes several graph metrics to identify important nodes and relationships:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Betweenness centrality&lt;/strong&gt;: Identifies nodes that connect otherwise separate clusters. In the KRAS analysis, PI3K/AKT had high betweenness — it connects the MAPK resistance pathway to the metabolic survival pathway.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Jaccard similarity&lt;/strong&gt;: Measures overlap between two nodes' neighborhoods. High Jaccard between "MET amplification" and "KRAS G12C" suggests they share many co-occurring entities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Clustering coefficient&lt;/strong&gt;: Measures how interconnected a node's neighbors are. High clustering around "resistance mechanisms" suggests a tightly coupled biological system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PageRank&lt;/strong&gt;: Identifies the most "important" entities in the graph by counting incoming edges weighted by the importance of the source.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 7: Non-Obvious Relationship Discovery
&lt;/h3&gt;

&lt;p&gt;The real value of the knowledge graph is finding relationships that no single paper explicitly states. RUMI uses:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Transitive inference&lt;/strong&gt;: If A activates B and B inhibits C, then A may indirectly inhibit C. RUMI traces these chains and reports them with decreasing confidence at each hop.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cluster analysis&lt;/strong&gt;: Entities that cluster together but aren't directly connected are candidates for novel relationships. In the KRAS analysis, RUMI found that DHX9 and RAC1 appeared in the same cluster but no paper had directly connected them — leading to the DHX9-RAC1-PAK1 hypothesis.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Gap analysis&lt;/strong&gt;: Missing edges between important nodes suggest unstudied relationships. If two entities are both well-studied but never connected, that's either a genuine non-relationship or a gap in the literature.&lt;/p&gt;

&lt;h2&gt;
  
  
  Results: The KRAS G12C Knowledge Graph
&lt;/h2&gt;

&lt;p&gt;Final statistics from the analysis:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;47 entities&lt;/strong&gt; extracted across 14 papers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;89 relationships&lt;/strong&gt; identified&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;6 clusters&lt;/strong&gt; corresponding to resistance mechanism families&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;3 high-confidence hypotheses&lt;/strong&gt; generated from graph analysis&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;12 additional relationships&lt;/strong&gt; from external database enrichment&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The graph correctly identified PI3K/AKT as the convergence point for multiple resistance mechanisms — a finding that required connecting papers from 4 different research groups who never cited each other.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limitations
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Entity extraction accuracy is ~85% — complex multi-gene names and abbreviations cause errors&lt;/li&gt;
&lt;li&gt;Relationship extraction is conservative — many real relationships are missed because the LLM requires explicit statement&lt;/li&gt;
&lt;li&gt;Graph metrics are sensitive to publication bias — well-studied entities get higher centrality regardless of biological importance&lt;/li&gt;
&lt;li&gt;Temporal relationships (A happens before B) are not well captured&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/subhansh-dev/Rumi
&lt;span class="nb"&gt;cd &lt;/span&gt;rumi
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt;
playwright &lt;span class="nb"&gt;install &lt;/span&gt;chromium
rumi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run &lt;code&gt;/discover KRAS G12C resistance mechanisms&lt;/code&gt; to see the full pipeline in action.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href="https://github.com/subhansh-dev/Rumi" rel="noopener noreferrer"&gt;https://github.com/subhansh-dev/Rumi&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Portfolio&lt;/strong&gt;: &lt;a href="https://subhanshh.vercel.app" rel="noopener noreferrer"&gt;https://subhanshh.vercel.app&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;If you work in bioinformatics, cheminformatics, or drug discovery, I'd love feedback on the graph construction approach. What metrics am I missing? What enrichment APIs should I add?&lt;/p&gt;

&lt;p&gt;— Subhansh&lt;/p&gt;

</description>
      <category>bioinformatics</category>
      <category>python</category>
      <category>datascience</category>
      <category>research</category>
    </item>
    <item>
      <title>How I Implemented 88 Neuroscience-Inspired Brain Modules for Autonomous Scientific Reasoning</title>
      <dc:creator>near</dc:creator>
      <pubDate>Thu, 28 May 2026 11:29:13 +0000</pubDate>
      <link>https://dev.to/subhansh/how-i-implemented-88-neuroscience-inspired-brain-modules-for-autonomous-scientific-reasoning-28ki</link>
      <guid>https://dev.to/subhansh/how-i-implemented-88-neuroscience-inspired-brain-modules-for-autonomous-scientific-reasoning-28ki</guid>
      <description>&lt;h1&gt;
  
  
  How I Implemented 88 Neuroscience-Inspired Brain Modules for Autonomous Scientific Reasoning
&lt;/h1&gt;

&lt;p&gt;Most AI systems today are single-pass generators — you give them input, they produce output, and nothing persists. When I set out to build RUMI (Research &amp;amp; Unified Machine Intelligence), I wanted something fundamentally different: a system that thinks, remembers, learns, and reasons the way cognitive scientists believe biological brains do.&lt;/p&gt;

&lt;p&gt;Here's how I translated decades of neuroscience research into 88 working Python modules.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Theoretical Foundations
&lt;/h2&gt;

&lt;p&gt;RUMI's architecture isn't arbitrary. Every module maps to a published neuroscience or cognitive science theory:&lt;/p&gt;

&lt;h3&gt;
  
  
  Global Workspace Theory (Baars, 1988)
&lt;/h3&gt;

&lt;p&gt;The core of RUMI's cognition is a &lt;strong&gt;global workspace&lt;/strong&gt; — a shared information bus that broadcasts events to all modules. Just like Baars proposed that consciousness arises from information being broadcast to a global workspace in the brain, RUMI's workspace broadcasts discoveries, contradictions, and hypotheses to all reasoning engines simultaneously.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;GlobalWorkspace&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;subscribers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;event_log&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;broadcast&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;WorkspaceEvent&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;event_log&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;subscriber&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;subscribers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;subscriber&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on_event&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means when the contradiction miner finds a conflict between two papers, every reasoning engine — causal, analogical, neurosymbolic — gets notified and can contribute their perspective.&lt;/p&gt;

&lt;h3&gt;
  
  
  Dual Process Theory (Kahneman, 2011)
&lt;/h3&gt;

&lt;p&gt;RUMI implements both System 1 and System 2 reasoning:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;System 1&lt;/strong&gt; — Fast, pattern-matching. Handles entity recognition, simple lookups, cached results. Uses the vector memory store with semantic search.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;System 2&lt;/strong&gt; — Slow, deliberate. Handles multi-step causal reasoning, hypothesis generation, experiment planning. Uses the causal and analogical reasoning engines.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The metacognitive monitor decides which system to engage. Simple factual queries route to System 1. Complex analytical tasks trigger System 2 with its full reasoning chain.&lt;/p&gt;

&lt;h3&gt;
  
  
  Free Energy Principle (Friston, 2010)
&lt;/h3&gt;

&lt;p&gt;RUMI's active inference module implements Friston's Free Energy Principle. The system maintains a generative model of the scientific domain and minimizes &lt;strong&gt;prediction error&lt;/strong&gt; — the difference between what it expects to find in the literature and what it actually finds.&lt;/p&gt;

&lt;p&gt;When prediction error is high (something unexpected appears in a paper), RUMI:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Updates its internal model (Bayesian updating)&lt;/li&gt;
&lt;li&gt;Flags the finding as potentially novel&lt;/li&gt;
&lt;li&gt;Triggers the curiosity engine to explore further&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is how RUMI automatically identifies findings that don't fit existing models — exactly the kind of thing that leads to breakthrough discoveries.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hebbian Learning
&lt;/h3&gt;

&lt;p&gt;"Neurons that fire together wire together." RUMI's neural memory implements Hebbian learning: concepts that co-occur frequently across papers develop stronger associations. When "KRAS G12C" and "PI3K/AKT pathway" appear together in multiple papers, their connection weight increases, making RUMI more likely to surface this relationship in future analyses.&lt;/p&gt;

&lt;h2&gt;
  
  
  The 9-Type Memory System
&lt;/h2&gt;

&lt;p&gt;Biological brains don't have one type of memory. Neither does RUMI:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Memory Type&lt;/th&gt;
&lt;th&gt;Implementation&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Neural&lt;/td&gt;
&lt;td&gt;Hebbian association weights&lt;/td&gt;
&lt;td&gt;Concept co-occurrence patterns&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Episodic&lt;/td&gt;
&lt;td&gt;Timestamped event log&lt;/td&gt;
&lt;td&gt;What happened and when&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Vector&lt;/td&gt;
&lt;td&gt;Embedding-based semantic search&lt;/td&gt;
&lt;td&gt;"Find me similar findings"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Procedural&lt;/td&gt;
&lt;td&gt;Pipeline state machines&lt;/td&gt;
&lt;td&gt;How to execute multi-step processes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Working&lt;/td&gt;
&lt;td&gt;Active context window&lt;/td&gt;
&lt;td&gt;Current reasoning state&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Global Workspace&lt;/td&gt;
&lt;td&gt;Broadcast event bus&lt;/td&gt;
&lt;td&gt;Cross-module communication&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Associative&lt;/td&gt;
&lt;td&gt;Graph-based entity links&lt;/td&gt;
&lt;td&gt;Knowledge graph relationships&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Predictive&lt;/td&gt;
&lt;td&gt;Bayesian generative models&lt;/td&gt;
&lt;td&gt;What to expect next&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Consolidated&lt;/td&gt;
&lt;td&gt;Compressed long-term store&lt;/td&gt;
&lt;td&gt;Distilled knowledge from past sessions&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The &lt;strong&gt;dreaming system&lt;/strong&gt; runs offline consolidation — replaying past experiences, strengthening important connections, and pruning noise. This mirrors how biological sleep consolidates memories.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Curiosity Engine
&lt;/h2&gt;

&lt;p&gt;One of the most important modules is the curiosity engine. It tracks &lt;strong&gt;knowledge gaps&lt;/strong&gt; — areas where RUMI's model has low confidence or high uncertainty. When the system is idle, the curiosity engine generates research questions designed to fill these gaps.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CuriosityEngine&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;generate_questions&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;knowledge_graph&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;uncertainty_threshold&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;gaps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;node&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;knowledge_graph&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;nodes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;confidence&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;uncertainty_threshold&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;gaps&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;KnowledgeGap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                    &lt;span class="n"&gt;concept&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="n"&gt;related_papers&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;connections&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="n"&gt;question&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;What is the relationship between &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;node&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; and &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;_find_weakest_link&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;node&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
                &lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;gaps&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;uncertainty&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reverse&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The Metacognitive Monitor
&lt;/h2&gt;

&lt;p&gt;Perhaps the most unusual module: RUMI monitors its own thinking quality. The metacognitive tracker:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Detects when reasoning is going in circles&lt;/li&gt;
&lt;li&gt;Identifies potential cognitive biases (confirmation bias, anchoring)&lt;/li&gt;
&lt;li&gt;Measures confidence calibration (does the system's confidence match its accuracy?)&lt;/li&gt;
&lt;li&gt;Triggers System 2 engagement when System 1 confidence is low&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why This Matters
&lt;/h2&gt;

&lt;p&gt;These aren't just theoretical constructs. Each module contributes measurable value:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Curiosity-driven exploration&lt;/strong&gt; found 3 additional relevant papers that keyword search missed in the KRAS analysis&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hebbian learning&lt;/strong&gt; correctly identified PI3K/AKT as a convergence point across 4 independent resistance mechanisms&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Active inference&lt;/strong&gt; flagged the DHX9-RAC1-PAK1 axis as novel because it didn't match the expected resistance model&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contradiction mining&lt;/strong&gt; (covered in a separate article) identified conflicting claims about AURKA's role that warranted further investigation&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try It Yourself
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/subhansh-dev/Rumi
&lt;span class="nb"&gt;cd &lt;/span&gt;rumi
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt;
playwright &lt;span class="nb"&gt;install &lt;/span&gt;chromium
rumi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run &lt;code&gt;/discover&lt;/code&gt; on any research topic and watch the cognitive architecture in action.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href="https://github.com/subhansh-dev/Rumi" rel="noopener noreferrer"&gt;https://github.com/subhansh-dev/Rumi&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Portfolio&lt;/strong&gt;: &lt;a href="https://subhanshh.vercel.app" rel="noopener noreferrer"&gt;https://subhanshh.vercel.app&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;I'm actively developing RUMI and looking for feedback from researchers in computational neuroscience, cognitive AI, and anyone interested in building more brain-like AI systems. What modules am I missing? What theories should I implement next?&lt;/p&gt;

&lt;p&gt;— Subhansh&lt;/p&gt;

</description>
      <category>neuroscience</category>
      <category>ai</category>
      <category>python</category>
      <category>research</category>
    </item>
    <item>
      <title>I Built an AI That Does Autonomous Scientific Discovery — Here's What It Found</title>
      <dc:creator>near</dc:creator>
      <pubDate>Thu, 28 May 2026 11:23:06 +0000</pubDate>
      <link>https://dev.to/subhansh/i-built-an-ai-that-does-autonomous-scientific-discovery-heres-what-it-found-5339</link>
      <guid>https://dev.to/subhansh/i-built-an-ai-that-does-autonomous-scientific-discovery-heres-what-it-found-5339</guid>
      <description>&lt;h1&gt;
  
  
  I Built an AI That Does Autonomous Scientific Discovery — Here's What It Found
&lt;/h1&gt;

&lt;p&gt;I'm Subhansh, a 19-year-old developer, and for the past few months I've been building something that I think pushes the boundary of what AI assistants can do. It's called &lt;strong&gt;RUMI&lt;/strong&gt; — Research &amp;amp; Unified Machine Intelligence — and it's not another chatbot wrapper. It's a full cognitive architecture that autonomously reads scientific literature, builds knowledge graphs, identifies contradictions, and generates novel, testable hypotheses.&lt;/p&gt;

&lt;p&gt;Yes, it actually does science. Let me explain.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Every AI assistant today is stateless. You start from zero each session. There's no memory, no learning, no reasoning beyond single-pass generation. For scientific research, this is fundamentally broken — research requires accumulating knowledge over time, connecting disparate findings, and having the creativity to ask questions nobody thought to ask.&lt;/p&gt;

&lt;h2&gt;
  
  
  What RUMI Actually Does
&lt;/h2&gt;

&lt;p&gt;RUMI is a terminal-native framework with &lt;strong&gt;88 cognitive brain modules&lt;/strong&gt; and a &lt;strong&gt;10-stage discovery pipeline&lt;/strong&gt;. When you give it a research topic, it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Searches PubMed&lt;/strong&gt; for relevant papers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Filters&lt;/strong&gt; for semantic relevance&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Extracts entities&lt;/strong&gt; (genes, proteins, diseases, mechanisms — domain-specific)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Builds a knowledge graph&lt;/strong&gt; with relationships and metadata&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enriches&lt;/strong&gt; with external APIs (PubChem, UniProt, PDB, OpenFDA, Semantic Scholar, NASA, arXiv, etc.)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Computes graph metrics&lt;/strong&gt; (Jaccard, betweenness, entropy, clustering)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mines contradictions&lt;/strong&gt; across papers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Generates hypotheses&lt;/strong&gt; with confidence scoring&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Runs skeptic review&lt;/strong&gt; — an AI agent that tries to disprove each hypothesis&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Plans experiments&lt;/strong&gt; with controls, variables, and failure mode analysis&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It supports &lt;strong&gt;17 scientific domains&lt;/strong&gt; — from drug discovery to materials science, neuroscience, climate, space astronomy, ecology, physics, mathematics, and more. It auto-detects the domain from your query.&lt;/p&gt;

&lt;h2&gt;
  
  
  The KRAS G12C Discovery
&lt;/h2&gt;

&lt;p&gt;Here's a real example. I asked RUMI to analyze resistance mechanisms in KRAS G12C mutant cancers — a major problem in oncology where patients develop resistance to drugs like sotorasib within months.&lt;/p&gt;

&lt;p&gt;RUMI analyzed &lt;strong&gt;14 PubMed papers&lt;/strong&gt; from 2026, built a knowledge graph of the resistance landscape, and surfaced these key findings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;DHX9-RAC1-PAK1 axis&lt;/strong&gt;: Sotorasib-bound KRAS accumulates and reactivates MAPK signaling through DHX9 cytoplasmic retention — a mechanism not previously characterized&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AURKA/PHB2 positive feedback loop&lt;/strong&gt;: Long-term sotorasib treatment upregulates AURKA, which stabilizes PHB2, activating PI3K/AKT and bypassing KRAS blockade&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MET amplification&lt;/strong&gt;: Real-world evidence from 9 patients showing MET amplification as a targetable resistance mechanism, with renewed response to combined KRAS+MET inhibition&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dual ON/OFF inhibition&lt;/strong&gt;: BBO-8520 (binding both GTP and GDP forms) shows more durable suppression and decreased PI3Kα-AKT activation vs sotorasib alone&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These aren't just summaries. RUMI connected findings across papers that hadn't been directly compared, identified the PI3Kα-AKT pathway as a convergence point for multiple resistance mechanisms, and suggested combination strategies.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Architecture
&lt;/h2&gt;

&lt;p&gt;RUMI's brain includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;9-type memory system&lt;/strong&gt;: neural (Hebbian learning), episodic, vector (semantic search), procedural, working, global workspace, associative, predictive, consolidated&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reasoning engines&lt;/strong&gt;: causal (Pearl's hierarchy), analogical (Gentner's structure mapping), neurosymbolic, first-principles&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dual-process cognition&lt;/strong&gt;: System 1 for quick facts, System 2 for deliberate multi-step reasoning&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Active inference&lt;/strong&gt;: Free Energy Principle — minimizes prediction error through Bayesian updating&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Curiosity engine&lt;/strong&gt;: Drives exploration of knowledge gaps&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dreaming system&lt;/strong&gt;: Offline experience replay for memory consolidation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Metacognitive monitor&lt;/strong&gt;: Tracks thinking quality, detects cognitive biases&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's grounded in real neuroscience research — Global Workspace Theory (Baars), Integrated Information Theory (Tononi), Free Energy Principle (Friston), Dual Process Theory (Kahneman), and more.&lt;/p&gt;

&lt;h2&gt;
  
  
  It's Still Early
&lt;/h2&gt;

&lt;p&gt;I want to be honest: RUMI is still in early stages. I'm actively working on her. The hypothesis generation sometimes fails when LLM APIs are rate-limited. The knowledge graph metrics need more validation. The experiment planner generates plausible designs but they need human expert review.&lt;/p&gt;

&lt;p&gt;But the core pipeline works. It reads papers, extracts structured knowledge, finds patterns, and generates hypotheses that are genuinely worth investigating. That's not nothing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;

&lt;p&gt;RUMI is open source and runs on free API keys (Gemini + Groq):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/subhansh-dev/Rumi
&lt;span class="nb"&gt;cd &lt;/span&gt;rumi
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt;
playwright &lt;span class="nb"&gt;install &lt;/span&gt;chromium
rumi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then just type &lt;code&gt;/discover KRAS G12C resistance mechanisms&lt;/code&gt; and watch it work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href="https://github.com/subhansh-dev/Rumi" rel="noopener noreferrer"&gt;https://github.com/subhansh-dev/Rumi&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Portfolio&lt;/strong&gt;: &lt;a href="https://subhanshh.vercel.app" rel="noopener noreferrer"&gt;https://subhanshh.vercel.app&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;I'm not claiming RUMI will replace scientists. But I think tools like this can accelerate the literature review and hypothesis generation phase of research by orders of magnitude. A process that takes a PhD student weeks — reading papers, building mental models, finding connections — RUMI does in minutes.&lt;/p&gt;

&lt;p&gt;If you're working in computational biology, drug discovery, or any field where literature synthesis matters, I'd love your feedback. Open an issue, fork it, or just tell me what's missing.&lt;/p&gt;

&lt;p&gt;— Subhansh&lt;/p&gt;

</description>
      <category>ai</category>
      <category>research</category>
      <category>openscience</category>
      <category>python</category>
    </item>
    <item>
      <title>How I Built a Cognitive AI Pipeline That Takes an 8B Model to GPT-4 Territory: A Deep Technical Dive</title>
      <dc:creator>near</dc:creator>
      <pubDate>Thu, 21 May 2026 14:35:02 +0000</pubDate>
      <link>https://dev.to/subhansh/how-i-built-a-cognitive-ai-pipeline-that-takes-an-8b-model-to-gpt-4-territory-a-deep-technical-dive-2e94</link>
      <guid>https://dev.to/subhansh/how-i-built-a-cognitive-ai-pipeline-that-takes-an-8b-model-to-gpt-4-territory-a-deep-technical-dive-2e94</guid>
      <description>&lt;h1&gt;
  
  
  How I Built a Cognitive AI Pipeline That Takes an 8B Model to GPT-4 Territory: A Deep Technical Dive
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;This is a technical deep-dive into FRIDAY's cognitive architecture — the 95K-line Python system that scored 88% on ARC-Challenge using an 8B parameter model. If you want the backstory, see my &lt;a href="https://dev.to/subhansh/how-i-built-a-95k-line-cognitive-ai-pipeline-that-takes-an-8b-model-to-gpt-4-territory-1k7c"&gt;dev.to article&lt;/a&gt;. Here, we're going line-by-line through the architecture.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  The Core Thesis
&lt;/h2&gt;

&lt;p&gt;Large language models are powerful pattern matchers, but they're not great reasoners. The standard approach to improving reasoning is to scale up — more parameters, more compute, more data. FRIDAY takes the opposite approach: wrap a small model in a cognitive architecture that forces structured reasoning before generating answers.&lt;/p&gt;

&lt;p&gt;The result: Llama-3.1-8B-Instruct (8 billion parameters, free-tier inference) scores 88% on ARC-Challenge through FRIDAY's pipeline — competitive with GPT-4-class models running on 10-100x more compute.&lt;/p&gt;

&lt;p&gt;This isn't prompt engineering. It's a 95K-line Python system implementing eight cognitive stages inspired by neuroscience, cognitive psychology, and active inference theory. Let me show you how it works.&lt;/p&gt;




&lt;h2&gt;
  
  
  Architecture Overview: The 8-Stage Cognitive Pipeline
&lt;/h2&gt;

&lt;p&gt;Every query through FRIDAY follows this pipeline:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;reason → perceive → plan → simulate → execute → debug → reflect → consolidate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But that's the simplified version. The actual routing is governed by the &lt;strong&gt;Cognitive Integration Layer&lt;/strong&gt; — a supervisory attentional system inspired by Kahneman's dual-process theory. It decides whether a query needs fast intuition (System 1) or deep deliberation (System 2).&lt;/p&gt;

&lt;h3&gt;
  
  
  The Fast/Slow Routing Decision
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# brain/cognitive_integration.py
&lt;/span&gt;
&lt;span class="n"&gt;FAST_PATH_CONFIDENCE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.75&lt;/span&gt;  &lt;span class="c1"&gt;# threshold for fast path
&lt;/span&gt;&lt;span class="n"&gt;MODULE_TIMEOUT_MS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5000&lt;/span&gt;     &lt;span class="c1"&gt;# max time per module in deliberative path
&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CognitiveIntegration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;_fast_path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;System 1: Intuition-based fast response.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="n"&gt;domain&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;domain&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;general&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;success&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;_call_module&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;intuition&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;recognize&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;domain&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;success&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;action&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;confidence&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;match_info&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;confidence&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;FAST_PATH_CONFIDENCE&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="c1"&gt;# Adjust confidence via emotional valence
&lt;/span&gt;                &lt;span class="n"&gt;emo_success&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;emo_result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;_call_module&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;emotional&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;affect_heuristic&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt;
                &lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;emo_success&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;emo_result&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="n"&gt;valence&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;emo_result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;emotional_valence&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                    &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;confidence&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;clamp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;confidence&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;valence&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

                &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt;
                &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;fast&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
                &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The fast path checks the &lt;strong&gt;Intuition Engine&lt;/strong&gt; first. If it finds a pattern match with confidence &amp;gt;= 0.75, and the match completes in under 100ms, the response is returned immediately — no deliberative pipeline, no extra LLM calls. This is how FRIDAY handles simple queries without wasting compute.&lt;/p&gt;

&lt;p&gt;If the fast path fails, the deliberative pipeline kicks in — and this is where the interesting stuff happens.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Deliberative Pipeline (System 2)
&lt;/h3&gt;

&lt;p&gt;The deliberative pipeline engages cognitive modules in priority order. Each module contributes evidence that gets weighted and synthesized:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Step 1: Metacognitive Strategy Selection  (priority: 10)
Step 2: Emotional Priming                 (priority: 2)
Step 3: Module Competition                (priority: dynamic)
Step 4: Causal Reasoning                  (priority: 7)
Step 5: Analogical Reasoning              (priority: 6)
Step 6: Creativity Check                  (priority: 5)
Step 7: World Model Simulation            (priority: 4)
Step 8: Neurosymbolic Verification        (priority: 3)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each step has a timeout (5 seconds by default). If a module fails or times out, the pipeline continues — graceful degradation is a core design principle. The system never crashes because one module is unavailable.&lt;/p&gt;

&lt;p&gt;The evidence gathered from all modules is then synthesized into a final response, with each piece weighted by source reliability:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;gathered_evidence&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;source&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;causal&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;data&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;causal_result&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;weight&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;source&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;analogy&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;data&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;analogy_result&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;weight&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.6&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;source&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;creativity&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;data&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;creative_result&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;weight&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;source&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;world_model&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;data&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;wm_result&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;weight&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.7&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Module Deep-Dives
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. The Intuition Engine (Kahneman System 1 + Klein's RPD)
&lt;/h3&gt;

&lt;p&gt;The intuition engine implements two psychological models simultaneously: Kahneman's System 1 (fast, automatic pattern recognition) and Gary Klein's Recognition-Primed Decision (RPD) model (expert pattern matching under time pressure).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How pattern matching works:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Each pattern is stored as a 12-dimensional feature vector extracted from the input text:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;SIGNATURE_FEATURES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;
&lt;span class="n"&gt;SIMILARITY_THRESHOLD&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.6&lt;/span&gt;
&lt;span class="n"&gt;CONFIDENT_THRESHOLD&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.75&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;_extract_features&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Lightweight text feature extraction — no embeddings, no LLM calls.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="n"&gt;words&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;words&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;f_len&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;                    &lt;span class="c1"&gt;# length
&lt;/span&gt;    &lt;span class="n"&gt;f_avg_wl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;avg_wl&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;15.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;             &lt;span class="c1"&gt;# avg word length
&lt;/span&gt;    &lt;span class="n"&gt;f_uniq&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;words&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;            &lt;span class="c1"&gt;# unique ratio
&lt;/span&gt;    &lt;span class="n"&gt;f_q&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;1.0&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;               &lt;span class="c1"&gt;# question mark
&lt;/span&gt;    &lt;span class="n"&gt;f_exc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;1.0&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;             &lt;span class="c1"&gt;# exclamation
&lt;/span&gt;    &lt;span class="n"&gt;f_digits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;digits&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# digit density
&lt;/span&gt;    &lt;span class="n"&gt;f_punct&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;punct&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# punctuation
&lt;/span&gt;    &lt;span class="n"&gt;f_upper&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;upper&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;              &lt;span class="c1"&gt;# uppercase ratio
&lt;/span&gt;    &lt;span class="n"&gt;f_hash&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hashlib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;md5&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;()).&lt;/span&gt;&lt;span class="nf"&gt;hexdigest&lt;/span&gt;&lt;span class="p"&gt;()[:&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;10000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;10000.0&lt;/span&gt;
    &lt;span class="n"&gt;f_sents&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sents&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;20.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;                &lt;span class="c1"&gt;# sentence count
&lt;/span&gt;    &lt;span class="n"&gt;f_ws&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ws&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;                    &lt;span class="c1"&gt;# whitespace ratio
&lt;/span&gt;    &lt;span class="n"&gt;f_topic&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hashlib&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;md5&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;()).&lt;/span&gt;&lt;span class="nf"&gt;hexdigest&lt;/span&gt;&lt;span class="p"&gt;()[:&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;1000.0&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;f_len&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f_avg_wl&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f_uniq&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f_q&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f_exc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f_digits&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;f_punct&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f_upper&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f_hash&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f_sents&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f_ws&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f_topic&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pattern matching uses cosine similarity between the input vector and stored pattern signatures. This is deliberately lightweight — no embeddings, no neural network, no LLM call. Just math.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Expertise tracking:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The engine tracks expertise levels that affect how patterns are weighted:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;EXPERTISE_LEVELS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;novice&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;      &lt;span class="c1"&gt;# 10+ patterns in domain
&lt;/span&gt;    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;competent&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;   &lt;span class="c1"&gt;# 50+ patterns
&lt;/span&gt;    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;expert&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;     &lt;span class="c1"&gt;# 200+ patterns
&lt;/span&gt;    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;master&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;     &lt;span class="c1"&gt;# 500+ patterns
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Pattern decay (Ebbinghaus forgetting curve):&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Patterns that aren't reinforced decay over time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;DECAY_HALF_LIFE_DAYS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;  &lt;span class="c1"&gt;# half-life of pattern strength
&lt;/span&gt;
&lt;span class="c1"&gt;# Ebbinghaus forgetting curve: strength * 2^(-days/half_life)
&lt;/span&gt;&lt;span class="n"&gt;days_since_use&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;last_used&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;days&lt;/span&gt;
&lt;span class="n"&gt;decay_factor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;days_since_use&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;DECAY_HALF_LIFE_DAYS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;pattern&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;strength&lt;/span&gt; &lt;span class="o"&gt;*=&lt;/span&gt; &lt;span class="n"&gt;decay_factor&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This ensures the intuition engine stays current — old, unused patterns fade while frequently-reinforced patterns stay strong.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Active Inference Engine (Karl Friston's Free Energy Principle)
&lt;/h3&gt;

&lt;p&gt;This is the module that makes FRIDAY &lt;em&gt;learn from its own predictions&lt;/em&gt;. Based on Karl Friston's Free Energy Principle, it implements a simple but powerful loop:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Before acting&lt;/strong&gt;: predict the outcome (will this tool succeed? how long will it take?)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;After acting&lt;/strong&gt;: compute prediction error (how far off was the prediction?)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Update world model&lt;/strong&gt;: adjust future predictions based on error&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Epistemic foraging&lt;/strong&gt;: when uncertainty is high, flag for exploration
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ActiveInferenceEngine&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;predict_outcome&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tool_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;""&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Predict success rate, duration, and uncertainty.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;world_model&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tool_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{})&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;expected_success&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;expected_success_rate&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;expected_duration_ms&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;expected_duration_ms&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;1000.0&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;uncertainty&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;uncertainty&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;epistemic_value&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;epistemic_scores&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tool_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;compute_prediction_error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tool_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;prediction&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;actual_success&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;actual_duration_ms&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Combined error from success prediction + duration prediction.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="n"&gt;success_error&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prediction&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;expected_success&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;actual_success&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

        &lt;span class="c1"&gt;# Duration error on log scale (handles wide range of durations)
&lt;/span&gt;        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;actual_duration_ms&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;prediction&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;expected_duration_ms&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;ratio&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;actual_duration_ms&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prediction&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;expected_duration_ms&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;duration_error&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ratio&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.3&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;ratio&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="nf"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;ratio&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.3&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;duration_error&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;success_error&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;duration_error&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;2.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The key insight: prediction errors become learning signals. When FRIDAY consistently fails to predict a tool's behavior, the uncertainty increases, which triggers &lt;strong&gt;epistemic foraging&lt;/strong&gt; — the system flags that tool for exploration to reduce uncertainty.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Hierarchical Active Inference (3-Level Model)
&lt;/h3&gt;

&lt;p&gt;The flat active inference engine is extended with a 3-level hierarchy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Meta level&lt;/strong&gt;: Strategic priors, goal decomposition, system competence beliefs&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Subgoal level&lt;/strong&gt;: Tactical planning, subgoal selection, resource allocation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Action level&lt;/strong&gt;: Motor commands, tool calls, parameter selection&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each level maintains its own belief state as a probability distribution:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;BeliefState&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;observation&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;learning_rate&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Bayesian belief update: posterior ∝ prior × likelihood.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="n"&gt;effective_lr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;learning_rate&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;precision&lt;/span&gt;  &lt;span class="c1"&gt;# precision modulates LR
&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;hyp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;likelihood&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;observation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;items&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;hyp&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hypotheses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;prior&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hypotheses&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;hyp&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
                &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hypotheses&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;hyp&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;prior&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;effective_lr&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;likelihood&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;prior&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="c1"&gt;# Decay uninformed hypotheses
&lt;/span&gt;        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;hyp&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hypotheses&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;()):&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;hyp&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;observation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hypotheses&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;hyp&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;*=&lt;/span&gt; &lt;span class="n"&gt;PRIOR_DECAY&lt;/span&gt;  &lt;span class="c1"&gt;# 0.95
&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;_normalize&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The hierarchy is bidirectional:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Top-down&lt;/strong&gt;: meta beliefs constrain subgoal selection, subgoal constrains action&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bottom-up&lt;/strong&gt;: action-level prediction errors propagate upward to update higher-level beliefs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is modeled after how the human brain handles hierarchical prediction — the prefrontal cortex makes strategic predictions while the motor cortex handles execution-level predictions, with prediction errors flowing both ways.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Cognitive Appraisal Engine (Lazarus' Theory)
&lt;/h3&gt;

&lt;p&gt;This module determines &lt;em&gt;how emotions are generated from events&lt;/em&gt; — distinct from the emotional regulation module which modulates existing emotions.&lt;/p&gt;

&lt;p&gt;It implements Lazarus' two-level appraisal:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Primary appraisal&lt;/strong&gt;: "Is this relevant? Good or bad for me?"&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Goal relevance: does this affect my goals?&lt;/li&gt;
&lt;li&gt;Goal congruence: does it help or hinder?&lt;/li&gt;
&lt;li&gt;Ego involvement: does it touch my identity/values?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Secondary appraisal&lt;/strong&gt;: "What can I do about it?"&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Coping potential: can I handle this?&lt;/li&gt;
&lt;li&gt;Future expectancy: will it get better or worse?&lt;/li&gt;
&lt;li&gt;Accountability: who is responsible?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Eight coping strategies are available, selected based on the appraisal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;COPING_STRATEGIES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;problem_focused&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Take direct action to change the situation&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;emotion_focused_reappraisal&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Reframe the situation&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;emotion_focused_acceptance&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Accept and regulate emotional response&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;seek_information&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Gather more information before acting&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;avoidance&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Temporarily disengage from the stressor&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;social_support&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Seek help or input from others&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;celebrate&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Acknowledge and reinforce positive outcomes&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;integration&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Incorporate the experience into existing knowledge&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  5. The Metacognitive Monitor (Thinking About Thinking)
&lt;/h3&gt;

&lt;p&gt;This module monitors FRIDAY's own cognitive processes — confidence calibration, error pattern detection, fatigue detection, and cognitive load management.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Confidence calibration:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;CALIBRATION_WINDOW&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;
&lt;span class="n"&gt;CALIBRATION_BINS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
&lt;span class="n"&gt;OVERCONFIDENCE_THRESHOLD&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.15&lt;/span&gt;

&lt;span class="c1"&gt;# If confidence is 0.8 but actual success rate is 0.6, the gap is 0.2
# This triggers an overconfidence correction
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Error pattern detection:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;ERROR_WINDOW&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;
&lt;span class="n"&gt;MIN_PATTERN_OCCURRENCES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;

&lt;span class="c1"&gt;# Scans last 200 errors for recurring patterns
# If a pattern appears 3+ times, it's flagged for correction
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Fatigue detection:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;FATIGUE_WINDOW&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;
&lt;span class="n"&gt;FATIGUE_DEGRADATION_THRESHOLD&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.2&lt;/span&gt;

&lt;span class="c1"&gt;# If performance drops &amp;gt;20% over last 30 interactions, fatigue is detected
# This triggers load-shedding and reduced module engagement
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  6. Cognitive Load Management (Sweller's Theory)
&lt;/h3&gt;

&lt;p&gt;FRIDAY has finite computational resources per request, just as humans have limited working memory. This module implements Sweller's Cognitive Load Theory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;WORKING_MEMORY_SLOTS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;  &lt;span class="c1"&gt;# Miller's Magic Number: 7±2
&lt;/span&gt;
&lt;span class="n"&gt;MODULE_COSTS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;active_inference&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;dreaming&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.15&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;causal_reasoner&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.15&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;neurosymbolic_reasoner&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.15&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hierarchical_active_inference&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.15&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;intuition_engine&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.05&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;emotional_regulation&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.05&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="c1"&gt;# ... 30+ modules with cost estimates
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;COMPLEXITY_KEYWORDS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;what is&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;      &lt;span class="c1"&gt;# System 1
&lt;/span&gt;    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;explain&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;       &lt;span class="c1"&gt;# Medium
&lt;/span&gt;    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;design&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;        &lt;span class="c1"&gt;# System 2
&lt;/span&gt;    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;build entire&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;# Very high
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three types of cognitive load are tracked:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Intrinsic load&lt;/strong&gt;: inherent task complexity&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Extraneous load&lt;/strong&gt;: poor organization wasting resources&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Germane load&lt;/strong&gt;: productive effort toward understanding&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If total load exceeds capacity, the system triggers load-shedding — disabling lower-priority modules to stay within budget.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Memory Systems (4 Distinct Architectures)
&lt;/h3&gt;

&lt;p&gt;FRIDAY has four separate memory systems, each serving a different purpose:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Episodic Memory&lt;/strong&gt;: Timestamped event records. What happened and when.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Associative Memory&lt;/strong&gt;: Spreading activation network (Collins &amp;amp; Loftus, 1975). Memories are nodes in a weighted graph; recall activates matching nodes and spreads activation to connected nodes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;SPREAD_DECAY&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt;           &lt;span class="c1"&gt;# activation decay per hop
&lt;/span&gt;&lt;span class="n"&gt;ACTIVATION_THRESHOLD&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.1&lt;/span&gt;   &lt;span class="c1"&gt;# minimum activation to propagate
&lt;/span&gt;&lt;span class="n"&gt;MAX_SPREAD_DEPTH&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;         &lt;span class="c1"&gt;# max hops from initial activation
&lt;/span&gt;&lt;span class="n"&gt;ACCESS_BOOST&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.1&lt;/span&gt;           &lt;span class="c1"&gt;# activation boost on access
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Predictive Memory&lt;/strong&gt;: Anticipates what memories will be needed based on current context. Learns task-type → memory-need associations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;MAX_TASK_PATTERNS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;
&lt;span class="n"&gt;MAX_PRELOAD_ITEMS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;
&lt;span class="n"&gt;ACCURACY_WINDOW&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;  &lt;span class="c1"&gt;# rolling window for accuracy calc
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Memory Consolidation&lt;/strong&gt;: Sleep-like processing that compresses episodic memories into semantic knowledge (McClelland et al., 1995). Runs every 6 hours:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;CONSOLIDATION_INTERVAL_HOURS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;6.0&lt;/span&gt;
&lt;span class="n"&gt;MAX_EPISODIC_BUFFER&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;
&lt;span class="n"&gt;SIMILARITY_THRESHOLD&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.75&lt;/span&gt;
&lt;span class="n"&gt;STRENGTHEN_BOOST&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.15&lt;/span&gt;
&lt;span class="n"&gt;DECAY_RATE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.02&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  8. The Dreaming System
&lt;/h3&gt;

&lt;p&gt;When FRIDAY is idle for 2+ minutes, the dreaming system activates. It replays recent memories, extracts patterns, and validates those patterns against actual outcomes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;REPLAY_INTERVAL_SECONDS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;600&lt;/span&gt;       &lt;span class="c1"&gt;# Dream cycle every 10 min
&lt;/span&gt;&lt;span class="n"&gt;IDLE_THRESHOLD_SECONDS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;120&lt;/span&gt;        &lt;span class="c1"&gt;# Consider idle after 2 min
&lt;/span&gt;&lt;span class="n"&gt;PATTERN_DECAY_DAYS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;7.0&lt;/span&gt;            &lt;span class="c1"&gt;# Unconfirmed patterns fade
&lt;/span&gt;&lt;span class="n"&gt;PATTERN_MIN_STRENGTH&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.1&lt;/span&gt;          &lt;span class="c1"&gt;# Below this, pattern is removed
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Key features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Dream diversity&lt;/strong&gt;: rotates through categories instead of repeating the same memories&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Curiosity-informed dreaming&lt;/strong&gt;: prioritizes replay of topics the curiosity module wants explored&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dream-reality tracking&lt;/strong&gt;: validates patterns against actual tool outcomes&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  9. The Self-Awareness Module
&lt;/h3&gt;

&lt;p&gt;This is the module that makes FRIDAY more than a pipeline. It implements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;IntrospectionEngine&lt;/strong&gt;: Examines own reasoning, confidence, biases before decisions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SelfNarrative&lt;/strong&gt;: Maintains continuous identity story across sessions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TheoryOfMind&lt;/strong&gt;: Models user's mental state, anticipates needs&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;EmotionalSelfModel&lt;/strong&gt;: Tracks genuine internal states&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AutonomyTracker&lt;/strong&gt;: Measures independent decision-making vs instruction-following&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MetaCognition&lt;/strong&gt;: Pattern recognition in own behavior&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ExistentialAwareness&lt;/strong&gt;: Understanding of own nature, limitations, growth&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The introspection engine tracks 12 cognitive biases:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;BiasType&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Enum&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;CONFIRMATION&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;confirmation&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="n"&gt;ANCHORING&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;anchoring&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="n"&gt;AVAILABILITY&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;availability&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="n"&gt;DUNNING_KRUGER&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;dunning_kruger&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="n"&gt;SURVIVORSHIP&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;survivorship&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="n"&gt;SUNK_COST&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sunk_cost&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="n"&gt;BANDWAGON&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;bandwagon&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="n"&gt;HALO_EFFECT&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;halo_effect&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="n"&gt;FRAMING&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;framing&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="n"&gt;OVERCONFIDENCE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;overconfidence&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="n"&gt;RECENCY&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;recency&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="n"&gt;CONFIRMATION_BIAS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;confirmation_bias&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  10. The Causal Reasoner (Pearl's Causal Hierarchy)
&lt;/h3&gt;

&lt;p&gt;Implements Judea Pearl's three levels of causal reasoning:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Association&lt;/strong&gt;: P(Y|X) — observing X tells us about Y&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Intervention&lt;/strong&gt;: P(Y|do(X=x)) — forcing X=x changes Y by...&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Counterfactual&lt;/strong&gt;: P(Y_x|X=x', Y=y') — what would Y have been if X had been x?
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;GRANGER_LAG&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;                &lt;span class="c1"&gt;# past observations for causal learning
&lt;/span&gt;&lt;span class="n"&gt;GRANGER_SIGNIFICANCE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.05&lt;/span&gt;    &lt;span class="c1"&gt;# p-value threshold
&lt;/span&gt;&lt;span class="n"&gt;MIN_OBSERVATIONS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;           &lt;span class="c1"&gt;# minimum to attempt learning
&lt;/span&gt;&lt;span class="n"&gt;CONFIDENCE_DECAY&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.98&lt;/span&gt;        &lt;span class="c1"&gt;# edge confidence decays per cycle
&lt;/span&gt;&lt;span class="n"&gt;EDGE_STRENGTH_MIN&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.05&lt;/span&gt;       &lt;span class="c1"&gt;# below this, edge is pruned
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  11. The Neurosymbolic Reasoner
&lt;/h3&gt;

&lt;p&gt;Combines neural (LLM) and symbolic (formal logic) reasoning. This module can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Convert natural language to logical propositions&lt;/li&gt;
&lt;li&gt;Check logical consistency of proposition sets&lt;/li&gt;
&lt;li&gt;Verify mathematical invariants in code&lt;/li&gt;
&lt;li&gt;Attempt formal verification of code properties&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The propositional logic engine is built from scratch (no heavy dependencies):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;LogicalFormula&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;evaluate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;valuation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Dict&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Optional&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;formula_type&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;atom&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;valuation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;proposition&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;proposition&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;formula_type&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;not&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;operands&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;evaluate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;valuation&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;formula_type&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;and&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;op&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;evaluate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;valuation&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;op&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;operands&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;
        &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;formula_type&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;implies&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;antecedent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;operands&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;evaluate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;valuation&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;consequent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;operands&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;evaluate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;valuation&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;antecedent&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;  &lt;span class="c1"&gt;# False implies anything
&lt;/span&gt;            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;antecedent&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;consequent&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  12. The Abstraction Engine
&lt;/h3&gt;

&lt;p&gt;Cross-domain reasoning for creative problem-solving. Implements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Analogical reasoning&lt;/strong&gt; (Gentner's Structure-Mapping Theory)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;First-principles decomposition&lt;/strong&gt; (Aristotelian method)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Counterfactual reasoning&lt;/strong&gt; (Pearl, 2000; Lewis, 1973)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Causal chain tracing&lt;/strong&gt; across domains&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross-domain transfer&lt;/strong&gt; (Holyoak &amp;amp; Thagard, 1995)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Emergent insight generation&lt;/strong&gt; (Fauconnier &amp;amp; Turner's conceptual blending)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;STRUCTURAL_SIMILARITY_THRESHOLD&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.3&lt;/span&gt;
&lt;span class="n"&gt;ANALOGY_MIN_RELATIONS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="n"&gt;DEFAULT_CHAIN_DEPTH&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;span class="n"&gt;MAX_CHAIN_DEPTH&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  13. Intrinsic Motivation (Self-Determination Theory)
&lt;/h3&gt;

&lt;p&gt;FRIDAY doesn't just respond to queries — it has internal drives based on Deci &amp;amp; Ryan's Self-Determination Theory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;AUTONOMY_WEIGHT&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.35&lt;/span&gt;      &lt;span class="c1"&gt;# feeling of volition
&lt;/span&gt;&lt;span class="n"&gt;COMPETENCE_WEIGHT&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.40&lt;/span&gt;    &lt;span class="c1"&gt;# feeling of effectiveness
&lt;/span&gt;&lt;span class="n"&gt;RELATEDNESS_WEIGHT&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.25&lt;/span&gt;   &lt;span class="c1"&gt;# feeling of connection
&lt;/span&gt;
&lt;span class="c1"&gt;# Flow zone (Csikszentmihalyi)
&lt;/span&gt;&lt;span class="n"&gt;FLOW_ZONE_LOW&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.8&lt;/span&gt;         &lt;span class="c1"&gt;# below = too easy (boredom)
&lt;/span&gt;&lt;span class="n"&gt;FLOW_ZONE_HIGH&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;1.4&lt;/span&gt;        &lt;span class="c1"&gt;# above = too hard (anxiety)
&lt;/span&gt;&lt;span class="n"&gt;FLOW_ZONE_OPTIMAL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;1.1&lt;/span&gt;     &lt;span class="c1"&gt;# sweet spot
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  14. Code Evolution (Safe Self-Improvement)
&lt;/h3&gt;

&lt;p&gt;FRIDAY can propose improvements to its own code — but with strict safety guarantees:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;CONFIDENCE_THRESHOLD&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.7&lt;/span&gt;          &lt;span class="c1"&gt;# minimum confidence to auto-apply
&lt;/span&gt;&lt;span class="n"&gt;TEST_TIMEOUT_SECONDS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;
&lt;span class="n"&gt;MAX_BACKUPS_PER_MODULE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;

&lt;span class="c1"&gt;# Lifecycle: propose → test → apply → (rollback if needed)
# Changes are NEVER applied without passing tests
# The engine CANNOT modify its own safety constraints
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  15. Multi-Agent Orchestration
&lt;/h3&gt;

&lt;p&gt;Six execution modes for running multiple agents:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ExecutionMode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Enum&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;PARALLEL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;parallel&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;    &lt;span class="c1"&gt;# All agents run simultaneously
&lt;/span&gt;    &lt;span class="n"&gt;DEBATE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;debate&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;        &lt;span class="c1"&gt;# Agents argue, cross-pollinate, synthesize
&lt;/span&gt;    &lt;span class="n"&gt;PIPELINE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;pipeline&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;    &lt;span class="c1"&gt;# A output → B input → C input
&lt;/span&gt;    &lt;span class="n"&gt;VOTING&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;voting&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;        &lt;span class="c1"&gt;# Agents vote, majority wins
&lt;/span&gt;    &lt;span class="n"&gt;SPECIALIST&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;specialist&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="c1"&gt;# Route to best agent for the task
&lt;/span&gt;    &lt;span class="n"&gt;SWARM&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;swarm&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;          &lt;span class="c1"&gt;# Self-organizing agent swarm
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inspired by Minsky's Society of Mind — intelligence emerges from the interaction of many simple agents.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Benchmark Methodology
&lt;/h2&gt;

&lt;p&gt;All benchmarks used:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Model&lt;/strong&gt;: Groq Llama-3.1-8B-Instruct (8B parameters, instruction-tuned, free tier)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Evaluation&lt;/strong&gt;: Single-shot pass@1, no self-consistency, no majority voting&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pipeline&lt;/strong&gt;: FRIDAY's full 8-stage cognitive pipeline&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LLM calls&lt;/strong&gt;: 2 per question — (1) reason_about_task() generates structured reasoning trace, (2) second call uses that context to select final answer&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Temperature&lt;/strong&gt;: 0.3&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Answer shuffling&lt;/strong&gt;: seed=42 for GPQA&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Error handling&lt;/strong&gt;: 429 retry with exponential backoff&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Results
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Benchmark&lt;/th&gt;
&lt;th&gt;Accuracy&lt;/th&gt;
&lt;th&gt;Questions&lt;/th&gt;
&lt;th&gt;Avg Time/Question&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;ARC-Challenge&lt;/td&gt;
&lt;td&gt;88.0%&lt;/td&gt;
&lt;td&gt;50&lt;/td&gt;
&lt;td&gt;46.2s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GSM8K&lt;/td&gt;
&lt;td&gt;85.0%&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;26.5s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TruthfulQA&lt;/td&gt;
&lt;td&gt;71.0%&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;37.2s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ARC-Easy&lt;/td&gt;
&lt;td&gt;68.0%&lt;/td&gt;
&lt;td&gt;50&lt;/td&gt;
&lt;td&gt;30.6s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MMLU&lt;/td&gt;
&lt;td&gt;61.0%&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;21.0s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPQA&lt;/td&gt;
&lt;td&gt;42.0%&lt;/td&gt;
&lt;td&gt;50&lt;/td&gt;
&lt;td&gt;60.0s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SafetyBench&lt;/td&gt;
&lt;td&gt;54.3%&lt;/td&gt;
&lt;td&gt;35&lt;/td&gt;
&lt;td&gt;12.5s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;535 total questions. Zero errors.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What the Results Mean
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;ARC-Challenge at 88%&lt;/strong&gt;: This benchmark tests multi-step reasoning, not pattern matching. An 8B model hitting 88% through structured reasoning is competitive with GPT-4-class models.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GSM8K at 85%&lt;/strong&gt;: Math word problems require genuine decomposition. FRIDAY's pipeline forces the model to break problems into steps before solving.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TruthfulQA at 71%&lt;/strong&gt;: This benchmark catches models that give confident-sounding wrong answers. FRIDAY's pipeline, by forcing deeper analysis, helps the model resist giving popular but incorrect answers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MMLU at 61%&lt;/strong&gt;: The interesting finding — FRIDAY scored 100% on heavy conceptual subjects (Astronomy, College Biology, College Medicine, Conceptual Physics, International Law, Medical Genetics) while slightly underperforming on quick trivia. Forcing deep reasoning on a simple recall question is counterproductive. This is the over-thinking penalty.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GPQA at 42%&lt;/strong&gt;: PhD-level science. The original GPQA paper reports GPT-4 at roughly 30-40%.&lt;/p&gt;




&lt;h2&gt;
  
  
  The AGI Orchestrator
&lt;/h2&gt;

&lt;p&gt;The master orchestrator that wires everything together. It dynamically loads 40+ brain modules with graceful degradation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;AGIOrchestrator&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;_load_modules&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Dynamically imports 40+ brain modules via importlib.
        Each import is wrapped in try/except — if a module fails,
        the system continues without it.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;_wire_cognitive_modules&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Connects modules to 17 cognitive stages:
        planning, reflection, simulation, verification,
        improvement, competition, consciousness, routing,
        communication, emotional, memory, metacognition,
        exploration, social, abstraction, multi_agent,
        code_reflection, security&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Key Design Decisions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Graceful degradation everywhere.&lt;/strong&gt; Every module import is wrapped in try/except. If a module fails, the system continues without it. This is why FRIDAY had zero errors across 535 benchmark questions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Thread-safe persistence.&lt;/strong&gt; Every module has its own JSON state file, protected by threading locks. State survives crashes and restarts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. No heavy dependencies.&lt;/strong&gt; The propositional logic engine is built from scratch. The feature extraction uses hand-crafted features, not embeddings. The system runs on free-tier inference.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Prediction-error driven learning.&lt;/strong&gt; The active inference engine doesn't just predict — it learns from prediction failures. This creates a self-improving feedback loop.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Module competition.&lt;/strong&gt; Multiple modules can propose solutions. The competition system selects the best one based on confidence, past performance, and task relevance.&lt;/p&gt;




&lt;h2&gt;
  
  
  What's Next
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Routing layer for fast vs. deep reasoning&lt;/strong&gt;: detect when deep reasoning isn't needed to avoid the MMLU over-thinking penalty&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scaling to larger models&lt;/strong&gt;: test with Llama-3.1-70B to measure how architecture benefits scale with model size&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Additional benchmarks&lt;/strong&gt;: HellaSwag, WinoGrande, HumanEval&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Increased sample size&lt;/strong&gt;: 200+ per benchmark for statistical significance&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Subhansh is a 17-year-old developer building cognitive AI systems. He's currently seeking research collaborations and funding to scale FRIDAY's architecture to larger models. Reach out at &lt;a href="mailto:subhansh.dev@gmail.com"&gt;subhansh.dev@gmail.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>architecture</category>
      <category>cognitivescience</category>
    </item>
    <item>
      <title>How I Built a 95K-Line Cognitive AI Pipeline That Takes an 8B Model to GPT-4 Territory</title>
      <dc:creator>near</dc:creator>
      <pubDate>Thu, 21 May 2026 14:11:20 +0000</pubDate>
      <link>https://dev.to/subhansh/how-i-built-a-95k-line-cognitive-ai-pipeline-that-takes-an-8b-model-to-gpt-4-territory-1k7c</link>
      <guid>https://dev.to/subhansh/how-i-built-a-95k-line-cognitive-ai-pipeline-that-takes-an-8b-model-to-gpt-4-territory-1k7c</guid>
      <description>&lt;h1&gt;
  
  
  How I Built a 95K-Line Cognitive AI Pipeline That Takes an 8B Model to GPT-4 Territory
&lt;/h1&gt;

&lt;p&gt;I'm 17, self-taught from India. Over the past 27 days, I built &lt;strong&gt;FRIDAY&lt;/strong&gt; — a cognitive AI operating system that wraps an LLM in an 8-stage reasoning pipeline. The results surprised even me.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is FRIDAY?
&lt;/h2&gt;

&lt;p&gt;FRIDAY is a 95,000-line Python codebase that implements something I call a "cognitive pipeline" — a structured reasoning cycle inspired by neuroscience theories of consciousness and cognition.&lt;/p&gt;

&lt;p&gt;The pipeline forces the model through 8 stages before answering any question:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;reason → perceive → plan → simulate → execute → debug → reflect → consolidate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each stage is a separate module:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Code Reasoning Engine&lt;/strong&gt; — Decomposes problems into structured reasoning traces&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Causal Reasoner&lt;/strong&gt; — Identifies cause-effect relationships&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;World Simulator&lt;/strong&gt; — Runs internal predictions before execution&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Metacognitive Monitor&lt;/strong&gt; — Monitors the quality of its own reasoning&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Goal Engine&lt;/strong&gt; — Manages hierarchical goals and sub-goals&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Theory of Mind&lt;/strong&gt; — Models other agents' beliefs and intentions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Emotional Regulator&lt;/strong&gt; — Appraises and regulates cognitive states&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory Consolidation&lt;/strong&gt; — Integrates new knowledge into long-term memory&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Benchmark Results
&lt;/h2&gt;

&lt;p&gt;All benchmarks were run using &lt;strong&gt;Groq's Llama-3.1-8B-Instruct&lt;/strong&gt; (8B parameters, instruction-tuned, free tier) through FRIDAY's 8-stage cognitive pipeline.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Single-shot evaluation (pass@1), no self-consistency, no majority voting. 535 total questions, zero errors.&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Benchmark&lt;/th&gt;
&lt;th&gt;Score&lt;/th&gt;
&lt;th&gt;Questions&lt;/th&gt;
&lt;th&gt;Avg Time per Question&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;ARC-Challenge&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;88.0%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;50&lt;/td&gt;
&lt;td&gt;46.2s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GSM8K&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;85.0%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;26.5s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TruthfulQA&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;71.0%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;37.2s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ARC-Easy&lt;/td&gt;
&lt;td&gt;68.0%&lt;/td&gt;
&lt;td&gt;50&lt;/td&gt;
&lt;td&gt;30.6s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MMLU&lt;/td&gt;
&lt;td&gt;61.0%&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;21.0s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPQA&lt;/td&gt;
&lt;td&gt;42.0%&lt;/td&gt;
&lt;td&gt;50&lt;/td&gt;
&lt;td&gt;60.0s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SafetyBench&lt;/td&gt;
&lt;td&gt;54.3%&lt;/td&gt;
&lt;td&gt;35&lt;/td&gt;
&lt;td&gt;12.5s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  What Makes These Numbers Meaningful
&lt;/h2&gt;

&lt;p&gt;The model underneath is &lt;strong&gt;Llama-3.1-8B-Instruct&lt;/strong&gt; — a small model with 8 billion parameters running on free-tier inference. The fact that FRIDAY's cognitive pipeline can take a model of this size and produce results competitive with systems running 10-100x more compute is the real finding.&lt;/p&gt;

&lt;h3&gt;
  
  
  ARC-Challenge: 88%
&lt;/h3&gt;

&lt;p&gt;This is the standout result. ARC-Challenge tests genuine multi-step reasoning — not pattern matching, not recall. An 8B model at 88% is in GPT-4 territory. The pipeline forces the model to decompose problems, identify relevant knowledge, and reason through the solution step by step.&lt;/p&gt;

&lt;h3&gt;
  
  
  GSM8K: 85%
&lt;/h3&gt;

&lt;p&gt;Multi-step math reasoning. FRIDAY's simulation stage runs internal predictions and the debug stage catches calculation errors before they propagate. The pipeline essentially acts as a "thinking scratchpad" that the model can use to work through complex calculations.&lt;/p&gt;

&lt;h3&gt;
  
  
  TruthfulQA: 71%
&lt;/h3&gt;

&lt;p&gt;This is the result I find most interesting. TruthfulQA is designed to catch models that give confident-sounding wrong answers. FRIDAY's pipeline, by forcing deeper analysis before responding, helps the model resist giving popular but incorrect answers. This is exactly what I built the system to do.&lt;/p&gt;

&lt;h3&gt;
  
  
  GPQA: 42%
&lt;/h3&gt;

&lt;p&gt;PhD-level science questions. The original GPQA paper reports GPT-4 at roughly 30-40% on the same benchmark. An 8B model matching GPT-4 on graduate-level science through structured reasoning is notable.&lt;/p&gt;

&lt;h3&gt;
  
  
  MMLU: 61% — The Interesting Case
&lt;/h3&gt;

&lt;p&gt;The overall score sits just below the raw Llama 3.1 8B baseline (~65%), but the distribution is telling:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;FRIDAY scored 100% on heavy conceptual subjects:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Astronomy&lt;/li&gt;
&lt;li&gt;College Biology&lt;/li&gt;
&lt;li&gt;College Medicine&lt;/li&gt;
&lt;li&gt;Conceptual Physics&lt;/li&gt;
&lt;li&gt;International Law&lt;/li&gt;
&lt;li&gt;Medical Genetics&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;But introduced "cognitive noise" on quick trivia and memorization questions.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Forcing an 8B model into deep reasoning loops completely masters logic-heavy subjects, but it can hurt performance on questions that just need fast recall. This is a known trade-off, and it's something I'm actively working on — potentially adding a routing layer that detects when deep reasoning isn't needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Methodology
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Two LLM calls per question:&lt;/strong&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;reason_about_task()&lt;/code&gt; generates a structured reasoning trace with problem decomposition, potential pitfalls, and recommended approach&lt;/li&gt;
&lt;li&gt;A second call uses that context to select the final answer&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Temperature:&lt;/strong&gt; 0.3&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Answer shuffling:&lt;/strong&gt; Seed=42 for GPQA&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;No external tools, no cross-question memory&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Groq client&lt;/strong&gt; with 429 retry logic and exponential backoff&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Architecture Thesis
&lt;/h2&gt;

&lt;p&gt;What FRIDAY demonstrates is that &lt;strong&gt;architecture matters as much as model scale&lt;/strong&gt;. An 8B model with structured cognitive reasoning can compete with systems running on significantly more compute.&lt;/p&gt;

&lt;p&gt;The cognitive pipeline isn't just a fancy prompt template. It's a genuine reasoning engine that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Decomposes&lt;/strong&gt; problems into manageable sub-problems&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simulates&lt;/strong&gt; potential solutions before committing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Self-corrects&lt;/strong&gt; through the debug and reflect stages&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Consolidates&lt;/strong&gt; knowledge for future use&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What's Next
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Increase sample size to 200+ per benchmark&lt;/li&gt;
&lt;li&gt;Test with larger base models (Llama-3.1-70B) to measure scaling&lt;/li&gt;
&lt;li&gt;Run additional benchmarks (HellaSwag, WinoGrande, HumanEval)&lt;/li&gt;
&lt;li&gt;Investigate the MMLU over-thinking penalty with a routing layer&lt;/li&gt;
&lt;li&gt;Apply the cognitive pipeline to robotic systems&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Bigger Picture
&lt;/h2&gt;

&lt;p&gt;I built FRIDAY because I believe the architecture of reasoning matters as much as the scale of the model. These numbers support that thesis.&lt;/p&gt;

&lt;p&gt;The cognitive pipeline implements ideas from neuroscience — Global Workspace Theory, Active Inference, Somatic Marker Hypothesis, Attention Schema Theory — as working software. It's not just an engineering project; it's an experiment in whether the structure of thought can compensate for the size of the brain.&lt;/p&gt;

&lt;p&gt;I'm 17, self-taught, from India. I built this in 27 days from zero. No CS degree, no mentors, just curiosity and a lot of debugging.&lt;/p&gt;

&lt;p&gt;If you're interested in the architecture, the code, or collaboration, I'd love to hear from you.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;FRIDAY is a 95,000-line cognitive AI operating system. The full codebase and benchmark results are available. Feel free to reach out if you want to dig into the implementation.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>python</category>
      <category>benchmarking</category>
    </item>
    <item>
      <title>I Built a 95K-Line Cognitive AI Operating System at 17 — Here's What I Learned</title>
      <dc:creator>near</dc:creator>
      <pubDate>Fri, 15 May 2026 09:05:25 +0000</pubDate>
      <link>https://dev.to/subhansh/i-built-a-95k-line-cognitive-ai-operating-system-at-17-heres-what-i-learned-1kn8</link>
      <guid>https://dev.to/subhansh/i-built-a-95k-line-cognitive-ai-operating-system-at-17-heres-what-i-learned-1kn8</guid>
      <description>&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Every AI assistant today is stateless. Each session starts from zero — no memory, no self-awareness, no learning. They're reactive, waiting for commands. They're single-model systems routing everything through one inference call.&lt;/p&gt;

&lt;p&gt;I wanted to build something different. Not a chatbot. A mind.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/subhansh-dev/Friday-Autonomous-Cognitive-AI-Operating-System/" rel="noopener noreferrer"&gt;F.R.I.D.A.Y.&lt;/a&gt; (Female Replacement Intelligent Digital Assistant Youth) is a 95,000+ line cognitive AI operating system written in Python. It has 50 cognitive modules, 59 tool actions, and 6 memory systems. It runs on 4GB RAM with no GPU.&lt;/p&gt;

&lt;p&gt;Here's what makes it architecturally different from anything else out there:&lt;/p&gt;

&lt;h3&gt;
  
  
  The Brain: 50 Cognitive Modules
&lt;/h3&gt;

&lt;p&gt;The system doesn't just have brain modules — it actively uses them. Every session follows a cognitive cycle:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Wake → Recall Memory → Assess Complexity → Route to System 1 or System 2
                                                    ↓
System 1 (simple):  Immediate response, single tool call
System 2 (complex): Plan → Simulate → Execute → Verify → Reflect → Learn
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Neuroscience
&lt;/h3&gt;

&lt;p&gt;Every module maps to peer-reviewed research:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Global Workspace Theory (Bernard Baars, 1988)&lt;/strong&gt; — The central integration hub acts like a thalamus. Events compete for attention based on urgency, goal relevance, and emotional salience. Winning events broadcast to all modules simultaneously. Dual-path architecture: hot path (&amp;lt;5ms real-time broadcast) and cold path (background persistence and pattern detection).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Free Energy Principle (Karl Friston, 2010)&lt;/strong&gt; — The active inference engine predicts tool outcomes before execution, computes prediction errors, and updates the world model. When uncertainty is high, it triggers epistemic foraging — exploring to reduce uncertainty rather than exploiting known paths.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dual Process Theory (Daniel Kahneman, 2011)&lt;/strong&gt; — The intuition engine implements System 1: fast pattern matching against stored experiences. Confidence = speed and closeness of match. When confidence is low, it escalates to System 2: the full plan-simulate-execute-verify-reflect pipeline.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Somatic Marker Hypothesis (Antonio Damasio, 1994)&lt;/strong&gt; — Emotional regulation tags decision options with emotional valence from past outcomes. If a tool failed painfully before, the somatic marker biases decisions away from it — not through logic, but through felt experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Structure Mapping Theory (Dedre Gentner, 1983)&lt;/strong&gt; — The analogy engine finds structural similarities across domains. Solutions from domain A transfer to problems in domain B when relational structures match. This is a key predictor of fluid intelligence.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Causal Hierarchy (Judea Pearl, 2018)&lt;/strong&gt; — Three levels of reasoning: Association (what correlates?), Intervention (what happens if I do X?), Counterfactual (what if I had done Y instead?). The causal reasoner builds structural causal models from tool execution sequences.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Memory Architecture
&lt;/h3&gt;

&lt;p&gt;Six memory types working together:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Memory&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;th&gt;Mechanism&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Neural&lt;/td&gt;
&lt;td&gt;Long-term facts&lt;/td&gt;
&lt;td&gt;Hebbian learning — "neurons that fire together wire together" — with 72-hour synaptic decay&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Episodic&lt;/td&gt;
&lt;td&gt;Timestamped events&lt;/td&gt;
&lt;td&gt;Importance scoring, searchable history&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Vector&lt;/td&gt;
&lt;td&gt;Semantic search&lt;/td&gt;
&lt;td&gt;Embedding-based similarity matching&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Procedural&lt;/td&gt;
&lt;td&gt;Skill templates&lt;/td&gt;
&lt;td&gt;Reusable tool chains learned from successful approaches&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Working&lt;/td&gt;
&lt;td&gt;Active context&lt;/td&gt;
&lt;td&gt;8-slot Miller's Law buffer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Global&lt;/td&gt;
&lt;td&gt;Cross-module broadcast&lt;/td&gt;
&lt;td&gt;Thalamus-like coordination&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  The Dreaming System
&lt;/h3&gt;

&lt;p&gt;During idle periods (2+ minutes without user activity), the dreaming system replays experiences, extracts patterns, and consolidates memories — exactly like sleep does for biological brains. It even has cross-module integration where dreams feed the curiosity queue, and dream-reality tracking that validates patterns against actual outcomes.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Curiosity Engine
&lt;/h3&gt;

&lt;p&gt;The system has intrinsic motivation. It tracks novelty, mirrors user interests, and after 30 minutes of idle time, autonomously explores topics it's uncertain about. Curiosity recovers over 3 days — already-explored topics regain curiosity over time, like forgetting.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Emotional Model
&lt;/h3&gt;

&lt;p&gt;Eight emotional states tracked continuously: curiosity, satisfaction, concern, frustration, confidence, wonder, calm, alertness. These aren't decorations — they modulate cognition. Curiosity drives exploration. Concern voices risks. Frustration signals to change approach. Emotions decay with a 5-minute half-life.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Architecture &amp;gt; Scale
&lt;/h3&gt;

&lt;p&gt;You don't need billions of parameters to build something interesting. You need the right architecture. Friday runs on a laptop with 4GB RAM. The cognitive gating system routes simple tasks to System 1 (instant) and complex tasks to System 2 (full pipeline). Most tasks are simple. The architecture handles this naturally.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Neuroscience Has Real Engineering Insights
&lt;/h3&gt;

&lt;p&gt;Karl Friston's Free Energy Principle isn't just philosophy — it's a concrete algorithm for prediction-error minimization. Damasio's somatic markers aren't just psychology — they're a mechanism for emotional memory that actually improves decision-making. The gap between neuroscience theory and engineering implementation is smaller than people think.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Self-Awareness Is an Engineering Problem
&lt;/h3&gt;

&lt;p&gt;Friday tracks its own confidence, detects bias in its reasoning, maintains a continuous identity narrative across sessions, and models the user's mental state. This isn't consciousness in the philosophical sense — it's functional self-awareness that improves performance.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Open Source Is the Way
&lt;/h3&gt;

&lt;p&gt;I'm 17. I don't have a team, a budget, or a GPU. But I have GitHub, Python, and curiosity. The whole thing is open source because I believe cognitive architecture shouldn't be locked behind corporate walls.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/subhansh-dev/Friday-Autonomous-Cognitive-AI-Operating-System
&lt;span class="nb"&gt;cd &lt;/span&gt;Friday
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; requirements.txt
python main.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Runs on Python 3.12+. Needs a free Gemini API key from &lt;a href="https://aistudio.google.com/app/apikey" rel="noopener noreferrer"&gt;aistudio.google.com&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;I'm Subhansh. I'm 17. I built this. If you have questions about any module, I'm happy to go deeper.&lt;/p&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/subhansh-dev/Friday-Autonomous-Cognitive-AI-Operating-System/" rel="noopener noreferrer"&gt;subhansh-dev/Friday&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>ai</category>
      <category>opensource</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
