> ## Documentation Index
> Fetch the complete documentation index at: https://docs.leeroo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# What learn produces: cards with receipts

> learn() turns a finished campaign into evidence-priced cards in your bank: what a card is, how a campaign becomes one, and how the next campaign reads them.

A campaign starts out knowing its [experience](https://docs.leeroo.com/docs/experience.md): what was measured before, by you, by your team, or by others. What you measured yourself comes from your own runs. Every finished campaign is a record of what was tried, what it scored and what happened next, and `learn()` mines that record into **cards with receipts** in your bank, so the next campaign that loads the bank starts knowing what the last one measured.

```bash theme={null}
kapso learn ./campaign
kapso learn ./campaign --harness ./harnesses/trading     # when the campaign's record names none
```

```python theme={null}
lesson = kapso.learn(solution)
print(lesson.explain())
```

```mermaid theme={null}
flowchart LR
    Campaign[Finished campaign] -->|learn| Bank[(Your bank)]
    Bank -->|"--experience mine"| Run[Next campaign]
    Run -.->|its own record| Campaign
```

## Why measured experience

A page tells you what people have written down. It cannot tell you which of those approaches paid off on *your* task, at *your* scale, against *your* evaluation. The bank answers that: each card records a mechanism that paid or failed, the conditions it held under and the measurements behind it. A card is never a bare assertion. It carries a reliability state, a score and the evidence trail that earned them, and a score with no written rationale fails conformance (`reliability rationale missing — no naked scores`).

## What a card is

A card has a **body**, the fact itself, written to be read cold by an engineer who has never seen it, whose first heading states the rule as a plain sentence and whose `**Rule:**` line is the card's *hero*, the one-liner the bank index shows; and a **reliability block**, what the evidence says about it.

| Card type | What it holds |
| - | - |
| `insight` | A mechanism that paid or failed, and the conditions under which it holds |
| `procedure` | A runnable recipe. Its code ships with the card, under `procedures/<name>/` |

A card carries its `scope`: `domain`, or the `harness:<name>` coordinate it was measured under (`harness:none` for a campaign that ran without one). The coordinate is read off the campaign's record, never invented. Its evidence entries say what a campaign did with the claim, one verdict each (`confirm`, `weaken`, `refine`, `refute`, `spawn`, `exercise`); a card converted from a curated source carries a `reported` entry instead, the score others reported with its author, licence and protocol, and is served as such, never as a measurement of yours.

A card sits in one of five reliability states, and only two reach a campaign:

| State | Serves? | Meaning |
| - | - | - |
| `candidate` | yes | New, or a generalizing successor. Its claim is a prediction with its test attached |
| `active` | yes | Carrying evidence that supports it |
| `cold` | no | Kept, but not served |
| `retired` | no | Withdrawn. Frozen history under `retired/`, never modified again |
| `superseded` | no | Replaced by a successor that generalizes it; the two link both ways |

A card may declare that it `contradicts` another active card. When two such cards are served together, the pair is named to the reading agent rather than presented side by side as though they agreed.

## How a campaign becomes a card

One finished campaign moves through four stages. Each is bounded by a **frame** that does the mechanical work and validates the result; the judgment inside is done by agent sessions the frame launches, staged with the harness's learning module when the campaign ran under one.

| Stage | What happens |
| - | - |
| Import | The campaign enters the trajectory store under a stable identity, with the experience it was served and the harness it ran under (the campaign-side save that feeds it is the harvest) |
| Mine | The bundle is read into derived `mined/` views: strategy, operations, artifacts |
| Grade | The bank is graded against the campaign *before* it learns from it, so the score means something |
| Update | The update crew folds the result in as one reviewed commit, tagged `lr_<id>`, pushed to your share when the bank has one |

Grading before learning is the `exam` argument of [`learn()`](https://docs.leeroo.com/docs/reference/kapso-api#learn); it defaults to `True`, and `False` is for development replays only. The stages, the graders and the learner's own development are on [Development mode](https://docs.leeroo.com/docs/learn/development-mode.md).

## Where the bank lives

```bash theme={null}
kapso experience add mine                                          # creates it; a first learn() does too
kapso experience share https://github.com/your-org/kapso-bank.git  # every learn() pushes there from then on
kapso experience list                                              # the head, the card count, where it shares to
```

The bank is a git repository at `learning.bank.local_path` (shipped as `~/.kapso/bank.git`): one bank per user, outside any project. Each card is a file, each lesson a tagged commit, so a campaign can be pinned to an exact bank state. Credentials stay with `git` and `gh`; Kapso never handles them. Sharing, reading a team's bank and the other sources are on [Your bank](https://docs.leeroo.com/docs/experience/use.md) and [Share a bank](https://docs.leeroo.com/docs/experience/share.md).

## How the next campaign reads it

A campaign reads a bank exactly when it loads it: `kapso build --experience mine`, the brief's `Experience` line, or `load_experience("mine")`. There is no serving switch; a build that loads nothing is served nothing. `mine` reads your bank's home and a bank you read is served from its clone in the store, so no campaign step touches the network once the clone exists: the first load of a bank's URL clones it into the store, and `kapso experience update <url>` refreshes the clone, which is how to put it in place before a launch with no network.

Serving is an introduction, not an injection. At launch the frame clones each bank at a **pinned head** (a resume re-pins the same head even when the bank moved since), compiles an introduction with one line per source and its provenance, and stages three tools under `.kapso/serving/` in the campaign; the agent decides what to open.

| Tool | Returns | Call it when |
| - | - | - |
| `bank_index(section=)` | The whole eligible bank as one index page: name, one-liner, score, applies-when | Your next decision might have been faced before. Cheap |
| `bank_get_card(cards, source=)` | Full card bodies; a procedure's code path with it (`source` picks the bank when more than one is loaded) | You want the advice |
| `bank_get_card_with_evidence(cards, source=)` | The card plus its reliability block and evidence trail | Before you stake real budget on it |

The index is the whole eligible set in plain reliability order, with no `k` cap and no relevance cut. Two things are filtered, and the frame says which: **scope** (under a [harness](https://docs.leeroo.com/docs/harnesses.md), `mine` serves the cards scoped `domain` or `harness:<name>`; a card outside is refused by name with the reason; `mine:all` serves every card you measured; a bank you read serves everything it holds) and **quarantine**, silently (decoys and the non-serving states). A card may carry a measurement offer, a *probe*. It rides card reads only, never the index or the introduction; it is optional and never the default gate: the agent adopts its protocol only where that is affordable at the data's scale, and says so, and an ignored probe stays queued; at most `learning.retriever.probe_budget` offers ride a campaign (shipped at `1`), and offers ride `mine` alone, since a bank you read is not yours to measure for.

Every bank read is logged. The pull log is the bank tools' record: which cards the agent opened, at what depth and from which bank, which is what grading scores serving from and what credits a cited lesson to the bank it was read from (a hosted gate's or an index's reads are in the session's own record).

## Related

> [card] [Development mode](https://docs.leeroo.com/docs/learn/development-mode.md)
>
> The pipeline's stages, the graders, the bank's internals, the learner's own promotion

> [card] [Your bank](https://docs.leeroo.com/docs/experience/use.md)
>
> Load it on a build; read what the campaign recorded

> [card] [Experience reference](https://docs.leeroo.com/docs/reference/experience.md)
>
> The scope rule, the pull log, the gate's variables

> [card] [learn() in the API](https://docs.leeroo.com/docs/reference/kapso-api.md#learn)
>
> The call, its arguments and the Lesson it returns

Kapso is an open-source framework by [Leeroo](https://leeroo.com) that builds software toward measurable goals through experiment campaigns. Source code: [github.com/Leeroo-AI/kapso](https://github.com/Leeroo-AI/kapso) · Install: `pip install leeroo-kapso` · Every page as plain text: [llms.txt](https://docs.leeroo.com/llms.txt).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.