# reactive prompt models rosetta stone

- Status: `experiment`
- Track: [reactive prompt architectures](https://aifoc.us/labs/reactive-prompts/)
- Layer: 5. Local Compute, Wasm & Zero-Framework UI
- Updated: 1 December 2026
- Live demo: https://reactive-prompt-rosetta.kinlan-test.workers.dev
- Source: https://github.com/PaulKinlan/reactive-prompt-rosetta

## Inspired by

- [the projects behind my ai focus posts](https://aifoc.us/projects/)
- [what falling ai model latency means for the web](https://aifoc.us/latency/)

## Hypothesis

- **Claim:** Replacing bare synchronous `effect()` subscriptions with async epoch barriers, cancelable observables, structural JSON early cutoff, keyed IVM, and event-sourced human pinning eliminates all five failure classes from `@paulkinlan/reactive-prompt`.
- **Confirms it:** Across identical 6-scenario torture tests and the 5-node Spec-to-PRD pipeline, naive `effect()` fails all five pathologies while specialized engines record 0 glitches, 0 race corruptions, 0 jitter cascades, and preserved human edits.
- **Falsifies or bounds it:** Combined epoch barriers and structural early cutoff introduce deadlocks or fail to beat imperative request-cancellation wrappers in code simplicity.

> **Why this exists:** Choosing how to make prompts reactive is difficult when each abstraction lives in a separate blog post with a different example app. Running six distinct reactive architectures—classic `@paulkinlan/reactive-prompt` `effect()`, Async Resource Signals with epoch barriers, WICG [`Observable`](https://wicg.github.io/observable/) (`switchMap` / `exhaustMap` / `concatMap`), Salsa-style JSON early-cutoff diffing, keyed Collection IVM, and event-sourced human pinning—against the exact same six torture tests and a 5-node Spec-to-PRD app isolates where each abstraction succeeds or fails.


## What this lab tests

[Reactive Prompt Rosetta Stone](https://reactive-prompt-rosetta.kinlan-test.workers.dev) ([GitHub](https://github.com/PaulKinlan/reactive-prompt-rosetta)) compares all six engines live over an abort-aware Cloudflare Worker NDJSON stream (`/api/prompt-step`) and feature-detected Chrome Built-in AI (`LanguageModel`), displaying core engine snippets alongside calls fired, aborted requests, early cutoffs, glitches, race corruptions, and preserved manual edits.

```js
// Async Resource epoch barrier + Salsa structural early-cutoff
const plan = createPromptResource({
  deps: [requirements, risks], // epoch join waits until both match generation v
  earlyCutoffKey: (json) => canonicalHash(json.fields), // ignores wording jitter
  run: (inputs, signal) => streamPromptStep("/api/prompt-step", inputs, { signal }),
});
```


## Open questions to iterate on

- Can a single lightweight Web primitive combine Async Resource epochs, Salsa JSON cutoff, and human-pin conflict states in < 200 lines?
- How does built-in `LanguageModel` local streaming latency shift the optimal cancellation policy (`switchMap` vs. `debounce`)?

## Iteration log

- **2026-12-01:** Built 6-engine Rosetta Stone harness with 6 isolated failure-mode torture tests, 5-node Spec-to-PRD app, and live NDJSON worker stream.
- **2026-12-01:** Moved the 6-engine torture matrix and Spec-to-PRD workbench ahead of the setup blueprint, added DOM-only syntax highlighting for engine code and wire logs, tightened 700px embed wrapping, and applied no-cache headers across HTML, CSS, and JS assets.

## Primitives tested

- `Async Resource Signals`
- `WICG Observable`
- `Salsa Early-Cutoff`
- `Collection IVM`
- `Event-Sourced Pinning`

## Connected labs in other tracks

- [declarative <ai-prompt> cells & pinning studio](https://aifoc.us/labs/reactive-prompts/reactive-prompt-cells/) — Tests HTML custom-element encapsulation of these reactive primitives.
- [backward-chaining goal-driven reactive ui](https://aifoc.us/labs/reactive-prompts/reactive-goal-ui/) — Flips push DAGs around into pull-based minimal missing-input solvers.

---
Canonical: https://aifoc.us/labs/reactive-prompts/reactive-prompt-rosetta/
