Skip to content

CortexBuild β€” System Architecture (v0.1)

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    CortexBuild CONTROL PLANE                           β”‚
β”‚                                                                       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  Web UI (Next.js 15 + Tailwind + shadcn/ui)                    β”‚  β”‚
β”‚  β”‚  β€’ Project list                                                 β”‚  β”‚
β”‚  β”‚  β€’ Task board (Linear-style; PM-persona language)              β”‚  β”‚
β”‚  β”‚  β€’ Agent timeline (real-time; tech-lead-persona detail)        β”‚  β”‚
β”‚  β”‚  β€’ Approval queue (PR merge, deploy, spend, secrets)           β”‚  β”‚
β”‚  β”‚  β€’ Settings: provider keys, autonomy matrix, rule packs        β”‚  β”‚
β”‚  β”‚  β€’ Audit log viewer (filterable, exportable)                   β”‚  β”‚
β”‚  β”‚  β€’ Cost dashboard ($ per task, per agent, per provider)        β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚ WebSocket (progress, approvals)
                            β”‚ REST (commands, queries)
                            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              ORCHESTRATOR SERVICE (Python 3.12 + FastAPI)            β”‚
β”‚                                                                       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚ Phase Sequencer β”‚ β”‚  Rule SSoT      β”‚ β”‚  Recurrence Ledger  β”‚    β”‚
β”‚  β”‚ (wave model)    β”‚ β”‚  Engine         β”‚ β”‚  Persister          β”‚    β”‚
β”‚  β”‚                 β”‚ β”‚                 β”‚ β”‚                     β”‚    β”‚
│  │ Plan→Critic→    │ │ Renders rules   │ │ Post-mortem capture │    │
β”‚  β”‚ Buildβ†’[Tβˆ₯Sβˆ₯O]   β”‚ β”‚ to all enabled  β”‚ β”‚ β†’ ledger entry      β”‚    β”‚
β”‚  β”‚ β†’PR Reviewer    β”‚ β”‚ provider tools  β”‚ β”‚ β†’ new rule draft    β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚                                                                       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚ Provider Router β”‚ β”‚ Approval Gate   β”‚ β”‚  Audit Log Writer   β”‚    β”‚
β”‚  β”‚                 β”‚ β”‚ State Machine   β”‚ β”‚                     β”‚    β”‚
β”‚  β”‚ Claude/Copilot/ β”‚ β”‚ Auto/Notify/    β”‚ β”‚ Every shell op,     β”‚    β”‚
β”‚  β”‚ Codex/Bedrock/  β”‚ β”‚ Approve per     β”‚ β”‚ file edit, API call β”‚    β”‚
β”‚  β”‚ Vertex/Ollama   β”‚ β”‚ action class    β”‚ β”‚ β†’ Postgres + S3     β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚                                                                       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”β”‚
β”‚  β”‚  Multi-tenant data layer (Postgres + Redis)                     β”‚β”‚
β”‚  β”‚  β€’ projects, users, sessions, approvals, tasks, agents, runs    β”‚β”‚
β”‚  β”‚  β€’ audit_log, recurrence_ledger, rule_packs, llm_provider_keys  β”‚β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚                              β”‚
                            β”‚ spawns workspace             β”‚ invokes LLM
                            β–Ό                              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  EXECUTION RUNTIME                   β”‚  β”‚  LLM PROVIDER APIs        β”‚
β”‚  (Daytona devcontainer)              β”‚  β”‚                           β”‚
β”‚                                      β”‚  β”‚  β€’ Anthropic (Claude)     β”‚
β”‚  Per-project sandbox VM:             β”‚  β”‚  β€’ OpenAI (GPT/Codex)     β”‚
β”‚  β€’ Repo clone (read-write)           β”‚  β”‚  β€’ GitHub Copilot CLI     β”‚
β”‚  β€’ Toolchain auto-install            β”‚  β”‚  β€’ Bedrock                β”‚
β”‚    (node, python, go, rust, java)    β”‚  β”‚  β€’ Vertex                 β”‚
β”‚  β€’ Provider CLIs                     β”‚  β”‚  β€’ Ollama (local)         β”‚
β”‚    (gh, claude, codex, etc.)         β”‚  β”‚                           β”‚
β”‚  β€’ Network egress firewall           β”‚  β”‚  Keys: BYO, encrypted     β”‚
β”‚  β€’ Resource limits (cgroups)         β”‚  β”‚  at rest (KMS), never     β”‚
β”‚  β€’ Audit-logged shell                β”‚  β”‚  leave control plane      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚
                            β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  USER'S GIT PROVIDER (external)                       β”‚
β”‚                                                                        β”‚
β”‚  GitHub / GitLab / Bitbucket / Azure DevOps                           β”‚
β”‚  Branches, PRs, issues, comments β€” CortexBuild writes here              β”‚
β”‚  User reviews in their normal git UI; CortexBuild never blocks merge    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Diagram legend (adjacent qualifiers). In the boxes above: Bedrock / Vertex are reachable via an OpenAI-compatible gateway only β€” no native adapter (roadmap); native providers = Claude, Gemini, OpenAI-compatible. The Execution Runtime (Daytona devcontainer) box is Phase 1 β€” planned πŸ”œ, not yet shipped.

Status β€” roadmap vs shipped. This diagram shows the full target architecture. Shipped today (P0): rule SSoT + 4-surface render, the recurrence ledger, brownfield analysis, and offline conformance/eval. Planned (not yet shipped): the Execution Runtime (Daytona devcontainer / per-project sandbox) is Phase 1 β€” planned πŸ”œ; the fully autonomous orchestrator control loop and the 20-action-class approval matrix are later phases. Provider note: native providers today are Anthropic (Claude), Gemini, and any OpenAI-compatible endpoint β€” Bedrock / Vertex / Azure OpenAI are reachable only via an OpenAI-compatible gateway (no native adapter).

Component responsibilities

Web UI (Next.js)

  • Authenticated dashboard
  • Real-time updates via WebSocket
  • Approval dialogs (blocking when needed)
  • Persona toggle (PM ↔ tech-lead)
  • BYO key management (write-only forms)

Orchestrator Service (FastAPI)

  • Stateless API + stateful workers
  • Multi-tenant: project = tenant boundary
  • Long-running task supervision
  • Provider adapter abstraction
  • Rule rendering (port of render-agents.ps1)
  • Recurrence ledger CRUD
  • Audit log emission

Execution Runtime (Daytona) β€” Phase 1, planned πŸ”œ

  • One devcontainer per project, persistent
  • Toolchain installers triggered by detected stack
  • Provider CLIs preinstalled (or installed on-demand)
  • Shell wrapped to log every command
  • Network egress firewall (allow git provider + LLM APIs only by default)
  • Filesystem snapshots before risky operations

LLM Provider APIs

  • Calls happen from the orchestrator (not the VM) for cost tracking + key isolation
  • VM only ever talks to its repo + the orchestrator
  • Orchestrator caches plan outputs

Boundaries (what runs where)

Concern Control Plane VM Git Provider LLM API
Repo clone β€” βœ… (source) β€”
Code edit β€” βœ… β€” β€”
LLM call βœ… (router) β€” β€” (target)
Rule rendering βœ… β€” β€” β€”
PR open (orchestrates) βœ… (gh pr create) (target) β€”
Approval dialog βœ… β€” β€” β€”
Audit log write βœ… (emits events) β€” β€”
Recurrence ledger βœ… β€” β€” β€”
Secrets storage βœ… (KMS) (env vars at runtime) β€” β€”

Data model (top-level tables)

-- Tenancy
projects (id, slug, owner_user_id, repo_url, git_provider, status, created_at)
users (id, email, oauth_provider, oauth_id, persona_default, created_at)
project_members (project_id, user_id, role)  -- owner | admin | member | viewer

-- Configuration
provider_keys (id, project_id, provider, key_ciphertext, kms_key_id, created_at)
autonomy_matrix (project_id, action_class, level, updated_by, updated_at)
rule_packs_enabled (project_id, pack_name, pack_version, enabled_at)

-- Work
tasks (id, project_id, source, source_id, title, body, complexity, confidence, status, ...)
runs (id, task_id, branch_name, status, started_at, ended_at, cost_usd, ...)
agent_invocations (id, run_id, agent_id, provider, model, prompt_tokens, completion_tokens, latency_ms, ...)

-- Approvals
approvals (id, project_id, run_id, action_class, payload_json, requested_at, decided_at, decision, decided_by)

-- Governance
audit_log (id, project_id, run_id, actor_type, actor_id, action, target, payload_json, ts)
recurrence_ledger (id, project_id, class, severity, agent, symptom, root_cause, fix, guard_id, status, automation_target, ts)

-- Rule SSoT
rule_packs (id, slug, version, source_url, signed_by, content_hash)
rendered_targets (project_id, target_tool, target_path, content_hash, rendered_at)

Provider Adapter interface

class ProviderAdapter(Protocol):
    name: str  # "claude_code" | "copilot_cli" | "codex" | "bedrock" | ...  (bedrock/vertex = gateway-only, no native adapter)

    async def invoke(
        self,
        prompt: str,
        *,
        system: str | None = None,
        tools: list[ToolDef] | None = None,
        model_hint: ModelTier,  # "reasoning_heavy" | "balanced" | "fast_cheap"
        max_tokens: int = 4096,
        timeout_seconds: int = 300,
    ) -> InvocationResult: ...

    async def stream(self, ...) -> AsyncIterator[StreamChunk]: ...

    def estimate_cost(self, prompt: str, model_hint: ModelTier) -> Decimal: ...

    def capabilities(self) -> set[Capability]:
        # {CODE_EXECUTION, WEB_BROWSE, FILE_IO, VISION, LONG_CONTEXT}
        ...

    async def rate_limit_status(self) -> RateLimitStatus: ...

    async def health_check(self) -> HealthStatus:
        # Daily smoke test from CI hits this
        ...

Phase Sequencer (wave model)

Ported from CortexVigil rule-phase-sequence:

Wave 1a: Planner (sequential)
Wave 1b: Critic (conditional β€” skip for trivial low-risk plans)
Wave 2:  Builder (sequential β€” only writer)
Wave 3:  Tester βˆ₯ Security βˆ₯ Optimizer (parallel β€” all read-only)
Wave 4:  PR Reviewer (sequential)

State machine guarantees: agents never run out of order; waves block on previous wave's completion; wave 3 parallelism is opt-in per runtime capability.

Approval Gate State Machine

Action requested by agent
       β”‚
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Lookup autonomy  β”‚
β”‚ level for class  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚
       β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”  AUTO     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚ Level │──────────►│ Execute now  │──► Audit log
   β””β”€β”€β”€β”¬β”€β”€β”€β”˜           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚ NOTIFY        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
       β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Ίβ”‚ Execute now  │─►│ Notify UI    │──► 5-min rollback window
       β”‚               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚
       β”‚ APPROVE       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
       └──────────────►│ Pause agent  │─►│ UI prompts   │─►│ User decidesβ”‚
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
                                                                  β”‚
                                                       Yes β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β” No
                                                           β–Ό             β–Ό
                                                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                                    β”‚ Execute    β”‚  β”‚ Abort task β”‚
                                                    β”‚ + audit    β”‚  β”‚ + audit    β”‚
                                                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Sequence: Onboarding a brownfield repo

User                  UI               Orchestrator       VM (Daytona)         LLM Provider
 β”‚                     β”‚                    β”‚                  β”‚                     β”‚
 β”‚  Connect repo URL   β”‚                    β”‚                  β”‚                     β”‚
 │────────────────────►│                    β”‚                  β”‚                     β”‚
 β”‚                     β”‚   POST /projects   β”‚                  β”‚                     β”‚
 β”‚                     │───────────────────►│                  β”‚                     β”‚
 β”‚                     β”‚                    β”‚  Create workspaceβ”‚                     β”‚
 β”‚                     β”‚                    │─────────────────►│                     β”‚
 β”‚                     β”‚                    β”‚                  β”‚ Clone repo          β”‚
 β”‚                     β”‚                    β”‚                  β”‚ Detect toolchain    β”‚
 β”‚                     β”‚                    β”‚                  β”‚ Install tools       β”‚
 β”‚                     β”‚                    β”‚                  β”‚ Run graphify        β”‚
 β”‚                     β”‚                    │◄─────────────────│ Structural report   β”‚
 β”‚                     β”‚                    β”‚                  β”‚                     β”‚
 β”‚                     β”‚                    β”‚  Invoke Analyser β”‚                     β”‚
 β”‚                     β”‚                    │─────────────────────────────────────►│
 β”‚                     β”‚                    │◄─────────────────────────────────────│ Inferred rules
 β”‚                     β”‚                    β”‚                  β”‚                     β”‚ + heatmap
 β”‚                     β”‚  Show heatmap + Q1 β”‚                  β”‚                     β”‚
 β”‚                     │◄───────────────────│                  β”‚                     β”‚
 β”‚  Answer Q1..Qn      β”‚                    β”‚                  β”‚                     β”‚
 │◄────────────────────│                    β”‚                  β”‚                     β”‚
 β”‚                     β”‚  POST answers      β”‚                  β”‚                     β”‚
 β”‚                     │───────────────────►│                  β”‚                     β”‚
 β”‚                     β”‚                    β”‚  Render rule packβ”‚                     β”‚
 β”‚                     β”‚                    β”‚  β†’ .CortexBuild/   β”‚                     β”‚
 β”‚                     β”‚                    β”‚  Push to repo    β”‚                     β”‚
 β”‚                     β”‚                    │─────────────────►│                     β”‚
 β”‚                     β”‚                    β”‚                  β”‚ git push origin     β”‚
 β”‚                     β”‚                    β”‚                  β”‚ "CortexBuild init"    β”‚
 β”‚                     β”‚                    β”‚                  β”‚                     β”‚
 β”‚                     β”‚  Show first roadmapβ”‚                  β”‚                     β”‚
 β”‚                     │◄───────────────────│                  β”‚                     β”‚
 β”‚  Approve roadmap    β”‚                    β”‚                  β”‚                     β”‚
 │────────────────────►│                    β”‚                  β”‚                     β”‚
 β”‚                     β”‚  POST /run/start   β”‚                  β”‚                     β”‚
 β”‚                     │───────────────────►│                  β”‚                     β”‚
 β”‚                     β”‚                    β”‚                  β”‚                     β”‚
 β”‚                     β”‚  …work begins…     β”‚                  β”‚                     β”‚

Note: the VM (Daytona) lane above is the Phase 1 β€” planned πŸ”œ execution runtime, not yet shipped.

Failure modes + handling

Failure Detection Response
LLM provider timeout Adapter timeout (300s) Retry once with smaller model; surface to user if both fail
Provider rate limit HTTP 429 Queue; backoff; route to alternate provider if user enabled
VM crash Daytona health check Restart workspace; resume from last checkpoint (planned runtime β€” Phase 1 πŸ”œ)
Git push rejected Exit code from git push Open issue on repo; pause project; notify user
Approval timeout No user response in 24h Auto-decline; surface in dashboard
Budget exceeded Cost meter Pause project; notify user; require explicit unblock
Recurring same-class failure Ledger query Auto-promote to enforced rule; stop attempting that class
Provider key revoked Adapter auth error Mark project paused; notify user via email + UI
Worker process OOM Container metrics Auto-restart; failed task flagged for manual review