How havishalterx-eng/alter-x-4- works
1. Purpose and system shape
ALTERX is a multi-tenant autonomous execution platform with Workflow Mode (business workflows) and Project Mode (software delivery). It is a monorepo containing TypeScript/NestJS services, Python/FastAPI-style engine services, a browser client, shared contracts, and AWS infrastructure. The central design is a Platform control plane calling a separately bounded Engine.
Key roots: apps/, packages/contracts/, infrastructure/terraform/.
2. Entry points and external boundary
The main user-facing boundary is the Platform API, backed by the web SPA. The API handles identity, tenancy/RBAC, product CRUD, billing, integrations, and forwards engine requests through dedicated facades/clients. The web client provides workflow building, projects, runs, knowledge, operations, and admin surfaces.
Paths: apps/platform-api/src/main.ts, apps/platform-api/src/app.module.ts, apps/platform-web/src/main.tsx.
3. Workflow and project control plane
The orchestration service is the Engine’s durable system of record for workflows, triggers, conversations, projects, runs, artifacts, approvals, execution checkpoints, recovery, and deployment state. It compiles workflow/architecture inputs into executable DAGs, launches and observes runs, and exposes gRPC seams to execution services.
Primary flow: Platform API → orchestration APIs/facades → graph compiler → durable run queue → node execution → persisted run events/outcomes.
Paths: apps/orchestration-service/src/compiler/graph-compiler.service.ts, apps/orchestration-service/src/runs/run-launcher.service.ts, apps/orchestration-service/src/registry/nodeexec.service.ts.
4. Planning, capability binding, and execution graph
Intelligence Service turns problem understanding into plans and resolves available capabilities/agents. Its planner and architecture synthesizer feed binding decisions that the orchestration compiler converts to DAG nodes. This is the primary planning boundary for downstream graph work.
Paths: apps/intelligence-service/src/planner/kernel.py, apps/intelligence-service/src/architecture_synthesizer/service.py, apps/intelligence-service/src/selection_binding/engine.py.
5. Controlled execution gateways and workers
Node execution is deliberately mediated: Model Gateway is the only intended LLM-provider route; Tool Gateway is the external-tool route; Sandbox Service handles code execution; Verification evaluates outputs. Background workers host Temporal consumers, schedulers, and executor-related processing, separating asynchronous work from request-serving services.
Paths: apps/model-gateway/src/gateway/model-gateway.service.ts, apps/tool-gateway/src/gateway/tool-gateway.service.ts, apps/background-workers/src/platform-jobs/handlers.ts.
6. Knowledge, memory, evaluation, and governance loop
ADS Core ingests connector/upload content, normalizes/chunks/embeds it, applies source/document permissions, and serves retrieval. Memory Service stores policy and learned memory, delivers policy data, and detects drift using intelligence and cost signals. Eval Service orchestrates golden-set, red-team, chaos, and promotion-gate evidence. Audit and deletion services provide cross-system accountability and right-to-delete orchestration.
Paths: apps/ads-core/src/ingestion/pipeline.py, apps/memory-service/src/drift/detector.py, apps/eval-service/src/execution/orchestrator.py.
7. Contracts, persistence, runtime, and infrastructure
packages/contracts is the shared API/proto/schema authority; service-to-service communication uses generated gRPC contracts alongside HTTP boundaries. PostgreSQL-backed service stores use Drizzle (TypeScript) or Alembic (Python); object storage, queues/events, secrets, configuration, cache, and observability are represented through adapters. Terraform defines an eight-account AWS deployment in ap-south-1; local development includes Docker Compose, LocalStack, Grafana, and Tempo. Supported vendor integrations include AWS Bedrock/Titan, OpenAI, Anthropic, E2B/AgentCore sandboxes, Auth0/Google, Stripe/Razorpay, WhatsApp, and Temporal.
Paths: packages/contracts/proto/alter/compiler/v1/compiler.proto, packages/adapters/src/temporal/durable-execution-provider.ts, infrastructure/terraform/modules/environment/main.tf.
Main entry points: main.ts Platform API · nodeexec.service.ts Node Execution · run-launcher.service.ts Run Launcher · kernel.py Intelligence Service
Components 18
Platform Control Plane
- Platform Web · User surfaces for workflows, projects, runs, knowledge, operations, and admin.
apps/platform-web/src/main.tsx - Platform API · Identity, tenancy, product, billing, integration, and Engine facades.
apps/platform-api/src/main.ts - Platform Modules · Control-plane application wiring.
apps/platform-api/src/app.module.ts
Engine
Durable planning and execution boundary.
- Intelligence Service · Synthesizes plans, architectures, and capability bindings.
apps/intelligence-service/src/planner/kernel.py - Architecture Synthesizer · Produces architecture inputs for execution graphs.
apps/intelligence-service/src/architecture_synthesizer/service.py - Capability Binding · Resolves available agents and capabilities.
apps/intelligence-service/src/selection_binding/engine.py - Graph Compiler · Converts plans and bindings into executable DAG nodes.
apps/orchestration-service/src/compiler/graph-compiler.service.ts - Run Launcher · Launches and observes durable workflow and project runs.
apps/orchestration-service/src/runs/run-launcher.service.ts - Node Execution · gRPC seam between orchestration and execution services.
apps/orchestration-service/src/registry/nodeexec.service.ts - Model Gateway · Exclusive intended route to LLM providers.
apps/model-gateway/src/gateway/model-gateway.service.ts - Tool Gateway · Controlled route to external tools and integrations.
apps/tool-gateway/src/gateway/tool-gateway.service.ts - Background Workers · Temporal consumers, schedulers, and executor processing.
apps/background-workers/src/platform-jobs/handlers.ts
Knowledge & Governance
- ADS Core · Ingests, permission-filters, embeds, and retrieves source content.
apps/ads-core/src/ingestion/pipeline.py - Memory Service · Stores learned policy memory and detects drift.
apps/memory-service/src/drift/detector.py - Eval Service · Runs golden-set, red-team, chaos, and promotion evidence.
apps/eval-service/src/execution/orchestrator.py
Shared Runtime
- Shared Contracts · Generated API and gRPC contract source.
packages/contracts/proto/alter/compiler/v1/compiler.proto - Durable Execution Adapter · Provider boundary for durable execution.
packages/adapters/src/temporal/durable-execution-provider.ts - AWS Environment · Eight-account ap-south-1 deployment runtime.
infrastructure/terraform/modules/environment/main.tf
Connections 22
- Platform Web → Platform API: HTTPS
- Platform API → Platform Modules: composes
- Platform API → Intelligence Service: planning requests
- Platform API → Run Launcher: Engine facade
- Intelligence Service → Architecture Synthesizer: architecture synthesis
- Intelligence Service → Capability Binding: capability resolution
- Architecture Synthesizer → Graph Compiler: architecture input
- Capability Binding → Graph Compiler: bound capabilities
- Graph Compiler → Run Launcher: executable DAG
- Run Launcher → Durable Execution Adapter: durable runs
- Durable Execution Adapter → Background Workers: dispatches async work
- Run Launcher → Node Execution: launch nodes
- Node Execution → Model Gateway: model invocation
- Node Execution → Tool Gateway: tool invocation
- Node Execution → ADS Core: retrieval
- Node Execution → Memory Service: policy and memory
- Eval Service → Run Launcher: evaluation runs
- Memory Service → Intelligence Service: drift signals
- Shared Contracts → Platform API: API schemas
- Shared Contracts → Graph Compiler: compiler gRPC schema
- AWS Environment → Platform API: hosts
- AWS Environment → Durable Execution Adapter: runtime resources