# soumalyasaha/breach architecture

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

- Interactive diagram: https://gitdiagram.com/soumalyasaha/breach
- Repository: https://github.com/soumalyasaha/breach

## Overview

Breach is an adversarial mathematics agent: it formalizes an informal claim, searches for a counterexample with deterministic solvers, and reports a bounded verdict or a classified unknown. Users enter claims through the CLI or Streamlit interface; the engine translates and checks them, then the interface presents the result. Additional capabilities include proof-step challenges and failure autopsies, blackboard image transcription, citations, cube-and-conquer search, and report export. Edges reflect excerpts, indexed references, or README documentation; unsampled subsystems are included where documented, without inferring unshown calls.

Main entry points: [`src/cli.py`](https://github.com/soumalyasaha/breach/blob/main/src/cli.py) (CLI), [`src/web.py`](https://github.com/soumalyasaha/breach/blob/main/src/web.py) (Streamlit app), [`src/engine.py`](https://github.com/soumalyasaha/breach/blob/main/src/engine.py) (Claim engine), [`src/argue.py`](https://github.com/soumalyasaha/breach/blob/main/src/argue.py) (Challenges and autopsy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_cli["CLI<br/>[cli.py]"]
  node_web["Streamlit app<br/>[web.py]"]
  node_vision["Drawing transcription<br/>[vision.py]"]
  node_examples["Example gallery<br/>[examples.py]"]
  node_clipboard["Clipboard support<br/>[clipboard.py]"]
  node_symbols["Math symbols<br/>[symbols.py]"]
  node_theme["Shared UI theme<br/>[ui_theme.py]"]
  node_banner["Banner rendering<br/>[banner.py]"]
end

subgraph group_verification["Verification workflow"]
  node_state["Proof state<br/>[state.py]"]
  node_engine["Claim engine<br/>[engine.py]"]
  node_llm["LLM providers<br/>[llm_client.py]"]
  node_orchestrator["Worker dispatch<br/>[orchestrator.py]"]
  node_cases["Case search<br/>[cases.py]"]
  node_powers["Power utilities<br/>[powers.py]"]
end

subgraph group_collaboration["Challenges and context"]
  node_memory[("Proof memory<br/>[memory.py]")]
  node_argue["Challenges and autopsy<br/>[argue.py]"]
end

subgraph group_outputs["Results and utilities"]
  node_citations["Citation lookup<br/>[citations.py]"]
  node_export["Report export<br/>[export.py]"]
  node_paths["Session and output paths<br/>[paths.py]"]
end

node_user(("Mathematics user"))
node_z3["Z3 solver"]
node_sympy["SymPy solver"]

node_user -->|"submits claims"| node_cli
node_user -->|"submits claims"| node_web
node_cli -->|"checks claims"| node_engine
node_web -->|"checks claims"| node_engine
node_engine -->|"translates claims"| node_llm
node_engine -->|"solves with"| node_z3
node_engine -->|"solves with"| node_sympy
node_engine -->|"builds result"| node_state
node_engine -->|"uses utilities"| node_powers
node_orchestrator -->|"runs solver"| node_engine
node_orchestrator -->|"stores worker results"| node_memory
node_cli -.->|"dispatches search workers"| node_orchestrator
node_cli -.->|"runs case search"| node_cases
node_argue -->|"rechecks constraints"| node_engine
node_argue -->|"answers challenges"| node_llm
node_argue -->|"updates steps"| node_state
node_argue -.->|"uses shared memory"| node_memory
node_web -->|"handles challenges"| node_argue
node_web -->|"transcribes drawings"| node_vision
node_web -->|"looks up citations"| node_citations
node_cli -->|"looks up citations"| node_citations
node_cli -->|"loads examples"| node_examples
node_cli -->|"exports reports"| node_export
node_web -->|"exports reports"| node_export
node_cli -->|"applies shortcuts"| node_symbols
node_web -->|"applies shortcuts"| node_symbols
node_cli -.->|"uses clipboard"| node_clipboard
node_cli -->|"renders interface"| node_theme
node_web -->|"renders interface"| node_theme
node_banner -->|"uses styles"| node_theme
node_export -->|"renders session"| node_state
node_export -->|"writes output"| node_paths
node_cli -->|"resolves sessions"| node_paths
node_web -->|"syncs session"| node_paths

click node_cli "https://github.com/soumalyasaha/breach/blob/main/src/cli.py"
click node_web "https://github.com/soumalyasaha/breach/blob/main/src/web.py"
click node_state "https://github.com/soumalyasaha/breach/blob/main/src/state.py"
click node_engine "https://github.com/soumalyasaha/breach/blob/main/src/engine.py"
click node_llm "https://github.com/soumalyasaha/breach/blob/main/src/llm_client.py"
click node_memory "https://github.com/soumalyasaha/breach/blob/main/src/memory.py"
click node_orchestrator "https://github.com/soumalyasaha/breach/blob/main/src/orchestrator.py"
click node_argue "https://github.com/soumalyasaha/breach/blob/main/src/argue.py"
click node_vision "https://github.com/soumalyasaha/breach/blob/main/src/vision.py"
click node_citations "https://github.com/soumalyasaha/breach/blob/main/src/citations.py"
click node_cases "https://github.com/soumalyasaha/breach/blob/main/src/cases.py"
click node_examples "https://github.com/soumalyasaha/breach/blob/main/src/examples.py"
click node_export "https://github.com/soumalyasaha/breach/blob/main/src/export.py"
click node_clipboard "https://github.com/soumalyasaha/breach/blob/main/src/clipboard.py"
click node_powers "https://github.com/soumalyasaha/breach/blob/main/src/powers.py"
click node_symbols "https://github.com/soumalyasaha/breach/blob/main/src/symbols.py"
click node_theme "https://github.com/soumalyasaha/breach/blob/main/src/ui_theme.py"
click node_banner "https://github.com/soumalyasaha/breach/blob/main/src/banner.py"
click node_paths "https://github.com/soumalyasaha/breach/blob/main/src/paths.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_web,node_vision,node_examples,node_clipboard,node_symbols,node_theme,node_banner,node_user toneBlue
class node_state,node_engine,node_llm,node_orchestrator,node_cases,node_powers toneAmber
class node_memory,node_argue toneMint
class node_citations,node_export,node_paths toneRose
class node_z3,node_sympy toneIndigo
```

## Components

### User interfaces

- [CLI](https://github.com/soumalyasaha/breach/blob/main/src/cli.py): `src/cli.py`
- [Streamlit app](https://github.com/soumalyasaha/breach/blob/main/src/web.py): `src/web.py`
- [Drawing transcription](https://github.com/soumalyasaha/breach/blob/main/src/vision.py): `src/vision.py`
- [Example gallery](https://github.com/soumalyasaha/breach/blob/main/src/examples.py): `src/examples.py`
- [Clipboard support](https://github.com/soumalyasaha/breach/blob/main/src/clipboard.py): `src/clipboard.py`
- [Math symbols](https://github.com/soumalyasaha/breach/blob/main/src/symbols.py): `src/symbols.py`
- [Shared UI theme](https://github.com/soumalyasaha/breach/blob/main/src/ui_theme.py): `src/ui_theme.py`
- [Banner rendering](https://github.com/soumalyasaha/breach/blob/main/src/banner.py): `src/banner.py`

### Verification workflow

- [Proof state](https://github.com/soumalyasaha/breach/blob/main/src/state.py): `src/state.py`
- [Claim engine](https://github.com/soumalyasaha/breach/blob/main/src/engine.py): `src/engine.py`
- [LLM providers](https://github.com/soumalyasaha/breach/blob/main/src/llm_client.py): `src/llm_client.py`
- [Worker dispatch](https://github.com/soumalyasaha/breach/blob/main/src/orchestrator.py): `src/orchestrator.py`
- [Case search](https://github.com/soumalyasaha/breach/blob/main/src/cases.py): `src/cases.py`
- [Power utilities](https://github.com/soumalyasaha/breach/blob/main/src/powers.py): `src/powers.py`

### Challenges and context

- [Proof memory](https://github.com/soumalyasaha/breach/blob/main/src/memory.py): `src/memory.py`
- [Challenges and autopsy](https://github.com/soumalyasaha/breach/blob/main/src/argue.py): `src/argue.py`

### Results and utilities

- [Citation lookup](https://github.com/soumalyasaha/breach/blob/main/src/citations.py): `src/citations.py`
- [Report export](https://github.com/soumalyasaha/breach/blob/main/src/export.py): `src/export.py`
- [Session and output paths](https://github.com/soumalyasaha/breach/blob/main/src/paths.py): `src/paths.py`

### Other components

- **Mathematics user**
- **Z3 solver**
- **SymPy solver**

## Connections

- Mathematics user → CLI: submits claims (evidence: `README.md`)
- Mathematics user → Streamlit app: submits claims (evidence: `README.md`)
- CLI → Claim engine: checks claims (evidence: `src/cli.py`)
- Streamlit app → Claim engine: checks claims (evidence: `src/web.py`)
- Claim engine → LLM providers: translates claims (evidence: `src/engine.py`)
- Claim engine → Z3 solver: solves with (evidence: `README.md`)
- Claim engine → SymPy solver: solves with (evidence: `README.md`)
- Claim engine → Proof state: builds result (evidence: `src/engine.py`)
- Claim engine → Power utilities: uses utilities (evidence: `src/engine.py`)
- Worker dispatch → Claim engine: runs solver (evidence: `src/orchestrator.py`)
- Worker dispatch → Proof memory: stores worker results (evidence: `src/orchestrator.py`)
- CLI → Worker dispatch: dispatches search workers
- CLI → Case search: runs case search (evidence: `src/cli.py`)
- Challenges and autopsy → Claim engine: rechecks constraints (evidence: `src/argue.py`)
- Challenges and autopsy → LLM providers: answers challenges (evidence: `src/argue.py`)
- Challenges and autopsy → Proof state: updates steps (evidence: `src/argue.py`)
- Challenges and autopsy → Proof memory: uses shared memory (evidence: `src/argue.py`)
- Streamlit app → Challenges and autopsy: handles challenges (evidence: `src/web.py`)
- Streamlit app → Drawing transcription: transcribes drawings (evidence: `src/web.py`)
- Streamlit app → Citation lookup: looks up citations (evidence: `src/web.py`)
- CLI → Citation lookup: looks up citations (evidence: `src/cli.py`)
- CLI → Example gallery: loads examples (evidence: `src/cli.py`)
- CLI → Report export: exports reports (evidence: `src/cli.py`)
- Streamlit app → Report export: exports reports (evidence: `src/web.py`)
- CLI → Math symbols: applies shortcuts (evidence: `src/cli.py`)
- Streamlit app → Math symbols: applies shortcuts (evidence: `src/web.py`)
- CLI → Clipboard support: uses clipboard (evidence: `src/cli.py`)
- CLI → Shared UI theme: renders interface (evidence: `src/cli.py`)
- Streamlit app → Shared UI theme: renders interface (evidence: `src/web.py`)
- Banner rendering → Shared UI theme: uses styles (evidence: `src/banner.py`)
- Report export → Proof state: renders session (evidence: `src/export.py`)
- Report export → Session and output paths: writes output (evidence: `src/export.py`)
- CLI → Session and output paths: resolves sessions (evidence: `src/cli.py`)
- Streamlit app → Session and output paths: syncs session (evidence: `src/web.py`)
