// Commissions · shipped May 2026
Klay is a senior marketing consultancy. Its client wall lists Airbus, Barclays, Emaar, Johnson & Johnson, and PwC. I rebuilt its Squarespace site as a custom PHP/SQLite platform around a Claude-powered Marketing Clarity Diagnosis.
The problem
Leadership teams often can’t tell where their marketing problem actually sits: clarity, structure, or drift. Klay had a calculator for it, buried in a Typeform embed on Squarespace 7.1. The diagnosis deserved to be the product, not a form.
What it does
A 6-stage, 22-question form with client-side branching and server-authoritative validation feeds a layered engine:
- Pass 0: deterministic scoring. A faithful port of Klay’s calculator: threshold engine, 6 routing rules plus 1 override, 20+ variables. Instant.
- Pass 1: initial diagnosis. claude-sonnet-4-6, direct calls to the Anthropic Messages API (no SDK, no proxy), writes a first diagnosis from the freeform answers and can override the threshold call.
- Pass 2: brand research. Web search, hard-capped at 8 uses, grounds the diagnosis in the respondent’s public brand. Skipped without brand inputs.
- Pass 3: synthesis. The final written diagnosis; it cannot change the path. If it fails, the respondent still gets Pass 1’s output.
Each respondent lands on one of three engagement paths: Advisory (clarity), Blueprint (structure), or Strategic Oversight (drift). The path resolves in 35–115s, synchronous.
- PHP 8.2 · no framework, no Composer
- SQLite · WAL
- Vanilla JS · no build step
- Claude API · claude-sonnet-4-6
- Docker · nginx + PHP-FPM on DarkTower
Receipts
- The whole diagnosis stack (pipeline, admin portal, CMS) is 17 PHP files under 4,400 lines. No framework, no Composer, no bundler.
- Every pipeline artifact persists verbatim in SQLite: request body, raw response, parsed JSON per pass, totaling 30+ columns per submission.
- The CMS lets a non-engineer edit questions, branching, and scoring weights; publishing runs 8 invariants, the scoring suite, and a 50-submission replay: 13 production submissions replayed, 0 recommendation flips.
- v0.1.0 to v0.3.1 shipped in 2 days (2026-05-03 to 2026-05-04).
- Analytics is GoAccess on server logs. No Google Analytics, no cookies, no trackers.
Status
Private commercial work for Klay. The repo stays closed; a handover doc covers prompts, scoring matrix, and architecture. Shipped and took production submissions in May 2026 on a staging hostname; the meetklay.com cutover is still pending, so Squarespace holds the domain for now. Part of Commissions: client work, shipped.
Links: private client build. Walkthrough on request.
