@miller-tech/uap 1.0.0

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.
Files changed (660) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +888 -0
  3. package/dist/analyzers/index.d.ts +3 -0
  4. package/dist/analyzers/index.d.ts.map +1 -0
  5. package/dist/analyzers/index.js +684 -0
  6. package/dist/analyzers/index.js.map +1 -0
  7. package/dist/benchmarks/agents/naive-agent.d.ts +60 -0
  8. package/dist/benchmarks/agents/naive-agent.d.ts.map +1 -0
  9. package/dist/benchmarks/agents/naive-agent.js +144 -0
  10. package/dist/benchmarks/agents/naive-agent.js.map +1 -0
  11. package/dist/benchmarks/agents/uap-agent.d.ts +167 -0
  12. package/dist/benchmarks/agents/uap-agent.d.ts.map +1 -0
  13. package/dist/benchmarks/agents/uap-agent.js +437 -0
  14. package/dist/benchmarks/agents/uap-agent.js.map +1 -0
  15. package/dist/benchmarks/benchmark.d.ts +328 -0
  16. package/dist/benchmarks/benchmark.d.ts.map +1 -0
  17. package/dist/benchmarks/benchmark.js +112 -0
  18. package/dist/benchmarks/benchmark.js.map +1 -0
  19. package/dist/benchmarks/execution-verifier.d.ts +41 -0
  20. package/dist/benchmarks/execution-verifier.d.ts.map +1 -0
  21. package/dist/benchmarks/execution-verifier.js +340 -0
  22. package/dist/benchmarks/execution-verifier.js.map +1 -0
  23. package/dist/benchmarks/hierarchical-prompting.d.ts +37 -0
  24. package/dist/benchmarks/hierarchical-prompting.d.ts.map +1 -0
  25. package/dist/benchmarks/hierarchical-prompting.js +246 -0
  26. package/dist/benchmarks/hierarchical-prompting.js.map +1 -0
  27. package/dist/benchmarks/improved-benchmark.d.ts +89 -0
  28. package/dist/benchmarks/improved-benchmark.d.ts.map +1 -0
  29. package/dist/benchmarks/improved-benchmark.js +585 -0
  30. package/dist/benchmarks/improved-benchmark.js.map +1 -0
  31. package/dist/benchmarks/index.d.ts +11 -0
  32. package/dist/benchmarks/index.d.ts.map +1 -0
  33. package/dist/benchmarks/index.js +11 -0
  34. package/dist/benchmarks/index.js.map +1 -0
  35. package/dist/benchmarks/model-integration.d.ts +111 -0
  36. package/dist/benchmarks/model-integration.d.ts.map +1 -0
  37. package/dist/benchmarks/model-integration.js +904 -0
  38. package/dist/benchmarks/model-integration.js.map +1 -0
  39. package/dist/benchmarks/multi-turn-agent.d.ts +44 -0
  40. package/dist/benchmarks/multi-turn-agent.d.ts.map +1 -0
  41. package/dist/benchmarks/multi-turn-agent.js +254 -0
  42. package/dist/benchmarks/multi-turn-agent.js.map +1 -0
  43. package/dist/benchmarks/multi-turn-loop.d.ts +57 -0
  44. package/dist/benchmarks/multi-turn-loop.d.ts.map +1 -0
  45. package/dist/benchmarks/multi-turn-loop.js +167 -0
  46. package/dist/benchmarks/multi-turn-loop.js.map +1 -0
  47. package/dist/benchmarks/tasks.d.ts +19 -0
  48. package/dist/benchmarks/tasks.d.ts.map +1 -0
  49. package/dist/benchmarks/tasks.js +435 -0
  50. package/dist/benchmarks/tasks.js.map +1 -0
  51. package/dist/bin/cli.d.ts +3 -0
  52. package/dist/bin/cli.d.ts.map +1 -0
  53. package/dist/bin/cli.js +546 -0
  54. package/dist/bin/cli.js.map +1 -0
  55. package/dist/bin/llama-server-optimize.d.ts +18 -0
  56. package/dist/bin/llama-server-optimize.d.ts.map +1 -0
  57. package/dist/bin/llama-server-optimize.js +708 -0
  58. package/dist/bin/llama-server-optimize.js.map +1 -0
  59. package/dist/bin/policy.d.ts +3 -0
  60. package/dist/bin/policy.d.ts.map +1 -0
  61. package/dist/bin/policy.js +143 -0
  62. package/dist/bin/policy.js.map +1 -0
  63. package/dist/bin/tool-calls.d.ts +3 -0
  64. package/dist/bin/tool-calls.d.ts.map +1 -0
  65. package/dist/bin/tool-calls.js +4 -0
  66. package/dist/bin/tool-calls.js.map +1 -0
  67. package/dist/browser/index.d.ts +2 -0
  68. package/dist/browser/index.d.ts.map +1 -0
  69. package/dist/browser/index.js +2 -0
  70. package/dist/browser/index.js.map +1 -0
  71. package/dist/browser/web-browser.d.ts +30 -0
  72. package/dist/browser/web-browser.d.ts.map +1 -0
  73. package/dist/browser/web-browser.js +93 -0
  74. package/dist/browser/web-browser.js.map +1 -0
  75. package/dist/cli/agent.d.ts +20 -0
  76. package/dist/cli/agent.d.ts.map +1 -0
  77. package/dist/cli/agent.js +474 -0
  78. package/dist/cli/agent.js.map +1 -0
  79. package/dist/cli/analyze.d.ts +7 -0
  80. package/dist/cli/analyze.d.ts.map +1 -0
  81. package/dist/cli/analyze.js +103 -0
  82. package/dist/cli/analyze.js.map +1 -0
  83. package/dist/cli/completion-gates.d.ts +51 -0
  84. package/dist/cli/completion-gates.d.ts.map +1 -0
  85. package/dist/cli/completion-gates.js +201 -0
  86. package/dist/cli/completion-gates.js.map +1 -0
  87. package/dist/cli/compliance.d.ts +8 -0
  88. package/dist/cli/compliance.d.ts.map +1 -0
  89. package/dist/cli/compliance.js +509 -0
  90. package/dist/cli/compliance.js.map +1 -0
  91. package/dist/cli/coord.d.ts +7 -0
  92. package/dist/cli/coord.d.ts.map +1 -0
  93. package/dist/cli/coord.js +138 -0
  94. package/dist/cli/coord.js.map +1 -0
  95. package/dist/cli/dashboard.d.ts +21 -0
  96. package/dist/cli/dashboard.d.ts.map +1 -0
  97. package/dist/cli/dashboard.js +1508 -0
  98. package/dist/cli/dashboard.js.map +1 -0
  99. package/dist/cli/deploy.d.ts +19 -0
  100. package/dist/cli/deploy.d.ts.map +1 -0
  101. package/dist/cli/deploy.js +387 -0
  102. package/dist/cli/deploy.js.map +1 -0
  103. package/dist/cli/droids.d.ts +9 -0
  104. package/dist/cli/droids.d.ts.map +1 -0
  105. package/dist/cli/droids.js +227 -0
  106. package/dist/cli/droids.js.map +1 -0
  107. package/dist/cli/generate.d.ts +17 -0
  108. package/dist/cli/generate.d.ts.map +1 -0
  109. package/dist/cli/generate.js +432 -0
  110. package/dist/cli/generate.js.map +1 -0
  111. package/dist/cli/hooks.d.ts +9 -0
  112. package/dist/cli/hooks.d.ts.map +1 -0
  113. package/dist/cli/hooks.js +464 -0
  114. package/dist/cli/hooks.js.map +1 -0
  115. package/dist/cli/init.d.ts +12 -0
  116. package/dist/cli/init.d.ts.map +1 -0
  117. package/dist/cli/init.js +364 -0
  118. package/dist/cli/init.js.map +1 -0
  119. package/dist/cli/mcp-router.d.ts +16 -0
  120. package/dist/cli/mcp-router.d.ts.map +1 -0
  121. package/dist/cli/mcp-router.js +143 -0
  122. package/dist/cli/mcp-router.js.map +1 -0
  123. package/dist/cli/memory.d.ts +24 -0
  124. package/dist/cli/memory.d.ts.map +1 -0
  125. package/dist/cli/memory.js +885 -0
  126. package/dist/cli/memory.js.map +1 -0
  127. package/dist/cli/model.d.ts +15 -0
  128. package/dist/cli/model.d.ts.map +1 -0
  129. package/dist/cli/model.js +290 -0
  130. package/dist/cli/model.js.map +1 -0
  131. package/dist/cli/patterns.d.ts +26 -0
  132. package/dist/cli/patterns.d.ts.map +1 -0
  133. package/dist/cli/patterns.js +862 -0
  134. package/dist/cli/patterns.js.map +1 -0
  135. package/dist/cli/rtk-validation.d.ts +9 -0
  136. package/dist/cli/rtk-validation.d.ts.map +1 -0
  137. package/dist/cli/rtk-validation.js +9 -0
  138. package/dist/cli/rtk-validation.js.map +1 -0
  139. package/dist/cli/rtk.d.ts +34 -0
  140. package/dist/cli/rtk.d.ts.map +1 -0
  141. package/dist/cli/rtk.js +401 -0
  142. package/dist/cli/rtk.js.map +1 -0
  143. package/dist/cli/schema-diff.d.ts +7 -0
  144. package/dist/cli/schema-diff.d.ts.map +1 -0
  145. package/dist/cli/schema-diff.js +11 -0
  146. package/dist/cli/schema-diff.js.map +1 -0
  147. package/dist/cli/setup-mcp-router.d.ts +8 -0
  148. package/dist/cli/setup-mcp-router.d.ts.map +1 -0
  149. package/dist/cli/setup-mcp-router.js +163 -0
  150. package/dist/cli/setup-mcp-router.js.map +1 -0
  151. package/dist/cli/setup-wizard.d.ts +2 -0
  152. package/dist/cli/setup-wizard.d.ts.map +1 -0
  153. package/dist/cli/setup-wizard.js +806 -0
  154. package/dist/cli/setup-wizard.js.map +1 -0
  155. package/dist/cli/setup.d.ts +15 -0
  156. package/dist/cli/setup.d.ts.map +1 -0
  157. package/dist/cli/setup.js +154 -0
  158. package/dist/cli/setup.js.map +1 -0
  159. package/dist/cli/sync.d.ts +8 -0
  160. package/dist/cli/sync.d.ts.map +1 -0
  161. package/dist/cli/sync.js +395 -0
  162. package/dist/cli/sync.js.map +1 -0
  163. package/dist/cli/task.d.ts +33 -0
  164. package/dist/cli/task.d.ts.map +1 -0
  165. package/dist/cli/task.js +672 -0
  166. package/dist/cli/task.js.map +1 -0
  167. package/dist/cli/tool-calls.d.ts +20 -0
  168. package/dist/cli/tool-calls.d.ts.map +1 -0
  169. package/dist/cli/tool-calls.js +605 -0
  170. package/dist/cli/tool-calls.js.map +1 -0
  171. package/dist/cli/uap.d.ts +10 -0
  172. package/dist/cli/uap.d.ts.map +1 -0
  173. package/dist/cli/uap.js +398 -0
  174. package/dist/cli/uap.js.map +1 -0
  175. package/dist/cli/update.d.ts +10 -0
  176. package/dist/cli/update.d.ts.map +1 -0
  177. package/dist/cli/update.js +300 -0
  178. package/dist/cli/update.js.map +1 -0
  179. package/dist/cli/visualize.d.ts +77 -0
  180. package/dist/cli/visualize.d.ts.map +1 -0
  181. package/dist/cli/visualize.js +287 -0
  182. package/dist/cli/visualize.js.map +1 -0
  183. package/dist/cli/worktree.d.ts +9 -0
  184. package/dist/cli/worktree.d.ts.map +1 -0
  185. package/dist/cli/worktree.js +213 -0
  186. package/dist/cli/worktree.js.map +1 -0
  187. package/dist/coordination/adaptive-patterns.d.ts +65 -0
  188. package/dist/coordination/adaptive-patterns.d.ts.map +1 -0
  189. package/dist/coordination/adaptive-patterns.js +108 -0
  190. package/dist/coordination/adaptive-patterns.js.map +1 -0
  191. package/dist/coordination/auto-agent.d.ts +82 -0
  192. package/dist/coordination/auto-agent.d.ts.map +1 -0
  193. package/dist/coordination/auto-agent.js +145 -0
  194. package/dist/coordination/auto-agent.js.map +1 -0
  195. package/dist/coordination/capability-router.d.ts +79 -0
  196. package/dist/coordination/capability-router.d.ts.map +1 -0
  197. package/dist/coordination/capability-router.js +334 -0
  198. package/dist/coordination/capability-router.js.map +1 -0
  199. package/dist/coordination/database.d.ts +13 -0
  200. package/dist/coordination/database.d.ts.map +1 -0
  201. package/dist/coordination/database.js +136 -0
  202. package/dist/coordination/database.js.map +1 -0
  203. package/dist/coordination/deploy-batcher.d.ts +122 -0
  204. package/dist/coordination/deploy-batcher.d.ts.map +1 -0
  205. package/dist/coordination/deploy-batcher.js +718 -0
  206. package/dist/coordination/deploy-batcher.js.map +1 -0
  207. package/dist/coordination/droid-validator.d.ts +59 -0
  208. package/dist/coordination/droid-validator.d.ts.map +1 -0
  209. package/dist/coordination/droid-validator.js +142 -0
  210. package/dist/coordination/droid-validator.js.map +1 -0
  211. package/dist/coordination/index.d.ts +10 -0
  212. package/dist/coordination/index.d.ts.map +1 -0
  213. package/dist/coordination/index.js +10 -0
  214. package/dist/coordination/index.js.map +1 -0
  215. package/dist/coordination/pattern-router.d.ts +50 -0
  216. package/dist/coordination/pattern-router.d.ts.map +1 -0
  217. package/dist/coordination/pattern-router.js +118 -0
  218. package/dist/coordination/pattern-router.js.map +1 -0
  219. package/dist/coordination/service.d.ts +81 -0
  220. package/dist/coordination/service.d.ts.map +1 -0
  221. package/dist/coordination/service.js +619 -0
  222. package/dist/coordination/service.js.map +1 -0
  223. package/dist/coordination/worktree-enforcer.d.ts +22 -0
  224. package/dist/coordination/worktree-enforcer.d.ts.map +1 -0
  225. package/dist/coordination/worktree-enforcer.js +71 -0
  226. package/dist/coordination/worktree-enforcer.js.map +1 -0
  227. package/dist/generators/claude-md.d.ts +3 -0
  228. package/dist/generators/claude-md.d.ts.map +1 -0
  229. package/dist/generators/claude-md.js +1020 -0
  230. package/dist/generators/claude-md.js.map +1 -0
  231. package/dist/generators/template-loader.d.ts +105 -0
  232. package/dist/generators/template-loader.d.ts.map +1 -0
  233. package/dist/generators/template-loader.js +291 -0
  234. package/dist/generators/template-loader.js.map +1 -0
  235. package/dist/index.d.ts +49 -0
  236. package/dist/index.d.ts.map +1 -0
  237. package/dist/index.js +63 -0
  238. package/dist/index.js.map +1 -0
  239. package/dist/mcp-router/config/parser.d.ts +9 -0
  240. package/dist/mcp-router/config/parser.d.ts.map +1 -0
  241. package/dist/mcp-router/config/parser.js +174 -0
  242. package/dist/mcp-router/config/parser.js.map +1 -0
  243. package/dist/mcp-router/executor/client.d.ts +31 -0
  244. package/dist/mcp-router/executor/client.d.ts.map +1 -0
  245. package/dist/mcp-router/executor/client.js +189 -0
  246. package/dist/mcp-router/executor/client.js.map +1 -0
  247. package/dist/mcp-router/index.d.ts +22 -0
  248. package/dist/mcp-router/index.d.ts.map +1 -0
  249. package/dist/mcp-router/index.js +18 -0
  250. package/dist/mcp-router/index.js.map +1 -0
  251. package/dist/mcp-router/output-compressor.d.ts +26 -0
  252. package/dist/mcp-router/output-compressor.d.ts.map +1 -0
  253. package/dist/mcp-router/output-compressor.js +236 -0
  254. package/dist/mcp-router/output-compressor.js.map +1 -0
  255. package/dist/mcp-router/search/fuzzy.d.ts +26 -0
  256. package/dist/mcp-router/search/fuzzy.d.ts.map +1 -0
  257. package/dist/mcp-router/search/fuzzy.js +94 -0
  258. package/dist/mcp-router/search/fuzzy.js.map +1 -0
  259. package/dist/mcp-router/server.d.ts +50 -0
  260. package/dist/mcp-router/server.d.ts.map +1 -0
  261. package/dist/mcp-router/server.js +229 -0
  262. package/dist/mcp-router/server.js.map +1 -0
  263. package/dist/mcp-router/session-stats.d.ts +37 -0
  264. package/dist/mcp-router/session-stats.d.ts.map +1 -0
  265. package/dist/mcp-router/session-stats.js +56 -0
  266. package/dist/mcp-router/session-stats.js.map +1 -0
  267. package/dist/mcp-router/tools/discover.d.ts +37 -0
  268. package/dist/mcp-router/tools/discover.d.ts.map +1 -0
  269. package/dist/mcp-router/tools/discover.js +65 -0
  270. package/dist/mcp-router/tools/discover.js.map +1 -0
  271. package/dist/mcp-router/tools/execute.d.ts +43 -0
  272. package/dist/mcp-router/tools/execute.d.ts.map +1 -0
  273. package/dist/mcp-router/tools/execute.js +144 -0
  274. package/dist/mcp-router/tools/execute.js.map +1 -0
  275. package/dist/mcp-router/types.d.ts +62 -0
  276. package/dist/mcp-router/types.d.ts.map +1 -0
  277. package/dist/mcp-router/types.js +6 -0
  278. package/dist/mcp-router/types.js.map +1 -0
  279. package/dist/memory/adaptive-context.d.ts +149 -0
  280. package/dist/memory/adaptive-context.d.ts.map +1 -0
  281. package/dist/memory/adaptive-context.js +1095 -0
  282. package/dist/memory/adaptive-context.js.map +1 -0
  283. package/dist/memory/agent-scoped-memory.d.ts +67 -0
  284. package/dist/memory/agent-scoped-memory.d.ts.map +1 -0
  285. package/dist/memory/agent-scoped-memory.js +126 -0
  286. package/dist/memory/agent-scoped-memory.js.map +1 -0
  287. package/dist/memory/ambiguity-detector.d.ts +54 -0
  288. package/dist/memory/ambiguity-detector.d.ts.map +1 -0
  289. package/dist/memory/ambiguity-detector.js +401 -0
  290. package/dist/memory/ambiguity-detector.js.map +1 -0
  291. package/dist/memory/backends/base.d.ts +18 -0
  292. package/dist/memory/backends/base.d.ts.map +1 -0
  293. package/dist/memory/backends/base.js +2 -0
  294. package/dist/memory/backends/base.js.map +1 -0
  295. package/dist/memory/backends/factory.d.ts +4 -0
  296. package/dist/memory/backends/factory.d.ts.map +1 -0
  297. package/dist/memory/backends/factory.js +53 -0
  298. package/dist/memory/backends/factory.js.map +1 -0
  299. package/dist/memory/backends/github.d.ts +27 -0
  300. package/dist/memory/backends/github.d.ts.map +1 -0
  301. package/dist/memory/backends/github.js +134 -0
  302. package/dist/memory/backends/github.js.map +1 -0
  303. package/dist/memory/backends/qdrant-cloud.d.ts +32 -0
  304. package/dist/memory/backends/qdrant-cloud.d.ts.map +1 -0
  305. package/dist/memory/backends/qdrant-cloud.js +167 -0
  306. package/dist/memory/backends/qdrant-cloud.js.map +1 -0
  307. package/dist/memory/context-compressor.d.ts +116 -0
  308. package/dist/memory/context-compressor.d.ts.map +1 -0
  309. package/dist/memory/context-compressor.js +430 -0
  310. package/dist/memory/context-compressor.js.map +1 -0
  311. package/dist/memory/context-pruner.d.ts +55 -0
  312. package/dist/memory/context-pruner.d.ts.map +1 -0
  313. package/dist/memory/context-pruner.js +85 -0
  314. package/dist/memory/context-pruner.js.map +1 -0
  315. package/dist/memory/correction-propagator.d.ts +44 -0
  316. package/dist/memory/correction-propagator.d.ts.map +1 -0
  317. package/dist/memory/correction-propagator.js +156 -0
  318. package/dist/memory/correction-propagator.js.map +1 -0
  319. package/dist/memory/daily-log.d.ts +67 -0
  320. package/dist/memory/daily-log.d.ts.map +1 -0
  321. package/dist/memory/daily-log.js +143 -0
  322. package/dist/memory/daily-log.js.map +1 -0
  323. package/dist/memory/dynamic-retrieval.d.ts +112 -0
  324. package/dist/memory/dynamic-retrieval.d.ts.map +1 -0
  325. package/dist/memory/dynamic-retrieval.js +908 -0
  326. package/dist/memory/dynamic-retrieval.js.map +1 -0
  327. package/dist/memory/embeddings.d.ts +172 -0
  328. package/dist/memory/embeddings.d.ts.map +1 -0
  329. package/dist/memory/embeddings.js +780 -0
  330. package/dist/memory/embeddings.js.map +1 -0
  331. package/dist/memory/generic-uap-patterns.d.ts +7 -0
  332. package/dist/memory/generic-uap-patterns.d.ts.map +1 -0
  333. package/dist/memory/generic-uap-patterns.js +43 -0
  334. package/dist/memory/generic-uap-patterns.js.map +1 -0
  335. package/dist/memory/hierarchical-memory.d.ts +141 -0
  336. package/dist/memory/hierarchical-memory.d.ts.map +1 -0
  337. package/dist/memory/hierarchical-memory.js +485 -0
  338. package/dist/memory/hierarchical-memory.js.map +1 -0
  339. package/dist/memory/knowledge-graph.d.ts +98 -0
  340. package/dist/memory/knowledge-graph.d.ts.map +1 -0
  341. package/dist/memory/knowledge-graph.js +275 -0
  342. package/dist/memory/knowledge-graph.js.map +1 -0
  343. package/dist/memory/memory-consolidator.d.ts +124 -0
  344. package/dist/memory/memory-consolidator.d.ts.map +1 -0
  345. package/dist/memory/memory-consolidator.js +514 -0
  346. package/dist/memory/memory-consolidator.js.map +1 -0
  347. package/dist/memory/memory-maintenance.d.ts +39 -0
  348. package/dist/memory/memory-maintenance.d.ts.map +1 -0
  349. package/dist/memory/memory-maintenance.js +336 -0
  350. package/dist/memory/memory-maintenance.js.map +1 -0
  351. package/dist/memory/model-router.d.ts +105 -0
  352. package/dist/memory/model-router.d.ts.map +1 -0
  353. package/dist/memory/model-router.js +474 -0
  354. package/dist/memory/model-router.js.map +1 -0
  355. package/dist/memory/multi-view-memory.d.ts +134 -0
  356. package/dist/memory/multi-view-memory.d.ts.map +1 -0
  357. package/dist/memory/multi-view-memory.js +430 -0
  358. package/dist/memory/multi-view-memory.js.map +1 -0
  359. package/dist/memory/predictive-memory.d.ts +79 -0
  360. package/dist/memory/predictive-memory.d.ts.map +1 -0
  361. package/dist/memory/predictive-memory.js +294 -0
  362. package/dist/memory/predictive-memory.js.map +1 -0
  363. package/dist/memory/prepopulate.d.ts +76 -0
  364. package/dist/memory/prepopulate.d.ts.map +1 -0
  365. package/dist/memory/prepopulate.js +832 -0
  366. package/dist/memory/prepopulate.js.map +1 -0
  367. package/dist/memory/semantic-compression.d.ts +77 -0
  368. package/dist/memory/semantic-compression.d.ts.map +1 -0
  369. package/dist/memory/semantic-compression.js +359 -0
  370. package/dist/memory/semantic-compression.js.map +1 -0
  371. package/dist/memory/serverless-qdrant.d.ts +102 -0
  372. package/dist/memory/serverless-qdrant.d.ts.map +1 -0
  373. package/dist/memory/serverless-qdrant.js +369 -0
  374. package/dist/memory/serverless-qdrant.js.map +1 -0
  375. package/dist/memory/short-term/factory.d.ts +26 -0
  376. package/dist/memory/short-term/factory.d.ts.map +1 -0
  377. package/dist/memory/short-term/factory.js +28 -0
  378. package/dist/memory/short-term/factory.js.map +1 -0
  379. package/dist/memory/short-term/indexeddb.d.ts +25 -0
  380. package/dist/memory/short-term/indexeddb.d.ts.map +1 -0
  381. package/dist/memory/short-term/indexeddb.js +64 -0
  382. package/dist/memory/short-term/indexeddb.js.map +1 -0
  383. package/dist/memory/short-term/schema.d.ts +6 -0
  384. package/dist/memory/short-term/schema.d.ts.map +1 -0
  385. package/dist/memory/short-term/schema.js +141 -0
  386. package/dist/memory/short-term/schema.js.map +1 -0
  387. package/dist/memory/short-term/sqlite.d.ts +64 -0
  388. package/dist/memory/short-term/sqlite.d.ts.map +1 -0
  389. package/dist/memory/short-term/sqlite.js +274 -0
  390. package/dist/memory/short-term/sqlite.js.map +1 -0
  391. package/dist/memory/speculative-cache.d.ts +111 -0
  392. package/dist/memory/speculative-cache.d.ts.map +1 -0
  393. package/dist/memory/speculative-cache.js +457 -0
  394. package/dist/memory/speculative-cache.js.map +1 -0
  395. package/dist/memory/task-classifier.d.ts +40 -0
  396. package/dist/memory/task-classifier.d.ts.map +1 -0
  397. package/dist/memory/task-classifier.js +342 -0
  398. package/dist/memory/task-classifier.js.map +1 -0
  399. package/dist/memory/terminal-bench-knowledge.d.ts +48 -0
  400. package/dist/memory/terminal-bench-knowledge.d.ts.map +1 -0
  401. package/dist/memory/terminal-bench-knowledge.js +622 -0
  402. package/dist/memory/terminal-bench-knowledge.js.map +1 -0
  403. package/dist/memory/write-gate.d.ts +39 -0
  404. package/dist/memory/write-gate.d.ts.map +1 -0
  405. package/dist/memory/write-gate.js +190 -0
  406. package/dist/memory/write-gate.js.map +1 -0
  407. package/dist/models/api-client.d.ts +46 -0
  408. package/dist/models/api-client.d.ts.map +1 -0
  409. package/dist/models/api-client.js +182 -0
  410. package/dist/models/api-client.js.map +1 -0
  411. package/dist/models/execution-profiles.d.ts +64 -0
  412. package/dist/models/execution-profiles.d.ts.map +1 -0
  413. package/dist/models/execution-profiles.js +403 -0
  414. package/dist/models/execution-profiles.js.map +1 -0
  415. package/dist/models/executor.d.ts +130 -0
  416. package/dist/models/executor.d.ts.map +1 -0
  417. package/dist/models/executor.js +382 -0
  418. package/dist/models/executor.js.map +1 -0
  419. package/dist/models/index.d.ts +19 -0
  420. package/dist/models/index.d.ts.map +1 -0
  421. package/dist/models/index.js +23 -0
  422. package/dist/models/index.js.map +1 -0
  423. package/dist/models/plan-validator.d.ts +37 -0
  424. package/dist/models/plan-validator.d.ts.map +1 -0
  425. package/dist/models/plan-validator.js +179 -0
  426. package/dist/models/plan-validator.js.map +1 -0
  427. package/dist/models/planner.d.ts +73 -0
  428. package/dist/models/planner.d.ts.map +1 -0
  429. package/dist/models/planner.js +375 -0
  430. package/dist/models/planner.js.map +1 -0
  431. package/dist/models/router.d.ts +96 -0
  432. package/dist/models/router.d.ts.map +1 -0
  433. package/dist/models/router.js +523 -0
  434. package/dist/models/router.js.map +1 -0
  435. package/dist/models/types.d.ts +370 -0
  436. package/dist/models/types.d.ts.map +1 -0
  437. package/dist/models/types.js +232 -0
  438. package/dist/models/types.js.map +1 -0
  439. package/dist/models/unified-router.d.ts +152 -0
  440. package/dist/models/unified-router.d.ts.map +1 -0
  441. package/dist/models/unified-router.js +313 -0
  442. package/dist/models/unified-router.js.map +1 -0
  443. package/dist/policies/convert-policy-to-claude.d.ts +3 -0
  444. package/dist/policies/convert-policy-to-claude.d.ts.map +1 -0
  445. package/dist/policies/convert-policy-to-claude.js +87 -0
  446. package/dist/policies/convert-policy-to-claude.js.map +1 -0
  447. package/dist/policies/database-manager.d.ts +27 -0
  448. package/dist/policies/database-manager.d.ts.map +1 -0
  449. package/dist/policies/database-manager.js +198 -0
  450. package/dist/policies/database-manager.js.map +1 -0
  451. package/dist/policies/enforced-tool-router.d.ts +53 -0
  452. package/dist/policies/enforced-tool-router.d.ts.map +1 -0
  453. package/dist/policies/enforced-tool-router.js +80 -0
  454. package/dist/policies/enforced-tool-router.js.map +1 -0
  455. package/dist/policies/index.d.ts +10 -0
  456. package/dist/policies/index.d.ts.map +1 -0
  457. package/dist/policies/index.js +8 -0
  458. package/dist/policies/index.js.map +1 -0
  459. package/dist/policies/policy-gate.d.ts +59 -0
  460. package/dist/policies/policy-gate.d.ts.map +1 -0
  461. package/dist/policies/policy-gate.js +171 -0
  462. package/dist/policies/policy-gate.js.map +1 -0
  463. package/dist/policies/policy-memory.d.ts +18 -0
  464. package/dist/policies/policy-memory.d.ts.map +1 -0
  465. package/dist/policies/policy-memory.js +126 -0
  466. package/dist/policies/policy-memory.js.map +1 -0
  467. package/dist/policies/policy-tools.d.ts +11 -0
  468. package/dist/policies/policy-tools.d.ts.map +1 -0
  469. package/dist/policies/policy-tools.js +66 -0
  470. package/dist/policies/policy-tools.js.map +1 -0
  471. package/dist/policies/schemas/policy.d.ts +69 -0
  472. package/dist/policies/schemas/policy.d.ts.map +1 -0
  473. package/dist/policies/schemas/policy.js +31 -0
  474. package/dist/policies/schemas/policy.js.map +1 -0
  475. package/dist/tasks/coordination.d.ts +83 -0
  476. package/dist/tasks/coordination.d.ts.map +1 -0
  477. package/dist/tasks/coordination.js +291 -0
  478. package/dist/tasks/coordination.js.map +1 -0
  479. package/dist/tasks/database.d.ts +19 -0
  480. package/dist/tasks/database.d.ts.map +1 -0
  481. package/dist/tasks/database.js +149 -0
  482. package/dist/tasks/database.js.map +1 -0
  483. package/dist/tasks/decoder-gate.d.ts +64 -0
  484. package/dist/tasks/decoder-gate.d.ts.map +1 -0
  485. package/dist/tasks/decoder-gate.js +268 -0
  486. package/dist/tasks/decoder-gate.js.map +1 -0
  487. package/dist/tasks/index.d.ts +6 -0
  488. package/dist/tasks/index.d.ts.map +1 -0
  489. package/dist/tasks/index.js +6 -0
  490. package/dist/tasks/index.js.map +1 -0
  491. package/dist/tasks/service.d.ts +40 -0
  492. package/dist/tasks/service.d.ts.map +1 -0
  493. package/dist/tasks/service.js +671 -0
  494. package/dist/tasks/service.js.map +1 -0
  495. package/dist/tasks/types.d.ts +238 -0
  496. package/dist/tasks/types.d.ts.map +1 -0
  497. package/dist/tasks/types.js +74 -0
  498. package/dist/tasks/types.js.map +1 -0
  499. package/dist/telemetry/index.d.ts +2 -0
  500. package/dist/telemetry/index.d.ts.map +1 -0
  501. package/dist/telemetry/index.js +2 -0
  502. package/dist/telemetry/index.js.map +1 -0
  503. package/dist/telemetry/session-telemetry.d.ts +56 -0
  504. package/dist/telemetry/session-telemetry.d.ts.map +1 -0
  505. package/dist/telemetry/session-telemetry.js +807 -0
  506. package/dist/telemetry/session-telemetry.js.map +1 -0
  507. package/dist/types/analysis.d.ts +82 -0
  508. package/dist/types/analysis.d.ts.map +1 -0
  509. package/dist/types/analysis.js +2 -0
  510. package/dist/types/analysis.js.map +1 -0
  511. package/dist/types/config.d.ts +3324 -0
  512. package/dist/types/config.d.ts.map +1 -0
  513. package/dist/types/config.js +418 -0
  514. package/dist/types/config.js.map +1 -0
  515. package/dist/types/coordination.d.ts +240 -0
  516. package/dist/types/coordination.d.ts.map +1 -0
  517. package/dist/types/coordination.js +43 -0
  518. package/dist/types/coordination.js.map +1 -0
  519. package/dist/types/index.d.ts +4 -0
  520. package/dist/types/index.d.ts.map +1 -0
  521. package/dist/types/index.js +4 -0
  522. package/dist/types/index.js.map +1 -0
  523. package/dist/uap-droids-strict.d.ts +59 -0
  524. package/dist/uap-droids-strict.d.ts.map +1 -0
  525. package/dist/uap-droids-strict.js +200 -0
  526. package/dist/uap-droids-strict.js.map +1 -0
  527. package/dist/utils/config-manager.d.ts +30 -0
  528. package/dist/utils/config-manager.d.ts.map +1 -0
  529. package/dist/utils/config-manager.js +41 -0
  530. package/dist/utils/config-manager.js.map +1 -0
  531. package/dist/utils/fetch-with-retry.d.ts +5 -0
  532. package/dist/utils/fetch-with-retry.d.ts.map +1 -0
  533. package/dist/utils/fetch-with-retry.js +61 -0
  534. package/dist/utils/fetch-with-retry.js.map +1 -0
  535. package/dist/utils/merge-claude-md.d.ts +28 -0
  536. package/dist/utils/merge-claude-md.d.ts.map +1 -0
  537. package/dist/utils/merge-claude-md.js +342 -0
  538. package/dist/utils/merge-claude-md.js.map +1 -0
  539. package/dist/utils/rate-limiter.d.ts +58 -0
  540. package/dist/utils/rate-limiter.d.ts.map +1 -0
  541. package/dist/utils/rate-limiter.js +100 -0
  542. package/dist/utils/rate-limiter.js.map +1 -0
  543. package/dist/utils/string-similarity.d.ts +37 -0
  544. package/dist/utils/string-similarity.d.ts.map +1 -0
  545. package/dist/utils/string-similarity.js +114 -0
  546. package/dist/utils/string-similarity.js.map +1 -0
  547. package/dist/utils/validate-json.d.ts +51 -0
  548. package/dist/utils/validate-json.d.ts.map +1 -0
  549. package/dist/utils/validate-json.js +94 -0
  550. package/dist/utils/validate-json.js.map +1 -0
  551. package/docs/INDEX.md +66 -0
  552. package/docs/architecture/MULTI_MODEL.md +224 -0
  553. package/docs/architecture/SYSTEM_ANALYSIS.md +1117 -0
  554. package/docs/architecture/UAP_COMPLIANCE.md +217 -0
  555. package/docs/architecture/UAP_PROTOCOL.md +339 -0
  556. package/docs/architecture/UAP_STRICT_DROIDS.md +172 -0
  557. package/docs/archive/BALLS_MODE_SELF_ANALYSIS.md +260 -0
  558. package/docs/archive/FAILING_TASKS_SOLUTION_PLAN.md +668 -0
  559. package/docs/archive/JINJA2-SYSTEM-MESSAGE-FIX.md +209 -0
  560. package/docs/archive/NPM-PUBLISH-V0.9.1.md +240 -0
  561. package/docs/archive/OPTIMIZATION_OPTIONS.md +334 -0
  562. package/docs/archive/SETUP_IMPROVEMENTS.md +213 -0
  563. package/docs/archive/UAP_GENERIC_OPTIMIZATION_PLAN.md +270 -0
  564. package/docs/archive/UAP_V103_PATTERN_DESIGN.md +315 -0
  565. package/docs/archive/UAP_V104_COMPLIANCE_DESIGN.md +223 -0
  566. package/docs/archive/changelog/2026-03-10_uap-100-compliance.md +77 -0
  567. package/docs/archive/changelog/2026-03-10_uap-full-system-verification.md +109 -0
  568. package/docs/benchmarks/ACCURACY_ANALYSIS.md +471 -0
  569. package/docs/benchmarks/TOKEN_OPTIMIZATION.md +572 -0
  570. package/docs/benchmarks/VALIDATION_PLAN.md +568 -0
  571. package/docs/benchmarks/VALIDATION_RESULTS.md +161 -0
  572. package/docs/deployment/DEPLOYMENT.md +895 -0
  573. package/docs/deployment/DEPLOYMENT_STRATEGIES.md +518 -0
  574. package/docs/deployment/DEPLOY_BATCHER_ANALYSIS.md +856 -0
  575. package/docs/deployment/DEPLOY_BATCHING.md +273 -0
  576. package/docs/deployment/DEPLOY_BUCKETING_ANALYSIS.md +420 -0
  577. package/docs/deployment/QWEN35_LLAMA_CPP.md +265 -0
  578. package/docs/getting-started/INTEGRATION.md +449 -0
  579. package/docs/getting-started/OVERVIEW.md +344 -0
  580. package/docs/getting-started/SETUP.md +203 -0
  581. package/docs/integrations/MCP_ROUTER_SETUP.md +445 -0
  582. package/docs/integrations/RTK_INTEGRATION.md +468 -0
  583. package/docs/operations/TROUBLESHOOTING.md +660 -0
  584. package/docs/reference/API_REFERENCE.md +903 -0
  585. package/docs/reference/FEATURES.md +472 -0
  586. package/docs/reference/HARNESS-MATRIX.md +318 -0
  587. package/docs/reference/UAP_CLI_REFERENCE.md +600 -0
  588. package/docs/research/BEHAVIORAL_PATTERNS.md +228 -0
  589. package/docs/research/DOMAIN_STRATEGIES.md +316 -0
  590. package/docs/research/MEMORY_SYSTEMS_COMPARISON.md +812 -0
  591. package/docs/research/PATTERN_ANALYSIS_2026-01-18.md +436 -0
  592. package/docs/research/PERFORMANCE_ANALYSIS_2026-01-18.md +209 -0
  593. package/docs/research/PERFORMANCE_TEST_PLAN.md +383 -0
  594. package/docs/research/TERMINAL_BENCH_LEARNINGS.md +217 -0
  595. package/package.json +113 -0
  596. package/scripts/README.md +161 -0
  597. package/templates/CLAUDE.template.md +10 -0
  598. package/templates/CLAUDE_ARCHITECTURE.template.md +103 -0
  599. package/templates/CLAUDE_CODING.template.md +127 -0
  600. package/templates/CLAUDE_DROIDS.template.md +109 -0
  601. package/templates/CLAUDE_MEMORY.template.md +131 -0
  602. package/templates/CLAUDE_WORKFLOWS.template.md +139 -0
  603. package/templates/PROJECT.template.md +209 -0
  604. package/templates/SCHEMA.md +57 -0
  605. package/templates/archive/CLAUDE.template.root-v6.md +534 -0
  606. package/templates/archive/CLAUDE.template.v6.md +534 -0
  607. package/templates/hooks/forgecode/pre-compact.sh +68 -0
  608. package/templates/hooks/forgecode/session-start.sh +169 -0
  609. package/templates/hooks/forgecode.plugin.sh +128 -0
  610. package/templates/hooks/pre-compact.sh +74 -0
  611. package/templates/hooks/session-start.sh +366 -0
  612. package/tools/agents/README.md +224 -0
  613. package/tools/agents/UAP/README.md +386 -0
  614. package/tools/agents/UAP/__init__.py +9 -0
  615. package/tools/agents/UAP/cli.py +901 -0
  616. package/tools/agents/UAP/compliance_verify.sh +108 -0
  617. package/tools/agents/UAP/full_verification.sh +126 -0
  618. package/tools/agents/UAP/version.py +32 -0
  619. package/tools/agents/benchmarks/benchmark_memory_systems.py +730 -0
  620. package/tools/agents/benchmarks/results/benchmark_20260106_064817.json +170 -0
  621. package/tools/agents/benchmarks/results/benchmark_20260106_064817.md +51 -0
  622. package/tools/agents/config/chat_template.jinja +77 -0
  623. package/tools/agents/config/tool-call-schema.json +19 -0
  624. package/tools/agents/config/tool-call.gbnf +58 -0
  625. package/tools/agents/docker/Dockerfile.python +52 -0
  626. package/tools/agents/docker/Dockerfile.ubuntu +55 -0
  627. package/tools/agents/docker-compose.qdrant.yml +24 -0
  628. package/tools/agents/install-opencode-local.sh.j2 +135 -0
  629. package/tools/agents/migrations/apply.py +256 -0
  630. package/tools/agents/opencode_uap_agent.py +1505 -0
  631. package/tools/agents/plugin/README.md +91 -0
  632. package/tools/agents/plugin/index.ts +46 -0
  633. package/tools/agents/plugin/pre-compact.sh +68 -0
  634. package/tools/agents/plugin/session-start.sh +175 -0
  635. package/tools/agents/plugin/uap-commands.ts +45 -0
  636. package/tools/agents/plugin/uap-droids.ts +54 -0
  637. package/tools/agents/plugin/uap-patterns.ts +54 -0
  638. package/tools/agents/plugin/uap-skills.ts +52 -0
  639. package/tools/agents/plugins/uap-enforce.ts +314 -0
  640. package/tools/agents/scripts/__pycache__/tool_call_wrapper.cpython-313.pyc +0 -0
  641. package/tools/agents/scripts/chat_template_verifier.py +343 -0
  642. package/tools/agents/scripts/fix-qwen-template.js +38 -0
  643. package/tools/agents/scripts/fix_qwen_chat_template.py +316 -0
  644. package/tools/agents/scripts/generate_lora_training_data.py +412 -0
  645. package/tools/agents/scripts/init_qdrant.py +151 -0
  646. package/tools/agents/scripts/memory_migration.py +560 -0
  647. package/tools/agents/scripts/migrate_memory_to_qdrant.py +110 -0
  648. package/tools/agents/scripts/prepare_lora.sh +512 -0
  649. package/tools/agents/scripts/query_memory.py +200 -0
  650. package/tools/agents/scripts/qwen-tool-call-test.js +38 -0
  651. package/tools/agents/scripts/qwen-tool-call-wrapper.js +38 -0
  652. package/tools/agents/scripts/qwen_tool_call_test.py +464 -0
  653. package/tools/agents/scripts/qwen_tool_call_wrapper.py +686 -0
  654. package/tools/agents/scripts/start-services.sh +96 -0
  655. package/tools/agents/scripts/tool-choice-proxy.cjs +296 -0
  656. package/tools/agents/scripts/tool_call_test.py +656 -0
  657. package/tools/agents/scripts/tool_call_wrapper.py +799 -0
  658. package/tools/agents/tests/test_uap_compliance.py +257 -0
  659. package/tools/agents/uap_agent.py +122 -0
  660. package/tools/agents/uap_agent_install.sh +12 -0
package/README.md ADDED
@@ -0,0 +1,888 @@
1
+ # Universal Agent Protocol (UAP) v8.7.0
2
+
3
+ [![npm version](https://img.shields.io/npm/v/universal-agent-protocol.svg)](https://www.npmjs.com/package/universal-agent-protocol)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ <div align="center">
7
+
8
+ ### AI agents that learn, remember, and coordinate
9
+
10
+ **Every lesson, every pattern, every memory preserved across sessions.**
11
+
12
+ _Not just in one conversation -- but forever._
13
+
14
+ </div>
15
+
16
+ ---
17
+
18
+ ## Quick Start (30 seconds)
19
+
20
+ ```bash
21
+ npm install -g universal-agent-protocol
22
+ cd your-project
23
+ uap init
24
+ uap setup -p all
25
+ ```
26
+
27
+ ---
28
+
29
+ ## Table of Contents
30
+
31
+ - [Feature Overview](#feature-overview)
32
+ - [Memory System](#1-memory-system-23-components)
33
+ - [Multi-Agent Coordination](#2-multi-agent-coordination)
34
+ - [Deploy Batching](#3-deploy-batching)
35
+ - [Policy Enforcement](#4-policy-enforcement-system)
36
+ - [Browser Automation](#5-browser-automation-cloakbrowser)
37
+ - [MCP Router](#6-mcp-router-98-token-reduction)
38
+ - [Multi-Model Architecture](#7-multi-model-architecture)
39
+ - [Pattern System](#8-pattern-system-22-patterns)
40
+ - [Droids and Skills](#9-droids--skills)
41
+ - [Task Management](#10-task-management)
42
+ - [Worktree System](#11-worktree-system)
43
+ - [Hooks System](#12-hooks-system)
44
+ - [CLI Reference](#13-cli-reference-20-commands)
45
+ - [Benchmarking](#14-benchmarking-system)
46
+ - [Qwen3.5 / Local LLM](#15-qwen35--local-llm-optimization)
47
+ - [RTK Token Compression](#16-rtk-rust-token-killer)
48
+ - [Platform Integrations](#17-platform-integrations)
49
+ - [Harness Feature Matrix](#18-harness-feature-matrix)
50
+ - [Guardrails](#guardrails)
51
+ - [Scaling Guide](#scaling-more-devs-more-agents)
52
+ - [Configuration](#configuration)
53
+ - [Testing](#testing--quality)
54
+
55
+ ---
56
+
57
+ ## Feature Overview
58
+
59
+ | Category | Components | Purpose |
60
+ | ------------------ | ------------ | ----------------------------------------------------------------------- |
61
+ | Memory | 23 modules | 4-layer persistent memory with embeddings, knowledge graph, compression |
62
+ | Coordination | 6 modules | Multi-agent lifecycle, work claims, messaging, overlap detection |
63
+ | Deploy Batching | 1 module | Squash, merge, parallelize deploy actions across agents |
64
+ | Policy Enforcement | 6 modules | Store, evaluate, and enforce operational policies with audit trail |
65
+ | Browser | 1 module | Stealth web automation via CloakBrowser (Playwright drop-in) |
66
+ | MCP Router | 6 modules | 2-tool meta-router replacing N tool definitions (98% token savings) |
67
+ | Models | 4 modules | Multi-model routing, planning, execution, validation |
68
+ | Patterns | 22 patterns | Battle-tested workflows from Terminal-Bench 2.0 |
69
+ | Droids | 8+ experts | Specialized agents for security, performance, docs, testing |
70
+ | Skills | 27 skills | Reusable domain expertise (chess, polyglot, compression, etc.) |
71
+ | Tasks | 4 modules | Full task lifecycle with dependencies, claims, JSONL sync |
72
+ | Worktrees | 1 module | Isolated git branches per agent, auto-numbered |
73
+ | Hooks | 2 hooks | Session start (memory injection) and pre-compact (preservation) |
74
+ | CLI | 20+ commands | Full system management with rich dashboard visualization |
75
+ | Benchmarks | 10+ modules | Terminal-Bench adapter, Harbor integration, A/B comparison |
76
+ | LLM Optimization | 5 modules | Qwen3.5 tool call fixes, llama.cpp optimizer, LoRA training |
77
+ | RTK | 1 module | 60-90% token savings on command outputs |
78
+ | Platforms | 6 platforms | Claude, Factory, OpenCode, ForgeCode, VSCode, Cursor |
79
+
80
+ ---
81
+
82
+ ## 1. Memory System (23 Components)
83
+
84
+ ### Architecture: 4 Layers
85
+
86
+ ```
87
+ +-------------------------------------------------------------------+
88
+ | L1: WORKING | Recent actions | 50 max | SQLite |
89
+ | L2: SESSION | Current session | Per run | SQLite |
90
+ | L3: SEMANTIC | Long-term learnings | Qdrant | Vectors |
91
+ | L4: KNOWLEDGE | Entity relationships | SQLite | Graph |
92
+ +-------------------------------------------------------------------+
93
+ ```
94
+
95
+ ### Hierarchical Tiers (Hot/Warm/Cold)
96
+
97
+ | Tier | Entries | Access Time | Behavior |
98
+ | ---- | ------- | ----------- | -------------------- |
99
+ | Hot | 10 | <1ms | Always in context |
100
+ | Warm | 50 | <5ms | Promoted on access |
101
+ | Cold | 500 | ~50ms | Semantic search only |
102
+
103
+ Time-decay formula: `effective_importance = importance * decayRate^daysSinceAccess`
104
+
105
+ ### Memory Components
106
+
107
+ | Component | File | Purpose |
108
+ | ---------------------- | ------------------------------------- | ---------------------------------------------------------------------------------- |
109
+ | Short-Term (SQLite) | `src/memory/short-term/sqlite.ts` | FTS5 full-text search, WAL mode, speculative cache |
110
+ | Short-Term (IndexedDB) | `src/memory/short-term/indexeddb.ts` | Browser environment backend |
111
+ | Hierarchical Memory | `src/memory/hierarchical-memory.ts` | Hot/warm/cold tiering with auto-promotion/demotion |
112
+ | Embedding Service | `src/memory/embeddings.ts` | 4 providers: Ollama, OpenAI, sentence-transformers, TF-IDF fallback |
113
+ | GitHub Backend | `src/memory/backends/github.ts` | Store memories as JSON files in a GitHub repo |
114
+ | Qdrant Backend | `src/memory/backends/qdrant-cloud.ts` | Vector search with project-isolated collections |
115
+ | Serverless Qdrant | `src/memory/serverless-qdrant.ts` | Auto-start/stop Docker, cloud fallback, idle shutdown |
116
+ | Write Gate | `src/memory/write-gate.ts` | Quality filter: behavioral change, commitment, decision, stable fact, user request |
117
+ | Daily Log | `src/memory/daily-log.ts` | Staging area -- all writes land here first, user promotes |
118
+ | Correction Propagation | `src/memory/correction-propagator.ts` | Cross-tier updates, old claims marked [superseded] |
119
+ | Memory Maintenance | `src/memory/memory-maintenance.ts` | Prune, decay, archive, deduplicate (similarity > 0.92) |
120
+ | Agent-Scoped Memory | `src/memory/agent-scoped-memory.ts` | Per-agent partitions, explicit cross-agent sharing |
121
+ | Memory Consolidation | `src/memory/memory-consolidator.ts` | Triggers every 10 entries, recursive summarization |
122
+ | Context Compression | `src/memory/context-compressor.ts` | 3 levels (light/medium/aggressive), token budgets |
123
+ | Semantic Compression | `src/memory/semantic-compression.ts` | SimpleMem-style atomic facts, 30x token reduction |
124
+ | Multi-View (ENGRAM) | `src/memory/multi-view-memory.ts` | Episodic/semantic/procedural typing, multi-index |
125
+ | Speculative Cache | `src/memory/speculative-cache.ts` | Pre-computes likely queries, LRU with TTL |
126
+ | Knowledge Graph | `src/memory/knowledge-graph.ts` | Entities + relationships in SQLite, <20ms access |
127
+ | Dynamic Retrieval | `src/memory/dynamic-retrieval.ts` | Adaptive depth based on query complexity |
128
+ | Adaptive Context | `src/memory/adaptive-context.ts` | 21 optimizations, historical benefit tracking |
129
+ | Task Classifier | `src/memory/task-classifier.ts` | Classifies into 9 categories, suggests droids |
130
+ | Model Router | `src/memory/model-router.ts` | Routes to optimal model by task type and cost |
131
+ | Prepopulation | `src/memory/prepopulate.ts` | Import from docs (markdown) and git history |
132
+
133
+ ---
134
+
135
+ ## 2. Multi-Agent Coordination
136
+
137
+ ### How Agents Work Together Without Collisions
138
+
139
+ ```
140
+ Agent A Agent B Agent C
141
+ | | |
142
+ v v v
143
+ [Register] [Register] [Register]
144
+ | | |
145
+ v v v
146
+ [Heartbeat 30s] [Heartbeat 30s] [Heartbeat 30s]
147
+ | | |
148
+ v v v
149
+ [Announce: src/auth/] [Announce: src/api/] [Announce: src/ui/]
150
+ | | |
151
+ v v v
152
+ [Overlap Check] [Overlap Check] [Overlap Check]
153
+ | | |
154
+ v v v
155
+ [Worktree: 001-auth] [Worktree: 002-api] [Worktree: 003-ui]
156
+ | | |
157
+ v v v
158
+ [Work in isolation] [Work in isolation] [Work in isolation]
159
+ | | |
160
+ v v v
161
+ [Queue deploy] [Queue deploy] [Queue deploy]
162
+ | | |
163
+ +----------+---------------+----------+---------------+
164
+ | |
165
+ v v
166
+ [Deploy Batcher] [Squash & Execute]
167
+ ```
168
+
169
+ ### Coordination Components
170
+
171
+ | Component | File | Purpose |
172
+ | --------------------- | --------------------------------------- | ----------------------------------------------------------------- |
173
+ | Coordination Service | `src/coordination/service.ts` | Agent lifecycle, work claims, announcements, messaging |
174
+ | Coordination Database | `src/coordination/database.ts` | SQLite with WAL: agents, claims, announcements, messages, deploys |
175
+ | Capability Router | `src/coordination/capability-router.ts` | Routes tasks to droids by 18 capability types |
176
+ | Auto-Agent | `src/coordination/auto-agent.ts` | Automatic registration, heartbeat, graceful shutdown |
177
+ | Pattern Router | `src/coordination/pattern-router.ts` | Loads Terminal-Bench patterns, always includes critical ones |
178
+
179
+ ### Overlap Detection
180
+
181
+ Conflict risk levels: `none` | `low` | `medium` | `high` | `critical`
182
+
183
+ Detection checks:
184
+
185
+ - File-level overlap (same files modified)
186
+ - Directory-level overlap (same directories)
187
+ - Collaboration suggestions (merge order, sequential vs parallel)
188
+
189
+ ### Messaging
190
+
191
+ - **Broadcast** -- all agents
192
+ - **Direct** -- specific agent
193
+ - **Channels** -- broadcast, deploy, review, coordination
194
+ - **Priority** -- normal, high, urgent
195
+ - **Read receipts** -- delivery confirmation
196
+
197
+ ---
198
+
199
+ ## 3. Deploy Batching
200
+
201
+ Prevents deploy storms when multiple agents finish work simultaneously.
202
+
203
+ ### How It Works
204
+
205
+ ```
206
+ Agent A queues: commit -> push
207
+ Agent B queues: commit -> push
208
+ Agent C queues: commit -> push
209
+ |
210
+ v
211
+ [Deploy Batcher]
212
+ |
213
+ v
214
+ Squash 3 commits into 1
215
+ Single push to remote
216
+ ```
217
+
218
+ ### Batch Windows (per action type)
219
+
220
+ | Action | Default Window | Urgent Window |
221
+ | -------- | -------------- | ------------- |
222
+ | commit | 30s | 3s |
223
+ | push | 5s | 1s |
224
+ | merge | 10s | 2s |
225
+ | workflow | 5s | 1s |
226
+ | deploy | 60s | 5s |
227
+
228
+ ### Features
229
+
230
+ - **Squashing** -- Multiple commits to same target become one
231
+ - **Merging** -- Similar pending actions deduplicated
232
+ - **Parallel execution** -- Independent workflows run concurrently
233
+ - **Sequential safety** -- State-dependent actions (commit, push, merge) run in order
234
+ - **Timeout protection** -- 300s default, prevents hung processes
235
+ - **Dry run** -- Preview mode before execution
236
+ - **Urgent mode** -- Reduces all windows to minimum
237
+
238
+ ### CLI
239
+
240
+ ```bash
241
+ uap deploy queue --action commit --target main --message "feat: add auth"
242
+ uap deploy batch # Group pending actions
243
+ uap deploy execute # Run the batch
244
+ uap deploy status # View queue
245
+ uap deploy flush # Force-execute all pending
246
+ uap deploy config # View batch config
247
+ uap deploy set-config --urgent # Enable urgent mode
248
+ ```
249
+
250
+ ---
251
+
252
+ ## 4. Policy Enforcement System
253
+
254
+ ### Architecture (3 Layers)
255
+
256
+ ```
257
+ Tool Call
258
+ |
259
+ v
260
+ [EnforcedToolRouter]
261
+ |
262
+ v
263
+ [PolicyGate]
264
+ / | \
265
+ v v v
266
+ [Policy] [Policy] [Policy]
267
+ REQUIRED RECOMMENDED OPTIONAL
268
+ |
269
+ v
270
+ [Allow / Block]
271
+ |
272
+ v
273
+ [Audit Trail]
274
+ ```
275
+
276
+ ### Components
277
+
278
+ | Component | File | Purpose |
279
+ | -------------------- | ------------------------------------------ | ----------------------------------------------------- |
280
+ | Policy Schema | `src/policies/schemas/policy.ts` | Zod schemas for policies and executions |
281
+ | Database Manager | `src/policies/database-manager.ts` | SQLite with WAL, JSON serialization, 3 tables |
282
+ | Policy Memory | `src/policies/policy-memory.ts` | CRUD, relevance search, tag/category filtering |
283
+ | Policy Tools | `src/policies/policy-tools.ts` | Store/execute Python enforcement tools |
284
+ | Policy Gate | `src/policies/policy-gate.ts` | Middleware: check REQUIRED policies, block violations |
285
+ | Enforced Tool Router | `src/policies/enforced-tool-router.ts` | Single entry point for all tool calls |
286
+ | Policy Converter | `src/policies/convert-policy-to-claude.ts` | Markdown to CLAUDE.md format |
287
+
288
+ ### Enforcement Levels
289
+
290
+ | Level | Behavior |
291
+ | ----------- | ----------------------------------------------------------- |
292
+ | REQUIRED | Blocks execution if violated, throws `PolicyViolationError` |
293
+ | RECOMMENDED | Logged but does not block |
294
+ | OPTIONAL | Informational only |
295
+
296
+ ### Audit Trail
297
+
298
+ Every policy check is logged to `policy_executions` table:
299
+
300
+ - Policy ID, tool name, operation, arguments
301
+ - Allowed/blocked decision with reason
302
+ - Timestamp
303
+
304
+ ### CLI
305
+
306
+ ```bash
307
+ uap-policy add -f policies/image-rules.md -c image -l REQUIRED
308
+ uap-policy list
309
+ uap-policy check -o "vision_count" -a '{"image":"photo.png"}'
310
+ uap-policy audit -n 50
311
+ uap-policy convert -i <policy-id> -o output.md
312
+ uap-policy add-tool -p <id> -t count_elements -c scripts/count.py
313
+ ```
314
+
315
+ ---
316
+
317
+ ## 5. Browser Automation (CloakBrowser)
318
+
319
+ Stealth web browser via CloakBrowser -- a Playwright drop-in with 33 source-level C++ patches.
320
+
321
+ ### Capabilities
322
+
323
+ | Feature | Status |
324
+ | -------------------- | ------------------------------------- |
325
+ | Headless Chrome | Real Chrome UA (not "HeadlessChrome") |
326
+ | webdriver flag | `false` (undetectable) |
327
+ | Plugins | 5 detected (matches real browser) |
328
+ | window.chrome | Present |
329
+ | reCAPTCHA v3 | 0.9 score |
330
+ | Cloudflare Turnstile | Passes |
331
+ | FingerprintJS | Undetected |
332
+ | Persistent profiles | Cookie/localStorage persistence |
333
+
334
+ ### Usage
335
+
336
+ ```typescript
337
+ import { createWebBrowser } from 'universal-agent-protocol/browser';
338
+
339
+ const browser = createWebBrowser();
340
+ await browser.launch({ headless: true, humanize: true });
341
+ await browser.goto('https://example.com');
342
+ const content = await browser.getContent();
343
+ await browser.evaluate(() => document.title);
344
+ await browser.close();
345
+ ```
346
+
347
+ ---
348
+
349
+ ## 6. MCP Router (98% Token Reduction)
350
+
351
+ Replaces N tool definitions with 2 meta-tools.
352
+
353
+ ### Before vs After
354
+
355
+ ```
356
+ Before: 47 tools exposed = ~12,000 tokens in system prompt
357
+ After: 2 tools exposed = ~200 tokens in system prompt
358
+ (98.3% reduction)
359
+ ```
360
+
361
+ ### Components
362
+
363
+ | Component | File | Purpose |
364
+ | ----------------- | ------------------------------------- | ------------------------------------------- |
365
+ | MCP Server | `src/mcp-router/server.ts` | Exposes `discover_tools` and `execute_tool` |
366
+ | Config Parser | `src/mcp-router/config/parser.ts` | Loads MCP configs from standard paths |
367
+ | Fuzzy Search | `src/mcp-router/search/fuzzy.ts` | Tool discovery with fuzzy matching |
368
+ | Client Pool | `src/mcp-router/executor/client.ts` | Manages connections to MCP servers |
369
+ | Output Compressor | `src/mcp-router/output-compressor.ts` | Compresses tool output |
370
+ | Session Stats | `src/mcp-router/session-stats.ts` | Per-tool token consumption tracking |
371
+
372
+ ---
373
+
374
+ ## 7. Multi-Model Architecture
375
+
376
+ ### 3-Tier Execution
377
+
378
+ ```
379
+ Tier 1: TaskPlanner -- Decomposes task into subtasks
380
+ Tier 2: ModelRouter -- Assigns optimal model per subtask
381
+ Tier 3: TaskExecutor -- Executes with validation
382
+ ```
383
+
384
+ | Component | File | Purpose |
385
+ | -------------- | ------------------------------ | -------------------------------------------------------- |
386
+ | Model Router | `src/models/router.ts` | Routes by complexity (critical/high/medium/low) and cost |
387
+ | Task Planner | `src/models/planner.ts` | Decomposition, dependency analysis, parallelization |
388
+ | Task Executor | `src/models/executor.ts` | Executes plans with model clients |
389
+ | Plan Validator | `src/models/plan-validator.ts` | Cycle detection, coherence checks, timeout protection |
390
+
391
+ ---
392
+
393
+ ## 8. Pattern System (22 Patterns)
394
+
395
+ Battle-tested patterns from Terminal-Bench 2.0 analysis, stored in `.factory/patterns/`.
396
+
397
+ | Pattern | ID | Category | What It Prevents |
398
+ | --------------------- | --- | -------------- | -------------------------------------- |
399
+ | Output Existence | P12 | Verification | 37% of failures (missing output files) |
400
+ | Output Format | P14 | Verification | Wrong format/encoding |
401
+ | Constraint Extraction | P17 | Planning | Missing hidden requirements |
402
+ | Task-First | P16 | Execution | Over-planning before doing |
403
+ | Impossible Refusal | P19 | Safety | Attempting impossible tasks |
404
+ | Adversarial | P20 | Security | Missing attack vectors |
405
+ | Chess Engine | P21 | Domain | Reinventing Stockfish |
406
+ | Git Recovery | P22 | Recovery | Data loss during git ops |
407
+ | Compression Check | P23 | Verification | Lossy compression errors |
408
+ | Polyglot | P24 | Code-Golf | Single-language thinking |
409
+ | Service Config | P25 | DevOps | Misconfigured services |
410
+ | Near-Miss | P26 | Testing | Almost-correct solutions |
411
+ | Smoke Test | P28 | Testing | Untested changes |
412
+ | Performance Threshold | P30 | Optimization | Missing perf targets |
413
+ | Round-Trip | P31 | Verification | Encode/decode mismatches |
414
+ | CLI Verify | P32 | Verification | Broken CLI commands |
415
+ | Numerical Stability | P33 | Testing | Floating point errors |
416
+ | Image Pipeline | P34 | Domain | Image processing errors |
417
+ | Decoder-First | P35 | Analysis | Wrong problem decomposition |
418
+ | Competition Domain | P36 | Research | Missing domain knowledge |
419
+ | IaC Parity | IaC | Infrastructure | Config drift |
420
+ | Iterative Refinement | P13 | Testing | First-attempt acceptance |
421
+
422
+ ---
423
+
424
+ ## 9. Droids & Skills
425
+
426
+ ### Expert Droids (8+)
427
+
428
+ | Droid | File | Specialization |
429
+ | ------------------------ | --------------------------------------------- | -------------------------------- |
430
+ | Code Quality Guardian | `.factory/droids/code-quality-guardian.md` | Code review, quality enforcement |
431
+ | Debug Expert | `.factory/droids/debug-expert.md` | Debugging specialist |
432
+ | Documentation Expert | `.factory/droids/documentation-expert.md` | Documentation |
433
+ | ML Training Expert | `.factory/droids/ml-training-expert.md` | ML/training |
434
+ | Performance Optimizer | `.factory/droids/performance-optimizer.md` | Performance |
435
+ | Security Auditor | `.factory/droids/security-auditor.md` | Security review |
436
+ | Sysadmin Expert | `.factory/droids/sysadmin-expert.md` | System administration |
437
+ | Terminal-Bench Optimizer | `.factory/droids/terminal-bench-optimizer.md` | Benchmark optimization |
438
+
439
+ ### Skills (27 total)
440
+
441
+ **Project Skills** (5): codebase-navigator, memory-management, near-miss-iteration, terminal-bench, worktree-workflow
442
+
443
+ **Claude Skills** (5): hooks-session-start, hooks-pre-compact, scripts-tool-router, scripts-preload-memory, session-context-preservation-droid
444
+
445
+ **Factory Skills** (16): adversarial, balls-mode, batch-review, chess-engine, cli-design-expert, codebase-navigator, compression, git-forensics, near-miss, polyglot, sec-context-review, service-config, terminal-bench-strategies, typescript-node-expert, unreal-engine-developer
446
+
447
+ ---
448
+
449
+ ## 10. Task Management
450
+
451
+ Full task lifecycle with dependencies, claims, and JSONL sync for git versioning.
452
+
453
+ | Feature | Description |
454
+ | ------------ | -------------------------------------------- |
455
+ | Types | task, bug, feature, epic, chore, story |
456
+ | Statuses | open, in_progress, blocked, done, wont_do |
457
+ | Priorities | P0 (critical) through P4 (low) |
458
+ | Dependencies | blocks, related, discovered_from |
459
+ | Claims | Exclusive claim with worktree + announcement |
460
+ | JSONL Sync | Git-versionable task export |
461
+ | Compaction | Archive old closed tasks |
462
+
463
+ ---
464
+
465
+ ## 11. Worktree System
466
+
467
+ Each agent works in an isolated git worktree to prevent conflicts.
468
+
469
+ ```bash
470
+ uap worktree create my-feature
471
+ # Creates: .worktrees/001-my-feature/
472
+ # Branch: 001-my-feature
473
+ # Registry: .uap/worktree_registry.db
474
+
475
+ uap worktree list # Show all worktrees
476
+ uap worktree pr 001 # Create PR
477
+ uap worktree cleanup 001 # Remove worktree + branch
478
+ ```
479
+
480
+ Auto-numbered (NNN-slug) to prevent naming collisions between agents.
481
+
482
+ ---
483
+
484
+ ## 12. Hooks System
485
+
486
+ ### Session Start Hook
487
+
488
+ Runs at every session start:
489
+
490
+ 1. Cleans stale agents (>24h no heartbeat)
491
+ 2. Injects UAP compliance checklist (10 steps)
492
+ 3. Loads recent memories (last 24h)
493
+ 4. Surfaces open loops from session memories
494
+ 5. Warns about stale worktrees
495
+
496
+ ### Pre-Compact Hook
497
+
498
+ Runs before context compaction:
499
+
500
+ 1. Records compaction marker in memory
501
+ 2. Checks if lessons were stored (warns if not)
502
+ 3. Outputs compliance reminder
503
+ 4. Cleans up agents from current session
504
+
505
+ ### Supported Platforms
506
+
507
+ ```bash
508
+ uap hooks install claude
509
+ uap hooks install factory
510
+ uap hooks install cursor
511
+ uap hooks install vscode
512
+ uap hooks install opencode
513
+ uap hooks install forgecode
514
+ ```
515
+
516
+ ---
517
+
518
+ ## 13. CLI Reference (20+ Commands)
519
+
520
+ ### Core
521
+
522
+ | Command | Description |
523
+ | ---------------------- | -------------------------------------------- |
524
+ | `uap init` | Initialize UAP in a project |
525
+ | `uap setup -p all` | Full setup (memory, Qdrant, hooks, patterns) |
526
+ | `uap generate` | Regenerate CLAUDE.md from templates |
527
+ | `uap update` | Update all components |
528
+ | `uap analyze` | Analyze project structure |
529
+ | `uap compliance check` | Verify UAP compliance |
530
+ | `uap dashboard` | Rich terminal dashboard |
531
+
532
+ ### Memory
533
+
534
+ | Command | Description |
535
+ | ---------------------------- | ------------------------------------- |
536
+ | `uap memory status` | Check memory system |
537
+ | `uap memory query <search>` | Search memories |
538
+ | `uap memory store <content>` | Store a learning (write-gated) |
539
+ | `uap memory start` | Start Qdrant |
540
+ | `uap memory prepopulate` | Import from docs/git |
541
+ | `uap memory promote` | Promote daily log entries |
542
+ | `uap memory correct` | Correct a memory (propagates) |
543
+ | `uap memory maintain` | Run maintenance (prune, decay, dedup) |
544
+
545
+ ### Coordination
546
+
547
+ | Command | Description |
548
+ | --------------------- | --------------------- |
549
+ | `uap agent register` | Register agent |
550
+ | `uap agent heartbeat` | Send heartbeat |
551
+ | `uap agent announce` | Announce work area |
552
+ | `uap agent overlaps` | Check for conflicts |
553
+ | `uap agent broadcast` | Message all agents |
554
+ | `uap coord status` | Coordination overview |
555
+ | `uap coord cleanup` | Clean stale agents |
556
+
557
+ ### Deploy
558
+
559
+ | Command | Description |
560
+ | -------------------- | --------------------- |
561
+ | `uap deploy queue` | Queue a deploy action |
562
+ | `uap deploy batch` | Group pending actions |
563
+ | `uap deploy execute` | Run the batch |
564
+ | `uap deploy flush` | Force-execute all |
565
+ | `uap deploy status` | View queue |
566
+
567
+ ### Additional Binaries
568
+
569
+ | Binary | Description |
570
+ | ---------------- | ------------------------------------------- |
571
+ | `uap-policy` | Policy management (add, list, check, audit) |
572
+ | `uap-tool-calls` | Qwen3.5 tool call fixes |
573
+ | `llama-optimize` | llama.cpp startup parameter generator |
574
+
575
+ ---
576
+
577
+ ## 14. Benchmarking System
578
+
579
+ Terminal-Bench adapter for A/B comparison of UAM-enabled vs naive agents.
580
+
581
+ | Component | File | Purpose |
582
+ | ------------------- | -------------------------------------- | ------------------------------------ |
583
+ | Benchmark Framework | `src/benchmarks/benchmark.ts` | Task schemas, verification functions |
584
+ | Benchmark Runner | `src/benchmarks/runner.ts` | Orchestrates execution |
585
+ | Naive Agent | `src/benchmarks/agents/naive-agent.ts` | Baseline without UAM |
586
+ | UAM Agent | `src/benchmarks/agents/uam-agent.ts` | UAM-enabled agent |
587
+ | SUPERGENIUS Agent | `src/uam_harbor/supergenius_agent.py` | Python agent targeting 80%+ |
588
+ | Harbor Datasets | `harbor-datasets/` | Docker-sandboxed benchmark tasks |
589
+
590
+ ---
591
+
592
+ ## 15. Qwen3.5 / Local LLM Optimization
593
+
594
+ | Component | File | Purpose |
595
+ | ----------------- | ----------------------------------------------------- | ----------------------------------------- |
596
+ | Tool Call Fixes | `tools/agents/scripts/qwen_tool_call_*.py` | Fix Qwen3.5 tool call reliability |
597
+ | Chat Template Fix | `tools/agents/scripts/fix_qwen_chat_template.py` | Template modifications |
598
+ | Llama Optimizer | `src/bin/llama-server-optimize.ts` | Optimal llama.cpp params for 16/24GB VRAM |
599
+ | LoRA Training | `tools/agents/scripts/generate_lora_training_data.py` | Fine-tuning data generation |
600
+ | Qwen Settings | `config/qwen35-settings.json` | Model-specific configuration |
601
+
602
+ ---
603
+
604
+ ## 16. RTK (Rust Token Killer)
605
+
606
+ 60-90% token savings on command outputs.
607
+
608
+ ```bash
609
+ uap rtk install # Install RTK
610
+ uap rtk status # Check installation
611
+ uap rtk help # Usage guide
612
+ ```
613
+
614
+ ---
615
+
616
+ ## 17. Platform Integrations
617
+
618
+ | Platform | Directory | Features |
619
+ | ----------- | ------------ | ------------------------------------------------ |
620
+ | Claude Code | `.claude/` | Hooks, skills, settings, commands, agents |
621
+ | Factory.AI | `.factory/` | Droids, skills, hooks, patterns, config |
622
+ | OpenCode | `.opencode/` | Plugin system, config |
623
+ | ForgeCode | `.forge/` | ZSH plugin, hooks |
624
+ | VSCode | `.vscode/` | Workspace settings, extensions |
625
+ | Beads | `.beads/` | Git-native issue tracking with JSONL, daemon RPC |
626
+
627
+ ---
628
+
629
+ ## 18. Harness Feature Matrix
630
+
631
+ Every AI coding harness ships as a stateless editor with file and terminal access. UAP closes the gap between "tool that edits code" and "agent platform that learns, coordinates, and enforces policy." It works with **15 harnesses** across 4 integration tiers -- same features everywhere, deeper wiring on first-class platforms.
632
+
633
+ ### What UAP Adds (and Why It Matters)
634
+
635
+ - **4-layer persistent memory** -- agents retain lessons, decisions, and corrections across sessions instead of starting from zero
636
+ - **Write gate** -- 5-criteria quality filter prevents memory pollution so only high-value knowledge is stored
637
+ - **22 battle-tested patterns** -- Terminal-Bench 2.0 workflows eliminate the 37% of failures caused by missing output files, wrong formats, and skipped verification
638
+ - **Pattern RAG** -- on-demand pattern retrieval saves ~12K tokens per session by injecting only relevant patterns
639
+ - **Worktree isolation** -- each agent works in its own git worktree so parallel agents never corrupt each other's state
640
+ - **Multi-agent coordination** -- heartbeats, overlap detection, and conflict risk assessment let 2-10+ agents collaborate without collisions
641
+ - **Deploy batching** -- squash commits and serialize pushes to prevent deploy storms when multiple agents finish simultaneously
642
+ - **Policy enforcement** -- required/recommended/optional rules with audit trail ensure agents follow project standards
643
+ - **Task management** -- dependency-aware DAG with cycle detection, claims, and JSONL sync for git-versionable task tracking
644
+ - **Model routing** -- routes subtasks to optimal models by complexity and cost across 6 presets
645
+ - **MCP Router** -- replaces N tool definitions with 2 meta-tools for 98% token reduction in system prompts
646
+ - **RTK** -- 60-90% token savings on command outputs via Rust-based compression
647
+ - **12-gate compliance** -- automated protocol verification catches drift before it ships
648
+ - **20+ CLI commands** -- full system management with rich dashboard visualization
649
+
650
+ > Full 15-harness matrix with per-harness integration details: **[docs/reference/HARNESS-MATRIX.md](docs/reference/HARNESS-MATRIX.md)**
651
+
652
+ ### Baseline: What Harnesses Provide Natively
653
+
654
+ | Feature | Claude Code | Factory.AI | OpenCode | ForgeCode | Cursor | VSCode | Cline | Windsurf |
655
+ | ---------------------------- | :---------: | :--------: | :--------: | :-------: | :----------: | :-----: | :---------: | :------------: |
656
+ | File system + terminal | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
657
+ | Context file | CLAUDE.md | PROJECT.md | -- | -- | .cursorrules | -- | .clinerules | .windsurfrules |
658
+ | Native hooks | Yes | Yes | Plugin API | ZSH | hooks.json | -- | -- | -- |
659
+ | MCP support | Native | Native | Config | -- | Native | Via ext | Via ext | Via ext |
660
+ | Persistent sessions | Yes | Yes | Yes | ZSH env | Limited | Limited | Limited | Limited |
661
+ | Local LLM support | -- | -- | Native | Yes | Yes | Via ext | Yes | Yes |
662
+ | **Persistent memory** | -- | -- | -- | -- | -- | -- | -- | -- |
663
+ | **Pattern library** | -- | -- | -- | -- | -- | -- | -- | -- |
664
+ | **Multi-agent coordination** | -- | -- | -- | -- | -- | -- | -- | -- |
665
+ | **Policy enforcement** | -- | -- | -- | -- | -- | -- | -- | -- |
666
+
667
+ The bottom four rows are the gap. No harness provides them. UAP does.
668
+
669
+ ### With UAP: Uniform Capabilities Across All Harnesses
670
+
671
+ | Capability | Benefit | All Harnesses |
672
+ | ------------------------ | ------------------------------------- | :-----------: |
673
+ | 4-layer memory (L1-L4) | Agents remember across sessions | Yes |
674
+ | Write gate + tiering | Only high-value knowledge stored | Yes |
675
+ | 22 patterns + RAG | Proven workflows, ~12K token savings | Yes |
676
+ | Worktree isolation | Parallel agents, zero conflicts | Yes |
677
+ | Multi-agent coordination | Heartbeats, overlap detection, claims | Yes |
678
+ | Deploy batching | No push races, squashed commits | Yes |
679
+ | Policy engine | Audit-trailed rule enforcement | Yes |
680
+ | Task DAG | Dependency-aware work tracking | Yes |
681
+ | Model router | Right model for each subtask | Yes |
682
+ | MCP Router | 98% system prompt token reduction | Yes |
683
+ | RTK compression | 60-90% output token savings | Yes |
684
+ | 12-gate compliance | Automated protocol verification | Yes |
685
+ | 20+ CLI commands | Full management + dashboard | Yes |
686
+
687
+ ### Integration Tiers
688
+
689
+ | Tier | Harnesses | What You Get |
690
+ | ---------------------- | ------------------------------------------------- | ----------------------------------------------------------------------- |
691
+ | **T1 -- First-Class** | Claude Code, Factory.AI, OpenCode, ForgeCode | Native hooks, dedicated config dir, `uap sync`, context file generation |
692
+ | **T2 -- IDE-Based** | Cursor, VSCode, Cline | Platform-specific hooks, MCP config paths |
693
+ | **T3 -- CLI/Terminal** | Windsurf, Codex CLI, Aider, Zed AI | Mapped to T1/T2 via CLAUDE.md or .cursorrules |
694
+ | **T4 -- Additional** | GitHub Copilot, JetBrains AI, SWE-agent, Continue | Piggybacks on T2 infrastructure |
695
+
696
+ All tiers receive identical UAP features. The difference is integration depth, not capability.
697
+
698
+ ---
699
+
700
+ ## Guardrails
701
+
702
+ ### Completion Gates (Mandatory)
703
+
704
+ Every task must pass 3 gates before completion:
705
+
706
+ | Gate | Check | Prevents |
707
+ | --------------- | ------------------------- | ----------------------- |
708
+ | OUTPUT_EXISTS | All expected files exist | Phantom completions |
709
+ | CONSTRAINTS_MET | All requirements verified | Partial implementations |
710
+ | TESTS_PASS | `npm test` passes 100% | Broken code |
711
+
712
+ ### Write Gate (Memory Quality)
713
+
714
+ Evaluates 5 criteria before storing a memory:
715
+
716
+ 1. **Behavioral change** -- Does this change how we work?
717
+ 2. **Commitment with consequences** -- Is there a real commitment?
718
+ 3. **Decision with rationale** -- Was a decision made and why?
719
+ 4. **Stable recurring fact** -- Is this a durable fact?
720
+ 5. **Explicit user request** -- Did the user ask to remember this?
721
+
722
+ Minimum score: 0.3 (configurable). Noise patterns filter acknowledgments and transient requests.
723
+
724
+ ### Policy Enforcement
725
+
726
+ REQUIRED policies block tool execution. Every check is logged to the audit trail. `PolicyViolationError` thrown with structured details.
727
+
728
+ ### Pattern Router
729
+
730
+ Critical patterns (Output Existence, Decoder-First) are always active regardless of task classification.
731
+
732
+ ### Correction Propagation
733
+
734
+ When a memory is corrected, old claims are marked `[superseded]` with date and reason across all tiers.
735
+
736
+ ### Stale Agent Cleanup
737
+
738
+ Session hooks automatically clean agents with no heartbeat for >24 hours.
739
+
740
+ ---
741
+
742
+ ## Scaling: More Devs, More Agents
743
+
744
+ ### How Multiple Agents Avoid Collisions
745
+
746
+ | Mechanism | How It Works |
747
+ | ----------------------------- | ----------------------------------------------------------------------------------------------- |
748
+ | **Worktree isolation** | Each agent gets its own git worktree (`.worktrees/NNN-slug/`). No shared working directory. |
749
+ | **Work announcements** | Agents announce which files/directories they're touching. Overlap detection warns of conflicts. |
750
+ | **Conflict risk levels** | `none` / `low` / `medium` / `high` / `critical` -- agents can decide whether to proceed. |
751
+ | **Collaboration suggestions** | System recommends merge order and sequential vs parallel work. |
752
+ | **Deploy batching** | Multiple agents' commits are squashed and pushed in a single batch, preventing push races. |
753
+ | **Agent-scoped memory** | Each agent has its own memory partition. Cross-agent sharing requires explicit promotion. |
754
+ | **Heartbeat liveness** | 30-second heartbeats detect crashed agents. Stale agents cleaned automatically. |
755
+ | **Exclusive claims** | Transaction-safe resource claiming with expiry prevents double-work. |
756
+
757
+ ### Scaling from 1 to N Agents
758
+
759
+ ```
760
+ 1 agent: No coordination needed. Worktree optional.
761
+ 2-3 agents: Worktrees + announcements. Deploy batching recommended.
762
+ 4-10 agents: Full coordination. Capability routing. Deploy batching required.
763
+ 10+ agents: All of the above + agent-scoped memory + messaging channels.
764
+ ```
765
+
766
+ ### Scaling from 1 to N Developers
767
+
768
+ | Concern | Solution |
769
+ | ------------------ | ------------------------------------------------------- |
770
+ | Config conflicts | `.uap.json` is project-scoped, not user-scoped |
771
+ | Memory conflicts | SQLite WAL mode supports concurrent reads |
772
+ | Worktree naming | Auto-numbered (001, 002, ...) prevents collisions |
773
+ | Deploy races | Batcher squashes and serializes state-dependent actions |
774
+ | Pattern drift | Patterns indexed in Qdrant, shared across all agents |
775
+ | Policy consistency | Policies stored in SQLite, enforced uniformly |
776
+
777
+ ### Database Concurrency
778
+
779
+ All SQLite databases use WAL (Write-Ahead Logging) mode:
780
+
781
+ - Multiple concurrent readers
782
+ - Single writer with no reader blocking
783
+ - Busy timeout prevents lock contention errors
784
+
785
+ ### Resource Isolation
786
+
787
+ ```
788
+ agents/data/
789
+ memory/
790
+ short_term.db # Shared memory (WAL mode)
791
+ policies.db # Shared policies (WAL mode)
792
+ coordination/
793
+ coordination.db # Shared coordination (WAL mode)
794
+ .uap/tasks/
795
+ tasks.db # Shared tasks (WAL mode)
796
+ .uap/
797
+ worktree_registry.db # Shared worktree registry
798
+ .worktrees/
799
+ 001-feature-a/ # Agent A's isolated checkout
800
+ 002-feature-b/ # Agent B's isolated checkout
801
+ ```
802
+
803
+ ---
804
+
805
+ ## Configuration
806
+
807
+ ### .uap.json (Project)
808
+
809
+ ```json
810
+ {
811
+ "project": { "name": "my-project", "defaultBranch": "main" },
812
+ "memory": {
813
+ "shortTerm": { "enabled": true, "path": "./agents/data/memory/short_term.db" },
814
+ "longTerm": { "enabled": true, "provider": "qdrant" }
815
+ },
816
+ "worktrees": { "enabled": true, "directory": ".worktrees" }
817
+ }
818
+ ```
819
+
820
+ ### opencode.json (Platform)
821
+
822
+ ```json
823
+ {
824
+ "provider": {
825
+ "llama.cpp": {
826
+ "options": { "baseURL": "http://localhost:8080/v1" },
827
+ "models": {
828
+ "qwen35-a3b-iq4xs": {
829
+ "limit": { "context": 262144, "output": 81920 }
830
+ }
831
+ }
832
+ }
833
+ }
834
+ }
835
+ ```
836
+
837
+ ---
838
+
839
+ ## Testing & Quality
840
+
841
+ ```bash
842
+ npm test # 271 tests across 24 test files
843
+ npm run build # TypeScript compilation
844
+ npm run lint # ESLint
845
+ npm run format # Prettier
846
+ ```
847
+
848
+ ### Test Coverage
849
+
850
+ | Area | Tests |
851
+ | -------------- | ------------------------------------------------------- |
852
+ | Deploy Batcher | 16 tests |
853
+ | Coordination | Multi-agent lifecycle |
854
+ | Tasks | CRUD, dependencies, claims |
855
+ | Models | Router, planner, validator |
856
+ | Memory | Write gate, daily log, corrections, maintenance, scoped |
857
+ | MCP Router | Filter, output compressor |
858
+ | Browser | Navigation, evaluate, content extraction |
859
+ | Droids | Parallel execution |
860
+
861
+ ---
862
+
863
+ ## Requirements
864
+
865
+ | Dependency | Version | Required | Purpose |
866
+ | ---------- | --------- | -------- | ----------------------- |
867
+ | Node.js | >= 18.0.0 | Yes | Runtime |
868
+ | git | Latest | Yes | Version control |
869
+ | Docker | Latest | No | Local Qdrant |
870
+ | Python 3 | Latest | No | Embeddings, Pattern RAG |
871
+
872
+ ---
873
+
874
+ ## Attribution
875
+
876
+ - Terminal-Bench patterns from [Terminal-Bench 2.0](https://github.com/aptx432/terminal-bench)
877
+ - Code Field prompts from [NeoVertex1/context-field](https://github.com/NeoVertex1/context-field)
878
+ - CloakBrowser from [CloakHQ/CloakBrowser](https://github.com/CloakHQ/CloakBrowser)
879
+
880
+ ---
881
+
882
+ <div align="center">
883
+
884
+ **[Documentation](docs/UAP_OVERVIEW.md)** | **[Issues](https://github.com/DammianMiller/universal-agent-protocol/issues)** | **[npm](https://www.npmjs.com/package/universal-agent-protocol)**
885
+
886
+ _Built for developers who want AI that learns._
887
+
888
+ </div>