Skip to main content

Architecture

X4 is organized around a few stable boundaries.

Main Components​

ComponentLocationResponsibility
X4 CLIsrc/cli.tsWorkspace, registry, sandbox, remote, control, GitHub, issue, PR, and orchestration commands.
Registryregistry/*.yamlRepo sets, sandbox profiles, env bundles, and validation commands.
Execution modelinfra/execution/x4-execution-model.yamlControl nodes, workers, SSH users, worker classes, and state roots.
Codex pluginplugins/x4-codex/Codex skills that route agents through the X4 CLI.
VS Code adapterextensions/vscode-x4/IDE commands for X4 workspace and validation flows.
Mastra orchestratorapps/mastra-orchestrator/GitHub bot workflows for planning, implementation, PR follow-up, testing, and triage.
Scriptsscripts/Install, update, bootstrap, and smoke helpers for devboxes/control/workers.

Runtime Topology​

Mastra Orchestrator Topology​

Boundary Rules​

  • The CLI owns deterministic workspace operations.
  • Mastra owns GitHub event orchestration and bot state.
  • Codex owns agentic inspection and edits when explicitly invoked by Mastra or a human/agent workflow.
  • Remote workers own execution artifacts, not policy decisions.
  • GitHub comments and checks should be generated from structured X4 evidence.