AI Focus

declarative <ai-prompt> cells & pinning studio

Imperative effect() subscriptions hide dependency edges inside JavaScript closures, leak listeners across re-renders, trigger unwanted token spend on every keystroke, and silently overwrite manual human edits when an upstream input changes. Treating every prompt as a spreadsheet cell encoded in HTML custom-element attributes makes the graph DevTools-inspectable, scopes cost policies (auto, debounce, manual, frozen), and preserves user edits via a conflict resolution state.

Hypothesis

Encoding prompt dependencies and execution gates (auto, debounce, manual, frozen, switch/exhaust) as <ai-prompt> custom elements eliminates listener leaks, exposes topology in DevTools, and protects manual human edits.

What confirms it: Detaching an <ai-prompt> node aborts active fetches via disconnectedCallback(), identical prompt+config hashes hit content-addressed cache, and upstream changes enter conflict instead of overwriting pinned cells.

What falsifies or bounds it: HTML attribute bindings become unwieldy for nested object schemas or deeply branching array rows compared to keyed JS IVM collections.

Declarative <ai-prompt> Web Components exposing watch, policy, and auto/debounce/manual/frozen gates alongside content-addressed caching, human pin conflict resolution, and keyed IVM tables. Open declarative <ai-prompt> cells & pinning studio full screen ↗

What this lab tests

Declarative Prompt Cells (GitHub) implements <ai-prompt> Custom Elements wired with content-addressed caching (hash(promptText, config)), disconnectedCallback() AbortController teardown, human pin/conflict/merge controls, and keyed Collection IVM feature tables.

<ai-prompt id="cell-brief" watch="#product, #audience" mode="auto" policy="switch">
  Draft an executive brief for ${#product} aimed at ${#audience}.
</ai-prompt>
<ai-prompt id="cell-faq" watch="#cell-brief" mode="manual" policy="exhaust">
  Generate customer FAQs from ${#cell-brief}.
</ai-prompt>

Open questions

  • What HTML element API (ElementInternals, form participation, shadowRoot) makes <ai-prompt> drop cleanly into existing <form> flows?
  • What three-way merge UX works best when an upstream input changes underneath a human-pinned cell?

Iteration log

  • — Implemented <ai-prompt> Web Component runtime, content-addressed cache, keep/accept/merge conflict states, and keyed Collection IVM table.
  • — Moved the live <ai-prompt> workbench ahead of setup docs, added CSP-safe DOM syntax highlighting across setup snippets, live DOM snapshots, and wire/cache/scrubber inspectors, hardened 700px embed wrapping, and enforced no-cache headers across HTML, CSS, and JS assets.

Primitives tested: Custom Elements (<ai-prompt>), Content-Addressed Cache, Human Override Pinning, Keyed Collection IVM.

This is an active lab under /labs/ and stays off the main RSS feed until graduated into a full essay.

More in reactive prompt architectures

Connected labs

← reactive prompt architectures · All labs