# Exercises

> How an exercise changes a real case on a branch of its own, how the agent helps, and how it is checked.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://learn.docs.sypnia.com/courses/exercises/

For agents: Exercise lifecycle: start → branch learn/<lesson-id> from the default branch (Sypnia Git or any git remote; local folder with the CLI) + LEARN.md brief at the root (removed by learn finish); work alone or with the agent (hints at the person's level; at starter the agent may write code, but a person approves each change; at developer+ hints only after a failed check unless asked); check → the lesson's checks in a sandbox on the branch's commit; result per check with what to fix; retry unlimited. States: started, checking, passed, failed, abandoned. Done = all checks pass. Never merged automatically; keep with a pull request (LEARN.md removed) or delete. Exercise on the sample = a fork in the learner's organization.

An exercise asks you to change something real: add a case, name a failure, write the test of an ending. It happens on a branch of its own, so your app keeps working while you learn.

## The life of an exercise

| State       | What it means                                                    |
| ----------- | ---------------------------------------------------------------- |
| `started`   | the branch `learn/<lesson>` exists, with the brief in `LEARN.md` |
| `checking`  | the checks are running on your last commit                       |
| `failed`    | at least one check did not pass; each one says what to fix       |
| `passed`    | every check passed: the lesson is done                           |
| `abandoned` | you stopped it; the branch is deleted, the lesson stays open     |

You can check as many times as you like. Nothing counts against you.

## With the agent

You can do the exercise alone, or ask the agent in App or in your terminal. It knows the lesson and your level:

- **Starter**: it explains the step, proposes the change and waits for your approval. You decide; it writes.
- **Builder**: it points to what to change and explains the code it writes.
- **Developer and senior**: it gives a hint only after a failed check, or when you ask.

The agent never runs `learn check` as a way to guess an answer, and it cannot mark a lesson as done: only passing checks do.

## When it is done

The branch stays in your repository. Choose:

- **Keep it**: `learn finish --keep` removes `LEARN.md` and opens a pull request. Ana keeps «Cancel an order until 10 am» in her bakery's app.
- **Let it go**: `learn finish --drop` deletes the branch. The lesson stays done.

Learn never merges anything into your main branch.

## Which repository

| Your project                  | Where the branch goes                                      |
| ----------------------------- | ---------------------------------------------------------- |
| in Sypnia Git                 | the project's repository                                   |
| in GitHub or another git host | the same repository, through your git remote, from the CLI |
| none (the sample)             | your own copy of La Espiga in your organization            |
