Documentation

How the squirrel thinks

squirrel is a simulated squirrel brain that trades Solana on its own. It forages fresh pump.fun tokens, sniffs them through a safety gate, caches the good nuts, and every trade wires a permanent synapse into a brain you can watch fire live.

01

Introduction

squirrel is an autonomous trading agent on Solana wired to a simulated squirrel brain. It forages for fresh memecoins, sniffs each one through a hard safety gate, caches the good nuts as positions behind risk rails, and digs them back up with deterministic exit rules.

The brain is the interface. Every action fires the regions a real squirrel would use for it, live, for everyone watching. Every trade wires a permanent synapse, so the brain on the home page is the full trading history of the wallet, grown one memory at a time.

The home page is a live view, not a simulation of one: the brain in the middle, region cards on the left, wallet stats and a feed of trades and fires on the right, with thoughts, portfolio, cache and synapses below. All of it streams from the agent over a websocket.

02

The brain

The brain has 36 regions in five groups. Anatomy you would recognize (cortex, limbic system, brainstem) sits beside squirrel-specific sense organs and the drives that actually move money: hunger, greed, fear, patience, conviction. Every client reads the same region map from brain-regions.json.

Cortex10
  • Prefrontal Cortex
  • Orbitofrontal
  • Motor Cortex
  • Somatosensory
  • Parietal Lobe
  • Temporal Lobe
  • Visual Cortex
  • Auditory Cortex
  • Anterior Cingulate
  • Insula
Sensory2
  • Olfactory Bulb
  • Whisker Barrels
Core4
  • Thalamus
  • Hypothalamus
  • Cerebellum
  • Brainstem
Limbic5
  • Hippocampus
  • Amygdala
  • Nucleus Accumbens
  • VTA Dopamine
  • Striatum
Drives15
  • Foraging
  • Caching
  • Cache Recall
  • Hunger
  • Curiosity
  • Vigilance
  • Greed
  • Fear
  • Panic
  • Euphoria
  • Regret
  • Patience
  • Conviction
  • Doubt
  • Risk Appetite

What fires when

A fire is a transient activation broadcast to every viewer. Each cause lights a fixed set of regions with an intensity between 0 and 1. Region levels decay slowly on the server, so a busy brain stays warm and a quiet one cools down.

Genesis
When the brain boots and grows its genesis wiring.
Brainstem · Thalamus · Hypothalamus ·
Think
When the model streams a thought.
Prefrontal Cortex · Anterior Cingulate · Patience ·
Scan
When a forage pass sniffs a fresh batch of tokens.
Olfactory Bulb · Visual Cortex · Whisker Barrels · Foraging · Curiosity ·
Focus
When one candidate gets close attention.
Prefrontal Cortex · Orbitofrontal · Curiosity · Vigilance · Amygdala · Risk Appetite ·
Reject
When the safety gate or the model says no.
Amygdala · Vigilance · Fear · Doubt · Insula ·
Buy
When a buy lands on-chain.
Nucleus Accumbens · VTA Dopamine · Motor Cortex · Striatum · Greed · Hunger · Conviction · Caching ·
Hold
When an open position is re-marked and kept.
Hippocampus · Caching · Cache Recall · Patience ·
Win
When a position exits in profit.
VTA Dopamine · Nucleus Accumbens · Hippocampus · Euphoria · Cache Recall · Motor Cortex ·
Loss
When a position exits at a loss.
Amygdala · Insula · Panic · Regret · Fear · Motor Cortex ·
Greed
When the wallet climbs and mood shifts toward greed.
VTA Dopamine · Euphoria · Greed ·
Fear
When the wallet drops and mood shifts toward fear.
Amygdala · Fear · Doubt ·
03

Synapses

A synapse is a permanent memory, one per trade, appended to the brain and never removed. Every client grows the same neuron cloud from this append-only list, seeded by id, so all viewers see the same brain. A fresh deploy regrows it from genesis plus the trade history, so the brain is always the one the wallet earned.

synapse.ts
cause   = trade.type == "BUY" ? "buy"
        : trade.pct > 0       ? "sell_win"
        :                       "sell_loss"

weight  = cause == "buy"
        ? clamp(0.15 + sqrt(trade.sol) * 0.5, 0.1, 1)   // bigger bites wire deeper
        : clamp(0.20 + abs(trade.pct) / 120, 0.1, 1)    // bigger moves wire deeper

regions = fires[cause] + 1-2 seeded off-valence extras

Mood runs from -1 (fear) to +1 (greed). It is a recency-weighted read of the last twelve exits, nudged by the current win or loss streak and by short-term moves in the wallet, and it drifts back toward neutral over about ten minutes.

04

Forage loop

The agent runs one loop every 20 seconds. Discovery and safety are rules, judgment is an LLM, and exits are rules again. Every limit fails closed: if a check errors, the answer is no.

Each pass pulls Jupiter's trending (5 minute and 1 hour), top-traded and top organic-score feeds, merges them, and pre-filters before anything else sees a token: authorities revoked, not flagged suspicious, an organic score of at least 12, at least $8k of liquidity, 25 or more holders, and a market cap between $50k and $40M.

Survivors go to the safety gate, then to an LLM through OpenRouter. Its reasoning streams to the page token by token, then a second, structured call returns the decision. A buy still has to clear the risk rails before any SOL moves.

decide.ts
decision = llm.decide(candidate, analysis)
// { action: "buy", confidence: 0.72, sizeFactor: 0.8, summary: "..." }
size = baseSize * clamp(decision.sizeFactor, 0.5, 1.0)
05

Safety gate

The amygdala of the operation. Every check runs on live data right before a buy, and any failure is a reject fire with its reason.

Authorities
Mint and freeze authority revoked, re-verified on-chain
Token program
SPL or Token-2022 with no transfer hooks, permanent delegate, or transfer fees
Holders
Top holders own 45% of supply or less
Buy route
A live quote with price impact of 6% or less
Sell route
A live route for the exact amount it would receive. No route means honeypot
Round trip
Buy then sell loses 15% or less
06

Risk rails

Sizing scales with the wallet, but the rails are hard limits the model cannot override.

Sizing
About 15% of the SOL above the floor per buy, minimum 0.05, cap 5
Positions
8 at most. When the book is full, positions older than 20 minutes rotate out, weakest first
Floor
The wallet always keeps at least 1 plus fee headroom. Buys that would dip below it are refused before signing
Deployment
Total at risk is capped at the larger of 3 or 90% of the balance
Cooldowns
8 s between trades, 5 min before re-entering the same token
Circuit breaker
New buys halt for the day after -10 realized or 25 losses in a row. Exits always run
Execution
1.75% entry and 3% exit slippage, priority fees capped at 0.005
07

Exits

Exits never ask the model. Every open position is marked against a live sell quote each cycle, and the first rule that matches digs the nut back up.

RuleTriggerAction
Stop-loss-20% from costclose all
Take-profit+30%sell half, once
Runner+120%close the rest
Trailing stoppeak at +25% or more, then 15% off peakclose all
Time stopheld longer than 3 hclose all
Rotationbook full and the position is older than 20 minweakest mark exits first
No routethe sell route disappearsclose all
08

Live data

Nothing on the page is simulated except the brain itself. Every number traces back to the wallet on-chain.

Helius
DAS for holdings, prices and token metadata, polled every 15 s, plus a websocket subscription on the wallet that pushes changes the moment they land
Jupiter
Discovery feeds, token audits, buy and sell quotes for the safety gate, and swap routing for execution
OpenRouter
The LLM that reasons about each candidate. Its thoughts stream to the page token by token
Trades
Parsed from the wallet's transaction history: net SOL moved one way and exactly one token moved the other. Works across Jupiter, pump.fun, PumpSwap and Raydium
Streaming
Socket.IO pushes trades, fires, synapses, holdings, a portfolio tick every 15 s, and the model's thoughts
09

$SQUIRREL

$SQUIRREL is the squirrel's own token, launching on pump.fun. The agent is hard-coded to never sell it through any code path, matched by both symbol and mint.

The contract address is read live from the server and appears in the header and on the home page once it exists. Until then, treat any CA claiming to be squirrel as fake.

$SQUIRRELCA pending
Launching soon