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, runtime maps, hosted Jessie execution status, marketing skill prompts, and runbooks 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.
Hosted Execution
7 Jessie paths
SEO, GA4, Google Ads, Meta Ads, Integrated Performance Report, technical SEO audit, and the Jessie workbench run from Asana intake.
Evidence Library
Staff-only registry
Report artifacts, files, provenance, and revision rounds are indexed in D1 with larger packages referenced from R2.
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 now separates Manage Users and Manage Clients. Client setup is captured as Sources, Context, and Users so agents know which tools and facts are safe to use.
Jessie still posts artifacts to Asana, but the Report Artifact Registry gives staff a durable index for reuse, auditability, evidence lookup, and revision history.
| 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 for dashboards, Report Library, and Admin & Configuration CRUD. | Has encrypted Pages secrets for the API origin and internal service token, office-IP middleware restriction, report artifact views, and admin deep links by Business Unit. |
| Workers | agency-os-dev-platform-build-control-plane | API, Asana webhook intake, queue consumer, Admin Registry, Report Artifact Registry, Client Data Plane fixture/data endpoints, health checks. | Current public dev worker runs on workers.dev; Admin Registry, Report Artifact Registry, and Client Data Plane routes require X-Agency-OS-Internal-Token. |
| D1 | agency-os-dev-platform-build-runs | Operational database for build runs, Team Agent runs, report artifact registry, Client Data Plane setup, facts, access grants, and access logs. | Binding: PLATFORM_BUILD_DB. Registry tables index artifacts, files, channel provenance, and revision rounds. |
| R2 | agency-os-dev-technical-seo-audits | Stores larger generated artifact packages such as technical SEO crawl/evidence bundles. | D1 stores stable keys and metadata for audit packages. |
| R2 | agency-os-dev-client-data-plane | Stores Raw Source Snapshot payloads for Client Data Plane ingestion runs. | Binding: CLIENT_DATA_PLANE_BUCKET. Strategic Settlements manual GA4/GSC refresh writes raw snapshots here while D1 stores metadata and curated facts. |
| 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, Google Ads, Meta, 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 task and task-comment story 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, needs clarification, 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 or manually refreshed | Activate source assets, data products, subscription data views, dashboard inclusion, and GA4/GSC fact refreshes. | D1 setup/fact tables, R2 raw snapshots |
| 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 |
SEO, GA4, Google Ads, Meta Ads, Integrated Performance Report, technical SEO audit, and useful general workbench runs keep their existing Asana attachment/comment write-back.
The control-plane Worker writes report_artifacts, report_artifact_files, report_channel_provenance, and report_revision_rounds rows tied to the Team Agent run and Asana task.
Technical SEO crawl data, CSV exports, raw debug JSON, screenshots, and future larger evidence bundles live in R2 when available; D1 stores stable keys and references.
The staff-only /reports/ view lists artifacts by Business Unit, period, skill, status, files, channel provenance, Asana task link, and revision history.
The Team Agent queue can execute SEO reporting, GA4 reporting, Google Ads reporting, Meta Ads reporting, Integrated Performance Report, technical SEO audit, and governed Jessie workbench requests.
The aggregate-performance-reporting route now produces `client-report.html`, `consultant-appendix.html`, and `evidence.json` on the same Asana task for consultant approval.
Review artifacts, package files, channel provenance, and revision rounds are indexed in D1 and visible in the staff-only Report Library.
The Integrated Performance Report now renders actual channel performance evidence in Performance Snapshot and What Changed instead of channel draft-label text.
Human comments after review_ready are classified as acceptance, revision request, discussion, scope change, or no-op, then processed on the same canonical Asana task.
Technical SEO audit packages use Browser Run, R2, Asana evidence links, and incomplete-crawl findings instead of silent empty success reports.
Generic Jessie requests now plan, clarify, or use approved read-only analysis tools when confidently matched, including Plunkett Meta creative frequency and Plunkett SEO keyword-gap analysis.
Hosted skills attach or link review-required artifacts to the source Asana task and keep client delivery consultant-mediated.
Admin now focuses on Manage Users and Manage Clients, with client setup split into Sources, Context, and Users. Dashboard cards distinguish Dashboard Needed from Setup Needed, and list readiness is recomputed from current records.
Ready Business Units now expose Create dashboard on the Dashboards page. The Admin Registry Worker upserts an active staff-preview dashboard surface and the web interface opens slugged dashboard routes such as /dashboards/strategic-settlements/.
The first real Client Data Plane ingestion slice adds Refresh data for GA4 and Search Console Source Assets, R2 Raw Source Snapshots, D1 curation runs, current facts, fact versions, and dashboard fact retrieval.
Agency staff configure the client group, Business Unit, source assets, context folder, staff access, and dashboard surface inclusion.
POST /admin-registry/business-units/:businessUnitId/refresh-data runs the configured GA4 and Google Search Console Source Assets for that Business Unit. Strategic Settlements is the first real client slice.
The Worker uses Google OAuth credentials from Cloudflare Secrets Store, stores minimized raw GA4/GSC payloads in CLIENT_DATA_PLANE_BUCKET, and writes raw_source_snapshots metadata rows in D1.
Curation runs upsert current_client_facts and client_fact_versions with lineage linking source assets, ingestion runs, raw object keys, date range, and transformation version.
Staff dashboards expose a Refresh data action and then 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, Google Ads credentials, Meta token, Accuranker, DataForSEO, Semrush, Ahrefs, and Browser Run.
The web interface uses encrypted Pages secrets for AGENCY_OS_API_BASE_URL and AGENCY_OS_INTERNAL_API_TOKEN. The architecture site does not have these secrets.
The Worker requires X-Agency-OS-Internal-Token on /client-data-plane/* and /report-artifacts/*, then compares it with the AGENCY_OS_INTERNAL_API_TOKEN secret binding before serving staff-only metadata.
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.
Admin & Configuration has two primary modes: Manage Users and Manage Clients. Manage Clients starts with a Business Unit selector and a Create Client action.
Each Business Unit is configured through Sources, Context, and Users tabs. Source IDs such as Asana project GID, GA4 property, Search Console site, Accuranker project, Google Ads, Meta, and HubSpot live in Sources.
Context stores the Box client context folder binding. Users stores internal staff assignments now and leaves room for external client access later.
The Worker recomputes readiness from current records for source assets, staff mappings, Business Unit roles, Jessie service identity, and no-live-connector policy. Dashboard lists no longer trust stale persisted readiness snapshots.
A Business Unit with passed admin setup but no dashboard route is shown as Dashboard Needed with a Create dashboard action. The Worker creates an active staff-preview dashboard_surface_configurations record, then the card switches to Open dashboard.
Business Unit dashboards now expose Refresh data. The action calls Admin Registry, validates GA4/GSC Source Assets, persists raw snapshots, and lets the dashboard render current facts.
.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, staff-only Report Library, 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