runfabric

Architecture

In this repo the Go engine lives at the repository root. CLI command wiring lives under internal/cli/ (split by command domain), while app orchestration entrypoints live under platform/workflow/app/.

Shared contracts should live under platform/core/contracts/ to avoid stale cross-package contract copies.


Quick navigation

Architecture ownership

Canonical ownership and dependency direction rules for provider, router, runtime, simulator, and CLI orchestration domains are frozen in docs/ARCHITECTURE_OWNERSHIP.md.

Binary command ownership contracts for runfabric, runfabricd, and runfabricw are frozen in docs/BINARY_PROFILES_ADR.md.

That ADR is the source of truth for:


Deploy flow: CLI -> app -> dispatch mode

Engine request routing diagram

RunFabric engine request routing flow

1. Entry: CLI commands

CLI command File Calls app boundary
runfabric deploy internal/cli/lifecycle/deploy.go platform/workflow/app.Deploy (or DeployFromSourceURL for --source)
runfabric remove internal/cli/lifecycle/remove.go platform/workflow/app.Remove
runfabric invoke run internal/cli/invocation/invoke.go platform/workflow/app.Invoke
runfabric invoke logs internal/cli/invocation/logs.go platform/workflow/app.Logs

internal/cli/common/app_service.go provides a small app-service interface used by CLI command handlers.

2. App layer: bootstrap and provider dispatch

Location: platform/workflow/app/

Core pieces:

3. Extension boundary and plugin resolution

Location: platform/extensions/registry/resolution/ and platform/extensions/providerpolicy/

4. Execution paths

5. Recovery path

Recover operations execute through provider recovery capability with durable journal state.


Workflow runtime flow: CLI -> app -> runtime -> step handler -> state

Workflow execution currently uses a single in-process durable runtime loop (not separate scheduler and dispatcher services).

Runtime path (as implemented)

  1. CLI command entrypoint (runfabric workflow run|status|cancel|replay) in internal/cli/common/workflow.go.
  2. App boundary forwarding in platform/workflow/app/workflow.go.
  3. Durable runtime loop executes in platform/deploy/controlplane/workflow_runtime.go.
  4. Step execution dispatch (code/ai/human-approval) is handled by platform/deploy/controlplane/workflow_typed_steps.go.
  5. Durable run/step state persists through platform/core/state/core/runs.go under .runfabric/runs/<stage>/<runId>.json.

Scheduler vs dispatcher model (current decision)

Workflow binding layers

Two distinct binding layers exist and should not be conflated:

  1. Runtime step binding (engine runtime path)
    • Binds workflow step kinds (code, ai-*, human-approval) to typed handler behavior in workflow_typed_steps.go.
    • MCP/tool/resource/prompt calls are runtime-level step concerns (policy + correlation metadata).
  2. Provider orchestration binding (provider-native orchestration path)
    • Binds configured provider extensions to cloud-native orchestrators (for example AWS Step Functions, GCP Cloud Workflows, Azure Durable Functions).
    • This is provider extension/orchestration sync behavior, not the local WorkflowRuntime step scheduling loop.

AI workflow execution boundary

Contributor rule

Do not add AI execution logic to provider adapters. Keep AI execution in controlplane/runtime so behavior remains cloud-agnostic, testable, and policy-consistent.


Provider code layout

Built-in provider implementations live under extensions/providers/<name>/.

Structure

extensions/providers/
├── aws/
├── gcp/
├── azure/
├── cloudflare/
├── vercel/
├── netlify/
├── kubernetes/
├── alibaba/
├── digitalocean/
├── fly/
└── ibm/

Related built-in plugin roots:

API dispatch wiring remains provider-neutral in platform/deploy/core/api/ and provider policy mapping in platform/extensions/providerpolicy/.

Providers wired to deploy API

AWS uses the controlplane path.


See also: ARCHITECTURE_OWNERSHIP.md, DEPLOY_PROVIDERS.md, COMMAND_REFERENCE.md