Architecture

Architecture | SmallBiz Ops Copilot

A repository-derived architecture review covering components, control flow, operating boundaries, and the evidence a technical reviewer should inspect.

Reviewed 2026-07-28. This page is derived from checked-in repository evidence and links back to its source.

Service Architecture - SmallBiz Ops Copilot

SmallBiz Ops Copilot is a bounded, approval-safe support control tower. The architecture separates the implemented pilot path from production capabilities that still require customer-specific design and verification.

Current Runtime

flowchart LR
    OC["Openclaw\nnormalized event"] -->|"signed webhook"| MW["Cloudflare Pages\nmiddleware and validation"]
    MW --> D1[("Cloudflare D1\nqueue and audit state")]
    OP["Operator browser"] --> UI["Queue, risk board,\nreview pack"]
    UI --> API["Pages Functions\ntriage, draft, approval"]
    API --> D1
    API -->|"optional, operator invoked"| LLM["OpenAI or Gemini"]
    API -->|"fallback"| TPL["Deterministic templates"]
    API -->|"approved handoff"| MB["Maltbook webhook"]
    MB -.->|"outside current evidence boundary"| CC["Customer channel"]

The dotted edge is intentionally not a product claim. The repository records Maltbook webhook acceptance but does not verify delivery to a marketplace, social network, email inbox, or end customer.

Trust Boundaries

BoundaryImplemented controlCurrent limitation
InboundOpenclaw shared-secret signature and normalized schemaNo replay timestamp/nonce window or direct channel adapter
StateD1 schema for merchant, ticket, message, draft, SLA, and action logsDefault merchant pattern is not tenant isolation
TriageOperator-triggered deterministic rules and logged overridesNot a policy engine or autonomous classifier
DraftOperator-triggered provider call, BYOK support, template fallbackNo tenant prompt policy or formal model evaluation set
ApprovalNamed operator value is required and loggedOperator ID is not authenticated identity
HandoffMaltbook configuration gate and explicit success/pending responseNo customer-channel receipt or exactly-once outbox
Public dataConfiguration readiness only; context is operator-facingMust not drive automated refund or fulfillment decisions

Implemented Components

Pilot Deployment

ResourcePurposeGuard
Cloudflare PagesStatic operator UINo secrets in client assets
Pages FunctionsRequest validation and workflow APIsExplicit integration failures
D1Pilot queue and audit recordsCustomer-approved retention and deletion required
Cloudflare secretsOpenclaw, Maltbook, and optional model credentialsSeparate local/staging/production values
External model providerOptional draft assistanceOperator invocation and deterministic fallback
Maltbook webhookApproved workflow handoffAcceptance is not customer-channel delivery

Production Target

flowchart LR
    IDP["Customer identity provider"] --> GW["Authenticated API gateway"]
    SRC["Approved support channels"] --> ADP["Tenant-scoped adapters\nsignature + replay guard"]
    ADP --> Q["Durable queue / outbox"]
    Q --> CORE["Tenant-scoped workflow service"]
    GW --> CORE
    CORE --> DB[("Tenant-isolated data\nretention + deletion jobs")]
    CORE --> MODEL["Policy-gated model adapter"]
    CORE --> APPR["Authenticated approval service"]
    APPR --> OUT["Delivery adapter + receipt verification"]
    OUT --> AUDIT["Immutable delivery and audit evidence"]

Promotion requires tenant authentication and authorization, rate limits, replay protection, an outbox or equivalent retry design, verified delivery receipts, privacy controls, monitoring, incident ownership, and customer-specific acceptance tests.

Failure Semantics

Cost And Scope Controls

Verification

npm run verify
python3 scripts/validate_repository_surface.py
python3 scripts/validate_architecture_blueprint.py
npm run smoke:local

The sellable unit is a customer-specific Secure Workflow Pilot. It is not a revenue, response-time, or automation guarantee.