# disler/ten-levels-of-jev architecture

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

- Interactive diagram: https://gitdiagram.com/disler/ten-levels-of-jev
- Repository: https://github.com/disler/ten-levels-of-jev

## Overview

10 Levels of Jev is an interactive lab demonstrating thirty JSON-based decision-making use cases, from simple code-level judgments to Jev tools and hooks in a coding agent. The main workflow is to choose a level and option in the web lab, submit input to the server, run the selected example, and stream decisions and Jev-call events back to the UI. The server can also launch interactive pi sessions for agent-oriented levels. The README documents all ten levels; sampled source confirms the server, client, selected examples, and session lifecycle, but not every level’s internal wiring.

Main entry points: [`apps/ten-levels/server/server.mjs`](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/server/server.mjs) (Lab HTTP server), [`apps/ten-levels/src/core/client.ts`](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/core/client.ts) (Jev client), [`apps/ten-levels/web/src/views/LevelView.vue`](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/web/src/views/LevelView.vue) (Level views), [`apps/ten-levels/server/agent-session.mjs`](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/server/agent-session.mjs) (Agent sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_lab["Web Lab"]
  node_web["Vue lab<br/>[App.vue]"]
  node_webapi["Web API client<br/>[api.ts]"]
  node_agentapi["Agent API client<br/>[agent-api.ts]"]
  node_views["Level views<br/>[LevelView.vue]"]
  node_visuals["Run visualizations<br/>[RunVisual.vue]"]
end

subgraph group_runtime["Demo Runtime"]
  node_server["Lab HTTP server<br/>[server.mjs]"]
  node_scenarios["Scenario registry<br/>[scenarios.mjs]"]
  node_demo["Terminal demo<br/>[demo.ts]"]
  node_core["Jev client<br/>[client.ts]"]
  node_mock["Offline mock<br/>[mock.ts]"]
end

subgraph group_examples["Decision Levels"]
  node_lvl1["Single decisions<br/>[index.ts]"]
  node_lvl2["Multiple choice<br/>[index.ts]"]
  node_lvl3["Composite scoring<br/>[index.ts]"]
  node_lvl4["Confidence gates<br/>[index.ts]"]
  node_lvl5["Intent routing<br/>[index.ts]"]
  node_lvl6["Guardrail hooks<br/>[index.ts]"]
  node_lvl7["Compaction decisions<br/>[index.ts]"]
  node_lvl8["Single-file judgments<br/>[index.ts]"]
  node_lvl9["File-scale judgments<br/>[index.ts]"]
  node_lvl10["Agentic Jev<br/>[index.ts]"]
end

subgraph group_agent["Agent Integration"]
  node_agentext["Agent extensions<br/>[ask-jev.ts]"]
  node_sessions["Agent sessions<br/>[agent-session.mjs]"]
end

node_visitor(("Lab user"))
node_pi["pi coding agent"]
node_typesafe{{"TypeSafe API"}}
node_openrouter{{"OpenRouter API"}}

node_visitor -->|"uses"| node_web
node_web -->|"shows levels"| node_views
node_views -->|"requests runs"| node_webapi
node_views -->|"controls sessions"| node_agentapi
node_webapi -->|"calls API"| node_server
node_agentapi -->|"calls agent API"| node_server
node_server -->|"selects options"| node_scenarios
node_server -->|"streams events"| node_visuals
node_server -->|"reads status"| node_core
node_server -->|"starts sessions"| node_sessions
node_server -->|"runs option"| node_lvl1
node_server -->|"runs option"| node_lvl2
node_server -->|"runs option"| node_lvl3
node_server -->|"runs option"| node_lvl4
node_server -->|"runs option"| node_lvl5
node_server -->|"runs option"| node_lvl6
node_server -->|"runs option"| node_lvl7
node_server -->|"runs option"| node_lvl8
node_server -->|"runs option"| node_lvl9
node_server -->|"runs option"| node_lvl10
node_lvl5 -->|"calls decisions"| node_core
node_lvl3 -->|"calls decisions"| node_core
node_demo -->|"uses client"| node_core
node_core -.->|"runs mock"| node_mock
node_core -.->|"sends requests"| node_typesafe
node_core -.->|"sends requests"| node_openrouter
node_sessions -->|"spawns and controls"| node_pi
node_sessions -->|"loads extension"| node_agentext
node_pi -->|"dispatches hooks"| node_agentext
node_agentext -.->|"requests decisions"| node_core

click node_web "https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/web/src/App.vue"
click node_webapi "https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/web/src/lib/api.ts"
click node_agentapi "https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/web/src/lib/agent-api.ts"
click node_views "https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/web/src/views/LevelView.vue"
click node_visuals "https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/web/src/components/RunVisual.vue"
click node_server "https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/server/server.mjs"
click node_scenarios "https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/server/scenarios.mjs"
click node_demo "https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/demo.ts"
click node_core "https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/core/client.ts"
click node_mock "https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/core/mock.ts"
click node_lvl1 "https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/levels/level01/index.ts"
click node_lvl2 "https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/levels/level02/index.ts"
click node_lvl3 "https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/levels/level03/index.ts"
click node_lvl4 "https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/levels/level04/index.ts"
click node_lvl5 "https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/levels/level05/index.ts"
click node_lvl6 "https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/levels/level06/index.ts"
click node_lvl7 "https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/levels/level07/index.ts"
click node_lvl8 "https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/levels/level08/index.ts"
click node_lvl9 "https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/levels/level09/index.ts"
click node_lvl10 "https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/levels/level10/index.ts"
click node_agentext "https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/extensions/ask-jev.ts"
click node_sessions "https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/server/agent-session.mjs"

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_web,node_webapi,node_agentapi,node_views,node_visuals,node_visitor toneBlue
class node_server,node_scenarios,node_demo,node_core,node_mock toneAmber
class node_lvl1,node_lvl2,node_lvl3,node_lvl4,node_lvl5,node_lvl6,node_lvl7,node_lvl8,node_lvl9,node_lvl10,node_typesafe,node_openrouter toneMint
class node_agentext,node_sessions toneRose
class node_pi toneIndigo
```

## Components

### Web Lab

- [Vue lab](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/web/src/App.vue): `apps/ten-levels/web/src/App.vue`
- [Web API client](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/web/src/lib/api.ts): `apps/ten-levels/web/src/lib/api.ts`
- [Agent API client](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/web/src/lib/agent-api.ts): `apps/ten-levels/web/src/lib/agent-api.ts`
- [Level views](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/web/src/views/LevelView.vue): `apps/ten-levels/web/src/views/LevelView.vue`
- [Run visualizations](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/web/src/components/RunVisual.vue): `apps/ten-levels/web/src/components/RunVisual.vue`

### Demo Runtime

- [Lab HTTP server](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/server/server.mjs): `apps/ten-levels/server/server.mjs`
- [Scenario registry](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/server/scenarios.mjs): `apps/ten-levels/server/scenarios.mjs`
- [Terminal demo](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/demo.ts): `apps/ten-levels/src/demo.ts`
- [Jev client](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/core/client.ts): `apps/ten-levels/src/core/client.ts`
- [Offline mock](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/core/mock.ts): `apps/ten-levels/src/core/mock.ts`

### Decision Levels

- [Single decisions](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/levels/level01/index.ts): `apps/ten-levels/src/levels/level01/index.ts`
- [Multiple choice](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/levels/level02/index.ts): `apps/ten-levels/src/levels/level02/index.ts`
- [Composite scoring](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/levels/level03/index.ts): `apps/ten-levels/src/levels/level03/index.ts`
- [Confidence gates](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/levels/level04/index.ts): `apps/ten-levels/src/levels/level04/index.ts`
- [Intent routing](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/levels/level05/index.ts): `apps/ten-levels/src/levels/level05/index.ts`
- [Guardrail hooks](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/levels/level06/index.ts): `apps/ten-levels/src/levels/level06/index.ts`
- [Compaction decisions](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/levels/level07/index.ts): `apps/ten-levels/src/levels/level07/index.ts`
- [Single-file judgments](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/levels/level08/index.ts): `apps/ten-levels/src/levels/level08/index.ts`
- [File-scale judgments](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/levels/level09/index.ts): `apps/ten-levels/src/levels/level09/index.ts`
- [Agentic Jev](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/src/levels/level10/index.ts): `apps/ten-levels/src/levels/level10/index.ts`

### Agent Integration

- [Agent extensions](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/extensions/ask-jev.ts): `apps/ten-levels/extensions/ask-jev.ts`
- [Agent sessions](https://github.com/disler/ten-levels-of-jev/blob/main/apps/ten-levels/server/agent-session.mjs): `apps/ten-levels/server/agent-session.mjs`

### Other components

- **Lab user**
- **pi coding agent**
- **TypeSafe API**
- **OpenRouter API**

## Connections

- Lab user → Vue lab: uses
- Vue lab → Level views: shows levels
- Level views → Web API client: requests runs
- Level views → Agent API client: controls sessions
- Web API client → Lab HTTP server: calls API
- Agent API client → Lab HTTP server: calls agent API
- Lab HTTP server → Scenario registry: selects options
- Lab HTTP server → Run visualizations: streams events
- Lab HTTP server → Jev client: reads status
- Lab HTTP server → Agent sessions: starts sessions
- Lab HTTP server → Single decisions: runs option
- Lab HTTP server → Multiple choice: runs option
- Lab HTTP server → Composite scoring: runs option
- Lab HTTP server → Confidence gates: runs option
- Lab HTTP server → Intent routing: runs option
- Lab HTTP server → Guardrail hooks: runs option
- Lab HTTP server → Compaction decisions: runs option
- Lab HTTP server → Single-file judgments: runs option
- Lab HTTP server → File-scale judgments: runs option
- Lab HTTP server → Agentic Jev: runs option
- Intent routing → Jev client: calls decisions
- Composite scoring → Jev client: calls decisions
- Terminal demo → Jev client: uses client
- Jev client → Offline mock: runs mock
- Jev client → TypeSafe API: sends requests
- Jev client → OpenRouter API: sends requests
- Agent sessions → pi coding agent: spawns and controls
- Agent sessions → Agent extensions: loads extension
- pi coding agent → Agent extensions: dispatches hooks
- Agent extensions → Jev client: requests decisions
