@miller-tech/uap 1.93.0 → 1.93.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -44
- package/docs/INDEX.md +28 -7
- package/docs/architecture/OVERVIEW.md +106 -17
- package/docs/architecture/PROTOCOL.md +31 -13
- package/docs/design/SELF_HARNESS.md +8 -0
- package/docs/design/UAP_REACTOR.md +17 -2
- package/docs/getting-started/CONFIGURATION.md +16 -7
- package/docs/getting-started/INSTALLATION.md +37 -18
- package/docs/getting-started/QUICKSTART.md +20 -14
- package/docs/guides/AUTOMATIC.md +9 -1
- package/docs/guides/AUTOMATIC_FEATURES.md +7 -1
- package/docs/guides/COORDINATION.md +5 -2
- package/docs/guides/DELIVER.md +3 -1
- package/docs/guides/DELIVERY_PIPELINE.md +122 -0
- package/docs/guides/DEPLOY_BATCHING.md +13 -4
- package/docs/guides/DROIDS_AND_SKILLS.md +13 -3
- package/docs/guides/LOCAL_MODELS.md +22 -7
- package/docs/guides/MCP_ROUTER.md +3 -1
- package/docs/guides/MEMORY.md +9 -4
- package/docs/guides/MULTI_MODEL.md +19 -3
- package/docs/guides/POLICIES.md +4 -2
- package/docs/guides/QWEN36_LLAMACPP.md +12 -3
- package/docs/guides/WORKTREE_WORKFLOW.md +6 -2
- package/docs/integrations/MCP_ROUTER.md +12 -3
- package/docs/integrations/RTK.md +15 -4
- package/docs/reference/API.md +9 -2
- package/docs/reference/CLI.md +13 -7
- package/docs/reference/CONFIGURATION.md +9 -3
- package/docs/reference/DATABASE_SCHEMA.md +13 -6
- package/docs/reference/FEATURES.md +135 -38
- package/docs/reference/PATTERNS.md +28 -12
- package/docs/reference/PLATFORMS.md +12 -5
- package/package.json +1 -1
- package/src/policies/enforcers/__pycache__/_common.cpython-312.pyc +0 -0
- package/tools/agents/scripts/__pycache__/toolcall_path_normalizer.cpython-312.pyc +0 -0
package/README.md
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
# Universal Agent Protocol (UAP)
|
|
4
4
|
|
|
5
|
-
**
|
|
5
|
+
**The discipline layer that turns a talented-but-unreliable AI coding agent into a dependable member of your software delivery line.**
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/@miller-tech/uap)
|
|
8
8
|
[](https://nodejs.org)
|
|
9
|
-
[](#testing)
|
|
10
10
|
[](LICENSE)
|
|
11
11
|
|
|
12
|
-
`v1.
|
|
12
|
+
`v1.93.1` · 220+ modules · 170+ test suites · 9 agent harnesses
|
|
13
13
|
|
|
14
|
-
[Quickstart](#quickstart) · [Why UAP?](#why-uap) · [`uap deliver`](#the-deliver-harness) · [
|
|
14
|
+
[Quickstart](#quickstart) · [Why UAP?](#why-uap) · [The delivery pipeline](docs/guides/DELIVERY_PIPELINE.md) · [`uap deliver`](#the-deliver-harness) · [Docs](docs/INDEX.md)
|
|
15
15
|
|
|
16
16
|
</div>
|
|
17
17
|
|
|
@@ -19,19 +19,21 @@
|
|
|
19
19
|
|
|
20
20
|
## Why UAP?
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
Shipping software with an AI agent is a lot like running a small factory floor. Intent comes in one end; working, verified, merged code should come out the other. In between are stations — understand the job, set up a bench, build it, **check it actually works**, ship it — and a jam at any one of them quietly ruins everything downstream.
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
Coding agents are capable but undisciplined line workers. They forget yesterday's shift, grab the wrong tool, build something that *looks* right, stamp it "done" without plugging it in, and trip over the other workers on the floor. That's not a problem you fix by swapping in a smarter model — it's a *process* problem. UAP is the process: it sits **underneath your agent harness** (Claude Code, Factory, Cursor, OpenCode, and more) and puts a station at every point where the line usually breaks — no model change required.
|
|
25
|
+
|
|
26
|
+
| Where the line jams | What UAP puts there | What you get |
|
|
25
27
|
|---|---|---|
|
|
26
|
-
|
|
|
27
|
-
| Tool output floods the context | MCP Router — tool-hiding +
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
28
|
+
| Agent starts every session amnesiac | 4-tier memory with semantic recall + write-gates | It remembers your codebase and past decisions |
|
|
29
|
+
| Tool output floods the context window | MCP Router — tool-hiding + output compression | Up to **~98%** smaller on big tool calls |
|
|
30
|
+
| "Looks right" but doesn't run | `uap deliver` — a loop against your **real** gates | Code that compiles, not a mock-up of it |
|
|
31
|
+
| Agent grades its own homework | Execution/runtime verify + a separate acceptance judge | "Done" means *verified* done |
|
|
32
|
+
| Two agents clobber each other | Worktree isolation + live file coordination | Conflict-free parallel work |
|
|
33
|
+
| "Guidelines" get ignored | Policy gates as executable hooks, not prose | Violations are **blocked**, not politely suggested |
|
|
34
|
+
| Same mistake, every session | Memory promotion + pattern learning | The floor gets better every run |
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
**→ Take the full station-by-station tour: [The UAP Delivery Pipeline](docs/guides/DELIVERY_PIPELINE.md).**
|
|
35
37
|
|
|
36
38
|
---
|
|
37
39
|
|
|
@@ -41,12 +43,12 @@ AI coding agents are capable but undisciplined. They forget everything between s
|
|
|
41
43
|
# Install globally
|
|
42
44
|
npm install -g @miller-tech/uap
|
|
43
45
|
|
|
44
|
-
# One-
|
|
46
|
+
# One friendly, arrow-key guided setup in your project
|
|
45
47
|
cd your-project
|
|
46
48
|
uap setup
|
|
47
49
|
```
|
|
48
50
|
|
|
49
|
-
|
|
51
|
+
`uap setup` walks you through the whole line — memory, patterns, policy gates, model routing, multi-agent coordination, and the verification gates — and wires it into every agent session. Take the defaults and you're one Enter away from a disciplined agent.
|
|
50
52
|
|
|
51
53
|
```bash
|
|
52
54
|
uap memory query "how did we handle auth last time?" # semantic recall
|
|
@@ -58,7 +60,7 @@ uap dashboard overview # live task / agent / me
|
|
|
58
60
|
|
|
59
61
|
## The `deliver` harness
|
|
60
62
|
|
|
61
|
-
`uap deliver`
|
|
63
|
+
The two stations that matter most are **Build** and **QC**, and `uap deliver` owns both. It's a **convergence loop that iterates a model against your project's real completion gates until the work is actually delivered** — build passes, tests pass, lint is clean — not until the model *thinks* it's done.
|
|
62
64
|
|
|
63
65
|
```bash
|
|
64
66
|
uap deliver "implement the password reset flow"
|
|
@@ -66,36 +68,36 @@ uap deliver "implement the password reset flow"
|
|
|
66
68
|
|
|
67
69
|
What happens under the hood:
|
|
68
70
|
|
|
69
|
-
1. **Explore → plan → apply** — the model proposes changes; the applier writes them safely (
|
|
70
|
-
2. **Verify against real gates** — a verifier ladder runs your build, tests, and lint. Nothing is "done" until they're green.
|
|
71
|
-
3. **Critique & iterate** — failures feed back as structured guidance
|
|
72
|
-
4. **
|
|
71
|
+
1. **Explore → plan → apply** — the model proposes changes; the applier writes them safely (existing tests and gate configs are protected from being overwritten).
|
|
72
|
+
2. **Verify against real gates** — a verifier ladder runs your build, tests, and lint, and can *execute* the result (headless browser / vm-dom / child process) to prove it runs. Nothing is "done" until they're green.
|
|
73
|
+
3. **Critique & iterate** — failures feed back as structured guidance and the loop continues, persisting until delivered.
|
|
74
|
+
4. **Generator ≠ evaluator** — the check that signs off is deliberately not the model that wrote the code, so an agent can't confirm its own success.
|
|
73
75
|
5. **Autonomy with a guidance channel** — runs the full mission without stopping to ask, while still accepting operator guidance mid-flight.
|
|
74
76
|
|
|
75
77
|
It works with frontier models *and* local models (llama.cpp / Qwen) served over the Anthropic Messages API. See **[docs/guides/DELIVER.md](docs/guides/DELIVER.md)**.
|
|
76
78
|
|
|
77
79
|
---
|
|
78
80
|
|
|
79
|
-
##
|
|
81
|
+
## The line, station by station
|
|
80
82
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
83
|
+
| Station | The break it prevents | Key machinery |
|
|
84
|
+
|---|---|---|
|
|
85
|
+
| **Intake** | Amnesiac sessions, invented scope | [Memory](docs/guides/MEMORY.md), reactor injection, [DESIGN.md](DESIGN.md) |
|
|
86
|
+
| **Prep / routing** | Wrong approach, wrong-sized model | [Multi-model routing](docs/guides/MULTI_MODEL.md), [patterns](docs/reference/PATTERNS.md), [droids & skills](docs/guides/DROIDS_AND_SKILLS.md) |
|
|
87
|
+
| **Isolation** | Editing `main`, clobbering files | [Worktrees](docs/guides/WORKTREE_WORKFLOW.md), live file coordination, delivery gate |
|
|
88
|
+
| **Build** | Plausible-but-wrong code, stubs, empty output | [`uap deliver`](docs/guides/DELIVER.md), serving-layer recipes, [local-model guardrails](docs/guides/LOCAL_MODELS.md) |
|
|
89
|
+
| **QC / verify** | "Done" on code that never ran | Completion gates, `uap verify`, acceptance judge, generator≠evaluator |
|
|
90
|
+
| **Coordination** | Parallel agents colliding/deadlocking | [Coordination](docs/guides/COORDINATION.md), model-slot concurrency, [deploy batching](docs/guides/DEPLOY_BATCHING.md) |
|
|
91
|
+
| **Shipping** | Regressions, red CI, skipped version bumps | Worktree→PR flow, version gates, CI feedback watcher |
|
|
92
|
+
| **Feedback** | The same mistake every session | Memory promotion, pattern learning, session analysis |
|
|
91
93
|
|
|
92
|
-
|
|
94
|
+
Running the whole length of the floor: **policy gates** (24 executable enforcers that *block* non-compliant tool calls — worktree, test, schema-diff, expert-review, delivery-enforcement…) and the **MCP Router** (keeps the context window lean). Full catalog: **[docs/reference/FEATURES.md](docs/reference/FEATURES.md)**.
|
|
93
95
|
|
|
94
96
|
---
|
|
95
97
|
|
|
96
98
|
## Architecture
|
|
97
99
|
|
|
98
|
-
UAP installs hooks into your agent harness, then mediates every tool call through memory, policy, and token-optimization layers.
|
|
100
|
+
UAP installs hooks into your agent harness, then mediates every tool call through the memory, policy, and token-optimization layers — a control booth over the whole line.
|
|
99
101
|
|
|
100
102
|
```
|
|
101
103
|
┌─────────────────────────────────────────────────────────────┐
|
|
@@ -106,32 +108,29 @@ UAP installs hooks into your agent harness, then mediates every tool call throug
|
|
|
106
108
|
▼
|
|
107
109
|
┌─────────────────────────────────────────────────────────────┐
|
|
108
110
|
│ UAP CLI (uap) │
|
|
109
|
-
│ setup · memory · deliver ·
|
|
110
|
-
│ task · droids · model · mcp-router ·
|
|
111
|
+
│ setup · memory · deliver · verify · worktree · policy │
|
|
112
|
+
│ task · coord · droids · model · mcp-router · design … │
|
|
111
113
|
└──┬─────────┬──────────┬──────────┬──────────┬───────────────┘
|
|
112
114
|
▼ ▼ ▼ ▼ ▼
|
|
113
115
|
Memory Policy MCP Router Delivery Coordination
|
|
114
|
-
4 tiers
|
|
116
|
+
4 tiers 24 gates compression + verify + deploy batch
|
|
115
117
|
```
|
|
116
118
|
|
|
117
|
-
- **30+ CLI commands** across 18 source subsystems (
|
|
119
|
+
- **30+ CLI commands** across 18 source subsystems (220+ TypeScript modules).
|
|
118
120
|
- Deep dive: **[docs/architecture/OVERVIEW.md](docs/architecture/OVERVIEW.md)** · protocol spec: **[docs/architecture/PROTOCOL.md](docs/architecture/PROTOCOL.md)**.
|
|
119
121
|
|
|
120
122
|
---
|
|
121
123
|
|
|
122
124
|
## Benchmarks
|
|
123
125
|
|
|
124
|
-
The honest, controlled result (paired A/B — same model, tasks, and seeds,
|
|
125
|
-
toggling only UAP, with confidence intervals): **UAP's accuracy lift depends on
|
|
126
|
-
whether the base agent already self-verifies.**
|
|
126
|
+
The honest, controlled result (paired A/B — same model, tasks, and seeds, toggling only UAP, with confidence intervals): **UAP's accuracy lift depends on whether the base agent already checks its own work at the QC station.**
|
|
127
127
|
|
|
128
128
|
| Baseline | UAP accuracy lift | |
|
|
129
129
|
|---|---|---|
|
|
130
130
|
| Agentic harness (self-tests) | **~0pp** (CI spans 0) | overhead only — value is efficiency/coordination |
|
|
131
131
|
| Non-agentic single-shot model | **+20pp** (78%→98%, 95% CI [+8,+32], p=0.008) | gate loop repairs edge-case bugs |
|
|
132
132
|
|
|
133
|
-
Run it yourself: `uap bench paired --adapter raw --suite benchmarks/suites/real-gate-gated`.
|
|
134
|
-
Full analysis: **[docs/benchmarks/PAIRED_FINDINGS.md](docs/benchmarks/PAIRED_FINDINGS.md)**.
|
|
133
|
+
That's the pipeline thesis in one table: the more an agent skips the QC station on its own, the more UAP's gates are worth. Run it yourself: `uap bench paired --adapter raw --suite benchmarks/suites/real-gate-gated`. Full analysis: **[docs/benchmarks/PAIRED_FINDINGS.md](docs/benchmarks/PAIRED_FINDINGS.md)**.
|
|
135
134
|
|
|
136
135
|
<details><summary>Earlier uncontrolled Terminal-Bench numbers (confounded — see TBench Investigation)</summary>
|
|
137
136
|
|
|
@@ -150,6 +149,8 @@ Methodology, raw runs, and cost analysis: **[docs/benchmarks/](docs/benchmarks/)
|
|
|
150
149
|
|
|
151
150
|
## Supported harnesses
|
|
152
151
|
|
|
152
|
+
Same line, whichever floor you code on.
|
|
153
|
+
|
|
153
154
|
| Harness | Hooks | MCP Router | Policy gates |
|
|
154
155
|
|---|---|---|---|
|
|
155
156
|
| Claude Code | ✅ | ✅ | ✅ |
|
|
@@ -170,6 +171,7 @@ Install into all detected harnesses with `uap hooks install`; audit coverage wit
|
|
|
170
171
|
|
|
171
172
|
| | |
|
|
172
173
|
|---|---|
|
|
174
|
+
| **[The Delivery Pipeline](docs/guides/DELIVERY_PIPELINE.md)** | The station-by-station tour — start here for the big picture |
|
|
173
175
|
| **[Getting Started](docs/getting-started/)** | Installation, quickstart, configuration |
|
|
174
176
|
| **[Guides](docs/guides/)** | deliver, memory, MCP router, worktrees, policies, multi-model, local models |
|
|
175
177
|
| **[Architecture](docs/architecture/)** | System overview + the UAP protocol |
|
|
@@ -186,7 +188,7 @@ Start at the **[documentation index](docs/INDEX.md)**.
|
|
|
186
188
|
```bash
|
|
187
189
|
npm install
|
|
188
190
|
npm run build # TypeScript compile
|
|
189
|
-
npm test # vitest —
|
|
191
|
+
npm test # vitest — 170+ suites
|
|
190
192
|
npm run bench # benchmark suite
|
|
191
193
|
```
|
|
192
194
|
|
package/docs/INDEX.md
CHANGED
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
# UAP Documentation
|
|
2
2
|
|
|
3
|
-
The complete documentation for the **Universal Agent Protocol** (`@miller-tech/uap` v1.
|
|
3
|
+
The complete documentation for the **Universal Agent Protocol** (`@miller-tech/uap` v1.93.1) — the discipline layer that turns a talented-but-unreliable AI coding agent into a dependable member of your software delivery line.
|
|
4
4
|
|
|
5
|
-
New here?
|
|
5
|
+
New here? The friendliest way in is the **[Delivery Pipeline tour](guides/DELIVERY_PIPELINE.md)** — it walks the whole factory floor, station by station, showing where agents normally break and what UAP puts in place to catch it. Then grab the [Quickstart](getting-started/QUICKSTART.md).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Find your way by station
|
|
10
|
+
|
|
11
|
+
UAP is organized like a delivery line. If you know which part of the pipeline you're trying to fix, start here:
|
|
12
|
+
|
|
13
|
+
| Station | The break it prevents | Start with |
|
|
14
|
+
|---|---|---|
|
|
15
|
+
| **Intake** — understand the work | Amnesiac sessions, invented scope | [Memory](guides/MEMORY.md) · [Reactor](design/UAP_REACTOR.md) |
|
|
16
|
+
| **Prep / routing** — right job, right station | Wrong approach or wrong-sized model | [Multi-Model Routing](guides/MULTI_MODEL.md) · [Patterns](reference/PATTERNS.md) · [Droids & Skills](guides/DROIDS_AND_SKILLS.md) |
|
|
17
|
+
| **Isolation** — a bench per job | Editing `main`, clobbering files | [Worktree Workflow](guides/WORKTREE_WORKFLOW.md) |
|
|
18
|
+
| **Build** — make the thing | Plausible-but-wrong code, stubs, empty output | [`uap deliver`](guides/DELIVER.md) · [Local Models](guides/LOCAL_MODELS.md) |
|
|
19
|
+
| **QC / verify** — prove it runs | "Done" on code that never ran | [`uap deliver`](guides/DELIVER.md) · [Policies](guides/POLICIES.md) |
|
|
20
|
+
| **Coordination** — many workers, one floor | Parallel agents colliding | [Coordination](guides/COORDINATION.md) · [Deploy Batching](guides/DEPLOY_BATCHING.md) |
|
|
21
|
+
| **Shipping** — out the door safely | Regressions, red CI, skipped bumps | [Worktree Workflow](guides/WORKTREE_WORKFLOW.md) · [Policies](guides/POLICIES.md) |
|
|
22
|
+
| **Feedback** — the floor learns | The same mistake every session | [Memory](guides/MEMORY.md) · [Self-Harness](design/SELF_HARNESS.md) |
|
|
23
|
+
| *Cross-cutting* — the whole line | Ignored rules, bloated context | [Policies](guides/POLICIES.md) · [MCP Router](guides/MCP_ROUTER.md) |
|
|
24
|
+
|
|
25
|
+
Full map: **[The UAP Delivery Pipeline](guides/DELIVERY_PIPELINE.md)**.
|
|
6
26
|
|
|
7
27
|
---
|
|
8
28
|
|
|
@@ -12,14 +32,15 @@ New here? Start with the [project README](../README.md), then [Getting Started](
|
|
|
12
32
|
|---|---|
|
|
13
33
|
| [Installation](getting-started/INSTALLATION.md) | Prerequisites, `npm install -g @miller-tech/uap`, what `uap setup` does, per-harness hook install |
|
|
14
34
|
| [Quickstart](getting-started/QUICKSTART.md) | 5-minute path: setup → memory → `uap deliver` → dashboard |
|
|
15
|
-
| [Configuration](getting-started/CONFIGURATION.md) | `.uap.json`, environment variables, Qdrant, model profiles |
|
|
35
|
+
| [Configuration](getting-started/CONFIGURATION.md) | `.uap.json`, environment variables, `.uap/proxy.env`, Qdrant, model profiles |
|
|
16
36
|
|
|
17
37
|
## Guides
|
|
18
38
|
|
|
19
39
|
| Doc | What it covers |
|
|
20
40
|
|---|---|
|
|
41
|
+
| [**The Delivery Pipeline**](guides/DELIVERY_PIPELINE.md) | The station-by-station tour — the big-picture map of the whole floor ⭐ |
|
|
21
42
|
| [**What UAP Does Automatically**](guides/AUTOMATIC_FEATURES.md) | Every feature in benefit / when-it-kicks-in terms — install once, it all self-applies ⭐ |
|
|
22
|
-
| [**`uap deliver`**](guides/DELIVER.md) | The
|
|
43
|
+
| [**`uap deliver`**](guides/DELIVER.md) | The Build+QC harness — convergence loop to verified completion, tiered gates, CI/deploy feedback loop ⭐ |
|
|
23
44
|
| [Memory](guides/MEMORY.md) | The 4-tier memory system, write-gates, semantic recall |
|
|
24
45
|
| [MCP Router](guides/MCP_ROUTER.md) | Token-optimizing tool proxy + FTS5 output compression |
|
|
25
46
|
| [Worktree Workflow](guides/WORKTREE_WORKFLOW.md) | Branch-per-feature isolation, auto-PR, enforcement |
|
|
@@ -35,10 +56,10 @@ New here? Start with the [project README](../README.md), then [Getting Started](
|
|
|
35
56
|
|
|
36
57
|
| Doc | What it covers |
|
|
37
58
|
|---|---|
|
|
38
|
-
| [Overview](architecture/OVERVIEW.md) | System architecture
|
|
59
|
+
| [Overview](architecture/OVERVIEW.md) | System architecture as the delivery-line floor plan; subsystems, tool-call flow |
|
|
39
60
|
| [Protocol](architecture/PROTOCOL.md) | The harness↔UAP contract, hook lifecycle, decision loop |
|
|
40
61
|
| [Reactor (auto-apply)](design/UAP_REACTOR.md) | Dynamic experts/skills/patterns injected per prompt across harnesses; the assist vs enforce model, per-harness wiring |
|
|
41
|
-
| [Self-Harness (proposal)](design/SELF_HARNESS.md) | Self-improving harness: autonomous mine→propose→validate loop over a bounded Mod DSL
|
|
62
|
+
| [Self-Harness (proposal)](design/SELF_HARNESS.md) | Self-improving harness: autonomous mine→propose→validate loop over a bounded Mod DSL; cross-model transfer, online mining |
|
|
42
63
|
|
|
43
64
|
## Reference
|
|
44
65
|
|
|
@@ -46,7 +67,7 @@ New here? Start with the [project README](../README.md), then [Getting Started](
|
|
|
46
67
|
|---|---|
|
|
47
68
|
| [CLI](reference/CLI.md) | Every `uap` command and flag |
|
|
48
69
|
| [API](reference/API.md) | Programmatic API surface |
|
|
49
|
-
| [Features](reference/FEATURES.md) | Full feature catalog
|
|
70
|
+
| [Features](reference/FEATURES.md) | Full feature catalog, mapped to the pipeline stages |
|
|
50
71
|
| [Patterns](reference/PATTERNS.md) | The 23 Terminal-Bench patterns |
|
|
51
72
|
| [Platforms](reference/PLATFORMS.md) | The 9 supported harnesses + support matrix |
|
|
52
73
|
| [Configuration](reference/CONFIGURATION.md) | All config files and env vars |
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
# UAP Architecture Overview
|
|
2
2
|
|
|
3
|
-
`v1.
|
|
3
|
+
`v1.93.1` · 223 TypeScript modules across 18 `src/` subsystems · 170+ test suites
|
|
4
|
+
|
|
5
|
+
> **🏭 Where this fits:** Whole pipeline — this is the factory-floor map. A bare
|
|
6
|
+
> agent walks work from an idea to a shipped change with no stations in between,
|
|
7
|
+
> so it forgets context, edits the wrong branch, writes plausible-but-broken
|
|
8
|
+
> code, declares "done" on a red build, and repeats the mistake next session.
|
|
9
|
+
> **What it delivers:** a station at every stage where an agentic workflow
|
|
10
|
+
> normally breaks, so your agent's output comes off the line understood,
|
|
11
|
+
> isolated, built, verified, coordinated, shipped, and remembered.
|
|
12
|
+
|
|
13
|
+
Think of UAP as the **software-delivery pipeline** your agent runs on — a
|
|
14
|
+
sausage-factory floor where each station guards one stage of turning an
|
|
15
|
+
instruction into a merged, working change. The stations are UAP's subsystems.
|
|
16
|
+
This document is the floor plan: what each station is, and which break it
|
|
17
|
+
prevents. For the end-to-end walkthrough, see the
|
|
18
|
+
[delivery pipeline guide](../guides/DELIVERY_PIPELINE.md).
|
|
4
19
|
|
|
5
20
|
The Universal Agent Protocol (UAP) is a layer that sits **underneath** an AI
|
|
6
21
|
coding agent's harness — Claude Code, Factory, Cursor, OpenCode, Codex, and
|
|
@@ -16,11 +31,36 @@ harness↔UAP contract, see [PROTOCOL.md](PROTOCOL.md).
|
|
|
16
31
|
|
|
17
32
|
---
|
|
18
33
|
|
|
34
|
+
## The pipeline at a glance
|
|
35
|
+
|
|
36
|
+
Every station below maps to a stage where a normal agentic workflow breaks, and
|
|
37
|
+
to the subsystem that guards it. Read this as the conveyor belt your work rides:
|
|
38
|
+
|
|
39
|
+
| Stage | What breaks without a station | Station (subsystem) |
|
|
40
|
+
|-------|-------------------------------|---------------------|
|
|
41
|
+
| **1. Intake** — understand the work | agent forgets past sessions, hallucinates scope | 4-tier **memory**, **reactor** per-prompt injection, DESIGN.md |
|
|
42
|
+
| **2. Prep / routing** — pick the approach | wrong model, wrong tactic | pattern router, query-complexity, **multi-model routing**, recipe selection |
|
|
43
|
+
| **3. Isolation** — protect the tree | agent edits `master`, clobbers files, collides | **worktree**-per-feature, **file coordination**, delivery gate |
|
|
44
|
+
| **4. Build** — write the code | plausible-but-wrong code, stubs, empty/looping local-model output | **deliver** loop, serving-layer recipes, proxy guardrails, local-model handling |
|
|
45
|
+
| **5. QC / verify** — prove it works | *the big one:* agent says "done" on broken code and self-grades wrong | **completion gates**, execution/runtime verify, **acceptance judge**, generator≠evaluator, tiered gates |
|
|
46
|
+
| **6. Line coordination** — many hands | parallel agents collide, duplicate, deadlock | **coordination DB**, collaboration board + challenge, model-slot concurrency, deploy batching |
|
|
47
|
+
| **7. Shipping** — merge & release | regressions, broken CI, skipped version bumps | worktree→PR flow, version/completion gates, CI feedback watcher, never-regress, git-safety |
|
|
48
|
+
| **8. Feedback** — learn from it | same mistake every session | **memory promotion**, pattern RL, session analysis |
|
|
49
|
+
|
|
50
|
+
Cross-cutting through every station: **policy gates** are the executable rules
|
|
51
|
+
posted at each station, the **MCP Router** keeps the context lean so the belt
|
|
52
|
+
never jams, and UAP runs across **9 harnesses** so the same floor plan applies
|
|
53
|
+
wherever your agent works.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
19
57
|
## The hook-mediation model
|
|
20
58
|
|
|
21
59
|
A bare agent harness calls a tool (Edit, Write, Bash, a spawned sub-agent, an
|
|
22
60
|
MCP tool) and the model sees the raw result. UAP inserts itself between the
|
|
23
|
-
harness and the tool by registering hooks at the harness's interception points
|
|
61
|
+
harness and the tool by registering hooks at the harness's interception points —
|
|
62
|
+
this is how every station gets a chance to inspect the work before it moves down
|
|
63
|
+
the line:
|
|
24
64
|
|
|
25
65
|
- **Claude Code / VSCode / Factory / Cursor** — `PreToolUse` hooks
|
|
26
66
|
- **OpenCode** — the `tool.execute.before` plugin hook
|
|
@@ -93,9 +133,14 @@ src/
|
|
|
93
133
|
|
|
94
134
|
---
|
|
95
135
|
|
|
96
|
-
## Subsystems
|
|
136
|
+
## Subsystems (station by station)
|
|
97
137
|
|
|
98
|
-
### Memory (`src/memory/`)
|
|
138
|
+
### Memory (`src/memory/`) — Intake & Feedback stations
|
|
139
|
+
|
|
140
|
+
**The break it prevents:** at intake, a fresh agent has amnesia — it re-litigates
|
|
141
|
+
solved problems and hallucinates scope. At feedback, it drops the lesson it just
|
|
142
|
+
learned and repeats the mistake tomorrow. Memory is the station that carries
|
|
143
|
+
context onto the belt and carries lessons back off it.
|
|
99
144
|
|
|
100
145
|
A four-tier memory system that gives the agent persistent context across
|
|
101
146
|
sessions. The tiers (`src/memory/README.md`):
|
|
@@ -124,7 +169,9 @@ Key modules:
|
|
|
124
169
|
- `memory-consolidator.ts` — summarizes working entries into session memory,
|
|
125
170
|
extracts lessons, and dedups by content hash + embedding similarity.
|
|
126
171
|
- `write-gate.ts` — a quality filter that scores candidate memories and only
|
|
127
|
-
persists those above threshold (prevents memory pollution).
|
|
172
|
+
persists those above threshold (prevents memory pollution). This is the
|
|
173
|
+
feedback station's own gate: only lessons that change future behavior get
|
|
174
|
+
promoted.
|
|
128
175
|
- `knowledge-graph.ts` — the L4 graph: upsert entities, strengthen
|
|
129
176
|
relationships, recursive-CTE traversal.
|
|
130
177
|
- `context-compressor.ts` / `semantic-compression.ts` — token budgeting and
|
|
@@ -135,7 +182,11 @@ Key modules:
|
|
|
135
182
|
- `model-router.ts` — benchmark-fingerprint LLM routing with feedback learning
|
|
136
183
|
(consumed by `src/models/unified-router.ts`).
|
|
137
184
|
|
|
138
|
-
### MCP Router (`src/mcp-router/`)
|
|
185
|
+
### MCP Router (`src/mcp-router/`) — cross-cutting: keep the belt from jamming
|
|
186
|
+
|
|
187
|
+
**The break it prevents:** a context window flooded with tool schemas and raw
|
|
188
|
+
tool output stalls every station downstream. The router keeps context lean so
|
|
189
|
+
work keeps moving.
|
|
139
190
|
|
|
140
191
|
A hierarchical Model Context Protocol router that achieves large token savings
|
|
141
192
|
by two independent mechanisms (`src/mcp-router/server.ts`,
|
|
@@ -158,7 +209,12 @@ The design target documented in source is ~75,000 tokens of tool definitions
|
|
|
158
209
|
collapsed to ~700 (98%+). Per-output FTS5 savings are computed live per call.
|
|
159
210
|
See [../integrations/MCP_ROUTER.md](../integrations/MCP_ROUTER.md) for setup.
|
|
160
211
|
|
|
161
|
-
### Policies (`src/policies/`)
|
|
212
|
+
### Policies (`src/policies/`) — cross-cutting: the rules posted at every station
|
|
213
|
+
|
|
214
|
+
**The break it prevents:** rules that live in a README are advisory and get
|
|
215
|
+
skipped under pressure. Policies are the executable rules bolted to each
|
|
216
|
+
station — worktree, task, delivery, tests, review — so a violation stops the
|
|
217
|
+
belt instead of sliding through.
|
|
162
218
|
|
|
163
219
|
Project guidelines expressed as **executable hook gates** rather than prose.
|
|
164
220
|
Two layers:
|
|
@@ -179,14 +235,23 @@ Enforcers cover the worktree gate (`worktree_required.py`), task discipline
|
|
|
179
235
|
(`schema_diff_gate.py`), memory-before-plan, MCP-router-first, RTK wrapping, and
|
|
180
236
|
more. Levels: **REQUIRED** blocks, **RECOMMENDED** logs, **OPTIONAL** informs.
|
|
181
237
|
|
|
182
|
-
### Delivery — `uap deliver` (`src/delivery/`)
|
|
238
|
+
### Delivery — `uap deliver` (`src/delivery/`) — Build & QC stations
|
|
239
|
+
|
|
240
|
+
**The break it prevents:** this is the heart of the floor. Left alone, an agent
|
|
241
|
+
emits plausible-but-wrong code and declares victory on a red build. The deliver
|
|
242
|
+
loop won't let the work leave the Build/QC stations until the project's *real*
|
|
243
|
+
gates actually pass.
|
|
183
244
|
|
|
184
245
|
A 15-module convergence loop that drives an underlying model against the
|
|
185
246
|
project's **real** completion gates until the work actually passes — the
|
|
186
247
|
mechanism behind UAP's "agents stop declaring victory on broken code." See the
|
|
187
248
|
[deliver flow](#how-uap-deliver-orchestrates) below.
|
|
188
249
|
|
|
189
|
-
### Coordination (`src/coordination/`)
|
|
250
|
+
### Coordination (`src/coordination/`) — Isolation & Line-coordination stations
|
|
251
|
+
|
|
252
|
+
**The break it prevents:** put two agents on one repo and they edit the same
|
|
253
|
+
file, duplicate work, or deadlock. This station gives every agent its own lane,
|
|
254
|
+
announces who's touching what, and blocks live same-file collisions.
|
|
190
255
|
|
|
191
256
|
Lets multiple agents work the same repo without colliding. A singleton SQLite
|
|
192
257
|
DB (`database.ts`) backs an agent registry, work announcements, work claims,
|
|
@@ -208,7 +273,11 @@ droids from `capability-router.ts`. `pattern-router.ts` matches tasks to
|
|
|
208
273
|
Terminal-Bench patterns (always enforcing **P12** Output Existence and
|
|
209
274
|
**P35** Decoder-First).
|
|
210
275
|
|
|
211
|
-
### Models (`src/models/`)
|
|
276
|
+
### Models (`src/models/`) — Prep / routing station
|
|
277
|
+
|
|
278
|
+
**The break it prevents:** an agent that reaches for the same model on every task
|
|
279
|
+
either overpays for trivial edits or under-powers a hard migration. This station
|
|
280
|
+
picks the right approach and model before the work hits the belt.
|
|
212
281
|
|
|
213
282
|
Multi-model routing. `router.ts` classifies a task (complexity + type from
|
|
214
283
|
keyword scoring) and `selectModel()` picks a model per the routing strategy —
|
|
@@ -221,7 +290,12 @@ model per subtask; `executor.ts` runs the plan level-by-level with retries and
|
|
|
221
290
|
fallback; `execution-profiles.ts` tunes *how* the chosen model runs
|
|
222
291
|
(temperature, budgets); `analytics.ts` records outcomes so routing improves.
|
|
223
292
|
|
|
224
|
-
### Tasks (`src/tasks/`)
|
|
293
|
+
### Tasks (`src/tasks/`) — Prep / routing & Line-coordination stations
|
|
294
|
+
|
|
295
|
+
**The break it prevents:** work without a tracked task drifts scope, races other
|
|
296
|
+
agents on the same files, and starts before its prerequisites are ready. This
|
|
297
|
+
station gates each task through a decoder-first check and hands claims to the
|
|
298
|
+
coordination lane.
|
|
225
299
|
|
|
226
300
|
A dependency-aware task tracker (a Beads alternative) backed by SQLite
|
|
227
301
|
(`tasks`, `task_dependencies`, `task_history`, `task_activity`,
|
|
@@ -232,18 +306,29 @@ release with overlap detection); `decoder-gate.ts` implements the P35
|
|
|
232
306
|
Decoder-First pre-execution validator (droid schema, tool availability,
|
|
233
307
|
claim conflicts, worktree requirement, ambiguity).
|
|
234
308
|
|
|
235
|
-
### Dashboard (`src/dashboard/`)
|
|
309
|
+
### Dashboard (`src/dashboard/`) — floor visibility
|
|
310
|
+
|
|
311
|
+
**The break it prevents:** a floor you can't see is a floor you can't trust. This
|
|
312
|
+
gives you a live view of every station.
|
|
236
313
|
|
|
237
314
|
A live visualization layer (`uap dashboard`) over tasks, agents, memory,
|
|
238
315
|
policies, models, and benchmark/session history, with an event stream for
|
|
239
316
|
real-time updates.
|
|
240
317
|
|
|
241
|
-
### Observability (`src/observability/`)
|
|
318
|
+
### Observability (`src/observability/`) — Feedback station
|
|
319
|
+
|
|
320
|
+
**The break it prevents:** without traces you can't tell *why* a run failed, so
|
|
321
|
+
the floor never improves. This station records what really happened so the
|
|
322
|
+
pipeline can be tuned.
|
|
242
323
|
|
|
243
324
|
Emits HALO / OpenInference spans for delivery runs and tool calls, consumed by
|
|
244
325
|
`uap harness analyze` to optimize agent execution from real traces.
|
|
245
326
|
|
|
246
|
-
### Benchmark harness (`src/benchmarks/paired/`)
|
|
327
|
+
### Benchmark harness (`src/benchmarks/paired/`) — measuring the floor
|
|
328
|
+
|
|
329
|
+
**The break it prevents:** claims that a station helps are worthless without a
|
|
330
|
+
controlled measurement. This harness toggles only the UAP scaffold and reports
|
|
331
|
+
the honest delta.
|
|
247
332
|
|
|
248
333
|
A controlled paired-A/B harness (`uap bench paired`) for measuring UAP's impact
|
|
249
334
|
without confounds. It holds the base model + agent constant and toggles **only**
|
|
@@ -261,7 +346,8 @@ is **+20pp** over a non-agentic baseline and **~0pp** over an agentic one.
|
|
|
261
346
|
|
|
262
347
|
## How a tool call flows: memory → policy → MCP Router
|
|
263
348
|
|
|
264
|
-
|
|
349
|
+
This is one item riding the belt through the mediation stations. For a
|
|
350
|
+
representative `execute_tool` call routed through the UAP MCP server:
|
|
265
351
|
|
|
266
352
|
```
|
|
267
353
|
1. Tool call arrives at the PreToolUse hook.
|
|
@@ -294,8 +380,10 @@ decision loop defined normatively in [PROTOCOL.md](PROTOCOL.md#agent-decision-lo
|
|
|
294
380
|
|
|
295
381
|
## How `uap deliver` orchestrates
|
|
296
382
|
|
|
297
|
-
|
|
298
|
-
|
|
383
|
+
This is the Build/QC station's inner mechanism — the part that refuses to pass
|
|
384
|
+
work down the line until it actually runs green. `uap deliver "<instruction>"`
|
|
385
|
+
runs `ConvergenceLoop.deliver()` (`src/delivery/convergence-loop.ts`). The
|
|
386
|
+
staged flow:
|
|
299
387
|
|
|
300
388
|
```
|
|
301
389
|
detect gates ──▶ baseline check ──▶ protect files ──▶ ╔═════ turn loop ═════╗
|
|
@@ -344,6 +432,7 @@ ceiling (default 30, hard cap 50), and stops once progress stalls.
|
|
|
344
432
|
## See also
|
|
345
433
|
|
|
346
434
|
- [PROTOCOL.md](PROTOCOL.md) — the harness↔UAP contract and agent loop
|
|
435
|
+
- [../guides/DELIVERY_PIPELINE.md](../guides/DELIVERY_PIPELINE.md) — the end-to-end delivery-pipeline walkthrough
|
|
347
436
|
- [../integrations/MCP_ROUTER.md](../integrations/MCP_ROUTER.md) — MCP Router setup
|
|
348
437
|
- [../integrations/RTK.md](../integrations/RTK.md) — RTK (Rust Token Killer)
|
|
349
438
|
- [../../CONTRIBUTING.md](../../CONTRIBUTING.md) — development workflow
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# The UAP Protocol
|
|
2
2
|
|
|
3
|
-
`v1.
|
|
3
|
+
`v1.93.1`
|
|
4
|
+
|
|
5
|
+
> **🏭 Where this fits:** Cross-cutting (the factory rulebook) — with no shared
|
|
6
|
+
> contract, each station's rules are guesswork and your agent slips broken work
|
|
7
|
+
> past whichever gate it doesn't recognize. **What it delivers:** the normative
|
|
8
|
+
> hook-and-gate contract that makes every station on the
|
|
9
|
+
> [delivery pipeline](../guides/DELIVERY_PIPELINE.md) enforceable and portable —
|
|
10
|
+
> the same rules apply whichever harness runs the line.
|
|
4
11
|
|
|
5
12
|
This document specifies the **Universal Agent Protocol** itself: the contract
|
|
6
13
|
between an AI agent harness and the UAP layer beneath it. It is normative —
|
|
@@ -13,6 +20,12 @@ set of interception points the harness exposes, a defined hook lifecycle, an
|
|
|
13
20
|
agent decision loop, and a set of gates that block work which violates the
|
|
14
21
|
contract. Any harness that can run a hook before tool execution can host UAP.
|
|
15
22
|
|
|
23
|
+
Read the sections below as the rules posted at each station on the floor:
|
|
24
|
+
session start feeds the **intake** station, the pre-tool-use gates guard
|
|
25
|
+
**isolation** and **build**, the decision loop threads **intake → build →
|
|
26
|
+
feedback**, the worktree convention is the **isolation** station itself, and the
|
|
27
|
+
completion gates are the **QC/verify** station that stops "done"-on-broken-code.
|
|
28
|
+
|
|
16
29
|
---
|
|
17
30
|
|
|
18
31
|
## 1. The harness ↔ UAP contract
|
|
@@ -55,7 +68,8 @@ Hook scripts are generated and installed by `uap hooks install`
|
|
|
55
68
|
|
|
56
69
|
### 2.1 Session start
|
|
57
70
|
|
|
58
|
-
On session start the harness runs the session-start
|
|
71
|
+
The **intake station.** On session start the harness runs the session-start
|
|
72
|
+
hook, which MUST:
|
|
59
73
|
|
|
60
74
|
1. **Inject memory.** Query the short-term store (last-24h top memories plus
|
|
61
75
|
open "session" loops of type action/goal/decision with importance ≥ 7) and
|
|
@@ -70,8 +84,8 @@ context, not a gate.
|
|
|
70
84
|
|
|
71
85
|
### 2.2 Pre-tool-use
|
|
72
86
|
|
|
73
|
-
Before each tool call the harness runs the
|
|
74
|
-
relevant gates for that tool. Conceptually:
|
|
87
|
+
The **isolation and build gates.** Before each tool call the harness runs the
|
|
88
|
+
pre-tool-use hook, which runs the relevant gates for that tool. Conceptually:
|
|
75
89
|
|
|
76
90
|
```
|
|
77
91
|
pre-tool-use(tool, args):
|
|
@@ -96,9 +110,10 @@ across context compaction; the stop hook runs a completion checklist.
|
|
|
96
110
|
|
|
97
111
|
## 3. Agent decision loop
|
|
98
112
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
113
|
+
The belt path itself: intake pulls context in, act builds, and feedback carries
|
|
114
|
+
lessons back out. A conforming agent SHOULD execute each task through this loop.
|
|
115
|
+
The TypeScript implementation lives in `src/memory/dynamic-retrieval.ts` (query)
|
|
116
|
+
and the short-term store / consolidator (record, promote).
|
|
102
117
|
|
|
103
118
|
```
|
|
104
119
|
┌──────────────────────────────────────────────┐
|
|
@@ -131,9 +146,10 @@ transient debugging state, and secrets MUST NOT be promoted.
|
|
|
131
146
|
|
|
132
147
|
## 4. Worktree convention
|
|
133
148
|
|
|
134
|
-
All file edits MUST happen inside a git worktree
|
|
135
|
-
Edits to the project root are blocked by the
|
|
136
|
-
(`worktree_required.py`)
|
|
149
|
+
The **isolation station.** All file edits MUST happen inside a git worktree
|
|
150
|
+
under `.worktrees/NNN-<slug>/`. Edits to the project root are blocked by the
|
|
151
|
+
worktree gate (`worktree_required.py`) — this is what keeps your agent off
|
|
152
|
+
`master` and out of another agent's lane.
|
|
137
153
|
|
|
138
154
|
```bash
|
|
139
155
|
uap worktree ensure --strict # verify you are inside a worktree (exit 0)
|
|
@@ -158,9 +174,11 @@ Rules:
|
|
|
158
174
|
|
|
159
175
|
## 5. Completion gates
|
|
160
176
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
177
|
+
The **QC/verify station — the one everyone skips.** Claiming a code change is
|
|
178
|
+
DONE is prohibited until all gates pass; this is where "the agent said done on a
|
|
179
|
+
red build" gets caught. The gates are decomposed across policy enforcers and the
|
|
180
|
+
`review`-stage policy logic in `policy-gate.ts` (auto-forced on completion /
|
|
181
|
+
merge / deploy operations):
|
|
164
182
|
|
|
165
183
|
| Gate | Enforcer / mechanism | Requirement |
|
|
166
184
|
|------|----------------------|-------------|
|
|
@@ -7,6 +7,14 @@
|
|
|
7
7
|
> (Weakness Mining → Harness Proposal → Proposal Validation), no human engineer. Reports
|
|
8
8
|
> Terminal-Bench-2.0 lifts incl. **Qwen3.5-35B-A3B 23.8%→38.1%** (our model's sibling).
|
|
9
9
|
|
|
10
|
+
> **🏭 Where this fits:** Feedback station (the floor tunes its own machines) —
|
|
11
|
+
> without it, the same failure mode recurs every run and a human has to hand-tune
|
|
12
|
+
> the harness for each new model, which doesn't scale. **What it delivers:** an
|
|
13
|
+
> autonomous loop that mines real failure traces, proposes bounded harness fixes,
|
|
14
|
+
> validates them against real gates, and keeps only the winners — so the whole
|
|
15
|
+
> [delivery pipeline](../guides/DELIVERY_PIPELINE.md) gets better at building the
|
|
16
|
+
> next change instead of repeating the last mistake.
|
|
17
|
+
|
|
10
18
|
## 1. Why this, why now
|
|
11
19
|
|
|
12
20
|
The paper's thesis is exactly the lesson of our manual harness-tuning campaign on Qwen3.6-35B-A3B:
|