Skip to content

Operations Registry

Operations are reusable workflow primitives. Instead of every workflow re-implementing "post to Discord" or "write rows to Supabase," each primitive is registered once in the operations registry and referenced from any workflow step via step.operationId.

When an operation fails — say, the Strapi token expires — every workflow that uses it lights up red on the same diamond in the Loom sculpture. That's the rope-braiding effect. optimalOS/client/loom-braid.ts draws connection lines across strands to make the shared dependency visible at a glance.

Where operations live

Two scan roots, same convention as workflows:

  1. optimalOS/operations/ — shipped with OptimalOS.
  2. ~/.optimalos/operations/ — user-added. Wins on id collision.

Each .ts file may export either:

  • export const operation: OperationDef — a single primitive.
  • export const operations: OperationDef[] — a group (e.g. all strapi.* in one file).

Loader: optimalOS/src/loom/operations.ts.

OperationDef shape

From optimalOS/src/loom/types.ts:54-60:

ts
{
  id: string,           // 'category.name' — e.g. 'strapi.create-draft'
  label: string,        // 'STRAPI DRAFT' — short, uppercase
  description?: string,
  category: OperationCategory,
  fn: StepFn,           // same signature as a workflow step
}

The id is validated against ^[a-z0-9]+(\.[a-z0-9-]+)+$ so registry references stay parseable.

Categories

Defined in optimalOS/src/loom/types.ts:44-52:

  • strapi — Strapi headless CMS reads/writes.
  • supabase — Supabase row reads/writes.
  • llm — language-model calls (OpenRouter, Anthropic, etc.).
  • notify — outbound notifications (Discord, etc.).
  • scrape — HTTP scrapes.
  • storage — object storage uploads.
  • dw — data warehouse (Snowflake) operations.
  • other — escape hatch.

Seed operations

The shipped operations as of 2026-04-27 (verify against the source files; this list reflects what's in optimalOS/operations/):

Operation idLabelCategoryFile
strapi.fetch-draftsSTRAPI FETCHstrapioptimalOS/operations/strapi.ts
strapi.create-draftSTRAPI DRAFTstrapioptimalOS/operations/strapi.ts
strapi.publish-draftSTRAPI PUBLISHstrapioptimalOS/operations/strapi.ts
supabase.read-rowsSUPABASE READsupabaseoptimalOS/operations/supabase.ts
supabase.write-rowsSUPABASE WRITEsupabaseoptimalOS/operations/supabase.ts
llm.generate-textLLM GENllmoptimalOS/operations/llm.ts
notify.discord-webhookDISCORDnotifyoptimalOS/operations/notify.ts
scrape.http-fetchSCRAPEscrapeoptimalOS/operations/scrape.ts
storage.upload-fileSTORAGEstorageoptimalOS/operations/storage.ts
dw.snowflake-mergeSNOWFLAKEdwoptimalOS/operations/dw.ts

Cross-validation

When the workflow loader processes a workflow, every step.operationId is cross-validated against the operations registry. Unknown ids surface as validationErrors on the workflow rather than crashing at runtime.

Visual braiding

optimalOS/client/loom-braid.ts overlays curves between same-operation step diamonds in different strands. The visual signal is intentional: when a SQL operation breaks, you see every workflow that depends on it pulse red simultaneously.

API

http
GET /api/loom/operations

Returns each loaded operation with a usedBy: string[] field listing the workflows that reference it. Code: optimalOS/src/routes/loom.ts:9.

Built by Carlos Lenis in Miami