Courses  /  Build Kits
whatsapp-closer-agentkit v0.1.0 MIT

Blueprint for Claude Code

WhatsApp
Closer

This repo doesn't ship the application. It ships the instructions for Claude Code to build it on your machine, one file per phase, with pinned versions and the literal output you have to see at each step.

What gets built is an agent that handles every incoming chat with a setter-and-closer profile: it qualifies, answers the playbook objection, offers times that actually exist, books, and leaves written in the CRM where things stand.

unbuilt tree · gate
PASS · 0 errors
unbuilt tree · suite
50 passed, 203 skipped
gate checks
23
blueprint files
16
commands
11
pinned dependencies with ==
30

Every line comes from a command. The commands are in verification.

01

The problem

Two problems, one on top of the other

The one underneath is about installation. pip install doesn't give the same result on two computers, and it doesn't warn you. The case that justifies the whole kit is in PINES.md:

fastapi 0.141.1  declares starlette>=0.46.0   ← no ceiling
starlette         1.3.1   2026-06-12          the latest that existed
                  1.4.0   2026-08-05  ┐
                  1.4.1   2026-08-05  │  all AFTER
                  1.5.0   2026-08-08  │  fastapi 0.141.1 was
                  1.5.1   2026-08-08  │  frozen
                  1.6.0   2026-08-08  ┘
It doesn't fail at install time. It fails later, strangely, and the error names neither of the two. — PINES.md

That's why nothing here is pinned with >=. The 30 dependencies, the model, and the base image live in a single file, and the gate rejects anything generated that doesn't respect them.

The one on top is about selling. People ask for a WhatsApp agent that sells, not a menu bot: one that qualifies, answers objections, books. Today replies are written by hand. Whoever writes at three in the morning goes with whoever answered first.

The kit's answer: four beats per step

Every step of the blueprint comes in the same shape. Objective, what ends up true. Do this, the command, copyable. You have to see, the literal output, not "it should work". If it fails, every failure mode with its fix.

The fourth exists because computers are different. A step without "If it fails" leaves you facing a screen that says no and no way out. — blueprint/00-mapa.md

02

What kind of repo this is

Instructions, not an application

In the clone there is no agente/ folder. Your run writes it. That's the difference that explains the numbers above: the gate passes with eleven skipped checks and the suite leaves 203 tests asleep, because they are waiting for a build that doesn't exist yet.

What does come is 16 blueprint files, one per phase, and 11 commands in .claude/skills/ that open them in order. The rule the map repeats: read one file per phase, not all sixteen. Loading them all spends the context the build needs at the end.

CommandWhat it does
/startfrom a freshly downloaded clone to a working closer: it sizes up the ground, says what it costs and how long it takes, interviews, builds, and deploys locally or on Railway
/armar-cerradorbuilds the whole closer, phase by phase. /start walks the same files, with the start and the finish around them
/seguirresumes a half-finished build, without overwriting anything silently
/configurarcatalog, price range, availability, escalation, internal channel
/playbookthe objections with their answers, the tone, and how to address people
/conectarthe credentials, which the installer writes
/probarchat simulator
/revisarruns the gate
/publicardeploys and registers the webhook
/bandejaapproves the drafts one by one
/soltarmoves step 3 to automatic, if the numbers add up

If the build is cut short, the state stays in .wca-estado.json with the phase and the sha256 of each written file. It's local and doesn't go to git. A file that changed isn't rewritten silently: what changed is stated and confirmation is awaited, file by file.

03

The six steps

Six steps, and they are the contract

The output always carries all six elements, even if five are skipped. That's what lets you see where the cycle broke off.

1

Receive the message and bring in the context.

webhook · history · contact card · transcribed audio

2

Detect the intent and qualify.

budget · urgency · fit · score 0 to 100

3

Reply in the brand tone and offer times that exist.

writes to a person

4

Book and confirm.

writes to the calendar

5

Write the stage, the summary, and the next step in the CRM.

writes to the database

6

Hand the chat to a human when appropriate.

anger · price out of range · escalation word

Steps 3, 4, and 5 write outside. The default mode is borrador: they draft, show, and wait for explicit confirmation. Moving to automatico is decided by the installer, and done with /soltar.

The six invariants

No blueprint file can break them, and each one has its check in the gate.

  • Signatures are verified over the raw body, with hmac.compare_digest. Re-serializing the JSON to sign it passes all the tests and fails all real deliveries.
  • Everything that goes out passes through a single enviar(): 24-hour window, ban check, and never writing first to someone who hasn't written.
  • A single HTTP client, with an explicit timeout=.
  • No credentials in the tree. Secrets are written by the installer, never by a tool call.
  • No price or deadline that isn't in the catalog. No objection that isn't in the playbook: it is named and left for the human.
  • The versions and the model come from PINES.md and nowhere else.

04

What gets built

The pieces the run writes

PieceHow it ends up
Providermeta, zernio, or demo, against a single interface. demo asks for no credentials and is not a fake transport: it replays recorded deliveries, with the same raw bytes, the same signature header, and the same deduplication path.
Audiois transcribed with the Whisper API (OPENAI_API_KEY). Without that key, step 1 stops with the reason written out, not with an invented transcription.
Imageis read by the Anthropic model that is already configured. There is no vision key to get.
CalendarGoogle Calendar: the event, and the reminder 24 hours before.
CRMthe leads table, with step 5 writing to it.
Panel and APIagente/servidor.py: ten routes and eleven methods — the GET and POST of /webhook/{proveedor} share a path —, the API behind PANEL_TOKEN, and a view that opens in the browser.
Deploymentthe laptop, a Mac Mini, or Railway. Railway is the blueprint's default, but the installer makes the choice.
Inboxdrafts are resolved one by one. Approving doesn't send: it re-runs the step with confirmado set to true, and sends the single enviar().

The credentials are 18 variables, and env.example carries the names and where each value comes from. Never a value. The only one always needed is Anthropic's: demo mode saves you the WhatsApp credentials, not the model that drafts.

05

How it is verified

Two commands, and you can run them yourself

This is what an unbuilt tree gave, that is, without the agente/ folder. Don't copy it from here: run the two commands and compare.

$ .venv/bin/python scripts/auditar.py

auditar · whatsapp-closer-agentkit · without agente/: not built yet

  [ok      ] 01 blueprint-existe   16 file(s) cited by 28, all with content
  [ok      ] 02 manifiesto         7 templates up to date with the manifest.
  [ok      ] 05 pines              30 pins in 1 file(s), MODELO=claude-opus-5, imagen python:3.12-slim, verif
  [salteado] 06 deps-imports       agente/ doesn't exist: this runs after /armar-cerrador
  [ok      ] 08 secretos           104 files reviewed, 7 patterns
  [ok      ] 17 contrato-control   6/6 mutations rejected
  [ok      ] 19 pruebas            50 passed, 203 skipped in 0.25s · 203 skipped: 0 live-only, 203 waiting
  [salteado] 23 censo-de-campos    the census didn't run in this tree: no EVIDENCIA/censo.json. Run it with `.v

auditar: PASS · 0 errors · 1 warning · 11 skipped
  a skipped check is not a passed check: read the reason for each one.

Excerpt: 8 of the 23 lines, verbatim. The block slides to the right. The cuts at the end of a line are from the tool. The seconds change on every run.

$ .venv/bin/python -m pytest -q

50 passed, 203 skipped in 0.25s

The 11 skipped and the 203 asleep are the correct state of a tree with no build: they are waiting for agente/. The gate says so with a warning and not an error, for that very reason. That is the only warning in this run. As soon as the build exists, they stop being skipped and need another look. A second warning appears if git doesn't yet have the core files in the index, so on a half-committed copy it may give you something different.

What the gate measures

23 checks. The first twenty-two look at the tree: that the blueprint is whole, that the templates haven't drifted from the manifest, that the versions are the ones in PINES.md, that no secret is written in a file, that there is a single HTTP client and a single enviar(), that the output schema doesn't accept a mutation it should reject.

The gate doesn't open a socket or read a secret, and that's on purpose: a check that goes out to the network sits waiting on a timeout with a bad connection, and then there's no report.

Check 23: the field census

The twenty-third measures one floor up. It goes field by field through the output contract, mutates it, and re-runs the suite: if no node turns red, that field is declared by the contract and asserted by no one.

In a clone it can't run, because there's no output to mutate:

$ .venv/bin/python scripts/auditar.py --censo

census: couldn't be measured. the census needs the build: agente/ciclo.py
doesn't exist, so there's no output to mutate and the 43
declared fields go unmeasured. The static half — the
`SIN_ASERCION` list against the schema — does run in check 23 without a build

It has already run once over a build. Of the 43 fields: 31 asserted, 3 that the schema fixes and have no possible mutant, and 9 with no assertion. That number is published, with the nine names, in PENDIENTES.md.

Six generations

Six independent runs built the agent from this blueprint. The last three closed at 217, 231, and 253 passed, with the gate at PASS · 0 errors · 0 warnings · 0 skipped.

Those numbers don't come from this clone and can't: there's no agente/ here. What a freshly downloaded clone gives is what's above, and that you can reproduce on your machine in two commands.

06

The limits

What it doesn't do, and what's still missing

What the agent doesn't do

  • It doesn't invent prices or promotions. What's not in the catalog you give it doesn't exist. A discount invented by an agent ends up being paid by the business.
  • It doesn't answer objections that aren't in your playbook. It names them and leaves them for the human.
  • It doesn't write first. It answers whoever wrote to it. It doesn't send bulk messages and doesn't open cold conversations: that's what gets Meta to take the number down.
  • It doesn't negotiate a price out of range. That escalates, always.
  • It doesn't keep answering after an escalation. Not even to say goodbye.
  • It doesn't delete or reorder anything in the CRM. It adds and updates the contact's row.

A limit the agent doesn't set

Outside the 24-hour window from the contact's last message, WhatsApp only lets you send approved templates. The step 4 reminder almost always falls outside that window, so it needs a template registered by Meta, and approval takes time.

A green gate doesn't mean it works against Meta

It means the kit is well put together. What gets closed by hand, once, with your credentials, is in PENDIENTES.md, each one with what it looks like when it fails:

  • The webhook signature against your secret. When it fails, the handler answers 401 and with Meta the message doesn't arrive, with no error in sight.
  • Meta's permanent token, not the 24-hour one. When it fails, everything works the first afternoon and by the next morning there's a 401 on every send, with no change on your side.
  • The reminder template, approved before booking the first real appointment.
  • The leads table and the write permission on your key.

Nine fields no test asserts

The census found them and they're published by name, not hidden:

calificacion/intencion          crm/resumen
calificacion/urgencia           crm/proximo_paso
respuesta/objecion_detectada    crm/proximo_paso_fecha
respuesta/objecion_en_playbook  pregunta
                                supuestos

The worst of the nine is objecion_en_playbook: what it decides is whether the playbook was looked up or not, which is the only thing separating this agent from a menu bot.

A blocked path

For Google Calendar, authorized_user goes all the way. service_account is stopped: the token asks for a JWT signed with RS256 and no library that does it is in PINES.md. It's declared, not improvised.