@miller-tech/uap 1.46.0 → 1.46.2

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/docs/INDEX.md CHANGED
@@ -62,6 +62,7 @@ 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
66
  | [Validation Results](benchmarks/VALIDATION_RESULTS.md) | Terminal-Bench 2.0 results (−49.7% tokens, +33pp success) |
66
67
  | [Token Optimization](benchmarks/TOKEN_OPTIMIZATION.md) | Where the token savings come from |
67
68
  | [Accuracy Analysis](benchmarks/ACCURACY_ANALYSIS.md) | Success-rate and error analysis |
@@ -0,0 +1,136 @@
1
+ # Terminal-Bench Investigation — Findings & Improvement Plan
2
+
3
+ > A rigorous investigation into whether UAP improves a local model
4
+ > (Qwen3.6-35B-A3B via llama.cpp) on terminal-bench@2.0, and what to do next.
5
+ > Headline: **every apparent gain we found was a measurement confound.** The
6
+ > value of the investigation is the *method* and a clear, honest baseline.
7
+
8
+ ## TL;DR
9
+
10
+ - **`uap deliver` cannot beat a strong agentic baseline on terminal-bench**, and
11
+ it's **structural**: the benchmark hides its verifier and the tasks expose no
12
+ real gates, so deliver's convergence loop has nothing to converge against.
13
+ Confirmed across 7 integration variants.
14
+ - **UAP's automatic context layer shows no measurable pass-rate lift** on this
15
+ benchmark. The single apparent win (`fix-git` 0/3 → 3/3) was traced by
16
+ ablation to a **one-flag harness bug** (`OpenCodeBaseline` invoked opencode
17
+ without `--dir /app`), not to UAP. With a fair control the arms tie.
18
+ - **Single 6-task runs are not trustworthy** — per-task pass rates flip
19
+ run-to-run (≈10–33% variance). Several "results" earlier in the investigation
20
+ were variance, not signal.
21
+ - **What is genuinely true:** deliver's value is *real-gate projects*
22
+ (build/test/CI), proven independently; terminal-bench is the wrong instrument
23
+ to measure UAP-context value.
24
+
25
+ ## Method
26
+
27
+ - Model: Qwen3.6-35B-A3B (IQ4_XS) on llama.cpp, OpenAI-compatible `:8080/v1`.
28
+ - Harness: harbor + the opencode agents in `tools/agents/opencode_uap_agent.py`.
29
+ - Subset: a 6-task "quick" set (`fix-git`, `openssl-selfsigned-cert`, `regex-log`,
30
+ `sqlite-db-truncate`, `log-summary-date-ranges`, `financial-document-processor`).
31
+ - Multi-seed: `k=3` trials/task (added after single-run results proved noisy).
32
+ - A stall-watchdog (kill a container idle >22 min) handles the intermittent
33
+ opencode hangs that otherwise lock a run for ~50 min.
34
+
35
+ ## Results
36
+
37
+ ### deliver integrations (6-task, single-run unless noted)
38
+
39
+ | Arm | Result | deliver's role |
40
+ |---|---|---|
41
+ | Baseline (opencode + UAP context) | 4/6 | none |
42
+ | Gateless deliver (per-edit trigger) | ≤2/5 + 23-min hang | vacuous / harmful |
43
+ | Self-gated deliver (trigger, blind exec) | 4/6 | inert |
44
+ | Agentic deliver (trigger) | 2/6 | **corrupted** tasks |
45
+ | Deliver-as-executor (agentic solver) | 2/6 | proxy-gated, underperforms |
46
+ | Deliver-hybrid (opencode + repair, `--keep-best`) | 3/6 | no-op (no real gates) → safe |
47
+
48
+ Deliver only helps when **real gates** exist; the subset exposes none, so it is
49
+ at best a no-op and at worst (forced against a self-authored *proxy* gate)
50
+ corrupts tasks the agent already solves.
51
+
52
+ ### Baseline-vs-UAP A/B (k=3 = 18 trials/arm)
53
+
54
+ | | Confounded (broken control) | **Corrected (`--dir /app` fixed)** |
55
+ |---|---|---|
56
+ | Baseline | 10/18 (56%) | 10/16 (62%) |
57
+ | UAP-context | 11/17 (65%) | 11/17 (65%) |
58
+ | `fix-git` | 0/3 vs 3/3 | **3/3 vs 3/3** |
59
+
60
+ The corrected A/B's only per-task differences are within noise; on the 5 clean
61
+ (non-`sqlite`) tasks the fair baseline (10/15) is ≥ UAP (9/15). **No measurable
62
+ UAP-context lift.**
63
+
64
+ ### Ablation of the one apparent win (`fix-git`)
65
+
66
+ | Variant | `fix-git` (k=3) | Conclusion |
67
+ |---|---|---|
68
+ | Plain opencode, no `--dir` | 0/3 | handicapped control |
69
+ | Full UAP | 3/3 | — |
70
+ | UAP − git domain snippet | 3/3 | domain knowledge ≠ cause |
71
+ | UAP − agentic-forcing − retry | 3/3 | tool-forcing ≠ cause |
72
+ | **Baseline + `--dir /app`** | **3/3** | **the actual cause (a harness bug)** |
73
+
74
+ ## Methodology lessons (the durable value)
75
+
76
+ 1. **An A/B is only as good as its control.** A single mis-invocation (`--dir
77
+ /app`) manufactured a 9-point "UAP lift" that did not exist.
78
+ 2. **Ablate a surprising win before believing it.** Every premature conclusion
79
+ here was overturned by ablation or a fairer control.
80
+ 3. **Always multi-seed.** n=1 on this benchmark is noise; report mean±range.
81
+ 4. **Disprove cheaply first.** The `openssl` "difference" was killed in 30s by
82
+ checking that the task matches no UAP category (no mechanism) — no run needed.
83
+ 5. **Watchdog hang-prone runs.** `sqlite-db-truncate` hangs opencode for *both*
84
+ agents; without a stall-killer a run loses hours.
85
+
86
+ ---
87
+
88
+ ## Improvement plan
89
+
90
+ Terminal-bench pass-rate has proven a poor instrument for UAP value (variance
91
+ swamps effects; deliver needs gates the benchmark hides). The options below are
92
+ split into "raise the tbench number" and "improve real UAP usage", since they
93
+ are different goals.
94
+
95
+ ### A. Raise the terminal-bench number
96
+
97
+ 1. **Fix the hangs (free reliability).** `sqlite-db-truncate` (and occasionally
98
+ others) lock opencode for ~50 min, losing trials and wall-clock. Root-cause
99
+ the stall (suspect: a tool-call that never returns, or the enforce-plugin
100
+ loop detection) and bound it. Ship the stall-watchdog into the runner.
101
+ 2. **Reduce variance with self-consistency.** Run N attempts/task and vote or
102
+ judge-select. Directly converts boundary tasks (the 1–2/3 tasks) into wins.
103
+ Cost: N× inference — but the model is local/zero-marginal-cost.
104
+ 3. **Escalate hard tasks to a stronger model.** The compute/ML/algorithm tasks
105
+ (`path-tracing`, `torch-tensor-parallelism`, `caffe-cifar-10`, `mteb-retrieve`,
106
+ `financial-document-processor`) are beyond a 3B-active model's ceiling.
107
+ Detect stagnation and escalate to a stronger model for those tasks only.
108
+ 4. **Earn the UAP-context lift, measured.** Today it shows none. Either prove
109
+ per-component value with controlled per-snippet A/Bs (multi-seed) and keep
110
+ only what measurably helps, or redesign injection to be higher-signal
111
+ (task-relevant patterns/skills with measured impact). Do **not** expand
112
+ `PATTERN_SNIPPETS` on faith — the git snippet was proven inert.
113
+
114
+ ### B. Improve real UAP usage (where value actually lives)
115
+
116
+ 1. **deliver on real-gate projects.** This is deliver's home: build/test/CI
117
+ repos with real gates. `--keep-best` makes it never-regress; the agentic
118
+ executor + real-gate detection make it converge. Measure on real projects
119
+ (time-to-green, regression rate), not terminal-bench.
120
+ 2. **Token efficiency.** The MCP router's ~98% tool-schema reduction is a real,
121
+ measurable win independent of pass-rate. Track tokens-per-task as a
122
+ first-class metric — likely where UAP's clearest ROI is.
123
+ 3. **Reliability & safety.** Enforcement gates, worktree isolation, and
124
+ never-regress delivery are correctness wins that a pass-rate benchmark does
125
+ not capture. Measure defects-prevented / regressions-avoided.
126
+ 4. **Memory & continuity.** Cross-session recall is a usage-quality win; measure
127
+ repeated-mistake rate across sessions, not single-task accuracy.
128
+
129
+ ### Recommended sequence
130
+
131
+ 1. **Fix the hangs** (cheap, unblocks every future run).
132
+ 2. **Self-consistency on the quick-6, multi-seed** — the most likely real
133
+ tbench gain, and a clean experiment.
134
+ 3. **Escalation for the hard-task tail** — addresses the model-ceiling failures.
135
+ 4. In parallel, **shift UAP-value measurement off pass-rate** to token
136
+ efficiency + real-gate deliver, where the value is demonstrable.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miller-tech/uap",
3
- "version": "1.46.0",
3
+ "version": "1.46.2",
4
4
  "description": "Autonomous AI agent memory system with CLAUDE.md protocol enforcement",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1037,8 +1037,12 @@ class OpenCodeBaseline(BaseInstalledAgent):
1037
1037
 
1038
1038
  run = ExecInput(
1039
1039
  command=(
1040
- f"source $HOME/.nvm/nvm.sh && "
1041
- f"opencode --model {model} run --format=json {escaped} "
1040
+ # `cd /app` + `--dir /app` so opencode indexes the task directory
1041
+ # (matches OpenCodeUAP). Without it opencode runs from the wrong
1042
+ # cwd and fails file-exploration tasks — which made the baseline a
1043
+ # handicapped, unfair control in A/B comparisons.
1044
+ f"source $HOME/.nvm/nvm.sh && cd /app && "
1045
+ f"opencode --model {model} --dir /app run --format=json {escaped} "
1042
1046
  f"2>&1 | tee /logs/agent/opencode.txt"
1043
1047
  ),
1044
1048
  env=env,