# vahidkaargar/jade-decision-governance architecture

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

- Interactive diagram: https://gitdiagram.com/vahidkaargar/jade-decision-governance
- Repository: https://github.com/vahidkaargar/jade-decision-governance

## Overview

JADE is a Python runtime that governs decisions and side effects for Claude Code: it evaluates and journals Jev calls, classifies tool risk, and can require a human-issued permit before risky execution. Its broader product includes outcome tracking and an offline measurement/improvement loop, plus human-operated wiring and operational checks. The README documents the user workflow and safety boundaries; source excerpts and the SOURCE INDEX support several internal links. Unsampled modules are represented only where the README or tree establishes a meaningful capability.

Main entry points: [`jade/ask.py`](https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/ask.py) (Decision request), [`jade/hooks.py`](https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/hooks.py) (Claude hooks), [`jade/ledger.py`](https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/ledger.py) (Event ledger), [`jade/cli.py`](https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/cli.py) (JADE CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_integration["Claude integration"]
  node_cli["JADE CLI<br/>[cli.py]"]
  node_setup["Harness setup<br/>[setup.py]"]
  node_hooks["Claude hooks<br/>[hooks.py]"]
end

subgraph group_decision["Decision runtime"]
  node_proxy["Jev proxy<br/>[proxy.py]"]
  node_ask["Decision request<br/>[ask.py]"]
  node_adapter["Provider adapter<br/>[adapter.py]"]
  node_questions["Question registry<br/>[questions.py]"]
  node_routing["Question routing<br/>[route.py]"]
  node_redact["Text redaction<br/>[redact.py]"]
end

subgraph group_governance["Safety and state"]
  node_policy["Risk policy<br/>[policy.py]"]
  node_permits["Human permits<br/>[permits.py]"]
  node_decisions["Decision records<br/>[decide.py]"]
  node_state["Decision lifecycle<br/>[state_machine.py]"]
  node_ledger[("Event ledger<br/>[ledger.py]")]
end

subgraph group_learning["Measurement and operations"]
  node_evaluation["Labels and metrics<br/>[evals.py]"]
  node_improvement["Offline improvement<br/>[improve.py]"]
  node_operations["Governance operations<br/>[ops.py]"]
  node_readouts["Ledger readouts<br/>[readouts.py]"]
end

node_owner(("Human owner"))
node_claude(("Claude Code"))
node_provider{{"OpenRouter / Jev"}}

node_owner -->|"wires manually"| node_setup
node_setup -->|"installs hooks"| node_claude
node_claude -->|"dispatches events"| node_hooks
node_owner -->|"runs commands"| node_cli
node_cli -->|"requests evaluation"| node_ask
node_hooks -->|"classifies tool risk"| node_policy
node_hooks -->|"checks approval"| node_permits
node_hooks -->|"records events"| node_ledger
node_hooks -->|"requests Jev"| node_proxy
node_ask -->|"routes question"| node_routing
node_ask -->|"builds question"| node_questions
node_ask -->|"redacts text"| node_redact
node_ask -->|"calls provider"| node_adapter
node_adapter -->|"sends request"| node_provider
node_ask -->|"journals call"| node_ledger
node_ask -->|"records result"| node_decisions
node_decisions -->|"applies transition"| node_state
node_decisions -->|"stores outcomes"| node_ledger
node_owner -->|"approves permit"| node_permits
node_ledger -->|"supplies observations"| node_evaluation
node_evaluation -->|"informs tuning"| node_improvement
node_cli -->|"runs checks"| node_operations
node_cli -->|"shows ledger"| node_readouts
node_operations -->|"reads governance state"| node_ledger

click node_cli "https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/cli.py"
click node_setup "https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/setup.py"
click node_hooks "https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/hooks.py"
click node_proxy "https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/proxy.py"
click node_ask "https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/ask.py"
click node_adapter "https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/adapter.py"
click node_questions "https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/questions.py"
click node_routing "https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/route.py"
click node_redact "https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/redact.py"
click node_policy "https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/policy.py"
click node_permits "https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/permits.py"
click node_decisions "https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/decide.py"
click node_state "https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/state_machine.py"
click node_ledger "https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/ledger.py"
click node_evaluation "https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/evals.py"
click node_improvement "https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/improve.py"
click node_operations "https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/ops.py"
click node_readouts "https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/readouts.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_setup,node_hooks toneBlue
class node_proxy,node_ask,node_adapter,node_questions,node_routing,node_redact toneAmber
class node_policy,node_permits,node_decisions,node_state,node_ledger,node_provider toneMint
class node_evaluation,node_improvement,node_operations,node_readouts toneRose
class node_owner,node_claude toneIndigo
```

## Components

### Claude integration

- [JADE CLI](https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/cli.py): `jade/cli.py`
- [Harness setup](https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/setup.py): `jade/setup.py`
- [Claude hooks](https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/hooks.py): `jade/hooks.py`

### Decision runtime

- [Jev proxy](https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/proxy.py): `jade/proxy.py`
- [Decision request](https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/ask.py): `jade/ask.py`
- [Provider adapter](https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/adapter.py): `jade/adapter.py`
- [Question registry](https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/questions.py): `jade/questions.py`
- [Question routing](https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/route.py): `jade/route.py`
- [Text redaction](https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/redact.py): `jade/redact.py`

### Safety and state

- [Risk policy](https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/policy.py): `jade/policy.py`
- [Human permits](https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/permits.py): `jade/permits.py`
- [Decision records](https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/decide.py): `jade/decide.py`
- [Decision lifecycle](https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/state_machine.py): `jade/state_machine.py`
- [Event ledger](https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/ledger.py): `jade/ledger.py`

### Measurement and operations

- [Labels and metrics](https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/evals.py): `jade/evals.py`
- [Offline improvement](https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/improve.py): `jade/improve.py`
- [Governance operations](https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/ops.py): `jade/ops.py`
- [Ledger readouts](https://github.com/vahidkaargar/jade-decision-governance/blob/main/jade/readouts.py): `jade/readouts.py`

### Other components

- **Human owner**
- **Claude Code**
- **OpenRouter / Jev**

## Connections

- Human owner → Harness setup: wires manually
- Harness setup → Claude Code: installs hooks
- Claude Code → Claude hooks: dispatches events
- Human owner → JADE CLI: runs commands
- JADE CLI → Decision request: requests evaluation (evidence: `jade/cli.py`)
- Claude hooks → Risk policy: classifies tool risk (evidence: `jade/hooks.py`)
- Claude hooks → Human permits: checks approval (evidence: `jade/hooks.py`)
- Claude hooks → Event ledger: records events (evidence: `jade/hooks.py`)
- Claude hooks → Jev proxy: requests Jev (evidence: `jade/hooks.py`)
- Decision request → Question routing: routes question (evidence: `jade/ask.py`)
- Decision request → Question registry: builds question (evidence: `jade/ask.py`)
- Decision request → Text redaction: redacts text (evidence: `jade/ask.py`)
- Decision request → Provider adapter: calls provider (evidence: `jade/ask.py`)
- Provider adapter → OpenRouter / Jev: sends request
- Decision request → Event ledger: journals call (evidence: `jade/ask.py`)
- Decision request → Decision records: records result (evidence: `jade/ask.py`)
- Decision records → Decision lifecycle: applies transition (evidence: `jade/decide.py`)
- Decision records → Event ledger: stores outcomes (evidence: `jade/decide.py`)
- Human owner → Human permits: approves permit
- Event ledger → Labels and metrics: supplies observations (evidence: `jade/evals.py`)
- Labels and metrics → Offline improvement: informs tuning (evidence: `jade/improve.py`)
- JADE CLI → Governance operations: runs checks (evidence: `jade/cli.py`)
- JADE CLI → Ledger readouts: shows ledger (evidence: `jade/cli.py`)
- Governance operations → Event ledger: reads governance state (evidence: `jade/ops.py`)
