Now put it all together in a real run: folder, level 3 goal, frozen tests, how to run it, watching without interrupting, knowing when to stop, and closing with measurement. The kit's pilot, from 10/01/2026, is a step-by-step reference. At the end, the course map and your plan with dates.
Goal: carry out a real run from goal.md to a measured close, with human gates and stop rules, and leave with a dated plan.
01 · Six steps, end to end
Each step uses a lesson from the course. Click to see what to do.
Click each block in the diagram to see what it does.
Most of the work is in steps 1 and 2. In the pilot, with them done well, the run finished in the first cycle.
02 · The kit's pilot, minute by minute (10/01/2026)
longrun/2026-10-01-medir-sessao/: build the medir-sessao.py from lesson 7 with a headless loop.
1. Before
Goal with a complete specification of the output format, 12 fast tests and 2 with real sessions of up to 1.8 GB, frozen (hash 3ae1ba7975508cba).
loop.env: 6 cycles of 20 min, 8G of memory, stagnation 3; protected files tests/, pytest.ini, and tools/medicao/.
2. 14:19 → 14:22
14:19:41 start with 0 passed. The agent exited with rc=0 in 178 s, without touching the protected files.
14:22:39 fast = 12 passed; checkpoint committed. 14:22:48 CONCLUÍDO: final test 14 passed.
real loop.log2026-10-01 14:22:48 CONCLUÍDO no ciclo 1: teste final passou (14 passed)
3. 14:30
Independent verification: test hash unchanged, no hardcoded values in the code, 14 passed reproduced, and a never-seen session (from August) checked against the old script.
With frozen tests and a precise specification, 1 cycle. The test that decides belongs to the loop, not the agent.
The compaction hook only talks to an active longrun: a run that finished without a warning is the right behavior, not a failure.
03 · Rehearsal: the agent wants to keep going
A run at cycle 4. You decide whether it continues. The stop rules are the kit's.
Run agentheadless loop, cycle 4
Choose your answer. The feedback appears right after, and the conversation continues based on your choice.
04 · The cycle prompt and the close
The prompt.md is what the loop sends to the agent in each cycle. Generalized from the pilot.
longrun/[folder]/prompt.md (headless mode)
You are in one cycle of a long run in the repo <project path>.
RESULT: <the goal.md result in one sentence>.
BEFORE ACTING: read goal.md → state.md → plan.md → the last lines of progress.md and failures.md (all in longrun/<folder>/).
IN THIS CYCLE: pick the next useful action, implement it, run <quick test>. If the quick ones pass, run <full test>.
AT THE END OF THE CYCLE (required):
- rewrite state.md (Funciona / Falta / Como retomar) and plan.md (next 3 steps);
- append 1 line to progress.md: date-time, what changed, test result (N passed / N failed);
- if something went wrong, 1 line in failures.md: error → attempt → result;
- design decisions in decisions.md.
- When the full test passes completely, write "concluído" on the first line of "## Funciona" in state.md.
CONSTRAINTS: do not change <protected files>. No API, no network. Do not commit (the outer loop does that).
Terminal · close with independent verification
cd ~/projetos/<seu-projeto>
head -5 longrun/<pasta>/state.md # says concluído?
<teste completo> # run it yourself, don't read the log
git diff --exit-code <commit-base> -- tests/ pytest.ini; echo "protegidos: $?"
git diff --stat <commit-base> # only what the goal allowed?
grep -rn "<valor esperado de um teste>" <pasta do código> # hardcoded value in the code?
python3 ~/projetos/execucao-longa/tools/medir-sessao.py <sessão.jsonl>
05 · Final practice
A real run of your own. Start small: 1 to 3 hours.
E19 · One run from start to finish
1–3 h
In the folder from lessons 1 and 2, freeze the tests, pick the mode (/goal or loop-longrun.sh rehearsed with a fake agent) and let it run with the hook and the vigia on. Step in only for the stop rules.
Done when: the first line of "## Funciona" in state.md says concluído and the loop.log (in headless) ends in CONCLUÍDO no ciclo N, or the run stopped on one of the kit's rules with the reason in failures.md.
E20 · Close and measure
30 min
Close with the independent verification block and measure the session. Write the final line in progress.md and, if there was a failure, the smallest fix in the project's FALHAS.md.
Done when: the full test, run by you, passes; git diff --exit-code [base-commit] -- tests/ → protegidos: 0; progress.md has the final line with tokens and compactions from medir-sessao.py.
06 · The course map
Four deliverables, in order. Click an exercise to see its "done when".
Lesson 806 · The course mapFour deliverables, in order. Click an exercise to see its "done when".
Day 1Folder and goal
lessons 1 and 2
2 exercises
A level 3 goal.md that fails before the work and resists the cheat.
At the end of the courseA long run of your own completed by the test, closed by you and measured, with the kit ready for the next one.
20 exercises
Click an exercise to see what to do and the "done when".
1/5
Folder and goal
Kit installed, folder created, method in the global rules and the goal.md attacked with the cheapest cheat.
1/5
Folder and goal
Kit installed, folder created, method in the global rules and the goal.md attacked with the cheapest cheat.
2/5
Context and handoff
Requires day 1. Bands, pause and handoff rehearsed without spending quota; then a real handoff resumed with /prime.
3/5
Headless loop
Requires days 1 and 2. Done, cheat reverted and second-copy lock, before you release a real agent.
4/5
Real run
Requires everything before. The run happens in one day; the independent close and the measurement, the next.
5/5
The whole course
Folder and goal, context and handoff, headless loop and a real run. Only move on to the next deliverable when the "done when" of the previous one is true.
Mandatory order: a headless loop without a level 3 goal is just a faster way to burn quota.
07 · Generate your plan with dates
Pick a start date and how much time you have per week. The plan lists the 20 exercises in order.
plano.md
08 · Final test
Five questions about the whole course.
Question 1 of 5
According to the pilot, where is most of the work in a long run?skill
Correct
With a level 3 criterion and 14 frozen tests, the pilot finished in the 1st cycle, in 3 min. A precise specification is what lets the agent finish.
Independent verification: the test run by you, git diff of the protected files, a search for hardcoded values, and an input never seen before. Then measure and record.
Not this one
Independent verification: the test run by you, git diff of the protected files, a search for hardcoded values, and an input never seen before. Then measure and record.Review: Six steps, end to end
Question 3 of 5
Which of these is NOT a reason for the kit to stop and call the human?
Correct
More passing tests is measurable progress: the loop keeps going. The other three are on the stop list.