# tomszenessy/ai_template architecture

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

- Interactive diagram: https://gitdiagram.com/tomszenessy/ai_template
- Repository: https://github.com/tomszenessy/ai_template

## Overview

AI_TEMPLATE is a Python-based agent-project toolkit: it initializes or adopts a repository, then supplies session guidance, capability and documentation upkeep, deterministic checks, and review workflows. The main user path is invoking a repository command, receiving a session brief or action, and using the kit’s navigation, gates, and review tools to keep project work verifiable. The README documents additional capabilities beyond the excerpts; edges below are limited to explicit README statements or source-index references, so some runtime wiring is not shown.

Main entry points: [`tools/kit/commands.py`](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/commands.py) (Command handlers), [`tools/kit/checkrun.py`](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/checkrun.py) (Check runner), [`tools/kit/registry.py`](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/registry.py) (Capability registry), [`tools/kit/core.py`](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/core.py) (Manifest and safety primitives)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Command and session"]
  node_repoctl["CLI entry<br/>[repoctl.py]"]
  node_session["Session lifecycle<br/>[session.py]"]
  node_commands["Command handlers<br/>[commands.py]"]
end

subgraph group_planning["Project planning"]
  node_product["Product workflow<br/>[product.py]"]
  node_guided["Guided kickoff<br/>[guided.py]"]
  node_issues["Issue workflow<br/>[issues.py]"]
end

subgraph group_capabilities["Capabilities and docs"]
  node_registry["Capability registry<br/>[registry.py]"]
  node_scaffold["Capability creation<br/>[scaffold.py]"]
  node_skills["Skill provenance<br/>[skills.py]"]
  node_docsync["Docs synchronization<br/>[docsync.py]"]
  node_derive["Generated artifacts<br/>[derive.py]"]
end

subgraph group_quality["Checks and review"]
  node_checkrun["Check runner<br/>[checkrun.py]"]
  node_checks["Repository checks<br/>[checks.py]"]
  node_risk["Change risk<br/>[risk.py]"]
  node_uireview["UI review<br/>[uireview.py]"]
  node_evals["Agent evaluations<br/>[evals.py]"]
  node_trial["Fresh-agent trial<br/>[trial.py]"]
  node_garden["Repository upkeep<br/>[garden.py]"]
end

subgraph group_repository["Repository operations"]
  node_navigate["Repository navigation<br/>[navigate.py]"]
  node_semantic["Semantic search<br/>[semantic.py]"]
  node_structure["Project structure<br/>[structure.py]"]
  node_adopt["Kit adoption<br/>[adopt.py]"]
  node_bootstrap["Project bootstrap<br/>[bootstrap.py]"]
  node_kitupdate["Kit updates<br/>[kitupdate.py]"]
  node_core["Manifest and safety primitives<br/>[core.py]"]
  node_config["Kit configuration<br/>[config.py]"]
  node_gitinfo["Git queries<br/>[gitinfo.py]"]
  node_github["GitHub adapter<br/>[github.py]"]
end

node_developer(("Developer or agent"))

node_developer -->|"runs commands"| node_repoctl
node_repoctl -->|"dispatches hooks"| node_session
node_session -->|"builds brief"| node_navigate
node_session -->|"runs gates"| node_checkrun
node_session -->|"reads next step"| node_product
node_commands -->|"runs checks"| node_checkrun
node_commands -->|"handles planning"| node_product
node_commands -->|"handles search"| node_navigate
node_commands -->|"starts review"| node_uireview
node_commands -->|"starts similarity"| node_semantic
node_commands -->|"creates capabilities"| node_scaffold
node_product -->|"validates surfaces"| node_structure
node_product -->|"uses review state"| node_uireview
node_registry -->|"registers resources"| node_skills
node_docsync -->|"reads capabilities"| node_registry
node_derive -->|"renders declarations"| node_registry
node_derive -->|"generates index"| node_docsync
node_checkrun -->|"checks declarations"| node_registry
node_checkrun -->|"loads project"| node_core
node_checks -->|"checks doc bindings"| node_docsync
node_checks -->|"checks GitHub state"| node_github
node_navigate -->|"finds capabilities"| node_registry
node_semantic -->|"uses indexed context"| node_navigate
node_adopt -->|"shares kit lock"| node_kitupdate
node_bootstrap -->|"validates project"| node_structure
node_kitupdate -->|"refreshes outputs"| node_derive
node_evals -->|"loads project"| node_core
node_trial -->|"runs evaluation"| node_evals
node_garden -->|"runs checks"| node_checkrun
node_risk -->|"reads project"| node_core
node_uireview -->|"reads settings"| node_config
node_core -->|"queries repository"| node_gitinfo
node_github -->|"loads configuration"| node_core
node_issues -->|"uses GitHub adapter"| node_github

click node_repoctl "https://github.com/tomszenessy/ai_template/blob/main/tools/repoctl.py"
click node_session "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/session.py"
click node_commands "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/commands.py"
click node_product "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/product.py"
click node_guided "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/guided.py"
click node_issues "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/issues.py"
click node_registry "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/registry.py"
click node_scaffold "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/scaffold.py"
click node_skills "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/skills.py"
click node_docsync "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/docsync.py"
click node_derive "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/derive.py"
click node_navigate "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/navigate.py"
click node_semantic "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/semantic.py"
click node_structure "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/structure.py"
click node_adopt "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/adopt.py"
click node_bootstrap "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/bootstrap.py"
click node_kitupdate "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/kitupdate.py"
click node_checkrun "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/checkrun.py"
click node_checks "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/checks.py"
click node_risk "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/risk.py"
click node_uireview "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/uireview.py"
click node_evals "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/evals.py"
click node_trial "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/trial.py"
click node_garden "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/garden.py"
click node_core "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/core.py"
click node_config "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/config.py"
click node_gitinfo "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/gitinfo.py"
click node_github "https://github.com/tomszenessy/ai_template/blob/main/tools/kit/github.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_repoctl,node_session,node_commands toneBlue
class node_product,node_guided,node_issues toneAmber
class node_registry,node_scaffold,node_skills,node_docsync,node_derive toneMint
class node_checkrun,node_checks,node_risk,node_uireview,node_evals,node_trial,node_garden toneRose
class node_navigate,node_semantic,node_structure,node_adopt,node_bootstrap,node_kitupdate,node_core,node_config,node_gitinfo,node_github,node_developer toneIndigo
```

## Components

### Command and session

- [CLI entry](https://github.com/tomszenessy/ai_template/blob/main/tools/repoctl.py): `tools/repoctl.py`
- [Session lifecycle](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/session.py): `tools/kit/session.py`
- [Command handlers](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/commands.py): `tools/kit/commands.py`

### Project planning

- [Product workflow](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/product.py): `tools/kit/product.py`
- [Guided kickoff](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/guided.py): `tools/kit/guided.py`
- [Issue workflow](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/issues.py): `tools/kit/issues.py`

### Capabilities and docs

- [Capability registry](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/registry.py): `tools/kit/registry.py`
- [Capability creation](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/scaffold.py): `tools/kit/scaffold.py`
- [Skill provenance](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/skills.py): `tools/kit/skills.py`
- [Docs synchronization](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/docsync.py): `tools/kit/docsync.py`
- [Generated artifacts](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/derive.py): `tools/kit/derive.py`

### Checks and review

- [Check runner](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/checkrun.py): `tools/kit/checkrun.py`
- [Repository checks](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/checks.py): `tools/kit/checks.py`
- [Change risk](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/risk.py): `tools/kit/risk.py`
- [UI review](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/uireview.py): `tools/kit/uireview.py`
- [Agent evaluations](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/evals.py): `tools/kit/evals.py`
- [Fresh-agent trial](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/trial.py): `tools/kit/trial.py`
- [Repository upkeep](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/garden.py): `tools/kit/garden.py`

### Repository operations

- [Repository navigation](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/navigate.py): `tools/kit/navigate.py`
- [Semantic search](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/semantic.py): `tools/kit/semantic.py`
- [Project structure](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/structure.py): `tools/kit/structure.py`
- [Kit adoption](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/adopt.py): `tools/kit/adopt.py`
- [Project bootstrap](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/bootstrap.py): `tools/kit/bootstrap.py`
- [Kit updates](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/kitupdate.py): `tools/kit/kitupdate.py`
- [Manifest and safety primitives](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/core.py): `tools/kit/core.py`
- [Kit configuration](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/config.py): `tools/kit/config.py`
- [Git queries](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/gitinfo.py): `tools/kit/gitinfo.py`
- [GitHub adapter](https://github.com/tomszenessy/ai_template/blob/main/tools/kit/github.py): `tools/kit/github.py`

### Other components

- **Developer or agent**

## Connections

- Developer or agent → CLI entry: runs commands (evidence: `README.md`)
- CLI entry → Session lifecycle: dispatches hooks (evidence: `tools/repoctl.py`)
- Session lifecycle → Repository navigation: builds brief (evidence: `tools/kit/session.py`)
- Session lifecycle → Check runner: runs gates (evidence: `tools/kit/session.py`)
- Session lifecycle → Product workflow: reads next step (evidence: `tools/kit/session.py`)
- Command handlers → Check runner: runs checks (evidence: `tools/kit/commands.py`)
- Command handlers → Product workflow: handles planning (evidence: `tools/kit/commands.py`)
- Command handlers → Repository navigation: handles search (evidence: `tools/kit/commands.py`)
- Command handlers → UI review: starts review (evidence: `tools/kit/commands.py`)
- Command handlers → Semantic search: starts similarity (evidence: `tools/kit/commands.py`)
- Command handlers → Capability creation: creates capabilities (evidence: `tools/kit/commands.py`)
- Product workflow → Project structure: validates surfaces (evidence: `tools/kit/product.py`)
- Product workflow → UI review: uses review state (evidence: `tools/kit/product.py`)
- Capability registry → Skill provenance: registers resources (evidence: `tools/kit/skills.py`)
- Docs synchronization → Capability registry: reads capabilities (evidence: `tools/kit/docsync.py`)
- Generated artifacts → Capability registry: renders declarations (evidence: `tools/kit/derive.py`)
- Generated artifacts → Docs synchronization: generates index (evidence: `tools/kit/derive.py`)
- Check runner → Capability registry: checks declarations (evidence: `tools/kit/checkrun.py`)
- Check runner → Manifest and safety primitives: loads project (evidence: `tools/kit/checkrun.py`)
- Repository checks → Docs synchronization: checks doc bindings (evidence: `tools/kit/checks.py`)
- Repository checks → GitHub adapter: checks GitHub state (evidence: `tools/kit/checks.py`)
- Repository navigation → Capability registry: finds capabilities (evidence: `tools/kit/navigate.py`)
- Semantic search → Repository navigation: uses indexed context (evidence: `tools/kit/semantic.py`)
- Kit adoption → Kit updates: shares kit lock (evidence: `tools/kit/adopt.py`)
- Project bootstrap → Project structure: validates project (evidence: `tools/kit/bootstrap.py`)
- Kit updates → Generated artifacts: refreshes outputs (evidence: `tools/kit/kitupdate.py`)
- Agent evaluations → Manifest and safety primitives: loads project (evidence: `tools/kit/evals.py`)
- Fresh-agent trial → Agent evaluations: runs evaluation (evidence: `tools/kit/trial.py`)
- Repository upkeep → Check runner: runs checks (evidence: `tools/kit/garden.py`)
- Change risk → Manifest and safety primitives: reads project (evidence: `tools/kit/risk.py`)
- UI review → Kit configuration: reads settings (evidence: `tools/kit/uireview.py`)
- Manifest and safety primitives → Git queries: queries repository (evidence: `tools/kit/core.py`)
- GitHub adapter → Manifest and safety primitives: loads configuration (evidence: `tools/kit/github.py`)
- Issue workflow → GitHub adapter: uses GitHub adapter (evidence: `tools/kit/issues.py`)
