Skip to content

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.

IDScopeOne-liner
RULE-001FrameworkStack baseline: Spring Boot 3.4.2, Spring 6.2.2, JDK 21, Kotlin 21.
RULE-002FrameworkParent POM must be com.lg5.spring:lg5-spring-parent.
RULE-003ArchitectureHexagonal + DDD; the domain core must be Spring-free.
RULE-004ArchitectureAll services must mirror the blank-service 8-module shape.
RULE-005FrameworkNo custom framework annotations—stock Spring + Lombok only.
RULE-006ArchitectureREST controllers must produce application/vnd.api.v1+json.
RULE-007KafkaKafka payloads must be Avro (SpecificRecordBase).
RULE-008OutboxThe Transactional Outbox pattern is mandatory for cross-boundary events.
RULE-009SagaSagaStep<T> implementations must be transactional and idempotent.
RULE-010KafkaKafka listeners must treat OptimisticLock and not-found errors as NO-OPs.
RULE-011OutboxOutbox schedulers must implement the OutboxScheduler interface.
RULE-012TestingIntegration and Acceptance tests must use @ActiveProfiles({"test","local"}).
RULE-013TestingTestcontainers use must be opt-in via a testcontainers.<name>.enabled property.
RULE-014FrameworkConfiguration properties must use canonical prefixes (e.g., kafka-config.*).
RULE-016ArchitectureDDD 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.

IDSeverityScopeOne-liner
RULE-015shouldStylefinal everywhere, use records for DTOs, Kotlin only for interfaces/config.
RULE-017shouldBuildPrefer Make targets (e.g., make all-build) over raw mvn or gradle commands.
RULE-018infoReferenceGround all answers and generated code against the canonical reference projects.

Released under the MIT License.