All articles
    architecture
    idempotency
    determinism
    context-runtime
    mission-runtime
    discovery-runtime
    database-systems
    event-sourcing
    replay
    verification
    governance
    provenance
    aiengineering
    llmops
    genai

    The Evolution of a Runtime Stack: How Idempotency Rebuilt Database Systems for AI

    August 5, 2026redevops.io
    The Evolution of a Runtime Stack: How Idempotency Rebuilt Database Systems for AI

    Editor's note, October 2026: This article was accurate when it was published on 5 August 2026: the project's code was then licensed under AGPL-3.0-or-later alone, which is open source. On 8 August 2026 the Commons Clause was added, so current versions of the rAIls components are source-available rather than open source as the Open Source Initiative defines it. Versions released before that date remain available under AGPL-3.0-or-later. References to third-party open-source projects are unaffected.

    Idempotency as an operations pillar, and the database-systems discipline a stack of AI runtimes kept rediscovering, one source of nondeterminism at a time.

    The project started with a much smaller question (multiple runtimes and an AI operating system still ahead):

    Can an AI system make the same decision twice?

    Traditional RAG cannot. A user asks the same question twice. Different chunks are retrieved. The context window changes. The model produces a different answer, and nothing in the system explains why. What follows is the honest account of chasing that one property through the whole stack, and where it led.

    Part I: Make retrieval deterministic

    The first objective was introducing idempotency into retrieval. Retrieval became a deterministic artifact where it had been whatever the vector database returned today: chunk identifiers, retrieval provenance, ranking evidence, reference-based context, immutable snapshots.

    The first insight was that references matter more than retrieved text. Retrieval stopped returning prose and started returning an ArtifactHandle: a stable, content-addressed identifier plus its provenance and the ranking evidence that surfaced it. What a model finally sees is a ContextView, materialized from those handles on demand, never a copy pasted forward. Store the same value twice and one copy eventually goes stale; store the reference and there is exactly one source of truth to dereference.

    This is database normalization, arrived at from the retrieval side. And it bought the thing the rest of the platform is built on: a falsifiable claim. Ask the same question twice and you get the same chunk identifiers, provably. Recall@k became a deterministic, contamination-immune measurement; the same corpora, scored through three independent implementations (Python, Go, and a JVM retriever), land within ~2% of each other. Determinism was what made every later claim testable.

    Part II: Context became an executable plan

    Once retrieval was deterministic, the next problem appeared: every application was manually deciding which retriever, which reranker, how much context, which model, what order, what budget. Each app solved it differently. The application was implementing a planner, badly, and in a dozen incompatible ways.

    That became the Context Runtime. Applications began asking "I need enough evidence to answer this question under these constraints" where they had asked "give me documents." The same shift SQL made over hand-written record access: from imperative fetching to a declarative statement of intent a planner is free to satisfy optimally.

    Under the hood the plan is a decision across six orthogonal axes (representation, retrieval, reasoning, model, topology, and verification) that collapse into one canonical, explainable ExecutionPlan carrying its own cost, latency, and quality estimates. A query planner and optimizer in everything but name, down to the EXPLAIN it can emit for any decision. And it earns its keep: routing each question to the method proven to answer that kind beats any single fixed method (measured routing accuracy 0.883 against every fixed baseline). There is no universal best encoder either: the right embedder depends on the corpus's language and domain, which is exactly why a planner is the correct abstraction.

    Part III: Execution held all the nondeterminism

    The system could now reliably answer questions. It still couldn't reliably perform work. Execution contained everything left: retries, human approval, rollback, auditing, side effects, resumability, verification.

    This produced the Mission Runtime. The system executed compiled missions where it had executed prompts: goal → logical plan → physical graph → verified execution → replayable evidence. Here the database lineage stops being an analogy and becomes the design.

    Each AI execution problem turned out to be a database discipline: event sourcing is a write-ahead log; replay is crash recovery; compensation is the saga pattern; human approval is a two-phase commit gate; leased concurrency is locking; the hash-chained ledger is a tamper-evident audit; reference-first artifacts are normalization; verification planes are CHECK constraints reproduced from an independent source.
    Scroll the diagram sideways to read itFull size

    Event sourcing is a write-ahead log. Replay is crash recovery from that log: a mission resumes, or reconstructs, by re-reading its own events. Compensation is the saga pattern, and it fires on execution failure: a plan that is declined never ran, so there's nothing to unwind; a plan that half-executed rolls back the steps already taken. Human approval is a two-phase gate on side effects. Concurrency uses leases; the physical graph is lowered into parallel waves the way an optimizer schedules a query. The ledger is append-only and hash-chained, so it's tamper-evident: you can prove the record wasn't rewritten after the fact.

    The invariant that ties it together is recovery: a mission must replay to the same terminal state from its ledger. That single property is what makes execution auditable, resumable, and regression-testable at once. And the deeper realization: context planning and execution planning are two different optimization problems (what each node should know versus how the graph should run), and collapsing them into one layer is exactly the mistake that makes agent frameworks unpredictable.

    Part IV: Discovery proposes; it doesn't execute

    After the Mission Runtime, another gap: nothing explained where missions came from. Eventually the system itself needed to notice "this investigation should exist."

    That became the Discovery Runtime. Discovery proposes and does not execute. It produces opportunities, and those opportunities compile through exactly the same Mission pipeline as human-authored work. One compiler, three sources: human, application, discovery. This is the discipline a database applies to writes: every statement, whoever issued it, goes through one planner and one execution path. There is no privileged back door that skips validation.

    A proposal carries two distinct kinds of provenance the pipeline keeps separate: origin (what triggered it) and domain_context (the epistemic record of each input: stated, inferred, unresolved, contradicted, defaulted, or confirmed). Conflating the two is how systems quietly launder a guess into a fact; keeping them apart is what lets a mission explain what it did and how sure it was. The guarantee is behavioral: a human-authored mission and a discovered one must validate, simulate, run, replay, and verify identically, differing only in that recorded provenance.

    Part V: One rule wearing eight disguises

    Making the runtimes deterministic uncovered problems that looked unrelated. They were related. Every one was another form of hidden state: the same enemy the database world spent decades naming.

    • Reference-first artifacts: store references; storing the number twice means one copy becomes wrong (the update anomaly, precisely).
    • Immutable revisions: append; an append-only log is the only shape that survives replay.
    • Read-only view models: worksheets resolve references; a materialized view that recomputes on read is a bug with a UI.
    • Proposal workflow: models produce proposals that humans or policy apply. The model sits on the read side of the write path.
    • Verification planes: every stored claim must be independently reproducible; identity, derived state, comparability, and presentation each get their own verifier (CHECK constraints, except each reproduces the claim from an independent source, the stored value untrusted).
    • Ownership reachability: a control is not implemented until the production path cannot bypass it.
    • Constructed invalid state: a guard is not tested until a fixture deliberately builds the state it rejects. Many of the project's biggest bugs hid exactly here: tests asserting against a state they never actually constructed.
    • Independent representations: a consistency check can't compare a representation to itself; every parity check eventually became a comparison of two independently produced sources, after starting as that tautology.

    These are one rule with a generalized form. The platform gives it a ladder: a contract is SPECIFIED with no live adopter, CONFORMANT when an adapter round-trips its golden fixtures, and only DEPLOYED_CONFORMANT when the deployed path both produces and verifies the artifact. Reproducing a golden hash proves translation and leaves adoption unproven. Reproducible under an independent path, or it doesn't count.

    Part VI: Mission DevOps

    Once missions were executable artifacts, another observation: mission execution resembles software delivery. Software.

    Mission DevOps: a lifecycle over one versioned artifact, the MissionProgram: Validate, Explain, Profile, Simulate, Run, Replay, Verify, Bundle, CI. Explain is the plan; Profile is EXPLAIN ANALYZE for a mission; Simulate is a dry run; Replay reconstructs a past run from its ledger.
    Scroll the diagram sideways to read itFull size

    The verbs are borrowed on purpose. Explain is the plan; Profile is EXPLAIN ANALYZE for a mission: the plan annotated with what it actually cost. Simulate is a dry run against the physical graph; Replay reconstructs a past run from its ledger; Verify re-establishes the invariants. Mission execution became something that can be promoted, replayed, audited, and regression-tested exactly like software, because, mechanically, that is now what it is.

    Part VII: Quantify stress-tested the whole thing

    Quantify turned out to be an application that became the stress test. Nearly every architectural invariant was discovered while implementing it: immutable worksheets, comparability semantics, proposal workflows, replay, verification, ownership, tenant isolation, transaction boundaries, PostgreSQL concurrency, JSON immutability, evidence preservation, read-only rendering, deterministic replay.

    Many weren't anticipated in the original Context Runtime. They emerged because the system was pushed into a domain where silent mistakes become financial mistakes. RSU vesting, disposition, and reconciliation don't tolerate a value that quietly recomputes: an immutable financial artifact must redeliver the identical result a year later, a worksheet must resolve and must not recalculate, and what leaves the tenant boundary is a signed snapshot proven to contain only what it should. A domain where a rounding drift is a restatement is the fastest way to find every place the architecture was still trusting stored state.

    Part VIII: The platform that emerged

    Looking backward, the architecture separates into distinct layers, each deciding one thing, with the common planes wrapped around all of them.

    The layered platform: Applications; the Discovery Runtime deciding what should exist; the Mission Runtime deciding how work executes; the Context Runtime deciding what evidence is needed; ReDevOps RAG resolving references into governed context; and Models, Tools and Humans at the base, wrapped by common planes for identity, policy, governance, verification, evidence, runtime events, evaluation and observability.
    Scroll the diagram sideways to read itFull size

    Beneath the runtimes, one more name became canonical, and the discipline it names exists precisely so the story above can't quietly reverse. agent-harness owns how a single model or tool step runs safely (clients, tools, sandbox, approvals, guardrails, evaluation). The shared contracts are held the same way (what a shared type means: schema identity, versioning, canonical serialization, and the golden fixtures every implementation must round-trip), and they live inside the public runtime itself, each pinned to a CONTRACT_VERSION and holding no algorithms of their own, owned by that runtime. Dependencies flow one direction (contracts at the bottom, deployment composition at the top), so no reference application, however important, ever becomes the accidental owner of reusable runtime behavior. The ownership map is the last idempotency guarantee: it keeps the architecture from drifting.

    The common theme

    The project appears to have produced many independent ideas: Context Runtime, Mission Runtime, Discovery Runtime, Mission SDK, Mission DevOps, reference-first context, worksheet architecture, verification planes, runtime contracts. In practice they are all instances of one engineering principle:

    Move decisions out of prompts and into deterministic, replayable, verifiable runtimes.

    Or, stated another way: traditional AI systems execute prompts; this platform executes governed artifacts. And there's a quieter observation underneath it. Nobody set out to rebuild database systems for AI execution: normalization, query planning, write-ahead logs, MVCC, constraints, one write path. Idempotency dragged the design there, one runtime at a time, because those are simply what it costs to make a decision you can make twice.

    The Python implementation of every runtime above is now open source. If you'd start from the code:

    • agentic-os: the Mission Runtime and execution / control plane.
    • context-runtime: the context query planner (the six-axis ExecutionPlan).
    • redevops-rag: the reference-first RAG substrate that resolves handles into governed context.
    • mission-sdk: the developer boundary: author, validate, explain and run a MissionProgram.

    Read the architecture: redevops.io/architecture · the ten whitepapers · the companion piece, A Different Layer of the AI Stack.

    #AIEngineering #LLMOps #SystemsDesign #Determinism #Idempotency #EventSourcing #DatabaseSystems #ContextRuntime #MissionRuntime #DiscoveryRuntime #Governance #Provenance #GenAI #AIInfrastructure

    Want ReDevOps in your Google Top Stories & AI results?Follow ReDevOps on Google