azcodr 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,9 +3,9 @@ name: lets-build
3
3
  description: Use when initializing or bootstrapping a new project from this template workspace, or when the user invokes '/lets-build' to conduct deep research and relentless questioning across language, stack, frameworks, package managers, databases, and architectural layers, followed by scaffolding the finalized project. Do not use for routine bug fixing, editing existing code features, or auditing already bootstrapped projects.
4
4
  ---
5
5
 
6
- # Let's Build: Interactive Architecture Research & Project Bootstrapper
6
+ # Let's Build: Problem-First Architecture Research & Project Bootstrapper
7
7
 
8
- > **Core Purpose:** Conduct an exhaustive, relentless architectural interview across all 18 systemic dimensions to finalize technical choices (language, runtime, frameworks, package managers, databases, tenancy, auth, workflows, observability, CI/CD) with zero assumptions, synthesize an approved ADR, and bootstrap the project following strict Hexagonal architecture.
8
+ > **Core Purpose:** Conduct an exhaustive, problem-first architectural interview across domain essence, physical constraints, and system topology to derive technical choices (language, runtime, frameworks, build tools, architectural style) with zero assumptions, synthesize an approved ADR, and bootstrap a lean, strictly YAGNI project foundation.
9
9
 
10
10
  ---
11
11
 
@@ -27,50 +27,53 @@ description: Use when initializing or bootstrapping a new project from this temp
27
27
  Progress through five mandatory stages:
28
28
 
29
29
  ```
30
- 1. DISCOVER (Toolchain & Root) ──► 2. INTERROGATE (Relentless Interview) ──► 3. SYNTHESIZE (ADR & Blueprint) ──► 4. BOOTSTRAP (Scaffold Code) ──► 5. VERIFY (Prove Health)
30
+ 1. DISCOVER (Toolchain & Root) ──► 2. INTERROGATE (Problem-First Interview) ──► 3. SYNTHESIZE (ADR & Blueprint) ──► 4. BOOTSTRAP (Topology Scaffolding) ──► 5. VERIFY (Prove Health)
31
31
  ```
32
32
 
33
33
  ---
34
34
 
35
35
  ### Phase 1: Discover (Toolchain & Workspace Inspection)
36
36
  1. Inspect the workspace root: confirm whether this is a fresh copy or an existing codebase.
37
- 2. Check for pre-installed development runtimes and CLI tools (`go`, `rustc`/`cargo`, `python3`/`uv`, `node`/`pnpm`, `docker`, `atlas`, `semgrep`).
37
+ 2. Check for pre-installed development runtimes and CLI tools (`go`, `rustc`/`cargo`, `python3`/`uv`, `node`/`pnpm`, `docker`, `semgrep`).
38
38
  3. Verify that `AGENTS.md`, `memory.md`, and `docs/rules/` exist and remain intact.
39
39
 
40
40
  ---
41
41
 
42
- ### Phase 2: Interrogate (The Relentless Architecture Interview)
42
+ ### Phase 2: Interrogate (The Problem-First Architecture Interview)
43
43
  Do NOT guess or assume any technology or stack choice. Execute the relentless interrogation using [references/architecture_interview_matrix.md](./references/architecture_interview_matrix.md). Group questions logically into digestible batches:
44
44
 
45
- #### Batch 1: Domain, Performance & Language
46
- 1. **Domain & Problem Statement:** What is the business problem, expected scale (RPS, active tenants), and compliance requirements (SOC 2, ISO 27001, GDPR)?
47
- 2. **Primary Programming Language & Runtime:** Go, Rust, Python, TypeScript, Java/Kotlin, C#, or Polyglot microservices?
48
- 3. **Package Manager & Toolchain:** Specific package manager (e.g. `uv` vs `poetry`, `cargo`, `pnpm`, `go modules`) and task runner?
49
-
50
- #### Batch 2: Transports, Protocols & Persistence
51
- 4. **Transport & Network:** REST (OpenAPI 3.1), gRPC (Protobuf v3 via `buf`), GraphQL, or Event-Driven? Which web/transport framework?
52
- 5. **Database & Storage Engine:** Relational (PostgreSQL, MySQL, CockroachDB, SQLite) vs Document (MongoDB) vs Hybrid? ORM vs Query Builder vs raw SQL? Canonical 6 Total Audit Fields?
53
- 6. **Database Migration Tooling:** Declarative migrations (**Atlas**) vs versioned SQL (**Flyway**, **Liquibase**, **Goose**)?
54
- 7. **Multi-Tenancy Isolation Model:** AST query interceptor, Database RLS, Schema-per-tenant, or Database-per-tenant?
55
- 8. **Dynamic Schemas & Extensibility:** Universal **JSON Schema Draft 2020-12** in semi-structured columns, EAV, or virtual columns?
56
-
57
- #### Batch 3: Pluggable Logic, Security & Identity
58
- 9. **Dynamic Business Logic:** Common Expression Language (CEL), GoF Strategy registries, or WebAssembly (Extism) sandboxes?
59
- 10. **Workflow Orchestration:** Temporal.io durable execution vs Camunda/Zeebe (BPMN 2.0) vs statecharts?
60
- 11. **Authentication & Identity:** OIDC, OAuth 2.1 with PKCE, Passkeys (FIDO2/WebAuthn), PASETO, or JWT with JWKS rotation?
61
- 12. **Authorization Engine:** Open Policy Agent (OPA Rego via HTTP/Wasm), OpenFGA (Zanzibar ReBAC), or Cerbos?
62
-
63
- #### Batch 4: Presentation, Infrastructure & Quality
64
- 13. **Frontend & Presentation:** Web (React/Vue/Svelte/Web Components), Mobile (Flutter/Native), Server-Driven UI (SDUI), and W3C DTCG Design Tokens?
65
- 14. **Caching & Locks:** Redis, Valkey, Dragonfly, Memcached, or local LRU with XFetch stampede defense?
66
- 15. **Event Streaming:** Apache Kafka, NATS JetStream, RabbitMQ, SQS, with Transactional Outbox?
67
- 16. **Observability:** OpenTelemetry OTLP traces/metrics/logs over gRPC/HTTP with W3C trace context?
68
- 17. **DevSecOps & Verification:** Semgrep SAST, Gitleaks, Trivy scanning, CycloneDX SBOM, Cosign, and Outside-In TDD (London School) with 100% coverage gates?
69
- 18. **Containerization & Deployment:** Minimal OCI Distroless/Scratch, Docker Compose, Kubernetes, and OpenTofu IaC?
70
-
71
- #### Batch 5: Lifecycles, State Machines & Ubiquitous Language
72
- 19. **State Invariant Separation:** Core Invariant States (Hard FSM in Aggregate Root) vs Tenant-Configurable Operational Workflow Stages (Soft FSM via transition matrices and CEL guards)?
73
- 20. **Ubiquitous Language Agreement:** Living glossary contract (`ubiquitous_language.md`) with AST linter denylists and branded nominal types?
45
+ #### Batch 1: Problem Space & System Topology
46
+ 1. **Domain & Problem Statement:** What real-world problem or capability does this system solve? What data moves, and what transformations occur?
47
+ 2. **System Topology Classification:** Which topology best matches the execution target?
48
+ - Topology A: Web SaaS / Cloud Microservices
49
+ - Topology B: Browser Extension (Manifest V3)
50
+ - Topology C: Game Engine / High-Performance Simulator (Bare metal, GPU)
51
+ - Topology D: Browser / Canvas Game (HTML5 Canvas / WebGL / WebGPU)
52
+ - Topology E: Desktop Application / CLI Utility (Native POSIX/Windows)
53
+ - Topology F: Embedded / Systems Library
54
+
55
+ #### Batch 2: Operational & Physical Constraints (The Machine Reality)
56
+ 3. **Latency & Time Budget:** Hard real-time (<16.6ms / <7ms frame loop), interactive low-latency (<10ms keystroke), soft service API (<200ms p99), or batch?
57
+ 4. **Memory Management & GC Tolerance:** Zero-GC pause tolerance (demands C/C++/Rust/Zig), managed throughput GC (Go, Java 21+, C# .NET 9), or single-threaded event loop (JS/TS)?
58
+ 5. **Concurrency & Execution Model:** Single-threaded event loop, multi-threaded worker pools with work stealing, SIMD compute shaders, or distributed actors?
59
+ 6. **Persistence & Connectivity:** Zero persistence (in-memory only), local flat/binary files, embedded SQLite, client-side browser storage, or enterprise RDBMS (Postgres)? Zero network, WebSockets, UDP, or HTTP/REST/gRPC?
60
+
61
+ #### Batch 3: Architectural Style & Emergent Toolchain
62
+ 7. **Architectural Style Derivation:**
63
+ - Web SaaS ➔ Modular Monolith / Hexagonal (Ports & Adapters)
64
+ - Browser Extension ➔ Platform Scripting (`background`, `content`, `popup`, `storage`)
65
+ - Game Engine ➔ Data-Oriented Design (DOD / ECS / Cache-friendly contiguous memory)
66
+ - Canvas Game ➔ Game Loop (`Input ➔ Update ➔ Render`)
67
+ - Desktop CLI ➔ Command Pipeline (`Arg Parser ➔ Handler ➔ Stream I/O`)
68
+ 8. **Primary Programming Language & Runtime:** Derived strictly from the constraints above (C, Rust, TypeScript, Go, Java, C#, Python).
69
+ 9. **Package Manager & Toolchain:** Specific package manager (`cargo`, `pnpm`, `uv`, `go modules`) and build task runner.
70
+
71
+ #### Batch 4: Targeted Invariants (Topology-Scoped, 100% YAGNI)
72
+ Inquire *only* into the dimensions relevant to the selected topology:
73
+ - *If Web SaaS / Backend:* API protocol (REST/gRPC), DB migration engine (Atlas/Flyway), tenancy isolation model, authentication, and OCI distroless containers.
74
+ - *If Browser Extension:* MV3 content script isolation (IIFE bundle), `chrome.storage.sync` flow, permissions. (Zero Docker/K8s/OpenAPI!).
75
+ - *If Game Engine:* Graphics backend (Vulkan/DirectX/wgpu), memory allocators (arena/frame), ECS archetype model. (Zero Docker/SQL!).
76
+ - *If CLI:* Arg parsing library, POSIX exit codes, streaming I/O, `--json` formatting. (Zero Docker/SQL!).
74
77
 
75
78
  ---
76
79
 
@@ -81,23 +84,20 @@ Do NOT guess or assume any technology or stack choice. Execute the relentless in
81
84
 
82
85
  ---
83
86
 
84
- ### Phase 4: Bootstrap (Deterministic Technical Scaffolding)
87
+ ### Phase 4: Bootstrap (Deterministic Topology Scaffolding)
85
88
  Upon user confirmation:
86
- 1. Run the deterministic workspace initialization script:
89
+ 1. Run the topology-aware workspace initialization script:
87
90
  ```bash
88
- bash .agents/skills/lets-build/scripts/bootstrap_workspace.sh . <language>
91
+ bash .agents/skills/lets-build/scripts/bootstrap_workspace.sh . <topology> <language>
89
92
  ```
90
- 2. Generate base infrastructure and open specification foundations in `specs/`:
91
- - `specs/openapi/v1/openapi.yaml` (minimal health probe and API versioning metadata)
92
- - `specs/tokens/tokens.json` (W3C DTCG design tokens baseline)
93
- 3. Scaffold initial Hexagonal application technical skeleton following [references/hexagonal_bootstrap_scaffolds.md](./references/hexagonal_bootstrap_scaffolds.md):
94
- - Pure architecture ports and adapters layout (`src/domain/`, `src/ports/`, `src/adapters/`).
95
- - Minimal system health probes (`/healthz`, `/readyz`).
96
- - Strict isolation: **Do NOT scaffold application business features or fabricate domain entities yet.**
97
- 4. Generate build manifests (`go.mod`, `Cargo.toml`, `pyproject.toml`, or `package.json`), linter/formatter configurations, minimal multi-stage `Dockerfile`, and `docker-compose.yml`.
98
- 5. Scaffold initial test runner and boundary verification smoke test (`scripts/smoke_test.sh`).
99
- 6. **Replace Starter README with Project-Specific README**:
100
- Generate a clean, project-specific `README.md` using [references/project_readme_template.md](./references/project_readme_template.md), completely replacing the starter/meta-template content with the project's actual name, mission, stack highlights, quickstart commands, directory tree, and links to `docs/rules/`.
93
+ 2. Generate base infrastructure strictly for the selected topology (zero speculative bloat):
94
+ - *Backend:* `specs/openapi/v1/openapi.yaml`, `specs/tokens/tokens.json`, `deploy/docker`, `deploy/compose`.
95
+ - *Extension:* `manifest.json`, `src/background/index.ts`, `src/content/index.ts`, `src/popup/index.html`.
96
+ - *Game / Engine:* `src/core/`, `src/ecs/`, asset manifest, frame loop entrypoint.
97
+ - *CLI:* `src/cmd/`, `src/core/`, CLI entrypoint with exit code handling.
98
+ 3. Generate build manifests (`Cargo.toml`, `package.json`, `go.mod`, `pyproject.toml`), linter configurations, and boundary smoke test (`scripts/smoke_test.sh`).
99
+ 4. **Replace Starter README with Project-Specific README**:
100
+ Generate a clean, project-specific `README.md` completely replacing meta-template content with the project's actual name, mission, stack highlights, quickstart commands, and directory tree.
101
101
 
102
102
  ---
103
103
 
@@ -106,9 +106,9 @@ Upon user confirmation:
106
106
  ```bash
107
107
  bash .agents/skills/agentic-architect/scripts/validate_agentic_configs.sh
108
108
  ```
109
- 2. Execute toolchain dependency checks, build commands, and health probe tests:
109
+ 2. Execute toolchain dependency checks, build commands, and health/smoke tests:
110
110
  - Compile code and verify zero compiler or lint errors.
111
- - Verify direct backend and reverse proxy health probes (`/healthz`).
111
+ - Verify boundary verification smoke test (`scripts/smoke_test.sh`).
112
112
  3. **Mandatory Handover to Domain Analysis (STOP & PIVOT):**
113
113
  - **`lets-build` IS NOW COMPLETE.** Do NOT proceed to write domain business entities, repositories, or application features.
114
114
  - Present the bootstrapped technical skeleton to the user.
@@ -120,11 +120,11 @@ Upon user confirmation:
120
120
 
121
121
  - **MAJOR DONT: DO NOT invent, assume, or scaffold application domain entities, business logic, or feature pages during `/lets-build`.** The `lets-build` skill is strictly an infrastructure and technical stack bootstrapper. Fabricating business domain features without dedicated domain analysis and relentless questioning of the user is a fatal architectural defect.
122
122
  - **DO NOT** assume the stack. Never start writing Go, Rust, Python, or TypeScript before asking the user.
123
- - **DO NOT** scaffold all options at once. Follow the user's chosen stack strictly.
124
- - **DO NOT** couple domain entities to ORMs, database libraries, or HTTP frameworks. The domain core must remain pure.
123
+ - **DO NOT** scaffold universal web boilerplate (Docker, Kubernetes, OpenAPI, Postgres migrations) for non-backend projects (Browser Extensions, CLIs, Game Engines, Desktop apps).
124
+ - **DO NOT** force Hexagonal Architecture onto platforms where the application IS the platform integration (e.g. Browser Extensions). Match architecture to topology.
125
125
  - **DO NOT** proceed to code generation without presenting the blueprint and receiving explicit user approval.
126
- - **DO NOT** skip or delete the 41 atomic domain rules in `docs/rules/` during bootstrapping. The rules govern the ongoing lifecycle of the newly bootstrapped project.
127
- - **DO NOT** create monolithic files (> 300 lines) or large functions (> 30 lines). Maintain strict Clean Code standards.
126
+ - **DO NOT** skip or delete the atomic domain rules in `docs/rules/` during bootstrapping. The rules govern the ongoing lifecycle of the newly bootstrapped project.
127
+ - **DO NOT** create monolithic files (> 250 lines) or large functions (> 30 lines). Maintain strict Clean Code standards.
128
128
 
129
129
  ---
130
130
 
@@ -134,31 +134,24 @@ Upon user confirmation:
134
134
  ```markdown
135
135
  # Architectural Specification & Technology Blueprint
136
136
 
137
- ## 1. Core Profile
137
+ ## 1. Problem Space & Topology
138
138
  - **Project Domain:** <domain>
139
+ - **System Topology:** <Web SaaS / Browser Extension / Game Engine / Canvas Game / CLI / Library>
140
+ - **Architectural Style:** <Hexagonal / Platform Scripting / Data-Oriented Design / Game Loop / Command Pipeline>
141
+
142
+ ## 2. Core Profile & Constraints
139
143
  - **Primary Language & Runtime:** <language / version>
140
144
  - **Package Manager & Build Tool:** <tool>
141
-
142
- ## 2. Interface & Transport
143
- - **Protocols:** <REST / gRPC / CloudEvents>
144
- - **Transport Framework:** <framework>
145
- - **Contracts:** <specs/openapi / specs/protobuf>
146
-
147
- ## 3. Persistence & Isolation
148
- - **Storage Engine:** <engine & version>
149
- - **Migration Engine:** <Atlas / Flyway / Goose>
150
- - **Tenancy Isolation:** <Model A / B / C / D>
151
- - **Dynamic Schemas:** <JSON Schema Draft 2020-12>
152
-
153
- ## 4. Logic, Workflows & Identity
154
- - **Dynamic Logic:** <Common Expression Language / Wasm Extism>
155
- - **Workflows:** <Temporal / Camunda / Statecharts>
156
- - **Authentication:** <OIDC / WebAuthn Passkeys / PASETO>
157
- - **Authorization:** <OPA Rego / OpenFGA ReBAC>
158
-
159
- ## 5. Operations & Quality
160
- - **Caching & Streams:** <Cache Engine / Broker>
161
- - **Observability:** <OpenTelemetry OTLP>
162
- - **DevSecOps:** <Semgrep / Trivy / Gitleaks / Syft>
163
- - **Testing:** Outside-In TDD (100.00% coverage gate)
145
+ - **Latency / Performance Target:** <Hard real-time / Interactive / Service / Batch>
146
+ - **Memory & Concurrency Model:** <Zero GC / Managed GC / Single-threaded event loop>
147
+
148
+ ## 3. Interfaces & Storage
149
+ - **Protocols / Transports:** <REST / gRPC / WebSockets / CLI stdin-stdout / None>
150
+ - **Storage / Persistence:** <PostgreSQL / SQLite / chrome.storage / Flat file / In-memory>
151
+ - **Specifications:** <OpenAPI 3.1 / Manifest V3 / Protobuf / None>
152
+
153
+ ## 4. Quality & Verification
154
+ - **Testing Strategy:** Outside-In TDD with Nano-Cycles (Uncle Bob's 3 Laws)
155
+ - **Code Health Gates:** 100.00% test coverage gate, zero lint errors
156
+ - **DevSecOps:** <Semgrep / Trivy / Gitleaks / None>
164
157
  ```
@@ -1,188 +1,109 @@
1
- # Comprehensive Architecture Interview Matrix
1
+ # Problem-First Architecture Interview Matrix
2
2
 
3
- > **Source of Truth:** Exhaustive taxonomy across 20 architectural dimensions to interrogate before bootstrapping any enterprise project.
3
+ > **Core Philosophy:** Software architecture must be derived from problem constraints, domain invariants, and execution targets—never from preemptive tool selection. Tools, runtimes, and databases are emergent outputs of the Problem Space.
4
4
 
5
5
  ---
6
6
 
7
- ## Dimension 1: Architectural Paradigm & Monolith-to-Service Boundary
8
- - **System Topology:** Modular Monolith (Modulith), Event-Driven Architecture (EDA), Service-Oriented (SOA), or Microservices?
9
- - **Domain Decoupling:** Hexagonal Ports & Adapters, Clean Architecture, Onion Architecture, or Pragmatic Layered?
10
- - **Language Bias:** Zero language bias; pure business domain core decoupled from infrastructure adapters.
7
+ ## Tier 1: Problem Space Definition & System Topology
11
8
 
12
- ---
13
-
14
- ## Dimension 2: Core Programming Languages & Runtimes
15
- - **Primary Languages:**
16
- - Systems / High-Performance: Rust, Go, or C++23
17
- - Enterprise / JVM: Java 21+ (Loom virtual threads) or Kotlin
18
- - Web / Full-Stack: TypeScript (Node.js / Bun)
19
- - Data / ML / Scripting: Python 3.12+ or Elixir (BEAM concurrency)
20
- - **Language Invariants:** Strict static sound typing; zero unhandled exceptions at domain boundaries.
21
-
22
- ---
23
-
24
- ## Dimension 3: Package Managers, Workspaces & Monorepo Tooling
25
- - **Package Manager:**
26
- - Node/TS: `pnpm` (with strict isolated node_modules), `bun`, or `yarn` (Berry)
27
- - Rust: `cargo` (with cargo workspaces)
28
- - Go: Go Modules (with multi-module workspaces)
29
- - Python: `uv`, `poetry`, or `pixi`
30
- - **Monorepo Build Orchestration:** Turborepo, Nx, or Bazel/Buck2 with remote caching?
31
-
32
- ---
33
-
34
- ## Dimension 4: Containerization, Base OS & Cloud-Native Runtime
35
- - **Container Strategy:**
36
- - Zero-cve distroless (`gcr.io/distroless/*`) or `scratch` base images?
37
- - Rootless container execution (`USER nonroot:nonroot`)?
38
- - Multi-stage Dockerfiles with build caching?
39
- - **Cloud-Native Invariants:** 12-Factor (2026 Edition); stateless runtime isolates; graceful `SIGTERM` draining.
40
-
41
- ---
42
-
43
- ## Dimension 5: API Protocols, Transports & Network Contracts
44
- - **Primary Transport:**
45
- - RESTful HTTP/JSON (RFC 7807 problem details + OpenAPI 3.1)
46
- - gRPC / Protocol Buffers (v3 / Buf CLI)
47
- - GraphQL (Apollo / GraphQL-Yoga with code-first or schema-first SDL)
48
- - WebSockets / Server-Sent Events (SSE) for real-time push
49
- - **API Versioning Strategy:** URI Path (`/v1/`), Request Header, or Media Type negotiation?
50
-
51
- ---
52
-
53
- ## Dimension 6: Database & Persistence Engine
54
- - **Primary Storage Engine:**
55
- - Relational: PostgreSQL, MySQL / MariaDB, SQLite, CockroachDB, or TiDB
56
- - Document / NoSQL: MongoDB, DynamoDB, or Cassandra
57
- - Multi-Model / Hybrid: Relational core with document extension
58
- - **Persistence Pattern:** Repository Pattern with raw SQL / query builders (e.g. `sqlx`, `pgx`, `Kysely`, `jOOQ`) vs ORM (e.g. Prisma, SQLAlchemy, GORM, Hibernate)?
59
- - **Mandatory Universal Audit Columns:**
60
- - Standardize on **The Canonical 6 Total Audit Fields** (`createdAt`, `createdBy`, `updatedAt`, `updatedBy`, `deletedAt`, `deletedBy`) across all mutable relational entities?
61
- - Strictly immutable append-only ledgers (`createdAt`, `createdBy` only; updates/deletions prohibited)?
62
-
63
- ---
9
+ ### Dimension 1: The Core Problem & Domain Essence
10
+ - **Problem Statement:** What real-world problem or capability does this system address? What data moves, and what transformations occur?
11
+ - **Domain Invariants:** What core business, legal, mathematical, or physical rules must never be violated?
12
+ - **Domain Subdivisions:** Identify subdomains:
13
+ - *Core Subdomain:* The unique differentiator (e.g. proprietary physics simulation, smart filter inversion, bidding algorithm).
14
+ - *Supporting Subdomain:* Necessary domain-specific capabilities (e.g. user preferences, level editor).
15
+ - *Generic Subdomain:* Solved industry utilities (e.g. authentication, logging).
64
16
 
65
- ## Dimension 7: Database Migration & Schema Evolution
66
- - **Migration Engine:** Declarative schema management (**Atlas**), versioned SQL migrations (**Flyway**, **Liquibase**, **Goose**, or **Bytebase**)?
67
- - **Zero-Downtime Expand-Contract:** Does the project commit to the 5-phase expand-contract deployment lifecycle?
17
+ ### Dimension 2: System Topology Classification
18
+ Classify the system into its primary operational topology:
19
+ 1. **Topology A — Web SaaS / Cloud Microservices:** Network-facing HTTP/gRPC services with multi-tenant data persistence and web/mobile clients.
20
+ 2. **Topology B — Browser Extension:** Client-side sandboxed extension (Chrome/Firefox MV3) orchestrating content scripts, background service workers, and popup UI.
21
+ 3. **Topology C — Game Engine / High-Performance Simulator:** Low-level, frame-budgeted application directly interfacing with GPU APIs (Vulkan, DirectX, Metal) and system memory.
22
+ 4. **Topology D — Browser / Canvas Game:** Sandboxed web game running inside the browser DOM/Canvas via Canvas2D, WebGL, or WebGPU.
23
+ 5. **Topology E — Desktop Application / CLI Utility:** Standalone OS binary (POSIX/Windows) executed locally via terminal arguments or native desktop UI.
24
+ 6. **Topology F — Systems / Embedded / Cryptographic Library:** Headless shared library or crate compiled for specific hardware targets or WASM runtimes.
68
25
 
69
26
  ---
70
27
 
71
- ## Dimension 8: Multi-Tenancy Data Isolation Model
72
- - **Isolation Strategy:**
73
- 1. **Model A: Universal AST Query Interceptor** (Tenant column + automatic SQL/query AST rewriting)
74
- 2. **Model B: Database Row-Level Security (RLS)** (Session-scoped `set_config` / session variables)
75
- 3. **Model C: Schema-per-Tenant** (Dedicated database schema namespace per tenant)
76
- 4. **Model D: Database-per-Tenant** (Physical instance routing via connection pool manager)
77
- 5. **Model E: Storage Proxy** (Envoy / ProxySQL / Vitess)
28
+ ## Tier 2: Physical & Operational Constraints
78
29
 
79
- ---
30
+ ### Dimension 3: Latency & Time Budgets
31
+ - **Hard Real-Time:** Frame budget enforced (e.g. 16.6ms for 60 FPS, 6.94ms for 144 FPS). Any jitter causes dropped frames.
32
+ - **Interactive Low-Latency:** Sub-10ms response for user inputs (e.g. keystrokes in a code editor, real-time audio DSP).
33
+ - **Service Request-Response:** Soft latency (e.g. p99 < 200ms for web APIs; p95 < 50ms for internal RPC).
34
+ - **Asynchronous / Batch:** Throughput-optimized batch or event stream processing (seconds to minutes).
80
35
 
81
- ## Dimension 9: Dynamic Schemas & Extensible Entities
82
- - **Dynamic Field Storage:** Semi-structured JSON column with **JSON Schema Draft 2020-12** validation vs Entity-Attribute-Value (EAV) vs Virtual Column projection?
83
- - **Meta-Schema Virtual Entities:** Will tenants define completely custom entities at runtime without code deployments?
36
+ ### Dimension 4: Memory Management & Garbage Collection Tolerance
37
+ - **Zero GC Pause Tolerance:** Latency spikes or unpredictable GC pauses are unacceptable. Demands deterministic, manual, or compile-time memory management (C, C++, Rust, Zig).
38
+ - **High-Throughput Managed GC:** GC pauses (< 10ms) are completely imperceptible within network I/O latency. Managed runtimes maximize developer velocity (Go, Java 21+ with Loom, C# .NET 9).
39
+ - **Single-Threaded Event Loop:** JavaScript / TypeScript runtime in browser sandbox or Node/Bun.
84
40
 
85
- ---
41
+ ### Dimension 5: Concurrency & Execution Topology
42
+ - **Single-Threaded Cooperative:** Event loop with non-blocking async I/O (browser JS, Node.js).
43
+ - **Multi-Threaded Work-Stealing:** Parallel pipelines across CPU cores (physics, rendering, audio) requiring data-race safety.
44
+ - **Data-Parallel / SIMD:** Vectorized computation over contiguous arrays or GPU compute shaders.
45
+ - **Distributed Shared-Nothing:** Clustered actor nodes or horizontal stateless containers.
86
46
 
87
- ## Dimension 10: Pluggable Business Logic & Workflows
88
- - **Dynamic Rules:** Google's **Common Expression Language (CEL)** vs JSON Logic vs Strategy Registries?
89
- - **Workflow Orchestration:** **Temporal.io** durable execution vs **Camunda 8 / Zeebe (BPMN 2.0)** vs state machine libraries?
90
- - **Sandboxed Scripting:** **WebAssembly (Extism / Wasmtime)** micro-sandboxes vs isolated interpreters?
47
+ ### Dimension 6: Persistence & Connectivity Demands
48
+ - **Zero Persistence:** In-memory state only (e.g. real-time canvas game, transient CLI filter).
49
+ - **Local Embedded / Flat Storage:** Local binary files, JSON configuration, or embedded SQLite.
50
+ - **Client-Side Platform Storage:** Browser `chrome.storage.local` / `sync`, `localStorage`, or IndexedDB.
51
+ - **Enterprise Relational / Document RDBMS:** PostgreSQL, MySQL, MongoDB, CockroachDB with ACID transactions.
52
+ - **Network Interface:** Pure local IPC/pipes (zero network), WebSockets, UDP packets, or HTTP/REST/gRPC.
91
53
 
92
54
  ---
93
55
 
94
- ## Dimension 11: Authentication & Identity
95
- - **Protocols:** OpenID Connect (OIDC), OAuth 2.1 with PKCE, SAML 2.0 federation, or local credentials?
96
- - **Passkeys / Passwordless:** W3C / FIDO2 WebAuthn passkey support?
97
- - **Token Format:** PASETO (Platform-Agnostic Security Tokens) vs RFC 7519 JWT with JWKS asymmetric key rotation?
98
- - **Token Rotation:** Cryptographic Refresh Token Rotation (RTR) with family invalidation on replay detection?
56
+ ## Tier 3: Architectural Style Derivation (Topology Alignment)
99
57
 
100
- ---
58
+ Match the architectural style strictly to the system topology:
101
59
 
102
- ## Dimension 12: Authorization & Policy-as-Code
103
- - **Policy Engine:**
104
- - **Open Policy Agent (OPA)** (Rego language via REST/gRPC or embedded `.wasm` module)
105
- - **OpenFGA** (Google Zanzibar Relationship-Based Access Control - ReBAC)
106
- - **Cerbos** (Stateless policy-as-code)
107
- - Application-level RBAC / ABAC guard wrappers
60
+ | Topology | Mandatory Architectural Style | Rationale | Anti-Pattern to Ban |
61
+ |---|---|---|---|
62
+ | **Web SaaS / Backend** | **Hexagonal (Ports & Adapters) / Clean** | Decouples business rules from databases, HTTP frameworks, and external APIs. | Fat controllers with inline SQL; leaky abstractions. |
63
+ | **Browser Extension** | **Platform Scripting Architecture** | Direct, lean coordination of `background`, `content`, `popup`, and browser storage APIs. | Forcing Hexagonal ports, use-case classes, or `/healthz` probes. |
64
+ | **Game Engine** | **Data-Oriented Design (DOD / ECS)** | Cache-friendly contiguous memory layout (dense component arrays) for SIMD vectorization. | Deep OOP inheritance hierarchies; GC-managed wrappers. |
65
+ | **Canvas Game** | **Game Loop Architecture** | Structured `Input ➔ Update ➔ Render` loop driven by `requestAnimationFrame`. | Enterprise repository and layered CRUD ceremony. |
66
+ | **Desktop CLI** | **Command Pipeline Architecture** | Streamlined `Arg Parser ➔ Command Handler ➔ Stream I/O`. | Embedding REST servers, microservices, or Docker containers. |
108
67
 
109
68
  ---
110
69
 
111
- ## Dimension 13: Presentation, Client & Server-Driven UI (SDUI)
112
- - **Frontend Framework & Architecture:**
113
- - Web: React, Vue, Svelte, Solid, Angular, or Web Components?
114
- - Mobile: Flutter, React Native, iOS SwiftUI, or Android Jetpack Compose?
115
- - Hypermedia / SSR: HTMX / HTML-over-the-wire?
116
- - Server-Driven UI (SDUI): Declarative JSON layout schemas rendered by client registries?
117
- - **UI Component Primitives & Styling:**
118
- - Standardize on `shadcn/ui` with `@radix-ui` headless primitives + Tailwind CSS?
119
- - Accessible dialogs, focus trapping, and zero native alerts per `accessibility.md`?
120
- - **Server-State Caching & Data Synchronization:**
121
- - **TanStack Query (`@tanstack/react-query`)** with query keys, stale-while-revalidate, and automatic mutation invalidation vs SWR vs raw fetch?
122
- - **Form State Management & Validation:**
123
- - **React Hook Form (`react-hook-form` + `@hookform/resolvers/zod`)** or **TanStack Form (`@tanstack/react-form`)** with **Zod** schema contracts?
124
- - **Data Grids & Table Virtualization:**
125
- - **TanStack Table (`@tanstack/react-table`)** for headless sorting, filtering, and pagination?
126
- - **Client Stores & Global State:**
127
- - **Zustand** vs Jotai vs Redux Toolkit for shared client-only state?
128
- - **Design Tokens:** W3C Design Tokens Community Group (DTCG) `tokens.json` processed via Style Dictionary?
70
+ ## Tier 4: Emergent Toolchain & Language Derivation
129
71
 
130
- ---
72
+ Derive the programming language, runtime, and package manager strictly from the constraints established above:
131
73
 
132
- ## Dimension 14: Caching, Distributed Locks & Session State
133
- - **Caching Engine:** Redis, Valkey, Dragonfly, KeyDB, Memcached, or local in-memory LRU?
134
- - **Cache Pattern:** Cache-Aside with jittered TTLs, XFetch probabilistic stampede defense, and event-driven invalidation?
135
- - **Distributed Locks:** Redis Redlock / atomic SETNX with bounded TTLs?
74
+ | Language Profile | Optimal Fit | Primary Trade-Off |
75
+ |---|---|---|
76
+ | **C (C99 / C11)** | Game engines, embedded systems, OS kernels. | Raw pointer control, instant compile times; manual memory management. |
77
+ | **Rust** | Game engines, code editors, CLI tools, systems services. | Zero GC, compile-time memory safety, fearless concurrency; steeper learning curve, slower builds. |
78
+ | **TypeScript / JS** | Browser extensions, canvas games, web frontends, fullstack apps. | Instant browser compatibility, rich UI ecosystem; single-threaded event loop, runtime typing. |
79
+ | **Go** | Cloud microservices, CLI tools, network proxies. | Fast startup, simple concurrency (goroutines); basic GC, limited generics. |
80
+ | **Java 21+ / C# (.NET 9)** | Enterprise transaction platforms, high-throughput microservices. | Massive enterprise ecosystem, virtual threads; higher memory footprint. |
81
+ | **Python** | Data analysis, ML pipelines, quick automation scripts. | Expressive syntax, unmatched ML libraries; slower execution, GIL constraints. |
136
82
 
137
83
  ---
138
84
 
139
- ## Dimension 15: Distributed Messaging & Event Streaming
140
- - **Message Broker:** Apache Kafka / Redpanda, NATS JetStream, RabbitMQ, AWS SQS, or Redis Streams?
141
- - **Event Specification:** CNCF CloudEvents v1.0.2 format?
142
- - **Transactional Outbox:** Polling relay (`FOR UPDATE SKIP LOCKED`) or Change Data Capture (CDC via Debezium)?
143
-
144
- ---
85
+ ## Tier 5: Targeted Invariants (Strictly Topology-Scoped, 100% YAGNI)
145
86
 
146
- ## Dimension 16: Observability, Telemetry & Logging
147
- - **Standard:** 100% CNCF OpenTelemetry (OTel) with OTLP export over gRPC/HTTP?
148
- - **Tracing:** W3C Trace Context (`traceparent`, `tracestate`)?
149
- - **Logging Format:** Structured JSON conforming to Elastic Common Schema (ECS) or OpenTelemetry Resource Schema?
87
+ Inquire *only* into the dimensions relevant to the selected topology. **Never ask non-backend projects about databases, containers, or API versioning!**
150
88
 
151
- ---
89
+ ### For Web SaaS & Enterprise Backends ONLY:
90
+ - **API Protocols:** REST (OpenAPI 3.1) vs gRPC (Protobuf v3 via Buf) vs GraphQL.
91
+ - **Database Migrations:** Declarative (Atlas) vs Versioned SQL (Flyway, Goose).
92
+ - **Multi-Tenancy Isolation:** AST Query Interceptor vs Database RLS vs Schema-per-tenant.
93
+ - **Authentication & AuthZ:** OIDC, OAuth 2.1, PASETO, OPA Rego, or OpenFGA ReBAC.
94
+ - **Container Infrastructure:** Minimal Distroless/Scratch OCI containers and Docker Compose.
152
95
 
153
- ## Dimension 17: DevSecOps, Supply Chain & Security
154
- - **SAST:** Polyglot Semgrep rules for security and code quality?
155
- - **Secret Detection:** Pre-commit Gitleaks or Secretlint hooks?
156
- - **Vulnerability Scanning:** Trivy container and lockfile scanning in CI?
157
- - **SBOM & Provenance:** Syft CycloneDX 1.6 SBOM generation and Cosign artifact signing?
96
+ ### For Browser Extensions ONLY:
97
+ - **Manifest Version:** Chrome/Firefox Manifest V3.
98
+ - **Script Isolation & Bundling:** Self-contained IIFE for content scripts (zero external ES module chunk imports).
99
+ - **State Synchronization:** `chrome.storage.sync` with local fallback and unidirectional event application.
100
+ - **Permissions:** Principle of least privilege for `manifest.json`.
158
101
 
159
- ---
160
-
161
- ## Dimension 18: Testing & Verification Strategy
162
- - **TDD Methodology:** Outside-In TDD (London School) double loop?
163
- - **BDD Acceptance:** Executable Cucumber / Gherkin `.feature` criteria?
164
- - **Contract Testing:** Consumer-Driven Contract testing via Pact?
165
- - **Property-Based Testing:** Schemathesis OpenAPI / GraphQL automated fuzzing?
166
- - **Coverage Gate:** Mandatory 100.00% coverage thresholds across all suites?
167
-
168
- ---
169
-
170
- ## Dimension 19: State Machines, Workflows & Lifecycle Configurability
171
- - **State Taxonomy & Invariant Separation:**
172
- - **Core Invariant States (Hard FSM):** Enforced strictly inside compiled Domain Aggregate Roots? (Financial/legal integrity states like `SETTLED`, `CANCELLED` cannot be user-rewritten).
173
- - **Operational Workflow Stages (Soft FSM):** Tenant-configurable review funnels, approval tiers, or sub-statuses managed via Declarative State Transition Matrices?
174
- - **Transition Guards & Rule Evaluation:**
175
- - Standardize on Common Expression Language (CEL) or embedded Wasm sandboxing for tenant-defined guards?
176
- - **Workflow Orchestration:**
177
- - Durable workflow engine (Temporal.io, Camunda 8 / Zeebe BPMN 2.0) for multi-step distributed sagas?
178
- - **Transition Audit Trail:**
179
- - Mandatory append-only state transition log (`transitionId`, `entityType`, `entityId`, `fromState`, `toState`, `event`, `actorId`, `createdAt`)?
180
-
181
- ---
102
+ ### For Game Engines & High-Performance Simulators ONLY:
103
+ - **Graphics Backend:** Native Vulkan, DirectX 12, Metal, or portable `wgpu`.
104
+ - **Memory Allocation Strategy:** Linear allocators, frame allocators, arena allocators, or pool allocators.
105
+ - **Entity Model:** Archetype ECS (e.g. `bevy_ecs`, `hecs`, `EnTT`) vs dense component arrays.
182
106
 
183
- ## Dimension 20: Ubiquitous Language & Domain-Code Agreement
184
- - **Living Glossary:** Authoritative `docs/knowledge/ubiquitous_language.md` mapping domain terms, business definitions, and exact code identifiers?
185
- - **Linguistic Drift Defenses:**
186
- - Mechanical AST / Linter rules (ESLint `id-denylist`) prohibiting banned synonyms?
187
- - Branded nominal types (`type UserId = string & { readonly __brand: unique symbol }`) preventing primitive obsession and cross-domain identifier confusion?
188
- - **Anti-Corruption Layer (ACL):** Adapters at system perimeters converting external vendor terminology into the canonical Ubiquitous Language?
107
+ ### For Desktop CLIs ONLY:
108
+ - **CLI Framework:** Zero-dependency argument parser vs battle-tested CLI library (e.g. `clap` for Rust, `cobra` for Go).
109
+ - **I/O Protocols:** Standard POSIX streams (`stdin`, `stdout`, `stderr`), exit codes (0 for success, non-zero for error), JSON output flags (`--json`).