DEV Community

Code Nomi Nomi
Code Nomi Nomi

Posted on

Why We Built an AI Agent with ADHD (and Cut Token Waste by 85%)

Replacing probabilistic LLM supervisory loops with deterministic, ADHD-inspired mechanical gates (locks, breakers, fail-closed routing).

Let’s talk about a dirty secret in modern AI agent development: we are fighting fire with gasoline.

Whenever an autonomous agent drifts, gets confused, or struggles with concurrent tasks, the industry's default reflex is to throw another LLM at it. A "supervisor agent", a "critic model", an "evaluator prompt".

The outcome?

  1. Insane token bloat: Passing full capability matrices and doctrines on every cycle.
  2. Control plane hallucinations: The supervisor model hallucinates its own supervision.
  3. Deadlocks & context collapse: The agent hangs forever on stuck subroutines or chokes on incoming requests while busy.

We took a step back and asked a radical question: What if we stopped modeling agents as ideal neurotypical workers, and instead implemented the mechanical constraints of ADHD?


The Neurobiology Invariant

In computational neuroscience, ADHD is not a "lack of computation" — it is a gating and resource-allocation mechanism:

  • Strict activation barriers: Sub-routines without critical priority or urgency simply fail to engage.
  • Hyperfocus (Mutual Exclusion): Once locked into a high-priority task, the channel is closed. Non-critical interruptions are physically dropped, not queued.
  • Thermal breakers: When processing stalls or loops, the system terminates abruptly rather than idling indefinitely.

We decided to translate these exact invariants into bare-metal software primitives: bare-metal NATS messaging, asyncio.Lock, and hard circuit-breakers. Zero probabilistic arbitration in the control plane.


The Architecture: 3 Hard Mechanical Gates

Here is how an incoming task navigates the execution pipeline:


text
[ Incoming Event on tour.tache ]
                   │
                   ▼
         ┌───────────────────┐
         │    Rank Router    │ ──(Deterministic Classification, Zero LLM)
         └───────────────────┘
                   │
         ┌─────────┴─────────┐
         │                   │
    [ Ranks D / C ]     [ Rank S / Kinjutsu ]
         │                   │
         │             (Closed-by-Default Gate)
         │                   ▼
         │           [ tour.approbation ]
         │                   │
         │           ┌───────┴───────┐
         │           │ ≠ "Autoriser" │ == "Autoriser"
         │           ▼               ▼
         │      ANNULE_REFUS     Pass Granted
         │                           │
         └─────────┬─────────────────┘
                   │
                   ▼
       ┌────────────────────────┐
       │    Hyperfocus Latch    │ (asyncio.Lock)
       └────────────────────────┘
         │ In progress?
         ├─► YES ───────► Instant Drop: ANNULE_OCCUPE (Zero Backlog)
         └─► NO  ───────┐
                        ▼
             ┌────────────────────────┐
             │    Thermal Breaker     │ (asyncio.wait_for 5.0s)
             └────────────────────────┘
               │
               ├─► Runtime ≤ 5s  ───► EXECUTE_AUTONOME / APPROUVE
               └─► Runtime > 5s  ───► Hard Trip: ANNULE_DISJONCTEUR
Enter fullscreen mode Exit fullscreen mode

Top comments (0)