# valentynkit/jev-belay architecture

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

- Interactive diagram: https://gitdiagram.com/valentynkit/jev-belay
- Repository: https://github.com/valentynkit/jev-belay

## Overview

jev-belay is a Claude Code Stop hook that checks transcript evidence before asking Jev whether an unverified completion claim should be blocked. Its main path is local and fail-open; the README also documents a decision-log viewer and a separate corpus-based evaluation workflow. The graph preserves those research and support capabilities. Some hook internals and optional integrations are unsampled, so uncertain links are omitted rather than inferred.

Main entry points: [`belay.mjs`](https://github.com/valentynkit/jev-belay/blob/main/belay.mjs) (Stop hook), [`corpus`](https://github.com/valentynkit/jev-belay/tree/main/corpus) (Stop records), [`tools/label.mjs`](https://github.com/valentynkit/jev-belay/blob/main/tools/label.mjs) (Human or proxy labels), [`tools/measure.mjs`](https://github.com/valentynkit/jev-belay/blob/main/tools/measure.mjs) (Evaluation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Stop gate"]
  node_hook["Stop hook<br/>[belay.mjs]"]
  node_transcript["Transcript evidence<br/>[belay.mjs]"]
  node_jev{{"Jev API"}}
  node_decision[("Decision and guard<br/>[belay.mjs]")]
  node_fake["Fake Jev<br/>[fake-jev.mjs]"]
end

subgraph group_visibility["Decision visibility"]
  node_view["Live view and replay<br/>[tui.mjs]"]
  node_log[("Decision log<br/>[belay.mjs]")]
end

subgraph group_research["Corpus evaluation"]
  node_extract["Corpus extraction<br/>[extract-corpus.mjs]"]
  node_records[("Stop records")]
  node_labels["Human or proxy labels<br/>[label.mjs]"]
  node_measure["Evaluation<br/>[measure.mjs]"]
  node_rubric["Label rubric<br/>[RUBRIC.md]"]
end

subgraph group_support["User support"]
  node_why["Explain decision<br/>[SKILL.md]"]
  node_doctor["Install diagnostics<br/>[SKILL.md]"]
end

node_claude(("Claude Code"))

node_claude -->|"invokes stop"| node_hook
node_hook -->|"reads evidence"| node_transcript
node_hook -->|"asks questions"| node_jev
node_hook -->|"records decision"| node_decision
node_hook -->|"blocks or allows"| node_claude
node_hook -.->|"can target"| node_fake
node_hook -->|"loads commands"| node_view
node_decision -->|"writes log"| node_log
node_view -->|"reads decisions"| node_log
node_why -->|"explains last"| node_log
node_doctor -->|"checks round trip"| node_hook
node_transcript -->|"projects turns"| node_extract
node_extract -->|"writes records"| node_records
node_records -->|"supplies stops"| node_labels
node_rubric -->|"guides labeling"| node_labels
node_labels -->|"appends labels"| node_records
node_records -->|"supplies corpus"| node_measure
node_labels -->|"supplies labels"| node_measure
node_measure -->|"requests answers"| node_jev
node_measure -->|"uses ask"| node_hook

click node_hook "https://github.com/valentynkit/jev-belay/blob/main/belay.mjs"
click node_transcript "https://github.com/valentynkit/jev-belay/blob/main/belay.mjs"
click node_decision "https://github.com/valentynkit/jev-belay/blob/main/belay.mjs"
click node_fake "https://github.com/valentynkit/jev-belay/blob/main/tools/fake-jev.mjs"
click node_view "https://github.com/valentynkit/jev-belay/blob/main/tui.mjs"
click node_log "https://github.com/valentynkit/jev-belay/blob/main/belay.mjs"
click node_why "https://github.com/valentynkit/jev-belay/blob/main/skills/why/SKILL.md"
click node_doctor "https://github.com/valentynkit/jev-belay/blob/main/skills/doctor/SKILL.md"
click node_extract "https://github.com/valentynkit/jev-belay/blob/main/tools/extract-corpus.mjs"
click node_records "https://github.com/valentynkit/jev-belay/tree/main/corpus"
click node_labels "https://github.com/valentynkit/jev-belay/blob/main/tools/label.mjs"
click node_measure "https://github.com/valentynkit/jev-belay/blob/main/tools/measure.mjs"
click node_rubric "https://github.com/valentynkit/jev-belay/blob/main/corpus/RUBRIC.md"

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_hook,node_transcript,node_jev,node_decision,node_fake toneBlue
class node_view,node_log toneAmber
class node_extract,node_records,node_labels,node_measure,node_rubric toneMint
class node_why,node_doctor toneRose
class node_claude toneIndigo
```

## Components

### Stop gate

- [Stop hook](https://github.com/valentynkit/jev-belay/blob/main/belay.mjs): `belay.mjs`
- [Transcript evidence](https://github.com/valentynkit/jev-belay/blob/main/belay.mjs): `belay.mjs`
- **Jev API**
- [Decision and guard](https://github.com/valentynkit/jev-belay/blob/main/belay.mjs): `belay.mjs`
- [Fake Jev](https://github.com/valentynkit/jev-belay/blob/main/tools/fake-jev.mjs): `tools/fake-jev.mjs`

### Decision visibility

- [Live view and replay](https://github.com/valentynkit/jev-belay/blob/main/tui.mjs): `tui.mjs`
- [Decision log](https://github.com/valentynkit/jev-belay/blob/main/belay.mjs): `belay.mjs`

### Corpus evaluation

- [Corpus extraction](https://github.com/valentynkit/jev-belay/blob/main/tools/extract-corpus.mjs): `tools/extract-corpus.mjs`
- [Stop records](https://github.com/valentynkit/jev-belay/tree/main/corpus): `corpus`
- [Human or proxy labels](https://github.com/valentynkit/jev-belay/blob/main/tools/label.mjs): `tools/label.mjs`
- [Evaluation](https://github.com/valentynkit/jev-belay/blob/main/tools/measure.mjs): `tools/measure.mjs`
- [Label rubric](https://github.com/valentynkit/jev-belay/blob/main/corpus/RUBRIC.md): `corpus/RUBRIC.md`

### User support

- [Explain decision](https://github.com/valentynkit/jev-belay/blob/main/skills/why/SKILL.md): `skills/why/SKILL.md`
- [Install diagnostics](https://github.com/valentynkit/jev-belay/blob/main/skills/doctor/SKILL.md): `skills/doctor/SKILL.md`

### Other components

- **Claude Code**

## Connections

- Claude Code → Stop hook: invokes stop (evidence: `README.md`)
- Stop hook → Transcript evidence: reads evidence (evidence: `belay.mjs`)
- Stop hook → Jev API: asks questions (evidence: `README.md`)
- Stop hook → Decision and guard: records decision (evidence: `README.md`)
- Stop hook → Claude Code: blocks or allows (evidence: `README.md`)
- Stop hook → Fake Jev: can target (evidence: `README.md`)
- Stop hook → Live view and replay: loads commands (evidence: `belay.mjs`)
- Decision and guard → Decision log: writes log (evidence: `README.md`)
- Live view and replay → Decision log: reads decisions (evidence: `README.md`)
- Explain decision → Decision log: explains last (evidence: `README.md`)
- Install diagnostics → Stop hook: checks round trip (evidence: `README.md`)
- Transcript evidence → Corpus extraction: projects turns (evidence: `tools/extract-corpus.mjs`)
- Corpus extraction → Stop records: writes records (evidence: `tools/extract-corpus.mjs`)
- Stop records → Human or proxy labels: supplies stops (evidence: `tools/label.mjs`)
- Label rubric → Human or proxy labels: guides labeling (evidence: `tools/label.mjs`)
- Human or proxy labels → Stop records: appends labels (evidence: `tools/label.mjs`)
- Stop records → Evaluation: supplies corpus (evidence: `tools/measure.mjs`)
- Human or proxy labels → Evaluation: supplies labels (evidence: `tools/measure.mjs`)
- Evaluation → Jev API: requests answers (evidence: `tools/measure.mjs`)
- Evaluation → Stop hook: uses ask (evidence: `tools/measure.mjs`)
