Skip to main content

AlphaSwarm First-Class Module Transformation Plan

Status: Proposed (planning only — no production runtime change in this document set).
Date: 2026-08-10
Evidence tracks: DOC (4ada4996…), A+E (8019545a…), B+C (eb4b09c8…), D+F (07eed925…).
Related ADRs: 015 · 016 · 017 · 018 · 019 · 020
Evidence index: alphaswarm-first-class-module-evidence-index.md

Evidence tag legend​

TagMeaning
AClaim from attached source reports (R1/R2/R3) or orientation docs
BRepository fact (path/symbol verified in this planning pass or a track)
CArchitecture recommendation of this plan
DExternal technical guidance cited by sources
EOpen question / unsupported / needs measurement
VERIFIEDSpot-checked or track-read against live files
PARTIALLY VERIFIEDGrep/doc evidence + structural inference
INFERREDPattern inference only
PROPOSEDTarget-state design not yet implemented
BLOCKEDNo evidence found; do not assert existence

1. Executive summary​

Primary decision (C, justified by B): Adopt a monorepo-local compatibility facade that promotes the existing alphaswarm Python namespace as the stable public domain/application kernel. Implementation owners remain separately deployable:

ConcernOwner today (B)
Wire/contracts / workload ABCalphaswarm_core
Mutation authority /manage/*alphaswarm_controller (WorkloadRuntime, TerraformRuntime)
Distributed executionalphaswarm_worker (WorkRequest, Executor, ExecutorRouter, NativeExecutor)
Orchestration enginesalphaswarm_orchestration (EngineKind.DAGSTER / PREFECT — not Temporal)
ML / RL / agents / KB specialistsalphaswarm_models, alphaswarm_rl, alphaswarm_agents, alphaswarm_kb
Money-plane bot adaptersalphaswarm_bots
Quant domain + API compositionalphaswarm monolith (facade home)

Reject (A→C, affirmed by B): SimulationMeta as core; LLMs as live execution peers; a second scheduler/execution/MLOps/deployment control plane; duplicating DeploymentSpec as RuntimeDeploymentSpec; inventing asctl or Temporal orchestration.

Secondary alternative (C): Generated contracts package (alphaswarm_catalog-style) or PEP 420 namespace aggregation — useful for wire schemas, too thin as the application kernel (see §7).

Immediate focus: close domain dual-representation hotspots (Symbol/BarData/OrderRequest), unify ExecutionProfile translation, formalize Activity vs Simulation vs Workflow vs WorkRequest vs DeploymentSpec vocabulary, and turn on safety gates (tenancy_rls_enforce, halt propagation, MCP audience) before any live-execution expansion.


2. Source-document findings​

Source shorthand (A): R1 Python Trading Simulation Architecture · R2 Quantitative Trading Architecture Guide · R3 deep-research critique · Ctx alphaswarm_internal/ARCHITECTURE.md (orientation only).

Retain (map into AlphaSwarm)​

ConceptTagDisposition
Pure kernels + externalized contextAStrengthen strategy/engine purity
Multi-mode engines (batch / replay / paper / live)A+BAlready exist as backtest cascade + paper + worker profiles
Numba path-dependent research kernelsA+BHFT LOB path already uses @njit
Canonical event log + golden replay digestsA+CStrengthen promotion/parity
Independent deterministic risk / kill / fail-closedA+BRiskLimits, GateChain, kill switch
Bounded queues + typed backpressureA+CForbid silent critical drops
Strangler Fig migrationA+CPhases 0–8 below
Engine protocol + factory/registryA(R3)+BPrefer over metaclasses
LLM structured advisory above riskA+BOrderIntent airlock

Reject / quarantine​

ConceptTagDisposition
SimulationMeta as platform coreA→CReject — opacity, no semantic unification
Write-once identical semantics across vectorized↔live↔agent DAGA→CShare kernels + events, not engines
Marketing latency (100–500×, 1M msg/s, sub-µs) as requirementsA→EReject until measured harness exists
Broken SHM ring samples / “zero-copy” via Python dictsA→CQuarantine until redesigned
LLMs / Ray as order-path peersA→CResearch/advisory only
SQLite LangGraph checkpointer as prod defaultA→CDurable checkpointer for prod
ROS 2 / Laguna-specific MoE hardware as platform reqA→CReject
Temporal as AlphaSwarm orchestrationA(hyp)→BABSENT — Dagster/Prefect only

Unsafe source claims corrected explicitly (A→B)​

  1. Temporal orchestration in controller — CORRECTED ABSENT (B): EngineKind = dagster | prefect only (alphaswarm_orchestration/.../contracts.py).
  2. asctl CLI — CORRECTED ABSENT (B): entry points are alphaswarm-controller, alphaswarm-cli-control-plane, alphaswarm-controller-operator.
  3. Need for RuntimeDeploymentSpec — CORRECTED (B): use existing DeploymentSpec in alphaswarm_core/.../models/deployment.py.
  4. Terraform cell module — CORRECTED ABSENT (B): cells are Kustomize overlays under alphaswarm_platform/deployments/kubernetes/cells/; ArgoCD AppSets exist.
  5. SimulationSpec / PyO3 / SHM production path — BLOCKED in repo search; de facto simulation is GraphSpec(mode="simulation") (B).
  6. NautilusTrader library import — domain is “Nautilus-inspired”; live bridge referenced for event-driven path — do not claim full library embedding without further verification (PARTIALLY VERIFIED / INFERRED).

3. Repository current-state architecture​

Package roles (B — Track A+E, spot-verified)​

Spec-driven runtimes already present (B)​

SpecRuntimeSpec versionsLedger
AgentSpecAgentRuntimeagent_spec_versionsagent_runs_v2
WorkflowSpecWorkflowRuntimeworkflow_spec_versionsworkflow_runs
BotSpecBotRuntimebot_versionsbot_deployments
RLExperimentSpecRLRuntimerl_experiment_versionsrl_runs
AnalysisSpecAnalysisRuntimeanalysis_spec_versionsanalysis_runs
GraphSpecLabRuntimecontent-hash on lab_graphslab_runs
KBCorpusSpecKBRuntimekb_corpus_spec_versionskb_runs
MLSkillSpecMLSkillRuntimeml_skill_versionsml_skill_runs
TerraformStackSpecTerraformRuntimeterraform_stack_spec_versionsterraform_runs
workload opsWorkloadRuntimen/aworkload_runs

Mutation authority (B — Track D)​

  • Workload ops: WorkloadRuntime (alphaswarm_core) executed via controller/embedded modes.
  • IaC provisioning: TerraformRuntime (controller only sanctioned subprocess).
  • Surface: /manage/* on controller; monolith brokers where flagged.
  • State of record: Postgres ledgers; controller JSONL + HTTP sink for terraform audit.

4. Evidence inventory​

See also evidence index.

IDClaimTagPath / symbol
E1WorkRequest / Executor / ExecutorRouter / NativeExecutor existVERIFIEDalphaswarm_worker/.../execution/{contracts,base,router,native}.py
E2DeploymentSpec exists (no RuntimeDeploymentSpec)VERIFIEDalphaswarm_core/.../models/deployment.py
E3EngineKind = Dagster/Prefect onlyVERIFIEDalphaswarm_orchestration/.../contracts.py
E4Controller entry points (no asctl)VERIFIEDalphaswarm_controller/pyproject.toml
E5Cells via KustomizeVERIFIEDalphaswarm_platform/deployments/kubernetes/cells/*/kustomization.yaml
E6GraphSpec simulation modeVERIFIEDalphaswarm/lab/schema.py mode: Literal[...,"simulation"]
E7Default-OFF: RLS, MCP RFC8707, halt propagationVERIFIEDalphaswarm/config/settings.py
E8Research→paper metadata gateVERIFIEDalphaswarm/trading/metadata_gate.py
E9ExecutionProfile dual definitionVERIFIEDworker Enum vs orchestration PortableModel
E10Domain dual-rep hotspotsVERIFIEDcore/types.py vs core/domain/
E11Missing Forecast/Calibration/Benchmark/Scenario/Listing/Fills typesBLOCKED/GAPTrack B search
E12No PyO3/SHM/SimulationMeta/SimulationSpecBLOCKEDTrack B+C search
E13No tests/perf harnessBLOCKEDTrack F
E14PromotionPolicy + GateChainVERIFIED/PARTIALLYlab/evidence/promotion.py, promotion/gate.py

5. Source-to-code mapping​

Source concept (A)Existing AlphaSwarm surface (B)Mapping status
First-class SimulationGraphSpec(mode="simulation") + backtest engines + LabRuntimeSurrogate exists; no SimulationSpec
VECTORIZED paradigmVectorbtProEngine, worker VECTORIZED_BACKTESTMapped
EVENT_DRIVEN syncEventDrivenBacktester, SimulatedBrokerageMapped
EVENT_DRIVEN async / livepaper session + NativeExecutor + bots adaptersMapped (partial live)
AGENT_DIRECTED_DAGWorkflowRuntime / LangGraph adaptersMapped as agent plane, not engine peer
Deployment topologyDeploymentSpec + Kustomize cells + ArgoCDMapped — do not add RuntimeDeploymentSpec
Metaclass engine selection@register / RLComponent / InfrastructureProviderMeta / EngineCapabilitiesPrefer registry/factory (C)
Risk gateGateChain, RiskLimits, worker _risk_gate, bots RTS6Mapped
SHM / PyO3 HFTNot found as product pathReject until redesigned (C)
RAG episodic journalalphaswarm_kb + HierarchicalRAG shimsOptional KB feature
Distributed sweepsworker Ray/Dask/Spark backends (research plane)Mapped; MONEY → native only
Temporal workflows—Do not map — absent

6. Current problems and risks​

Anti-patterns to refuse (C — §26 of assignment)​

  1. Second control plane for scheduling, execution, MLOps, or deployment.
  2. SimulationMeta / hidden method rebinding as public architecture.
  3. LLM → venue order without OrderIntent + deterministic gates.
  4. Duplicate DeploymentSpec / WorkRequest / ExecutorRouter.
  5. Big-bang rename of alphaswarm_core → “the platform” (wrong layer).
  6. Silent queue drops on risk/order events.
  7. Marketing latency numbers as acceptance criteria.
  8. Turning on money plane while RLS / halt-propagation / MCP audience remain OFF.
  9. Editing shipped Alembic migrations or mutating hash-locked *_spec_versions.
  10. Agent ORM/Iceberg direct reads (Hard Rule 22).

Highest-impact risks​

RiskSeverityEvidence
Domain dual-representation drift (Symbol/BarData/OrderRequest)HighB Track B H1–H3
Live expansion with tenancy_rls_enforce=offHighB settings
orchestration_kill_propagation_enabled=False leaves sub-runs aliveHighB settings + Track D
ExecutionProfile translation gap worker↔orchestrationMediumB E9
No performance regression suiteHigh for liveB Track F Gap
Missing first-class Forecast/Scenario/Fills etc.MediumB Track B
Credential store duplication (alphaswarm_config vs core)MediumCtx / ARCHITECTURE

7. Definition of first-class alphaswarm​

Primary approach (C) — selected​

Monorepo-local compatibility facade package promoting the existing alphaswarm Python namespace as the stable public domain/application kernel.

What “first-class alphaswarm” means (C, aligned to assignment §1 intents):

  1. Canonical public Python namespace for platform capabilities.
  2. Owner of stable domain vocabulary (instruments, orders, bars, intents) — not infra ABCs alone.
  3. Entry for defining investment/trading activities.
  4. Entry for creating simulations / studies / workflows / work requests (typed facades, not new engines).
  5. Compatibility facade over existing execution/model/orchestration/deployment owners via translation adapters.
  6. Home of versioned interfaces, protocols, schemas, state machines, registries that application code imports.
  7. Boundary preventing app code from depending on infra SDKs directly.
  8. Surface through which governance, authorization, provenance, and PIT constraints are expressed.
  9. Composable kernel — not a second monolith framework.
  10. Migration target preserving production behavior until cutovers are flag-gated.

Why not promote alphaswarm_core alone (C)​

alphaswarm_core is correctly dependency-light contracts (DeploymentSpec, WorkloadRuntime, providers, RBAC). It is the wrong layer for quant domain types, strategy runtimes, Iceberg writes, and Celery-mounted tasks. Promoting it would either (a) bloat it into a second monolith or (b) force every app import through an incomplete kernel.

Secondary alternatives (C)​

AlternativeProsConsVerdict
PEP 420 namespace aggregationClean packaging storyHarder import-boundary CI; risk of circular installsSecondary
Generated contracts package (extend alphaswarm_catalog)Strong for OpenAPI/JSON Schema wireToo thin for domain kernels & runtimesSecondary / complementary
Big-bang rename / merge packagesApparent simplicityBreaks every consumer; violates Strangler FigRejected

Expansive internal layer model mapped onto EXISTING packages (C→B)​

LayerResponsibilityExisting home
L0 PresentationUI/CLI/BFFalphaswarm_ui, alphaswarm_admin, alphaswarm_client, alphaswarm_cli
L1 API compositionHTTP/WS gatewayalphaswarm_api, alphaswarm/api
L2 Application kernel (facade)Domain services, activity APIsalphaswarm (promoted)
L3 Domain modelInstruments, orders, positions, eventsalphaswarm/core/domain (+ legacy types strangler)
L4 Spec/runtime servicesHash-locked runtimesagents/bots/rl/kb/models/analysis/lab
L5 Execution dispatchWorkRequest routingalphaswarm_worker
L6 Orchestration adaptersDagster/Prefectalphaswarm_orchestration
L7 Mutation / infraWorkload + Terraformalphaswarm_controller + alphaswarm_core
L8 Data planeIceberg/Hudi/Kafka/MCPalphaswarm/data, ingest, streaming
L9 IdentityIdP, M2M, step-upalphaswarm_auth + monolith security
L10 ObservabilityOTEL, progress framesalphaswarm_core.observe, _progress

8. Target domain model​

Keep and converge (B→C)​

  • InstrumentBase hierarchy + InstrumentId / IdentifierSet (core/domain/)
  • DomainOrder / DomainPosition / ExecutionReport
  • RiskLimits, kill switch, PricingContext
  • StrategyPromotionRequest, OrderIntent
  • Spec family: BotSpec, AgentSpec, RLExperimentSpec, WorkflowSpec, GraphSpec, MLSkillSpec, KBCorpusSpec

Add as first-class domain types (PROPOSED — currently BLOCKED/GAP)​

TypeRationaleSuggested home
ForecastModels return ad-hoc arrays todayalphaswarm/core/domain/forecast.py
CalibrationResultPricing “Calibrated” lacks entitycore/domain/calibration.py
BenchmarkReferenced but no classcore/domain/benchmark.py
ScenarioOverrides exist; no entitycore/domain/scenario.py
Listing (Instrument×Venue)Only string primary_listing_venuecore/domain/listing.py
Fill / fill rowsMulti-partial fills need historypersist beside execution_reports

Dual-representation consolidation (C)​

Legacy (core/types.py)Target (core/domain/)Phase
SymbolInstrumentId (+ Symbol shim)Phase 2–3
BarDataBar / BarSpecificationPhase 2–3
OrderRequest / OrderDataDomainOrderPhase 3–4
Signalnew domain SignalPhase 3
PortfolioTargetricher portfolio VOPhase 4

9. Target package architecture​

Rules (C):

  • New public imports prefer alphaswarm.<domain> stable paths.
  • Facades may wrap worker/controller/specialists; specialists must not invent parallel public APIs for the same nouns.
  • alphaswarm_core remains the shared infra contract wheel; domain richness stays in alphaswarm.
  • No new top-level alphaswarm_simulation runtime package unless GraphSpec/LabRuntime prove insufficient after Phase 3 review.

10. Control-plane / data-plane / money-plane architecture​

PlaneAuthority (B)Must not
Controlcontroller /manage/*, WorkloadRuntime, TerraformRuntimeCall venues; host strategy math
DataIceberg wrapper, DataMCP, lineageAccept orders
MoneyNativeExecutor + bots + GateChain + RiskLimitsConsult LLMs inside risk gate
LLMAgent/Workflow runtimesBypass OrderIntent; mutate hard limits upward

See ADR-036.


11. Activity model​

Definition (C): An Activity is a short-lived, auditable unit of work with clear inputs/outputs, no long-running checkpointed graph, and optional side effects under existing gates.

Candidates mapped from repo (B→C):

ActivityExisting mechanism
DataMCP tool invokeDataMCPTool + audit
Ingestion approval stepIngestionApproval state machine
Pricing calc()PricingContext
Single cache refresh / entity listmetadata cache routes
Emit security auditemit_audit_event

Non-goals: Do not introduce Temporal Activities. Do not rename Celery tasks wholesale. Optionally add a thin alphaswarm.activity facade that documents/standardizes logging + tenancy stamps (PROPOSED Phase 2).


12. Simulation model​

Definition (C): A Simulation is a deterministic or quasi-deterministic replay against pinned data with no live venue side effects.

ModeExisting (B)Notes
Vectorized historicalVectorbtProEngineResearch throughput
Event-driven bar replayEventDrivenBacktester + SimulatedBrokerageChronological fidelity
LOB/HFTLobBacktestEngineNumba driver
Lab graph simulationGraphSpec(mode="simulation") → Dagster bridgeDe facto SimulationSpec
RL episode (train/eval, non-paper)RLRuntimeTrajectories to Iceberg

Shared across modes (C): pure decision kernels + canonical market/order events + digestable state hashes.
Not shared: clocks, fill models, reconnects, ACKs — owned by each engine.

Reject: single metaclass Simulation that claims live parity. See ADR-034 / ADR-035.


13. Runtime and deployment model​

Distinguish without collapsing (C)​

ConceptQuestion it answersExisting type (B)
ActivityWhat atomic work just ran?DataMCP / approval steps (facade PROPOSED)
SimulationWhat offline replay am I running?GraphSpec simulation / backtest engines
WorkflowWhat multi-step checkpointed graph?WorkflowSpec + WorkflowRuntime
WorkRequestWhat resource-bounded dispatch unit?alphaswarm_worker.WorkRequest
DeploymentSpecWhat infra deploy am I requesting?alphaswarm_core.models.deployment.DeploymentSpec

Deployment topology (B)​

  • Cells: Kustomize overlays (cells/shared-*, cells/silo-*) with alphaswarm.io/cell-id.
  • GitOps: ArgoCD ApplicationSets for services + observability.
  • Worker deploy: deployments/kubernetes/base/alphaswarm-worker/.
  • Bots CRDs: quantbot.io/v1 via controller operator.

Do not invent a Terraform cell module or RuntimeDeploymentSpec.


14. Agent and RAG architecture​

ConcernOwner (B)Rule
Agent executionAgentRuntimeNo direct ORM/Iceberg; DataMCP only
Multi-agent workflowsWorkflowRuntime + adaptersHalt + versioning
LLM callsrouter_completeHard Rule 2
KB remember/recallKBRuntime / data.kb.*Hard Rules 56–60
Cross-silo recallalphaswarm_kb_federation onlyRead-only
Structured outputs → tradeMust become OrderIntent then gatesADR-037

LLMs are advisory peers, never money-plane peers (C). They may tighten risk, never raise hard limits.


15. Multi-tenancy and security model​

ControlDefault (B)Live-expansion requirement (C)
tenancy_rls_enforceoff≥ permissive, then strict with tests
mcp_require_rfc8707offpermissive before external MCP exposure
orchestration_kill_propagation_enabledFalseTrue before multi-runtime live
ws_auth_requiredFalseTrue for hosted
enable_money_plane (worker)FalseExplicit ops enable + HMAC approval
Step-up MFACI-enforced on destructive routesKeep expanding pattern list
Trust zonesUI / admin / controller / dataNever merge staff & customer processes

Identity matrix remains Entra-first for hosted UI/admin; CLI device flow; M2M via Agent Identity / CredentialResolver.


16. Public API examples​

Examples use existing names (B); new facade wrappers are PROPOSED.

# Domain identity (prefer domain; Symbol shim during strangler)
from alphaswarm.core.domain.identifiers import InstrumentId
from alphaswarm.core.types import Symbol # legacy shim — deprecate

sym = Symbol.parse("AAPL.US") # Hard Rule 1 during transition
# iid = InstrumentId(...) # target

# Simulation via lab GraphSpec (de facto SimulationSpec)
from alphaswarm.lab.schema import GraphSpec
from alphaswarm.lab.runtime import LabRuntime

spec = GraphSpec(mode="simulation", ...) # hashable graph
result = LabRuntime(spec).run()

# WorkRequest dispatch (worker contracts)
from alphaswarm_worker.execution.contracts import (
WorkRequest, ExecutionProfile, Plane, DataBinding, ResourceSpec,
)

req = WorkRequest(
profile=ExecutionProfile.VECTORIZED_BACKTEST,
plane=Plane.LLM, # never MONEY without NativeExecutor path
data_binding=DataBinding(...), # Iceberg snapshot pin
resources=ResourceSpec(...),
idempotency_key="...",
)

# Bot money-plane lifecycle
from alphaswarm_bots.spec import BotSpec
from alphaswarm_bots.runtime import BotRuntime
BotRuntime(bot_spec).run_paper(...) # still subject to metadata_gate

# Infra deploy — existing DeploymentSpec, not RuntimeDeploymentSpec
from alphaswarm_core.models.deployment import DeploymentSpec
deploy = DeploymentSpec(...) # provider.deploy(deploy)

Facade aspiration (PROPOSED):

from alphaswarm import activities, simulations, workflows, work, deploy

simulations.run(graph_spec) # -> LabRuntime / backtest runner
work.submit(work_request) # -> WorkSubmissionClient
workflows.run(workflow_spec) # -> WorkflowRuntime
deploy.apply(deployment_spec) # -> controller /manage (HTTP)

17. Existing-to-target component map​

Existing package / surfaceTarget roleAction
alphaswarmPublic domain/application kernel + facadePromote; add facade modules; strangler domain
alphaswarm_coreInfra contracts / WorkloadRuntime / DeploymentSpecKeep thin; do not absorb quant domain
alphaswarm_controllerSole mutation executorKeep; no Temporal; no asctl rename
alphaswarm_workerSole WorkRequest execution planeKeep; MONEY→NativeExecutor
alphaswarm_orchestrationDagster/Prefect adaptersKeep; unify ExecutionProfile translation
alphaswarm_agentsAgent/Workflow specialistsKeep behind facade
alphaswarm_botsMoney-plane bot unitKeep
alphaswarm_rlRL specialistKeep
alphaswarm_modelsML specialist + interfacesKeep; emit domain Forecast
alphaswarm_kb (+ federation)Cognitive memoryKeep
alphaswarm_platformIaC/GitOps/cellsKeep Kustomize cells
alphaswarm_api / _auth / _cli / _ui / _adminEdgesUnchanged boundaries
alphaswarm_catalogContracts-onlyComplementary generated schemas
alphaswarm_internalSSoT inventoriesOrientation, not runtime
Legacy core/types.pyCompatibility shimsDeprecate per ADR-038
Hypothetical Temporal / asctl / SimulationMeta—Do not create

18. Dependency rules​

UI/CLI/Admin  --HTTP-->  api / auth / monolith / controller
monolith (alphaswarm) --> core, worker(contracts), agents, bots, rl, models, kb, orchestration
controller --> core ONLY (CI rg guard)
worker --> core ONLY (+ optional ray/dask/spark)
kb_federation --> NOT alphaswarm.* / alphaswarm_kb.*
agents --> DataMCP / router_complete; NOT persistence ORM
bots money adapters --> GateChain / RiskLimits; NOT raw LLM SDKs

New facade modules may import owners; owners must not import facade internals in a cycle. Translation adapters live in alphaswarm/facade/ or alphaswarm/compat/ (PROPOSED naming).


19. State-machine definitions​

EntityStates (B / C)Notes
IngestionApprovalpending→approved/rejected→applied/failed/expiredB
WorkStatusSUCCESS/FAILED/DEAD_LETTERED/DRAINED/SKIPPED_CACHED/HALTEDB worker
CanonicalRunStatePENDING/RUNNING/SUCCESS/FAILED/CANCELLED/SKIPPEDB orch
EntraTenantLinkpending→active (+ reject)B
Paper sessionstart→running→stopped/haltedB
Order (domain)Nautilus-inspired lifecycle on DomainOrderB
Promotionresearch evidence→StrategyPromotionRequest→GateChain→live eligibilityB+C
Kill switchengaged/released (Redis)B
Spec versionsimmutable snapshots; never mutateB hard rules

20. Migration phases (Strangler Fig, Phase 0–8)​

PhaseNameGoalAcceptanceRollback
0Freeze vocabularyADRs accepted; anti-pattern list in CI docs; no new duplicate typesADR 033–020 accepted; evidence index linkedN/A (docs)
1Facade skeletonalphaswarm.facade re-exports + docs; zero behavior changeImport smoke tests; no new deps cyclesDelete facade package
2Contract alignmentSingle ExecutionProfile translation module; document Activity/Simulation/Workflow/WorkRequest/DeploymentSpecGolden translation tests worker↔orchFeature-flag off translator
3Domain stranglerEngine + paper paths migrate off legacy Symbol/BarData/OrderRequestParity tests; deprecation warningsShim re-enable
4Missing domain typesForecast, Scenario, Listing, Fill rows (additive)Migrations + MCP/cache pickers where neededLeave unused types; no forced cutover
5Simulation clarityFormal Simulation facade over GraphSpec/backtest; golden replay digestsReplay hash equality on fixtureFacade-only rollback
6Safety gates ONRLS permissive→strict path tested; halt propagation ON in staging; MCP audience permissiveTrack F gates 3–4–8 greenFlag revert to off
7Live-expansion readinessPerf baselines; money-plane checklist; promotion four-eyesGate 9 harness + metadata_gate + GateChain e2eKeep money plane OFF
8Deprecation harvestRemove unused legacy imports; update AGENTS/indexImport linter clean; curator refreshRestore shims one release

21. Test strategy​

Build on Track F inventory (B):

LayerAction (C)
UnitExpand domain shim/parity tests under tests/core/
ContractExecutionProfile translator; WorkRequest schema freeze tests
Boundary CIKeep 14 lints; add “no RuntimeDeploymentSpec / no Temporal import” guards
IntegrationRLS-on suite (new); halt fan-out with propagation flag ON
ReplayGolden event-log digests for event-driven + LOB fixtures
ChaosExtend beyond RL to agent + worker crash mid-WorkRequest
PerfCreate tests/perf/ with pytest-benchmark — do not cite unverified README latency (E)
E2ERestore admin Playwright coverage; UI navigation already growing

22. Performance strategy​

Methodology (C) — reject unverified A claims:

  1. Define per-stage SLOs: ingest→strategy intent→risk→send (paper/live), kill-switch engage→all halt acks, WorkRequest queue wait.
  2. Measure p50/p95/p99/p99.9 at fixed offered load + burst; record CPU/mem.
  3. Separate research throughput benches (vectorized sweeps) from money-plane latency benches.
  4. Native/HFT paths: measure at native boundary; do not claim zero-copy across Python object handoff without buffer proofs.
  5. Free-threaded CPython: optional experiment (E) — not a design assumption.

No acceptance criterion may cite AlphaForge/BTQuant/blog 100–500× figures (A→E).


23. Deployment and rollout strategy​

  • Use existing GitOps/Kustomize cells — no new cell Terraform module.
  • Roll facade by package version compatibility, not big-bang cutover.
  • Hosted flags flipped per cell with dual-write only where already supported (cell_dual_write remains explicit).

24. Rollback strategy​

Change classRollback
Facade modulesRevert package; callers keep deep imports
Domain shimsRe-export legacy types; warning level only
Flag promotions (RLS/MCP/halt)Set back to off/False via config
Worker/orch translatorBypass flag to dual accept
MigrationsAdditive only; never edit shipped; follow-up migration to undo schema
ArgoCD syncPrevious image digests / AppSet revision

25. Risk register​

IDRiskMitigation
R1Facade becomes a new god-objectThin re-exports only; logic stays in owners
R2Domain migration breaks enginesPhase 3 parity + shim window
R3Live trading without RLSPhase 6 hard gate
R4Duplicate ExecutionProfile diverges furtherPhase 2 translator ownership
R5Agents invent second order pathADR-037 + CI import/lint
R6Perf unknown at cutoverPhase 7 harness mandatory
R7Index/docs driftIndex debt note + curator pass
R8Cred store dual pathUnify config/core stores (tracked separately)

26. Decisions requiring approval​

  1. Accept Primary approach (facade over alphaswarm namespace) — ADR-033.
  2. Reject SimulationMeta; accept Engine protocol — ADR-034/017.
  3. Confirm plane boundaries — ADR-036.
  4. Confirm research→order authorization chain — ADR-037.
  5. Deprecation window length for core/types.py (propose 2 minor releases) — ADR-038.
  6. Phase 6 flag schedule for RLS / halt propagation / MCP audience in staging→prod.
  7. Whether to add additive Fill table vs enrich execution_reports only.
  8. Whether LabRuntime joins AGENTS hard-rule list as 9th canonical runtime (docs/governance).

27. Prioritized implementation backlog​

Immediate next sprint (executable tickets — do not implement in this doc set)​

IDTicketOutcome
S1Accept ADRs 033–020 in arch reviewGovernance lock
S2Add CI guard: ban new RuntimeDeploymentSpec, SimulationMeta, temporalio importsPrevent regression
S3Draft alphaswarm/facade/ skeleton + import smoke tests (no behavior change)Phase 1 start
S4Implement ExecutionProfile translator module + bidirectional testsClose H4
S5Inventory all core/types.py import sites; publish strangler spreadsheetPhase 3 prep
S6Design RFC for Forecast + Scenario domain types (schemas only)Phase 4 prep
S7Add tests/perf/ scaffold with kill-switch + WorkloadRuntime benchmarksGate 9 start
S8Staging plan: enable orchestration_kill_propagation_enabled + measure fan-outPhase 6 prep
S9RLS-on integration test plan (fixture tenants, negative cross-tenant)Phase 6 prep
S10Curator refresh after docs land (or keep debt note)Index compliance

Medium backlog​

  • Golden replay digests for event-driven + LOB.
  • Listing + Fill persistence design.
  • Admin Playwright restoration.
  • Credential store unification (alphaswarm_config vs alphaswarm_core).
  • Document LabRuntime in AGENTS hard-rule table.

28. Definition of done​

This transformation program is done when:

  1. ADRs 033–020 accepted and linked from intro/architecture indexes.
  2. Public guidance states: import domain/application via alphaswarm; infra contracts via alphaswarm_core; mutate via controller; execute via worker.
  3. No duplicate DeploymentSpec/WorkRequest/ExecutorRouter/control planes introduced.
  4. Domain dual-rep hotspots have a dated deprecation path with CI tracking.
  5. ExecutionProfile translation is single-homed with tests.
  6. Activity / Simulation / Workflow / WorkRequest / DeploymentSpec vocabulary appears in AGENTS/docs without collapse.
  7. Safety flags for RLS, halt propagation, and MCP audience have a staged enablement record.
  8. Perf methodology and harness exist; no marketing latency claims remain in requirements.
  9. alphaswarm_index refreshed (curator) for new architecture docs.
  10. Production behavior unchanged except behind explicit approved flags.

Appendix A — Mermaid: target request paths​

Appendix B — Document control​

FieldValue
AuthorsConsolidation architect (planning subagent)
InputsTracks DOC, A+E, B+C, D+F; spot verification 2026-08-10
Non-goalsNo production Python/TS behavior changes in this change set
NextArchitecture review → sprint tickets S1–S10