@miller-tech/uap 1.40.0 → 1.40.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 +109 -642
- package/docs/INDEX.md +48 -286
- package/docs/architecture/OVERVIEW.md +328 -0
- package/docs/architecture/PROTOCOL.md +204 -0
- package/docs/benchmarks/README.md +17 -192
- package/docs/getting-started/CONFIGURATION.md +237 -0
- package/docs/getting-started/INSTALLATION.md +125 -0
- package/docs/getting-started/QUICKSTART.md +115 -0
- package/docs/guides/COORDINATION.md +162 -0
- package/docs/guides/DELIVER.md +115 -0
- package/docs/guides/DEPLOY_BATCHING.md +212 -0
- package/docs/guides/DROIDS_AND_SKILLS.md +202 -0
- package/docs/guides/LOCAL_MODELS.md +148 -0
- package/docs/guides/MCP_ROUTER.md +195 -0
- package/docs/guides/MEMORY.md +235 -0
- package/docs/guides/MULTI_MODEL.md +223 -0
- package/docs/guides/POLICIES.md +190 -0
- package/docs/guides/WORKTREE_WORKFLOW.md +185 -0
- package/docs/integrations/MCP_ROUTER.md +147 -0
- package/docs/integrations/RTK.md +102 -0
- package/docs/reference/API.md +485 -0
- package/docs/reference/CLI.md +719 -0
- package/docs/reference/CONFIGURATION.md +90 -193
- package/docs/reference/DATABASE_SCHEMA.md +110 -344
- package/docs/reference/FEATURES.md +176 -472
- package/docs/reference/PATTERNS.md +102 -0
- package/docs/reference/PLATFORMS.md +83 -0
- package/package.json +1 -1
- package/docs/AGENTS.md +0 -423
- package/docs/DOCUMENTATION_AUDIT_REPORT.md +0 -131
- package/docs/GETTING_STARTED.md +0 -288
- package/docs/PROJECT_ANALYSIS_REPORT.md +0 -510
- package/docs/architecture/COMPLETE_ARCHITECTURE.md +0 -748
- package/docs/architecture/EXPERT_STACK.md +0 -137
- package/docs/architecture/MULTI_MODEL.md +0 -224
- package/docs/architecture/PLATFORM_GATING.md +0 -68
- package/docs/architecture/SYSTEM_ANALYSIS.md +0 -334
- package/docs/architecture/UAP_COMPLIANCE.md +0 -217
- package/docs/architecture/UAP_PROTOCOL.md +0 -339
- package/docs/architecture/UAP_STRICT_DROIDS.md +0 -172
- package/docs/archive/BALLS_MODE_SELF_ANALYSIS.md +0 -260
- package/docs/archive/BENCHMARK_GAPS_AND_PLAN.md +0 -146
- package/docs/archive/FAILING_TASKS_SOLUTION_PLAN.md +0 -668
- package/docs/archive/JINJA2-SYSTEM-MESSAGE-FIX.md +0 -209
- package/docs/archive/MODEL_ROUTING_IMPLEMENTATION_SUMMARY.md +0 -281
- package/docs/archive/MODEL_ROUTING_OPTIMIZATION_PLAN.md +0 -320
- package/docs/archive/NPM-PUBLISH-V0.9.1.md +0 -240
- package/docs/archive/OPTIMIZATION_OPTIONS.md +0 -334
- package/docs/archive/PARALLELISM_GAPS_AND_OPTIONS.md +0 -422
- package/docs/archive/POLICY_GATE_IMPLEMENTATION.md +0 -245
- package/docs/archive/SETUP_IMPROVEMENTS.md +0 -213
- package/docs/archive/UAP_GENERIC_OPTIMIZATION_PLAN.md +0 -270
- package/docs/archive/UAP_OPTIMIZATION_PLAN.md +0 -701
- package/docs/archive/UAP_V103_PATTERN_DESIGN.md +0 -315
- package/docs/archive/UAP_V104_COMPLIANCE_DESIGN.md +0 -223
- package/docs/archive/changelog/2026-03-10_uap-100-compliance.md +0 -77
- package/docs/archive/changelog/2026-03-10_uap-full-system-verification.md +0 -109
- package/docs/archive/opencode-integration-guide.md +0 -740
- package/docs/archive/opencode-integration-quickref.md +0 -180
- package/docs/benchmarks/OVERNIGHT_RUNNER.md +0 -341
- package/docs/benchmarks/SPECULATIVE_DECODING_JOURNEY_2026-03.md +0 -221
- package/docs/benchmarks/VALIDATION_PLAN.md +0 -568
- package/docs/blog/SPECULATIVE_DECODING_PRODUCTION_PLAYBOOK.md +0 -139
- package/docs/blog/local-coding-agents.md +0 -266
- package/docs/blog/x-thread.md +0 -254
- package/docs/deployment/DEPLOYMENT.md +0 -895
- package/docs/deployment/DEPLOYMENT_STRATEGIES.md +0 -518
- package/docs/deployment/DEPLOY_BATCHER_ANALYSIS.md +0 -224
- package/docs/deployment/DEPLOY_BATCHING.md +0 -273
- package/docs/deployment/DEPLOY_BUCKETING_ANALYSIS.md +0 -420
- package/docs/deployment/QWEN35_LLAMA_CPP.md +0 -426
- package/docs/deployment/UAP_LLAMA_ANTHROPIC_PROXY_BOOTSTRAP.md +0 -279
- package/docs/getting-started/INTEGRATION.md +0 -628
- package/docs/getting-started/OVERVIEW.md +0 -324
- package/docs/getting-started/SETUP.md +0 -377
- package/docs/integrations/MCP_ROUTER_SETUP.md +0 -445
- package/docs/integrations/RTK_INTEGRATION.md +0 -468
- package/docs/operations/TROUBLESHOOTING.md +0 -660
- package/docs/pr/PR_SPECULATIVE_DOCS_TEMPLATE.md +0 -146
- package/docs/pr/UPSTREAM_PRS.md +0 -424
- package/docs/reference/API_REFERENCE.md +0 -903
- package/docs/reference/EXPERT_DROIDS.md +0 -219
- package/docs/reference/HARNESS-MATRIX.md +0 -318
- package/docs/reference/PATTERN_LIBRARY.md +0 -636
- package/docs/reference/UAP_CLI_REFERENCE.md +0 -620
- package/docs/research/BEHAVIORAL_PATTERNS.md +0 -228
- package/docs/research/DOMAIN_STRATEGIES.md +0 -316
- package/docs/research/MEMORY_SYSTEMS_COMPARISON.md +0 -812
- package/docs/research/PATTERN_ANALYSIS_2026-01-18.md +0 -436
- package/docs/research/PERFORMANCE_ANALYSIS_2026-01-18.md +0 -209
- package/docs/research/PERFORMANCE_TEST_PLAN.md +0 -383
- package/docs/research/TERMINAL_BENCH_LEARNINGS.md +0 -217
|
@@ -1,748 +0,0 @@
|
|
|
1
|
-
# UAP Complete Architecture
|
|
2
|
-
|
|
3
|
-
> **Version:** 1.18.0
|
|
4
|
-
> **Last Updated:** 2026-03-28
|
|
5
|
-
> **Status:** ✅ Production Ready
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Table of Contents
|
|
10
|
-
|
|
11
|
-
1. [System Overview](#system-overview)
|
|
12
|
-
2. [Memory Architecture](#memory-architecture)
|
|
13
|
-
3. [Coordination System](#coordination-system)
|
|
14
|
-
4. [Multi-Model Architecture](#multi-model-architecture)
|
|
15
|
-
5. [Policy Enforcement](#policy-enforcement)
|
|
16
|
-
6. [Deploy Batching](#deploy-batching)
|
|
17
|
-
7. [MCP Router](#mcp-router)
|
|
18
|
-
8. [Worktree System](#worktree-system)
|
|
19
|
-
9. [Pattern System](#pattern-system)
|
|
20
|
-
10. [Integration Patterns](#integration-patterns)
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## System Overview
|
|
25
|
-
|
|
26
|
-
### High-Level Architecture
|
|
27
|
-
|
|
28
|
-
```mermaid
|
|
29
|
-
graph TB
|
|
30
|
-
subgraph "AI Agent Layer"
|
|
31
|
-
CLAUDE[Claude Code]
|
|
32
|
-
FACTORY[Factory.AI]
|
|
33
|
-
OPencode[OpenCode]
|
|
34
|
-
FORGE[ForgeCode]
|
|
35
|
-
VSCODE[VSCode]
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
subgraph "UAP Core"
|
|
39
|
-
CLI[CLI Interface]
|
|
40
|
-
MEM[Memory System]
|
|
41
|
-
COORD[Coordination Service]
|
|
42
|
-
TASKS[Task Management]
|
|
43
|
-
MODELS[Multi-Model Router]
|
|
44
|
-
POLICY[Policy Enforcement]
|
|
45
|
-
DEPLOY[Deploy Batching]
|
|
46
|
-
PATTERNS[Pattern Router]
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
subgraph "Storage Layer"
|
|
50
|
-
SQLITE[(SQLite - Working/Session)]
|
|
51
|
-
QDRANT[(Qdrant - Semantic)]
|
|
52
|
-
KG[(SQLite - Knowledge Graph)]
|
|
53
|
-
GIT[(Git Repository)]
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
subgraph "External Services"
|
|
57
|
-
OLLAMA[Ollama Embeddings]
|
|
58
|
-
OPENAI[OpenAI API]
|
|
59
|
-
GITHUB[GitHub API]
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
CLAUDE --> CLI
|
|
63
|
-
FACTORY --> CLI
|
|
64
|
-
OPencode --> CLI
|
|
65
|
-
FORGE --> CLI
|
|
66
|
-
VSCODE --> CLI
|
|
67
|
-
|
|
68
|
-
CLI --> MEM
|
|
69
|
-
CLI --> COORD
|
|
70
|
-
CLI --> TASKS
|
|
71
|
-
CLI --> MODELS
|
|
72
|
-
CLI --> POLICY
|
|
73
|
-
CLI --> DEPLOY
|
|
74
|
-
CLI --> PATTERNS
|
|
75
|
-
|
|
76
|
-
MEM --> SQLITE
|
|
77
|
-
MEM --> QDRANT
|
|
78
|
-
MEM --> KG
|
|
79
|
-
|
|
80
|
-
COORD --> SQLITE
|
|
81
|
-
COORD --> GIT
|
|
82
|
-
|
|
83
|
-
TASKS --> SQLITE
|
|
84
|
-
|
|
85
|
-
MODELS --> OLLAMA
|
|
86
|
-
MODELS --> OPENAI
|
|
87
|
-
|
|
88
|
-
POLICY --> SQLITE
|
|
89
|
-
|
|
90
|
-
DEPLOY --> GIT
|
|
91
|
-
DEPLOY --> GITHUB
|
|
92
|
-
|
|
93
|
-
PATTERNS --> KG
|
|
94
|
-
|
|
95
|
-
style MEM fill:#e3f2fd
|
|
96
|
-
style COORD fill:#fff3e0
|
|
97
|
-
style TASKS fill:#f3e5f5
|
|
98
|
-
style MODELS fill:#e8f5e9
|
|
99
|
-
style POLICY fill:#fce4ec
|
|
100
|
-
style DEPLOY fill:#e0f2f1
|
|
101
|
-
style PATTERNS fill:#f3e5f5
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### Component Inventory
|
|
105
|
-
|
|
106
|
-
| Component | Modules | Status | Impact |
|
|
107
|
-
|-----------|---------|--------|--------|
|
|
108
|
-
| Memory System | 27 | ✅ Active | 10x retention |
|
|
109
|
-
| Coordination | 8 | ✅ Active | Zero conflicts |
|
|
110
|
-
| Task Management | 7 | ✅ Active | Structured workflow |
|
|
111
|
-
| Multi-Model | 10 | ✅ Active | Optimal routing |
|
|
112
|
-
| Policy Enforcement | 8 | ✅ Active | Compliance |
|
|
113
|
-
| Deploy Batching | 1 | ✅ Active | 50-80% CI savings |
|
|
114
|
-
| MCP Router | 10 | ✅ Active | 98% token reduction |
|
|
115
|
-
| Pattern System | 23 | ✅ Active | Proven workflows |
|
|
116
|
-
| Worktrees | 1 | ✅ Active | Safe isolation |
|
|
117
|
-
| **Total** | **96** | **100%** | **Production Ready** |
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
## Memory Architecture
|
|
122
|
-
|
|
123
|
-
### Four-Layer Memory System
|
|
124
|
-
|
|
125
|
-
```mermaid
|
|
126
|
-
graph TB
|
|
127
|
-
subgraph "L1: Working Memory"
|
|
128
|
-
W1[Recent Actions]
|
|
129
|
-
W2[Current Context]
|
|
130
|
-
W3[Active Decisions]
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
subgraph "L2: Session Memory"
|
|
134
|
-
S1[Session Decisions]
|
|
135
|
-
S2[Important Context]
|
|
136
|
-
S3[Cross-Request State]
|
|
137
|
-
end
|
|
138
|
-
|
|
139
|
-
subgraph "L3: Semantic Memory"
|
|
140
|
-
SE1[Learned Lessons]
|
|
141
|
-
SE2[Patterns Discovered]
|
|
142
|
-
SE3[Solutions]
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
subgraph "L4: Knowledge Graph"
|
|
146
|
-
K1[Entities]
|
|
147
|
-
K2[Relationships]
|
|
148
|
-
K3[File Dependencies]
|
|
149
|
-
K4[Code Patterns]
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
W1 --> S1
|
|
153
|
-
W2 --> S2
|
|
154
|
-
W3 --> S3
|
|
155
|
-
S1 --> SE1
|
|
156
|
-
S2 --> SE2
|
|
157
|
-
S3 --> SE3
|
|
158
|
-
SE1 --> K1
|
|
159
|
-
SE2 --> K2
|
|
160
|
-
SE3 --> K3
|
|
161
|
-
K1 & K2 & K3 --> K4
|
|
162
|
-
|
|
163
|
-
style W1 fill:#ffcdd2
|
|
164
|
-
style S1 fill:#fff9c4
|
|
165
|
-
style SE1 fill:#c8e6c9
|
|
166
|
-
style K1 fill:#bbdefb
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
### Memory Layer Specifications
|
|
170
|
-
|
|
171
|
-
| Layer | Storage | Capacity | Latency | Retention | Use Case |
|
|
172
|
-
|-------|---------|----------|---------|-----------|----------|
|
|
173
|
-
| **L1: Working** | SQLite `memories` | 50 entries | <1ms | Session | Recent actions, current context |
|
|
174
|
-
| **L2: Session** | SQLite `session_memories` | Unlimited | <5ms | Project | Session decisions, state |
|
|
175
|
-
| **L3: Semantic** | Qdrant vectors | Unlimited | ~50ms | Permanent | Learned lessons, patterns |
|
|
176
|
-
| **L4: Knowledge** | SQLite `entities/relationships` | Unlimited | <20ms | Permanent | Entity relationships, dependencies |
|
|
177
|
-
|
|
178
|
-
### Hierarchical Memory Manager
|
|
179
|
-
|
|
180
|
-
```mermaid
|
|
181
|
-
stateDiagram-v2
|
|
182
|
-
[*] --> Hot: add() with importance >= 7
|
|
183
|
-
|
|
184
|
-
Hot --> Hot: access() high frequency
|
|
185
|
-
Hot --> Warm: rebalance() overflow (max 10)
|
|
186
|
-
|
|
187
|
-
Warm --> Hot: access() promotion
|
|
188
|
-
Warm --> Warm: access() within threshold
|
|
189
|
-
Warm --> Cold: rebalance() overflow (max 50)
|
|
190
|
-
|
|
191
|
-
Cold --> Warm: query() retrieval with relevance > 0.7
|
|
192
|
-
Cold --> Summary: consolidate() periodic
|
|
193
|
-
|
|
194
|
-
Summary --> Cold: store summary
|
|
195
|
-
|
|
196
|
-
note right of Hot
|
|
197
|
-
In-context memory
|
|
198
|
-
Max 10 entries
|
|
199
|
-
2000 tokens limit
|
|
200
|
-
Auto-promotes on access
|
|
201
|
-
end note
|
|
202
|
-
|
|
203
|
-
note right of Warm
|
|
204
|
-
Cached memory
|
|
205
|
-
Max 50 entries
|
|
206
|
-
Frequent access
|
|
207
|
-
Decays over time
|
|
208
|
-
end note
|
|
209
|
-
|
|
210
|
-
note right of Cold
|
|
211
|
-
Archived memory
|
|
212
|
-
Max 500 entries
|
|
213
|
-
Semantic search only
|
|
214
|
-
Compressed storage
|
|
215
|
-
end note
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
### Memory Decay Formula
|
|
219
|
-
|
|
220
|
-
```
|
|
221
|
-
effective_importance = importance × (0.95 ^ days_since_access)
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
**Example Decay Timeline:**
|
|
225
|
-
|
|
226
|
-
| Days Since Access | Decay Factor | Effective Importance (init: 10) |
|
|
227
|
-
|-------------------|--------------|----------------------------------|
|
|
228
|
-
| 0 | 1.00 | 10.0 |
|
|
229
|
-
| 7 | 0.70 | 7.0 |
|
|
230
|
-
| 14 | 0.50 | 5.0 |
|
|
231
|
-
| 30 | 0.21 | 2.1 |
|
|
232
|
-
| 60 | 0.04 | 0.4 |
|
|
233
|
-
| 90 | 0.01 | 0.1 |
|
|
234
|
-
|
|
235
|
-
### Memory Operations Flow
|
|
236
|
-
|
|
237
|
-
```mermaid
|
|
238
|
-
sequenceDiagram
|
|
239
|
-
participant Agent
|
|
240
|
-
participant CLI as uap memory
|
|
241
|
-
participant SQLite
|
|
242
|
-
participant Qdrant
|
|
243
|
-
participant KG as Knowledge Graph
|
|
244
|
-
|
|
245
|
-
Note over Agent: Store Memory
|
|
246
|
-
Agent->>CLI: uap memory store "lesson"
|
|
247
|
-
CLI->>SQLite: INSERT into memories (L1)
|
|
248
|
-
CLI->>SQLite: INSERT into session_memories (L2)
|
|
249
|
-
|
|
250
|
-
alt importance >= 7
|
|
251
|
-
CLI->>Qdrant: Generate embedding
|
|
252
|
-
Qdrant-->>CLI: 384-dim vector
|
|
253
|
-
CLI->>Qdrant: Upsert to collection (L3)
|
|
254
|
-
end
|
|
255
|
-
|
|
256
|
-
alt entity detected
|
|
257
|
-
CLI->>KG: Extract entity
|
|
258
|
-
KG-->>CLI: Entity ID
|
|
259
|
-
CLI->>KG: Link to relationships
|
|
260
|
-
end
|
|
261
|
-
|
|
262
|
-
Note over Agent: Query Memory
|
|
263
|
-
Agent->>CLI: uap memory query "pattern"
|
|
264
|
-
CLI->>SQLite: SELECT from memories (FTS5, L1)
|
|
265
|
-
CLI->>SQLite: SELECT from session_memories (L2)
|
|
266
|
-
|
|
267
|
-
alt Need semantic search
|
|
268
|
-
CLI->>Qdrant: Embed query vector
|
|
269
|
-
Qdrant-->>CLI: Top-K similar memories (L3)
|
|
270
|
-
end
|
|
271
|
-
|
|
272
|
-
alt Entity relationship needed
|
|
273
|
-
CLI->>KG: Query relationships
|
|
274
|
-
KG-->>CLI: Entity graph (L4)
|
|
275
|
-
end
|
|
276
|
-
|
|
277
|
-
CLI-->>Agent: Combined results from all layers
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
---
|
|
281
|
-
|
|
282
|
-
## Coordination System
|
|
283
|
-
|
|
284
|
-
### Multi-Agent Coordination
|
|
285
|
-
|
|
286
|
-
```mermaid
|
|
287
|
-
flowchart TB
|
|
288
|
-
subgraph "Agent Registration"
|
|
289
|
-
A1[Agent A] -->|register| CS[Coordination Service]
|
|
290
|
-
A2[Agent B] -->|register| CS
|
|
291
|
-
A3[Agent C] -->|register| CS
|
|
292
|
-
end
|
|
293
|
-
|
|
294
|
-
subgraph "Work Announcement"
|
|
295
|
-
A1 -->|announce: src/auth.ts| CS
|
|
296
|
-
CS -->|check overlaps| A1
|
|
297
|
-
A2 -->|announce: src/api.ts| CS
|
|
298
|
-
CS -->|check overlaps| A2
|
|
299
|
-
A3 -->|announce: src/ui.ts| CS
|
|
300
|
-
CS -->|check overlaps| A3
|
|
301
|
-
end
|
|
302
|
-
|
|
303
|
-
subgraph "Worktree Allocation"
|
|
304
|
-
A1 -->|create worktree| WT1[.worktrees/001-auth/]
|
|
305
|
-
A2 -->|create worktree| WT2[.worktrees/002-api/]
|
|
306
|
-
A3 -->|create worktree| WT3[.worktrees/003-ui/]
|
|
307
|
-
end
|
|
308
|
-
|
|
309
|
-
subgraph "Parallel Execution"
|
|
310
|
-
WT1 -->|work| A1
|
|
311
|
-
WT2 -->|work| A2
|
|
312
|
-
WT3 -->|work| A3
|
|
313
|
-
end
|
|
314
|
-
|
|
315
|
-
subgraph "Completion"
|
|
316
|
-
A1 -->|complete| CS
|
|
317
|
-
A2 -->|complete| CS
|
|
318
|
-
A3 -->|complete| CS
|
|
319
|
-
CS -->|queue deploy| DB
|
|
320
|
-
end
|
|
321
|
-
|
|
322
|
-
subgraph "Deploy Batching"
|
|
323
|
-
DB -->|batch window| BATCH[Deploy Batcher]
|
|
324
|
-
BATCH -->|squash & commit| GIT[(Git)]
|
|
325
|
-
end
|
|
326
|
-
|
|
327
|
-
style CS fill:#e3f2fd
|
|
328
|
-
style BATCH fill:#fff3e0
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
### Overlap Detection Algorithm
|
|
332
|
-
|
|
333
|
-
```mermaid
|
|
334
|
-
flowchart TD
|
|
335
|
-
START[Agent announces intent]
|
|
336
|
-
|
|
337
|
-
START --> CHECK1{Same file?}
|
|
338
|
-
|
|
339
|
-
CHECK1 -->|Yes| CRITICAL{Editing same file?}
|
|
340
|
-
CRITICAL -->|Yes| BLOCK[CRITICAL: BLOCK - Request handoff]
|
|
341
|
-
CRITICAL -->|No| HIGH
|
|
342
|
-
|
|
343
|
-
CHECK1 -->|No| CHECK2{Same directory?}
|
|
344
|
-
CHECK2 -->|Yes| MEDIUM
|
|
345
|
-
CHECK2 -->|No| CHECK3{Shared dependencies?}
|
|
346
|
-
|
|
347
|
-
CHECK3 -->|Yes| LOW
|
|
348
|
-
CHECK3 -->|No| NONE[NONE: Safe parallel work]
|
|
349
|
-
|
|
350
|
-
HIGH[HIGH: Coordinate merge order]
|
|
351
|
-
MEDIUM[MEDIUM: Announce changes]
|
|
352
|
-
LOW[LOW: Watch shared imports]
|
|
353
|
-
|
|
354
|
-
BLOCK --> END[Coordinate before proceeding]
|
|
355
|
-
HIGH --> END
|
|
356
|
-
MEDIUM --> END
|
|
357
|
-
LOW --> END
|
|
358
|
-
NONE --> END
|
|
359
|
-
|
|
360
|
-
style BLOCK fill:#ffcdd2
|
|
361
|
-
style HIGH fill:#ffab91
|
|
362
|
-
style MEDIUM fill:#fff9c4
|
|
363
|
-
style LOW fill:#c8e6c9
|
|
364
|
-
style NONE fill:#bbdefb
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
### Inter-Agent Messaging
|
|
368
|
-
|
|
369
|
-
```mermaid
|
|
370
|
-
sequenceDiagram
|
|
371
|
-
participant A1 as Agent 1
|
|
372
|
-
participant CS as Coordination Service
|
|
373
|
-
participant A2 as Agent 2
|
|
374
|
-
participant A3 as Agent 3
|
|
375
|
-
|
|
376
|
-
Note over A1,A3: Broadcast Message
|
|
377
|
-
A1->>CS: broadcast(channel: coordination, message)
|
|
378
|
-
CS->>A2: Queue message
|
|
379
|
-
CS->>A3: Queue message
|
|
380
|
-
A2->>CS: receive()
|
|
381
|
-
CS-->>A2: Messages from coordination channel
|
|
382
|
-
|
|
383
|
-
Note over A1,A2: Direct Message
|
|
384
|
-
A1->>CS: send(to: A2, message)
|
|
385
|
-
A2->>CS: receive()
|
|
386
|
-
CS-->>A2: Direct message from A1
|
|
387
|
-
|
|
388
|
-
Note over A1,A2: Priority Handling
|
|
389
|
-
A1->>CS: send(to: A2, urgent message, priority: urgent)
|
|
390
|
-
A2->>CS: receive()
|
|
391
|
-
CS-->>A2: Urgent message (immediate delivery)
|
|
392
|
-
```
|
|
393
|
-
|
|
394
|
-
---
|
|
395
|
-
|
|
396
|
-
## Multi-Model Architecture
|
|
397
|
-
|
|
398
|
-
### Three-Tier Execution Model
|
|
399
|
-
|
|
400
|
-
```mermaid
|
|
401
|
-
graph TB
|
|
402
|
-
subgraph "Tier 1: Planning"
|
|
403
|
-
P1[TaskPlanner]
|
|
404
|
-
P2[Decompose task]
|
|
405
|
-
P3[Analyze dependencies]
|
|
406
|
-
P4[Generate subtasks]
|
|
407
|
-
end
|
|
408
|
-
|
|
409
|
-
subgraph "Tier 2: Routing"
|
|
410
|
-
R1[ModelRouter]
|
|
411
|
-
R2{Route by}
|
|
412
|
-
R2 --> Complexity
|
|
413
|
-
R2 --> Cost
|
|
414
|
-
R2 --> Latency
|
|
415
|
-
R2 --> Accuracy
|
|
416
|
-
end
|
|
417
|
-
|
|
418
|
-
subgraph "Tier 3: Execution"
|
|
419
|
-
E1[TaskExecutor]
|
|
420
|
-
E2{Execute subtask}
|
|
421
|
-
E2 -->|Simple| M1[Qwen3.5]
|
|
422
|
-
E2 -->|Complex| M2[Claude Opus]
|
|
423
|
-
E2 -->|Code| M3[Code-specific]
|
|
424
|
-
E2 -->|Analysis| M4[GPT-4]
|
|
425
|
-
end
|
|
426
|
-
|
|
427
|
-
subgraph "Validation"
|
|
428
|
-
V1[PlanValidator]
|
|
429
|
-
V2[Verify coherence]
|
|
430
|
-
V3[Check cycles]
|
|
431
|
-
end
|
|
432
|
-
|
|
433
|
-
P1 --> P2 --> P3 --> P4
|
|
434
|
-
P4 --> R1
|
|
435
|
-
R1 --> R2
|
|
436
|
-
R2 --> E1
|
|
437
|
-
E1 --> E2
|
|
438
|
-
E2 --> M1 & M2 & M3 & M4
|
|
439
|
-
M1 & M2 & M3 & M4 --> V1
|
|
440
|
-
V1 --> V2 --> V3
|
|
441
|
-
V3 -->|Valid| Output[Return result]
|
|
442
|
-
V3 -->|Invalid| P1
|
|
443
|
-
|
|
444
|
-
style P1 fill:#e3f2fd
|
|
445
|
-
style R1 fill:#fff3e0
|
|
446
|
-
style E1 fill:#f3e5f5
|
|
447
|
-
style V1 fill:#e8f5e9
|
|
448
|
-
```
|
|
449
|
-
|
|
450
|
-
### Model Profiles
|
|
451
|
-
|
|
452
|
-
```mermaid
|
|
453
|
-
pie title Model Profile Distribution
|
|
454
|
-
"Qwen3.5" : 35
|
|
455
|
-
"Claude Sonnet" : 25
|
|
456
|
-
"Claude Opus" : 15
|
|
457
|
-
"GPT-4" : 10
|
|
458
|
-
"Gemini" : 10
|
|
459
|
-
"Llama" : 5
|
|
460
|
-
```
|
|
461
|
-
|
|
462
|
-
| Profile | Use Case | Dynamic Temp | Tool Batching | Rate Limit |
|
|
463
|
-
|---------|----------|--------------|---------------|------------|
|
|
464
|
-
| **Qwen3.5** | General tasks | 0.9 → 0.1 | Yes | 60/min |
|
|
465
|
-
| **Claude Sonnet** | Code generation | 0.7 → 0.05 | Yes | 100/min |
|
|
466
|
-
| **Claude Opus** | Complex reasoning | 0.5 → 0.01 | Yes | 30/min |
|
|
467
|
-
| **GPT-4** | Analysis | 0.8 → 0.2 | No | 50/min |
|
|
468
|
-
| **Gemini** | Multi-modal | 0.6 → 0.1 | Yes | 40/min |
|
|
469
|
-
|
|
470
|
-
---
|
|
471
|
-
|
|
472
|
-
## Policy Enforcement
|
|
473
|
-
|
|
474
|
-
### Policy Enforcement Pipeline
|
|
475
|
-
|
|
476
|
-
```mermaid
|
|
477
|
-
flowchart LR
|
|
478
|
-
A[Tool Call Request] --> B{Policy Check}
|
|
479
|
-
|
|
480
|
-
B -->|REQUIRED| C{Policy Applied?}
|
|
481
|
-
C -->|Yes| D{Compliant?}
|
|
482
|
-
C -->|No| E[Allow]
|
|
483
|
-
|
|
484
|
-
D -->|Yes| F[Execute]
|
|
485
|
-
D -->|No| G[Block: PolicyViolationError]
|
|
486
|
-
|
|
487
|
-
B -->|RECOMMENDED| H[Log & Allow]
|
|
488
|
-
B -->|OPTIONAL| I[Log Only]
|
|
489
|
-
|
|
490
|
-
F --> J[Record Audit Trail]
|
|
491
|
-
H --> J
|
|
492
|
-
G --> J
|
|
493
|
-
E --> J
|
|
494
|
-
I --> J
|
|
495
|
-
|
|
496
|
-
style C fill:#e3f2fd
|
|
497
|
-
style D fill:#fff3e0
|
|
498
|
-
style F fill:#c8e6c9
|
|
499
|
-
style G fill:#ffcdd2
|
|
500
|
-
```
|
|
501
|
-
|
|
502
|
-
### Policy Levels
|
|
503
|
-
|
|
504
|
-
| Level | Behavior | Use Case | Example |
|
|
505
|
-
|-------|----------|----------|---------|
|
|
506
|
-
| **REQUIRED** | Blocks execution | Security, compliance | `worktree-enforcement` |
|
|
507
|
-
| **RECOMMENDED** | Logs but allows | Best practices | `pre-edit-build-gate` |
|
|
508
|
-
| **OPTIONAL** | Informational only | Guidelines | `testing-recommended` |
|
|
509
|
-
|
|
510
|
-
### Policy Audit Trail
|
|
511
|
-
|
|
512
|
-
```mermaid
|
|
513
|
-
graph LR
|
|
514
|
-
A[Policy Event] --> B{Event Type}
|
|
515
|
-
|
|
516
|
-
B -->|Violation| C[Block + Log]
|
|
517
|
-
B -->|Compliance| D[Allow + Log]
|
|
518
|
-
B -->|Warning| E[Log Warning]
|
|
519
|
-
|
|
520
|
-
C --> F[(Audit Log)]
|
|
521
|
-
D --> F
|
|
522
|
-
E --> F
|
|
523
|
-
|
|
524
|
-
F --> G{Query}
|
|
525
|
-
G -->|Time Range| H[Time-based Report]
|
|
526
|
-
G -->|Policy ID| I[Policy Report]
|
|
527
|
-
G -->|Agent ID| J[Agent Report]
|
|
528
|
-
|
|
529
|
-
style C fill:#ffcdd2
|
|
530
|
-
style D fill:#c8e6c9
|
|
531
|
-
style E fill:#fff9c4
|
|
532
|
-
```
|
|
533
|
-
|
|
534
|
-
---
|
|
535
|
-
|
|
536
|
-
## Deploy Batching
|
|
537
|
-
|
|
538
|
-
### Batch Window Mechanism
|
|
539
|
-
|
|
540
|
-
```mermaid
|
|
541
|
-
flowchart TB
|
|
542
|
-
A[Agent Queue Action] --> B{Action Type}
|
|
543
|
-
|
|
544
|
-
B -->|commit| W1[30s window]
|
|
545
|
-
B -->|push| W2[5s window]
|
|
546
|
-
B -->|merge| W3[10s window]
|
|
547
|
-
B -->|workflow| W4[5s window]
|
|
548
|
-
B -->|deploy| W5[60s window]
|
|
549
|
-
|
|
550
|
-
W1 --> C{Batch Window Active?}
|
|
551
|
-
W2 --> C
|
|
552
|
-
W3 --> C
|
|
553
|
-
W4 --> C
|
|
554
|
-
W5 --> C
|
|
555
|
-
|
|
556
|
-
C -->|No| D[Start Timer]
|
|
557
|
-
C -->|Yes| E[Add to Batch]
|
|
558
|
-
|
|
559
|
-
D --> F{Timeout?}
|
|
560
|
-
F -->|Yes| G[Execute Batch]
|
|
561
|
-
F -->|No| E
|
|
562
|
-
|
|
563
|
-
E --> G
|
|
564
|
-
|
|
565
|
-
G --> H[Squash Actions]
|
|
566
|
-
H --> I[Single Commit/Deploy]
|
|
567
|
-
|
|
568
|
-
style W1 fill:#e3f2fd
|
|
569
|
-
style W2 fill:#e3f2fd
|
|
570
|
-
style W3 fill:#e3f2fd
|
|
571
|
-
style W4 fill:#e3f2fd
|
|
572
|
-
style W5 fill:#e3f2fd
|
|
573
|
-
style G fill:#c8e6c9
|
|
574
|
-
```
|
|
575
|
-
|
|
576
|
-
### Batch Configuration
|
|
577
|
-
|
|
578
|
-
| Parameter | Default | Urgent | Description |
|
|
579
|
-
|-----------|---------|--------|-------------|
|
|
580
|
-
| **commit** | 30s | 3s | Squash commits |
|
|
581
|
-
| **push** | 5s | 1s | Push to remote |
|
|
582
|
-
| **merge** | 10s | 2s | Merge PRs |
|
|
583
|
-
| **workflow** | 5s | 1s | Trigger CI/CD |
|
|
584
|
-
| **deploy** | 60s | 5s | Production deploy |
|
|
585
|
-
|
|
586
|
-
---
|
|
587
|
-
|
|
588
|
-
## MCP Router
|
|
589
|
-
|
|
590
|
-
### Meta-Tool Architecture
|
|
591
|
-
|
|
592
|
-
```mermaid
|
|
593
|
-
flowchart TB
|
|
594
|
-
subgraph "Tool Discovery"
|
|
595
|
-
D1[discover_tools]
|
|
596
|
-
D2{Fuzzy Search}
|
|
597
|
-
D2 -->|Match| D3[Return Tool List]
|
|
598
|
-
end
|
|
599
|
-
|
|
600
|
-
subgraph "Tool Execution"
|
|
601
|
-
E1[execute_tool]
|
|
602
|
-
E2{Select Server}
|
|
603
|
-
E2 -->|Pool| E3[Client Pool]
|
|
604
|
-
E3 -->|Execute| E4[Run Tool]
|
|
605
|
-
E4 -->|Compress| E5[Output Compressor]
|
|
606
|
-
end
|
|
607
|
-
|
|
608
|
-
subgraph "Output Compression"
|
|
609
|
-
C1{Tier Check}
|
|
610
|
-
C1 -->|<5KB| C2[Passthrough]
|
|
611
|
-
C1 -->|5-10KB| C3[Head+Tail]
|
|
612
|
-
C1 -->|>10KB| C4[FTS5 Index]
|
|
613
|
-
end
|
|
614
|
-
|
|
615
|
-
D1 --> D2
|
|
616
|
-
E1 --> E2
|
|
617
|
-
E5 --> C1
|
|
618
|
-
C2 & C3 & C4 --> Output[Compressed Output]
|
|
619
|
-
|
|
620
|
-
style D1 fill:#e3f2fd
|
|
621
|
-
style E1 fill:#fff3e0
|
|
622
|
-
style C1 fill:#f3e5f5
|
|
623
|
-
```
|
|
624
|
-
|
|
625
|
-
### Token Savings Calculation
|
|
626
|
-
|
|
627
|
-
```
|
|
628
|
-
Traditional: N tools × 500 tokens = 50,000 tokens
|
|
629
|
-
MCP Router: 2 meta-tools × 500 tokens = 1,000 tokens
|
|
630
|
-
Savings: 49,000 tokens = 98% reduction
|
|
631
|
-
```
|
|
632
|
-
|
|
633
|
-
---
|
|
634
|
-
|
|
635
|
-
## Worktree System
|
|
636
|
-
|
|
637
|
-
### Worktree Lifecycle
|
|
638
|
-
|
|
639
|
-
```mermaid
|
|
640
|
-
stateDiagram-v2
|
|
641
|
-
[*] --> Created: worktree create <slug>
|
|
642
|
-
|
|
643
|
-
Created --> Working: cd .worktrees/NNN-slug
|
|
644
|
-
|
|
645
|
-
Working --> Working: commits
|
|
646
|
-
Working --> Working: changes
|
|
647
|
-
|
|
648
|
-
Working --> PRCreated: worktree pr <id>
|
|
649
|
-
PRCreated --> Merged: PR approved
|
|
650
|
-
PRCreated --> Working: changes requested
|
|
651
|
-
|
|
652
|
-
Merged --> Cleaned: worktree cleanup <id>
|
|
653
|
-
Cleaned --> [*]
|
|
654
|
-
|
|
655
|
-
note right of Created
|
|
656
|
-
Git worktree created
|
|
657
|
-
Branch: feature/NNN-slug
|
|
658
|
-
Isolated filesystem
|
|
659
|
-
end note
|
|
660
|
-
|
|
661
|
-
note right of Working
|
|
662
|
-
Developer working directory
|
|
663
|
-
All changes isolated
|
|
664
|
-
Can switch to main
|
|
665
|
-
end note
|
|
666
|
-
|
|
667
|
-
note right of Cleaned
|
|
668
|
-
Branch deleted
|
|
669
|
-
Worktree removed
|
|
670
|
-
PR merged
|
|
671
|
-
end note
|
|
672
|
-
```
|
|
673
|
-
|
|
674
|
-
---
|
|
675
|
-
|
|
676
|
-
## Pattern System
|
|
677
|
-
|
|
678
|
-
### Pattern Categories
|
|
679
|
-
|
|
680
|
-
```mermaid
|
|
681
|
-
mindmap
|
|
682
|
-
root((23 Patterns))
|
|
683
|
-
Critical
|
|
684
|
-
P12_OutputExistence
|
|
685
|
-
P35_DecoderFirst
|
|
686
|
-
P13_IterativeRefinement
|
|
687
|
-
Security
|
|
688
|
-
P20_Adversarial
|
|
689
|
-
P19_ImpossibleRefusal
|
|
690
|
-
Quality
|
|
691
|
-
P28_SmokeTest
|
|
692
|
-
P23_CompressionCheck
|
|
693
|
-
P31_RoundTrip
|
|
694
|
-
Performance
|
|
695
|
-
P30_PerformanceThreshold
|
|
696
|
-
P33_NumericalStability
|
|
697
|
-
Integration
|
|
698
|
-
P24_Polyglot
|
|
699
|
-
P25_ServiceConfig
|
|
700
|
-
Recovery
|
|
701
|
-
P22_GitRecovery
|
|
702
|
-
P26_NearMiss
|
|
703
|
-
```
|
|
704
|
-
|
|
705
|
-
---
|
|
706
|
-
|
|
707
|
-
## Integration Patterns
|
|
708
|
-
|
|
709
|
-
### Platform Integration Flow
|
|
710
|
-
|
|
711
|
-
```mermaid
|
|
712
|
-
sequenceDiagram
|
|
713
|
-
participant Platform as Platform (Claude/Factory/etc.)
|
|
714
|
-
participant Hooks as UAP Hooks
|
|
715
|
-
participant Memory as Memory System
|
|
716
|
-
participant Patterns as Pattern Router
|
|
717
|
-
|
|
718
|
-
Note over Platform: Session Start
|
|
719
|
-
Platform->>Hooks: session-start hook
|
|
720
|
-
Hooks->>Memory: inject recent memories
|
|
721
|
-
Memory-->>Hooks: 10 recent memories
|
|
722
|
-
Hooks->>Patterns: load relevant patterns
|
|
723
|
-
Patterns-->>Hooks: 5 contextual patterns
|
|
724
|
-
Hooks-->>Platform: Enhanced context
|
|
725
|
-
|
|
726
|
-
Note over Platform: Tool Call
|
|
727
|
-
Platform->>Hooks: pre-tool-use hook
|
|
728
|
-
Hooks->>Memory: query tool context
|
|
729
|
-
Memory-->>Hooks: relevant memories
|
|
730
|
-
Hooks-->>Platform: Tool with context
|
|
731
|
-
|
|
732
|
-
Note over Platform: Session End
|
|
733
|
-
Platform->>Hooks: pre-compact hook
|
|
734
|
-
Hooks->>Memory: consolidate lessons
|
|
735
|
-
Memory-->>Hooks: stored memories
|
|
736
|
-
Hooks-->>Platform: Compliance summary
|
|
737
|
-
```
|
|
738
|
-
|
|
739
|
-
---
|
|
740
|
-
|
|
741
|
-
<div align="center">
|
|
742
|
-
|
|
743
|
-
**Next Steps:**
|
|
744
|
-
- [Deployment Guide](../deployment/DEPLOYMENT.md)
|
|
745
|
-
- [CLI Reference](../reference/UAP_CLI_REFERENCE.md)
|
|
746
|
-
- [Benchmark Results](../benchmarks/COMPREHENSIVE_BENCHMARKS.md)
|
|
747
|
-
|
|
748
|
-
</div>
|