How havishvardhan04-creator/alter-x-3 works
1. Purpose and topology
ALTERX is a multi-tenant autonomous-execution platform with Workflow Mode and Project Mode. It combines a TypeScript/NestJS platform plane, TypeScript Engine services, Python/FastAPI intelligence services, a React/Vite web client, and shared contract-first APIs. The Platform BFF is intended as the sole Platform-facing caller of Engine/ADS.
• apps/platform-api/src/main.ts
• apps/orchestration-service/src/main.ts
• apps/platform-web/src/main.tsx
2. Public entry points and control plane
platform-web is the browser UI for workflows, projects, runs, knowledge, connections, billing, marketplace, and administration. It calls platform-api, which owns identity, tenancy/RBAC, persisted platform concerns, API aggregation, and Engine-facing facades. The API also streams run state to clients.
• apps/platform-web/src/app/router.tsx
• apps/platform-api/src/app.module.ts
• apps/platform-api/src/engine/engine-client.ts
3. Workflow/project lifecycle: orchestration as system of record
orchestration-service is the Engine’s durable lifecycle core: it stores workflows, versioned DAGs, triggers, conversations, runs, node executions, artifacts, approvals, verification results, recovery actions, and dispatch queue records. It compiles workflow/architecture inputs into executable DAGs, launches runs, records execution and stream events, and handles trigger/webhook ingress.
• apps/orchestration-service/src/compiler/graph-compiler.service.ts
• apps/orchestration-service/src/runs/run-launcher.service.ts
• apps/orchestration-service/db/schema/runs.ts
4. Planning and capability binding
intelligence-service converts problem/project intent into plans, resolves capabilities, synthesizes architectures, and binds selected implementations subject to policy. Its planner is an LLM-mediated manager/worker subsystem; it calls ADS, model gateway, and policy/binding-related services through explicit clients. The orchestration compiler is the boundary that turns these results into operational DAGs.
• apps/intelligence-service/src/planner/kernel.py
• apps/intelligence-service/src/architecture_synthesizer/service.py
• apps/intelligence-service/src/selection_binding/engine.py
5. Execution, gateways, and durable workers
Compiled runs are dispatched through the orchestration durable queue and executed via Temporal-based workers. Node handlers route LLM work through model-gateway, external-tool work through tool-gateway, and code execution through sandbox-service; these are intended provider/isolation boundaries rather than direct vendor access. Provisioning supports project build/deployment flow.
• apps/orchestration-service/src/runs/durable-run-queue.service.ts
• apps/orchestration-service/src/registry/nodeexec.service.ts
• packages/adapters/src/temporal/workflows/executor-workflow.ts
6. Knowledge, memory, verification, and recovery
ADS Core ingests connector/upload content, normalizes/chunks/embeds it, applies document/source permissions, and serves retrieval over HTTP/gRPC. Memory stores learned policy and detects drift. Verification scores quality gates; orchestration records results and selects/dispatches recovery actions. Eval service executes golden-set, red-team, chaos, and promotion-gate evaluation against the wider Engine.
• apps/ads-core/src/ingestion/pipeline.py
• apps/memory-service/src/policy_store/service.py
• apps/verification-service/src/verification/engine.py
• apps/eval-service/src/execution/orchestrator.py
7. Contracts, persistence, and infrastructure boundaries
packages/contracts contains the canonical OpenAPI, schemas, and protobuf contracts consumed across TypeScript and generated Python gRPC clients. Services maintain separate PostgreSQL schemas/migrations (Drizzle for TS, Alembic for Python). AWS Terraform provisions multi-account environment infrastructure; adapters encapsulate AWS, LLM, payment, identity, sandbox, browser, storage, observability, and Temporal integrations. Local development includes Compose, LocalStack, Grafana, and Tempo.
• packages/contracts/proto/alter/compiler/v1/compiler.proto
• packages/adapters/src/index.ts
• infrastructure/terraform/main.tf
Main entry points: main.ts Orchestration Service · kernel.py Intelligence Service · app.module.ts Platform API · compiler.proto Contracts
Components 20
Client
- Platform Web · Browser UI for platform workflows, projects, and administration.
apps/platform-web/src/app/router.tsx
Platform Plane
- Platform API · Owns identity, tenancy, RBAC, persisted platform concerns, and API aggregation.
apps/platform-api/src/app.module.ts - Engine Facade · Sole Platform-facing boundary for Engine and ADS calls.
apps/platform-api/src/engine/engine-client.ts
Execution Engine
- Orchestration Service · System of record for workflows, DAG versions, runs, executions, approvals, and recovery.
apps/orchestration-service/src/main.ts - Graph Compiler · Turns workflow and architecture inputs into executable DAGs.
apps/orchestration-service/src/compiler/graph-compiler.service.ts - Run Launcher · Launches runs and records execution and stream events.
apps/orchestration-service/src/runs/run-launcher.service.ts - Durable Run Queue
apps/orchestration-service/src/runs/durable-run-queue.service.ts - Temporal Workers · Execute dispatched DAG nodes durably.
packages/adapters/src/temporal/workflows/executor-workflow.ts - Node Execution Registry · Routes node work to isolated execution boundaries.
apps/orchestration-service/src/registry/nodeexec.service.ts - Execution Gateways · Model, tool, sandbox, and provisioning adapters isolate external execution.
packages/adapters/src/index.ts - Orchestration Store · Persists runs and execution lifecycle records.
apps/orchestration-service/db/schema/runs.ts
Intelligence & Quality
- Intelligence Service · Plans projects, synthesizes architectures, and binds capabilities under policy.
apps/intelligence-service/src/planner/kernel.py - Architecture Synthesizer
apps/intelligence-service/src/architecture_synthesizer/service.py - Selection & Binding
apps/intelligence-service/src/selection_binding/engine.py - Verification Service · Scores verification results used for recovery decisions.
apps/verification-service/src/verification/engine.py - Eval Service · Runs golden-set, red-team, chaos, and promotion-gate evaluations.
apps/eval-service/src/execution/orchestrator.py
Knowledge Services
- ADS Core · Ingests sources, enforces permissions, and serves retrieval over HTTP/gRPC.
apps/ads-core/src/ingestion/pipeline.py - Memory Service · Stores learned policy and detects drift.
apps/memory-service/src/policy_store/service.py
Shared Foundation
- Contracts · Canonical cross-runtime API contracts and generated clients.
packages/contracts/proto/alter/compiler/v1/compiler.proto - AWS Infrastructure · Provisions multi-account environment infrastructure.
infrastructure/terraform/main.tf
Connections 25
- Platform Web → Platform API: platform API
- Platform API → Engine Facade: engine/ADS facade
- Engine Facade → Orchestration Service: workflow and run requests
- Engine Facade → ADS Core: knowledge requests
- Orchestration Service → Graph Compiler: compile inputs
- Graph Compiler → Intelligence Service: planning and architecture
- Intelligence Service → Architecture Synthesizer: synthesize
- Intelligence Service → Selection & Binding: bind capabilities
- Intelligence Service → ADS Core: retrieve context
- Intelligence Service → Memory Service: policy and drift
- Graph Compiler → Run Launcher: executable DAG
- Run Launcher → Durable Run Queue: dispatch
- Durable Run Queue → Temporal Workers: durable work
- Temporal Workers → Node Execution Registry: execute nodes
- Node Execution Registry → Execution Gateways: LLM, tools, sandbox, provisioning
- Orchestration Service → Verification Service: verification requests
- Verification Service → Orchestration Service: results and recovery signals
- Eval Service → Orchestration Service: evaluate engine
- Orchestration Service → Orchestration Store: persist lifecycle
- Platform API → Platform Web: run-state stream
- Contracts → Platform API: API contracts
- Contracts → Orchestration Service: service contracts
- Contracts → Intelligence Service: generated contracts
- AWS Infrastructure → Platform API: provisions
- AWS Infrastructure → Orchestration Service: provisions