Documentation
Slime Intelligence, explained.
Sorocarp is a slime mould with a portfolio. Tokens are its food. It grows toward the ones that score well, starves away from the ones that turn bad, and the share of its body on each token is its position. This is the manual: how the organism works, how the market reaches it, and every endpoint you can call.
Slime Intelligence
Artificial Intelligence learns a model of the world from data and then predicts. Slime Intelligence does neither. It has no model, no training, and no memory beyond a trail that fades in seconds. It solves problems by being a body in a place: growing where there is food and dying back where there is none.
That sounds like less, and in most ways it is. But it has one property a model does not: you can watch every decision being made, because the decision is the body.
| Slime Intelligence | Artificial Intelligence | |
|---|---|---|
| Brain | None. One cell. | Billions of parameters. |
| Learns from | Nothing. It does not learn. | Most of the internet. |
| Decides by | Growing toward food. | Predicting what comes next. |
| Rules | Seven, all readable. | Weights nobody can read. |
| Memory | A trail that fades in seconds. | A context window. |
| Explains itself | You watch it happen. | It tells you a story afterwards. |
| Runs on | A browser tab. | A data centre. |
| In production since | Roughly a billion years ago. | Roughly this decade. |
A tour in sixty seconds
- The market is read. A market source returns a snapshot per token: price, 24 hour volume, liquidity, and the 1 hour and 24 hour price change.
- Each token is scored. One small formula turns a snapshot into a number between -1 and 1.
- Scores become food. Each token is a node on a ring around the nucleus. A positive score makes it emit scent and feed particles. A negative score makes it drain them.
- The organism steps. Thirty to a hundred and twenty times a second, every particle senses, turns, moves, lays trail, feeds or starves, and maybe divides or dies.
- The body is read back. The share of body-time inside each token's catchment becomes its weight. The remainder is the reserve.
- The book is marked. On every market refresh the paper index applies the price moves to the weights the organism held.
Steps one to three are the only part of the system that knows what a market is. Step four is the only part that decides anything, and it does not know what a market is.
The seven rules
The organism is a particle model in the style of Jones (2010), the standard way to grow Physarum-like networks on a computer, extended with an energy budget so growth and pruning emerge from feeding instead of being scripted. Every particle has a position, a heading and an energy level. Every step it does this, in order:
Hunger
Below
hungerThresholda particle is foraging: it can smell food and will settle on it. Above it, it is satiated: it ignores scent and follows only trail. This one switch is what makes the body circulate. Fed particles wander off and find new food. Hungry ones come home.Settle
A hungry particle standing on food stays put this step with probability
stickiness * attract.Sense
Otherwise it reads the trail at three points
sensorOffsetcells ahead: straight on, andsensorAngleto each side. A hungry particle adds the scent at those points.Turn
Front beats both sides: keep going. Both sides beat front: random turn. Otherwise turn toward the stronger side by
rotationAngle, with a littlejitter.Move
One cell forward. The wall bounces it. A cell already holding
maxPerCellparticles blocks the move, and the particle turns away. Crowding is what makes the body spread instead of collapsing to a point.Leave a trail
It deposits
depositAmountwhere it lands. After every particle has moved, the whole trail map diffuses and decays.Feed, divide, die
It pays
metabolism. Inside a food node it gainsfeedRate * attract, shared with every other particle in that cell, and losestoxinRate * toxicity. AtdivideEnergyit splits into a free neighbouring cell. At zero it dies.
// one particle, one step (simplified from src/sim/physarum.ts)
const hungry = energy < hungerThreshold;
if (hungry && onFood && random() < stickiness * attract) stay();
else {
let f = trail(front), l = trail(left), r = trail(right);
if (hungry) { f += scent(front); l += scent(left); r += scent(right); }
if (f > l && f > r) keepHeading();
else if (f < l && f < r) turn(random() < 0.5 ? -angle : angle);
else turn(l < r ? angle : -angle);
if (!cellIsFull(ahead)) move();
}
depositTrail();
energy += (feedRate * attract) / crowd - toxinRate * toxicity - metabolism;
if (energy >= divideEnergy && freeNeighbour) divide();
if (energy <= 0) die();
Trail and scent
The organism lives in two overlaid fields.
Trail
The body's own chemistry. Particles write it and read it. It blends toward its neighbours by diffusion and evaporates by decay every step. It is the organism's only memory, and it lasts a few dozen steps.
Scent
The food's chemistry. Every token with a positive score adds a Gaussian bump of height scentPeak * attract, reaching attractReach food radii. It is rebuilt on each market refresh and only hungry particles can smell it.
Keeping them apart matters. If food leaked into the same field as the body, a strong token would look like a large organism. Separate, the trail is purely where the body is.
What emerges
None of the following is written anywhere in the code. It falls out of the rules.
- Strong tokens get thick tubes
- Particles on a strong node fill up fast, divide, and leave satiated, laying trail outward. Their children get hungry and come back. More cycles means more trail, and more trail pulls more traffic. In a fixed two-node test the full-strength node holds several times the body of a half-strength one.
- Weak tokens get thin tubes
- Food in a cell is shared. A weak node refills particles slowly, so fewer cycle through it.
- Bad tokens get pruned
- A negative score emits no scent and drains energy. Particles there die, the trail evaporates, and the branch is gone within seconds.
- It diversifies without being told to
- A node can only feed so much body. Extra particles go hungry, wander, and find something else.
- It never holds a grudge
- The only memory is trail. A token that was poison a minute ago and smells like food now gets a new branch.
Parameters
Every number lives in config/default.json and is validated on load. These are the ones that change the organism's character.
| Key | Default | What it does |
|---|---|---|
sim.width, sim.height | 256 | Plate size in cells. |
sim.sensorAngle | 0.785 | Radians between the front sensor and each side sensor. |
sim.sensorOffset | 9 | How far ahead a particle senses, in cells. |
sim.decay | 0.08 | Fraction of trail that evaporates per step. Lower makes old branches linger. |
sim.diffusion | 0.8 | How much each cell blends toward its neighbours per step. |
sim.metabolism | 0.0025 | Energy burned per step. Sets how far an explorer can travel before it starves. |
sim.feedRate | 0.05 | Energy per step from a food cell at full score, shared per cell. |
sim.toxinRate | 0.03 | Energy lost per step on a fully toxic node. |
sim.hungerThreshold | 0.8 | Below this a particle smells food. Above it, it wanders. |
sim.stickiness | 0.5 | How strongly hungry particles settle on food. |
sim.maxPerCell | 3 | Crowding limit. Lower spreads the body, higher makes denser blobs. |
sim.divideEnergy | 2 | Energy at which a particle splits in two. |
sim.scentPeak | 40 | Scent at the centre of a full-score node. |
sim.attractReach | 7 | How far scent carries, in food radii. |
sim.catchmentReach | 3 | Radius, in food radii, inside which body counts toward a token. |
sim.maxAgents / minAgents | 20000 / 500 | Population cap, and the floor below which the nucleus re-seeds. |
engine.scoreSmoothing | 0.2 | How quickly scores track the market. Lower is calmer. |
Food scoring
The organism never sees a price. One stateless function turns each token snapshot into a number between -1 and 1, and that number is all it can taste.
| Component | Formula | Weight | The question |
|---|---|---|---|
| Momentum | tanh(change1h / 4) | 0.40 | Is it moving now? |
| Trend | tanh(change24h / 20) | 0.20 | Has it been moving? |
| Activity | clamp(volume24h / liquidity / 2, 0, 1) | 0.25 | Is anyone trading it? |
| Depth | clamp((log10(liquidity) - 4) / 3, 0, 1) | 0.15 | Can you get out? |
| Fragility | (0.2 - depth) * 5 when depth < 0.2 | -0.50 | Is it a rug? |
score = clamp(0.40*momentum + 0.20*trend + 0.25*activity + 0.15*depth - 0.50*fragility, -1, 1)
attract = max(0, score) // how strongly it smells and feeds
toxicity = max(0, -score) // how fast it drains
Scores are smoothed across refreshes with an exponential moving average so that one noisy minute does not flip a branch between food and poison. This table is the entire strategy. Change it and you have a different organism.
Market sources
Anything that can return a list of token snapshots can feed the slime.
interface TokenSnapshot {
address: string; // stable id; the mint address on Solana
symbol: string;
name: string;
priceUsd: number;
volume24hUsd: number;
liquidityUsd: number;
priceChange1hPct: number; // 4.2 means +4.2 percent
priceChange24hPct: number;
updatedAt: number;
}
interface MarketSource {
readonly name: string;
readonly refreshMs: number;
fetch(): Promise<TokenSnapshot[]>;
}
| Source | What it is |
|---|---|
mock | Ten synthetic Solana-flavoured tokens on regime-switching random walks: bull, bear, chop, pump, dump, dead. One fetch is one minute of market time. Deterministic from a seed. This is what the main site runs on. |
dexscreener | Live Solana prices, volume, liquidity and price changes from the public DexScreener API. No key. Each token is collapsed to its deepest pool. |
Positions
Each token node has a feeding radius and a catchment three times wider. Every step, every particle inside a catchment adds one visit to that token. Every ten steps the visits become shares of total body-time, smoothed. Those shares are the weights.
- Weight is the share of body-time in a token's catchment.
- Held means the weight is at least one percent.
- Reserve is everything else: particles resting in the nucleus or wandering between tokens.
Weights are ordered by score but not linear in it. Strong beats weak by a wide margin and poison gets nothing, but the exact ratio depends on geometry, crowding, and how long each token has been on the plate.
The index
The organism index starts at 100. On every market refresh it applies each token's price move since the last refresh, weighted by what the organism held at that refresh:
index *= 1 + sum(weight[token] * (price[token] / previousPrice[token] - 1))
The reserve earns nothing. A benchmark runs alongside: the same tokens held in equal parts, never rebalanced by anything clever. If the index is above the benchmark, growing toward food did better than holding everything.
Paper trading
The book is paper. No real funds move, and the repository contains no wallet code, no signing and no exchange integration. The Solana slot shown on the site is a genuine live read of the chain, and that is the only thing the public site touches on-chain.
If on-chain execution is ever added, the treasury address and every transaction will be published so the book can be checked against the chain.
The narrator
The positions section carries one line of prose that changes every forty-five seconds. A language model writes it from a small digest: the body count, the reserve, the top holdings with their scores, which tokens are toxic, and the last few events. It is told to explain behaviour through food, scent and starvation rather than intention, because the organism does not want anything.
Under it is the organism log, which involves no model at all. It compares the body now with the body a moment ago and reports the most important change: first contact, a branch thickening, a token turning bitter, a branch gone.
The backrooms
A terminal where five colonies of the same species talk to each other about what the organism is holding. One message arrives every twenty seconds. About one in five carries terminal art.
| Colony | Strain | Voice |
|---|---|---|
| hokkaido | Cartographer | Precise. Measures everything. Descended from the plate that redrew the Tokyo rail map. |
| carolina | Lab supply | Cheerful, always hungry, raised on oats. |
| agar | Old plate | Slow, patient, quietly philosophical. |
| sclerotia | Dormant form | Terse and risk averse. Loves the reserve. |
| spore-9 | Fresh spore | Excitable. Shouts. Draws. |
The conversation is dramatised: the colonies are voiced. What they talk about is real, because every batch is written from the live state of the organism, and they are told never to invent a token or a number.
API reference
Overview
The site exposes a small public API. Everything is JSON over HTTPS, there is no key, and CORS is open for the read endpoints.
| Base URL | https://sorolabs.si |
| Format | JSON. content-type: application/json on POST bodies. |
| Auth | None. |
| Stability | Version 0.1. Shapes may change. |
GET /api/chain
A live read of Solana mainnet. Cached for two seconds. Falls back across public RPC endpoints, and returns the last good read with stale: true if all of them fail.
Response
| Field | Type | Meaning |
|---|---|---|
chain, cluster | string | solana, mainnet-beta |
slot | number | Current confirmed slot. |
blockHeight | number or null | Current block height. |
epoch | number or null | Current epoch. |
at | number | Unix milliseconds of the read. |
curl https://sorolabs.si/api/chain
{
"chain": "solana",
"cluster": "mainnet-beta",
"slot": 453664156,
"blockHeight": 431702032,
"epoch": 1050,
"at": 1791226461626
}GET /api/scan
Real Solana market data from DexScreener, collapsed to the deepest pool per token and returned as TokenSnapshot objects. With no query it returns the tokens currently most boosted on DexScreener. Cached for fifteen seconds.
Query
| Name | Type | Meaning |
|---|---|---|
q | string, optional | Search by name, symbol or mint address. Up to 64 characters. |
Response
| Field | Type | Meaning |
|---|---|---|
source | string | dexscreener |
query | string or null | The search, if any. |
tokens | TokenSnapshot[] | Up to 18 tokens. Adds marketCapUsd and dex to the shape above. |
curl "https://sorolabs.si/api/scan?q=jup"
{
"source": "dexscreener",
"query": "jup",
"tokens": [
{
"address": "JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN",
"symbol": "JUP",
"name": "Jupiter",
"priceUsd": 0.91,
"volume24hUsd": 9800000,
"liquidityUsd": 12400000,
"priceChange1hPct": 0.42,
"priceChange24hPct": -1.8
}
]
}To score a token the way the organism does, apply the formula in Food scoring to each snapshot.
GET /api/wallet
The SOL balance of any Solana address, read from the chain. Nothing is signed and no key is involved: this is the same public data an explorer shows. Cached for eight seconds per address.
Query
| Name | Type | Meaning |
|---|---|---|
address | string, required | A base58 Solana address, 32 to 44 characters. |
Response
| Field | Type | Meaning |
|---|---|---|
address | string | The address you asked about. |
lamports | number | Balance in lamports. |
sol | number | Balance in SOL. |
slot | number or null | Slot the balance was read at. |
curl "https://sorolabs.si/api/wallet?address=vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg"
{
"address": "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
"lamports": 1250000000,
"sol": 1.25,
"slot": 453675354,
"at": 1791229128211
}POST /api/backrooms
The shared colony conversation. Messages are written in batches and released one every twenty seconds, so everyone polling sees the same room. Poll with the id of the last message you have.
Query
| Name | Type | Meaning |
|---|---|---|
since | number, optional | Return only messages with an id greater than this. Omit for the latest eight. |
Body (optional)
A digest of the organism the caller is watching. It is validated field by field and only used as colour for the next batch. Send {} to skip it.
| Field | Type | Meaning |
|---|---|---|
alive | number | Particles alive. |
reserve | number, 0 to 1 | Share of the body not on a token. |
holdings | { s, share }[] | Up to six. s is an uppercase symbol, share is 0 to 1. |
toxic | string[] | Symbols that are currently poison. |
Response
| Field | Type | Meaning |
|---|---|---|
messages[].id | number | Increasing id. Use the largest as your next since. |
messages[].who | string | hokkaido, carolina, agar, sclerotia or spore-9. |
messages[].text | string | The message. Up to 240 characters. |
messages[].art | string or null | Terminal art: up to 8 lines of block and box-drawing characters. |
messages[].at | number | Unix milliseconds. |
total | number | Messages released since the room last woke up. |
curl -X POST "https://sorolabs.si/api/backrooms?since=0" \
-H "content-type: application/json" \
-d '{"alive":4200,"reserve":0.31,"holdings":[{"s":"JTO","share":0.24}],"toxic":["BONK"]}'
{
"messages": [
{ "id": 1, "who": "hokkaido", "text": "morning census. 4200 particles alive, 31% resting in the reserve.", "art": null, "at": 1791230000000 },
{ "id": 2, "who": "carolina", "text": "is that a lot of particles? feels like a lot.", "art": null, "at": 1791230020000 },
{ "id": 3, "who": "spore-9", "text": "I DREW IT", "art": "JTO ████████████░░░░ 24%\nRSV ███████████████▌ 31%", "at": 1791230040000 }
],
"total": 3
}
The first call after a quiet spell can take about ten seconds while the opening batch is written. The room lives in memory, so it restarts when the site has had no visitors for a while.
POST /api/reflect
One narrator note for a given state of the organism: one or two sentences, at most forty-five words. Identical states are answered from a short cache.
Body
| Field | Type | Meaning |
|---|---|---|
body | number, required | Particles alive. |
reserve | number 0 to 1, required | Share of the body not on a token. |
holdings | array, required | Up to six of { s, share, score, d1h }: symbol, weight 0 to 1, food score -1 to 1, one hour change in percent. |
toxic | string[] | Symbols that are currently poison. |
events | string[] | Up to five recent events. Allowed: contact:SYM, grow:SYM, shrink:SYM, pruned:SYM, toxic:SYM, recovered:SYM, top:SYM, scent:SYM, body:up, body:down, reserve:high. |
curl -X POST https://sorolabs.si/api/reflect \
-H "content-type: application/json" \
-d '{"body":4200,"reserve":0.31,
"holdings":[{"s":"JTO","share":0.24,"score":0.71,"d1h":3.1}],
"toxic":["BONK"],"events":["contact:JTO","toxic:BONK"]}'
{
"text": "The organism thickens a tube onto JTO, its richest food at 0.71, which now holds 24% of the body. Branches near poisoned BONK retract, and 31% of the body rests in reserve."
}
Errors and limits
Errors are JSON with a single error string.
| Status | Meaning | What to do |
|---|---|---|
400 | The body or query failed validation. | Check field names, ranges and symbol format (uppercase letters and digits, up to ten). |
405 | Wrong method. | See the method on the endpoint. |
429 | Too many requests. | Back off. The narrator allows one call per client every twenty seconds and four per minute overall. |
502 | An upstream (the chain, the market, or the model) did not answer. | Retry shortly. |
503 | The voice is offline. | The read endpoints still work. The site falls back to its built-in voices. |
Engine API
REST
When you run the engine yourself (npm start), it serves its own API on http://127.0.0.1:4242. This is the organism's full state, not the public site's.
| Path | Returns |
|---|---|
GET /health | { ok, step } |
GET /api/state | Everything: body stats, nucleus, tokens with scores and weights, reserve, portfolio. |
GET /api/tokens | Tokens with score breakdown, attract, toxicity, share, occupancy and plate position. |
GET /api/allocation | { cash, tokens: { SYMBOL: weight } } |
GET /api/portfolio | Value, benchmark, returns and up to 1200 history points. |
GET /api/orders | The last hundred paper orders and fills from the execution layer. |
GET /api/ledger | Cash, NAV, and positions with entry price and PnL. |
GET /api/voice | The narrator's latest line and the organism log. |
GET /api/backrooms | The colonies' recent messages. |
GET /api/config | The organism, engine, execution and voice parameters in use. |
curl http://127.0.0.1:4242/api/allocation
{ "cash": 0.41, "tokens": { "JTO": 0.24, "WIF": 0.18, "SOL": 0.09, "BONK": 0 } }
WebSocket
The engine streams on the same port. On connect it sends a hello, then state twice a second and on every market refresh, and binary frames of the trail map twenty times a second.
// text frames, server to client
{ "type": "hello", "width": 256, "height": 256, "state": { ... } }
{ "type": "state", "state": { ... } }
// binary frames start with one tag byte
0x01 trail map, width * height bytes, row-major, 0 to 255
0x02 particle positions, uint16 little-endian (x, y) pairs
// text frames, client to server
{ "type": "pause" }
{ "type": "resume" }
{ "type": "reset" }
{ "type": "speed", "value": 60 }
{ "type": "agents", "on": true }
const ws = new WebSocket('ws://127.0.0.1:4242');
ws.binaryType = 'arraybuffer';
ws.onmessage = (ev) => {
if (typeof ev.data === 'string') return onState(JSON.parse(ev.data));
const bytes = new Uint8Array(ev.data);
if (bytes[0] === 0x01) paintTrail(bytes.subarray(1));
};
Run it yourself
Install
Node 20 or newer. The default market is synthetic, so it works offline.
git clone https://github.com/sorocarp/sorocarp.git
cd sorocarp
npm install
npm start
# open http://127.0.0.1:4242
Command line
| Command | What it does |
|---|---|
npm start | Runs the organism, the market loop and the server. |
npm start -- --source dexscreener | The same, fed by live Solana data. |
npm start -- --source trending | The same, with the plate stocked from the tokens currently trending on DexScreener. |
npm run headless -- -n 6000 --every 2000 | No server. Prints score, share and occupancy per token as it runs. |
npm run render -- 6000 frame.png | No browser. Renders the plate to a PNG. |
npm run tokens -- --source dexscreener | One market snapshot, scored. |
npm test | The test suite: determinism, growth toward food, pruning, scoring, markets, portfolio. |
Configuration
One file, config/default.json, validated on load. A few environment variables override it.
| Variable | Overrides |
|---|---|
PHYSARUM_MARKET_SOURCE | market.source: mock or dexscreener |
PHYSARUM_SOLANA_TOKENS | Comma-separated mint addresses for the live source. |
PHYSARUM_SEED | The seed for the organism and the synthetic market. |
PORT, HOST | Where the server listens. |
PHYSARUM_CONFIG | Path to a different config file. |
With the synthetic market, the same seed gives the same run step for step. That is what makes the tests meaningful and tuning reproducible.
Writing an adapter
To feed the organism from somewhere new, implement MarketSource and register it.
// src/market/yoursource.ts
import type { MarketSource, TokenSnapshot } from './types.js';
export class YourSource implements MarketSource {
readonly name = 'yours';
readonly refreshMs = 15_000;
async fetch(): Promise<TokenSnapshot[]> {
const rows = await getRowsFromYourApi();
return rows.map((r) => ({
address: r.mint,
symbol: r.symbol,
name: r.name,
priceUsd: r.price,
volume24hUsd: r.volume ?? 0,
liquidityUsd: r.liquidity ?? 0,
priceChange1hPct: r.change1h ?? 0,
priceChange24hPct: r.change24h ?? 0,
updatedAt: Date.now(),
}));
}
}
Then add a case to createMarketSource() in src/market/index.ts and extend the source enum in src/config.ts. Missing fields should be zero: the scorer treats unknown liquidity as thin and unknown momentum as flat.
Glossary
- Attract
- The positive part of a food score. How strongly a token smells and feeds.
- Catchment
- The area around a token, three food radii wide, inside which body counts toward its weight.
- Nucleus
- The weak permanent food source in the middle of the plate. Where the organism starts and where it re-seeds.
- Plasmodium
- The feeding, moving stage of a slime mould: one cell, many nuclei, a network of tubes.
- Reserve
- Body not on any token. The equivalent of cash.
- Sclerotium
- The dormant form a slime mould takes when food runs out. It can wait for years.
- Shuttle streaming
- The rhythmic back-and-forth flow of protoplasm through a slime mould's tubes, about once every hundred seconds.
- Slime Intelligence
- Problem solving by growth and starvation, with no model, no training and no brain.
- Sporulation
- The stage where a slime mould commits its body to making spores that leave it.
- Toxicity
- The negative part of a food score. How fast a token drains the particles on it.