Contextfulv0.23.0

Docs / Guides

contract topology · 01-topology.md · guide · card

System topology

The problem topology solves

An operator chooses a Contextful binary and a place to run it. Contextful runs connectors, stores their output as Parquet files and serves queries under access controls. The engine carries no business rules; applications supply domain meaning (domain-neutral).

Three components, three shared contracts

One Cargo workspace builds execution, storage and query code (workspace). The components share exactly three contracts: the connector interface, the part and manifest layout, and the capability-token format (three-crossings).

Because every binary shares the layout, a query-only binary reads what a full binary wrote (run-path-droppable). A function returning stored rows requires an access-control admission value, so a call omitting it fails to compile (mediation).

Build profiles

Each build profile is a Cargo feature bundle chosen at build time (profile). contextful-full runs connectors, schedules work and serves queries (full-profile). contextful-edge syncs stored files and serves read-only SQL (edge-profile).

contextful-control edits team configuration and applies canonical TOML (control-profile). No run-time detection widens a running binary into another profile (fixed-at-build). A subcommand needing an unlinked capability fails, naming the subcommand and profile (capability-absent).

Coordinating writers

Coordination rests on one property: a linearizable conditional write (primitive). Each new lease holder gets a higher fence, so a stale writer’s fence sits below the holder’s (fence-advances). A single node uses a local catalog file, a cluster uses Postgres, and Cloudflare uses D1 (backends).

One deployment, end to end

A Linux writer syncs corpus files to R2. A Cloudflare Linux Container reads a synchronized copy behind the gateway, the Worker that receives each caller’s request and forwards it with the caller’s credential. The deployment maps show every provider’s shapes.

Flowchart diagram Flowchart, top to bottom. 9 nodes, 8 edges. MCP or HTTP client → gateway [query + credential] Linux writer processes: pipeline serve scheduler → Wasmtime component host [spawn child] Linux writer processes / contextful pipeline run child: Wasmtime component host → Parquet and manifest files [parts + manifest] Linux writer processes: Parquet and manifest files → R2 corpus bucket [push] Cloudflare: gateway → Rust HTTP handlers [HTTP + same credential] Cloudflare: R2 corpus bucket → local snapshot files [S3 API hydration] Cloudflare / Linux Container running contextful-edge: Rust HTTP handlers → DuckDB library [admit query] Cloudflare / Linux Container running contextful-edge: DuckDB library → local snapshot files [scan snapshot] Cloudflare / Linux Container running contextful-edge: local snapshot files Linux writer processes contextful pipeline run child Wasmtime component host spawn child parts + manifest pipeline serve scheduler Parquet and manifest files Cloudflare Linux Container runningcontextful-edge admit query scan snapshot Rust HTTP handlers DuckDB library local snapshot files S3 API hydration HTTP + same credential gateway R2 corpus bucket push query + credential MCP or HTTP client

One reconciler at a time holds the deployment’s cadence lease (cadence-lease-ttl) and renews it while the applied document schedules work (cadence-lease-renewal). A run child invokes the connector, and the writer advances its cursor by one conditional update (cursor-cas).

Bucket sync copies the corpus to R2, and the edge binary pulls it and serves queries. The gateway forwards a caller’s request to the query container, which reaches readiness before it finishes loading stored data (container-readiness).

The deployment probe checks each hostname against its declared access policy. A public response on a private hostname fails the probe (posture-mismatch). A parity check compares each target’s parts with the reference deployment’s parts (parity).

Deploying on AWS

On AWS every process runs the contextful-full binary as a Fargate task, a container AWS runs with no server to manage. S3 holds the corpus and RDS PostgreSQL holds the catalog and execution state, so a task’s disk is a rebuildable cache (container-profile).

Two kinds of task share that state. A scheduled task runs due pipelines and exits. A long-lived contextful serve task answers reads behind a load balancer, and its health check passes once stored data has loaded (health-hydrated). Tasks reach S3 through their IAM role rather than stored keys (role-credentials).

The deployment maps name the service filling each role, and the Fargate runbook provisions them step by step.