reactive dom signals for prompts
In multi-step generation workflows, editing a single word in one input field often re-runs the entire pipeline from scratch and wastes money, or produces stale out-of-order streams when two edits overlap. Modeling prompt pipelines as a reactive DOM signal graph automatically aborts obsolete in-flight fetch() streams via AbortController while reusing cached outputs from unaffected steps.
Hypothesis
Modeling multi-step prompt workflows as a dependency DAG triggered by DOM mutations prevents wasted sibling reruns via structured-clone caching and avoids stale race overwrites via
AbortController.
What confirms it: Rapid edits to one leaf input abort superseded in-flight ReadableStream requests while unaffected upstream sibling nodes report cache hits.
What falsifies or bounds it: Chained downstream prompts re-execute redundantly when upstream edits produce semantically identical JSON values or abort storms throttle edge limits.
What this lab tests
Reactive DOM Signals (GitHub) links MutationObserver text edits to a 5-node dependency DAG that caches unchanged sibling branches via structuredClone and aborts superseded ReadableStream responses through AbortController.
Open questions
- How far can structural early-cutoff diffing push cache hit rates across multi-turn document workflows?
- Which parts of DOM observation belong in
MutationObserverversus explicit custom elements like<ai-prompt>?
Iteration log
- — Built
MutationObserver5-node DAG scheduler withstructuredClonememoization and NDJSONAbortControllerteardown. - — Reordered the page around the hypothesis and live DAG demo, added CSP-safe DOM syntax highlighting for setup code and JSON inspectors, tightened 700px embed responsiveness, and enforced no-cache headers across HTML, CSS, and JS assets.
Primitives tested: AbortController, MutationObserver, Structured Clone Cache, ReadableStream.
This is an active lab under /labs/ and stays off the main RSS feed until graduated into a full essay.