reactive prompt models rosetta stone
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 (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.
Hypothesis
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.
What 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.
What falsifies or bounds it: Combined epoch barriers and structural early cutoff introduce deadlocks or fail to beat imperative request-cancellation wrappers in code simplicity.
What this lab tests
Reactive Prompt Rosetta Stone (GitHub) 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.
// 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
- 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
LanguageModellocal streaming latency shift the optimal cancellation policy (switchMapvs.debounce)?
Iteration log
- — Built 6-engine Rosetta Stone harness with 6 isolated failure-mode torture tests, 5-node Spec-to-PRD app, and live NDJSON worker stream.
- — 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.
This is an active lab under /labs/ and stays off the main RSS feed until graduated into a full essay.