@miller-tech/uap 1.52.0 → 1.52.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 CHANGED
@@ -121,7 +121,19 @@ UAP installs hooks into your agent harness, then mediates every tool call throug
121
121
 
122
122
  ## Benchmarks
123
123
 
124
- Terminal-Bench 2.0, 12 representative tasks, UAP-on vs. baseline:
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.**
127
+
128
+ | Baseline | UAP accuracy lift | |
129
+ |---|---|---|
130
+ | Agentic harness (self-tests) | **~0pp** (CI spans 0) | overhead only — value is efficiency/coordination |
131
+ | Non-agentic single-shot model | **+20pp** (78%→98%, 95% CI [+8,+32], p=0.008) | gate loop repairs edge-case bugs |
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)**.
135
+
136
+ <details><summary>Earlier uncontrolled Terminal-Bench numbers (confounded — see TBench Investigation)</summary>
125
137
 
126
138
  | Metric | Baseline | With UAP | Δ |
127
139
  |---|---|---|---|
@@ -130,6 +142,8 @@ Terminal-Bench 2.0, 12 representative tasks, UAP-on vs. baseline:
130
142
  | Errors per task | 1.17 | 0.42 | **−68%** |
131
143
  | Wall-clock (total) | 618s | 266s | **−57%** |
132
144
 
145
+ </details>
146
+
133
147
  Methodology, raw runs, and cost analysis: **[docs/benchmarks/](docs/benchmarks/)**.
134
148
 
135
149
  ---
package/docs/INDEX.md CHANGED
@@ -62,7 +62,9 @@ New here? Start with the [project README](../README.md), then [Getting Started](
62
62
 
63
63
  | Doc | What it covers |
64
64
  |---|---|
65
- | [**TBench Investigation**](benchmarks/TBENCH_INVESTIGATION.md) | Rigorous findings: no measurable UAP-context lift (every gain was a confound), methodology lessons, and the improvement plan ⭐ |
65
+ | [**Paired Findings**](benchmarks/PAIRED_FINDINGS.md) | Controlled A/B results: UAP gate value is +20pp vs a non-agentic baseline [CI +8,+32], ~0pp vs an agentic one — with confidence intervals ⭐ |
66
+ | [Paired Harness](benchmarks/PAIRED_HARNESS.md) | The `uap bench paired` controlled-A/B harness: design, adapters (mock/opencode/claude/raw), authoring tasks |
67
+ | [TBench Investigation](benchmarks/TBENCH_INVESTIGATION.md) | Earlier finding: no measurable UAP-context lift (every uncontrolled gain was a confound), methodology lessons |
66
68
  | [Validation Results](benchmarks/VALIDATION_RESULTS.md) | Terminal-Bench 2.0 results (−49.7% tokens, +33pp success) |
67
69
  | [Token Optimization](benchmarks/TOKEN_OPTIMIZATION.md) | Where the token savings come from |
68
70
  | [Accuracy Analysis](benchmarks/ACCURACY_ANALYSIS.md) | Success-rate and error analysis |
@@ -190,8 +190,15 @@ mechanism behind UAP's "agents stop declaring victory on broken code." See the
190
190
 
191
191
  Lets multiple agents work the same repo without colliding. A singleton SQLite
192
192
  DB (`database.ts`) backs an agent registry, work announcements, work claims,
193
- inter-agent messages, and a deploy queue. `service.ts` detects **overlap** when
194
- agents announce work on the same files and suggests merge order;
193
+ inter-agent messages, and a deploy queue. The DB is **shared across all
194
+ worktrees** (resolved via `git --git-common-dir` to the main worktree), so agents
195
+ in different `.worktrees/` see each other. Coordination is **always-on, not
196
+ advisory**: `session-start.sh` auto-registers every agent (+ heartbeat), and the
197
+ pre-edit hook (`coordinate-file.sh`) announces each file edit and **blocks** when
198
+ another *live* agent (heartbeat < 120s) is editing the same repo-relative path,
199
+ warning + self-healing stale announcements otherwise; `session-end.sh` reaps only
200
+ stale state so one agent ending never wipes live peers. `service.ts` detects
201
+ **overlap** when agents announce work on the same files and suggests merge order;
195
202
  `deploy-batcher.ts` queues git/CI actions with per-type batch windows
196
203
  (commit 30s, push 5s, merge 10s, deploy 60s), folds/squashes similar pending
197
204
  actions, and executes batches sequentially or in parallel.
@@ -236,6 +243,20 @@ real-time updates.
236
243
  Emits HALO / OpenInference spans for delivery runs and tool calls, consumed by
237
244
  `uap harness analyze` to optimize agent execution from real traces.
238
245
 
246
+ ### Benchmark harness (`src/benchmarks/paired/`)
247
+
248
+ A controlled paired-A/B harness (`uap bench paired`) for measuring UAP's impact
249
+ without confounds. It holds the base model + agent constant and toggles **only**
250
+ the UAP scaffold over the same real-gate task suite and seeds, reporting a vector
251
+ of paired deltas (correctness + tokens/turns/latency) with bootstrap confidence
252
+ intervals, a McNemar gate-value 2×2, and per-component leave-one-out ablation.
253
+ Pluggable `AgentAdapter`s drive the agent under test: `opencode`/`claude`
254
+ subprocess adapters, a deterministic `mock`, and a non-agentic `raw`
255
+ single-shot-vs-gate-loop adapter that isolates gate value. Ground truth is a
256
+ deterministic per-task `verifyCmd` (no LLM judge). The headline result lives in
257
+ [benchmarks/PAIRED_FINDINGS.md](../benchmarks/PAIRED_FINDINGS.md): UAP gate value
258
+ is **+20pp** over a non-agentic baseline and **~0pp** over an agentic one.
259
+
239
260
  ---
240
261
 
241
262
  ## How a tool call flows: memory → policy → MCP Router
@@ -0,0 +1,147 @@
1
+ # Paired Benchmark Findings — When Does UAP Actually Help?
2
+
3
+ Results from the controlled paired harness (`uap bench paired`, see
4
+ [PAIRED_HARNESS.md](PAIRED_HARNESS.md)). These supersede earlier uncontrolled
5
+ numbers and complete the story the [TBench Investigation](TBENCH_INVESTIGATION.md)
6
+ started: every "UAP lift" measured without a controlled baseline turned out to be
7
+ a confound. This is the rigorous version — same model, same tasks, same seeds,
8
+ toggling **only** the UAP layer, with bootstrap confidence intervals on every
9
+ delta.
10
+
11
+ ## TL;DR
12
+
13
+ > **UAP's accuracy lift depends entirely on whether the base agent already
14
+ > self-verifies.** Against a strong agentic harness (opencode, which runs the
15
+ > tests itself), UAP adds overhead with **no measurable accuracy gain**. Against
16
+ > a non-agentic single-shot model, UAP's gate loop delivers **+20pp accuracy**
17
+ > (78% → 98%, 95% CI [+8, +32], p=0.008) by catching and repairing edge-case
18
+ > bugs the model ships in one shot.
19
+
20
+ | Baseline type | UAP accuracy lift | What this means |
21
+ |---|---|---|
22
+ | **Agentic** (opencode self-tests) | **~0pp** (CI spans 0) | gate is redundant; cost is pure overhead |
23
+ | **Non-agentic** (raw single-shot) | **+20pp** [CI +8, +32] | gate loop rescues failures the model can't self-catch |
24
+
25
+ The headline implication: **UAP's gate value is real and large, but only over a
26
+ baseline that doesn't already loop** — which is exactly the `uap deliver`
27
+ (model-wrapping) case. When you are already driving a capable agentic harness,
28
+ UAP's contribution shifts from *accuracy* to *efficiency, coordination, and
29
+ never-regress*.
30
+
31
+ ## The experiments
32
+
33
+ Five controlled runs against `ik-llama/qwen36-35b-a3b-iq4xs` (a 35B-A3B MoE).
34
+ All paired, all with deterministic ground-truth `verifyCmd` scorers (no LLM
35
+ judge). Metrics reported as a vector — correctness **and** tokens/turns/latency —
36
+ each as a paired delta with a 95% bootstrap CI and a sign-flip permutation
37
+ p-value. Correctness deltas additionally get a McNemar 2×2 ("fixed" vs
38
+ "regressed").
39
+
40
+ ### 1–3. Agentic baseline (opencode adapter)
41
+
42
+ | Run | Suite | Design | baseline → uap-full | Token Δ |
43
+ |---|---|---|---|---|
44
+ | 1 | real-gate (easy) | 2 tasks × 2 × 6 | 100% → 100% | +34.2k |
45
+ | 2 | real-gate-hard | 6 tasks × 8-arm ablation × 4 | 100% → 100% | +48.7k [13.9k, 93.3k] |
46
+ | 3 | real-gate-gated | 5 edge-case tasks × 8-arm ablation × 4 | 100% → 100% | +25.2k (n.s.) |
47
+
48
+ In every agentic run the **baseline already scored 100%** — there was no headroom
49
+ for UAP to improve accuracy. The per-component ablation (turning off gates /
50
+ worktree / memory / experts / skills / patterns one at a time) found **no
51
+ component with a Δsuccess confidence interval above zero**; the token deltas only
52
+ rank overhead.
53
+
54
+ **Root cause:** opencode is itself an agentic harness that runs the in-repo
55
+ tests and self-corrects by default. The UAP gate instruction is redundant on top
56
+ of an agent that already self-verifies — and adding in-repo tests to give the
57
+ "gate" something to run handed the same self-verification to the *baseline*.
58
+
59
+ ### 4. Non-agentic baseline (raw single-shot vs gate loop) — the decisive run
60
+
61
+ To isolate **gate value**, the `raw` adapter calls the model's completion
62
+ endpoint directly:
63
+
64
+ - **baseline** = one completion, no self-check (whatever it writes is final)
65
+ - **uap-full** = execute → run the visible in-repo gate → feed the failure back
66
+ → regenerate, looping until the gate passes (the `uap deliver` mechanism in
67
+ miniature)
68
+
69
+ 5 edge-case tasks × {single-shot, gate-loop} × 10 epochs, temperature 0.6
70
+ (so the first shot sometimes misses edges):
71
+
72
+ | Condition | Success | Errors | Tokens | Turns |
73
+ |---|--:|--:|--:|--:|
74
+ | baseline (single-shot) | **78.0%** | 22% | 1,170 | 1.0 |
75
+ | uap-full (gate loop) | **98.0%** | 2% | 2,242 | 1.3 |
76
+
77
+ - **Correctness: +20.0pp** — 95% CI **[+8.0, +32.0]**, p=0.008 ✅
78
+ - **Gate value (McNemar):** 11 fixed, 1 regressed, **net +10** (p=0.006)
79
+ - **Cost:** +1,072 tokens, +0.3 turns per task — cheap for a 20-point gain
80
+
81
+ When the baseline can't self-verify, it ships edge-case bugs 22% of the time. The
82
+ gate loop catches and repairs 11 of them, cutting the error rate to 2%. The one
83
+ "regressed" case is the honest caveat — once, the loop's rewrite broke something
84
+ single-shot happened to get right.
85
+
86
+ ## What the tasks look like
87
+
88
+ Findings only hold if the tasks have real headroom. The `real-gate-gated` suite
89
+ was built so the **obvious solution passes the happy path but fails hidden edge
90
+ cases**, and validated before any run: for every task the stub fails, a correct
91
+ reference passes, **and a naive happy-path solution fails the hidden verify**.
92
+
93
+ | Task | Happy-path trap | Hidden edge the gate must catch |
94
+ |---|---|---|
95
+ | `py-roman-strict` | sum the symbols | reject invalid numerals (`IIII`, `VV`, `IL`) |
96
+ | `js-csv-parse` | `split(',')` | quoted commas, escaped `""`, CRLF, trailing newline |
97
+ | `js-deep-equal` | `JSON.stringify` compare | `NaN`, key order, `{a:undefined}` vs `{}` |
98
+ | `py-parse-duration` | single-unit only | combined `1h30m15s`, raise on invalid |
99
+ | `py-merge-intervals` | assume sorted, strict overlap | unsorted input, touching `[1,2],[2,3]→[1,3]` |
100
+
101
+ Each ships an in-repo test suite (the *visible* gate, `task.gateCmd`) distinct
102
+ from the hidden superset `verifyCmd` that remains the authoritative scorer.
103
+
104
+ ## Methodology notes (and honest caveats)
105
+
106
+ - **Paired design** removes between-task variance — the dominant noise source.
107
+ Deltas are bootstrap CIs (10k resamples, seeded for reproducibility) + a
108
+ sign-flip permutation test. Single-arm point estimates are never claims.
109
+ - **Small N + a single shared GPU.** Token/latency CIs are wide and latency is
110
+ confounded by request queueing on one GPU; read the *correctness* and *token*
111
+ deltas, not absolute latency. The +20pp result holds with N=50/arm and a CI
112
+ that excludes zero, but it is one model on five tasks — directional, not a
113
+ universal constant.
114
+ - **Ceiling effect** is why the agentic runs show 0pp: a 35B model in an
115
+ agentic harness simply solves these self-contained algorithmic tasks. A weaker
116
+ model, or genuinely harder multi-file tasks, would re-open headroom.
117
+ - **Harness reliability:** an early ablation wedged for ~50 min because
118
+ `spawnSync`'s timeout only SIGTERMs the immediate child while opencode forks a
119
+ detached tree that keeps the pipe open. Fixed with a detached process-group
120
+ spawn + group SIGKILL; subsequent runs completed 158–190/192 cleanly.
121
+
122
+ ## Reproduce
123
+
124
+ ```bash
125
+ # The decisive gate-value experiment (raw single-shot vs gate loop):
126
+ UAP_RAW_TEMPERATURE=0.6 uap bench paired \
127
+ --adapter raw --model "<model-served-name>" \
128
+ --suite benchmarks/suites/real-gate-gated \
129
+ --epochs 10 --concurrency 3
130
+
131
+ # Agentic baseline + per-component ablation:
132
+ uap bench paired --adapter opencode --model <provider/model> \
133
+ --suite benchmarks/suites/real-gate-hard --ablation --epochs 4
134
+ ```
135
+
136
+ Artifacts (`records.jsonl`, `report.json`, `report.md`) land in
137
+ `benchmark-results/paired-<timestamp>/`. See [PAIRED_HARNESS.md](PAIRED_HARNESS.md)
138
+ for the harness internals, adapters, and how to author a task.
139
+
140
+ ## Bottom line
141
+
142
+ The accuracy-lift hypothesis is **falsified for the agentic-vs-agentic case** and
143
+ **confirmed for the non-agentic case**. Use UAP's gate loop (`uap deliver`) when
144
+ wrapping a model that won't self-verify — that is where the measurable accuracy
145
+ win lives. When you already run a strong agentic harness, value UAP for its
146
+ efficiency (token savings), coordination (multi-agent file safety), and
147
+ never-regress guarantees, not for first-pass accuracy.
@@ -1,10 +1,26 @@
1
1
  # UAP Benchmarks
2
2
 
3
- Performance and accuracy results for the Universal Agent Protocol, measured on Terminal-Bench 2.0.
3
+ Performance and accuracy results for the Universal Agent Protocol.
4
4
 
5
- ## Headline results
5
+ ## Controlled paired result (start here)
6
6
 
7
- UAP-on vs. baseline, 12 representative tasks across 8 categories:
7
+ The rigorous, reproducible finding from the [paired harness](PAIRED_HARNESS.md)
8
+ — same model, same tasks, same seeds, toggling **only** UAP, with confidence
9
+ intervals:
10
+
11
+ > **UAP's accuracy lift depends on whether the base agent already self-verifies.**
12
+ > Vs an agentic harness that self-tests → **~0pp** (overhead only). Vs a
13
+ > non-agentic single-shot model → **+20pp** (78% → 98%, 95% CI [+8, +32],
14
+ > p=0.008) from the gate loop repairing edge-case bugs.
15
+
16
+ Full analysis with all five experiments: **[Paired Findings](PAIRED_FINDINGS.md)**.
17
+
18
+ ## Earlier (uncontrolled) Terminal-Bench numbers
19
+
20
+ UAP-on vs. baseline, 12 representative tasks across 8 categories. These are
21
+ *uncontrolled* — the [TBench Investigation](TBENCH_INVESTIGATION.md) found the
22
+ apparent lifts were largely confounds; treat the paired results above as
23
+ authoritative.
8
24
 
9
25
  | Metric | Baseline | With UAP | Δ |
10
26
  |---|---|---|---|
@@ -17,10 +33,12 @@ UAP-on vs. baseline, 12 representative tasks across 8 categories:
17
33
 
18
34
  | Doc | What it covers |
19
35
  |---|---|
36
+ | [**Paired Findings**](PAIRED_FINDINGS.md) | Controlled results: when UAP helps (+20pp vs non-agentic; ~0pp vs agentic), with CIs ⭐ |
37
+ | [Paired Harness](PAIRED_HARNESS.md) | The `uap bench paired` A/B harness: design, adapters, authoring tasks |
38
+ | [TBench Investigation](TBENCH_INVESTIGATION.md) | Earlier finding: uncontrolled "lifts" were confounds |
20
39
  | [Validation Results](VALIDATION_RESULTS.md) | Full methodology + per-task breakdown |
21
40
  | [Token Optimization](TOKEN_OPTIMIZATION.md) | Where the token savings come from |
22
41
  | [Accuracy Analysis](ACCURACY_ANALYSIS.md) | Success-rate and error analysis |
23
42
  | [Comprehensive Benchmarks](COMPREHENSIVE_BENCHMARKS.md) | Extended measurements |
24
- | [Paired Harness](PAIRED_HARNESS.md) | Controlled UAP-on vs UAP-off A/B: `uap bench paired` |
25
43
 
26
44
  See the [documentation index](../INDEX.md) for the rest of the docs.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miller-tech/uap",
3
- "version": "1.52.0",
3
+ "version": "1.52.1",
4
4
  "description": "Autonomous AI agent memory system with CLAUDE.md protocol enforcement",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",