> For the complete documentation index, see [llms.txt](https://doc.lockerprotocol.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.lockerprotocol.com/hyper-agentic-trader/brain-and-lessons.md).

# The brain and the lessons

How the pilot judges its own past decisions and turns them into lessons it reads before deciding.

The daily pilot keeps a **brain**: its own record of what it decided, what the market answered, and what it drew from that. Every day reads it before deciding, whether the day is real, in simulation, or replayed.

```sh
lpa pilot brain
lpa pilot brain --name sonnet
lpa pilot brain --export ~/brain.json
lpa pilot brain --reset
```

## How a decision gets judged

The code does the judging, not the model.

* A position by steps is judged at its exit, or after a year without it. Its result in **R** is the net over the base stake, after the fees and the funding. Past thirty days without its exit the position is said to be **waiting**, not judged, since nothing closes it. The brain lists what is waiting, with its steps and its latent result, ahead of the lessons, so a new decision weighs it before adding to that market.
* A trade with a stop is judged on the candles that followed it: which came first, the stop or the target, and the result in **R**, net of the fees and the funding.
* An **abstention** is judged too, by two witness trades, one each way. Saying no is a decision with a result.
* A decision with a **limit entry** is judged from the candle that touched its price, never from the price itself. A limit no candle ever touched over its horizon is graded *a limit never filled*, counted flat with no R to average, and its review speaks of the level rather than of a trade that never happened.
* A **grid** is judged on what it did over thirty days: the decision that set it, not each of its round trips.
* A **range** is judged on the day's first entries. A whole session counts as one trade for the circuit breaker, however many times it armed again.

Then, and only then, the trader looks back at each newly judged decision and writes a **lesson** in its own words.

{% hint style="info" %}
Judging happens at the head of a day, before any decision: `lpa pilot run-now` and `lpa pilot replay` both judge what the market has answered since, let the trader draw its lessons, and put the brain at the head of the prompt. So the day decides with its own past in front of it.
{% endhint %}

## What `lpa pilot brain` shows

* How many decisions the brain holds, and how many the market has judged.
* Its record **by regime and by side**: judged, won, lost, flat, and the average R net of costs.
* Its lessons, the most reinforced first, twelve at most of the sixty it keeps. `seen 3` means three judged decisions taught the same lesson.

## How a lesson grows

A review can reinforce a lesson that already exists instead of writing a new one, and sharpen its words. Two rules keep this honest:

* Only a lesson of the decision's **own side** can be reinforced: no trade, long and short each have their own. Words about another side become a lesson of their own.
* Each lesson keeps the id of the experience that taught it, so a lesson can always be traced back to the day it came from.

## What it costs to read

What the model reads of the brain is bounded to **6000 characters**, whatever the brain's age. The record is counters, and the lessons are a fixed number chosen by relevance: those of the day's regimes first, then the most reinforced, then the newest.

So the brain costs the same on the first day and on the hundred and eightieth: under a cent a day. With three deliberations the later ones read it from the prompt cache. With one, the default by steps, no cache is asked for, since nothing would read it back. A strategy the code decides reads no brain at all, and a day of it spends nothing.

On disk it keeps a year of experiences, 2000 at most, and 60 lessons.

## Several brains

A brain is a folder, named:

```
~/.lpa/pilot/brain/<name>/        "main" unless you name another
```

`--name` picks one. A replay can learn in its own brain (`lpa pilot replay --brain sonnet`), and `--no-brain` plays with none. Use separate brains to compare two models, two charters or two strategies without mixing what each learned (`lpa pilot replay --strategy <name> --brain <name>`).

{% hint style="warning" %}
**The brain advises and never widens anything.** A lesson is data about the pilot's own past. The charter, the policy and the mandate keep the last word, always. No lesson has ever made an order legal that the limits refused.
{% endhint %}

## Your own lines: notes and rules

The continuous pilot keeps a second memory you write in yourself:

```sh
lpa pilot notes --add "I do not want shorts on ETH" --kind preference
lpa pilot rules --dont "add past the ladder" --because "the charter sizes it"
```

* **Notes** are facts, preferences and lessons. `--pin` keeps one at the top, `--freeze` keeps the pilot from rewriting it, `--remove` takes one out, `--export` writes them to a file.
* **Rules** are the pilot's rules to itself, each with its reason and the limit it cites. `--mute` silences one, `--forbid <subject>` keeps the pilot from writing rules on a subject at all.

Your lines cannot be removed by the pilot, a frozen line cannot be rewritten by it, and a rule that cites a limit goes away when that limit changes. Details in [lpa pilot](https://doc.lockerprotocol.com/hyper-agentic-trader/commands/pilot.md).

## Learn more

* [Your first simulation day](https://doc.lockerprotocol.com/hyper-agentic-trader/first-paper-day.md)
* [Replaying the past](https://doc.lockerprotocol.com/hyper-agentic-trader/replay.md)
* [Models and costs](https://doc.lockerprotocol.com/hyper-agentic-trader/models-and-costs.md)
