Skip to content

Proposal: Deterministic Data Artifacts — reusable code-mode workflows with optional UI #3601

Closed

Description

@reachjalil

Summary

I’m proposing Deterministic Data Artifacts: reusable, typed, agent-authored programs that combine approved OpenWork Connect tools and repeatedly produce validated data without requiring an agent or model at execution time.

The core inversion is:

The artifact is the deterministic data capability. A custom React UI is an optional presentation layer over its output.

An artifact should be useful on its own as canonical JSON, deterministic Markdown, a saved feed, or an agent-callable local capability. A custom UI can be added when the data benefits from interaction or a specialized visual structure.

This issue is a proposal for team feedback, not a commitment to freeze every implementation detail. I have the product, runtime, security, storage, scheduling, UI/UX, and delivery boundaries scoped, but I’m happy to adjust the design as we learn.

Problem

Agents are good at discovering tools and designing a retrieval workflow, but repeatedly asking an agent to perform the same multi-step data gathering has drawbacks:

  • tool selection and arguments may vary from run to run;
  • every refresh consumes model time and tokens;
  • permissions and provider behavior are harder to audit;
  • results are difficult to replay or compare;
  • every new presentation surface reconstructs the same retrieval logic; and
  • unattended refresh depends on keeping an agent workflow alive.

The reusable asset is not only the generated dashboard or one answer. It is the proven retrieval-and-transformation program.

Proposal

A Data Artifact contains:

  • a human-readable manifest and purpose;
  • a typed input schema;
  • a restricted TypeScript program;
  • portable capability requirements and execution limits;
  • a typed output schema;
  • synthetic fixtures;
  • immutable builds, snapshots, and receipts; and
  • optional Markdown templates or React views.

The execution model is:

typed input
  -> restricted TypeScript program
  -> reviewed read-only Connect capabilities
  -> validated canonical JSON snapshot
  -> JSON | Markdown | saved feed | optional React view

The agent authors and improves the artifact. The activated artifact itself runs as bounded code with zero model calls and no OpenCode session.

Product principles

  1. Data first. Canonical validated JSON and lineage are the product primitive.
  2. UI is optional. React is an independently revisioned view, not part of data identity.
  3. Agents author; deterministic programs repeat.
  4. Humans grant authority. An agent may propose bindings, activation, and schedules but may not silently approve them.
  5. Read-only first. V1 supports reviewed read-only capabilities only.
  6. No hidden runtime discovery. Programs call literal portable aliases mapped to exact reviewed tools.
  7. Failures preserve last-known-good data.
  8. Scheduling reuses Automations. No second artifact-specific scheduler.
  9. Portable source and private runtime state are separate.

User experience

1. Author

A user asks for a reusable information workflow, for example:

Build a weekly launch briefing from Calendar and Gmail.

The agent first searches for a compatible existing artifact. If none exists, it creates the manifest, TypeScript program, schemas, requirements, and synthetic fixtures.

2. Review and activate

The user reviews each proposed capability binding:

  • portable alias and purpose;
  • exact provider tool;
  • read-only evidence;
  • schema digest;
  • allowed argument policy;
  • call and response limits; and
  • expiration or revocation state.

The artifact becomes locally discoverable only after the reviewed build is activated.

3. Run and reuse

The user or an agent can execute it with typed input and choose an explicit freshness policy:

  • latest: return the latest compatible snapshot and never call providers;
  • refresh: execute now;
  • max-age: use a recent compatible snapshot or execute.

One successful snapshot can be consumed as JSON, rendered as Markdown, saved as a feed, or presented through an optional view without another provider call.

4. Save and schedule

The user can save a parameterized invocation. Feeds belong to saved invocations because the input parameters are part of data identity.

A schedule wakes the exact registered runtime host and workspace and executes the same code without a model or conversation.

5. Add a custom view if useful

A React view can be built against the artifact’s output schema. It receives only validated snapshots and independent interaction state. Removing or disabling the view does not disable the artifact, feed, schedule, JSON, Markdown, or agent reuse.

Architecture

flowchart LR
    U["User or agent"] --> L["Local OpenWork artifact affordances"]
    L --> S["Artifact service"]
    S --> R["Restricted code-mode runtime"]
    R --> B["Host-owned capability broker"]
    B --> D["Den / OpenWork Connect"]
    D --> M["External MCP tools"]

    R --> V["Output validation"]
    V --> J["Private JSON snapshot + receipt"]

    J --> A["Agent / API"]
    J --> K["Markdown"]
    J --> F["Saved feed"]
    J --> W["Optional React view"]

    X["Den Automations"] --> H["Exact runtime host + workspace"]
    H --> S
Loading

Local artifact discovery

Activated workspace artifacts should be exposed through OpenWork’s existing local provider/affordance layer, for example through openwork_context and openwork_query.

They should not be registered as organization-wide Den capabilities. Den’s capability facade remains the downstream credentialed broker used by the host to call Connect tools.

Code-mode runtime

The agent-generated program receives only a narrow context:

export default async function run(ctx) {
  const events = await ctx.call("calendar.events", {
    start: ctx.input.start,
    end: ctx.input.end,
  })

  return normalize(events, ctx.logicalTime)
}

Available to the program:

  • validated input;
  • host-supplied logical time;
  • an optional previous validated snapshot;
  • bounded structured logging; and
  • ctx.call(alias, arguments) for reviewed aliases.

Not available:

  • credentials or connection IDs;
  • unrestricted capability search;
  • network or filesystem access;
  • environment/process APIs;
  • timers, ambient clock, or randomness;
  • provider SDKs;
  • browser/DOM APIs; or
  • calls to other artifacts in V1.

Execution should occur locally in the OpenWork server that owns the workspace, inside a killable isolate behind a replaceable port. A pure-WASM QuickJS adapter is the current preference, but it must prove Node/Electron and Bun packaging, asynchronous host callbacks, memory limits, interruption, cancellation, and disposal before adoption. Static checks, node:vm, or a worker thread alone are not sufficient security boundaries.

Capability and credential security

Artifact code calls portable aliases such as calendar.events, not concrete provider connections.

The host privately maps each alias to a reviewed exact capability. For strict artifact calls, Den should:

  1. re-list the current provider tool;
  2. calculate its current schema and effect evidence;
  3. compare both against the reviewed digests;
  4. validate the arguments;
  5. reject unknown or write-capable effects; and
  6. only then contact the provider.

A failed precondition must report providerCallAttempted: false.

Provider credentials stay in Den. They never reach the artifact source, isolated runtime, snapshot, receipt, or optional view.

Runtime limits should cover program bytes, input depth/size, calls, argument bytes, response bytes, output bytes, logs, memory, per-call time, and total execution time.

Storage model

Portable workspace source

<workspace>/.opencode/openwork/data-artifacts/<slug>/
├── artifact.json
├── program.ts
├── program.json
├── input.schema.json
├── output.schema.json
├── fixtures/              # synthetic only
└── views/                 # optional
    ├── markdown/template.md
    └── react/
        ├── view.json
        ├── src/App.tsx
        └── styles.css

This tree is reviewable and portable. It contains no credentials, bindings, saved input values, provider-derived data, receipts, or host identity.

Private OpenWork runtime state

OpenWork-managed private storage owns:

  • activation and member opt-in;
  • exact bindings and connection identifiers;
  • schema/effect evidence;
  • saved invocation inputs and policies;
  • snapshots, feed heads, runs, and safe receipts;
  • view interaction state; and
  • stable runtime-host identity.

Raw provider responses are transient and are not persisted.

Den scheduling state

Den stores only the scheduling and targeting information it needs:

  • schedule and occurrence metadata;
  • owner/member;
  • opaque runtime-host and workspace target;
  • artifact and saved-invocation revisions;
  • claims, leases, cancellation, and terminal status; and
  • safe zero-model engine receipts.

Den does not store artifact source, saved input values, snapshot/feed contents, view state, or local paths.

Execution order

resolve owning workspace and activated revision
  -> validate and normalize input
  -> resolve latest / refresh / max-age
  -> return compatible cache hit, or create a run
  -> load and verify private bindings
  -> load the immutable program build
  -> start a fresh killable isolate
  -> execute bounded literal alias calls
  -> Den revalidates schema/effect/arguments before each provider call
  -> validate canonical output
  -> calculate output and data revisions
  -> atomically promote snapshot/feed head
  -> finalize a safe receipt
  -> project the same data revision to JSON, Markdown, or an optional view

Promotion happens last. Invalid input/output, provider failure, schema drift, timeout, cancellation, lease loss, or a promotion race must leave the previous successful snapshot current.

Scheduling

Scheduled refresh should extend the existing Automations protocol with a distinct data-artifact-refresh work kind.

A scheduled assignment pins:

  • stable runtimeHostId;
  • exact workspaceId;
  • artifact revision;
  • saved invocation and revision;
  • logical occurrence time; and
  • maximum runtime.

Only the runner advertising that host, workspace, and work kind may receive and claim the assignment. It must call the local Artifact Service directly and must not create a model session.

If the exact host is offline, moved, or no longer owns the workspace, the run becomes explicitly missed or needs attention. There is no fallback to another member runner, the active/first workspace, remote execution, or a model.

UI and UX

The proposed Data Artifact Studio is ordered around the data product:

  1. Overview — purpose, health, activation, discoverability, limits.
  2. Contract — typed inputs, outputs, examples, sensitivity.
  3. Program — source, diagnostics, fixtures, immutable build.
  4. Connections — requirements, reviewed bindings, drift/rebind state.
  5. Run — inputs, freshness, JSON, Markdown, output diff, receipt/history.
  6. Reuse — local agent identity and saved invocations.
  7. Refresh — feed, last/next run, schedule, pause, needs-attention.
  8. Views — optional Markdown template and React views.

The successful creation flow ends with a validated data result and reuse instructions, not a blank UI canvas.

Optional React view boundary

The view runs in an opaque-origin iframe with a restrictive CSP and a nonce-, instance-, sequence-, rate-, and size-bound message channel.

It receives only validated snapshot data and local interaction state. It receives no network, Connect, credentials, filesystem, registry, or scheduling surface.

Honest determinism

External providers can change, so this proposal does not claim identical live data forever.

The intended guarantee is:

The same artifact revision, normalized input, logical time, previous snapshot, provider responses, and runtime version produce the same validated output digest.

Synthetic fixtures provide exact replay. Live receipts preserve safe call and response/output digests for auditing.

Delivery shape

The proposed implementation order is:

  1. shared identities plus isolate and strict-Connect foundation proof;
  2. headless compiler/isolate/runner and private storage;
  3. owning-server execution, Studio, local agent reuse, JSON and Markdown;
  4. saved invocations, feeds, and exact-host scheduling; and
  5. optional React view backend and UX.

The first user-testable milestone is the complete manual/agent product: author, fixture, bind, activate, execute through real strict Connect, promote JSON, rediscover locally, render Markdown, and inspect the receipt.

Scheduling and custom views extend that milestone rather than delaying it.

Non-goals for V1

  • write-capable artifact bindings;
  • artifact-to-artifact calls inside the isolated program;
  • organization or cloud-hosted artifact execution;
  • a synchronized organization-wide Den artifact catalog;
  • interval/cron beyond the current Automations vocabulary;
  • migration from unmerged artifact experiments;
  • enabled definition/snapshot sharing or public links; and
  • treating a React view as the artifact’s canonical identity.

Feedback requested

I would especially value feedback on:

  1. Is data-first the right primitive, with React as an optional view?
  2. Should activated workspace artifacts use the local OpenWork affordance layer as proposed?
  3. Is read-only-only a suitable V1 authority boundary?
  4. Does the portable-source/private-state split match how we want artifacts to be copied and shared later?
  5. Are exact-host/workspace-pinned schedules the right local execution model?
  6. Are there important Connect, Automations, storage, security, or UX constraints missing?
  7. Which part should be narrowed or changed before implementation interfaces become expensive to move?

I’m happy to answer questions, adapt the scope, or change the architecture based on team feedback.

Activity

  1. OmarMcAdam commented on Oct 28, 2026

    @OmarMcAdam
    Member

    closed due to age, please reopen and tag me if still valid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions