Cloudflare Runtime
Pages + Workers
Pages hosts the internal reference and web interface; Workers run API, webhook, and queue logic.
Internal Architecture Reference
This internal Pages site collects architecture decisions, domain documentation, diagrams, and skill inventory for the team building and operating Agency OS.
Cloudflare Runtime
Pages + Workers
Pages hosts the internal reference and web interface; Workers run API, webhook, and queue logic.
State + Artifacts
D1 + R2
D1 stores operational state and current facts; R2 stores larger artifacts, snapshots, and audit packages.
Secrets Boundary
Secrets Store
API tokens and OAuth credentials are bound at runtime, never committed to source or rendered to dashboards.
Consultants and admins create or update Asana tasks. Asana webhooks notify Agency OS, so tasks can trigger build runs, agent runs, or client data setup work without staff leaving Asana.
Cloudflare Pages, Workers, Queues, D1, R2, Browser Run, and Secrets Store keep the system serverless and reduce vendor sprawl.
The Agency OS web interface reads dashboard feeds from the Client Data Plane. It does not query GA4, Search Console, Asana, or ad platforms on page load.
Agents can prepare work, comments, artifacts, and dashboard facts, but review-ready states and visibility decisions remain explicit.
| Layer | Resource | Role | Notes |
|---|---|---|---|
| Pages | agency-os-architecture-site | Internal living reference for system architecture, ADRs, docs, diagrams, and skills. | No API proxy and no dashboard data secret. |
| Pages | agency-os-web-interface | Operational Agency OS web interface. Starts with dashboards; later admin configuration and onboarding. | Has encrypted Pages secret AGENCY_OS_API_BASE_URL and office-IP middleware restriction. |
| Workers | agency-os-dev-platform-build-control-plane | API, Asana webhook intake, queue consumer, Client Data Plane fixture/data endpoints, health checks. | Current public dev worker runs on workers.dev. |
| D1 | agency-os-dev-platform-build-runs | Operational database for build runs, Team Agent runs, Client Data Plane setup, facts, access grants, and access logs. | Binding: PLATFORM_BUILD_DB. |
| R2 | agency-os-dev-technical-seo-audits | Stores larger generated artifacts such as technical SEO audit packages. | Future Client Data Plane snapshots and curated payloads also belong in R2. |
| Queues | agency-os-dev-platform-build-runs | Decouples Asana webhook receipt from build-run processing. | Binding: PLATFORM_BUILD_QUEUE. |
| Queues | agency-os-dev-team-agent-runs | Decouples Asana webhook receipt from Team Agent assessment and execution. | Binding: TEAM_AGENT_QUEUE. |
| Secrets Store | Agency OS credential store | Runtime binding for Asana, Google OAuth, Accuranker, DataForSEO, Semrush, Ahrefs, and Browser Run credentials. | Secret values are not stored in Git, D1, R2, Asana comments, or dashboard payloads. |
| AI Gateway | OpenAI provider, gpt-5.5 model config | Central policy/observability point for agent model calls. | Payload logging defaults off unless explicitly enabled. |
| Browser Run | Cloudflare Browser Run API | Crawl/render evidence for SEO reporting and technical audit workflows. | Uses a scoped token from Secrets Store. |
Terminology note: Cloudflare uses D1 for serverless SQL and R2 for object storage. If you see R1 or D2 in discussion notes, read that as R2/D1 unless we deliberately introduce a different product later.
Build tasks move through intake, clarification, ready, in progress, review, blocked, merged/done, or error sections.
Team Agent work enters a dedicated intake queue. Current dev requires the task to be assigned to Jessie before hosted execution is eligible.
Each client account/brand becomes a single Asana project. Subscription sections, such as SEO, group the planned and completed work that can later appear on dashboards.
Tasks are private by default. Consultants or agents can mark selected subscription tasks as client visible when strategy or sprint planning is ready.
Asana calls POST /webhooks/asana when configured projects or tasks change. The Worker supports the X-Hook-Secret handshake.
The Worker requires X-Hook-Signature and validates it against ASANA_WEBHOOK_SECRET before accepting event payloads.
The Worker groups webhook events by Asana task GID and creates idempotent Platform Build and Team Agent candidate messages.
Messages go to PLATFORM_BUILD_QUEUE and TEAM_AGENT_QUEUE so webhook acknowledgement is fast and downstream work can retry safely.
Queue consumers persist run state and event history in D1, detect duplicates, and decide whether a task is ignored, blocked, ready, or review-ready.
| Area | Asana state or signal | Agency OS action | Stored where |
|---|---|---|---|
| Platform Build | Task enters build project or relevant section | Create candidate Build Run and enqueue processing. | D1 build run tables and events |
| Team Agent | Task assigned to Jessie or matching configured eligibility | Assess skill request, context, credentials, and readiness. | D1 team agent run tables and events |
| Agent Execution | Task is ready | Run the selected skill, create review comment, and attach artifacts when needed. | D1 run state, Asana comments, R2 artifacts when large |
| Client Data Plane | Client brand/subscription setup is approved | Activate source assets, data products, subscription data views, and dashboard inclusion. | D1 setup/fact tables, R2 snapshots later |
| Client-visible Tasks | Task marked client visible and assigned to a subscription section | Expose task name, status, subscription, planned date, or Asana completed time in dashboard facts. | Prepared dashboard fact feed from stored facts |
| Errors | Checks fail or execution cannot continue | Create or update platform error tasks and keep evidence for review. | D1 event history, Asana error/regression section |
Agency staff configure the client group, brand, source assets, subscription data views, and dashboard surface inclusion.
Connectors collect GA4, Search Console, Asana, Accuranker, Google Ads, Meta, HubSpot, and Harvest data as roadmap slots.
Raw source responses are retained in R2-shaped object paths for audit and reprocessing.
Curated facts, freshness state, lineage refs, dashboard access grants, and agent access logs are indexed in D1.
Dashboards read prepared fact feeds from the Worker. They do not query source platforms directly on page load.
Worker credentials are injected through Cloudflare Secrets Store bindings such as AGENCY_OS_ASANA_AGENT_PAT, Google OAuth credentials, Accuranker, DataForSEO, Semrush, Ahrefs, and Browser Run.
The web interface uses an encrypted Pages secret for AGENCY_OS_API_BASE_URL. The architecture site does not have this secret.
Secrets must not be written into D1 records, R2 objects, Asana comments, generated reports, dashboard HTML, or logs.
The web interface is staff-only during development. Future client credentials and client-shareable access must use explicit grants and separate access controls.
.agents/skills/caveman/SKILL.md
.agents/skills/diagnose/SKILL.md
.agents/skills/grill-me/SKILL.md
.agents/skills/grill-with-docs/ADR-FORMAT.md
.agents/skills/grill-with-docs/CONTEXT-FORMAT.md
.agents/skills/grill-with-docs/SKILL.md
.agents/skills/handoff/SKILL.md
.agents/skills/improve-codebase-architecture/DEEPENING.md
.agents/skills/improve-codebase-architecture/INTERFACE-DESIGN.md
.agents/skills/improve-codebase-architecture/LANGUAGE.md
Asana build tasks, builder agents, checks, review artifacts, and human merge decisions.
Staff delegate delivery work through governed agent skill execution and human approval.
Onboarding setup, source bindings, fixture/dev/prod facts, dashboard feeds, and agent data access logs.
Dashboards, admin configuration, onboarding, and future client-shareable views live on a separate Pages domain.
Internal living reference for how Agency OS is put together. This site should stay staff-only.
Dashboard review today; admin configuration, onboarding, and future client-shareable views later.
Open web interface.agents/skills/caveman/SKILL.md
.agents/skills/diagnose/SKILL.md
.agents/skills/grill-me/SKILL.md
.agents/skills/grill-with-docs/ADR-FORMAT.md
.agents/skills/grill-with-docs/CONTEXT-FORMAT.md
.agents/skills/grill-with-docs/SKILL.md
.agents/skills/handoff/SKILL.md
.agents/skills/improve-codebase-architecture/DEEPENING.md