Skip to content

Architecture Upgrade Program (Modular Monolith First)

Last Updated: 2026-02-28
Audience: Engineering leads, backend/frontend engineers, release owners
Status: Completed baseline program (feature-freeze track)


Objective

Upgrade the existing system architecture to align with industry best practices for:

  • scalability
  • flexibility
  • operational reliability
  • performance
  • maintainability

while intentionally pausing net-new features until architecture foundations are stable.


Target Direction

Use a Modular Monolith as the primary architecture target before any microservice split.

Why this direction:

  • lower operational complexity than early microservices
  • faster stabilization and refactor velocity
  • cleaner boundaries and dependency control
  • easier testing and observability rollout
  • preserves optional future extraction paths

Program Phases

Phase 0: Architecture Freeze + Baseline (current)

Scope

  • Freeze net-new features (except critical security/bug fixes).
  • Establish baseline metrics and current-state architecture inventory.
  • Identify boundary smells, duplicate paths, and high-risk coupling.

Deliverables

  • As-is architecture map and domain inventory
  • Ranked flaw list (severity + impact + migration risk)
  • Baseline metric capture method (latency, errors, queue, test reliability, env drift)
  • No-feature execution checklist

Exit Criteria

  • Baseline report published and accepted
  • Top architecture risks explicitly prioritized
  • Owners assigned for first structural refactor wave

Phase 1: Target Architecture + Standards

Scope

  • Define target modular blueprint (C4-lite + module boundaries).
  • Define mandatory architecture standards and rules.

Mandatory Standards

  • one canonical runtime path per concern
  • strict typed config contract (env validation is single source)
  • explicit contracts at boundaries (schema-first I/O)
  • observability-by-default for critical operations
  • deprecation policy and ADR-first architecture decisions

Deliverables

  • target module boundary map
  • architecture rulebook
  • dependency direction rules
  • refactor acceptance gates

Exit Criteria

  • Rulebook approved
  • module boundary ADR accepted
  • migration sequence locked for Phase 2

Phase 2: Structural Refactor (2–4 weeks)

Scope

  • Restructure into clear domains (chat/runtime/tools/memory/queue/auth/protocols/files).
  • Remove overlapping runtime paths and dead compatibility branches.
  • Enforce dependency direction (core domains must not depend on adapters/infrastructure).

Deliverables

  • module-by-module refactor PR sequence
  • anti-drift tests for boundary import constraints
  • reduced cross-domain coupling in orchestration layer

Exit Criteria

  • circular dependency risk removed from critical paths
  • documented canonical path for runtime/tool/queue
  • anti-drift checks passing in release gate

Phase 3: Reliability + Performance Hardening (parallel)

Scope

  • Stabilize observability and SLO-oriented operations.
  • Profile and optimize top bottlenecks.

Deliverables

  • per-stage latency visibility with stable interpretation
  • queue backlog and failure visibility
  • tool denial visibility by reason and protocol context
  • baseline SLO targets and error budget draft
  • bottleneck optimization backlog (DB, queue throughput, prompt/runtime overhead)

Exit Criteria

  • operational diagnosis possible without code spelunking
  • performance baseline and target deltas documented

Phase 4: Release Governance + Future-Proofing

Scope

  • Lock architecture discipline into release process.
  • Prepare future extraction seams without premature service split.

Deliverables

  • mandatory curated release gate usage
  • architecture guard checks in CI
  • future extraction playbook (criteria-based, not trend-based)

Exit Criteria

  • governance checks enforced consistently
  • extraction criteria documented for future scale events

Target End-State Criteria ("Good Enough to Scale")

The architecture is considered foundation-ready when all are true:

  • clear domain boundaries with no critical circular dependencies
  • single canonical path for runtime orchestration, tool execution, and queue behavior
  • curated release gate stable with low flakiness
  • typed config convergence with controlled/explicit drift
  • observability sufficient for incident diagnosis without reading source code
  • SLO-aligned performance under expected load profiles

Execution Policy

  • No feature work unless security-critical or production-critical.
  • All architecture-affecting changes must update:
    • closure done-definition
    • release-gate evidence
    • relevant ADR/rule docs
  • Every refactor PR must include:
    • boundary impact summary
    • migration safety note
    • gate test evidence

Completion Update (2026-02-28)

  • Phase 0: Completed (audit + baseline published)
  • Phase 1: Completed (rulebook + anti-drift checks active)
  • Phase 2: Completed (direct aso.service imports removed from runtime paths; facades enforce canonical access)
  • Phase 3: Completed (runtime observability snapshot and runbook operationalized)
  • Phase 4: Completed (curated release gate + architecture guard checks documented/enforced)

Program now shifts from migration mode to maintenance mode:

  • keep feature-freeze discipline for architecture-sensitive changes
  • enforce anti-drift and release-gate checks on every high-impact PR

ASO Universal Consciousness System Documentation