# dopesir/universal-frontier-harness architecture

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

- Interactive diagram: https://gitdiagram.com/dopesir/universal-frontier-harness
- Repository: https://github.com/dopesir/universal-frontier-harness

## Overview

The Universal Frontier Engineering Harness combines agent-facing operational guidance with mechanical hooks that gate actions, validate edits, record verification evidence, and prevent unsupported completion. The principal workflow is an agent tool call through the pre-tool policy gate, then post-tool validation and evidence recording, followed by a stop-time freshness check. The README also describes adapter support, task contracts, delegation, and specialized engineering skills. Edges follow sampled imports/calls or explicit README statements; unsampled subsystems are included only where their paths are present in the tree.

Main entry points: [`hooks/pre_tool.py`](https://github.com/dopesir/universal-frontier-harness/blob/main/hooks/pre_tool.py) (Pre-tool Gate), [`hooks/post_tool.py`](https://github.com/dopesir/universal-frontier-harness/blob/main/hooks/post_tool.py) (Post-tool Recorder), [`hooks/stop_gate.py`](https://github.com/dopesir/universal-frontier-harness/blob/main/hooks/stop_gate.py) (Stop Hook), [`hooks/hooks.json`](https://github.com/dopesir/universal-frontier-harness/blob/main/hooks/hooks.json) (Hook Configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Agent Integration"]
  node_adapters["Host Adapters"]
  node_hookconfig["Hook Configuration<br/>[hooks.json]"]
  node_pretool["Pre-tool Gate<br/>[pre_tool.py]"]
  node_posttool["Post-tool Recorder<br/>[post_tool.py]"]
  node_stophook["Stop Hook<br/>[stop_gate.py]"]
end

subgraph group_runtime["Reliability Runtime"]
  node_contract["Task Contract<br/>[contract.py]"]
  node_policy["Action Policy<br/>[policy.py]"]
  node_statemachine["Session State<br/>[state_machine.py]"]
  node_lint["Syntax Linter<br/>[fast_lint.py]"]
  node_evidence[("Evidence Ledger<br/>[evidence.py]")]
  node_stopgate["Completion Gate<br/>[stop_gate.py]"]
end

subgraph group_guidance["Engineering Guidance"]
  node_rules["Operational Rules"]
  node_skills["Engineering Skills"]
  node_delegation["Delegation Roles<br/>[SKILL.md]"]
end

subgraph group_evaluation["Evaluation"]
  node_benchmarks["Contract Benchmarks<br/>[runner.py]"]
end

node_agent(("Coding Agent"))

node_agent -.->|"sends tool calls"| node_adapters
node_adapters -->|"normalizes actions"| node_policy
node_agent -->|"proposes action"| node_pretool
node_pretool -->|"evaluates action"| node_policy
node_pretool -->|"loads scope"| node_contract
node_pretool -->|"returns decision"| node_agent
node_agent -->|"returns tool result"| node_posttool
node_posttool -->|"classifies action"| node_policy
node_posttool -->|"lints writes"| node_lint
node_posttool -->|"appends passing runs"| node_evidence
node_agent -->|"proposes completion"| node_stophook
node_stophook -->|"evaluates stop"| node_stopgate
node_stopgate -->|"loads criteria"| node_contract
node_stopgate -->|"checks freshness"| node_evidence
node_stophook -->|"returns decision"| node_agent
node_hookconfig -.->|"configures hooks"| node_pretool
node_hookconfig -.->|"configures hooks"| node_posttool
node_hookconfig -.->|"configures hooks"| node_stophook
node_rules -->|"guides operation"| node_agent
node_skills -->|"guides workflows"| node_agent
node_delegation -->|"defines delegation"| node_agent
node_benchmarks -->|"validates tasks"| node_contract

click node_adapters "https://github.com/dopesir/universal-frontier-harness/tree/main/adapters"
click node_hookconfig "https://github.com/dopesir/universal-frontier-harness/blob/main/hooks/hooks.json"
click node_pretool "https://github.com/dopesir/universal-frontier-harness/blob/main/hooks/pre_tool.py"
click node_posttool "https://github.com/dopesir/universal-frontier-harness/blob/main/hooks/post_tool.py"
click node_stophook "https://github.com/dopesir/universal-frontier-harness/blob/main/hooks/stop_gate.py"
click node_contract "https://github.com/dopesir/universal-frontier-harness/blob/main/core/contract.py"
click node_policy "https://github.com/dopesir/universal-frontier-harness/blob/main/core/policy.py"
click node_statemachine "https://github.com/dopesir/universal-frontier-harness/blob/main/core/state_machine.py"
click node_lint "https://github.com/dopesir/universal-frontier-harness/blob/main/core/fast_lint.py"
click node_evidence "https://github.com/dopesir/universal-frontier-harness/blob/main/core/evidence.py"
click node_stopgate "https://github.com/dopesir/universal-frontier-harness/blob/main/core/stop_gate.py"
click node_rules "https://github.com/dopesir/universal-frontier-harness/tree/main/rules"
click node_skills "https://github.com/dopesir/universal-frontier-harness/tree/main/skills"
click node_delegation "https://github.com/dopesir/universal-frontier-harness/blob/main/skills/subagent-orchestration/SKILL.md"
click node_benchmarks "https://github.com/dopesir/universal-frontier-harness/blob/main/eval/runner.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_adapters,node_hookconfig,node_pretool,node_posttool,node_stophook toneBlue
class node_contract,node_policy,node_statemachine,node_lint,node_evidence,node_stopgate toneAmber
class node_rules,node_skills,node_delegation toneMint
class node_benchmarks toneRose
class node_agent toneIndigo
```

## Components

### Agent Integration

- [Host Adapters](https://github.com/dopesir/universal-frontier-harness/tree/main/adapters): `adapters`
- [Hook Configuration](https://github.com/dopesir/universal-frontier-harness/blob/main/hooks/hooks.json): `hooks/hooks.json`
- [Pre-tool Gate](https://github.com/dopesir/universal-frontier-harness/blob/main/hooks/pre_tool.py): `hooks/pre_tool.py`
- [Post-tool Recorder](https://github.com/dopesir/universal-frontier-harness/blob/main/hooks/post_tool.py): `hooks/post_tool.py`
- [Stop Hook](https://github.com/dopesir/universal-frontier-harness/blob/main/hooks/stop_gate.py): `hooks/stop_gate.py`

### Reliability Runtime

- [Task Contract](https://github.com/dopesir/universal-frontier-harness/blob/main/core/contract.py): `core/contract.py`
- [Action Policy](https://github.com/dopesir/universal-frontier-harness/blob/main/core/policy.py): `core/policy.py`
- [Session State](https://github.com/dopesir/universal-frontier-harness/blob/main/core/state_machine.py): `core/state_machine.py`
- [Syntax Linter](https://github.com/dopesir/universal-frontier-harness/blob/main/core/fast_lint.py): `core/fast_lint.py`
- [Evidence Ledger](https://github.com/dopesir/universal-frontier-harness/blob/main/core/evidence.py): `core/evidence.py`
- [Completion Gate](https://github.com/dopesir/universal-frontier-harness/blob/main/core/stop_gate.py): `core/stop_gate.py`

### Engineering Guidance

- [Operational Rules](https://github.com/dopesir/universal-frontier-harness/tree/main/rules): `rules`
- [Engineering Skills](https://github.com/dopesir/universal-frontier-harness/tree/main/skills): `skills`
- [Delegation Roles](https://github.com/dopesir/universal-frontier-harness/blob/main/skills/subagent-orchestration/SKILL.md): `skills/subagent-orchestration/SKILL.md`

### Evaluation

- [Contract Benchmarks](https://github.com/dopesir/universal-frontier-harness/blob/main/eval/runner.py): `eval/runner.py`

### Other components

- **Coding Agent**

## Connections

- Coding Agent → Host Adapters: sends tool calls (evidence: `README.md`)
- Host Adapters → Action Policy: normalizes actions (evidence: `adapters/antigravity.py`)
- Coding Agent → Pre-tool Gate: proposes action (evidence: `README.md`)
- Pre-tool Gate → Action Policy: evaluates action (evidence: `hooks/pre_tool.py`)
- Pre-tool Gate → Task Contract: loads scope (evidence: `hooks/pre_tool.py`)
- Pre-tool Gate → Coding Agent: returns decision (evidence: `README.md`)
- Coding Agent → Post-tool Recorder: returns tool result (evidence: `README.md`)
- Post-tool Recorder → Action Policy: classifies action (evidence: `hooks/post_tool.py`)
- Post-tool Recorder → Syntax Linter: lints writes (evidence: `hooks/post_tool.py`)
- Post-tool Recorder → Evidence Ledger: appends passing runs (evidence: `hooks/post_tool.py`)
- Coding Agent → Stop Hook: proposes completion (evidence: `README.md`)
- Stop Hook → Completion Gate: evaluates stop (evidence: `hooks/stop_gate.py`)
- Completion Gate → Task Contract: loads criteria (evidence: `core/stop_gate.py`)
- Completion Gate → Evidence Ledger: checks freshness (evidence: `core/stop_gate.py`)
- Stop Hook → Coding Agent: returns decision (evidence: `README.md`)
- Hook Configuration → Pre-tool Gate: configures hooks (evidence: `README.md`)
- Hook Configuration → Post-tool Recorder: configures hooks (evidence: `README.md`)
- Hook Configuration → Stop Hook: configures hooks (evidence: `README.md`)
- Operational Rules → Coding Agent: guides operation (evidence: `README.md`)
- Engineering Skills → Coding Agent: guides workflows (evidence: `README.md`)
- Delegation Roles → Coding Agent: defines delegation (evidence: `README.md`)
- Contract Benchmarks → Task Contract: validates tasks (evidence: `eval/runner.py`)
