# attribution & metering protocol lab

- Status: `experiment`
- Track: [content negotiation, signed citations & attribution](https://aifoc.us/labs/web-protocols/)
- Layer: 7. Self-Observing Web, Evaluation & Economics
- Updated: 1 December 2026
- Live demo: https://attribution-metering-lab.kinlan-test.workers.dev
- Source: https://github.com/PaulKinlan/attribution-metering-lab

## Inspired by

- [A link is all you need](https://aifoc.us/a-link-is-all-you-need/)
- [hypermedia was always the point](https://aifoc.us/hypermedia/)

## Hypothesis

- **Claim:** Issuing signed `X-Attribution-Receipt` headers paired with `#:~:text=` deep links creates verifiable referral and audit signals that support metered discovery without forcing sites into binary crawler bans or hard paywalls.
- **Confirms it:** `/api/quote/:docId` issues verifiable HMAC receipts that settle cleanly inside the Durable Object `AttributionLedger` (`/api/click-receipt`), separating legitimate referred clicks from unsigned replays.
- **Falsifies or bounds it:** Strip-on-copy URL transformations by chat interfaces or aggregator proxies discard `#:~:text=` parameters and receipt headers unless browsers preserve provenance natively.

> **Why this exists:** When answer engines ingest and summarize publisher articles without sending verifiable referrals or attribution signals back, publishers are left paying crawl bandwidth costs with no feedback loop, driving them toward hard paywalls and crawler blocks. This lab prototypes lightweight cryptographic quote receipts (`X-Attribution-Receipt` + `#:~:text=` links) and models whether metered referral attribution preserves open discovery better than all-or-nothing blocking.


## What this lab tests

[Attribution & Metering Protocol Lab](https://attribution-metering-lab.kinlan-test.workers.dev) ([GitHub](https://github.com/PaulKinlan/attribution-metering-lab)) issues cryptographically signed `X-Attribution-Receipt` headers and [`#:~:text=` Text Fragment](https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Fragment/Text_fragments) links from `/api/quote/:docId`, verifies referral clicks at `/api/click-receipt` inside a Durable Object SQLite ledger (`AttributionLedger`), and models sustainability across three publisher monetization curves.



## Deeper Dive: Reactive Prompt Architectures (Beyond `effect()` Overload)

My earlier experiments—[`@paulkinlan/reactive-prompt`](https://github.com/PaulKinlan/reactive-prompt) ([npm](https://www.npmjs.com/package/@paulkinlan/reactive-prompt)) and [`reactive-agent`](https://github.com/PaulKinlan/reactive-agent), discussed in [the projects behind my ai focus posts](/projects/) and [what falling ai model latency means for the web](/latency/)—wired prompt chains with Preact `signal()` and `effect()`. Synchronous UI signals assume derivations are fast, deterministic, cheap, and acyclic. Wrapping slow, nondeterministic model calls in plain `effect()` chains creates five failure modes: immediate execution with `undefined` placeholders, out-of-order async race overwrites without cancellation, diamond glitches across sibling joins, downstream cascades triggered by minor phrasing jitter, and overwritten human edits.

Labs 23–26 push four alternative reactive models from focused single-bug torture tests up to multi-pane applications, including what authoring code looks like in each model.


## Open questions to iterate on

- What lightweight token/receipt propagation mechanism survives copy-paste or markdown link serialization cleanly?
- At what referral conversion rate do open publishers break even compared to blocking automated crawlers outright?

## Iteration log

- **2026-12-01:** Built signed `/api/quote/:docId`, Durable Object SQLite `AttributionLedger`, `#:~:text=` link emitter, and 3-model economics simulator.
- **2026-12-01:** Reordered workbench ahead of setup docs, added a Durable Object-logged strip-on-copy falsification test and accurate route snippets, added CSP-safe DOM syntax highlighting across wire/ledger views, hardened 700px layout, and routed static assets with `no-cache` headers.

## Primitives tested

- `Text Fragments (#:~:text=)`
- `HMAC-SHA256 Receipts`
- `Durable Object SQLite`
- `Economics Simulator`

## Connected labs in other tracks

- [signed web citations](https://aifoc.us/labs/web-protocols/signed-web-citations/) — Proves quote integrity with publisher public keys via RFC 9421.
- [hyper content negotiation lab](https://aifoc.us/labs/web-protocols/hyper-content-negotiation-lab/) — Tests compact `text/markdown` representations alongside metered access.

---
Canonical: https://aifoc.us/labs/web-protocols/attribution-metering-lab/
