ADR-075: Architecture State Forensic Diagnostic & Baseline Acceptance
Status
Accepted
Date
2026-09-19
Context
Brownfield and evolving codebases often suffer from architectural drift—a gap between documented architectural intent (in READMEs, wikis, or historical ADRs) and actual runtime implementation.
Existing discovery mechanisms in CAS captured high-level conversational summaries and text documents, but lacked fine-grained empirical reconstruction directly from source manifests, workflow configurations, AST symbol graphs, and import dependencies.
Furthermore, automatic mutation of the validated baseline risked poisoning architectural truth with speculative or contradictory representations.
Decision
We adopt the Architecture State Forensic Diagnostic (CAS-ARCH-STATE v0.1) with the following core architectural decisions:
- Four-Pillar Architecture State Package:
Reconstruction outputs are partitioned into a dedicated structure under
knowledge/projects/<project>/architecture-state/: model/: intermediatearchitecture-state.yamland partitioned YAML files (systems.yaml,containers.yaml,components.yaml,dependencies.yaml,flows.yaml,controls.yaml,evidence.yaml).views/: 5 C4-inspired Markdown views (system-context.md,containers.md,components.md,architecture-flow.md,governance-controls.md).diagrams/: Mermaid.mmddiagrams for system context and container boundaries.diagnostic/: Forensic reports (evidence-report.md,contradictions.md,unknowns.md,coverage.md).-
ARCHITECTURE.md: Consolidated single-file architectural digest. -
Zero Uninvited Root Writes:
ARCHITECTURE.mdis strictly contained within the knowledge layer by default; it is only mirrored to<target-dir>/ARCHITECTURE.mdwhen the explicit--publish-rootflag is supplied. -
Standard-Library Python AST Extraction: For Python targets, extraction utilizes Python's built-in
astmodule to guarantee zero heavy binary dependencies. Polyglot targets utilize regex and manifest parsers. -
Non-Blocking Contradiction Auditing: Discrepancies between documented intent and empirical code do not abort execution; conflicting nodes are flagged with
status: contradictoryandconfidence: low, and cataloged incontradictions.md. -
Human-in-the-Loop Baseline Promotion Gate: Discovered states remain in
status: discovereduntil an architect explicitly promotes the state viauv run cas state baseline promote --project <project>, freezing a point-in-time snapshot underknowledge/projects/<project>/baseline/.
Consequences
Positive
- Reconstructs accurate, evidence-backed architectural views directly from code repositories.
- Detects ghost services and shadow components without halting diagnostic pipelines.
- Preserves governance baseline integrity through explicit human review gates.
- Emits clean, version-controllable Markdown and Mermaid artifacts.
Negative
- Initial v0.1 AST extraction depth is tailored to Python standard library; other languages require AST grammar additions in future iterations.