# siddicky/omp-typesafe architecture

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

- Interactive diagram: https://gitdiagram.com/siddicky/omp-typesafe
- Repository: https://github.com/siddicky/omp-typesafe

## Overview

omp-typesafe is an omp coding-agent extension that reviews agent work with TypeSafe AI and can optionally gate ambiguous plans or unsafe pipeline actions. The main flow is omp session events into the extension, evidence and transcript preparation, model-based review, then advisory notes; review notes do not block tools. Separate branches handle plan ambiguity, stop decisions, omp-skills safeguards, context compaction, and the direct `typesafe_ask` tool. The graph follows README capabilities and indexed modules; several implementation links are dashed because the excerpts do not show their call sites.

Main entry points: [`src/index.ts`](https://github.com/siddicky/omp-typesafe/blob/main/src/index.ts) (Extension runtime), [`src/reviewer.ts`](https://github.com/siddicky/omp-typesafe/blob/main/src/reviewer.ts) (Review batteries), [`src/client.ts`](https://github.com/siddicky/omp-typesafe/blob/main/src/client.ts) (TypeSafe client), [`src/branch.ts`](https://github.com/siddicky/omp-typesafe/blob/main/src/branch.ts) (Branch interpreter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_integration["Host integration"]
  node_extension["Extension runtime<br/>[index.ts]"]
  node_hostapi["Host adapters<br/>[host.ts]"]
  node_config["Configuration<br/>[config.ts]"]
  node_tool["typesafe_ask tool<br/>[index.ts]"]
end

subgraph group_review["Review workflow"]
  node_branch["Branch interpreter<br/>[branch.ts]"]
  node_evidence["Evidence collection<br/>[evidence.ts]"]
  node_reviewer["Review batteries<br/>[reviewer.ts]"]
  node_priorities["Review priorities<br/>[priorities.ts]"]
  node_client["TypeSafe client<br/>[client.ts]"]
  node_text["Text and redaction<br/>[text.ts]"]
end

subgraph group_gates["Review gates"]
  node_ambiguity["Ambiguity gate<br/>[ambiguity.ts]"]
  node_stopgate["Stop gate<br/>[index.ts]"]
end

subgraph group_pipeline["Skills pipeline"]
  node_approval["Approval integrity<br/>[approval.ts]"]
  node_planguard["Plan guard<br/>[plan-guard.ts]"]
  node_skill["Skill recognition<br/>[skill.ts]"]
  node_spec["Spec validation<br/>[spec.ts]"]
end

subgraph group_context["Context management"]
  node_compaction["Context compaction<br/>[compaction.ts]"]
end

node_user(("Agent user"))
node_omp{{"omp host"}}
node_typesafe{{"TypeSafe API"}}

node_user -->|"prompts"| node_omp
node_omp -->|"sends events"| node_extension
node_extension -.->|"uses adapters"| node_hostapi
node_extension -.->|"loads settings"| node_config
node_extension -.->|"reads session"| node_branch
node_extension -->|"collects evidence"| node_evidence
node_extension -->|"requests review"| node_reviewer
node_extension -.->|"loads priorities"| node_priorities
node_extension -.->|"checks ambiguity"| node_ambiguity
node_extension -.->|"evaluates stops"| node_stopgate
node_extension -.->|"checks approvals"| node_approval
node_extension -.->|"guards plan calls"| node_planguard
node_extension -.->|"recognizes skills"| node_skill
node_extension -->|"checks specs"| node_spec
node_extension -.->|"compacts context"| node_compaction
node_extension -.->|"registers tool"| node_tool
node_reviewer -->|"asks questions"| node_client
node_ambiguity -->|"scores clarity"| node_client
node_client -->|"sends requests"| node_typesafe
node_tool -.->|"uses primitives"| node_client
node_reviewer -->|"reads transcript"| node_branch
node_branch -->|"uses helpers"| node_text
node_evidence -->|"sanitizes evidence"| node_text
node_reviewer -.->|"formats review"| node_text
node_extension -->|"delivers notes"| node_omp

click node_extension "https://github.com/siddicky/omp-typesafe/blob/main/src/index.ts"
click node_hostapi "https://github.com/siddicky/omp-typesafe/blob/main/src/host.ts"
click node_config "https://github.com/siddicky/omp-typesafe/blob/main/src/config.ts"
click node_tool "https://github.com/siddicky/omp-typesafe/blob/main/src/index.ts"
click node_branch "https://github.com/siddicky/omp-typesafe/blob/main/src/branch.ts"
click node_evidence "https://github.com/siddicky/omp-typesafe/blob/main/src/evidence.ts"
click node_reviewer "https://github.com/siddicky/omp-typesafe/blob/main/src/reviewer.ts"
click node_priorities "https://github.com/siddicky/omp-typesafe/blob/main/src/priorities.ts"
click node_client "https://github.com/siddicky/omp-typesafe/blob/main/src/client.ts"
click node_text "https://github.com/siddicky/omp-typesafe/blob/main/src/text.ts"
click node_ambiguity "https://github.com/siddicky/omp-typesafe/blob/main/src/ambiguity.ts"
click node_stopgate "https://github.com/siddicky/omp-typesafe/blob/main/src/index.ts"
click node_compaction "https://github.com/siddicky/omp-typesafe/blob/main/src/compaction.ts"
click node_approval "https://github.com/siddicky/omp-typesafe/blob/main/src/pipeline/approval.ts"
click node_planguard "https://github.com/siddicky/omp-typesafe/blob/main/src/pipeline/plan-guard.ts"
click node_skill "https://github.com/siddicky/omp-typesafe/blob/main/src/pipeline/skill.ts"
click node_spec "https://github.com/siddicky/omp-typesafe/blob/main/src/pipeline/spec.ts"

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_extension,node_hostapi,node_config,node_tool,node_user toneBlue
class node_branch,node_evidence,node_reviewer,node_priorities,node_client,node_text toneAmber
class node_ambiguity,node_stopgate,node_typesafe toneMint
class node_approval,node_planguard,node_skill,node_spec toneRose
class node_compaction,node_omp toneIndigo
```

## Components

### Host integration

- [Extension runtime](https://github.com/siddicky/omp-typesafe/blob/main/src/index.ts): `src/index.ts`
- [Host adapters](https://github.com/siddicky/omp-typesafe/blob/main/src/host.ts): `src/host.ts`
- [Configuration](https://github.com/siddicky/omp-typesafe/blob/main/src/config.ts): `src/config.ts`
- [typesafe_ask tool](https://github.com/siddicky/omp-typesafe/blob/main/src/index.ts): `src/index.ts`

### Review workflow

- [Branch interpreter](https://github.com/siddicky/omp-typesafe/blob/main/src/branch.ts): `src/branch.ts`
- [Evidence collection](https://github.com/siddicky/omp-typesafe/blob/main/src/evidence.ts): `src/evidence.ts`
- [Review batteries](https://github.com/siddicky/omp-typesafe/blob/main/src/reviewer.ts): `src/reviewer.ts`
- [Review priorities](https://github.com/siddicky/omp-typesafe/blob/main/src/priorities.ts): `src/priorities.ts`
- [TypeSafe client](https://github.com/siddicky/omp-typesafe/blob/main/src/client.ts): `src/client.ts`
- [Text and redaction](https://github.com/siddicky/omp-typesafe/blob/main/src/text.ts): `src/text.ts`

### Review gates

- [Ambiguity gate](https://github.com/siddicky/omp-typesafe/blob/main/src/ambiguity.ts): `src/ambiguity.ts`
- [Stop gate](https://github.com/siddicky/omp-typesafe/blob/main/src/index.ts): `src/index.ts`

### Skills pipeline

- [Approval integrity](https://github.com/siddicky/omp-typesafe/blob/main/src/pipeline/approval.ts): `src/pipeline/approval.ts`
- [Plan guard](https://github.com/siddicky/omp-typesafe/blob/main/src/pipeline/plan-guard.ts): `src/pipeline/plan-guard.ts`
- [Skill recognition](https://github.com/siddicky/omp-typesafe/blob/main/src/pipeline/skill.ts): `src/pipeline/skill.ts`
- [Spec validation](https://github.com/siddicky/omp-typesafe/blob/main/src/pipeline/spec.ts): `src/pipeline/spec.ts`

### Context management

- [Context compaction](https://github.com/siddicky/omp-typesafe/blob/main/src/compaction.ts): `src/compaction.ts`

### Other components

- **Agent user**
- **omp host**
- **TypeSafe API**

## Connections

- Agent user → omp host: prompts (evidence: `README.md`)
- omp host → Extension runtime: sends events (evidence: `README.md`)
- Extension runtime → Host adapters: uses adapters (evidence: `src/index.ts`)
- Extension runtime → Configuration: loads settings (evidence: `src/index.ts`)
- Extension runtime → Branch interpreter: reads session (evidence: `src/index.ts`)
- Extension runtime → Evidence collection: collects evidence (evidence: `src/index.ts`)
- Extension runtime → Review batteries: requests review (evidence: `src/index.ts`)
- Extension runtime → Review priorities: loads priorities (evidence: `src/index.ts`)
- Extension runtime → Ambiguity gate: checks ambiguity (evidence: `src/index.ts`)
- Extension runtime → Stop gate: evaluates stops (evidence: `src/index.ts`)
- Extension runtime → Approval integrity: checks approvals (evidence: `src/index.ts`)
- Extension runtime → Plan guard: guards plan calls (evidence: `src/index.ts`)
- Extension runtime → Skill recognition: recognizes skills (evidence: `src/index.ts`)
- Extension runtime → Spec validation: checks specs (evidence: `src/index.ts`)
- Extension runtime → Context compaction: compacts context (evidence: `src/index.ts`)
- Extension runtime → typesafe_ask tool: registers tool (evidence: `src/index.ts`)
- Review batteries → TypeSafe client: asks questions (evidence: `src/reviewer.ts`)
- Ambiguity gate → TypeSafe client: scores clarity (evidence: `src/ambiguity.ts`)
- TypeSafe client → TypeSafe API: sends requests (evidence: `src/client.ts`)
- typesafe_ask tool → TypeSafe client: uses primitives (evidence: `src/index.ts`)
- Review batteries → Branch interpreter: reads transcript (evidence: `src/reviewer.ts`)
- Branch interpreter → Text and redaction: uses helpers (evidence: `src/branch.ts`)
- Evidence collection → Text and redaction: sanitizes evidence (evidence: `src/evidence.ts`)
- Review batteries → Text and redaction: formats review (evidence: `src/reviewer.ts`)
- Extension runtime → omp host: delivers notes (evidence: `README.md`)
