Cloudflare OS integration
Module: org-os-cloudflare-os, catalogued pilot (manifest, catalogue entry). Built and verified on a local Cloudflare OS stack; not deployed. Design: Cloudflare OS integration design. Package: packages/cloudflare-os-integration.
Cloudflare OS is Cloudflare’s workspace product (early access and open-sourced 2026-08-05, per its announcement; upstream claim, not checked here). This module lets a Cloudflare OS workspace read org-os instances: their registries, federation, schemas, rendered pages and a grounding bundle for the workspace agent, so people who never touch git can ask an agent about an org’s real state from a browser. The git repository stays canonical; the workspace holds only thin wiring. It is read-only. There is no write path.
The pieces:
- The core (
src/page-core,src/substrate,src/gatekeeper): pure, runtime-agnostic JavaScript. Page rendering, a substrate interface with an in-memory driver and a GitHub driver, and the five capabilities.scripts/page-shim.mjs(npm run page <id>) imports the same page renderer. - The adapter (
src/adapter/gatekeeper-org-os): a Cloudflare Worker, a “gatekeeper” in Cloudflare OS terms, that wires the core to the platform. - A gadget blueprint (
blueprints/org-dashboard/gadget.html): a dashboard that callsget_page.
What is verified, and what is not
| Level | State |
|---|---|
| Built | The core, the adapter source and the gadget source. npm run test:cloudflare-os-integration runs 86 tests. On this branch, 84 pass and 2 fail: the two daysUntil tests are time-zone dependent (they pass with TZ=UTC). |
| Verified against a live service | On a local Cloudflare OS stack (wrangler and workerd, upstream commit 1cb5e3d, 2026-08-07), 2026-08-08 and 2026-08-09: types:check silent, the GATEKEEPER_ORG_OS binding present, GET /gatekeeper/org-os/ returns 200, and the core read live GitHub data for a public hub (get_registry 13 projects, get_page rendered) and for a private instance (get_registry 27 projects, get_federation with 8 peers, get_page dashboard), each with a commit sha and stale: false. Separately, on 2026-08-09, a model provider was configured and its model list read live. |
| Not verified | The workspace agent calling a capability in chat. Anything in a deployed workspace: no starter fork or deployment is recorded. The org-dashboard gadget installed in a workspace, and its rpc.mjs shim (see below). Exporting the gadget to a .gadget blueprint archive. The NO_DEFAULT_CRED_INPUTS and deploy-wizard behaviour for a credential-free gatekeeper on the upstream deploy path. |
| In production use | No. |
The statements above about the platform come from the adapter’s notes of the 2026-08-08 and 2026-08-09 runs and from reading the pinned Cloudflare OS source; they were not re-run in this pass. The repository’s tests were.
What it connects to
- A Cloudflare account and a Cloudflare OS workspace: the starter (
https://github.com/cloudflare/cloudflare-os-starter, deployed from its README; upstream location, not checked here). Nothing in this repository deploys it. - GitHub, through its REST API, as the only substrate today: the gatekeeper reads each instance repository’s files at a configured ref. The driver sits behind a substrate interface, so another driver can replace it without changing the capabilities.
- A model provider configured in the workspace, for the agent. One that works: the workspace’s Ollama provider slot, which is a generic OpenAI-compatible client, pointed at a compatible gateway’s API URL with an API token. The
openaislot does not work with compatibility gateways because it speaks the Responses API. A key whose account has no balance fails on completions with a credits error even though the model list loads.
Capabilities
The Worker’s session object (bound in the workspace as ORG_OS) has two methods: listInstances() and instance(id). instance(id) returns a per-instance object with the five read methods: getRegistry(name), getFederation(), getSchema(name), getContextBundle() and getPage(pageId), for example session.instance("my-org").getRegistry("projects"). Each calls the core capability of the same name in snake case:
| Capability | Returns |
|---|---|
get_registry | data/<name>.yaml, parsed |
get_federation | the instance’s federation.yaml, parsed |
get_schema | .well-known/<name>.json |
get_context_bundle | identity, agent rules, memory index, the five most recent decisions and registry snapshots, each section cut to 64,000 characters with a flag; a missing file becomes null |
get_page | one rendered page: dashboard, projects, tasks, instances, decisions, plans or this-week |
The core’s handle() (in src/gatekeeper/capabilities.mjs) answers with an envelope, { ok: true, data, provenance: { instance, sha, date, stale } } or { ok: false, error: { code, message } }. The Worker adapter unwraps it: on success a method returns { data, provenance } (getPage returns { pageId, markdown, provenance }); on failure it throws an Error carrying only the message, so the error code never reaches the workspace caller. instance(id) for an unconfigured id throws “isn’t a configured org-os instance” (the core’s own code for that case is UNKNOWN_INSTANCE). provenance.sha is the commit the data was read from, so the agent can say where an answer came from. stale: true means the GitHub read failed and a cached copy was served. Names passed to get_registry and get_schema must be lower-case letters, digits and hyphens. Every read calls authorizeObservation() before it fetches, so an observation the user would deny never reaches GitHub. The substrate caches by ETag with a 60-second default TTL and serves last-known-good content if a refresh fails; the cache is an in-memory map inside the Durable Object.
Setup
Run these in order; each step’s check gates the next. All of it needs a Cloudflare account and is outside the repository’s tests.
- Deploy the starter into your Cloudflare account. Check that the workspace loads, a document can be created, and the agent chat responds.
- Install the adapter. Follow the adapter runbook: copy
src/adapter/gatekeeper-org-osinto the workspace’spackages/; there, runORG_OS_REPO=<path to this repository> node scripts/sync-core.mjs(it vendors the core by copy, because the workspace is a separate pnpm workspace and cannot resolve a sibling repository) andnode scripts/sync-types.mjs; runpnpm exec wrangler types; inworker-configuration.d.tspointmainModuleat./src/org-osinstead of the build output; thenpnpm run types:check, which must be silent; then, in the workspace root,pnpm install && pnpm run-local. The check is thatGATEKEEPER_ORG_OSappears in the binding list andGET /gatekeeper/org-os/returns 200. In local dev, agatekeeper-*directory containing awrangler.jsoncis bound automatically asGATEKEEPER_ORG_OS. On the starter’s deploy path the slot isworkers.customGatekeeper.nameindeployment.jsonc. - Configure the instances. Set
ORG_OS_INSTANCESin the adapter’swrangler.jsoncvars: a JSON array of{ "id", "owner", "repo", "ref" }, whererefdefaults tomain. Repository coordinates are public, so this is not a secret. Eachidis lower-case letters, digits and hyphens and unique;ownerandrepouse GitHub’s character set; a bad entry stops the Worker at startup. Thewrangler.jsoncin the repository still carries the maintainer’s example instances and a work-branchref; replace them with yours. - Set the token. Put a fine-grained GitHub personal access token with
contents: readonly, as a Wrangler secret:pnpm exec wrangler secret put ORG_OS_GITHUB_TOKEN --name gatekeeper-org-os. Do not grant write scopes. A public repository can be read without a token, at GitHub’s lower unauthenticated rate limit; a private one needs it. A fine-grained token is limited to one resource owner, so instances under different owners need separate arrangements. For local development, the multi-worker dev server does not read per-package secrets: add"gatekeeper-org-os": ["ORG_OS_GITHUB_TOKEN"]toPASSTHROUGH_GATEKEEPER_VARSin the workspace’srun-dev-server.js(a local edit) and put the token in the workspace’s gitignored.dev.vars. - Configure the model in the workspace, as above.
- Acceptance in chat. Ask the workspace agent what the active projects are, what the last three decisions were, who the peers in a federation are, and what is urgent now, and compare each answer with the repository. Then ask which commit the answer came from; it should report the provenance sha. The repository records no completed run of this step.
- Install the gadget (optional). Create a gadget in the workspace and paste
blueprints/org-dashboard/gadget.htmlas its source. The file importscallCapabilityfrom./rpc.mjs, which is not in the repository, and expectscallCapability(name, args)to resolve to{ ok: true, data, provenance }or{ ok: false, error: { code, message } }, withargs = { instance, page_id }. The adapter does not return that shape, so the shim must do three things: take the injectedORG_OSsession binding and callbinding.instance(args.instance)first, then the method with a positional argument (getPage(args.page_id)); catch theErrorthe adapter throws and turn it into{ ok: false, error: { code, message } }; and wrap a success as{ ok: true, data: { markdown }, provenance }. How the workspace injects the binding into a gadget was read from source and has not been observed in a running gadget, so the shim is untested. The gadget’s source is the version of record; change it here and reinstall rather than editing it in the workspace. It renders onlyerror.codeanderror.message, nevererror.detail, which can carry raw upstream bodies. - When it is live, update the module’s status in Modules and in
site/src/data/modules.yaml, which a test requires to agree.
Security posture
The gatekeeper is provisioned automatically and reads through one deployment-level token, not per-user OAuth. So every signed-in workspace user has the same access to the same repositories; addObserver() accepts unconditionally; and the contents of a private instance are readable by every workspace user. The boundary is workspace membership, enforced upstream at sign-in. That is safe only while workspace membership is close to organisation membership. If different users must see different data, the gatekeeper has to move to per-user OAuth and addObserver() must gain a real check.
Commands
npm run test:cloudflare-os-integration # the package's tests (node --test)
npm run page -- dashboard # the same page renderer, from local instance data; runs scripts/initialize.mjs (its output includes a "Checking Notion API" info line) and is a transitional bridge (also: projects, tasks, instances, decisions, plans, this-week)
What it writes and where
Nothing in the repository, and nothing to GitHub: the integration only reads. In the workspace it holds a copy of the core under the adapter’s vendor/org-os-core/ (generated by sync:core; never edit it, and re-run the sync after any change to the package’s src), an in-memory cache, and, if installed, the gadget.