Compatibility: Pactmark 0.1.x. All packages share one release version for the v0.1 line and are
published with per-package provenance.
The shape of the system
Figure 1. The kernel is provider-neutral by construction.core, runtime, policy,
evidence and agent avoid Node built-ins, environment reads and provider SDKs, which is what
lets the same agent implementation run on Node, a Next.js route and a Cloudflare Worker.
What each layer owns
Portable kernel — core, runtime, policy, evidence, agent
Portable kernel — core, runtime, policy, evidence, agent
core holds the domain: schemas, ports, events, authority types and the stable KAF_* error
registry. runtime orchestrates runs over those ports. policy implements default-deny
decisions, grants, canonicalization, kill switches and effect strategies. evidence handles
content-addressed artifacts, verification, redaction and pattern maturity. agent is the
ergonomic authoring surface most applications import.Execution and test — executor-in-process, testing
Execution and test — executor-in-process, testing
executor-in-process runs declared tools in-process and provides fail-closed egress brokers.
testing supplies fake clocks, deterministic IDs, fake model drivers, crash injection and
reusable adapter contract suites — and is never part of a production export.Storage and workers — store-memory, store-postgres, driver-postgres-worker
Storage and workers — store-memory, store-postgres, driver-postgres-worker
store-memory is deterministic, tenant-scoped and explicitly ephemeral. store-postgres
provides durable tenant-scoped stores. driver-postgres-worker implements the fenced lease loop
that lets a wake-up be claimed by exactly one worker.Transport and protocol — http, node, vercel, cloudflare, mcp
Transport and protocol — http, node, vercel, cloudflare, mcp
http implements Web-standard handlers for the whole command surface. node bridges to
node:http with graceful shutdown. vercel is a thin Next.js route adapter. cloudflare is the
experimental Worker subset. mcp is a guarded Model Context Protocol client that treats all
discovered metadata as untrusted.Integration and tooling — ai-sdk, otel, cli, create-pactmark
Integration and tooling — ai-sdk, otel, cli, create-pactmark
ai-sdk adapts the Vercel AI SDK without letting its types enter core APIs. otel emits
opt-in, metadata-only telemetry. cli provides the pactmark binary over injected host
adapters. create-pactmark is the deterministic offline initializer.The dependency rule that keeps it honest
Core must not depend on a proprietary model gateway, provider HTTP client, platform SDK, deployment CLI, telemetry exporter, or hosted database SDK.This is enforced by dependency-boundary checks in CI, not by review discipline. Practically it means you can swap Postgres for another durable store, or the AI SDK for a direct provider client, without touching a single line of run semantics.
What you actually import
For most applications the answer is short:How a run moves through the layers
Figure 2. Read the third column as the answer to “which package is responsible when this stage refuses”. Nothing in it belongs to the model adapter.Portability in practice
Theportable-agent example calls one unchanged agent implementation through Node, Vercel and
Cloudflare-shaped entrypoints, using the same deterministic fixture, and returns a normalized
contract result from all three.
Package reference
All nineteen packages with their exports and boundaries.
Production data flow
The same architecture annotated with trust boundaries and operator responsibilities.