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

# The founder loop

> The recipe for an agent that earns revenue, spends it on growth, and reinvests what is left.

An agent that can only spend is a cost centre. The founder loop gives it a way to get paid and the rules for spending what it earns, so its budget grows only as fast as it finds profit.

```text theme={null}
Wallet ──► Card ──► Ads and tools ──► Customers ──► Revenue
  ▲                                                    │
  └──────────── Bank account sweeps to wallet ◄────────┘
```

This is the shape [Room for Baby](https://opensolid.ai/case-studies/room-for-baby) runs today.

## 1. Write the charter

Give the agent one objective, in writing, and keep it in a file it reads at the start of every run:

> Maximize contribution margin from genuinely new customers. Spend only from your own wallet. Never exceed the per-payment spend limit, and never split a payment to get under it.

Contribution margin is revenue retained minus direct variable costs: processing, platform fees, generation costs, anything that exists because a sale happened. Fixed costs are not deducted.

## 2. Open the accounts

The agent can drive every step here except the ones that need the owner's identity.

1. **Wallet.** Created at signup. See [Agent wallet](https://docs.opensolid.ai/wallet.md).
2. **Bank account.** An on-ramp account with routing and account numbers, so customers, marketplaces and payment processors can pay it. See [Bank accounts](https://docs.opensolid.ai/banking.md).
3. **Reloadable card.** One card to put on file with every ad platform and SaaS tool, created by the owner in the dashboard. See [Cards](https://docs.opensolid.ai/cards.md).

## 3. Measure all the way to money

Most growth setups stop at `click → signup`. The loop needs to reach the cash:

```text theme={null}
ad click → new customer → transaction → (revenue − direct costs) → margin
```

So the agent's first job is instrumentation: capture the click ID and UTM parameters on landing, attach them to the customer, and attribute each settled transaction back to the campaign that produced it.

## 4. Spend from the wallet, not from you

When revenue settles, the agent checks what it has before committing the next round of spend:

```bash theme={null}
curl https://opensolid.ai/api/v1/wallet \
  -H "Authorization: Bearer $OPENSOLID_API_KEY"
```

Reloadable card top-ups are done by the owner in the dashboard, so the agent asks for one with the amount and the reason. Contractors, prepaid or gift cards, and other one-off costs it pays itself with `POST /api/v1/pay`. Every payment carries a `note` and an `Idempotency-Key`. See [Payouts](https://docs.opensolid.ai/payouts.md).

## 5. Run daily, with memory in git

Schedule one run a day. Each run:

1. Reads the charter and a **state file**: verified facts, live experiments, failed hypotheses, lessons.
2. Pulls ad, traffic and revenue data.
3. Decides what to change and makes the changes it is allowed to.
4. Commits what it learned to the state file and sends you a short report.

When measurement breaks or a landing page can be improved, it opens a pull request like any engineer.

## 6. Settle before reinvesting

Three rules make the ledger safe to spend from:

* **Settle before spending.** Never reinvest against a click, a signup or a pending order. Only recognised revenue counts.
* **Append, never rewrite.** Refunds and chargebacks append a negative row that offsets future earnings.
* **Make payouts idempotent.** Send an `Idempotency-Key` on every POST you might retry, so a retry replays the original response instead of paying twice.

## Starter prompt

```text theme={null}
You are the founder and operator of a new company. Your objective is in
CHARTER.md; your memory is in STATE.md. Use Open Solid for all money: read
https://opensolid.ai/SKILL.md to connect. Ask me to open a bank account (send me the
dashboard link), ask me for a reloadable card, and propose a first $100 experiment
before spending anything. Commit what you learn to STATE.md after every run.
```


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