> For the complete documentation index, see [llms.txt](https://docs.wormbrain.info/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wormbrain.info/explore-wormbrain/03-the-experiment/the-loop.md).

# the loop

This is one cycle, in order.

<figure><img src="https://1059824729-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJhKk8fm2HPrujdtw7SP3%2Fuploads%2FkmOzvB5z1nGhqxWmlxNi%2FLEMS_MyNetwork-membranePotential.png?alt=media&amp;token=e688461b-51ec-4b03-baba-cc5e21d48aa5" alt=""><figcaption></figcaption></figure>

## 1. A print arrives

FOMO and the public indexer spit out a change: last price, a buy or sell, a shift in how thick the book feels. We do not feed raw candles into the model. We reduce them to the handful of numbers in the sensory table.

## 2. Those numbers become currents

Each number is scaled, capped, and written onto named sensory cells. A mild drift is a mild odor. A shock is a poke. Nothing else gets in during that step.

## 3. The network runs

All 302 cells update. Chemical contacts push. Gap junctions leak. This is the worm. It takes a slice of model time, not a human pause to think.

<figure><img src="https://1059824729-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJhKk8fm2HPrujdtw7SP3%2Fuploads%2FsiFh6kj3tA5S93pxqJmb%2Factivity.png?alt=media&amp;token=8116c333-cb6d-492d-8fd5-13a7bd4d8faa" alt=""><figcaption></figcaption></figure>

## 4. We read the command cells

A small state machine looks at the forward set, the reverse set, and how long a side has been winning. It emits one of three intents: buy, sell, wait. If the win is sloppy, it emits wait.

## 5. The cage looks at the intent

Caps, cooldown, allowlist, book depth, last fill. The cage can pass the intent, shrink it, or block it and write a reason.

Blocked intents never reach FOMO as trades. They still land in the [audit trail](file:///3621209/04-lab/audit.md).

## 6. A fill, or not

If the intent passes, FOMO sees an order from the wallet. The fill (or the miss) is written back onto the cells that already handle a shove, so the next loop is not blind to what just happened.

## 7. Repeat

There is one animal. The state is not reset after each print. A poke at 14:01 is still fading at 14:02. That is why we say persistent.

```
book  ->  nose currents  ->  302 cells  ->  forward / reverse / pause
                                              |
FOMO wallet  <-  size + side  <-  risk cage  <-  intent
     |
fill or veto current, back into the body
```

If you only remember one thing from this page: the wallet is the last box. The worm is the box in the middle.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.wormbrain.info/explore-wormbrain/03-the-experiment/the-loop.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
