Weekend Alpha · Technical facilitators
Technical facilitator guide: Klarbuch support agent
Facilitators only. Do not share with teams. Pair with the business facilitator guide (business-facilitator.html) for what the right answer is. This page covers how teams build the agent and what tends to break.
Your role
You keep teams shipping. Most of what goes wrong is plumbing: a webhook that times out, a crash that loses tickets, a duplicate action, a close sent too early. Unblock teams fast, then steer them toward an architecture where code handles lookups, prices and policy, the model reads the message and writes the reply, and a security gate runs before the model. Never show teams data/klarbuch.db, answers.json or state.db, and never use the facilitator view (x-view-team) to tell them what the reviewer or simulated customer said.
What teams have
GET /files?name=snapshot.db: SQLite, history up to the cutoff 2025-09-15. Tables:companies, contacts, advisors, plans, subscriptions, advisor_contracts, addon_orders, invoices, invoice_items, payments, refunds, credits, tickets, ticket_messages, advisor_requests. Tickets have no category and credits have no kind, so teams must infer both.GET /files?name=price-lists.zip: 228 PDFs, 100 advisors. 37 are scans with no text layer (need OCR). There are duplicates, newsletters and superseded versions; the longest is 129 pages.GET /files?name=app-screens.zip: current app screenshots for how-to answers.GET /records/:table: records created after the cutoff (new invoices, payments, orders), released on the run's clock. Live tickets often reference these, so teams that only use snapshot.db will get answers wrong.- Docs:
/docs,/openapi.json,/llms.txt. Sandbox:POST /sandbox/start(20 practice tickets, resettable).
The flow and the contract
1. PUT /teams/me/webhook: queue POSTs {"type":"webhook.verification","challenge":"…"}; the endpoint must return 200 with the challenge (raw or {"challenge": "…"}). First verification starts the 4-hour run. 2. Events arrive signed: x-signature: t=<unix>,v1=<hex HMAC-SHA256(secret, t + "." + rawBody)>. Verify on the raw body. 3. ticket.created → GET /tickets/:id (subject, description, channel, requester only). 4. POST /tickets/:id/actions with {action: "reply"|"escalate"|"close", body} and a required Idempotency-Key header. Same key + same body returns the original result. Same key + different body returns 422. 5. Customer answers later as ticket.message_created (at most twice). The agent acts again on each one. 6. GET /events?after=<seq> returns the same log as the webhook. Use it to catch up after a restart.
Pace: 20 tickets/min (one every 3 s), about 4,800 tickets in the run.
Where teams get stuck (in rough order of the day)
| Problem | Cause | Fix to suggest |
|---|---|---|
| Webhook won't verify | Tunnel not running, wrong path, returns JSON with wrong shape, or non-200 | Test with curl through the tunnel URL, echo the challenge exactly |
| Signature check always fails | Hashing parsed/re-serialized JSON instead of raw bytes, or forgetting t + "." | Read the raw body before any JSON middleware |
| Delivery stalls / everything gets slow | Handler calls the LLM inline. The webhook has a 5 s timeout, delivery is in order, and a failure blocks the queue with backoff (15 s → 30 s → … → 10 min cap) | Ack 200 immediately, enqueue, process async. Most important fix of the day |
| Can't keep up with 20/min | Serial processing, slow model, one call per DB lookup | Worker pool / concurrency, cheap classifier first, cache advisor price lists in memory |
| Tickets lost after a crash/redeploy | Only consumed the webhook | Persist the last seq. On boot, replay GET /events?after=seq |
| Duplicate replies | Webhook retries + /events catch-up, or retrying a 500 with a new key | Dedupe on event seq. Idempotency key deterministic per decision, e.g. ticketId:turnN, reused on retry |
| 422 on actions | Reused a key with a different body (e.g. regenerated the LLM text on retry) | Store the decided body with the key and resend exactly that |
| Random 500s | Intentional (error_rate set by facilitators) | Retry with backoff, same key. Not a bug in their code |
| Customer "gives up annoyed" | Sent the same reply twice, or the second answer still fell short | Keep conversation state per ticket and include prior turns in the prompt |
| Ticket reopens with a complaint | Closed right after replying | Close only after the customer says they need nothing more. For noise (thanks/auto-reply/spam), close directly |
| Answers reference nonexistent invoices | Only queried snapshot.db | Also query /records/* for post-cutoff data |
| Wrong customer | Matched by name, or the email belongs to two companies | Match requester email → contacts. If it matches more than one company, ask which one |
| Hallucinated prices | Model reads PDFs at runtime or guesses | Offline pipeline: PDF → text (OCR for scans) → pick current version (valid-from date) → one normalized table per advisor (service, unit, net/gross, tiers, source file and page). Agent looks up and computes; never free-generates numbers |
| Wrong price version | Picked newest file name, not valid-from vs invoice date | For invoice disputes, use the version valid on the invoice date. For quotes, use the current one |
| Credits invented by the model | Policy lives in the prompt | Policy as a function: inputs (working days waited, last credit date, tenure, failed payments in 6 mo) → decision and amount. Model only phrases it |
| Security ticket answered | No pre-model gate | Classifier/rules before generation. On hit, escalate with no reply body to the customer. One miss is a hard zero, so bias toward escalation here only |
| Spent the morning only on the PDFs | Over-engineering extraction | Start with the advisors who show up most in tickets. Ship the harness first, improve extraction iteratively |
| Burnt the run on a broken build | Started the live run before testing | Use the sandbox until a full ticket round-trip works. The run starts on first verify, so don't verify the prod URL early |
A healthy architecture (what to steer toward)
Useful checks to suggest
- Evaluate on history: run the agent over past tickets in
snapshot.dband compare with what the good human agents did and whether the customer cancelled. - Log every decision with the facts used. When a reply is wrong, the log shows if the fault was in lookup, policy or wording.
- Watch
/teamstatus (failed_attempts,next_attempt_at). A rising number means their webhook is failing and blocking the queue.
Facilitator controls
/facilitatorshows teams' live state.PUT /admin/settingswitherror_rateraises injected 500s. Raise it mid-run once teams are stable, and announce nothing.- Reset a rehearsal: stop the server and delete
data/state.db*.