Platform Architecture · KWL Cadence

Platform architecture (the mental model)

Internal onboarding. High level on purpose — the aim is to understand how the pieces fit, not how they’re built. If you can draw this from memory, you’ve got it.

The whole platform in five layers

Collect → Transform → Signals → Publish → Judgement

  1. Collect. We gather public and official behavioural signals for each market — what people search, the music they play, the tone of the news, what they read about, what they watch, and which brands are advertising, plus official macro statistics. All public or official, no surveys, no personal data, essentially zero licence cost.
  2. Transform. Raw signals aren’t comparable out of the box, so we clean and normalise them — rescale, compare like-for-like across years, separate global trends from local moves — until a number means the same thing in every market.
  3. Signals → the read. Those signals become a market’s behavioural read: its mood, whether shoppers are trading down, whether premium is holding, whether the felt mood agrees with the economy. This is “how the market behaves”.
  4. Publish. The same read becomes three things: a Report, a Field Note, and the Cadence Skill (the read queryable inside the buyer’s own AI).
  5. Judgement. A human sits at the end of the pipeline, sense-checking, never at the start inventing the story.

The major components

The two ideas that matter most

The systems view

Three ways to look at the same platform: where it runs (cloud), how it’s stacked (software), and how data moves (flow).

1 · Cloud layers — where things run

 EXTERNAL SOURCES            BUILD MACHINE                 EDGE  (Cloudflare)
 (public / official)         (runs quarterly)              (always-on, global)
 ┌───────────────────┐       ┌────────────────────┐        ┌───────────────────┐
 │ Eurostat · Google │       │  the pipeline      │        │ website + reports │
 │ Trends · GDELT ·  │  ──▶  │  (collect→transform│  ──▶   │ Field Notes       │
 │ Wikipedia ·       │       │   →generate)       │        │ Cadence Skill     │
 │ Netflix · Spotify │       │  + Athena (music)  │        │ forms + accounts  │
 │ charts · Ads      │       └────────────────────┘        └───────────────────┘
 └───────────────────┘        makes the data                serves the customer

The build machine makes the data (quarterly). The edge serves it (all the time, worldwide). Customers never touch the build machine.

2 · Software layers — the stack

   what customers touch ▲
 ┌──────────────────────────────────────────────────────────────────┐
 │ 5  SURFACES     Website · Reports (web + PDF) · Field Notes · Skill │
 │ 4  PUBLISH      generator composes the read into each surface       │
 │ 3  DATA         editions/<market>.json + europe.json  ◀ source of truth
 │ 2  TRANSFORM    clean · normalise · combine into signals            │
 │ 1  COLLECT      fetchers pull the 7 signal families                 │
 └──────────────────────────────────────────────────────────────────┘
   raw public data ▼

Everything above layer 3 reads from the same data (layer 3), so the website, the reports and the Skill can never disagree.

3 · The flow — how data moves

 Sources ──▶ Collect ──▶ Transform ──▶ Signals  (= "the read" per market)
                                          │
                          ┌───────────────┼───────────────┐
                          ▼               ▼               ▼
                       Report         Field Note      Cadence Skill
                          └──── one source of truth · human-reviewed ────┘

Deeper — the architecture (implementation-lead level)

Skip this on day one; come back when you want the real shape.

Compute & where state lives. - Build machine (AWS Lightsail). Runs the Python pipeline quarterly. Raw signals land in per-family SQLite databases (kwl_macro.db; kwl_google_trends.db; kwl_media.db for GDELT / Wikipedia / Netflix). The music family is the exception — chart × audio data lives in AWS Athena (charts_poc_<m>_v2), queried over boto3. So the pipeline is SQLite-local except a hard Athena dependency for music: if Athena is unavailable the music fields degrade to null and every other family still generates. - The edge (Cloudflare). The public site is a git-connected Pages project (cadence-site) that builds site/astro with npm run build:prod on every push to main. Pages Functions (/api/*) handle the forms, the passwordless magic-link auth, and the Paddle webhook; D1 (SQLite at the edge) stores form submissions plus the buyer accounts + entitlements. The Cadence Skill is a separate Cloudflare Worker serving a trimmed, receipted answer layer over REST + MCP. - Three environments, isolated: production (edge, customer-facing, highly available), build/dev (Lightsail — every secret + the pipeline), sandbox (intern — forks only). The governing rule: nothing customer-facing depends on the build machine being up — the generated data is committed to git, so the site keeps serving even if the box is off.

The data contract (the source of truth). Each market compiles to editions/<m>.json: a signals object (macro stance, mood, divergence, discourse, trade-down, premium, sound), the narrative (headline / lede / read / speak / watch), keyPoints (evidence chips, each {claim, receipt}), brandActivity (demand × supply), and the raw family blocks. europe.json is the cross-market layer. Website, PDF renders and the Skill all read these, so they cannot disagree.

Design decisions worth knowing. - Generated, not authored — prose is composed by templates keyed to a story type, never per-market, so an 11th market self-writes. - No PII — public/official aggregate data only → GDPR Recital 26 out-of-scope → light procurement, clean acquirer due diligence. - Near-zero marginal cost — free/public data, no panel, two people. The moat is the method plus the accruing history, not the data pile. - Athena is a build-time dependency, not a runtime one — the edge never calls AWS (except a future Skill v1 with cached deep cuts).


Next: Data pipeline · Publishing workflow · Analytics methodology.