@miller-tech/uap 1.43.2 → 1.43.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 CHANGED
@@ -18,6 +18,7 @@ New here? Start with the [project README](../README.md), then [Getting Started](
18
18
 
19
19
  | Doc | What it covers |
20
20
  |---|---|
21
+ | [**What UAP Does Automatically**](guides/AUTOMATIC.md) | Every feature in benefit / when-it-kicks-in terms — install once, it all self-applies ⭐ |
21
22
  | [**`uap deliver`**](guides/DELIVER.md) | The delivery harness — convergence loop to verified completion ⭐ |
22
23
  | [Memory](guides/MEMORY.md) | The 4-tier memory system, write-gates, semantic recall |
23
24
  | [MCP Router](guides/MCP_ROUTER.md) | Token-optimizing tool proxy + FTS5 output compression |
@@ -28,6 +29,7 @@ New here? Start with the [project README](../README.md), then [Getting Started](
28
29
  | [Deploy Batching](guides/DEPLOY_BATCHING.md) | Conflict-free batched git/deploy actions |
29
30
  | [Coordination](guides/COORDINATION.md) | Multi-agent overlap detection |
30
31
  | [Local Models](guides/LOCAL_MODELS.md) | Running agents against local llama.cpp / Qwen models |
32
+ | [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 |
31
33
 
32
34
  ## Architecture
33
35
 
@@ -0,0 +1,92 @@
1
+ # What UAP Does For You — Automatically
2
+
3
+ > The whole point of UAP: **you install it once, and every feature applies itself
4
+ > as you code.** You don't call commands or remember protocols. UAP watches the
5
+ > coding agent's lifecycle (session start, every prompt, every tool call, every
6
+ > stop) and injects the right help or enforces the right guardrail *at the moment
7
+ > it's needed*.
8
+
9
+ ```bash
10
+ npx @miller-tech/uap init # one-time, per project
11
+ # …that's it. Open your coding agent and everything below is live.
12
+ ```
13
+
14
+ `init`/`setup` wire UAP into whichever agent you use — Claude Code, Cursor,
15
+ OpenCode, Factory, VSCode, Codex — by installing lifecycle hooks and the MCP
16
+ router. After that the features are **on by default and apply themselves as
17
+ appropriate**. Nothing here needs to be invoked by hand.
18
+
19
+ ---
20
+
21
+ ## How to read this
22
+
23
+ Two kinds of automatic behaviour, and they're deliberately different:
24
+
25
+ - **Assist** (dynamic, *helps* you): surfaces the right context — experts,
26
+ skills, patterns, memories — by *injecting* it where the model will see it.
27
+ It's confidence-gated, so quiet on conversational turns and rich on real
28
+ coding tasks. It never blocks; worst case it stays silent.
29
+ - **Enforce** (deterministic, *protects* you): hard guardrails that *block* a
30
+ tool call when it would violate a rule (edit outside a worktree, skip
31
+ delivery, run a dangerous command). Each has an escape hatch for the rare
32
+ sanctioned exception.
33
+
34
+ For every feature below: **what it does for you**, and **when it kicks in**.
35
+
36
+ ---
37
+
38
+ ## Assist — the right help shows up on its own
39
+
40
+ | Feature | What it does for you | When it kicks in |
41
+ |---|---|---|
42
+ | **Reactor** (dynamic routing) | On every prompt, surfaces the expert droids, skills, and enforcement patterns relevant to *this* task, so the agent works like it already knows the domain. | Every substantive prompt (`UserPromptSubmit` / per-message). Confidence-gated — silent on "thanks"/"merge it", rich on "fix the auth race condition". |
43
+ | **Memory recall** | Pulls back the lessons, decisions, and gotchas you (or another agent) learned before, so mistakes aren't repeated and context survives across sessions. | Session start (recent + high-importance memories) and per-prompt semantic recall on the task text. |
44
+ | **Pattern RAG** | Injects battle-tested execution patterns (Output-Existence, Decoder-First, Round-Trip verify, …) mined from Terminal-Bench, so the agent uses the approach that actually passes. | Per-prompt, matched to the task; full set retrievable on demand via Qdrant. |
45
+ | **Expert droids** | Routes domain work (security, performance, data, testing, …) to a specialist persona instead of a generalist guess. | When the capability router matches the task's type/files — recommended automatically, with optional auto-spawn above a confidence threshold. |
46
+ | **Skills** | Surfaces the right *procedure* (git-forensics, compression, SQLite-WAL recovery, polyglot, …) for the task at hand. | Per-prompt match against the task; top-N surfaced. |
47
+ | **Model routing** | Picks the right model tier per step (plan with the strong model, execute with the fast one) instead of one model for everything. | On task classification, by complexity and role. |
48
+
49
+ You don't ask for any of this. It appears in the agent's context the moment the
50
+ task warrants it, and stays out of the way when it doesn't.
51
+
52
+ ---
53
+
54
+ ## Enforce — the guardrails that keep work safe and verified
55
+
56
+ | Feature | What it does for you | When it kicks in |
57
+ |---|---|---|
58
+ | **Delivery enforcement** (`uap deliver`, **block by default**) | Routes substantive coding through the **convergence loop** — which iterates a model against your real gates (build, type-check, tests) until the change is *verified*, not just plausible. This is what **uplifts small local models well above their weight**: a 3B-active model that would flail on one shot succeeds when driven to green against the gates. | The moment the agent tries to edit a **source** file directly. Docs/configs/scripts/tests are exempt — only real implementation work is gated. Escape: `UAP_DELIVER_BYPASS=1`, or relax with `UAP_ENFORCE_DELIVERY=advisory`. |
59
+ | **Worktree isolation** | Forces code changes into an isolated `.worktrees/NNN-slug/` branch so you never clobber your working tree and every change is a clean, reviewable branch with an auto-PR. | Any source edit outside a worktree is blocked (`PreToolUse`). |
60
+ | **Policy / compliance gates** | Block non-compliant tool calls before they run — dangerous shell (force-push, `terraform apply`), edits that skip a schema diff, plan-before-read violations, etc. | `PreToolUse` on every Edit/Write/Bash/Task call. |
61
+ | **Schema-diff gate** | Flags breaking API/contract changes so you diff-and-verify consumers before shipping them. | After editing a schema/contract file (`*.schema.ts`, `types.ts`, `.proto`, `.graphql`, …). |
62
+ | **Completion gates** | Won't let the agent declare "done" until build/type-check/tests actually pass and a version bump happened. | On `Stop` (end of turn). |
63
+ | **Coordination** | Detects when multiple agents would touch the same files and prevents them stepping on each other. | Session start (register) + work announcement before claiming a task. |
64
+ | **rtk token-optimization** | Rewrites heavy CLI output (git/docker/npm/…) into compact form so the agent burns far fewer tokens reading command output. | Every wrapped CLI command. |
65
+ | **Deploy batching** | Queues changes into conflict-free batched commits/deploys instead of racy one-off pushes. | On `uap deliver --deploy` success. |
66
+
67
+ Each enforce-gate has a sanctioned escape hatch (an env var) for the rare case
68
+ you genuinely need to bypass it — so the guardrail is firm, not a cage.
69
+
70
+ ---
71
+
72
+ ## Behind it all
73
+
74
+ | Feature | What it does for you | When it kicks in |
75
+ |---|---|---|
76
+ | **MCP router** | Exposes a tiny meta-tool surface (`discover_tools`/`execute_tool`/`deliver`/`react`) instead of 150+ tools, cutting tool-schema tokens by ~98%. | Wired at install; used whenever the agent discovers/runs a tool. |
77
+ | **HALO trace analysis** | Mines your execution traces for systemic failure modes (loops, stalls) so the harness gets better over time. | Session end / on demand (`uap harness analyze`). |
78
+ | **4-tier memory** | Short-term (recent), long-term (semantic Qdrant), coordination, and patterns — the substrate the recall/pattern features draw from. | Continuously; written on significant decisions, read on recall. |
79
+
80
+ ---
81
+
82
+ ## The one-liner
83
+
84
+ **Install UAP, then just code.** The assist layer makes your agent act like a
85
+ domain expert with perfect recall; the enforce layer makes sure whatever it
86
+ produces is isolated, verified, and safe — and it drives even small local models
87
+ to *verified* results they couldn't reach in one shot. You never invoke any of
88
+ it; it applies itself, in the right place, at the right time.
89
+
90
+ See also: [`uap deliver`](DELIVER.md) · [Local Models](LOCAL_MODELS.md) ·
91
+ [Droids & Skills](DROIDS_AND_SKILLS.md) · [Policies](POLICIES.md) ·
92
+ the [Reactor design](../design/UAP_REACTOR.md).
@@ -7,6 +7,11 @@ UAP can drive its coding/convergence loop against **local models** served by
7
7
  This keeps inference on your own hardware (zero per-token cost) and works with
8
8
  quantized open-weight models such as Qwen 3.x.
9
9
 
10
+ > **Just want the recommended local setup?** See
11
+ > [Qwen3.6 35B-A3B on llama.cpp, by VRAM tier](QWEN36_LLAMACPP.md) for
12
+ > copy-paste launch commands for 8 / 12 / 16 / 24 / 32 GB GPUs, and how
13
+ > `uap deliver` uplifts a small local model to *verified* results.
14
+
10
15
  There are two endpoint shapes involved, and it matters which client speaks
11
16
  which protocol:
12
17
 
@@ -0,0 +1,110 @@
1
+ # Qwen3.6 35B-A3B on llama.cpp, by VRAM tier — with UAP
2
+
3
+ This is the recommended local stack for UAP: **Qwen3.6 35B-A3B** (a Mixture-of-
4
+ Experts model with only **~3B active parameters** per token) served by
5
+ **llama.cpp**, driven by **UAP's automatic features** — above all `uap deliver`,
6
+ which iterates the model against your real build/test gates until the change is
7
+ *verified*. That convergence loop is what lets a small, cheap, local model
8
+ **punch well above its weight**: one-shot it would flail; driven to green it
9
+ delivers.
10
+
11
+ Because the active footprint is ~3B, this model runs usefully even on modest
12
+ GPUs by **offloading the (sparse, mostly-idle) expert tensors to system RAM**
13
+ while keeping attention on the GPU. The knob for that is `--n-cpu-moe`.
14
+
15
+ ## Get the model
16
+
17
+ A 4-bit quant is the sweet spot for coding (quality vs. size). The full weights
18
+ are ~18–19 GB at IQ4_XS:
19
+
20
+ ```
21
+ Qwen3.6-35B-A3B-UD-IQ4_XS.gguf # ~18–19 GB on disk
22
+ # (a *-MTP.gguf build adds multi-token prediction for faster decode — use it if you have it)
23
+ ```
24
+
25
+ ## The base llama-server command
26
+
27
+ UAP speaks the OpenAI-compatible endpoint, so serve on `:8080/v1`. The flags
28
+ below are the ones that matter; the per-tier table just changes `--n-cpu-moe`,
29
+ `--ctx-size`, and the KV-cache type.
30
+
31
+ ```bash
32
+ llama-server \
33
+ --model Qwen3.6-35B-A3B-UD-IQ4_XS.gguf \
34
+ --host 0.0.0.0 --port 8080 \
35
+ --gpu-layers 99 \ # put all layers on GPU; experts get pulled back by --n-cpu-moe
36
+ --n-cpu-moe <PER TIER> \ # how many layers keep their MoE experts in CPU RAM
37
+ --ctx-size <PER TIER> \
38
+ --cache-type-k <q4_0|q8_0> --cache-type-v <q4_0|q8_0> \ # quantize KV cache to save VRAM
39
+ --flash-attn on \ # faster + less VRAM
40
+ --jinja \ # use the model's chat template (REQUIRED for tool calls)
41
+ --parallel 1
42
+ ```
43
+
44
+ > **`--jinja` / the chat template is non-negotiable for agent use.** Qwen3.6
45
+ > emits *native* OpenAI tool calls, but only when its chat template is active.
46
+ > If tools silently never fire, that's the cause — run `uap tool-calls setup`
47
+ > to install/repair the template, and `uap tool-calls status` to check.
48
+
49
+ ## VRAM tiers
50
+
51
+ Values are **starting points** — exact `--n-cpu-moe` depends on your build and
52
+ layer count. Rule of thumb: **raise `--n-cpu-moe` if you OOM, lower it for more
53
+ speed.** "System RAM" is what the offloaded experts need *in addition* to the
54
+ GPU.
55
+
56
+ | VRAM | `--n-cpu-moe` | `--ctx-size` | KV cache | System RAM | What to expect |
57
+ |---|---|---|---|---|---|
58
+ | **8 GB** | `99` (all experts → CPU) | `8192` | `q4_0` | ≥ 32 GB | Attention on GPU, all experts on CPU. Decode is CPU-bandwidth-bound (a few tok/s) — slow but *real*. `uap deliver` makes it productive by driving to verified completion instead of needing a strong one-shot. |
59
+ | **12 GB** | `~36` | `16384` | `q4_0` | ≥ 32 GB | Keep ~the top experts on GPU, rest on CPU. Noticeably faster than 8 GB. |
60
+ | **16 GB** | `~24` | `24576` | `q4_0` | ≥ 24 GB | Roughly half the experts on GPU. Comfortable for most coding tasks. |
61
+ | **24 GB** | *omit* (full model on GPU) | `32768`–`65536` | `q8_0` | 16 GB | **Sweet spot** (RTX 3090/4090). Weights + KV fit on-GPU; use `q8_0` KV for quality, `q4_0` if you want more context. Add `--flash-attn on`. |
62
+ | **32 GB** | *omit* | `131072` | `q8_0`/`f16` | 16 GB | Full model + large context. Add `--parallel 2–4` for concurrent sessions, bump `--batch-size`/`--ubatch-size`. |
63
+
64
+ Speed extras (any tier): `--flash-attn on` (always), and if your build supports
65
+ it, **self-speculation / MTP** (the `*-MTP.gguf` model, or `--draft-*` flags with
66
+ a tiny draft model) for materially faster decode.
67
+
68
+ ## Point UAP at it
69
+
70
+ ```bash
71
+ # 1) Tell UAP where the model lives (OpenAI-compatible endpoint)
72
+ export UAP_INFERENCE_ENDPOINT="http://localhost:8080/v1"
73
+ # (or set the endpoint on the model preset in .uap.json / src/models/types.ts)
74
+
75
+ # 2) Make sure tool calls work
76
+ uap tool-calls setup # install the chat template + helpers
77
+ uap tool-calls status # verify
78
+
79
+ # 3) That's it — code as normal. Everything is automatic from here.
80
+ ```
81
+
82
+ Once installed, **you don't run `uap deliver` by hand** — delivery enforcement
83
+ is on by default, so when your agent goes to implement something it's routed
84
+ through the convergence loop automatically (see
85
+ [What UAP Does For You, Automatically](AUTOMATIC.md)). If you *want* to drive a
86
+ task explicitly:
87
+
88
+ ```bash
89
+ uap deliver "implement a token-bucket rate limiter with tests"
90
+ ```
91
+
92
+ ## Why this punches above its weight
93
+
94
+ A 3B-active model rarely nails a non-trivial change in one shot. UAP changes the
95
+ game without changing the model:
96
+
97
+ - **`uap deliver`** loops execute → run-the-gates → fix → re-run until build,
98
+ type-check, and tests all pass — turning "plausible" into "verified".
99
+ - **Pattern RAG + expert routing** (automatic) put the right approach and the
100
+ right specialist persona in front of the model before it starts.
101
+ - **Memory** stops it re-making the same mistakes across turns and sessions.
102
+ - **Worktree + completion gates** keep every attempt isolated and only let
103
+ "done" mean *actually done*.
104
+
105
+ Net effect: a local, zero-per-token, 4-bit MoE model produces verified results
106
+ that a naive one-shot of a much larger model often won't — and it runs on a GPU
107
+ you already own.
108
+
109
+ See also: [Local Models](LOCAL_MODELS.md) · [`uap deliver`](DELIVER.md) ·
110
+ [Automatic features](AUTOMATIC.md).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miller-tech/uap",
3
- "version": "1.43.2",
3
+ "version": "1.43.3",
4
4
  "description": "Autonomous AI agent memory system with CLAUDE.md protocol enforcement",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",