Ready system · v0.7.0 · table booking · open source

The complete system so no table ever sits empty

Table booking for one restaurant, ready to run in your own environment: web chat and WhatsApp, a Telegram team desk, a waitlist and your own customer base. Version 0.7.0 is implemented: 93 out of 93 tests pass, LIMITES OK and the independent verification passed (docker build + healthcheck). Only your part is left: credentials, VPS and real data.

Reserva Restaurante banner: table booking, WhatsApp and the team on Telegram
Video

Watch the explainer

The project explained in a few minutes.

What it is

A ready system, built by an agent and proven by 93 tests

Here you get the working app and also the path that produced it: the contract for what it must do, the test battery that proves it, and the guardrails that stopped the agent from cheating. It was built by Claude Code and Codex, under the subscription, with the long-run execution method. The sibling project Atende Clínica was made exactly this way and also closed 93 out of 93 tests.

Table booking, automatic table allocation, confirmation, waitlist, WhatsApp Evolution, team on Telegram, LGPD and Raio-X

🍽️ The system

Dining rooms and tables with capacity, shifts by weekday, allocation of the smallest table that fits, "1 confirms / 2 cancels" confirmation, no-show, waitlist and large parties approved by the staff. Python 3 with the standard library only, and SQLite, one restaurant per installation, with Docker for the VPS.

📦 The kit

The code (./reserva, src/, web/, Dockerfile), the 20-section specification, the 93 black-box tests, the applied decisions, a map to Raio-X, the prompts for /goal and for the headless loop, and the guardrails that froze the contract. An adversarial validator reviewed the plan and fixed 13 problems before the build.

📈 The Raio-X de Margem rules

The customer contact stays with the restaurant, not the marketplace: the origin field rejects iFood and Rappi, and campaigns only go to people who consented (LGPD, Brazil's privacy law). These rules are Brazilian: marketplace terms such as iFood's and the LGPD are built in. The system returns clientes_novos_mes and retorno_atual_pct to the Raio-X de Margem dashboard.

How it works

From "a table for four, please" to a confirmed booking

This is the flow of the implemented system. 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 leaves the process.

Site chat or WhatsApp (Evolution)→ Name, party size, day, time→ Smallest table that fits→ Confirmation 24 h before→ Waitlist, large party, no-show→ Monthly numbers to Raio-X

Customer

Through chat or WhatsApp they book in four replies, check and cancel their own booking, get answers from the FAQ, ask for a human and send "PARAR" (stop) when they want no more messages.

Team on Telegram

Alerts for new bookings, cancellations and large parties. Commands /reservas, /fila, /responder, /encerrar, /aprovar and /recusar, also as a direct reply to the customer's message.

The /equipe page

With a token: the day's bookings by shift and dining room, an occupancy map by time slot, arrival and no-show, approve or refuse large parties, records for tables, shifts and FAQ, blocks and the human queue.

Prerequisites

What you need

To run the system you only need Python 3.10+; pytest is there to check the tests. Docker comes in for the VPS deploy; Evolution and Telegram are optional and yours. Claude Code or Codex only if you want to rebuild or adapt the system with the method.

Python 3.10+ and pytest

The application has no dependencies: standard library only. pytest is a development tool, used to check the 93 tests.

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

Docker, Evolution and Telegram

Docker brings the system up on the VPS with docker compose. An Evolution instance and a Telegram bot only if you want the channels; credentials stay in the .env.

# check
docker --version

Claude Code or Codex (optional)

Only to rebuild or adapt with the method, through the subscription, no paid API. For the headless loop, clone execucao-longa into ~/projetos.

# check
codex --version   # or: claude --version
User guide · step by step

From clone to a running system, in your own environment

The system is implemented: ./reserva ships in the repository. The commands below are the README's own. The cycle: check the tests, run it locally, configure your restaurant and, when you want, publish it on your VPS with your channels.

1

Clone and check the tests

The repository ships the ready system and the 93 black-box tests. On your machine the whole suite should pass.

git clone https://github.com/inematds/reserva-restaurante && cd reserva-restaurante
python3 -m pytest -q --collect-only | tail -1   # 93 tests collected
python3 -m pytest -q | tail -1                  # 93 passed
2

Run it locally

The first line prints PORTA=<n> (--porta 0 picks a free one). The server listens on 127.0.0.1; on the first run it creates the data folder, copies exemplos/restaurante.json and seeds reservas.sqlite3. Open / to chat as a customer and /equipe to operate with the token. Without Evolution and Telegram configured, messages stay in the simulated outbox (GET /api/saida).

./reserva serve --porta 8080 --dados ./dados   # PORTA=8080
# open http://127.0.0.1:8080/ and http://127.0.0.1:8080/equipe
3

Configure your restaurant

In dados/restaurante.json, replace the TROQUE-ESTE-TOKEN token with a unique one and set the real name, dining rooms, tables, shifts and FAQ. After the first run, tables, shifts and FAQ live in SQLite and are edited on the /equipe page or through the API; the other JSON settings are reloaded on restart. Confirmations, birthdays and come-back invitations go out through POST /api/tarefas/rodar (there is a button on the team page). The system does not charge deposits or Pix: any policy for groups goes in the FAQ.

nano dados/restaurante.json   # token, name, tables, shifts, FAQ
4

Backup and numbers for Raio-X

The backup is a ZIP with the configuration and a consistent copy of the SQLite database, even with the server running; store it with restricted access, because it holds personal data. Stop the server before restoring. The raiox command writes clientes_novos_mes and retorno_atual_pct into the Panel tracking file.

./reserva backup --dados ./dados --saida copia.bak
./reserva restaurar --dados ./dados --entrada copia.bak   # server stopped
./reserva raiox --dados ./dados --mes AAAA-MM --acompanhamento painel.json
5

Deploy to the VPS with Docker

The official Python image, no extra packages. The ./dados volume keeps SQLite and configuration, ./backups receives the copies and the port is bound to 127.0.0.1:8080: put a reverse proxy (Nginx or Caddy) with HTTPS in front, set the time zone (TZ) to the restaurant's, and do not pin RESERVA_AGORA in production. The README has the daily backup cron and the restore with a temporary container.

cp .env.exemplo .env && mkdir -p dados backups
cp exemplos/restaurante.json dados/restaurante.json   # edit token, tables and hours
chmod 600 .env dados/restaurante.json
docker compose up -d --build && docker compose ps
6

Connect WhatsApp and Telegram with your credentials

Evolution: fill in EVOLUTION_* and WEBHOOK_SEGREDO and set the MESSAGES_UPSERT event on the instance to https://your-domain/webhook/evolution/<secret>. Telegram: fill in TELEGRAM_*, register setWebhook on /webhook/telegram with secret_token equal to TELEGRAM_SEGREDO and add the bot to the group. Schedule POST /api/tarefas/rodar on localhost with X-Token (every five minutes, for example). No real service was called during the build: this part, the deploy and the pilot are yours.

nano .env   # EVOLUTION_*, TELEGRAM_*, WEBHOOK_SEGREDO, TELEGRAM_SEGREDO
docker compose up -d
7

Want to rebuild or adapt it? The method stays in the repo

This is how the system was built: decisions answered, contract frozen (specification and 93 tests with a hash), an agent in a long run (Codex headless loop or /goal in Claude Code) until 93 passed and LIMITES OK, and an independent verification the agent never saw: it looks for fixture values in the code, brings up a never-seen restaurant (15-minute step, a single shift, a 3-table combination) and does a docker build with a healthcheck. To change rules, edit docs/DECISOES-ABERTAS.md (in Portuguese), the specification and the tests, freeze again and run the same loop. The step by step is in the README and in longrun/2026-10-05-reservas-v1/.

bash longrun/2026-10-05-reservas-v1/congelar.sh
~/projetos/execucao-longa/tools/loop-longrun.sh longrun/2026-10-05-reservas-v1
python3 longrun/2026-10-05-reservas-v1/verificar-independente.py   # INDEPENDENTE OK
What's in the kit

Contract, tests and guardrails, with the real numbers

Everything the agent needed to build, and everything that stopped it from pretending it built. It stays in the repository for anyone who wants to check, rebuild or adapt.

93 acceptance tests

Black-box, over HTTP and the command line, in 10 files. All of them pass on v0.7.0.

test_reservas.py              15
test_integracoes.py           17
test_conversa.py              12
test_confirmacao_espera.py    10
test_horarios.py               9
test_cadastros.py              9
test_basico.py                 7
test_grupo_canal.py            7
test_docker.py                 4
test_lgpd_raiox.py             3

A 20-section specification

docs/ESPECIFICACAO.md: execution, restaurante.json, schedule and allocation rules, HTTP API, conversation, waitlist, confirmation, large parties and own customer base, export to Raio-X, LGPD, what stays out of v1, pages, records, blocks, database, Evolution, Telegram and Docker. Deposits by Pix, delivery and multiple restaurants are explicitly out.

Guardrails against shortcuts

Frozen hash of tests/, pytest.ini and the specification. File scope: the agent only touches the code and its own logs. No external dependency, no API key, no external URL and no 0.0.0.0 in the code. 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 never-seen restaurant with every argument explicit, and does a docker build and a container healthcheck. Only then does "93 passed" prove general logic.

20 decisions already proposed

Language, channels, allocation, duration by party size, a pending large party holding its tables, kitchen limit, no-show without charges, waitlist, consent rules and what goes to Raio-X. Only the items marked ⚠ change the contract.

Validated by an adversarial agent

A validator that never saw the planning checked tests against the specification, redid the arithmetic and tried to defeat the guardrails. It found and fixed 13 problems, 3 of which would have stalled the run. The full account is in docs/VALIDACAO.md.

Roadmap

Where it stands and where it goes

Plan and implementation are done. The system was built with the execucao-longa method and passed the independent verification, just like Atende Clínica, which also closed 93 out of 93. The next step is yours: the pilot in a real restaurant.

Plan ✅
Specification, tests and guardrails validatedA 20-section contract, 93 acceptance tests, proposed decisions, a map to Raio-X and an adversarial validation completed on 05/10/2026.
Build ✅
v0.7.0 built and verifiedAn agent in a long run until 93 passed and LIMITES OK; independent verification passed (never-seen restaurant, docker build and container healthcheck); chat and team page checked in a local browser.
Pilot
In a real restaurant, with youConfigure real dining rooms, tables, shifts and FAQ, connect Evolution and Telegram with your credentials, publish on your VPS and track new customers and returns in the Raio-X Recovery Panel. No deploy and no real service was run during the build.