# paulomtts/xarch architecture

> Architecture diagram of the GitHub repository paulomtts/xarch, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/paulomtts/xarch
- Repository: https://github.com/paulomtts/xarch
- Video tour (about a minute): https://gitdiagram.com/paulomtts/xarch/video

## Overview

xarch is a profile-driven architecture checker and scaffolder. The principal workflow is to choose a profile, optionally create its project skeleton, then check application and test files against its layout, import rules, tiers, and guards; findings include fixes. `where` explains a path before it is written. Separate commands validate and explain profiles, while experimental review asks a decision model for advisory placement readings, with calibration and acceptance records. The graph emphasizes these product stages and the rule engine; many lower-level adapters and services are grouped by subsystem. Edges are limited to documented behavior or visible registration and calls; unsampled wiring is not inferred.

Main entry points: [`xarch/modules/review/application/services/reviewing.py`](https://github.com/paulomtts/xarch/blob/main/xarch/modules/review/application/services/reviewing.py) (Review service), [`xarch/cli/app.py`](https://github.com/paulomtts/xarch/blob/main/xarch/cli/app.py) (Command app), [`xarch/modules/rules/application/controller.py`](https://github.com/paulomtts/xarch/blob/main/xarch/modules/rules/application/controller.py) (Rules controller), [`xarch/cli/commands/check.py`](https://github.com/paulomtts/xarch/blob/main/xarch/cli/commands/check.py) (Check and where)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI entry"]
  node_cli["Command app<br/>[app.py]"]
  node_bootstrap["Runtime wiring<br/>[wiring.py]"]
  node_rules_cmd["Check and where<br/>[check.py]"]
  node_profile_cmd["Profile commands<br/>[profile.py]"]
  node_scaffold_cmd["Scaffold commands<br/>[scaffold.py]"]
  node_review_cmd["Review commands<br/>[review.py]"]
end

subgraph group_rules["Architecture checks"]
  node_rules_controller["Rules controller<br/>[controller.py]"]
  node_rule_services["Check services"]
  node_rule_engine["Rule engine<br/>[engine.py]"]
  node_source_model["Source model<br/>[source.py]"]
  node_violations["Finding catalogue<br/>[violations.py]"]
end

subgraph group_profiles["Profiles and scaffolding"]
  node_spec_controller["Profile controller<br/>[controller.py]"]
  node_profile_services["Profile services"]
  node_profile_values["Profile vocabulary<br/>[placement.py]"]
  node_scaffold_controller["Scaffold controller<br/>[controller.py]"]
  node_scaffold_service["Scaffolding service<br/>[scaffolding.py]"]
end

subgraph group_review["Advisory review"]
  node_review_controller["Review controller<br/>[controller.py]"]
  node_review_service["Review service<br/>[reviewing.py]"]
  node_review_logic["Review decisions"]
  node_review_answer["Answer handling<br/>[answers.py]"]
  node_review_questions["Question building<br/>[questions.py]"]
  node_review_sending["Model requests<br/>[sending.py]"]
  node_decision_port["Decision model port<br/>[decision_model.py]"]
  node_review_values["Review results<br/>[values.py]"]
end

node_user(("Engineer"))
node_external_model{{"Decision model"}}

node_user -->|"runs commands"| node_cli
node_bootstrap -->|"builds app"| node_cli
node_cli -->|"registers"| node_rules_cmd
node_cli -->|"registers"| node_profile_cmd
node_cli -->|"registers"| node_scaffold_cmd
node_cli -->|"registers"| node_review_cmd
node_rules_cmd -->|"invokes"| node_rules_controller
node_profile_cmd -->|"invokes"| node_spec_controller
node_scaffold_cmd -->|"invokes"| node_scaffold_controller
node_review_cmd -->|"invokes"| node_review_controller
node_rules_controller -->|"delegates"| node_rule_services
node_rule_engine -->|"emits findings"| node_violations
node_rule_services -.->|"evaluates rules"| node_rule_engine
node_rules_controller -->|"uses source types"| node_source_model
node_spec_controller -->|"delegates"| node_profile_services
node_profile_services -->|"uses vocabulary"| node_profile_values
node_scaffold_controller -->|"delegates"| node_scaffold_service
node_review_controller -->|"delegates"| node_review_service
node_review_service -->|"uses decisions"| node_review_logic
node_review_service -->|"reads cached answers"| node_review_answer
node_review_service -->|"builds questions"| node_review_questions
node_review_service -->|"prepares requests"| node_review_sending
node_review_sending -.->|"uses port"| node_decision_port
node_decision_port -.->|"requests judgment"| node_external_model
node_review_service -->|"returns readings"| node_review_values

click node_cli "https://github.com/paulomtts/xarch/blob/main/xarch/cli/app.py"
click node_bootstrap "https://github.com/paulomtts/xarch/blob/main/xarch/bootstrap/wiring.py"
click node_rules_cmd "https://github.com/paulomtts/xarch/blob/main/xarch/cli/commands/check.py"
click node_profile_cmd "https://github.com/paulomtts/xarch/blob/main/xarch/cli/commands/profile.py"
click node_scaffold_cmd "https://github.com/paulomtts/xarch/blob/main/xarch/cli/commands/scaffold.py"
click node_review_cmd "https://github.com/paulomtts/xarch/blob/main/xarch/cli/commands/review.py"
click node_rules_controller "https://github.com/paulomtts/xarch/blob/main/xarch/modules/rules/application/controller.py"
click node_rule_services "https://github.com/paulomtts/xarch/tree/main/xarch/modules/rules/application/services"
click node_rule_engine "https://github.com/paulomtts/xarch/blob/main/xarch/modules/rules/application/logic/engine.py"
click node_source_model "https://github.com/paulomtts/xarch/blob/main/xarch/kernel/source.py"
click node_violations "https://github.com/paulomtts/xarch/blob/main/xarch/kernel/violations.py"
click node_spec_controller "https://github.com/paulomtts/xarch/blob/main/xarch/modules/spec/application/controller.py"
click node_profile_services "https://github.com/paulomtts/xarch/tree/main/xarch/modules/spec/application/services"
click node_profile_values "https://github.com/paulomtts/xarch/blob/main/xarch/profile_values/placement.py"
click node_scaffold_controller "https://github.com/paulomtts/xarch/blob/main/xarch/modules/scaffold/application/controller.py"
click node_scaffold_service "https://github.com/paulomtts/xarch/blob/main/xarch/modules/scaffold/application/services/scaffolding.py"
click node_review_controller "https://github.com/paulomtts/xarch/blob/main/xarch/modules/review/application/controller.py"
click node_review_service "https://github.com/paulomtts/xarch/blob/main/xarch/modules/review/application/services/reviewing.py"
click node_review_logic "https://github.com/paulomtts/xarch/tree/main/xarch/modules/review/application/logic"
click node_review_answer "https://github.com/paulomtts/xarch/blob/main/xarch/modules/review/application/logic/answers.py"
click node_review_questions "https://github.com/paulomtts/xarch/blob/main/xarch/modules/review/application/logic/questions.py"
click node_review_sending "https://github.com/paulomtts/xarch/blob/main/xarch/modules/review/application/logic/sending.py"
click node_decision_port "https://github.com/paulomtts/xarch/blob/main/xarch/modules/review/application/ports/decision_model.py"
click node_review_values "https://github.com/paulomtts/xarch/blob/main/xarch/modules/review/domain/values.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_bootstrap,node_rules_cmd,node_profile_cmd,node_scaffold_cmd,node_review_cmd toneBlue
class node_rules_controller,node_rule_services,node_rule_engine,node_source_model,node_violations toneAmber
class node_spec_controller,node_profile_services,node_profile_values,node_scaffold_controller,node_scaffold_service toneMint
class node_review_controller,node_review_service,node_review_logic,node_review_answer,node_review_questions,node_review_sending,node_decision_port,node_review_values toneRose
class node_user,node_external_model toneIndigo
```

## Components

### CLI entry

- [Command app](https://github.com/paulomtts/xarch/blob/main/xarch/cli/app.py): `xarch/cli/app.py`
- [Runtime wiring](https://github.com/paulomtts/xarch/blob/main/xarch/bootstrap/wiring.py): `xarch/bootstrap/wiring.py`
- [Check and where](https://github.com/paulomtts/xarch/blob/main/xarch/cli/commands/check.py): `xarch/cli/commands/check.py`
- [Profile commands](https://github.com/paulomtts/xarch/blob/main/xarch/cli/commands/profile.py): `xarch/cli/commands/profile.py`
- [Scaffold commands](https://github.com/paulomtts/xarch/blob/main/xarch/cli/commands/scaffold.py): `xarch/cli/commands/scaffold.py`
- [Review commands](https://github.com/paulomtts/xarch/blob/main/xarch/cli/commands/review.py): `xarch/cli/commands/review.py`

### Architecture checks

- [Rules controller](https://github.com/paulomtts/xarch/blob/main/xarch/modules/rules/application/controller.py): `xarch/modules/rules/application/controller.py`
- [Check services](https://github.com/paulomtts/xarch/tree/main/xarch/modules/rules/application/services): `xarch/modules/rules/application/services`
- [Rule engine](https://github.com/paulomtts/xarch/blob/main/xarch/modules/rules/application/logic/engine.py): `xarch/modules/rules/application/logic/engine.py`
- [Source model](https://github.com/paulomtts/xarch/blob/main/xarch/kernel/source.py): `xarch/kernel/source.py`
- [Finding catalogue](https://github.com/paulomtts/xarch/blob/main/xarch/kernel/violations.py): `xarch/kernel/violations.py`

### Profiles and scaffolding

- [Profile controller](https://github.com/paulomtts/xarch/blob/main/xarch/modules/spec/application/controller.py): `xarch/modules/spec/application/controller.py`
- [Profile services](https://github.com/paulomtts/xarch/tree/main/xarch/modules/spec/application/services): `xarch/modules/spec/application/services`
- [Profile vocabulary](https://github.com/paulomtts/xarch/blob/main/xarch/profile_values/placement.py): `xarch/profile_values/placement.py`
- [Scaffold controller](https://github.com/paulomtts/xarch/blob/main/xarch/modules/scaffold/application/controller.py): `xarch/modules/scaffold/application/controller.py`
- [Scaffolding service](https://github.com/paulomtts/xarch/blob/main/xarch/modules/scaffold/application/services/scaffolding.py): `xarch/modules/scaffold/application/services/scaffolding.py`

### Advisory review

- [Review controller](https://github.com/paulomtts/xarch/blob/main/xarch/modules/review/application/controller.py): `xarch/modules/review/application/controller.py`
- [Review service](https://github.com/paulomtts/xarch/blob/main/xarch/modules/review/application/services/reviewing.py): `xarch/modules/review/application/services/reviewing.py`
- [Review decisions](https://github.com/paulomtts/xarch/tree/main/xarch/modules/review/application/logic): `xarch/modules/review/application/logic`
- [Answer handling](https://github.com/paulomtts/xarch/blob/main/xarch/modules/review/application/logic/answers.py): `xarch/modules/review/application/logic/answers.py`
- [Question building](https://github.com/paulomtts/xarch/blob/main/xarch/modules/review/application/logic/questions.py): `xarch/modules/review/application/logic/questions.py`
- [Model requests](https://github.com/paulomtts/xarch/blob/main/xarch/modules/review/application/logic/sending.py): `xarch/modules/review/application/logic/sending.py`
- [Decision model port](https://github.com/paulomtts/xarch/blob/main/xarch/modules/review/application/ports/decision_model.py): `xarch/modules/review/application/ports/decision_model.py`
- [Review results](https://github.com/paulomtts/xarch/blob/main/xarch/modules/review/domain/values.py): `xarch/modules/review/domain/values.py`

### Other components

- **Engineer**
- **Decision model**

## Connections

- Engineer → Command app: runs commands (evidence: `README.md`)
- Runtime wiring → Command app: builds app (evidence: `xarch/bootstrap/app.py`)
- Command app → Check and where: registers (evidence: `xarch/cli/app.py`)
- Command app → Profile commands: registers (evidence: `xarch/cli/app.py`)
- Command app → Scaffold commands: registers (evidence: `xarch/cli/app.py`)
- Command app → Review commands: registers (evidence: `xarch/cli/app.py`)
- Check and where → Rules controller: invokes (evidence: `xarch/cli/app.py`)
- Profile commands → Profile controller: invokes (evidence: `xarch/cli/app.py`)
- Scaffold commands → Scaffold controller: invokes (evidence: `xarch/cli/app.py`)
- Review commands → Review controller: invokes (evidence: `xarch/cli/app.py`)
- Rules controller → Check services: delegates (evidence: `xarch/modules/rules/application/controller.py`)
- Rule engine → Finding catalogue: emits findings (evidence: `xarch/modules/rules/application/logic/engine.py`)
- Check services → Rule engine: evaluates rules (evidence: `xarch/modules/rules/application/services/asking.py`)
- Rules controller → Source model: uses source types (evidence: `xarch/modules/rules/application/controller.py`)
- Profile controller → Profile services: delegates (evidence: `xarch/modules/spec/application/controller.py`)
- Profile services → Profile vocabulary: uses vocabulary
- Scaffold controller → Scaffolding service: delegates (evidence: `xarch/modules/scaffold/application/controller.py`)
- Review controller → Review service: delegates (evidence: `xarch/modules/review/application/controller.py`)
- Review service → Review decisions: uses decisions (evidence: `xarch/modules/review/application/services/reviewing.py`)
- Review service → Answer handling: reads cached answers (evidence: `xarch/modules/review/application/services/reviewing.py`)
- Review service → Question building: builds questions (evidence: `xarch/modules/review/application/services/reviewing.py`)
- Review service → Model requests: prepares requests (evidence: `xarch/modules/review/application/services/reviewing.py`)
- Model requests → Decision model port: uses port
- Decision model port → Decision model: requests judgment
- Review service → Review results: returns readings (evidence: `xarch/modules/review/application/services/reviewing.py`)
