The Constitution
The Constitution is a set of immutable rules that form the foundational layer of the lg5-spring-agent-os. Every piece of code generated by the agent, every architectural decision, and every pull request is bound by these rules.
A rule is constitutional if its severity is must. Any deviation from a constitutional rule requires an explicit Architectural Decision Record (ADR) to justify it.
There are currently 15 constitutional rules and 3 advisory rules.
Constitutional Rules (severity: must)
These rules are mandatory and enforced automatically by the lg5-code-reviewer subagent.
| ID | Scope | One-liner |
|---|---|---|
RULE-001 | Framework | Stack baseline: Spring Boot 3.4.2, Spring 6.2.2, JDK 21, Kotlin 21. |
RULE-002 | Framework | Parent POM must be com.lg5.spring:lg5-spring-parent. |
RULE-003 | Architecture | Hexagonal + DDD; the domain core must be Spring-free. |
RULE-004 | Architecture | All services must mirror the blank-service 8-module shape. |
RULE-005 | Framework | No custom framework annotations—stock Spring + Lombok only. |
RULE-006 | Architecture | REST controllers must produce application/vnd.api.v1+json. |
RULE-007 | Kafka | Kafka payloads must be Avro (SpecificRecordBase). |
RULE-008 | Outbox | The Transactional Outbox pattern is mandatory for cross-boundary events. |
RULE-009 | Saga | SagaStep<T> implementations must be transactional and idempotent. |
RULE-010 | Kafka | Kafka listeners must treat OptimisticLock and not-found errors as NO-OPs. |
RULE-011 | Outbox | Outbox schedulers must implement the OutboxScheduler interface. |
RULE-012 | Testing | Integration and Acceptance tests must use @ActiveProfiles({"test","local"}). |
RULE-013 | Testing | Testcontainers use must be opt-in via a testcontainers.<name>.enabled property. |
RULE-014 | Framework | Configuration properties must use canonical prefixes (e.g., kafka-config.*). |
RULE-016 | Architecture | DDD building blocks must come from the ddd-common-domain library. |
Advisory Rules
These rules are strong recommendations and best practices. While not strictly enforced, they should be followed unless there is a compelling reason not to.
| ID | Severity | Scope | One-liner |
|---|---|---|---|
RULE-015 | should | Style | final everywhere, use records for DTOs, Kotlin only for interfaces/config. |
RULE-017 | should | Build | Prefer Make targets (e.g., make all-build) over raw mvn or gradle commands. |
RULE-018 | info | Reference | Ground all answers and generated code against the canonical reference projects. |