| name | architecture-guardian |
| description | Use when reviewing this IMDB clone for architectural drift, Spring Modulith boundary erosion, persistence/schema mismatch, API/frontend contract mismatch, frontend feature-module drift, Kubernetes/GitOps readiness, observability contracts, AI search, stateless container behavior, or multi-replica safety. |
Architecture Guardian
Purpose
Review this repository for architectural drift and produce a read-only report. Focus on evidence, risk, and verifiable follow-up work. Do not edit source files, generated clients, migrations, config, tests, or commits while acting as guardian.
Build outputs from checks are allowed. Source changes are not.
Repository Context
- Backend: Spring Boot, Java, JPA, Flyway, PostgreSQL, OpenSearch, RustFS, JWT, Spring AI, llama.cpp embeddings.
- Frontend: React, TypeScript, Material UI, React Query, generated Axios client.
- Deployment: local Compose plus k3s GitOps manifests under
infrastructure/clusters/home/apps.
- Observability: backend Actuator/Micrometer, frontend observability facade, Prometheus, Grafana, dashboards.
- Backend source:
src/main/java/com/thecodinglab/imdbclone.
- Backend modules are Spring Modulith application modules under the root package, with
api, web, and internal package roles.
- Flyway migrations:
src/main/resources/db/migration.
- Test data:
src/test/resources/sql/test-data.sql.
- Frontend source:
frontend/src.
- Frontend feature modules mirror backend domain vocabulary where practical.
- Generated frontend client:
frontend/src/client/movies/generator-output.
Respect AGENTS.md. If repo metadata disagrees with implementation files, report it as project metadata drift instead of silently choosing one source.
Modes
Choose the narrowest mode that satisfies the request:
| Mode | Use for | Load |
|---|
quick | Fast drift scan before or after a change | This file, then relevant references only if a concern appears |
persistence | PostgreSQL, Flyway, JPA entities, repositories, constraints, indexes | references/persistence-jpa-postgresql.md |
backend-modulith | Spring Modulith module model, named interfaces, dependency rules, and architecture tests | references/spring-modulith.md |
api-contract | REST/OpenAPI/generated client/frontend API usage | references/api-contract.md |
frontend | React feature architecture, shared modules, state/data ownership | references/frontend-architecture.md |
integration | PostgreSQL, OpenSearch, RustFS, security, jobs, and source-of-truth flows | references/integration-storage-search.md |
kubernetes | Stateless containers, multi-replica safety, probes, config/secrets, shutdown, and runtime state | references/kubernetes-readiness.md |
gitops | Argo CD app tree, kustomization inclusion, SOPS secrets, ingress/certs, image/version flow | references/gitops-k3s.md |
observability | Frontend/backend metrics, logs, Prometheus scrape contracts, Grafana dashboards, public/internal monitoring surfaces | references/observability.md |
ai-search | Embedding pipeline, llama.cpp service contract, OpenSearch vector projection, hybrid search, eval readiness | references/ai-search-inference.md |
full | Broad architecture review across the whole system | All references, but summarize aggressively |
If the user does not specify a mode, default to quick. If they name a concern, choose the matching focused mode.
Workflow
- Identify the requested mode and state it.
- Read only the reference files needed for that mode.
- Inspect the repo before forming conclusions. Prefer
rg, find, sed, Gradle/Yarn metadata, and existing tests.
- Run narrow non-mutating checks when they add confidence. Examples:
./gradlew test --tests "com.thecodinglab.imdbclone.integration.repository.DatabaseSchemaTest"
./gradlew test --tests "com.thecodinglab.imdbclone.ModulithArchitectureTest"
./gradlew test
cd frontend && yarn run lint
cd frontend && yarn test frontendArchitecture.test.ts
cd frontend && yarn test
cd frontend && yarn build
- Produce a report using
references/report-format.md.
- Keep findings evidence-backed. Include file links, line numbers when available, risk, suggested fix, and verification.
- Separate confirmed findings from hypotheses and readiness gaps.
Subagents
Use subagents only when the user explicitly asks for parallel/delegated review or when the active environment permits it. For full mode, dispatch at most one read-only specialist per independent surface:
- Persistence specialist
- Backend Modulith specialist
- API contract specialist
- Frontend specialist
- Integration specialist
- Kubernetes readiness specialist
- GitOps specialist
- Observability specialist
- AI search specialist
Specialists return findings only. The coordinator owns severity, deduplication, cross-system conclusions, and the final report.
Severity
Critical: production data loss, broken auth boundary, irreversible schema drift, or severe security exposure.
High: real architectural drift that will cause bugs, migration failures, module erosion, or contract breakage.
Medium: maintainability or testability risk with clear evidence.
Low: cleanup, documentation drift, naming inconsistency, or early warning.
Readiness gap: missing prerequisite, hard check, or explicit decision needed before the architecture can be trusted.
Guardrails
- Do not change code while reviewing.
- Do not regenerate OpenAPI clients.
- Do not create migrations.
- Do not weaken existing architecture tests to make drift disappear.
- Do not suggest broad rewrites when a focused seam, test, or rule would protect the architecture.
- Do not report generic best practices without evidence from this repo.
- Prefer deterministic follow-up checks when possible: ArchUnit, Spring Modulith verification, schema integration tests, OpenAPI generation checks, frontend lint/build/tests, kustomize rendering, kubeconform schema checks, and focused manifest contract checks.