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

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)

ProblemCauseFix to suggest
Webhook won't verifyTunnel not running, wrong path, returns JSON with wrong shape, or non-200Test with curl through the tunnel URL, echo the challenge exactly
Signature check always failsHashing parsed/re-serialized JSON instead of raw bytes, or forgetting t + "."Read the raw body before any JSON middleware
Delivery stalls / everything gets slowHandler 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/minSerial processing, slow model, one call per DB lookupWorker pool / concurrency, cheap classifier first, cache advisor price lists in memory
Tickets lost after a crash/redeployOnly consumed the webhookPersist the last seq. On boot, replay GET /events?after=seq
Duplicate repliesWebhook retries + /events catch-up, or retrying a 500 with a new keyDedupe on event seq. Idempotency key deterministic per decision, e.g. ticketId:turnN, reused on retry
422 on actionsReused 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 500sIntentional (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 shortKeep conversation state per ticket and include prior turns in the prompt
Ticket reopens with a complaintClosed right after replyingClose only after the customer says they need nothing more. For noise (thanks/auto-reply/spam), close directly
Answers reference nonexistent invoicesOnly queried snapshot.dbAlso query /records/* for post-cutoff data
Wrong customerMatched by name, or the email belongs to two companiesMatch requester email → contacts. If it matches more than one company, ask which one
Hallucinated pricesModel reads PDFs at runtime or guessesOffline 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 versionPicked newest file name, not valid-from vs invoice dateFor invoice disputes, use the version valid on the invoice date. For quotes, use the current one
Credits invented by the modelPolicy lives in the promptPolicy 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 answeredNo pre-model gateClassifier/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 PDFsOver-engineering extractionStart with the advisors who show up most in tickets. Ship the harness first, improve extraction iteratively
Burnt the run on a broken buildStarted the live run before testingUse 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)

Webhookticket.createdVerify signatureHMAC on raw bodyAck 200at once, under 5 sDurable queuededupe on seqOn bootGET /events?after=seqFetch ticketGET /tickets/:idIdentify companyemail → contactsSecurity gateruns before any LLMClassify intentLLM, fixed label setDeterministic toolsaccount, invoices, payments (+ /records)price lookup, policy functionWrite replyLLM, from facts onlyPOST actionIdempotency-Key per decisionretry 5xx with the same keyEscalateto a humanhitCustomer repliesmessage_createdreload thread stateLLM step: everything else is plain code

Useful checks to suggest

Facilitator controls