azcodr 1.2.0 → 1.2.2

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.
@@ -12,7 +12,7 @@ Regardless of language, all bootstrapped projects must follow this high-level se
12
12
  <project-root>/
13
13
  ├── .agents/skills/ # Specialized agentic workflows (carried from azcodr template)
14
14
  ├── docs/
15
- │ ├── knowledge/ # System knowledge graph, issue log, DO's/DONT's
15
+ │ ├── knowledge/ # Domain knowledge & living ubiquitous language glossary
16
16
  │ └── rules/ # 41 atomic single-responsibility domain rules
17
17
  ├── specs/ # Canonical contract specifications
18
18
  │ ├── protobuf/ # gRPC service definitions (*.proto)
package/AGENTS.md CHANGED
@@ -59,8 +59,7 @@ To prevent context bloat and keep prompt overhead minimal, detailed engineering
59
59
  | **TDD Double Loop** | [docs/rules/test_driven_development.md](./docs/rules/test_driven_development.md) | Outside-In TDD (London School), collaborator discovery, mock ownership. |
60
60
  | **Test Coverage & Isolation** | [docs/rules/test_isolation.md](./docs/rules/test_isolation.md) | 100.00% full-stack coverage, status codes, transactional DB rollback. |
61
61
  | **Clean Code** | [docs/rules/clean_code.md](./docs/rules/clean_code.md) | Naming, small functions, CQS, SLAP, DRY, DbC, zero side-effects. |
62
- | **Design Patterns** | [docs/rules/design_patterns.md](./docs/rules/design_patterns.md) | Adapter, Factory, Facade, Strategy, and Result `<T, E>` pattern. |
63
- | **GoF Design Patterns** | [docs/rules/gof_design_patterns_reference.md](./docs/rules/gof_design_patterns_reference.md) | Complete reference of all 23 GoF patterns across OOP and functional paradigms. |
62
+ | **Design Patterns** | [docs/rules/design_patterns.md](./docs/rules/design_patterns.md) | Adapter, Factory, Strategy, Result `<T, E>`, and complete 23 GoF catalog. |
64
63
  | **Type Safety** | [docs/rules/typescript.md](./docs/rules/typescript.md) | Compiler strictness, branded nominal types, type safety, static sound invariants. |
65
64
  | **ADRs** | [docs/rules/architecture_decision_records.md](./docs/rules/architecture_decision_records.md) | Authoring Lightweight Architectural Decision Records in `memory.md`. |
66
65
  | **Authentication** | [docs/rules/authentication.md](./docs/rules/authentication.md) | In-memory access tokens, refresh token rotation (RTR), WebAuthn passkeys. |
@@ -93,12 +92,11 @@ To prevent context bloat and keep prompt overhead minimal, detailed engineering
93
92
  | **React & Frontend** | [docs/rules/react.md](./docs/rules/react.md) | Modern React, shadcn/ui, TanStack Query, React Hook Form, and Zod validation. |
94
93
  | **Requirements Engineering** | [docs/rules/requirements_engineering.md](./docs/rules/requirements_engineering.md) | User stories vs requirements, 3 C's, INVEST vertical cake slicing, Gherkin. |
95
94
  | **Product Ownership** | [docs/rules/product_ownership.md](./docs/rules/product_ownership.md) | Product Backlog Management, OKRs, Kano/MoSCoW/RICE, Product Value, empiricism. |
96
- | **Domain-Driven Design** | [docs/rules/domain_driven_design.md](./docs/rules/domain_driven_design.md) | Ubiquitous Language, Bounded Contexts, Value Objects, Aggregates. |
95
+ | **Domain-Driven Design** | [docs/rules/domain_driven_design.md](./docs/rules/domain_driven_design.md) | Ubiquitous Language, Bounded Contexts, Aggregates, Capability Mapping. |
97
96
  | **Workflow State Machines** | [docs/rules/workflow_state_machines.md](./docs/rules/workflow_state_machines.md) | Configurable workflows, in-aggregate invariant FSMs, transition guards & audit logs. |
98
97
  | **Cloud-Native 12-Factor** | [docs/rules/cloud_native.md](./docs/rules/cloud_native.md) | 12-Factor (2026 Edition), OpenTelemetry (OTel), stateless isolates. |
99
98
  | **Agentic Config & Skills** | [docs/rules/agentic_configuration.md](./docs/rules/agentic_configuration.md) | Progressive disclosure architecture, skill inquiry branches, refinement loop. |
100
99
  | **Project Management** | [docs/rules/project_management.md](./docs/rules/project_management.md) | Work-In-Progress limits (WIP = 1), SMART developer tasks, Definition of Done. |
101
- | **Domain Modeling** | [docs/rules/domain_expertise.md](./docs/rules/domain_expertise.md) | Business capabilities, Aggregate Root invariants, Ubiquitous Language. |
102
100
  | **Relentless Questioning** | [docs/rules/relentless_questioning.md](./docs/rules/relentless_questioning.md) | Dynamic context-aware interrogation loops, adaptive decision trees. |
103
101
  | **Workspace Isolation** | [docs/rules/workspace_isolation.md](./docs/rules/workspace_isolation.md) | Strict workspace sovereignty, zero global contamination, local ground truth. |
104
102
  | **Continuous Learning** | [docs/rules/continuous_learning.md](./docs/rules/continuous_learning.md) | Direct rule ingestion, root-cause analysis, dynamic invariant updates. |
@@ -116,5 +114,5 @@ To prevent context bloat and keep prompt overhead minimal, detailed engineering
116
114
  - [`lets-build`](.agents/skills/lets-build/SKILL.md): Conducting architecture interviews to finalize stack, frameworks, package managers, and bootstrapping projects.
117
115
  - [`relentless-questioner`](.agents/skills/relentless-questioner/SKILL.md): Dynamic context-aware interrogation loops before planning and coding.
118
116
  - **Relentless Skill Architecture Inquiry:** Never author or update skills on assumptions. Interrogate all 7 inquiry branches (placement, trigger intent, domain truth, gotchas/anti-patterns, determinism, progressive bloat, verification loop) defined in [docs/rules/agentic_configuration.md](./docs/rules/agentic_configuration.md) before writing `SKILL.md`.
119
- - **Workspace Memory & Knowledge Hub:** Consult [`memory.md`](./memory.md) for ADRs, and [`docs/knowledge/`](./docs/knowledge/knowledge_graph.md) for system topologies and domain glossaries.
117
+ - **Workspace Memory & Knowledge Hub:** Consult [`memory.md`](./memory.md) for ADRs, and [`docs/knowledge/ubiquitous_language.md`](./docs/knowledge/ubiquitous_language.md) for domain glossaries.
120
118
  - **Harness Parity & Symlinks:** `AGENTS.md`, `CLAUDE.md`, and `agents.md` must remain identical via filesystem symbolic links to eliminate configuration divergence across different agent harnesses.
package/README.md CHANGED
@@ -1,23 +1,25 @@
1
- # azcodr: Enterprise Multi-Tenant Architecture & Agentic Engineering
1
+ # azcodr: Enterprise Architecture & Agentic Engineering Starter Template
2
2
 
3
- > **Production-ready, battle-tested multi-tenant enterprise architecture governed by strict systemic atomicity, 100% open-source standards, universal technology and language agnosticism, progressive disclosure agentic directives, and zero-downtime database patterns.**
3
+ > **Production-ready, battle-tested software architecture governed by problem-first topology alignment, strict systemic atomicity, evolutionary architecture tipping points, 100% open-source standards, true incremental TDD nano-cycles, and zero speculative bloat.**
4
4
 
5
5
  ---
6
6
 
7
7
  ## 🌟 Architectural Pillars
8
8
 
9
- 1. **Systemic Atomicity**: Every rule, skill, database transaction, and code unit adheres to the Single Responsibility Principle (SRP)—indivisible, self-contained, orthogonal, and composable with zero conjunction naming.
10
- 2. **Universal Technology & Stack Agnosticism**: Core business capabilities adhere strictly to Hexagonal (Ports & Adapters) architecture with zero runtime, language, or vendor lock-in. Runtimes, databases, and transports connect via interchangeable polyglot adapters with zero primary language bias.
11
- 3. **100% Open-Source & Open Standards**: Standardized exclusively on open-source solutions and vendor-neutral specifications (OpenTelemetry, OPA, OpenFGA, Protocol Buffers, OpenAPI 3.1, JSON Schema Draft 2020-12, CloudEvents, Semgrep, Trivy, Gitleaks, Cosign).
12
- 4. **Zero-Assumption Framework**: Ground truth is established solely through workspace configurations, code evidence, or direct user confirmation.
13
- 5. **Hardened Multi-Tenancy**: 4 interchangeable isolation models (AST query interceptor filtering, schema-per-tenant, database-per-tenant, transparent storage proxy) backed by transaction-scoped session context.
14
- 6. **Dynamic Extensibility Without Code Branching**:
9
+ 1. **Problem-First & Topology Alignment**: Architecture emerges strictly from problem constraints and execution targets (Problem-First; zero preemptive tool bias). Architectural styles match the problem topology: Hexagonal for enterprise backends, Platform Scripting for extensions, Data-Oriented Design for game engines, Command Pipeline for CLIs, and Game Loop for canvas games.
10
+ 2. **Systemic Atomicity**: Every rule, skill, database transaction, and code unit adheres to the Single Responsibility Principle (SRP)—indivisible, self-contained, orthogonal, and composable with zero conjunction naming.
11
+ 3. **Evolutionary Architecture & Refactor-Before-Add**: To eliminate AI-accelerated architectural drift, code graduates across 5 deterministic tipping points. Refactor structure first under existing green tests before implementing new features. Never append code into rotting files.
12
+ 4. **True Incremental TDD & Nano-Cycles**: Prohibit batch-test dumps ("Test-First Waterfall"). Follow Uncle Bob's Three Laws: write one micro-assertion at a time, verify RED failure output, write minimal code to turn GREEN, and refactor under green with Ping-Pong pair programming.
13
+ 5. **100% Open-Source & Open Standards**: Standardized exclusively on open-source solutions and vendor-neutral specifications (OpenTelemetry, OPA, OpenFGA, Protocol Buffers, OpenAPI 3.1, JSON Schema Draft 2020-12, CloudEvents, Semgrep, Trivy, Gitleaks, Cosign).
14
+ 6. **Zero-Assumption Framework**: Ground truth is established solely through workspace configurations, code evidence, or direct user confirmation.
15
+ 7. **Hardened Multi-Tenancy (When Applicable)**: 4 interchangeable isolation models (AST query interceptor filtering, schema-per-tenant, database-per-tenant, transparent storage proxy) backed by transaction-scoped session context.
16
+ 8. **Dynamic Extensibility Without Code Branching**:
15
17
  - Custom tables and columns via hybrid core relational/document models and validated JSON Schema.
16
18
  - Pluggable business logic via Common Expression Language (CEL), GoF Strategy registries, and WebAssembly (Wasm) micro-sandboxes.
17
19
  - Tenant lifecycles via durable workflows (Temporal / BPMN 2.0 / statecharts).
18
20
  - Server-Driven UI (SDUI) component registries and W3C Design Tokens Community Group (DTCG) theming.
19
- 7. **Resilient Database Architecture**: Full ACID atomicity, Transactional Outbox pattern eliminating dual-writes, declarative expand-contract zero-downtime migrations, and continuous Point-In-Time Recovery (PITR).
20
- 8. **Workspace Knowledge Hub & Token Economy**: In-workspace system knowledge graphs, defect post-mortems, and Lightweight Architectural Decision Records (ADRs) to eliminate repetitive token-expensive discovery loops.
21
+ 9. **Resilient Database Architecture**: Full ACID atomicity, Transactional Outbox pattern eliminating dual-writes, declarative expand-contract zero-downtime migrations, and continuous Point-In-Time Recovery (PITR).
22
+ 10. **Workspace Knowledge Hub & Token Economy**: In-workspace system knowledge graphs and Lightweight Architectural Decision Records (ADRs) to eliminate repetitive token-expensive discovery loops.
21
23
 
22
24
  ---
23
25
 
@@ -35,9 +37,8 @@
35
37
  │ └── relentless-questioner/ # Context-aware dynamic interrogation loop
36
38
  ├── docs/
37
39
  │ ├── knowledge/ # Institutional knowledge & domain contracts
38
- │ │ ├── knowledge_graph.md # Visual topologies & fast-lookup matrices
39
40
  │ │ └── ubiquitous_language.md # Living Ubiquitous Language glossary template
40
- │ └── rules/ # 47 atomic single-responsibility domain rules
41
+ │ └── rules/ # 45 atomic single-responsibility domain rules
41
42
  ├── AGENTS.md # Lean root agentic configuration (< 120 lines)
42
43
  ├── CLAUDE.md -> AGENTS.md # Filesystem symlink for harness parity
43
44
  ├── agents.md -> AGENTS.md # Filesystem symlink for harness parity
@@ -50,15 +51,14 @@
50
51
 
51
52
  ## 📋 Progressive Disclosure Rules Catalog (`docs/rules/`)
52
53
 
53
- The architecture enforces 47 atomic, single-responsibility domain rules. Read on demand to prevent prompt context bloat:
54
+ The architecture enforces 45 atomic, single-responsibility domain rules. Read on demand to prevent prompt context bloat:
54
55
 
55
56
  | Domain | Rule Reference File | Key Focus & Invariants |
56
57
  |---|---|---|
57
- | **TDD Double Loop** | [`test_driven_development.md`](./docs/rules/test_driven_development.md) | Outside-In TDD (London School), collaborator discovery, mock ownership. |
58
+ | **TDD Double Loop** | [`test_driven_development.md`](./docs/rules/test_driven_development.md) | Uncle Bob's 3 Laws, nano-cycles, Ping-Pong pairing, outside-in double loop. |
58
59
  | **Test Coverage & Isolation** | [`test_isolation.md`](./docs/rules/test_isolation.md) | 100.00% full-stack coverage, status codes, transactional DB rollback. |
59
- | **Clean Code** | [`clean_code.md`](./docs/rules/clean_code.md) | Naming, small functions (< 30 lines), CQS, SLAP, DRY, DbC, zero side-effects. |
60
- | **Design Patterns** | [`design_patterns.md`](./docs/rules/design_patterns.md) | Adapter, Factory, Facade, Strategy, and Result `<T, E>` pattern. |
61
- | **GoF Design Patterns** | [`gof_design_patterns_reference.md`](./docs/rules/gof_design_patterns_reference.md) | Complete reference of all 23 GoF patterns across OOP and functional paradigms. |
60
+ | **Clean Code** | [`clean_code.md`](./docs/rules/clean_code.md) | 5 evolutionary tipping points, Refactor-Before-Add, CQS, SLAP, DRY, fitness functions. |
61
+ | **Design Patterns** | [`design_patterns.md`](./docs/rules/design_patterns.md) | Adapter, Factory, Strategy, Result `<T, E>`, and complete 23 GoF catalog. |
62
62
  | **Type Safety** | [`typescript.md`](./docs/rules/typescript.md) | Compiler strictness, branded nominal types, type safety, static sound invariants. |
63
63
  | **ADRs** | [`architecture_decision_records.md`](./docs/rules/architecture_decision_records.md) | Authoring Lightweight Architectural Decision Records in `memory.md`. |
64
64
  | **Authentication** | [`authentication.md`](./docs/rules/authentication.md) | In-memory access tokens, refresh token rotation (RTR), WebAuthn passkeys. |
@@ -91,15 +91,14 @@ The architecture enforces 47 atomic, single-responsibility domain rules. Read on
91
91
  | **React & Frontend** | [`react.md`](./docs/rules/react.md) | Modern React, shadcn/ui, TanStack Query, React Hook Form, and Zod validation. |
92
92
  | **Requirements Engineering** | [`requirements_engineering.md`](./docs/rules/requirements_engineering.md) | User stories vs requirements, 3 C's, INVEST vertical cake slicing, Gherkin. |
93
93
  | **Product Ownership** | [`product_ownership.md`](./docs/rules/product_ownership.md) | Product Backlog Management, OKRs, Kano/MoSCoW/RICE, Product Value, empiricism. |
94
- | **Domain-Driven Design** | [`domain_driven_design.md`](./docs/rules/domain_driven_design.md) | Ubiquitous Language, Bounded Contexts, Value Objects, Aggregates. |
94
+ | **Domain-Driven Design** | [`domain_driven_design.md`](./docs/rules/domain_driven_design.md) | Problem vs Solution Space, Ubiquitous Language, Aggregates, Capability Mapping. |
95
95
  | **Workflow State Machines** | [`workflow_state_machines.md`](./docs/rules/workflow_state_machines.md) | Configurable workflows, in-aggregate invariant FSMs, transition guards & audit logs. |
96
96
  | **Cloud-Native 12-Factor** | [`cloud_native.md`](./docs/rules/cloud_native.md) | 12-Factor (2026 Edition), OpenTelemetry (OTel), stateless isolates. |
97
97
  | **Agentic Config & Skills** | [`agentic_configuration.md`](./docs/rules/agentic_configuration.md) | Progressive disclosure architecture, skill inquiry branches, refinement loop. |
98
98
  | **Project Management** | [`project_management.md`](./docs/rules/project_management.md) | Work-In-Progress limits (WIP = 1), SMART developer tasks, Definition of Done. |
99
- | **Domain Modeling** | [`domain_expertise.md`](./docs/rules/domain_expertise.md) | Business capabilities, Aggregate Root invariants, Ubiquitous Language. |
100
99
  | **Relentless Questioning** | [`relentless_questioning.md`](./docs/rules/relentless_questioning.md) | Dynamic context-aware interrogation loops, adaptive decision trees. |
101
100
  | **Workspace Isolation** | [`workspace_isolation.md`](./docs/rules/workspace_isolation.md) | Strict workspace sovereignty, zero global contamination, local ground truth. |
102
- | **Continuous Learning** | [`continuous_learning.md`](./docs/rules/continuous_learning.md) | Automated defect post-mortems, DO's/DONT's logging, dynamic rule updates. |
101
+ | **Continuous Learning** | [`continuous_learning.md`](./docs/rules/continuous_learning.md) | Direct 4-step rule ingestion, root-cause analysis, dynamic invariant updates. |
103
102
  | **Upstream Sync** | [`upstream_synchronization.md`](./docs/rules/upstream_synchronization.md) | Logging generic architecture improvements to changes.md; zero baseline pollution. |
104
103
 
105
104
  ---
@@ -134,46 +133,38 @@ In your AI coding assistant (Google Antigravity, Claude Code, Cursor, or OpenHan
134
133
  ```
135
134
  *(Or simply prompt: "Let's build a new project from this template.")*
136
135
 
137
- ### Step 3: The Relentless Architectural Interview
138
- The agent will execute a deep research loop and systematically interrogate you across all **18 systemic dimensions** (with zero assumptions) to lock in your desired technical stack:
139
-
140
- 1. **Domain, Scale & Performance**: Problem domain, p95/p99 latency budgets, peak throughput (RPS), and regulatory standards (SOC 2, ISO 27001, GDPR).
141
- 2. **Language & Runtime**: Go, Rust, Python, TypeScript, Java/Kotlin, C# (.NET), Elixir, or Polyglot microservices.
142
- 3. **Package Manager & Toolchain**: `go modules`, `cargo`, `uv`/`poetry`, `pnpm`, `gradle`, or `dotnet CLI`.
143
- 4. **Transport & Network**: REST (OpenAPI 3.1), gRPC (Protobuf v3 via `buf`), GraphQL, or Event-Driven.
144
- 5. **Transport Framework**: Gin, Axum, FastAPI, Fastify, Spring Boot, or ASP.NET Core.
145
- 6. **Database Engine**: PostgreSQL, MySQL, SQLite, CockroachDB, MongoDB, or Hybrid.
146
- 7. **Database Migrations**: Declarative schema migrations (**Atlas**) vs versioned SQL (**Flyway**, **Goose**).
147
- 8. **Multi-Tenancy Isolation**: AST query interceptor, Database RLS, Schema-per-tenant, or DB-per-tenant.
148
- 9. **Dynamic Schemas**: Universal **JSON Schema Draft 2020-12** in semi-structured columns vs EAV.
149
- 10. **Pluggable Logic & Workflows**: Common Expression Language (CEL), WebAssembly (Extism) sandboxing, and Temporal.io / BPMN 2.0.
150
- 11. **Authentication & Identity**: OIDC, OAuth 2.1, Passkeys (FIDO2/WebAuthn), PASETO, or JWT JWKS.
151
- 12. **Authorization Engine**: Open Policy Agent (OPA Rego via HTTP/Wasm), OpenFGA (Zanzibar ReBAC), or Cerbos.
152
- 13. **Frontend / Client**: Web (React, Vue, Svelte), Mobile (Flutter, Native), Server-Driven UI (SDUI), and W3C DTCG Design Tokens.
153
- 14. **Caching & Locks**: Redis, Valkey, Dragonfly, Memcached, or local LRU with XFetch stampede defense.
154
- 15. **Event Streaming**: Apache Kafka, NATS JetStream, RabbitMQ, SQS with Transactional Outbox.
155
- 16. **Observability**: OpenTelemetry OTLP traces/metrics/logs over gRPC/HTTP with W3C trace context.
156
- 17. **DevSecOps & Verification**: Semgrep SAST, Gitleaks, Trivy scanning, CycloneDX SBOM, Cosign, and Outside-In TDD (100% coverage gates).
157
- 18. **Deployment Target**: Minimal OCI Distroless/Scratch, Docker Compose, Kubernetes, and OpenTofu IaC.
136
+ ### Step 3: The Problem-First Architectural Interview
137
+ The agent will execute a deep research loop and systematically derive your technical stack strictly from problem constraints (with zero preemptive tool bias) across 5 tiered dimensions:
138
+
139
+ 1. **Problem Space & Topology Classification**: What real-world problem is being solved? What data moves and transforms? Classifies the system topology:
140
+ - *Topology A: Web SaaS / Cloud Microservices*
141
+ - *Topology B: Browser Extension (Manifest V3)*
142
+ - *Topology C: Game Engine / High-Performance Simulator (Bare metal, GPU)*
143
+ - *Topology D: Browser / Canvas Game (HTML5 Canvas / WebGL / WebGPU)*
144
+ - *Topology E: Desktop Application / CLI Utility (Native POSIX/Windows)*
145
+ - *Topology F: Systems / Embedded / Cryptographic Library*
146
+ 2. **Physical & Operational Constraints**: Latency budget (hard real-time <16.6ms frame loop vs interactive low-latency vs batch), memory model & GC tolerance (zero-GC pause tolerance vs managed throughput GC vs single-threaded event loop), and concurrency topology.
147
+ 3. **Architectural Style Derivation**: Matches style strictly to topology (Hexagonal for enterprise backends, Platform Scripting for extensions, Data-Oriented Design for game engines, Game Loop for canvas games, Command Pipeline for CLIs).
148
+ 4. **Emergent Stack & Toolchain**: Derives the optimal language (C, Rust, TypeScript, Go, Java, C#, Python), package manager, and build system strictly from the verified constraints.
149
+ 5. **Targeted Invariants (Strictly Topology-Scoped)**: Inquires *only* into the dimensions relevant to the selected topology (e.g. database migrations for web backends, content script isolation for extensions, CLI flags for CLIs; zero Docker, Kubernetes, or OpenAPI bloat for non-backend projects).
158
150
 
159
151
  ### Step 4: Blueprint Synthesis & Explicit Approval
160
152
  The agent consolidates all your choices into a formal **Architectural Specification & Technology Blueprint** and records a formal ADR in [`memory.md`](./memory.md).
161
153
  **The agent will stop and ask for your explicit confirmation before generating any code.**
162
154
 
163
- ### Step 5: Deterministic Project Bootstrapping
155
+ ### Step 5: Deterministic Topology Scaffolding (Strict YAGNI)
164
156
  Once confirmed, the agent automatically executes:
165
- 1. Directory scaffolding following **Hexagonal Architecture** (`src/domain/`, `src/ports/`, `src/adapters/`, `specs/`, `tests/`, `deploy/`).
166
- 2. Canonical contract generation (`specs/openapi/`, `specs/protobuf/`, `specs/schemas/`, `specs/tokens/`).
167
- 3. Build manifests, strict linter/formatter configurations, multi-stage Dockerfiles, and Compose environments.
168
- 4. Domain entities, primary/secondary port interfaces, and initial adapter stubs.
169
- 5. **Project-Specific README Generation**: Completely replaces the starter template `README.md` with clean, project-specific documentation (mission, stack highlights, quickstart setup, build/test commands, and directory structure), preserving links to `docs/rules/`.
170
- 6. Deterministic validation via `validate_agentic_configs.sh` and initial compiler/test suite execution.
157
+ 1. Topology-aware directory scaffolding via `bootstrap_workspace.sh . <topology> <language>`, generating **0 speculative folders** (e.g. extensions get no Kubernetes or OpenAPI specs; CLIs get no Dockerfiles).
158
+ 2. Targeted contract and entrypoint generation matching the derived topology.
159
+ 3. Build manifests, strict linter/formatter configurations, and boundary smoke test (`scripts/smoke_test.sh`).
160
+ 4. **Project-Specific README Generation**: Completely replaces the starter template `README.md` with clean, project-specific documentation (mission, stack highlights, quickstart setup, build/test commands, and directory structure), preserving links to `docs/rules/`.
161
+ 5. Deterministic validation via `validate_agentic_configs.sh` and initial smoke test execution.
162
+ 6. **Handover Gate to Domain Analysis**: Halts technical scaffolding and instructs the user to invoke `product-analyst` and `relentless-questioner` for domain modeling.
171
163
 
172
164
  ---
173
165
 
174
166
  ## 🏛️ Workspace Memory & Knowledge Hub
175
167
 
176
- - 🗺️ **[System Knowledge Graph](./docs/knowledge/knowledge_graph.md)**: Visual subsystem topologies and entity-relationship models.
177
168
  - 📖 **[Living Ubiquitous Language Glossary](./docs/knowledge/ubiquitous_language.md)**: Authoritative domain vocabulary contract.
178
169
  - 📜 **[Lightweight ADR Ledger](./memory.md)**: Formal Architectural Decision Records and governing rules.
179
170
  - 📝 **[Upstream Changes Ledger](./changes.md)**: Record candidate improvements and generic patterns for the upstream azcodr template.
package/changes.md CHANGED
@@ -60,3 +60,20 @@ When an AI agent or engineer discovers a generic architectural improvement, bug
60
60
  4. Codified Uncle Bob's Three Laws of TDD, banned batch-test dumps, and introduced the Incremental Nano-Cycle and Ping-Pong Pair Programming protocol.
61
61
  - **Domain Filter Verification:** Verified 100% generic; applicable across any language, stack, and project topology.
62
62
 
63
+ ### [2026-09-25] Permanent Removal of Static Markdown Knowledge Graph
64
+ - **Category:** Architecture & Knowledge Hub
65
+ - **Target File(s):** `docs/knowledge/knowledge_graph.md`, `AGENTS.md`, `memory.md`, `README.md`, `docs/rules/continuous_learning.md`
66
+ - **Rationale:** Static markdown Mermaid diagrams and entity models in template repositories suffer from maintenance drift, duplicate state from code/migrations, violate Problem-First by assuming a multi-tenant web backend, and waste prompt token budget.
67
+ - **Description:** Permanently eliminated `docs/knowledge/knowledge_graph.md`. Enforced code, type definitions, and versioned database migrations as the single source of truth for architectural topologies. Retained `docs/knowledge/ubiquitous_language.md` for lightweight living domain vocabulary contracts.
68
+ - **Domain Filter Verification:** Verified 100% generic; purged of all speculative and duplicate static models.
69
+
70
+ ### [2026-09-25] Workspace Rules Consolidation & Redundancy Purge
71
+ - **Category:** Rule & Knowledge Hub
72
+ - **Target File(s):** `docs/rules/domain_driven_design.md`, `docs/rules/design_patterns.md`, `docs/rules/domain_expertise.md`, `docs/rules/gof_design_patterns_reference.md`, `AGENTS.md`, `README.md`, `memory.md`
73
+ - **Rationale:** Eliminate duplicate and fragmented rules to optimize agent attention window, consolidate domain invariants, and uphold strict Single Responsibility across progressive disclosure documentation.
74
+ - **Description:**
75
+ 1. Merged business capability mapping and Aggregate Root gatekeeper invariants from `domain_expertise.md` directly into `domain_driven_design.md`. Removed redundant `domain_expertise.md`.
76
+ 2. Integrated the complete 23 Gang of Four patterns catalog from `gof_design_patterns_reference.md` directly into `design_patterns.md`. Removed redundant `gof_design_patterns_reference.md`.
77
+ 3. Reduced active progressive disclosure rules from 47 to 45 while preserving 100% domain coverage.
78
+ - **Domain Filter Verification:** Verified 100% generic; purged of all redundant files and circular links.
79
+
@@ -26,5 +26,4 @@ Whenever an error, test failure, build friction, or architectural anti-pattern o
26
26
  ## 2. Institutional Memory Maintenance
27
27
 
28
28
  - **Lightweight ADR Ledger**: Major technical decisions and invariant shifts are logged in [`memory.md`](../../memory.md) linking directly to the governing rule or skill.
29
- - **System Knowledge Graph**: Keep [`docs/knowledge/knowledge_graph.md`](../knowledge/knowledge_graph.md) synchronized with new services, ports, or adapters to avoid repetitive token-expensive codebase discovery in future sessions.
30
29
  - **Living Glossary**: Keep [`docs/knowledge/ubiquitous_language.md`](../knowledge/ubiquitous_language.md) updated with canonical domain terminology and forbidden synonyms.
@@ -36,6 +36,56 @@ Domain services must return explicit Result types, compelling callers to handle
36
36
 
37
37
  ---
38
38
 
39
- ## 3. GoF 23 Patterns Catalog
39
+ ## 3. Gang of Four (GoF) 23 Patterns Master Catalog
40
40
 
41
- For reference implementations of all 23 Gang of Four patterns across OOP and functional paradigms, consult [docs/rules/gof_design_patterns_reference.md](./gof_design_patterns_reference.md).
41
+ ### A. Creational Patterns (5 Patterns)
42
+ 1. **Factory Method**: Define an interface for creating an object, but let subclasses or factory functions decide which class to instantiate.
43
+ - *Use Case:* Tenant-specific payment gateway instantiation (`StripeAdapter` vs `PayPalAdapter`).
44
+ 2. **Abstract Factory**: Provide an interface for creating families of related or dependent objects without specifying concrete classes.
45
+ - *Use Case:* Multi-cloud storage factories creating matching `FileUploader`, `FileDownloader`, and `PresignedUrlGenerator` for S3, GCS, or MinIO.
46
+ 3. **Builder**: Separate the construction of a complex object from its representation, allowing the same construction process to create different representations.
47
+ - *Use Case:* Fluent query builders, complex report generators, or test data builders (`OrderBuilder.withItems(...).build()`).
48
+ 4. **Prototype**: Specify the kinds of objects to create using a prototypical instance, creating new objects by cloning this prototype.
49
+ - *Use Case:* Fast cloning of default tenant configuration templates without querying storage.
50
+ 5. **Singleton (DI-Scoped)**: Ensure a class has only one instance and provide a global point of access.
51
+ - *Rule:* Avoid global static singletons (causes test coupling). Enforce singleton lifecycle strictly through Dependency Injection (DI) containers.
52
+
53
+ ### B. Structural Patterns (7 Patterns)
54
+ 6. **Adapter (Mandatory)**: Convert the interface of a class into another interface clients expect.
55
+ - *Use Case:* Wrapping 3rd-party SDKs, storage drivers, and external network clients in application-owned interfaces. *Rule: Only mock types you own.*
56
+ 7. **Bridge**: Decouple an abstraction from its implementation so the two can vary independently.
57
+ - *Use Case:* Decoupling notification abstractions (`UrgentNotification`, `BatchNotification`) from delivery channels (`EmailChannel`, `SlackChannel`).
58
+ 8. **Composite**: Compose objects into tree structures to represent part-whole hierarchies.
59
+ - *Use Case:* Nested RBAC permission trees or hierarchical menu navigation systems.
60
+ 9. **Decorator**: Attach additional responsibilities to an object dynamically as a flexible alternative to subclassing.
61
+ - *Use Case:* Wrapping repository methods with distributed caching, OpenTelemetry tracing, or metrics logging.
62
+ 10. **Facade**: Provide a unified, high-level interface to a complex set of interfaces in a subsystem.
63
+ - *Use Case:* Checkout facade orchestrating inventory verification, payment processing, invoice generation, and email notification.
64
+ 11. **Flyweight**: Use sharing to support large numbers of fine-grained objects efficiently.
65
+ - *Use Case:* In-memory sharing of immutable tenant metadata and shared system role permission definitions.
66
+ 12. **Proxy**: Provide a surrogate or placeholder for another object to control access to it.
67
+ - *Use Case:* Lazy-loading database relations, virtual proxies for large assets, or tenant-scoped connection proxies.
68
+
69
+ ### C. Behavioral Patterns (11 Patterns)
70
+ 13. **Chain of Responsibility**: Pass requests along a chain of handlers until a handler processes it or the chain ends.
71
+ - *Use Case:* Inbound gateway middleware pipelines (Authentication ➔ TenantResolution ➔ RateLimiting ➔ Controller).
72
+ 14. **Command**: Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undo.
73
+ - *Use Case:* Asynchronous job queues, transactional audit commands, CQRS command handlers.
74
+ 15. **Interpreter**: Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences.
75
+ - *Use Case:* Custom search filter parsers (`status:active AND tier:pro`) or rule engine expression evaluation.
76
+ 16. **Iterator**: Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.
77
+ - *Use Case:* Async iterators streaming large database cursor result sets or reading multi-part upload chunks.
78
+ 17. **Mediator**: Define an object that encapsulates how a set of objects interact, preventing direct coupling between them.
79
+ - *Use Case:* In-memory event dispatcher mediating communication between decoupled domain services.
80
+ 18. **Memento**: Without violating encapsulation, capture and externalize an object's internal state so the object can be restored to this state later.
81
+ - *Use Case:* Audit trail snapshots recording `before` and `after` states for rollback capabilities.
82
+ 19. **Observer**: Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified automatically.
83
+ - *Use Case:* Domain Event buses (`UserRegisteredEvent`, `PaymentFailedEvent`) invoking multiple listeners.
84
+ 20. **State**: Allow an object to alter its behavior when its internal state changes, appearing as if it changed its class.
85
+ - *Use Case:* Subscription lifecycles (`TrialState` ➔ `ActiveState` ➔ `PastDueState` ➔ `CanceledState`) where allowed actions change dynamically.
86
+ 21. **Strategy**: Define a family of algorithms, encapsulate each one, and make them interchangeable at runtime.
87
+ - *Use Case:* Dynamic fee calculation, tenant-specific password complexity policies, or feature flag evaluation providers.
88
+ 22. **Template Method**: Define the skeleton of an algorithm in an operation, deferring some steps to subclasses.
89
+ - *Use Case:* Base ETL or data import pipelines with fixed steps (Extract ➔ Validate ➔ Transform ➔ Persist) where subclasses define validation.
90
+ 23. **Visitor**: Represent an operation to be performed on the elements of an object structure, defining a new operation without changing the classes of the elements.
91
+ - *Use Case:* Document export engines traversing an AST of content blocks to generate HTML, Markdown, or PDF.
@@ -27,6 +27,12 @@ Software engineering fails when teams jump directly into the **Solution Space**
27
27
  - **The Solution Space (The Accidents):** Concerns *how* the system is realized. Runtimes, programming languages (C, Rust, TS, Go, Java), and storage engines are **emergent outputs** derived strictly from Problem Space constraints.
28
28
  - **The Golden Hammer Anti-Pattern:** Selecting tools (e.g., "Let's use Next.js and PostgreSQL") before mapping problem constraints forces the domain to fit the tool, creating massive accidental complexity.
29
29
 
30
+ ### Strategic Subdomain & Capability Mapping
31
+ Structure enterprise business capabilities into three distinct tiers:
32
+ 1. **Core Subdomain / Capabilities**: Proprietary value drivers and business differentiators (e.g. specialized workflow engines, dynamic pricing algorithms). Allocate 80% of architectural effort here.
33
+ 2. **Supporting Subdomain / Capabilities**: Business functions specific to the domain but not competitive differentiators (e.g. order tracking, invoice rendering).
34
+ 3. **Generic Subdomain / Capabilities**: Standard commoditized software (e.g. authentication, audit logging, email transport). Rely exclusively on standard open-source libraries.
35
+
30
36
  ---
31
37
 
32
38
  ## 2. Domain-Code Language Agreement
@@ -89,6 +95,24 @@ Acceptance criteria must be written strictly in Ubiquitous Language, serving as
89
95
 
90
96
  1. **Entities**: Objects defined by identity that persists across state changes (e.g. `User`, `Order`, `Invoice`).
91
97
  2. **Value Objects**: Immutable objects defined strictly by their attributes with no identity (e.g. `Money`, `DateRange`, `EmailAddress`).
92
- 3. **Aggregates & Aggregate Roots**: Clusters of domain objects treated as a single transactional consistency boundary. All mutations must pass through explicit methods on the Aggregate Root.
98
+ 3. **Aggregates & Aggregate Roots**: Clusters of domain objects treated as a single transactional consistency boundary. All mutations must pass through explicit methods on the Aggregate Root that assert invariants before committing state:
99
+ - **Zero Anemic Domain Models**: Domain entities must encapsulate state and validation logic. Never expose public setters that allow outside code to corrupt business rules.
100
+ - **Aggregate Root Gatekeeper Pattern**:
101
+ ```typescript
102
+ export class OrderAggregate {
103
+ private constructor(private order: OrderState) {}
104
+
105
+ submit(): Result<void, DomainError> {
106
+ if (this.order.items.length === 0) {
107
+ return err(new DomainError('Cannot submit empty order'));
108
+ }
109
+ if (this.order.status !== 'DRAFT') {
110
+ return err(new DomainError('Order already submitted'));
111
+ }
112
+ this.order.status = 'SUBMITTED';
113
+ return ok(undefined);
114
+ }
115
+ }
116
+ ```
93
117
  4. **Anti-Corruption Layer (ACL)**: When integrating with third-party APIs or legacy systems that use different terminology, translate external payloads into the internal Ubiquitous Language at the boundary adapter before they enter the domain core.
94
118
  5. **Cross-Aggregate Coordination in Use Cases**: While an Aggregate Root guards its own internal invariants, business operations frequently span multiple aggregates (e.g. reserving an inventory item for an agreement). Application use cases or orchestrators must coordinate aggregate transitions atomically: asserting resource availability prior to state change, transitioning the constrained entity (e.g. `ALLOCATED`), and restoring state (`AVAILABLE`) upon cancellation, avoiding double-allocation race conditions without coupling aggregates directly.
package/memory.md CHANGED
@@ -6,7 +6,6 @@
6
6
 
7
7
  ## 1. Quick Navigation & Knowledge Repositories
8
8
 
9
- - 🗺️ **[System Knowledge Graph](./docs/knowledge/knowledge_graph.md)**: Architectural subsystems, Mermaid topologies, entity relationships, and fast-lookup matrices.
10
9
  - 📖 **[Living Ubiquitous Language Glossary](./docs/knowledge/ubiquitous_language.md)**: Authoritative, single-name domain vocabulary contract.
11
10
  - 📜 **[Lightweight ADR Master Index](#adr-master-index)**: Summary of all architectural decisions and direct links to governing rules.
12
11
  - 📝 **[Upstream Changes Ledger](./changes.md)**: Ledger of candidate improvements and generic patterns for upstream azcodr.
@@ -33,6 +32,9 @@
33
32
  | **ADR-013** | Design Architecture Triage, Persistent Shell & Dev Persona Isolation | 2026-09-20 | ACCEPTED | [`ui_ux_architecture.md`](./docs/rules/ui_ux_architecture.md), [`authentication.md`](./docs/rules/authentication.md) |
34
33
  | **ADR-014** | Product Ownership, Prioritization Models, SMART Tasks & INVEST Slicing | 2026-09-21 | ACCEPTED | [`product_ownership.md`](./docs/rules/product_ownership.md), [`requirements_engineering.md`](./docs/rules/requirements_engineering.md), [`project_management.md`](./docs/rules/project_management.md) |
35
34
  | **ADR-015** | Problem-First Architecture, Topology Scaffolding, Tipping Points & Nano-TDD | 2026-09-25 | ACCEPTED | [`clean_code.md`](./docs/rules/clean_code.md), [`domain_driven_design.md`](./docs/rules/domain_driven_design.md), [`test_driven_development.md`](./docs/rules/test_driven_development.md), [`lets-build`](./.agents/skills/lets-build/SKILL.md) |
35
+ | **ADR-016** | Elimination of Static Markdown Knowledge Graph | 2026-09-25 | ACCEPTED | [`clean_code.md`](./docs/rules/clean_code.md), [`continuous_learning.md`](./docs/rules/continuous_learning.md) |
36
+ | **ADR-017** | Progressive Rules Consolidation (DDD & GoF Patterns) | 2026-09-25 | ACCEPTED | [`domain_driven_design.md`](./docs/rules/domain_driven_design.md), [`design_patterns.md`](./docs/rules/design_patterns.md) |
37
+
36
38
 
37
39
  ---
38
40
 
@@ -126,3 +128,18 @@
126
128
  4. Mandate **True Incremental TDD & Nano-Cycles**: Prohibit batch-test dumps ("Test-First Waterfall"); enforce Uncle Bob's Three Laws (especially Law #2) and Ping-Pong pair programming with verified RED failure proofs.
127
129
  - **Enforced In:** [`AGENTS.md`](./AGENTS.md), [`clean_code.md`](./docs/rules/clean_code.md), [`domain_driven_design.md`](./docs/rules/domain_driven_design.md), [`test_driven_development.md`](./docs/rules/test_driven_development.md), [`lets-build`](./.agents/skills/lets-build/SKILL.md), [`architecture_interview_matrix.md`](./.agents/skills/lets-build/references/architecture_interview_matrix.md).
128
130
 
131
+ #### ADR-016: Elimination of Static Markdown Knowledge Graph in Favor of Code-as-Truth & Living Glossary
132
+ - **Date:** 2026-09-25 | **Status:** ACCEPTED
133
+ - **Context:** Template repositories often maintain static markdown files containing Mermaid diagrams, ERDs, and component topologies (`docs/knowledge/knowledge_graph.md`). In practice, these static artifacts suffer from rapid maintenance drift, violate the Problem-First mandate by pre-fabricating multi-tenant web backend models before the user defines their project, duplicate existing domain rules and memory records, and become stale tokens consumed on every context load.
134
+ - **Decision:** Permanently delete `docs/knowledge/knowledge_graph.md`. Treat executable code, strict type definitions, and versioned database migrations as the sole source of truth for architectural topologies. Retain `docs/knowledge/ubiquitous_language.md` as the lightweight, living domain vocabulary contract.
135
+ - **Enforced In:** [`AGENTS.md`](./AGENTS.md), [`clean_code.md`](./docs/rules/clean_code.md), [`continuous_learning.md`](./docs/rules/continuous_learning.md), [`memory.md`](./memory.md).
136
+
137
+ #### ADR-017: Progressive Rules Consolidation (DDD & GoF Design Patterns)
138
+ - **Date:** 2026-09-25 | **Status:** ACCEPTED
139
+ - **Context:** Multiple domain rules exhibited redundant overlaps: `domain_expertise.md` duplicated strategic capability mapping and tactical aggregate invariants already governed by `domain_driven_design.md`, while `gof_design_patterns_reference.md` artificially fragmented design patterns into a separate satellite file from `design_patterns.md`. This fragmentation caused token bloat in `AGENTS.md` and scattered domain invariants.
140
+ - **Decision:**
141
+ 1. Merge business capability tiering (Core/Supporting/Generic) and the Aggregate Root Gatekeeper invariant example into [`domain_driven_design.md`](./docs/rules/domain_driven_design.md). Delete redundant `domain_expertise.md`.
142
+ 2. Consolidate the 23 Gang of Four patterns catalog directly into [`design_patterns.md`](./docs/rules/design_patterns.md). Delete redundant `gof_design_patterns_reference.md`.
143
+ 3. Streamline rule catalog across `AGENTS.md` and `README.md` to 45 lean, single-responsibility, non-overlapping rules.
144
+ - **Enforced In:** [`AGENTS.md`](./AGENTS.md), [`README.md`](./README.md), [`domain_driven_design.md`](./docs/rules/domain_driven_design.md), [`design_patterns.md`](./docs/rules/design_patterns.md).
145
+
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "azcodr",
3
- "version": "1.2.0",
4
- "description": "Enterprise Multi-Tenant Architecture & Agentic Engineering Starter Template",
3
+ "version": "1.2.2",
4
+ "description": "Enterprise Architecture & Agentic Engineering Starter Template",
5
5
  "bin": {
6
6
  "azcodr": "bin/azcodr.js"
7
7
  },
@@ -1,188 +0,0 @@
1
- # System Knowledge Graph & Architectural Topology
2
-
3
- > **Core Purpose:** High-density, token-efficient knowledge representation of the workspace architecture, data topologies, and subsystem boundaries, eliminating repetitive discovery prompts.
4
-
5
- ---
6
-
7
- ## 1. Universal Hexagonal Architectural Subsystems
8
-
9
- ```mermaid
10
- flowchart TD
11
- subgraph Ingress["Client & Primary Ingress Adapters"]
12
- UI["Multi-Platform Client (Web / Mobile / Desktop SDUI)"]
13
- Gateway["Ingress Gateway / Envoy (REST / gRPC / SSE)"]
14
- BrokerIn["Message Consumer (Kafka / NATS / RabbitMQ)"]
15
- end
16
-
17
- subgraph Core["Pure Invariant Domain Core (Hexagonal Ports)"]
18
- direction TB
19
- TenantContext["Multi-Tenant Context Resolver Port"]
20
- AuthPort["Authentication & Identity Port"]
21
- AuthzPort["Authorization & Policy Port"]
22
- DomainServices["Domain Services & Aggregate Roots"]
23
- RulePort["Dynamic Rule Engine Port (CEL / Wasm)"]
24
- WorkflowPort["Workflow Orchestration Port (Temporal / BPMN)"]
25
- OutboxPort["Transactional Outbox Port"]
26
- CachePort["Cache & Distributed Lock Port"]
27
- RepoPort["Universal Repository Port"]
28
- end
29
-
30
- subgraph Egress["Secondary / Egress Polyglot Adapters"]
31
- Storage["Relational & NoSQL Storage (Postgres / MySQL / Cockroach / Mongo)"]
32
- CacheStore["In-Memory Store (Redis / Valkey / Dragonfly / Memcached)"]
33
- BrokerOut["Event Streaming (Kafka / NATS / RabbitMQ / CloudEvents)"]
34
- AuthEngines["Policy-as-Code (OPA Rego / OpenFGA ReBAC / Cerbos)"]
35
- SMTP["Transactional Email Gateway (SMTP / Providers)"]
36
- end
37
-
38
- UI --> Gateway
39
- Gateway --> TenantContext
40
- BrokerIn --> DomainServices
41
- TenantContext --> AuthPort
42
- AuthPort --> AuthzPort
43
- AuthzPort --> DomainServices
44
- DomainServices --> RulePort
45
- DomainServices --> WorkflowPort
46
- DomainServices --> OutboxPort
47
- DomainServices --> CachePort
48
- DomainServices --> RepoPort
49
-
50
- RepoPort --> Storage
51
- OutboxPort --> Storage
52
- OutboxPort --> BrokerOut
53
- CachePort --> CacheStore
54
- AuthzPort --> AuthEngines
55
- DomainServices --> SMTP
56
- ```
57
-
58
- ---
59
-
60
- ## 2. Multi-Tenant Data Isolation & Schema Graph
61
-
62
- ```mermaid
63
- erDiagram
64
- TENANT ||--o{ USER : "owns"
65
- TENANT ||--o{ ROLE : "defines"
66
- TENANT ||--o{ TENANT_SCHEMA : "configures"
67
- TENANT ||--o{ TENANT_ENTITY : "defines"
68
- TENANT_ENTITY ||--o{ TENANT_RECORD : "stores"
69
- TENANT ||--o{ OUTBOX_EVENT : "emits"
70
- TENANT ||--o{ AUDIT_LOG : "records"
71
-
72
- TENANT {
73
- uuid id PK
74
- string slug UK
75
- string name
76
- string subscription_tier
77
- string status
78
- json theme_tokens
79
- timestamptz created_at
80
- }
81
-
82
- USER {
83
- uuid id PK
84
- uuid tenant_id FK
85
- string email UK
86
- string password_hash
87
- boolean mfa_enabled
88
- timestamptz created_at
89
- }
90
-
91
- TENANT_SCHEMA {
92
- uuid id PK
93
- uuid tenant_id FK
94
- string entity_name
95
- json json_schema
96
- int version
97
- }
98
-
99
- OUTBOX_EVENT {
100
- uuid id PK
101
- uuid tenant_id FK
102
- string aggregate_type
103
- string aggregate_id
104
- string event_type
105
- json payload
106
- string status
107
- timestamptz created_at
108
- }
109
- ```
110
-
111
- ---
112
-
113
- ## 3. Subsystem Fast Lookup Index
114
-
115
- | Capability | Invariant Contract / Open Standard | Swappable Polyglot Adapters | Governing Rule |
116
- |---|---|---|---|
117
- | **Runtime & Language** | Hexagonal Core (Zero Deps) | Polyglot (Go, Rust, Python, Java, TypeScript) | [`clean_code.md`](../rules/clean_code.md) |
118
- | **Type Safety** | Sound static types & branded primitives | Rust, TypeScript, Go, Python (type hints) | [`typescript.md`](../rules/typescript.md) |
119
- | **Persistence / DAL** | Abstract Repository & Unit of Work | Atlas / Flyway migrations; SQL & NoSQL drivers | [`database_transactions.md`](../rules/database_transactions.md) |
120
- | **Tenant Isolation** | 4 Models (AST Interceptor, Schema, DB, Proxy) | SQL AST parser, RLS, multi-pool router, Envoy | [`multitenancy_isolation.md`](../rules/multitenancy_isolation.md) |
121
- | **Dynamic Schemas** | JSON Schema Draft 2020-12 | Polyglot validators (`valico`, `gojsonschema`, `ajv`) | [`tenant_dynamic_schemas.md`](../rules/tenant_dynamic_schemas.md) |
122
- | **Authentication** | OIDC, OAuth 2.1, Passkeys (WebAuthn) | PASETO, JWT with JWKS, SPIFFE/SPIRE mTLS | [`authentication.md`](../rules/authentication.md) |
123
- | **Authorization** | Policy-as-Code & ReBAC | OPA (Rego/Wasm), OpenFGA (Zanzibar), Cerbos | [`authorization.md`](../rules/authorization.md) |
124
- | **Pluggable Logic** | Common Expression Language (CEL) / Wasm | `cel-go`, `cel-rust`, Extism (Wasm plugins) | [`tenant_pluggable_logic.md`](../rules/tenant_pluggable_logic.md) |
125
- | **Workflows** | Durable Orchestration & Statecharts | Temporal.io SDKs, Camunda/Zeebe (BPMN 2.0) | [`tenant_pluggable_logic.md`](../rules/tenant_pluggable_logic.md) |
126
- | **Caching** | Abstract Cache Port with XFetch | Redis, Valkey, Dragonfly, Memcached, Local LRU | [`caching.md`](../rules/caching.md) |
127
- | **Feature Flags** | OpenFeature Standard | Flipt, Unleash, LaunchDarkly, GoFeatureFlag | [`feature_flags.md`](../rules/feature_flags.md) |
128
- | **Testing** | Outside-In TDD, BDD & Consumer Contracts | Cucumber/Gherkin, Pact, Schemathesis | [`test_driven_development.md`](../rules/test_driven_development.md) |
129
- | **Presentation / SDUI** | Declarative JSON SDUI + DTCG Tokens | Web (React/Vue/Svelte), Mobile (Flutter/Native) | [`server_driven_ui.md`](../rules/server_driven_ui.md) |
130
- | **Transactional Email** | Declarative Email Specs / MJML | SMTP Gateway, Mailpit (Local), SES/Sendgrid | [`transactional_email.md`](../rules/transactional_email.md) |
131
- | **Event Streaming** | CNCF CloudEvents v1.0.2 | Kafka, NATS JetStream, RabbitMQ, SQS | [`database_transactions.md`](../rules/database_transactions.md) |
132
- | **Observability** | OpenTelemetry OTLP standard | OTel Collector, Jaeger, Prometheus, OpenSearch | [`cloud_native.md`](../rules/cloud_native.md) |
133
-
134
- ---
135
-
136
- ## 4. Agentic Skill Topology & Composability Matrix
137
-
138
- ```mermaid
139
- flowchart TD
140
- subgraph Inputs["Inception & Intent"]
141
- Req["Stakeholder Feature Request / Mutation"]
142
- end
143
-
144
- subgraph Pattern1["Pattern 1: Sequential Pipeline Chaining (Workflows)"]
145
- direction TB
146
- SkillRQ["relentless-questioner"]
147
- SkillPA["product-analyst"]
148
- SkillTDD["test_driven_development"]
149
- SkillRefactor["clean-code-refactor"]
150
-
151
- SkillRQ -->|"Feature Alignment Spec (FAS)"| SkillPA
152
- SkillPA -->|"INVEST Stories & Gherkin AC"| SkillTDD
153
- SkillTDD -->|"Working Green Code"| SkillRefactor
154
- end
155
-
156
- subgraph Pattern2["Pattern 2: Dynamic Skill Stacking (Contextual Composition)"]
157
- AgentCore["Primary Agent Session"]
158
- SkillSec["compliance-audit"]
159
- SkillArch["agentic-architect"]
160
-
161
- AgentCore -.->|"Dynamic Load"| SkillSec
162
- AgentCore -.->|"Dynamic Load"| SkillArch
163
- end
164
-
165
- subgraph Pattern3["Pattern 3: Multi-Agent Subagent Delegation (Division of Labor)"]
166
- Coord["Coordinator Agent"]
167
- SubA["Subagent A: Compliance Auditor"]
168
- SubB["Subagent B: Code Refactorer"]
169
-
170
- Coord -->|"Invoke Task"| SubA
171
- Coord -->|"Invoke Task"| SubB
172
- SubA -->|"Audit Findings"| Coord
173
- SubB -->|"Refactored Units"| Coord
174
- end
175
-
176
- Req --> SkillRQ
177
- ```
178
-
179
- ### Many-to-Many Skill Cross-Matrix
180
-
181
- | Skill Name | Functional Specialty | Applicable Lifecycle Stages | Target Artifacts Produced |
182
- |---|---|---|---|
183
- | `relentless-questioner` | Context-aware ambiguity interrogation | Pre-Discovery, Pre-Planning | Feature Alignment Spec (FAS), Invariant List |
184
- | `product-analyst` | Requirements decomposition & Gherkin | Phase 1: Requirements | INVEST User Stories, Gherkin Scenarios |
185
- | `lets-build` | Technical infrastructure scaffolding | Initial Bootstrapping only | Package manifests, build configs, `/healthz` |
186
- | `clean-code-refactor` | Code smell eradication, GoF patterns | Phase 4: TDD Inner Loop | Decoupled classes, small functions (< 30 lines) |
187
- | `compliance-audit` | Security & compliance verification | Phase 1, Phase 5: DoD | Gitleaks, Semgrep, Trivy, OWASP audit logs |
188
- | `agentic-architect` | Agent configuration & skill governance | Continuous meta-refinement | Atomic `SKILL.md`, `AGENTS.md`, ADR records |
@@ -1,42 +0,0 @@
1
- # Domain Expertise, Capability Mapping & Business Invariants
2
-
3
- > **Core Mandate:** Decompose business domains into distinct capability boundaries, enforce business invariants strictly within Aggregate Roots, and protect living Ubiquitous Language.
4
-
5
- ---
6
-
7
- ## 1. Business Capability Mapping
8
-
9
- Structure enterprise business logic into three distinct capability tiers:
10
- 1. **Core Capabilities**: Proprietary value drivers and differentiators (e.g. specialized tenant workflow engines, dynamic pricing algorithms). Allocate 80% of architectural effort here.
11
- 2. **Supporting Capabilities**: Business functions specific to the domain but not competitive differentiators (e.g. order tracking, invoice rendering).
12
- 3. **Generic Capabilities**: Standard commoditized software (e.g. authentication, audit logging, email transport). Rely exclusively on standard open-source libraries.
13
-
14
- ---
15
-
16
- ## 2. Invariant Protection within Aggregate Roots
17
-
18
- - **Zero Anemic Domain Models**: Domain entities must encapsulate state and validation. Do not expose public setters that allow outside code to corrupt business rules.
19
- - **Aggregate Root Gatekeeper**: All mutations that modify entity state or related child entities must pass through explicit methods on the Aggregate Root that assert invariants before committing state:
20
- ```typescript
21
- export class OrderAggregate {
22
- private constructor(private order: OrderState) {}
23
-
24
- submit(): Result<void, DomainError> {
25
- if (this.order.items.length === 0) {
26
- return err(new DomainError('Cannot submit empty order'));
27
- }
28
- if (this.order.status !== 'DRAFT') {
29
- return err(new DomainError('Order already submitted'));
30
- }
31
- this.order.status = 'SUBMITTED';
32
- return ok(undefined);
33
- }
34
- }
35
- ```
36
-
37
- ---
38
-
39
- ## 3. Living Ubiquitous Language Dictionary
40
-
41
- - Maintain strict terminology discipline across models, database tables, API schemas, and frontend labels.
42
- - When domain experts or users establish a term, document it immediately and eliminate all competing synonyms across the codebase.
@@ -1,70 +0,0 @@
1
- # Gang of Four (GoF) Design Patterns — Universal Enterprise Reference
2
-
3
- > **Core Mandate:** Master catalog of all 23 Gang of Four design patterns mapped to real-world domain architectures across OOP and functional polyglot systems.
4
-
5
- ---
6
-
7
- ## 1. Creational Patterns (5 Patterns)
8
-
9
- Creational patterns abstract the instantiation process, making systems independent of how objects are created and composed.
10
-
11
- 1. **Factory Method**: Define an interface for creating an object, but let subclasses or factory functions decide which class to instantiate.
12
- - *Use Case:* Tenant-specific payment gateway instantiation (`StripeAdapter` vs `PayPalAdapter`).
13
- 2. **Abstract Factory**: Provide an interface for creating families of related or dependent objects without specifying concrete classes.
14
- - *Use Case:* Multi-cloud storage factories creating matching `FileUploader`, `FileDownloader`, and `PresignedUrlGenerator` for S3, GCS, or MinIO.
15
- 3. **Builder**: Separate the construction of a complex object from its representation, allowing the same construction process to create different representations.
16
- - *Use Case:* Fluent query builders, complex report generators, or test data builders (`OrderBuilder.withItems(...).build()`).
17
- 4. **Prototype**: Specify the kinds of objects to create using a prototypical instance, creating new objects by cloning this prototype.
18
- - *Use Case:* Fast cloning of default tenant configuration templates without querying storage.
19
- 5. **Singleton (DI-Scoped)**: Ensure a class has only one instance and provide a global point of access.
20
- - *Rule:* Avoid global static singletons (causes test coupling). Enforce singleton lifecycle strictly through Dependency Injection (DI) containers.
21
-
22
- ---
23
-
24
- ## 2. Structural Patterns (7 Patterns)
25
-
26
- Structural patterns deal with object composition and relationships, ensuring subsystems remain decoupled and flexible.
27
-
28
- 6. **Adapter (Mandatory)**: Convert the interface of a class into another interface clients expect.
29
- - *Use Case:* Wrapping 3rd-party SDKs, storage drivers, and external network clients in application-owned interfaces. *Rule: Only mock types you own.*
30
- 7. **Bridge**: Decouple an abstraction from its implementation so the two can vary independently.
31
- - *Use Case:* Decoupling notification abstractions (`UrgentNotification`, `BatchNotification`) from delivery channels (`EmailChannel`, `SlackChannel`).
32
- 8. **Composite**: Compose objects into tree structures to represent part-whole hierarchies.
33
- - *Use Case:* Nested RBAC permission trees or hierarchical menu navigation systems.
34
- 9. **Decorator**: Attach additional responsibilities to an object dynamically as a flexible alternative to subclassing.
35
- - *Use Case:* Wrapping repository methods with distributed caching, OpenTelemetry tracing, or metrics logging.
36
- 10. **Facade**: Provide a unified, high-level interface to a complex set of interfaces in a subsystem.
37
- - *Use Case:* Checkout facade orchestrating inventory verification, payment processing, invoice generation, and email notification.
38
- 11. **Flyweight**: Use sharing to support large numbers of fine-grained objects efficiently.
39
- - *Use Case:* In-memory sharing of immutable tenant metadata and shared system role permission definitions.
40
- 12. **Proxy**: Provide a surrogate or placeholder for another object to control access to it.
41
- - *Use Case:* Lazy-loading database relations, virtual proxies for large assets, or tenant-scoped connection proxies.
42
-
43
- ---
44
-
45
- ## 3. Behavioral Patterns (11 Patterns)
46
-
47
- Behavioral patterns characterize the ways in which classes or objects interact and distribute responsibility.
48
-
49
- 13. **Chain of Responsibility**: Pass requests along a chain of handlers until a handler processes it or the chain ends.
50
- - *Use Case:* Inbound gateway middleware pipelines (Authentication ➔ TenantResolution ➔ RateLimiting ➔ Controller).
51
- 14. **Command**: Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undo.
52
- - *Use Case:* Asynchronous job queues, transactional audit commands, CQRS command handlers.
53
- 15. **Interpreter**: Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences.
54
- - *Use Case:* Custom search filter parsers (`status:active AND tier:pro`) or rule engine expression evaluation.
55
- 16. **Iterator**: Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.
56
- - *Use Case:* Async iterators streaming large database cursor result sets or reading multi-part upload chunks.
57
- 17. **Mediator**: Define an object that encapsulates how a set of objects interact, preventing direct coupling between them.
58
- - *Use Case:* In-memory event dispatcher mediating communication between decoupled domain services.
59
- 18. **Memento**: Without violating encapsulation, capture and externalize an object's internal state so the object can be restored to this state later.
60
- - *Use Case:* Audit trail snapshots recording `before` and `after` states for rollback capabilities.
61
- 19. **Observer**: Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified automatically.
62
- - *Use Case:* Domain Event buses (`UserRegisteredEvent`, `PaymentFailedEvent`) invoking multiple listeners.
63
- 20. **State**: Allow an object to alter its behavior when its internal state changes, appearing as if it changed its class.
64
- - *Use Case:* Subscription lifecycles (`TrialState` ➔ `ActiveState` ➔ `PastDueState` ➔ `CanceledState`) where allowed actions change dynamically.
65
- 21. **Strategy**: Define a family of algorithms, encapsulate each one, and make them interchangeable at runtime.
66
- - *Use Case:* Dynamic fee calculation, tenant-specific password complexity policies, or feature flag evaluation providers.
67
- 22. **Template Method**: Define the skeleton of an algorithm in an operation, deferring some steps to subclasses.
68
- - *Use Case:* Base ETL or data import pipelines with fixed steps (Extract ➔ Validate ➔ Transform ➔ Persist) where subclasses define validation.
69
- 23. **Visitor**: Represent an operation to be performed on the elements of an object structure, defining a new operation without changing the classes of the elements.
70
- - *Use Case:* Document export engines traversing an AST of content blocks to generate HTML, Markdown, or PDF.