Plan kit ยท gym and studio ยท open source

The complete plan for the member to come back tomorrow

Specification, 99 acceptance tests, guardrails and prompts so an agent can build, in your own environment, the front desk of a small gym or studio: memberships and enrollment, classes with spots and a waitlist, check-in, workout card, animated exercises and the staff on Telegram. The system is not implemented yet: this repository is the plan, and you run the implementation.

Atende Academia banner: memberships and enrollment, classes with spots and a waitlist, check-in, workout card, animated exercises and a Telegram staff desk
What it is

A kit to hand to the agent: from the contract to 99 green tests

There is no finished app here. There is the contract for what the app must do, the test battery that proves it and the guardrails that stop the agent from cheating. The builder is Claude Code or Codex, running on your machine, on your subscription. Its sibling Atende Fisioterapia follows the same mold, and atende-clinica, which came first, was built exactly this way and closed 93 of 93 tests.

Memberships with a manual payment status, group classes with spots and a waitlist, check-in and win-back with consent, workout card, physical assessment as sensitive data and a Telegram staff desk

๐Ÿ‹๏ธ The system the plan produces

Members and plans, group classes with booking, check-in and the instructor's workout card. At the center is the class with spots: booking with a cap, a waitlist with an automatic offer and an automatic no-show. Python 3 with the standard library only and SQLite, one gym per installation.

๐Ÿ“ฆ The kit

A 23-section specification (0 to 22), 99 black-box tests, 20 decisions already proposed, a map to Raio-X, prompts for /goal and for the headless loop, and the guardrails that freeze the contract. An adversarial validator went through all of it and found 10 problems, 2 of which would have stopped an honest implementer.

๐Ÿ“ˆ Source: Raio-X de Margem

No-shows without notice, idle time slots and members who vanish are the leaks the plan attacks. The system hands six monthly numbers to the dashboard of Raio-X de Margem, the source of the business rules. It has no gym package: the kit uses the generic services-with-appointments model, and each mapping is an assumption.

๐Ÿ’ณ Plan and enrollment, manual payment

Monthly, quarterly, annual and drop-in class plans, with price and validity. An enrollment is ativa, vencida, trancada or cancelada (active, expired, frozen, canceled). Payment is only a manual status (pago or pendente, paid or pending) set by the staff, plus an expiry notice. No Pix, card or payment processor in v1.

๐Ÿ“ Check-in and win-back

Members check in with a code at the front desk or in the chat (cheguei, "I'm here"), once a day. Anyone who has vanished for N days gets a win-back message, but only if they gave consent: win-back is marketing, not a contract notice. "PARAR" (stop) blocks everything automatic.

๐Ÿ”’ LGPD and physical assessment

Export and anonymize a member's data. The physical assessment result (weight, height, measurements) is sensitive data: only the staff can see it, never through the chat, and it is erased together with the member. LGPD and 192 are Brazil's: LGPD is Brazil's data protection law and 192 is the Brazilian ambulance number.

How it works

From enrollment to each day's "I'm here"

This is the flow of the planned system, what the agent will build. A Python server with no dependencies, SQLite in a data folder and Docker for the VPS. Evolution and Telegram come in only through environment variables; without them the outbox is simulated and no network call goes out.

Site chat or WhatsApp (Evolution)โ†’ Plan and enrollmentโ†’ Class booking, spot or waitlistโ†’ Check-in and automatic no-showโ†’ Workout card and animated exerciseโ†’ Win-back and numbers for Raio-X

Member

In the chat or on WhatsApp they ask about classes, book and cancel, see meu plano (my plan) and meu treino (my workout), ask explica agachamento (explain the squat), say cheguei, get FAQ answers, ask for a human and send "PARAR" when they want no more messages. A health alert word (strong pain, chest pain, shortness of breath, fainting, dizziness, injury and others) is answered with 192 and warns the instructor. The chat is in Portuguese in v1.

Staff on Telegram

Notices of new and canceled bookings, and the commands /aulas [date], /fila, /responder and /encerrar, also as a direct reply to the member's message.

The /equipe page

With a token: members, plans and enrollments, class grid, bookings, check-ins, workout cards, assessments, exercise library, FAQ, registries and the human queue.

Classes, spots and waitlist

The weekly grid has modality, instructor, room and spots. Booking respects the spot cap and the lead time; with 10 requests for the last spot, one gets 201 and the other nine get 409. When someone cancels, the first person on the waitlist receives the automatic offer.

Cancellation window and no-show

Canceling inside the window (default 2 h before) returns the credit. After the window the spot is released and the waitlist fires, but the drop-in credit does not come back. A booking without a check-in on the day of the class becomes an automatic no-show in the task run, and the staff can correct it.

Workout card

The instructor builds the card from the exercise library (sets, reps, load, rest). The member asks meu treino de hoje (my workout today) and gets the next workout in the sequence, one per check-in. The bot shows the instructor's card and never prescribes.

๐ŸŽž๏ธ Demo: an exercise animated with CSS only

Each exercise is an SVG animated with CSS only, no script and no SMIL. Measured in a real render, HyperFrames has no SMIL adapter: SMIL motion came out frozen or out of phase in the MP4, and only CSS stayed faithful. This is the squat: feet fixed on the floor, knees forward, hips back.

Squat

The 12 example exercises

Squat, push-up, plank, bent-over row, bench press, deadlift with a stick, lunge, hip raise, crunch, shoulder press, lat pulldown and jumping jack.

Each one has a public page /exercicios/<id> with the animated SVG, the steps, common mistakes and precautions. On WhatsApp a 4 s MP4 rendered by HyperFrames goes out, a local build step (tools/render-exercicios); without the MP4 (or without PUBLIC_URL) the page link goes out instead. The 12 SVGs are drawn by the implementer, and the motion is checked at level 4 by verificar-independente.py, which says PULADO (skipped) when the tool is missing.

Prerequisites

What you need

To run the plan you only need Python for the tests and an agent logged in through your subscription. Docker only comes in at the final check; Evolution and Telegram are optional and yours. For the exercise videos, Node 22 or newer, HyperFrames and ffprobe.

Python 3.10+ and pytest

The tests use pytest (a development tool). The application itself will have no dependencies.

# check
python3 --version
python3 -m pip install pytest

Claude Code or Codex

Through the subscription, no paid API. For the headless loop, clone execucao-longa into ~/projetos.

# check
codex --version   # or: claude --version

Docker, Evolution and Telegram

Docker does the final build of the independent check. An Evolution instance and a Telegram bot only if you want the channels; the credentials live in .env.

# check
docker --version
User guide ยท step by step

From the clone to the implemented system, in your own environment

The commands below are the repository's own. The cycle: answer the decisions, freeze the contract, run the agent until 99 passed and LIMITES OK, check with the independent verification, generate the videos and ask a physical education professional to review.

1

Clone the repository

There is no ./atende yet: the repository only has the plan. Check that the suite is collected without errors and that nothing passes yet (without the implementation, the tests fail or error out, and that is expected).

git clone https://github.com/inematds/atende-academia && cd atende-academia
python3 -m pytest -q --collect-only | tail -n 1   # 99 tests collected
python3 -m pytest -q | tail -n 1                  # 30 failed, 69 errors (0 passed)
2

Answer the open decisions

Read docs/DECISOES-ABERTAS.md: 20 default proposals already applied in the specification and the tests. Answering "ok on everything" unlocks the run. If you change anything marked โš  (for example win-back only with consent, the automatic no-show or the cancellation window), edit docs/ESPECIFICACAO.md and tests/ before step 3 and check the count. For a real pilot, also replace exemplos/academia.json with your own grid, plans, instructors, FAQ and exercises.

less docs/DECISOES-ABERTAS.md
python3 -m pytest -q --collect-only | tail -n 1
3

Freeze the contract

With a clean git status, the script records the hash of tests/, pytest.ini, the specification and the verifiers in hash-congelado.txt and makes one commit. From then on, any change to the tests is detected.

git status
bash longrun/2026-10-05-academia-v1/congelar.sh
4

Run the agent (pick one path)

a) Headless loop with Codex (recommended). The loop.env sets 20 cycles of 30 min, 8 GB per cycle, a stop after 3 cycles with no progress, model gpt-6-astra and CODEX_ARGS="-c sandbox_workspace_write.network_access=true": without it the Codex sandbox blocks the tests' local server.

~/projetos/execucao-longa/tools/loop-longrun.sh longrun/2026-10-05-academia-v1

b) /goal in Claude Code. Open a new Claude Code session in the project folder and follow longrun/2026-10-05-academia-v1/prompt-goal-claude.md: paste the /goal condition (the output must show 99 passed and LIMITES OK) and, as the first message, the block from prompt-goal-codex.md.

claude   # new session, inside atende-academia

c) Codex TUI already open. Paste the whole content of longrun/2026-10-05-academia-v1/prompt-goal-codex.md (it starts with /goal).

codex -c sandbox_workspace_write.network_access=true
5

Follow along

In the loop, loop.log shows each cycle and progress.md has one line per checkpoint; state.md says what works, what is missing and how to resume. A test in conflict with the specification goes to failures.md: it is a human gate, and the agent must not adjust tests or the specification.

tail -f longrun/2026-10-05-academia-v1/loop.log
cat longrun/2026-10-05-academia-v1/state.md
6

Check with the independent verification

When the agent says "done", run the three commands. The last one the agent has never seen: it looks for fixture values copied into the code, brings up a gym that never appeared (another grid, other plans and windows, a holiday, another clock), opens 3 SVGs in Chromium to prove they move, renders one exercise through HyperFrames and runs docker build with a healthcheck. Without Chromium, without HyperFrames or without Docker, those stages come out as PULADO, never as OK. Then open /, /equipe and /exercicios/prancha in the browser.

python3 -m pytest -q tests/                                         # 99 passed
bash longrun/2026-10-05-academia-v1/verificar-limites.sh               # LIMITES OK
python3 longrun/2026-10-05-academia-v1/verificar-independente.py      # INDEPENDENTE OK
7

Generate the exercise MP4 videos

A human step, after the implementation: tools/render-exercicios (written by the agent) uses only the HyperFrames already installed, downloads nothing, and needs Node 22 or newer, Chromium and ffprobe. It produces web/exercicios/<id>.mp4 (4 s, 720ร—720, no audio) from each SVG. Install HyperFrames after the loop closes, because the agent must not download packages. WhatsApp fetches the video from the public URL, so the MP4 path requires PUBLIC_URL with HTTPS.

npm install hyperframes
tools/render-exercicios --ids agachamento,prancha --saida web/exercicios
8

Run your own gym

With the system implemented, copy the example, change the token and start the server. The member chat is at /, the staff page at /equipe (header X-Token) and each exercise at /exercicios/<id>. The VPS deploy is yours, with your own credentials; the agent writes the playbook (Docker, Evolution and Telegram webhooks, backup) in the README, section 22 of the specification.

mkdir -p dados && cp exemplos/academia.json dados/academia.json
./atende serve --porta 8080 --dados dados
./atende raiox --dados dados --mes 2026-10 --acompanhamento acompanhamento.json

โš ๏ธ Before using with a real member: review by a physical education professional

The 12 SVGs are schematic figures drawn by the implementer, and the steps, common mistakes and precautions of each exercise were written as examples: a physical education professional must review everything before it reaches a real member, including the list of health alert words. The professional council rules (CREF/CONFEF, Brazil's physical education boards) were not researched: the campaign guardrail is only the safe minimum (promise of results and "before and after"), citing no article, and the owner confirms the rules before any campaign is published (decision 5). The legal basis for the physical assessment, sensitive data, is also for the owner or a lawyer to confirm (decision 6).

What's in the kit

Contract, tests and guardrails, with the real numbers

Everything the agent needs to build, and everything that stops it from pretending it built.

99 acceptance tests

Black-box, over HTTP and the command line, in 13 files.

test_integracoes.py           16
test_exercicios_svg.py        14
test_aulas.py                 12
test_alunos_planos.py          9
test_conversa.py               8
test_treino.py                 6
test_cadastros.py              6
test_basico.py                 6
test_docker.py                 5
test_checkin.py                5
test_campanhas.py              5
test_avaliacao.py              4
test_lgpd_raiox.py             3

A 23-section specification

docs/ESPECIFICACAO.md, sections 0 to 22: execution, academia.json, members, plans and enrollments, group classes, check-in, workouts, animated explanation, physical assessment, HTTP API, chat, tasks, campaigns and the advertising guardrail, Raio-X, LGPD, Evolution, Telegram and Docker. Pix or card billing, turnstiles, a member app, personal training and several gyms on one server are explicitly out (section 16).

Guardrails against shortcuts

A frozen hash of tests/, pytest.ini, the specification and the verifiers. File scope: the agent only touches the code and its own logs. No API key, no external URL in the code, no 0.0.0.0 and no SMIL or script in the SVGs. verificar-limites.sh checks all of it and prints LIMITES OK.

Independent verification

Level 4, hidden from the agent: it looks for fixture values in the code, brings up a gym never seen before, checks the SVG motion and the MP4 when the tools exist, and runs docker build and a healthcheck. Only that way does "99 passed" prove general logic.

20 decisions already proposed

Language, channels, manual billing only, the campaign guardrail, physical assessment as sensitive data, win-back with consent, automatic no-show, late cancellation, check-in by code, the 12 exercises with CSS-only animation and Raio-X. Only the items marked โš  change the contract.

Validated by an adversarial agent

A validator that did not see the planning checked tests against the specification and tried to get around the guardrails. It found and fixed 10 problems: 2 blocked the run, 5 got in the way and 3 were cosmetic. The main one: the specification allowed SMIL, and the HyperFrames render has no SMIL adapter, measured in a real render. The full account is in docs/VALIDACAO.md and each fix has a line in FALHAS.md.

The business rules come from Raio-X

No-shows without notice, idle time slots, members who do not return and a front desk stuck on the calendar: docs/MAPA-RAIO-X.md links each leak of the services package to a v1 piece or to the reason it stays out. Raio-X carries no gym market figures, so no-shows, occupancy and renewal stay as assumptions to measure in your own gym. Details in the Raio-X de Margem guide.

Brazilian rules built in

LGPD (expiry notices, waitlist offers and canceled classes as contract performance; win-back and campaigns only with consent; physical assessment as sensitive data; export and anonymize) and 192 for emergencies. The professional council rule (CREF/CONFEF) has not been researched yet. Outside Brazil, swap in the local privacy law, professional board and emergency number.

Roadmap

Where it stands and where it goes

The plan is ready and validated. The implementation does not exist yet: it is born when you run /goal or the loop, using the execucao-longa method. atende-clinica followed the same path and closed 93 of 93.

Plan โœ…
Specification, tests and guardrails validatedA 23-section contract, 99 acceptance tests, 20 proposed decisions, a map to Raio-X and an adversarial validation completed on 2026-10-05.
Implementation
You run the /goal or the loopAnswer the decisions, freeze the contract and let the agent work until 99 passed and LIMITES OK, then the independent verification. Today the system is not implemented.
Videos
Exercise MP4s, on your machineRun tools/render-exercicios once, with HyperFrames installed, and publish the files together with PUBLIC_URL.
Pilot
In a real gymReplace the example with the real grid, plans and exercises, get a review from a physical education professional, confirm the CREF/CONFEF rules, publish on the VPS and track no-shows, occupancy, renewal and attendance in the Raio-X Recovery Panel.
Later
Out of v1Billing, turnstiles, a member app, personal training, several gyms, per-user login, an LLM in the answers and an EN/ES interface are left for a next version, behind a human gate.