AutoBlocksCalm automation for everyday life

AI assist

AutoBlocks includes bounded AI assist inside the product app only. AI helps you draft and understand AutoBlocks mapped to Phase 1 constructs — it does not run arbitrary code, access unsupported integrations, or change your account silently.

API routes: apps/api/src/modules/ai/routes.ts. Package: packages/ai-assist. Product UI: apps/product-web/src/features/ai-assist/.

Help chat on marketing (POST /help/chat) is separate — public, corpus-grounded, no tenant access. See Marketing site and help chat.


What AI can do

CapabilityEndpointWhen to use
DraftPOST /tenants/:tenantId/ai/draftDescribe a new AutoBlock in plain language
RefinePOST /tenants/:tenantId/ai/refineAdjust an in-progress wizard draft
RepairPOST /tenants/:tenantId/ai/repairFix validation errors after a failed save
ExplainPOST /tenants/:tenantId/ai/explainUnderstand what an existing AutoBlock does

All four require authentication and tenant membership.


What AI cannot do (Phase 1)

UnsupportedSystem behavior
Custom scriptingRejected with clear message
Arbitrary HTTP to unknown servicesOnly outbound_webhook steps
Silent auto-saveYou review every suggestion
Access other tenants' dataTenant-scoped requests only
Run automations on your behalfAI assists setup, not execution

AI assist flow

sequenceDiagram
  participant You
  participant Panel as AiAssistPanel
  participant API
  participant Provider as OpenAI or fallback

  You->>Panel: Enter intent or edit request
  Panel->>API: POST /tenants/:id/ai/draft
  API->>Provider: Bounded prompt + schema
  Provider-->>API: RoutineDraft JSON
  API-->>Panel: Draft with trigger + steps
  Panel-->>You: Review in wizard
  alt Accept
    You->>API: POST /routines
  else Reject / edit manually
    You->>Panel: Manual wizard edits
  end

Timeout: AI_TIMEOUT_MS — slow responses return HTTP 504 ai_timeout.


Entry points in the product

UI locationBehavior
/onboarding — AI pathFull draft during first-run
/routines/new?ai=1AI-first creation
Routines list — New with AISame as above
Wizard inline panelRefine while editing
Detail viewExplain existing AutoBlock

Component: apps/product-web/src/features/ai-assist/AiAssistPanel.tsx.


Supported output shape

AI maps intent to the same types as manual creation:

FieldAllowed values
Trigger kindmanual, schedule, inbound_webhook
Step kindnotification, outbound_webhook, storage
Rulesequals, contains, greater_than

Provider logic: packages/ai-assist/src/provider.ts.


Review before save (required)

PrinciplePractice
Trust over magicRead every step label and config
You stay in controlReject AI output and edit manually
Validate in wizardInvalid drafts show inline errors
Repair loopUse repair endpoint for targeted fixes
flowchart LR
  Draft["AI draft"]
  Review["You review"]
  Edit["Manual edit"]
  Save["POST /routines"]
  Reject["Discard AI"]

  Draft --> Review
  Review -->|OK| Save
  Review -->|Not OK| Edit --> Save
  Review -->|Wrong| Reject --> Edit

Auth and privacy

TopicDetail
AuthSession cookie required
Tenant scope:tenantId must match your workspace
Data sent to modelRoutine intent + draft JSON — not billing secrets
Help chat contrastPublic, no login, no tenant data

Error handling

HTTPErrorUser action
400invalid_requestFix input and retry
403Tenant mismatchRe-login
504ai_timeoutShorten request or retry
Validation on saverequired, min_itemsUse repair or manual fix

Client validation: apps/product-web/src/features/ai-assist/api-client.ts.


Related reading