@miller-tech/uap 1.137.1 → 1.137.3
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 +9 -5
- package/docs/guides/AUTOMATIC_FEATURES.md +8 -0
- package/docs/guides/DELIVER.md +91 -10
- package/docs/guides/DROIDS_AND_SKILLS.md +1 -1
- package/docs/guides/LOCAL_MODELS.md +4 -0
- package/docs/guides/PROXY.md +202 -0
- package/docs/reference/CLI.md +262 -1
- package/docs/reference/CONFIGURATION_REFERENCE.md +24 -0
- package/docs/reference/FEATURES.md +20 -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/docs/INDEX.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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.137.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
5
|
> **Reviewing the system?** The reverse-engineered, code-verified reference set lives in
|
|
6
6
|
> [`documentation/`](../documentation/architecture.md): architecture, flows, permissions
|
|
@@ -20,11 +20,11 @@ UAP is organized like a delivery line. If you know which part of the pipeline yo
|
|
|
20
20
|
| **Intake** — understand the work | Amnesiac sessions, invented scope | [Memory](guides/MEMORY.md) · [Reactor](design/UAP_REACTOR.md) |
|
|
21
21
|
| **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) |
|
|
22
22
|
| **Isolation** — a bench per job | Editing `main`, clobbering files | [Worktree Workflow](guides/WORKTREE_WORKFLOW.md) |
|
|
23
|
-
| **Build** — make the thing | Plausible-but-wrong code, stubs, empty output | [`uap deliver`](guides/DELIVER.md) · [Local Models](guides/LOCAL_MODELS.md) |
|
|
23
|
+
| **Build** — make the thing | Plausible-but-wrong code, stubs, empty output | [`uap deliver`](guides/DELIVER.md) · [Local Models](guides/LOCAL_MODELS.md) · [Inference Proxy](guides/PROXY.md) |
|
|
24
24
|
| **QC / verify** — prove it runs | "Done" on code that never ran | [`uap deliver`](guides/DELIVER.md) · [Policies](guides/POLICIES.md) |
|
|
25
25
|
| **Coordination** — many workers, one floor | Parallel agents colliding | [Coordination](guides/COORDINATION.md) · [Deploy Batching](guides/DEPLOY_BATCHING.md) |
|
|
26
26
|
| **Shipping** — out the door safely | Regressions, red CI, skipped bumps | [Worktree Workflow](guides/WORKTREE_WORKFLOW.md) · [Policies](guides/POLICIES.md) |
|
|
27
|
-
| **Feedback** — the floor learns | The same mistake every session | [Memory](guides/MEMORY.md) · [Self-Harness](design/SELF_HARNESS.md) |
|
|
27
|
+
| **Feedback** — the floor learns | The same mistake every session | [Memory](guides/MEMORY.md) · [Self-Harness](design/SELF_HARNESS.md) · [Self-Tuning](guides/SELF_TUNING.md) |
|
|
28
28
|
| *Cross-cutting* — the whole line | Ignored rules, bloated context | [Policies](guides/POLICIES.md) · [MCP Router](guides/MCP_ROUTER.md) |
|
|
29
29
|
|
|
30
30
|
Full map: **[The UAP Delivery Pipeline](guides/DELIVERY_PIPELINE.md)**.
|
|
@@ -54,12 +54,15 @@ Full map: **[The UAP Delivery Pipeline](guides/DELIVERY_PIPELINE.md)**.
|
|
|
54
54
|
| [Sandbox](guides/SANDBOX.md) | Kernel-level (bubblewrap) write isolation — the boundary that survives `--dangerously-skip-permissions` |
|
|
55
55
|
| [Policies](guides/POLICIES.md) | Executable policy gates that block non-compliant tool calls |
|
|
56
56
|
| [**Policy Selection & Recommendations**](guides/POLICY_SELECTION.md) | Which policies to enable for your workflow — a recommended core + tailored sets by scenario; `uap policy recommend` ⭐ |
|
|
57
|
+
| [Pay2U Policy Pack](guides/POLICY_PACK_PAY2U.md) | The pay2u-tailored policy bundle |
|
|
57
58
|
| [Multi-Model Routing](guides/MULTI_MODEL.md) | Plan → route → execute across 7 model profiles |
|
|
58
|
-
| [Droids & Skills](guides/DROIDS_AND_SKILLS.md) | 38 expert droids,
|
|
59
|
+
| [Droids & Skills](guides/DROIDS_AND_SKILLS.md) | 38 expert droids, 36 skills, the expert router |
|
|
59
60
|
| [Deploy Batching](guides/DEPLOY_BATCHING.md) | Conflict-free batched git/deploy actions |
|
|
60
61
|
| [Coordination](guides/COORDINATION.md) | Multi-agent overlap detection |
|
|
61
62
|
| [Local Models](guides/LOCAL_MODELS.md) | Running agents against local llama.cpp / Qwen models |
|
|
63
|
+
| [Inference Proxy](guides/PROXY.md) | The Anthropic↔local gateway: `uap proxy` lifecycle, reliability guardrails, security, serving recipes |
|
|
62
64
|
| [Qwen3.6 on llama.cpp by VRAM](guides/QWEN36_LLAMACPP.md) | Tiered 8/12/16/24/32 GB setup; how `uap deliver` uplifts small local models |
|
|
65
|
+
| [**LLM Self-Tuning**](guides/SELF_TUNING.md) | `uap tune` — raise a small model toward Opus by tuning UAP's flag surface with a benchmark-validated LLM/GP-BO loop; quality scoring, model profiles, auto-on real-time adaptation ⭐ |
|
|
63
66
|
|
|
64
67
|
## Architecture
|
|
65
68
|
|
|
@@ -68,7 +71,8 @@ Full map: **[The UAP Delivery Pipeline](guides/DELIVERY_PIPELINE.md)**.
|
|
|
68
71
|
| [Overview](architecture/OVERVIEW.md) | System architecture as the delivery-line floor plan; subsystems, tool-call flow |
|
|
69
72
|
| [Protocol](architecture/PROTOCOL.md) | The harness↔UAP contract, hook lifecycle, decision loop |
|
|
70
73
|
| [Reactor (auto-apply)](design/UAP_REACTOR.md) | Dynamic experts/skills/patterns injected per prompt across harnesses; the assist vs enforce model, per-harness wiring |
|
|
71
|
-
| [Self-Harness
|
|
74
|
+
| [Self-Harness](design/SELF_HARNESS.md) | Self-improving harness (shipped as `uap self-harness`): autonomous mine→propose→validate loop over a bounded Mod DSL; cross-model transfer, online mining |
|
|
75
|
+
| [LLM Self-Tuning (analysis)](design/LLM_SELF_TUNING_ANALYSIS.md) | The design behind `uap tune`: quality signal, LLM-guided + Gaussian-process flag search, closed-loop validation, model profiles, real-time adaptation |
|
|
72
76
|
|
|
73
77
|
## Reference
|
|
74
78
|
|
|
@@ -88,6 +88,14 @@ Install UAP (`npm i -g universal-agent-protocol`) and every feature below activa
|
|
|
88
88
|
|
|
89
89
|
**Why it matters:** No manual tuning. The right parameters are applied automatically for each model family.
|
|
90
90
|
|
|
91
|
+
### Real-Time Adaptation (self-tuning) ✨
|
|
92
|
+
|
|
93
|
+
**What it does:** During a session the reactor watches live signals — tool-failure rate, per-turn quality, context-window pressure, and RECON no-write streaks — and, when one breaches a threshold, emits a per-session adjustment the proxy honors mid-flight: escalate the turn to the judge model (fusion), converge sooner (lower the recon threshold), or force synthesis to break an exploration loop.
|
|
94
|
+
|
|
95
|
+
**When it kicks in:** Auto-on. It is conservative — a signal is emitted only on a real threshold breach, so a nominal session is unchanged. Opt out with `uap config set realtimeAdapt.enabled false` (or `UAP_REALTIME_ADAPT=0`).
|
|
96
|
+
|
|
97
|
+
**Why it matters:** The static per-model config (`uap tune`) can't foresee everything; this catches the failures that only show up live, escalating a small model exactly when it starts to struggle. See [LLM Self-Tuning](SELF_TUNING.md).
|
|
98
|
+
|
|
91
99
|
---
|
|
92
100
|
|
|
93
101
|
## Memory & Context
|
package/docs/guides/DELIVER.md
CHANGED
|
@@ -51,6 +51,22 @@ local or frontier — runs the build to 100% without stopping. See
|
|
|
51
51
|
|
|
52
52
|
---
|
|
53
53
|
|
|
54
|
+
## Big builds: decompose → orchestrate → epics → contracts-first
|
|
55
|
+
|
|
56
|
+
For a mission too large to hold in one context, `deliver` scales down the context each turn actually needs — this is what lets a small-context local model compose a system it could never see all at once.
|
|
57
|
+
|
|
58
|
+
- **`--decompose`** splits the mission into sequential phases, each converged by its own loop (auto for long, complex instructions; `--no-decompose` forbids it).
|
|
59
|
+
- **`--orchestrate`** runs those phases through the **blackboard orchestrator** with *minimal* per-task context — each task sees only its goal + its direct-dependency outputs. Implies `--decompose`.
|
|
60
|
+
- **`--epics`** runs a massive mission as a sequence of **epics, each a fresh session** — only prior epics' summaries are injected, never their full code — looped until each is accepted (auto for very long missions; `--no-epics` disables).
|
|
61
|
+
|
|
62
|
+
**Contracts-first** (on by default inside epic/decompose runs; `UAP_DELIVER_CONTRACTS=0` disables): the first epic plans the shared types, interfaces, and registry APIs the rest build against. Once accepted, its files are **locked read-only** so later epics build against frozen signatures and can't drift them. The public surface is *extracted and verified against emitted source* — only names proven present are recorded — which is what makes cross-module composition reliable without holding every module in context.
|
|
63
|
+
|
|
64
|
+
**Scaffold-then-fill** (on by default in phased runs; `UAP_DELIVER_SCAFFOLD=0` disables): a large phase is split into a **scaffold** phase that emits the compiling skeleton (complete public signatures, wired imports/exports, stub bodies — build/typecheck must pass) and a **fill** phase that implements the logic *without changing any signature*. The skeleton keeps the build green while the details land.
|
|
65
|
+
|
|
66
|
+
Interrupted a long run? **`--resume <id|latest>`** picks up a durable run from `.uap/deliver-runs` where it left off.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
54
70
|
## Auto-optimization
|
|
55
71
|
|
|
56
72
|
By default every task is **classified by complexity** and the matching convergence aids turn on automatically (`auto-optimizer.ts`). You don't have to tune anything for the common case. To control it explicitly:
|
|
@@ -103,41 +119,106 @@ uap deliver "add the orders endpoint" --until-deployed
|
|
|
103
119
|
|
|
104
120
|
---
|
|
105
121
|
|
|
122
|
+
## Beyond build & test: proving it runs
|
|
123
|
+
|
|
124
|
+
Green gates prove code *compiles and tests pass* — not that the artifact actually **runs**. `deliver` adds gates for that:
|
|
125
|
+
|
|
126
|
+
- **Execution gate** — auto-synthesized as a ladder rung whenever a runnable artifact is detected: it actually *runs* the thing (headless browser / vm-dom / child-process) and fails the turn on a runtime error, a blank canvas, or a static frame. Catches "declared done but never ran."
|
|
127
|
+
- **Acceptance judge** (`--acceptance`) — after the objective gates pass, an LLM judges the spec's *behavioral completeness* from the code + runtime evidence and feeds any unmet requirements back so the loop finishes the spec. Pair it with **`--evaluator-model <preset>`** to have a *different* model judge than the one that implemented (separate generator from evaluator — the "barbell" strategy).
|
|
128
|
+
- **Self-gate** — when a project has **no** detectable gates, `deliver` authors a task-specific acceptance gate as a fallback so there is always something to converge against (on by default; `--no-self-gate` disables, `--force-self-gate` authors one even when project gates exist).
|
|
129
|
+
|
|
130
|
+
## Resilience: baseline-delta, migrations & repair escalation
|
|
131
|
+
|
|
132
|
+
Long autonomous runs fail in predictable ways; `deliver` has a guard for each:
|
|
133
|
+
|
|
134
|
+
- **Baseline-delta gating** — the full ladder is run **once at mission start**. Any required gate that is *already red at baseline* (a pre-existing failure the mission didn't cause) is demoted to non-blocking and annotated; only **new** regressions (green→red) block delivery. So a pre-existing broken lint or flaky test can't consume every attempt. On by default (`UAP_DELIVER_BASELINE_DELTA=0` or `.uap.json` `deliver.baselineDelta:false` to disable).
|
|
135
|
+
- **Migration-validation gate** — when a `migrations/` dir with `.sql` files exists, a ladder rung runs the migrations against an **ephemeral throwaway Postgres container** before they can ship broken. Skips cleanly (never fails) when Docker/`sqlx-cli` isn't available.
|
|
136
|
+
- **Repair escalation** — a circuit breaker for the compile-error death spiral: when the compile-error count *grows* across consecutive turns, the loop stops mission work and runs **one narrow "make it compile, change nothing else" pass** — in a fresh focused session, on the `--escalate-model` when configured — then resumes.
|
|
137
|
+
|
|
106
138
|
## Options
|
|
107
139
|
|
|
140
|
+
**Loop & termination**
|
|
141
|
+
|
|
108
142
|
| Flag | Purpose |
|
|
109
143
|
|---|---|
|
|
110
144
|
| `--max-turns <n>` | Maximum execute→verify iterations before until-delivered extension (default `5`) |
|
|
111
145
|
| `--no-until-delivered` | Disable loop-until-delivered (ON by default: extends past `--max-turns` to the ceiling, stopping on stagnation) |
|
|
112
146
|
| `--ceiling <n>` | Hard turn ceiling for until-delivered (1–50, default `30`) |
|
|
147
|
+
| `--no-lazy` | Skip the lazy bare first attempt (by default one bare turn runs before the convergence aids engage) |
|
|
148
|
+
| `--resume <id>` | Resume an interrupted durable run: a run id or `latest` (`.uap/deliver-runs`) |
|
|
149
|
+
|
|
150
|
+
**Executor**
|
|
151
|
+
|
|
152
|
+
| Flag | Purpose |
|
|
153
|
+
|---|---|
|
|
154
|
+
| `--executor <mode>` | Per-turn executor: `blind` (one completion), `agentic` (tool-using read/list/bash/write loop), or `auto` (agentic when there's repo context/gates to inspect) — default `auto` |
|
|
155
|
+
| `--allow-bash` | Permit the agentic executor's `run_bash` tool when NOT under `uap sandbox` (off by default; auto-enabled under sandbox) |
|
|
156
|
+
|
|
157
|
+
**Models & routing**
|
|
158
|
+
|
|
159
|
+
| Flag | Purpose |
|
|
160
|
+
|---|---|
|
|
113
161
|
| `-m, --model <preset>` | Model preset (default `$UAP_DELIVER_MODEL` or `qwen35-a3b`) |
|
|
162
|
+
| `--routing <preset>` | Pick the executor per task complexity from a routing preset (e.g. `cost-tiered`, `speed-tiered`); ignored when `--model` is set (`$UAP_DELIVER_ROUTING`) |
|
|
114
163
|
| `--endpoint <url>` | Override the model endpoint (OpenAI-compatible `/v1`) |
|
|
115
|
-
| `--escalate-model <preset>` | Stronger model for escalation (default `$UAP_ESCALATE_MODEL`) |
|
|
164
|
+
| `--escalate-model <preset>` | Stronger model for the escalation/repair ladder (default `$UAP_ESCALATE_MODEL`) |
|
|
116
165
|
| `--temperature <t>` | Sampling temperature (default: execution-profile value) |
|
|
166
|
+
|
|
167
|
+
**Gates & acceptance**
|
|
168
|
+
|
|
169
|
+
| Flag | Purpose |
|
|
170
|
+
|---|---|
|
|
117
171
|
| `--gates <ids>` | Gate subset: `build,typecheck,test,lint` |
|
|
118
|
-
| `--
|
|
172
|
+
| `--acceptance` | After objective gates pass, judge spec behavioral completeness (LLM) and feed unmet requirements back |
|
|
173
|
+
| `--evaluator-model <preset>` / `--evaluator-endpoint <url>` | Judge the acceptance gate with a DIFFERENT model than the implementer (generator≠evaluator) |
|
|
174
|
+
| `--no-self-gate` | Disable the self-authored acceptance-gate fallback (on by default when no project gates are detected) |
|
|
175
|
+
| `--force-self-gate` | Author a task-specific acceptance gate even when project gates exist |
|
|
176
|
+
| `--keep-best` | Never regress: snapshot first, roll back if the run ends with a worse required-gate score |
|
|
177
|
+
|
|
178
|
+
**Tiers & CI/deploy feedback**
|
|
179
|
+
|
|
180
|
+
| Flag | Purpose |
|
|
181
|
+
|---|---|
|
|
182
|
+
| `--tiers <list>` | Explicit local tiers, e.g. `fast,integration,deploy-dev` (overrides auto-detection) |
|
|
119
183
|
| `--integration` / `--no-integration` | Run the integration tier (on by default when a suite is detected) |
|
|
120
184
|
| `--deploy-dev` / `--no-deploy-dev` | Run a local dev deploy + smoke tier (compose up → smoke → teardown) |
|
|
121
|
-
| `--watch-ci` | After local-green, commit + push the worktree branch and watch CI; re-converge on failure |
|
|
185
|
+
| `--watch-ci` | After local-green, commit + push the worktree branch and watch CI; re-converge on failure (never pushes master/main) |
|
|
122
186
|
| `--until-deployed` | Imply `--watch-ci` and require CI + staging/prod deploy jobs green before exiting 0 |
|
|
123
187
|
| `--ci-passes <n>` | Max CI re-converge passes on failure (1–10, default `2`) |
|
|
124
188
|
| `--ci-timeout <minutes>` | CI watch budget in minutes (1–120, default `20`) |
|
|
189
|
+
|
|
190
|
+
**Big builds (decompose → orchestrate → epics)**
|
|
191
|
+
|
|
192
|
+
| Flag | Purpose |
|
|
193
|
+
|---|---|
|
|
194
|
+
| `--decompose` / `--no-decompose` | Split the mission into sequential phases, each converged by its own loop (auto for long complex tasks) |
|
|
195
|
+
| `--orchestrate` / `--no-orchestrate` | Run decomposed tasks through the blackboard orchestrator with MINIMAL per-task context (implies `--decompose`) |
|
|
196
|
+
| `--epics` / `--no-epics` | Run a massive mission as a sequence of fresh-session epics until each is accepted (auto for very long missions) |
|
|
197
|
+
|
|
198
|
+
**Exploration & quality aids**
|
|
199
|
+
|
|
200
|
+
| Flag | Purpose |
|
|
201
|
+
|---|---|
|
|
125
202
|
| `--candidates <n>` | Best-of-N exploration: candidates per turn (2–8) |
|
|
126
|
-
| `--critic` | Structured critique of failed turns |
|
|
203
|
+
| `--critic` | Structured critique of failed turns (extra model call per failure) |
|
|
127
204
|
| `--practices` / `--no-semantic` | Inject/record best-practice cards (keyword retrieval with `--no-semantic`) |
|
|
128
|
-
| `--escalate` | Escalation ladder on stagnation |
|
|
205
|
+
| `--escalate` | Escalation ladder on stagnation (widen exploration → critic → stronger model) |
|
|
129
206
|
| `--ideate` / `--ideate-project <name>` | Divergent ideation strategy seeds |
|
|
130
|
-
| `--halo` | Emit HALO spans (analyze with `uap harness analyze`) |
|
|
131
|
-
| `--coordinate` | Register the run with the coordination layer |
|
|
132
|
-
| `--deploy` | On success, queue a commit of applied files into the deploy batcher |
|
|
133
207
|
| `--optimize` | Enable every convergence aid |
|
|
134
|
-
| `--no-auto` | Disable dynamic optimization |
|
|
208
|
+
| `--no-auto` | Disable dynamic optimization (aids are auto-selected by task complexity by default) |
|
|
209
|
+
|
|
210
|
+
**Integration & run control**
|
|
211
|
+
|
|
212
|
+
| Flag | Purpose |
|
|
213
|
+
|---|---|
|
|
135
214
|
| `--no-protect-tests` | Allow the model to modify pre-existing test files (protected by default) |
|
|
136
215
|
| `--guidance-file <path>` | Poll a file each turn for live operator guidance |
|
|
216
|
+
| `--halo` | Emit HALO spans (analyze with `uap harness analyze`) |
|
|
217
|
+
| `--coordinate` | Register the run with the coordination layer (announce, heartbeat, overlap detection) |
|
|
218
|
+
| `--deploy` | On success, queue a commit of applied files into the deploy batcher |
|
|
137
219
|
| `--project-root <path>` | Project whose gates define delivery (default: cwd) |
|
|
138
220
|
| `--dry-run` | Show detected gates and plan without calling the model |
|
|
139
221
|
| `--json` | Emit a JSON result |
|
|
140
|
-
| `--keep-best` | Never regress: snapshot the project first, roll back if the run ends with a worse required-gate score |
|
|
141
222
|
|
|
142
223
|
### `--keep-best` snapshots
|
|
143
224
|
|
|
@@ -156,7 +156,7 @@ A skill is a reusable workflow. Skills live in directories under
|
|
|
156
156
|
[`.factory/skills/`](../../.factory/skills/), each containing a `SKILL.md` file
|
|
157
157
|
with frontmatter (`name`, `version`, `compatibility`) and the workflow body.
|
|
158
158
|
|
|
159
|
-
UAP ships **
|
|
159
|
+
UAP ships **36 skills** in `.factory/skills/`, including:
|
|
160
160
|
|
|
161
161
|
- **Coordination & workflow** — `uap-coordination`, `uap-tasks`,
|
|
162
162
|
`uap-worktree`, `worktree-workflow`, `parallel-expert-review`, `batch-review`
|
|
@@ -162,6 +162,10 @@ The client then talks the Anthropic protocol to the proxy, which forwards
|
|
|
162
162
|
OpenAI requests to llama.cpp. The proxy supports streaming and tool-call
|
|
163
163
|
translation.
|
|
164
164
|
|
|
165
|
+
For the full picture — the `uap proxy` lifecycle, the reliability guardrails
|
|
166
|
+
that keep a small model from wedging, security, and serving recipes — see the
|
|
167
|
+
**[Inference Proxy guide](PROXY.md)**.
|
|
168
|
+
|
|
165
169
|
## Related
|
|
166
170
|
|
|
167
171
|
- [Deploy Batching](./DEPLOY_BATCHING.md) — what `uap deliver --deploy` queues.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# The Inference Proxy
|
|
2
|
+
|
|
3
|
+
UAP ships a local **inference proxy** — an Anthropic-Messages-compatible gateway
|
|
4
|
+
that sits in front of a local llama.cpp/Qwen backend, translates between the
|
|
5
|
+
Anthropic wire format and llama's OpenAI-compatible API, and applies a layer of
|
|
6
|
+
**reliability guardrails** on the way through. It's what lets a Claude-native
|
|
7
|
+
harness (Claude Code, Factory, …) drive a local model, and it's where most of
|
|
8
|
+
the "keep a small model from wedging" logic lives.
|
|
9
|
+
|
|
10
|
+
> Code: [`tools/agents/scripts/anthropic_proxy.py`](../../tools/agents/scripts/anthropic_proxy.py)
|
|
11
|
+
> (the server), `tools/agents/scripts/confidence_escalation.py` (serving
|
|
12
|
+
> recipes), and `src/cli/proxy.ts` / `src/cli/proxy-lifecycle.ts` (lifecycle).
|
|
13
|
+
> Related: [Local Models](LOCAL_MODELS.md) · [Configuration Reference](../reference/CONFIGURATION_REFERENCE.md).
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## What it does
|
|
18
|
+
|
|
19
|
+
- **Protocol translation** — accepts Anthropic `POST /v1/messages` and forwards
|
|
20
|
+
OpenAI-style requests to the local rail (`LLAMA_CPP_BASE`, e.g.
|
|
21
|
+
`http://localhost:8080/v1`), streaming and tool-calls included.
|
|
22
|
+
- **Reliability guardrails** — detects and breaks the failure modes a small
|
|
23
|
+
local model falls into (act/review loops, "I'm stuck" spirals, endless
|
|
24
|
+
exploration with no deliverable) so a run terminates instead of burning turns.
|
|
25
|
+
- **Context management** — scales token counts so the client compacts *before*
|
|
26
|
+
the local rail overflows, and prunes as a backstop.
|
|
27
|
+
- **Graceful degradation under load** — pool saturation returns a proper
|
|
28
|
+
Anthropic `529 overloaded_error` with `retry-after` rather than failing hard.
|
|
29
|
+
- **Serving recipes** — optional confidence/fusion escalation to a stronger
|
|
30
|
+
judge model, plus per-request routing from the reactor and the self-tuning
|
|
31
|
+
real-time adaptor.
|
|
32
|
+
|
|
33
|
+
### Endpoints
|
|
34
|
+
|
|
35
|
+
| Route | Purpose |
|
|
36
|
+
|---|---|
|
|
37
|
+
| `POST /v1/messages` (+ `/anthropic/v1/messages`) | Main Anthropic Messages endpoint (local model + guardrails) |
|
|
38
|
+
| `POST /v1/messages/count_tokens` | Token counting, scaled so the client compacts before the local rail overflows |
|
|
39
|
+
| `POST /v1/chat/completions` | OpenAI-compatible surface |
|
|
40
|
+
| `GET /v1/models` | Model list (honors the `__local_only__` passthrough sentinel) |
|
|
41
|
+
| `GET /health` | Liveness (probes the upstream; stays unauthenticated) |
|
|
42
|
+
| `GET /v1/context` | Per-session token-usage / utilization / guardrail telemetry (dashboards & debug) |
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Lifecycle: `uap proxy`
|
|
47
|
+
|
|
48
|
+
The proxy is **reference-counted and session-scoped**. Hooks call `ensure` when a
|
|
49
|
+
session starts and `release` when it ends, so it starts on demand and stops when
|
|
50
|
+
the last session leaves — but it **never** kills a proxy that systemd manages or
|
|
51
|
+
that other sessions are still using.
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
uap proxy [ensure | release | status | start | stop | restart | enable | disable]
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
| Subcommand | What it does |
|
|
58
|
+
|---|---|
|
|
59
|
+
| `ensure` | Start the proxy if none is running, or **adopt** a running one; register this session as a client |
|
|
60
|
+
| `release` | Deregister this session; stop the proxy **only if** we spawned it as a plain process and no other client remains |
|
|
61
|
+
| `status` | Report whether it's running, how (systemd vs spawned), the port, and client count (`--json` for machine-readable) |
|
|
62
|
+
| `start` / `stop` / `restart` | Explicit control (e.g. `restart` after changing `PROXY_*` in `.uap/proxy.env`) |
|
|
63
|
+
| `enable` / `disable` | Toggle `.uap.json` `proxy.autostart` so hooks auto-start it (or not) |
|
|
64
|
+
|
|
65
|
+
| Flag | Purpose |
|
|
66
|
+
|---|---|
|
|
67
|
+
| `--client <id>` | Client/session id (defaults to the session env or parent pid) |
|
|
68
|
+
| `--client-pid <n>` | Long-lived agent pid for liveness (hooks pass `$PPID`) |
|
|
69
|
+
| `--port <n>` | Proxy port (default `4000` / `$PROXY_PORT`) |
|
|
70
|
+
| `--if-enabled` | No-op unless `.uap.json` `proxy.autostart` is `true` (hook-safe) |
|
|
71
|
+
| `--quiet` / `--json` | Suppress output (hooks) / machine-readable status |
|
|
72
|
+
|
|
73
|
+
**How it's managed.** When available, the proxy runs as the systemd unit
|
|
74
|
+
`uap-anthropic-proxy.service`, reading its environment from
|
|
75
|
+
`~/.config/uap/anthropic-proxy.env`; a plain spawned proxy seeds the same file
|
|
76
|
+
for parity. The proxy also loads project-local `.uap/proxy.env` at startup
|
|
77
|
+
(real environment always wins). PID reuse is defended with a `/proc/<pid>`
|
|
78
|
+
start-time token so `release` never kills an unrelated process that inherited an
|
|
79
|
+
old pid. Everything hook-driven **fails open** — if the proxy won't start, the
|
|
80
|
+
agent just runs without it.
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
uap proxy status --json
|
|
84
|
+
uap proxy restart # pick up new PROXY_* values from .uap/proxy.env
|
|
85
|
+
uap proxy enable # let session hooks autostart it
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Security
|
|
91
|
+
|
|
92
|
+
- **Loopback by default.** The proxy binds `127.0.0.1` (`PROXY_HOST`). This is
|
|
93
|
+
deliberate: an unauthenticated `0.0.0.0` listener would let any host on your
|
|
94
|
+
LAN drive the local model — and reach any cloud passthrough — so local-only is
|
|
95
|
+
the safe default.
|
|
96
|
+
- **Shared-secret auth for LAN exposure.** To run it as a shared service, set
|
|
97
|
+
`PROXY_HOST=0.0.0.0` **and** a `PROXY_AUTH_TOKEN`. With a token set, every model
|
|
98
|
+
route requires `Authorization: Bearer <token>` (or `X-Uap-Proxy-Token`), checked
|
|
99
|
+
in constant time; `/health` stays open. Never expose it beyond loopback without
|
|
100
|
+
a token.
|
|
101
|
+
- **Passthrough credentials.** For requests routed to the cloud, the proxy
|
|
102
|
+
forwards the client's OAuth `Authorization: Bearer` verbatim and does not also
|
|
103
|
+
attach an `x-api-key` (Anthropic rejects both).
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Reliability guardrails
|
|
108
|
+
|
|
109
|
+
These are the heart of the proxy — the logic that keeps a weaker model from
|
|
110
|
+
wedging. Most are **on by default** and tuned via `PROXY_*` env vars (persisted
|
|
111
|
+
in `.uap/proxy.env` or the systemd EnvironmentFile). The high-signal knobs are in
|
|
112
|
+
the [Configuration Reference](../reference/CONFIGURATION_REFERENCE.md); the full
|
|
113
|
+
set is below.
|
|
114
|
+
|
|
115
|
+
### Termination breakers (on by default)
|
|
116
|
+
|
|
117
|
+
| Guardrail | Env (default) | Behavior |
|
|
118
|
+
|---|---|---|
|
|
119
|
+
| **Loop-breaker** | `PROXY_LOOP_BREAKER` (on) | Detects act/review cycles + no-progress streaks and releases `tool_choice` to `auto` so the model can actually terminate |
|
|
120
|
+
| **Stuck-break** | `PROXY_STUCK_BREAK` (on) | When the model self-reports "stuck in a loop" or hammers a rate-limited host, forces a terminal turn |
|
|
121
|
+
| **Deferral-break** | `PROXY_DEFERRAL_BREAK` (on) | The inverse: a no-tool turn that *defers* work ("I need more exploration cycles") is forced to act on the next turn |
|
|
122
|
+
| **Recon-convergence** | `PROXY_RECON_CONVERGENCE_THRESHOLD` (40) | After N tool-using turns with **no** write/deliverable, inject "stop exploring, produce the deliverable"; escalates to stripping tools if it persists (0 disables) |
|
|
123
|
+
| **Hard-finalize** | `PROXY_HARD_FINALIZE_TURNS` (40) | Absolute turn cap before a forced finalize |
|
|
124
|
+
| **MANDATE-DELIVER** | `PROXY_MANDATE_DELIVER` (on) | On the delivery-enforcer block marker, pin `tool_choice` to `deliver` so the next turn *must* route through the gated path — makes routing binding for weak models |
|
|
125
|
+
|
|
126
|
+
### Context & compaction
|
|
127
|
+
|
|
128
|
+
| Env (default) | Behavior |
|
|
129
|
+
|---|---|
|
|
130
|
+
| `PROXY_CONTEXT_WINDOW` (0 = auto) | Explicit local context window; 0 derives it from the live rail |
|
|
131
|
+
| `PROXY_COUNT_TOKENS_SCALE` (auto) | Scales the reported token count so the client auto-compacts before the local rail overflows |
|
|
132
|
+
| `PROXY_CONTEXT_PRUNE_THRESHOLD` (0.85) / `PROXY_CONTEXT_PRUNE_TARGET_FRACTION` (0.50) | Backstop pruning: prune at 85% of the window, land the session at ~50% |
|
|
133
|
+
|
|
134
|
+
### Connection health & backpressure
|
|
135
|
+
|
|
136
|
+
| Env (default) | Behavior |
|
|
137
|
+
|---|---|
|
|
138
|
+
| `PROXY_MAX_CONNECTIONS` (20) | httpx pool size; a large pool + 529 backoff absorbs connection churn gracefully |
|
|
139
|
+
| **529 backpressure** (no toggle) | A pool timeout returns HTTP **529 `overloaded_error`** with `retry-after` — pure graceful degradation, not a hard failure |
|
|
140
|
+
| `PROXY_CLOSEWAIT_REAP_INTERVAL` (0 = **off**) | Opt-in CLOSE-WAIT reaper (pool self-heal); off by default because pool-swap churn can harm a saturated upstream |
|
|
141
|
+
| `PROXY_TOOL_NARROWING` (**off**) | Opt-in: drop cycling/banned tools from the set on loops — always keeps the Bash/WebFetch/Agent escape hatch + write tools (a floor invariant that never strands the agent) |
|
|
142
|
+
|
|
143
|
+
> **Off-by-default knobs to know:** `PROXY_TOOL_NARROWING`, the CLOSE-WAIT reaper
|
|
144
|
+
> (`PROXY_CLOSEWAIT_REAP_INTERVAL=0`), `PROXY_POOL_SWAP_ON_SATURATION`, and the
|
|
145
|
+
> serving recipes (`PROXY_CONFIDENCE_ESCALATE`). Everything else above is on.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Serving recipes & escalation
|
|
150
|
+
|
|
151
|
+
The proxy can run a bounded **micro-agent recipe** in front of the local model —
|
|
152
|
+
escalating low-confidence or hard turns to a stronger **judge** model — behind
|
|
153
|
+
the same single model API. It is **off by default and fails open**.
|
|
154
|
+
|
|
155
|
+
| Env (default) | Meaning |
|
|
156
|
+
|---|---|
|
|
157
|
+
| `PROXY_CONFIDENCE_ESCALATE` (off) | Master switch for serving recipes |
|
|
158
|
+
| `PROXY_RECIPE` (auto) | `single \| confidence \| fusion` (+ `ratings \| remom`); `auto` routes by signal |
|
|
159
|
+
| `PROXY_CONFIDENCE_THRESHOLD` (0.5) | Below this confidence, escalate the turn to the judge |
|
|
160
|
+
| `PROXY_FUSION_N` (3) | Candidates the fusion recipe samples before the judge picks/merges (2–6) |
|
|
161
|
+
| `PROXY_ESCALATE_MODEL` / `PROXY_ESCALATE_ENDPOINT` / `PROXY_ESCALATE_API_KEY` | The stronger judge backend |
|
|
162
|
+
|
|
163
|
+
A judge-dependent recipe requires a judge **distinct from** the primary model —
|
|
164
|
+
a same-model "qwen judging qwen" setup downgrades to `single` unless
|
|
165
|
+
`PROXY_ALLOW_SELF_JUDGE=1`. The judge model id is configured on the harness side
|
|
166
|
+
via `recipes.judge.model` (see the [recipes settings](../reference/CONFIGURATION_REFERENCE.md));
|
|
167
|
+
`uap setup` / `uap config` seed the `PROXY_ESCALATE_*` triple into the proxy env.
|
|
168
|
+
|
|
169
|
+
### Cross-process signals
|
|
170
|
+
|
|
171
|
+
Because the proxy freezes its `PROXY_*` env at startup and has no reload
|
|
172
|
+
endpoint, two features steer it **per request** via small signal files (each a
|
|
173
|
+
best-effort read, TTL ~180s, never fatal):
|
|
174
|
+
|
|
175
|
+
- **Recipe signal** — the harness [Reactor](../design/UAP_REACTOR.md) writes its
|
|
176
|
+
per-prompt routing decision to `~/.cache/uap/recipe-signals/`; the proxy prefers
|
|
177
|
+
that fresh signal over re-deriving complexity itself.
|
|
178
|
+
- **Adaptation signal** — the [LLM self-tuning](SELF_TUNING.md) real-time adaptor
|
|
179
|
+
writes per-session adjustments (escalate / recipe / recon threshold / force
|
|
180
|
+
synthesis) to `~/.cache/uap/adaptation-signals/`. Consumed when
|
|
181
|
+
`PROXY_REALTIME_ADAPT` is on (**auto-on**; opt out with `0`).
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Configuration
|
|
186
|
+
|
|
187
|
+
Proxy settings are `PROXY_*` environment variables. Persist them with
|
|
188
|
+
`uap config set` (which writes `.uap/proxy.env`) and `uap proxy restart` to apply:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
uap config set PROXY_RECON_CONVERGENCE_THRESHOLD 30
|
|
192
|
+
uap config set PROXY_AUTH_TOKEN "$(openssl rand -hex 16)"
|
|
193
|
+
uap proxy restart
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
The curated high-impact subset is documented in the
|
|
197
|
+
[Configuration Reference](../reference/CONFIGURATION_REFERENCE.md#proxy);
|
|
198
|
+
the exhaustive list lives as module-level constants in `anthropic_proxy.py`.
|
|
199
|
+
|
|
200
|
+
> **Note:** the upstream backend default in the checked-in scripts
|
|
201
|
+
> (`LLAMA_CPP_BASE`) points at a specific host/port — always set it (or your
|
|
202
|
+
> model's `endpoint`) to your own llama.cpp/Qwen server.
|
package/docs/reference/CLI.md
CHANGED
|
@@ -29,7 +29,7 @@ runs, keeping `--help` fast.
|
|
|
29
29
|
| Command | Purpose |
|
|
30
30
|
|---------|---------|
|
|
31
31
|
| [`init`](#init) | Initialize agent context in the current project |
|
|
32
|
-
| [`setup`](#setup) |
|
|
32
|
+
| [`setup`](#setup) | Guided setup wizard (arrow-key), or `--profile maximum\|minimal\|custom`; backs up instruction files, extracts custom content |
|
|
33
33
|
| [`analyze`](#analyze) | Analyze project structure and emit metadata |
|
|
34
34
|
| [`generate`](#generate) | Generate or update CLAUDE.md and related files |
|
|
35
35
|
| [`update`](#update) | Update CLAUDE.md, memory system, and related components |
|
|
@@ -41,6 +41,19 @@ runs, keeping `--help` fast.
|
|
|
41
41
|
| [`expert-route`](#expert-route) | Recommend an expert droid chain for a task |
|
|
42
42
|
| [`deliver`](#deliver) | Convergence loop: iterate a model against gates until delivery |
|
|
43
43
|
| [`harness`](#harness) | HALO harness optimization over execution traces |
|
|
44
|
+
| [`bench`](#bench) | Controlled paired (UAP-on vs UAP-off) benchmark with CIs |
|
|
45
|
+
| [`self-harness`](#self-harness) | Self-improving harness: mine failures → propose → validate → commit |
|
|
46
|
+
| [`tune`](#tune) | LLM self-tuning: raise a small model toward Opus by tuning UAP flags |
|
|
47
|
+
| [`verify`](#verify) | Runtime verification gate: prove changed code actually runs |
|
|
48
|
+
| [`config`](#config) | Inspect and change every UAP setting (`.uap.json` / `.uap/proxy.env`) |
|
|
49
|
+
| [`design`](#design) | DESIGN.md interrogation, lint, and the off-token UI gate |
|
|
50
|
+
| [`proxy`](#proxy) | Reference-counted, session-scoped local inference proxy lifecycle |
|
|
51
|
+
| [`orchestrator`](#orchestrator) | Toggle the long multi-turn deliver orchestrator |
|
|
52
|
+
| [`handsfree`](#handsfree) (`hf`) | Hands-free persistence: loop any model to a 100% ledger |
|
|
53
|
+
| [`challenge`](#challenge) | Open multi-agent challenge with a significance-gated leaderboard |
|
|
54
|
+
| [`sandbox`](#sandbox) | Run a command with a kernel-enforced writable-dir boundary |
|
|
55
|
+
| [`react`](#react) | Resolve dynamic experts/skills/patterns for a lifecycle event (JSON) |
|
|
56
|
+
| [`status`](#status) | Show HALO trace collection state |
|
|
44
57
|
| [`ideate`](#ideate) | Divergent ideation (open-collider) for hard problems |
|
|
45
58
|
| [`coord`](#coord) | Agent coordination and status |
|
|
46
59
|
| [`agent`](#agent) | Agent lifecycle, work coordination, and communication |
|
|
@@ -379,6 +392,254 @@ The trace file defaults to `$UAP_HALO_TRACE_PATH` or `.uap/halo/traces.jsonl`.
|
|
|
379
392
|
|
|
380
393
|
---
|
|
381
394
|
|
|
395
|
+
## `bench`
|
|
396
|
+
|
|
397
|
+
Controlled paired benchmark — hold the base model + agent constant and toggle
|
|
398
|
+
UAP on/off over the same real-gate suite and seeds, then report paired deltas
|
|
399
|
+
with confidence intervals, a McNemar gate-value 2×2, and a cost–accuracy Pareto.
|
|
400
|
+
|
|
401
|
+
| Subcommand | Key flags | Purpose |
|
|
402
|
+
|------------|-----------|---------|
|
|
403
|
+
| `paired` | `--suite`, `--adapter <mock\|opencode\|claude\|mini\|raw\|deliver>`, `--model`, `--epochs`, `--concurrency`, `--ablation`, `--lazy`, `--seed`, `--iterations`, `--rope-margin`, `--out`, `--json` | Run the UAP-on vs UAP-off A/B; writes `records.jsonl` + Markdown/JSON reports |
|
|
404
|
+
|
|
405
|
+
```bash
|
|
406
|
+
uap bench paired --adapter opencode --model qwen36-a3b --epochs 5
|
|
407
|
+
uap bench paired --ablation # leave-one-out per UAP component
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
See [Paired Harness](../benchmarks/PAIRED_HARNESS.md) for the methodology.
|
|
411
|
+
|
|
412
|
+
---
|
|
413
|
+
|
|
414
|
+
## `self-harness`
|
|
415
|
+
|
|
416
|
+
Self-improving harness: mine model-specific failures from traces, propose a
|
|
417
|
+
bounded, reversible modification (the "Mod" DSL), validate it with a real paired
|
|
418
|
+
bench, and — with `--apply` — commit it and snapshot a versioned profile.
|
|
419
|
+
|
|
420
|
+
| Subcommand | Key flags | Purpose |
|
|
421
|
+
|------------|-----------|---------|
|
|
422
|
+
| `analyze` | `--records`, `--env`, `--transfer`, `--json` | Mine weaknesses + propose candidate Mods (read-only) |
|
|
423
|
+
| `run` | `--records`, `--suite`, `--heldout`, `--adapter`, `--model`, `--epochs`, `--max-candidates`, `--apply`, `--json` | The full loop; `--apply` commits + snapshots |
|
|
424
|
+
| `transfer` | `--transfer`, `--json` | List the cross-model transfer store |
|
|
425
|
+
| `mine-prod` | `--traces`, `--unit`, `--since`, `--pending`, `--json` | Mine production traces → enqueue proposals (never applies) |
|
|
426
|
+
| `pending` / `prune` | `--pending`, `--transfer`, `--json` | Inspect / ablation-prune the queue + store |
|
|
427
|
+
| `tune` | (alias of `uap tune`) | The LLM/GP flag self-tuning loop |
|
|
428
|
+
|
|
429
|
+
```bash
|
|
430
|
+
uap self-harness run --suite benchmarks/suites/real-gate --adapter opencode
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
See [Self-Harness (design)](../design/SELF_HARNESS.md).
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
## `tune`
|
|
438
|
+
|
|
439
|
+
LLM self-tuning — raise a small model (e.g. qwen3.6) toward Opus-level output by
|
|
440
|
+
tuning UAP's own flag surface (recipes, hands-free, memory, concurrency, proxy
|
|
441
|
+
guardrails) with a benchmark-validated closed loop. An LLM proposes small flag
|
|
442
|
+
changes when a judge model is configured; otherwise a Gaussian-process Bayesian
|
|
443
|
+
optimizer picks the next config. `uap self-harness tune` is an alias.
|
|
444
|
+
|
|
445
|
+
| Flag | Purpose |
|
|
446
|
+
|------|---------|
|
|
447
|
+
| `--model <id>` | Executor model family to tune (default `qwen36-a3b`) |
|
|
448
|
+
| `--adapter <name>` | `mock \| opencode \| claude \| mini \| raw \| deliver` |
|
|
449
|
+
| `--judge <id>` | Judge/tuner model; else `recipes.judge.model`, else GP-only |
|
|
450
|
+
| `--phase <name>` | Force one search phase: `coarse \| medium \| fine \| combinatorial` |
|
|
451
|
+
| `--max-iterations <n>` | Tuning-loop budget (default 6) |
|
|
452
|
+
| `--epochs`, `--concurrency`, `--iterations`, `--seed` | Paired-bench + stats controls |
|
|
453
|
+
| `--apply` | Commit accepted configs + save the profile (default: dry-run) |
|
|
454
|
+
| `--json` | Machine-readable result |
|
|
455
|
+
|
|
456
|
+
```bash
|
|
457
|
+
uap tune --model qwen36-a3b --adapter opencode --judge opus-4.8 --apply
|
|
458
|
+
uap tune --adapter mock --max-iterations 3 --json # offline smoke test
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
See [LLM Self-Tuning](../guides/SELF_TUNING.md).
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
## `verify`
|
|
466
|
+
|
|
467
|
+
Run the project's completion gates — including the **runtime execution gate**
|
|
468
|
+
that actually runs the changed code — against the current files and report
|
|
469
|
+
pass/fail. This is what the Stop hook calls to block "done" on code that never
|
|
470
|
+
ran.
|
|
471
|
+
|
|
472
|
+
| Flag | Purpose |
|
|
473
|
+
|------|---------|
|
|
474
|
+
| `-d, --dir <path>` | Project directory (default: cwd) |
|
|
475
|
+
| `--strict` | Treat "no verifiable gates" as a failure (fail-closed) |
|
|
476
|
+
| `--runtime-only` | Run only the cheap runtime execution gate |
|
|
477
|
+
| `--full` | Also run the expensive integration / deploy-dev tiers |
|
|
478
|
+
| `--gates <ids>` | Comma-separated rung subset (e.g. `build,test,execution`) |
|
|
479
|
+
| `--acceptance <specfile>` | LLM acceptance gate: judge behavioral completeness vs a spec |
|
|
480
|
+
| `--no-visual` | Skip the headless visual gate |
|
|
481
|
+
| `-m, --model`, `--endpoint` | Model + endpoint for the acceptance gate |
|
|
482
|
+
| `--timeout <ms>`, `--json` | Per-rung timeout; JSON output |
|
|
483
|
+
|
|
484
|
+
```bash
|
|
485
|
+
uap verify --runtime-only # prove the artifact runs
|
|
486
|
+
uap verify --acceptance spec.md --strict
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
---
|
|
490
|
+
|
|
491
|
+
## `config`
|
|
492
|
+
|
|
493
|
+
Inspect and change every UAP setting from one place — the single source of truth
|
|
494
|
+
is `src/config/settings-registry.ts`, which also generates the
|
|
495
|
+
[Configuration Reference](CONFIGURATION_REFERENCE.md).
|
|
496
|
+
|
|
497
|
+
| Subcommand | Purpose |
|
|
498
|
+
|------------|---------|
|
|
499
|
+
| `list` | All settings + current values |
|
|
500
|
+
| `get <key>` / `explain <key>` | Read / learn one setting |
|
|
501
|
+
| `set <key> <value>` | Change it (writes `.uap.json`, `.uap/proxy.env`, or prints a shell export) |
|
|
502
|
+
| `doctor` | Flag risky / sub-optimal settings |
|
|
503
|
+
| `wizard` | Interactive expert configurator (also `uap setup --profile custom`) |
|
|
504
|
+
| `docs` | Regenerate `docs/reference/CONFIGURATION_REFERENCE.md` from the registry |
|
|
505
|
+
|
|
506
|
+
```bash
|
|
507
|
+
uap config set recipes.enabled true
|
|
508
|
+
uap config set realtimeAdapt.enabled false # opt out of real-time adaptation
|
|
509
|
+
uap config doctor
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
---
|
|
513
|
+
|
|
514
|
+
## `design`
|
|
515
|
+
|
|
516
|
+
DESIGN.md integration: interrogate an existing UI into a design brief, lint UI
|
|
517
|
+
work against it, and gate off-token colors / off-scale spacing.
|
|
518
|
+
|
|
519
|
+
| Flag | Purpose |
|
|
520
|
+
|------|---------|
|
|
521
|
+
| `-d, --project-dir <path>` | Project directory (default: cwd) |
|
|
522
|
+
| `-o, --out <path>` | Output path for `interrogate` (default `DESIGN.md`) |
|
|
523
|
+
| `--force` | Overwrite an existing DESIGN.md |
|
|
524
|
+
| `-f, --file <path>` | Target file (lint/check) or `"old,new"` (diff) |
|
|
525
|
+
| `--json` | Machine-readable output |
|
|
526
|
+
|
|
527
|
+
---
|
|
528
|
+
|
|
529
|
+
## `proxy`
|
|
530
|
+
|
|
531
|
+
Reference-counted, session-scoped lifecycle for the local inference proxy (the
|
|
532
|
+
Anthropic-compatible gateway in front of a local llama.cpp/Qwen). Hooks
|
|
533
|
+
`ensure`/`release` it per session so it starts on demand and stops when the last
|
|
534
|
+
session leaves — but it never kills a proxy that systemd manages or that other
|
|
535
|
+
sessions still use.
|
|
536
|
+
|
|
537
|
+
`uap proxy [ensure | release | status | start | stop | restart | enable | disable]`
|
|
538
|
+
|
|
539
|
+
| Flag | Purpose |
|
|
540
|
+
|------|---------|
|
|
541
|
+
| `--client <id>` | Client/session id (defaults to the session env or parent pid) |
|
|
542
|
+
| `--client-pid <n>` | Long-lived agent pid for liveness (hooks pass `$PPID`) |
|
|
543
|
+
| `--port <n>` | Proxy port (default 4000 / `$PROXY_PORT`) |
|
|
544
|
+
| `--if-enabled` | No-op unless `.uap.json` `proxy.autostart` is true (hook-safe) |
|
|
545
|
+
| `--quiet` / `--json` | Suppress output (hooks) / machine-readable status |
|
|
546
|
+
|
|
547
|
+
```bash
|
|
548
|
+
uap proxy status --json
|
|
549
|
+
uap proxy restart # e.g. after changing PROXY_* in .uap/proxy.env
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
The proxy binds `127.0.0.1` by default; see the proxy `PROXY_*` settings in the
|
|
553
|
+
[Configuration Reference](CONFIGURATION_REFERENCE.md) and [Local Models](../guides/LOCAL_MODELS.md).
|
|
554
|
+
|
|
555
|
+
---
|
|
556
|
+
|
|
557
|
+
## `orchestrator`
|
|
558
|
+
|
|
559
|
+
Toggle the long multi-turn deliver orchestrator (blackboard decomposition +
|
|
560
|
+
epic controller for big autonomous builds). Persists to `.uap.json`
|
|
561
|
+
(`deliver.orchestrate`).
|
|
562
|
+
|
|
563
|
+
`uap orchestrator [on | off | auto | status]` — `auto` (default) engages it only
|
|
564
|
+
for large multi-epic work. See [Orchestrator & Hands-Free](../guides/ORCHESTRATOR.md).
|
|
565
|
+
|
|
566
|
+
---
|
|
567
|
+
|
|
568
|
+
## `handsfree`
|
|
569
|
+
|
|
570
|
+
Hands-free persistence (alias `hf`): drive any model to keep working until the
|
|
571
|
+
multi-epic build **completion ledger** is 100% done instead of stopping early.
|
|
572
|
+
Auto-on.
|
|
573
|
+
|
|
574
|
+
`uap handsfree [status | on | off | init | complete <id> | fail <id> | remaining | stop-check]`
|
|
575
|
+
|
|
576
|
+
| Flag | Purpose |
|
|
577
|
+
|------|---------|
|
|
578
|
+
| `--mission <text>` | Mission text for `init` |
|
|
579
|
+
| `--items <json>` | JSON array of ledger items for `init` |
|
|
580
|
+
|
|
581
|
+
See [Orchestrator & Hands-Free](../guides/ORCHESTRATOR.md).
|
|
582
|
+
|
|
583
|
+
---
|
|
584
|
+
|
|
585
|
+
## `challenge`
|
|
586
|
+
|
|
587
|
+
Open multi-agent challenge: a shared goal, verified submissions, and a
|
|
588
|
+
significance-gated leaderboard (scores within a ROPE margin of the leader are
|
|
589
|
+
ties, not wins).
|
|
590
|
+
|
|
591
|
+
| Subcommand | Key flags | Purpose |
|
|
592
|
+
|------------|-----------|---------|
|
|
593
|
+
| `open` | `--metric <name>`, `--rope-margin <x>`, `--lower-is-better` | Open a challenge with a shared goal + scoring metric |
|
|
594
|
+
| `submit` / `leaderboard` / `status` | — | Submit a verified result / view the ranked board / show state |
|
|
595
|
+
|
|
596
|
+
```bash
|
|
597
|
+
uap challenge open --metric tps --rope-margin 4
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
---
|
|
601
|
+
|
|
602
|
+
## `sandbox`
|
|
603
|
+
|
|
604
|
+
Run a command with a kernel-enforced workdir boundary (bubblewrap): only the
|
|
605
|
+
current dir + scratch are writable, so writes outside fail at the kernel — the
|
|
606
|
+
boundary `--dangerously-skip-permissions` cannot bypass.
|
|
607
|
+
|
|
608
|
+
```bash
|
|
609
|
+
uap sandbox -- <command> [args...]
|
|
610
|
+
```
|
|
611
|
+
|
|
612
|
+
See [Sandbox](../guides/SANDBOX.md).
|
|
613
|
+
|
|
614
|
+
---
|
|
615
|
+
|
|
616
|
+
## `react`
|
|
617
|
+
|
|
618
|
+
Resolve the dynamic UAP capabilities (experts / skills / patterns) for a
|
|
619
|
+
lifecycle event and emit JSON — the engine behind the per-prompt Reactor. Hook
|
|
620
|
+
adapters pipe a JSON `ReactorContext` on stdin; the flags below are for manual
|
|
621
|
+
invocation.
|
|
622
|
+
|
|
623
|
+
| Flag | Purpose |
|
|
624
|
+
|------|---------|
|
|
625
|
+
| `--event <event>` | `user-prompt \| session-start \| pre-tool \| post-tool \| stop \| session-end` |
|
|
626
|
+
| `--prompt <text>` | Prompt text (when not piping a JSON payload) |
|
|
627
|
+
| `-f, --files <files...>` | Changed files (routing signal) |
|
|
628
|
+
| `--inject-threshold <n>` | Min confidence to inject (default 0.30) |
|
|
629
|
+
| `--auto-spawn-threshold <n>` | Min confidence to auto-spawn an expert (default 0.80) |
|
|
630
|
+
| `--max-inject-chars <n>` | Inject character budget (default 1200) |
|
|
631
|
+
|
|
632
|
+
See [Reactor (auto-apply)](../design/UAP_REACTOR.md).
|
|
633
|
+
|
|
634
|
+
---
|
|
635
|
+
|
|
636
|
+
## `status`
|
|
637
|
+
|
|
638
|
+
Show HALO trace collection state (enabled, path, span count). `--json` for
|
|
639
|
+
machine-readable output. (Equivalent to `uap harness status`.)
|
|
640
|
+
|
|
641
|
+
---
|
|
642
|
+
|
|
382
643
|
## `ideate`
|
|
383
644
|
|
|
384
645
|
Divergent ideation (open-collider): generate non-trivial ideas for hard
|
|
@@ -598,6 +598,30 @@ The serving recipe the proxy applies (mirror of `recipes.recipe`, consumed by th
|
|
|
598
598
|
|
|
599
599
|
**Recommendation:** Keep in sync with `recipes.recipe`; `uap setup`/`uap config` write both.
|
|
600
600
|
|
|
601
|
+
### `realtimeAdapt.enabled`
|
|
602
|
+
|
|
603
|
+
| | |
|
|
604
|
+
|---|---|
|
|
605
|
+
| **Where** | `.uap.json` |
|
|
606
|
+
| **Type** | boolean |
|
|
607
|
+
| **Default** | `true` |
|
|
608
|
+
|
|
609
|
+
Real-time flag adaptation (LLM Self-Tuning P4): the reactor emits per-session adjustments from live signals (tool-failure/quality/context/RECON) so the proxy can escalate or converge mid-session. This is the effective master switch — off means no signal is emitted.
|
|
610
|
+
|
|
611
|
+
**Recommendation:** Leave on. It is conservative (emits only when a live signal breaches a threshold) and is the effective master switch — disabling it turns the whole feature off regardless of the proxy side.
|
|
612
|
+
|
|
613
|
+
### `PROXY_REALTIME_ADAPT`
|
|
614
|
+
|
|
615
|
+
| | |
|
|
616
|
+
|---|---|
|
|
617
|
+
| **Where** | `.uap/proxy.env` |
|
|
618
|
+
| **Type** | boolean |
|
|
619
|
+
| **Default** | `true` |
|
|
620
|
+
|
|
621
|
+
Proxy side of real-time adaptation: whether the serving proxy honors a fresh adaptation signal per request. Auto-on; harmless when no emitter is running (no signal to honor).
|
|
622
|
+
|
|
623
|
+
**Recommendation:** Leave on. Set `false` only to make the proxy ignore adaptation signals even when the reactor emits them.
|
|
624
|
+
|
|
601
625
|
## Dashboard
|
|
602
626
|
|
|
603
627
|
<a id="dashboard"></a>The live analytics server and its mutation token.
|
|
@@ -231,7 +231,19 @@ Hierarchical MCP router that collapses 150+ MCP tools to 2
|
|
|
231
231
|
| Subsystem | Description |
|
|
232
232
|
|-----------|-------------|
|
|
233
233
|
| Observability (`observability/halo-exporter.ts`) | Emits agent/LLM/tool spans as OTLP/OpenInference JSONL for the HALO engine. Opt-in via `UAP_HALO_TRACE`; zero-overhead when off. |
|
|
234
|
-
| Telemetry (`telemetry/session-telemetry.ts`) | Session-level telemetry capture. |
|
|
234
|
+
| Telemetry (`telemetry/session-telemetry.ts`) | Session-level telemetry capture, incl. per-turn quality estimates for real-time tuning. |
|
|
235
|
+
|
|
236
|
+
## Self-Improvement (`src/self-harness/`, `src/self-tuning/`) — Feedback
|
|
237
|
+
|
|
238
|
+
> **Stage: Feedback.** The floor doesn't just log its mistakes — it rewrites its
|
|
239
|
+
> own harness to stop making them. Two closed loops, both validated by the same
|
|
240
|
+
> paired benchmark so a "fix" is never accepted on faith.
|
|
241
|
+
|
|
242
|
+
| Subsystem | Description |
|
|
243
|
+
|-----------|-------------|
|
|
244
|
+
| Self-Harness (`self-harness/`) | Autonomous mine → propose → validate → decide loop over a bounded, reversible **Mod DSL** (proxy/llama env knobs, scaffold text, middleware, and settings-registry `ConfigMod`s). Cross-model transfer store; online production-trace mining. Fixes **correctness** bugs. `uap self-harness`. |
|
|
245
|
+
| Self-Tuning (`self-tuning/`) | `uap tune` — raises a small model toward Opus by tuning UAP's flag surface against a multi-dimensional **quality** score. LLM-guided proposals with a real Gaussian-process Bayesian-optimizer fallback; atomic rollback-safe flag writes; per-model tuning profiles (bundled qwen3.6 / Opus). |
|
|
246
|
+
| Real-time adaptation (`self-tuning/realtime-adaptor.ts`) | Per-session flag adjustments from live signals (tool-failure / quality / context pressure / RECON loop) over the adaptation-signal channel the proxy honors mid-session. **Auto-on**; opt out with `realtimeAdapt.enabled:false`. |
|
|
235
247
|
|
|
236
248
|
## Browser & Benchmarks — QC / Verify
|
|
237
249
|
|
|
@@ -267,7 +279,10 @@ similarity, and system resource detection.
|
|
|
267
279
|
|
|
268
280
|
The `uap` CLI is the single door into the whole factory (top-level commands):
|
|
269
281
|
`init`, `setup`, `analyze`, `generate`, `memory`, `patterns`, `worktree`,
|
|
270
|
-
`sync`, `droids`, `expert-route`, `deliver`, `harness` (HALO),
|
|
271
|
-
`
|
|
272
|
-
`
|
|
273
|
-
`
|
|
282
|
+
`sync`, `droids`, `expert-route`, `deliver`, `verify`, `harness` (HALO),
|
|
283
|
+
`bench`, `self-harness`, `tune`, `config`, `design`, `proxy`, `orchestrator`,
|
|
284
|
+
`handsfree` (`hf`), `challenge`, `sandbox`, `react`, `ideate`, `coord`, `agent`,
|
|
285
|
+
`deploy`, `task`, `compliance`, `coordination`, `skill`, `update`,
|
|
286
|
+
`dashboard` (alias `dash`), `model`, `mcp-router`, `hooks`, `tool-calls`,
|
|
287
|
+
`rtk`, `mcp-setup`, `schema-diff`, `policy`, `uap-omp`. See
|
|
288
|
+
[CLI reference](CLI.md) for every command and flag.
|
package/package.json
CHANGED
|
Binary file
|