@miller-tech/uap 1.39.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.
Files changed (99) hide show
  1. package/README.md +109 -642
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/bin/cli.js +2 -2
  4. package/dist/bin/cli.js.map +1 -1
  5. package/dist/cli/deliver.d.ts +3 -2
  6. package/dist/cli/deliver.d.ts.map +1 -1
  7. package/dist/cli/deliver.js +10 -5
  8. package/dist/cli/deliver.js.map +1 -1
  9. package/docs/INDEX.md +48 -286
  10. package/docs/architecture/OVERVIEW.md +328 -0
  11. package/docs/architecture/PROTOCOL.md +204 -0
  12. package/docs/benchmarks/README.md +17 -192
  13. package/docs/getting-started/CONFIGURATION.md +237 -0
  14. package/docs/getting-started/INSTALLATION.md +125 -0
  15. package/docs/getting-started/QUICKSTART.md +115 -0
  16. package/docs/guides/COORDINATION.md +162 -0
  17. package/docs/guides/DELIVER.md +115 -0
  18. package/docs/guides/DEPLOY_BATCHING.md +212 -0
  19. package/docs/guides/DROIDS_AND_SKILLS.md +202 -0
  20. package/docs/guides/LOCAL_MODELS.md +148 -0
  21. package/docs/guides/MCP_ROUTER.md +195 -0
  22. package/docs/guides/MEMORY.md +235 -0
  23. package/docs/guides/MULTI_MODEL.md +223 -0
  24. package/docs/guides/POLICIES.md +190 -0
  25. package/docs/guides/WORKTREE_WORKFLOW.md +185 -0
  26. package/docs/integrations/MCP_ROUTER.md +147 -0
  27. package/docs/integrations/RTK.md +102 -0
  28. package/docs/reference/API.md +485 -0
  29. package/docs/reference/CLI.md +719 -0
  30. package/docs/reference/CONFIGURATION.md +90 -193
  31. package/docs/reference/DATABASE_SCHEMA.md +110 -344
  32. package/docs/reference/FEATURES.md +176 -472
  33. package/docs/reference/PATTERNS.md +102 -0
  34. package/docs/reference/PLATFORMS.md +83 -0
  35. package/package.json +1 -1
  36. package/docs/AGENTS.md +0 -423
  37. package/docs/DOCUMENTATION_AUDIT_REPORT.md +0 -131
  38. package/docs/GETTING_STARTED.md +0 -288
  39. package/docs/PROJECT_ANALYSIS_REPORT.md +0 -510
  40. package/docs/architecture/COMPLETE_ARCHITECTURE.md +0 -748
  41. package/docs/architecture/EXPERT_STACK.md +0 -137
  42. package/docs/architecture/MULTI_MODEL.md +0 -224
  43. package/docs/architecture/PLATFORM_GATING.md +0 -68
  44. package/docs/architecture/SYSTEM_ANALYSIS.md +0 -334
  45. package/docs/architecture/UAP_COMPLIANCE.md +0 -217
  46. package/docs/architecture/UAP_PROTOCOL.md +0 -339
  47. package/docs/architecture/UAP_STRICT_DROIDS.md +0 -172
  48. package/docs/archive/BALLS_MODE_SELF_ANALYSIS.md +0 -260
  49. package/docs/archive/BENCHMARK_GAPS_AND_PLAN.md +0 -146
  50. package/docs/archive/FAILING_TASKS_SOLUTION_PLAN.md +0 -668
  51. package/docs/archive/JINJA2-SYSTEM-MESSAGE-FIX.md +0 -209
  52. package/docs/archive/MODEL_ROUTING_IMPLEMENTATION_SUMMARY.md +0 -281
  53. package/docs/archive/MODEL_ROUTING_OPTIMIZATION_PLAN.md +0 -320
  54. package/docs/archive/NPM-PUBLISH-V0.9.1.md +0 -240
  55. package/docs/archive/OPTIMIZATION_OPTIONS.md +0 -334
  56. package/docs/archive/PARALLELISM_GAPS_AND_OPTIONS.md +0 -422
  57. package/docs/archive/POLICY_GATE_IMPLEMENTATION.md +0 -245
  58. package/docs/archive/SETUP_IMPROVEMENTS.md +0 -213
  59. package/docs/archive/UAP_GENERIC_OPTIMIZATION_PLAN.md +0 -270
  60. package/docs/archive/UAP_OPTIMIZATION_PLAN.md +0 -701
  61. package/docs/archive/UAP_V103_PATTERN_DESIGN.md +0 -315
  62. package/docs/archive/UAP_V104_COMPLIANCE_DESIGN.md +0 -223
  63. package/docs/archive/changelog/2026-03-10_uap-100-compliance.md +0 -77
  64. package/docs/archive/changelog/2026-03-10_uap-full-system-verification.md +0 -109
  65. package/docs/archive/opencode-integration-guide.md +0 -740
  66. package/docs/archive/opencode-integration-quickref.md +0 -180
  67. package/docs/benchmarks/OVERNIGHT_RUNNER.md +0 -341
  68. package/docs/benchmarks/SPECULATIVE_DECODING_JOURNEY_2026-03.md +0 -221
  69. package/docs/benchmarks/VALIDATION_PLAN.md +0 -568
  70. package/docs/blog/SPECULATIVE_DECODING_PRODUCTION_PLAYBOOK.md +0 -139
  71. package/docs/blog/local-coding-agents.md +0 -266
  72. package/docs/blog/x-thread.md +0 -254
  73. package/docs/deployment/DEPLOYMENT.md +0 -895
  74. package/docs/deployment/DEPLOYMENT_STRATEGIES.md +0 -518
  75. package/docs/deployment/DEPLOY_BATCHER_ANALYSIS.md +0 -224
  76. package/docs/deployment/DEPLOY_BATCHING.md +0 -273
  77. package/docs/deployment/DEPLOY_BUCKETING_ANALYSIS.md +0 -420
  78. package/docs/deployment/QWEN35_LLAMA_CPP.md +0 -426
  79. package/docs/deployment/UAP_LLAMA_ANTHROPIC_PROXY_BOOTSTRAP.md +0 -279
  80. package/docs/getting-started/INTEGRATION.md +0 -628
  81. package/docs/getting-started/OVERVIEW.md +0 -324
  82. package/docs/getting-started/SETUP.md +0 -377
  83. package/docs/integrations/MCP_ROUTER_SETUP.md +0 -445
  84. package/docs/integrations/RTK_INTEGRATION.md +0 -468
  85. package/docs/operations/TROUBLESHOOTING.md +0 -660
  86. package/docs/pr/PR_SPECULATIVE_DOCS_TEMPLATE.md +0 -146
  87. package/docs/pr/UPSTREAM_PRS.md +0 -424
  88. package/docs/reference/API_REFERENCE.md +0 -903
  89. package/docs/reference/EXPERT_DROIDS.md +0 -219
  90. package/docs/reference/HARNESS-MATRIX.md +0 -318
  91. package/docs/reference/PATTERN_LIBRARY.md +0 -636
  92. package/docs/reference/UAP_CLI_REFERENCE.md +0 -620
  93. package/docs/research/BEHAVIORAL_PATTERNS.md +0 -228
  94. package/docs/research/DOMAIN_STRATEGIES.md +0 -316
  95. package/docs/research/MEMORY_SYSTEMS_COMPARISON.md +0 -812
  96. package/docs/research/PATTERN_ANALYSIS_2026-01-18.md +0 -436
  97. package/docs/research/PERFORMANCE_ANALYSIS_2026-01-18.md +0 -209
  98. package/docs/research/PERFORMANCE_TEST_PLAN.md +0 -383
  99. package/docs/research/TERMINAL_BENCH_LEARNINGS.md +0 -217
@@ -0,0 +1,102 @@
1
+ # Pattern Library Reference
2
+
3
+ > Universal Agent Protocol (UAP) v1.40.0
4
+
5
+ UAP ships an execution-pattern library: a set of reusable problem-solving
6
+ strategies that are matched to the current task and surfaced to the agent.
7
+ Patterns are defined as markdown files under `.factory/patterns/`, catalogued
8
+ in `.factory/patterns/index.json`, and retrieved on demand via a Qdrant-backed
9
+ RAG flow (`uap patterns query`).
10
+
11
+ ## The 23 Patterns
12
+
13
+ The canonical roster lives in `.factory/patterns/index.json`. Each pattern has
14
+ a numeric (or string) id, a markdown body file, a title, an abbreviation, a
15
+ category, and a keyword set used for retrieval.
16
+
17
+ | ID | Title | Abbreviation | Category | What it does |
18
+ |----|-------|--------------|----------|--------------|
19
+ | P12 | Output Existence Verification | OE-Verify | Verification | Confirm the artifact a task was supposed to produce actually exists before claiming done. **Always enforced.** |
20
+ | P13 | Iterative Refinement Loop | Iter-Ref | Testing | Run tests, fix, and re-run in a loop until they pass. |
21
+ | P14 | Output Format Validation | Format-Check | Verification | Validate that produced output matches the required format (JSON/YAML/CSV). |
22
+ | P16 | Task-First Execution | Task-First | Execution | When the task is clear, execute directly instead of over-planning. |
23
+ | P17 | Constraint Extraction | Extract-Constraints | Planning | Pull hard constraints ("exactly", "only", "no more than") out of the prompt before acting. |
24
+ | P19 | Impossible Task Refusal | Refuse-Impossible | Safety | Detect and refuse tasks that are fundamentally impossible. |
25
+ | P20 | Adversarial Thinking | Adversarial | Security | Reason about how something could be bypassed/exploited/evaded. |
26
+ | P21 | Chess Engine Integration | Chess-Engine | Domain-Specific | Delegate chess reasoning (FEN, best move, checkmate) to an engine. |
27
+ | P22 | Git Recovery Forensics | Git-Recovery | Recovery | Recover lost/corrupted git state via reflog and forensic inspection. |
28
+ | P23 | Compression Impossibility Detection | Compress-Check | Verification | Detect already-compressed data so re-compression isn't attempted. |
29
+ | P24 | Polyglot Code Construction | Polyglot | Code-Golf | Construct source that compiles/runs as multiple languages. |
30
+ | P25 | Service Configuration Pipeline | Service-Config | DevOps | Configure, validate, and reload a service/daemon as a pipeline. |
31
+ | P26 | Near-Miss Iteration | Near-Miss | Testing | When a test result is a small gap away, tweak and re-check. |
32
+ | P28 | Service Smoke Test | Smoke-Test | Verification | After deploy/start, run a health check / smoke test to verify. |
33
+ | P30 | Performance Threshold Tuning | Perf-Threshold | Optimization | Measure performance and tune against a percentage/threshold target. |
34
+ | P31 | Round-Trip Verification | Round-Trip | Verification | Encode then decode (or compress/decompress) and verify the round trip. |
35
+ | P32 | CLI Execution Verification | CLI-Verify | Verification | Verify a CLI/binary actually runs as expected. |
36
+ | P33 | Numerical Stability Testing | Num-Stable | Testing | Test floating-point/numerical work for precision and stability. |
37
+ | P34 | Image-to-Structured Pipeline | Image-Structured | Domain-Specific | Convert images (OCR/diagram/board) into structured data. |
38
+ | P35 | Decoder-First Analysis | Decoder-First | Analysis | Build/understand the decoder/parser first when reverse-engineering a format. **Always enforced.** |
39
+ | P36 | Competition Domain Research | Competition-Research | Research | Research the competitive domain (win rate, leaderboard, tournament) before optimizing. |
40
+ | P37 | Ambiguity Detection & Resolution | Ambiguity-Detect | Planning | Detect vague/unspecified requirements and clarify before acting. |
41
+ | IaC | Infrastructure as Code Parity | IaC-Parity | Infrastructure | Keep infrastructure changes reflected in IaC (terraform/kubernetes) for reproducibility. |
42
+
43
+ ### Always-on patterns
44
+
45
+ Two patterns are unconditionally included regardless of the matched task, set
46
+ in `src/coordination/pattern-router.ts`:
47
+
48
+ ```js
49
+ const alwaysIncludeIds = ['P12', 'P35']; // Output Existence, Decoder-First
50
+ ```
51
+
52
+ - **P12 (Output Existence Verification)** — guards against "claiming done"
53
+ without producing the artifact.
54
+ - **P35 (Decoder-First Analysis)** — anchors format/reverse-engineering work.
55
+
56
+ ## How pattern RAG works
57
+
58
+ Pattern retrieval is semantic, not keyword-based. The flow:
59
+
60
+ 1. **Indexing** (`uap patterns index`) runs a generated Python indexer
61
+ (`agents/scripts/index_patterns_to_qdrant.py`). It scans multiple sources —
62
+ `CLAUDE.md` (with `@include` resolution), additional source files
63
+ (`AGENTS.md`, etc.), `*/SKILL.md` skill files, and `.factory/patterns/*.md`
64
+ (using `index.json` to preserve the canonical `PNN: Title` identity and
65
+ keyword set). Documents are de-duplicated by content hash, embedded, and
66
+ upserted into the Qdrant collection.
67
+ 2. **Querying** (`uap patterns query "<task>"`) runs the generated query script
68
+ (`agents/scripts/query_patterns.py`), embeds the query with the same model,
69
+ and runs a cosine `query_points` search against the collection, returning the
70
+ top-K hits above the score threshold.
71
+ 3. **Fallback** — if the Python query script is absent, the CLI falls back to a
72
+ direct Qdrant `scroll` + keyword match (less accurate) and prints a notice.
73
+
74
+ ### RAG defaults
75
+
76
+ From `src/cli/patterns.ts` (`getPatternRagConfig`), overridable via
77
+ `.uap.json` under `memory.patternRag`:
78
+
79
+ | Setting | Default |
80
+ |---------|---------|
81
+ | Collection | `agent_patterns` |
82
+ | Embedding model | `all-MiniLM-L6-v2` |
83
+ | Vector size | `384` (Cosine distance) |
84
+ | Score threshold | `0.35` |
85
+ | Top-K | `2` |
86
+ | Index script | `./agents/scripts/index_patterns_to_qdrant.py` |
87
+ | Query script | `./agents/scripts/query_patterns.py` |
88
+ | Source file | `CLAUDE.md` |
89
+ | Max body chars | `400` (display); indexer truncates bodies at 2000 |
90
+
91
+ The query script requires a Python with `sentence-transformers` and
92
+ `qdrant-client`. The CLI auto-discovers `agents/.venv/bin/python`,
93
+ `.venv/bin/python`, then `python3`/`python`, and can bootstrap a venv.
94
+
95
+ ## `uap patterns` CLI
96
+
97
+ | Command | Description |
98
+ |---------|-------------|
99
+ | `uap patterns status` | Show RAG config, Qdrant collection point count, Python/script availability. |
100
+ | `uap patterns index` | (Re)index pattern/doc sources into the Qdrant collection. `--verbose` for full output. |
101
+ | `uap patterns query "<task>"` | Semantic search for task-relevant patterns. Flags: `--top <n>`, `--min-score <f>`, `--format text\|json`. |
102
+ | `uap patterns generate` | Generate the Python index/query scripts. `--force` to overwrite. |
@@ -0,0 +1,83 @@
1
+ # Platform & Harness Reference
2
+
3
+ > Universal Agent Protocol (UAP) v1.40.0
4
+
5
+ UAP integrates with 9 agent harnesses. The canonical list is `ALL_TARGETS` in
6
+ `src/cli/hooks.ts`. Every platform receives the UAP enforcement layer: lifecycle
7
+ hooks, the DB-driven policy gate, and (where supported) the hierarchical MCP
8
+ router.
9
+
10
+ ## Supported platforms
11
+
12
+ | Target flag | Platform | Config location | Integration style |
13
+ |-------------|----------|-----------------|-------------------|
14
+ | `claude` | Claude Code | `.claude/settings.local.json` + `.claude/hooks/` | Native hook events |
15
+ | `factory` | Factory.AI Droid | `.factory/settings.local.json` + `.factory/hooks/` | Native hook events (`$FACTORY_PROJECT_DIR`) |
16
+ | `cursor` | Cursor | `.cursor/hooks.json` + `.cursor/hooks/` | Native hook events |
17
+ | `vscode` | VSCode | `.claude/settings.local.json` + `.claude/hooks/` | Claude Code hook format (via third-party skills) |
18
+ | `opencode` | OpenCode | `.opencode/plugin/uap-session-hooks.ts` + `.opencode/hooks/` | TypeScript plugin |
19
+ | `codex` | Codex CLI | `AGENTS.md`, `.codex/config.toml`, `.codex/hooks/`, `.agents/skills/` | AGENTS.md + skills + MCP server |
20
+ | `forgecode` | ForgeCode | `.forge/forgecode.plugin.sh` + `.forge/hooks/` | ZSH plugin |
21
+ | `omp` | Oh-My-Pi | `.uap/omp/settings.json` + `.uap/omp/hooks/{pre,post}/` | omp pre/post hook dirs |
22
+ | `hermes` | Hermes Agent (NousResearch) | `~/.hermes/config.yaml` + `~/.hermes/agent-hooks/` | **Global** YAML config + MCP |
23
+
24
+ > **Hermes is global.** Its config lives under `~/.hermes` (or `$HERMES_HOME`),
25
+ > so it is excluded from the default project install loop (`PROJECT_TARGETS`).
26
+ > Installing it requires an explicit `-t hermes`. `status`/`doctor` still report it.
27
+
28
+ ## Support matrix
29
+
30
+ | Platform | Lifecycle hooks | Worktree/Bash guards | Policy gate | MCP router |
31
+ |----------|-----------------|----------------------|-------------|------------|
32
+ | Claude Code | Native | Yes | Hard (PreToolUse) | Yes |
33
+ | Factory.AI | Native | Yes | Hard (PreToolUse) | Yes |
34
+ | Cursor | Native | Yes | Hard (preToolUse) | Yes |
35
+ | VSCode | Native (Claude format) | Yes | Hard (PreToolUse) | Yes |
36
+ | OpenCode | Plugin events | Yes | Hard (`tool.execute.before` → exit 2 blocks) | Yes |
37
+ | Codex CLI | Advisory (no native pre-tool event) | Advisory | Hard for MCP-routed tools; advisory for native edit/bash | Yes (`[mcp_servers.uap]`) |
38
+ | ForgeCode | ZSH plugin | Yes (scripts) | Via gate script | — |
39
+ | Oh-My-Pi | pre/post dirs | Yes | Yes (`uap-policy-gate.sh`) | — |
40
+ | Hermes | `pre_tool_call` / `on_session_start` | `pre_tool_call` matcher | Hard via `uap-policy-gate-hermes.sh` (emits block JSON) | Yes (`mcp_servers.uap`) |
41
+
42
+ > **Gating notes.** Codex CLI has no native pre-tool-use hook event, so policy
43
+ > gating is **hard** only for tools routed through the UAP MCP server
44
+ > (`execute_tool` runs the PolicyGate) and **advisory** for Codex-native
45
+ > edit/bash. `uap hooks doctor` reports Codex as MCP-gated. Hermes hooks are
46
+ > fail-open by design, but the UAP gate always emits a decision JSON so real
47
+ > blocks are enforced; Hermes prompts once to approve each hook command
48
+ > (`~/.hermes/shell-hooks-allowlist.json`) unless `hooks_auto_accept: true`.
49
+
50
+ ## Lifecycle hooks installed
51
+
52
+ The shared hook scripts (copied from `templates/hooks/`) are wired into each
53
+ platform's lifecycle events:
54
+
55
+ | Script | Event | Purpose |
56
+ |--------|-------|---------|
57
+ | `session-start.sh` | SessionStart | Injects recent memory context. |
58
+ | `pre-tool-use-edit-write.sh` | PreToolUse (Edit/Write/MultiEdit) | Worktree file guard — **blocks** edits outside worktree dirs. |
59
+ | `pre-tool-use-bash.sh` | PreToolUse (Bash) | Dangerous-command guard — **blocks** force push, `terraform apply`, etc. |
60
+ | `uap-policy-gate.sh` | PreToolUse | DB-driven policy gate (`policies.db` + `.policy-tools/*.py`). |
61
+ | `post-tool-use-edit-write.sh` | PostToolUse (Edit/Write) | Build gate + backup reminder after edits. |
62
+ | `pre-compact.sh` | PreCompact | Flushes a compaction marker to memory. |
63
+ | `post-compact.sh` | PostCompact | Re-injects policy awareness after compaction. |
64
+ | `stop.sh` | Stop | Completion-gate checklist + session cleanup. |
65
+ | `session-end.sh` | SessionEnd | Agent deregistration + backup retention. |
66
+ | `loop-protection.sh` | — | Loop/spawn protection. |
67
+
68
+ ## Install & verify
69
+
70
+ ```bash
71
+ uap hooks install # install for all PROJECT_TARGETS (excludes hermes)
72
+ uap hooks install -t claude # install for a single platform
73
+ uap hooks install -t hermes # required to install the global Hermes config
74
+ uap hooks status # per-platform script + settings status (all targets)
75
+ uap hooks doctor # health check across all targets
76
+ ```
77
+
78
+ The MCP router is configured separately and across all harnesses with:
79
+
80
+ ```bash
81
+ uap mcp-setup # configure the hierarchical MCP router everywhere
82
+ uap mcp-router start # run the stdio MCP router server
83
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miller-tech/uap",
3
- "version": "1.39.0",
3
+ "version": "1.40.1",
4
4
  "description": "Autonomous AI agent memory system with CLAUDE.md protocol enforcement",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/docs/AGENTS.md DELETED
@@ -1,423 +0,0 @@
1
- # UAP Project Code Analysis and Documentation Audit Report
2
-
3
- ## Executive Summary
4
-
5
- The Universal Agent Protocol (UAP) is a comprehensive AI agent framework with extensive functionality for persistent memory, multi-agent coordination, pattern-based workflows, and policy enforcement. The project contains approximately 143 TypeScript source files, 74 test files, and over 90,000 total files (including benchmark results and agent sessions).
6
-
7
- ## Documentation Quality Assessment
8
-
9
- ### Current State: GOOD TO VERY GOOD
10
-
11
- **Strengths:**
12
-
13
- - Comprehensive README.md (542 lines) with feature overview, CLI reference, and architecture diagrams
14
- - Extensive CLI reference documentation (620 lines in UAP_CLI_REFERENCE.md)
15
- - Architecture documentation covering system design and components
16
- - Benchmark results and validation plans documented
17
- - Integration guides for multiple platforms (Claude, Factory, OpenCode, etc.)
18
-
19
- **Well-documented:**
20
-
21
- - Hierarchical memory (Hot/Warm/Cold tiers)
22
- - Embedding service with multiple providers
23
- - Knowledge graph implementation
24
- - Semantic compression
25
- - Write gate quality filtering
26
- - Daily log staging area
27
-
28
- **Under-documented:**
29
-
30
- - Predictive memory service
31
- - Context pruner (token-budget-aware)
32
- - Ambiguity detector (P37 pattern)
33
- - Prepopulation from docs/git history
34
- - Memory maintenance routines
35
- - Correction propagator for cross-tier updates
36
-
37
- ### 2. Multi-Agent Coordination (8 modules)
38
-
39
- **Well-documented:**
40
-
41
- - Coordination service and database
42
- - Agent lifecycle management
43
- - Work claims and announcements
44
- - Messaging system with channels
45
- - Deploy batching with configurable windows
46
-
47
- **Under-documented:**
48
-
49
- - Capability router (18 capability types)
50
- - Auto-agent registration
51
- - Pattern router implementation
52
- - Adaptive patterns with success tracking
53
-
54
- ### 3. Policy Enforcement (8 modules)
55
-
56
- **Well-documented:**
57
-
58
- - Policy schema and database manager
59
- - Policy memory CRUD operations
60
- - Enforcement levels (REQUIRED/RECOMMENDED/OPTIONAL)
61
- - Audit trail functionality
62
-
63
- **Under-documented:**
64
-
65
- - Policy gate middleware implementation
66
- - Enforced tool router
67
- - Python enforcement tools
68
- - Policy converter to CLAUDE.md format
69
-
70
- ### 4. Pattern System (23+ patterns)
71
-
72
- **Well-documented:**
73
-
74
- - Pattern list with descriptions
75
- - Critical patterns (P12, P35) always active
76
- - Pattern RAG management
77
-
78
- **Under-documented:**
79
-
80
- - Pattern matching algorithm
81
- - Pattern library storage format
82
- - Pattern success tracking metrics
83
- - Custom pattern creation guide
84
-
85
- ### 5. Worktree System
86
-
87
- **Well-documented:**
88
-
89
- - CLI commands (create, list, pr, cleanup, finish)
90
- - Git workflow integration
91
- - Exempt paths documentation
92
-
93
- **Under-documented:**
94
-
95
- - Worktree file guard enforcement mechanism
96
- - Branch naming conventions
97
- - Conflict resolution strategies
98
- - Prune functionality details
99
-
100
- ### 6. Hooks System
101
-
102
- **Well-documented:**
103
-
104
- - Session start hook (5 steps)
105
- - Pre-compact hook (4 steps)
106
- - Platform-specific installations
107
- - Hook status checking
108
-
109
- **Under-documented:**
110
-
111
- - Pre-tool-use hooks (mentioned but not detailed)
112
- - Post-tool-use hooks
113
- - Custom hook creation guide
114
- - Hook failure recovery
115
-
116
- ### 7. MCP Router
117
-
118
- **Well-documented:**
119
-
120
- - 98% token reduction claim
121
- - Meta-tool routing concept
122
- - Config parser and fuzzy search
123
-
124
- **Under-documented:**
125
-
126
- - Client pool management
127
- - Output compression algorithm
128
- - Session statistics tracking
129
- - Tool discover/execute definitions
130
-
131
- ### 8. Multi-Model Architecture
132
-
133
- **Well-documented:**
134
-
135
- - 3-tier execution model
136
- - 13 model profiles
137
- - Dynamic temperature and rate limiting
138
- - Model analytics
139
-
140
- **Under-documented:**
141
-
142
- - Task planner decomposition algorithm
143
- - Plan validator cycle detection
144
- - Unified router logic
145
- - Execution profile loading
146
-
147
- ### 9. Browser Automation
148
-
149
- **Well-documented:**
150
-
151
- - CloakBrowser integration
152
- - Playwright drop-in compatibility
153
- - Basic usage example
154
-
155
- **Under-documented:**
156
-
157
- - Stealth techniques
158
- - Humanize mode details
159
- - Error handling
160
- - Performance characteristics
161
-
162
- ### 10. Task Management
163
-
164
- **Well-documented:**
165
-
166
- - Task types and statuses
167
- - Priority levels (P0-P4)
168
- - Dependencies and claims
169
- - JSONL sync format
170
-
171
- **Under-documented:**
172
-
173
- - Event bus implementation
174
- - Decoder gate mechanism
175
- - Task classifier (9 categories)
176
- - Compaction/archive logic
177
-
178
- ### 11. Droids & Skills
179
-
180
- **Well-documented:**
181
-
182
- - 8 expert droids listed
183
- - 33 skills categorized
184
- - Skill documentation command
185
-
186
- **Under-documented:**
187
-
188
- - Droid creation process
189
- - Skill loading mechanism
190
- - Custom droid development
191
- - Skill composition patterns
192
-
193
- ## Documentation Gaps by Priority
194
-
195
- ### CRITICAL (Must-Have)
196
-
197
- 1. **Inline JSDoc for Public APIs**
198
- - Missing from src/index.ts exports (340 lines of exports)
199
- - Affects: Memory system, coordination, policies, models, MCP router
200
- - Impact: Breaks IDE autocomplete and API documentation generation
201
-
202
- 2. **CLI Command Completeness**
203
- - Dashboard has 11 views but only partially documented
204
- - Model commands (8 subcommands) under-documented
205
- - Policy commands (15 subcommands) need examples
206
- - Worktree finish command behavior not explained
207
-
208
- 3. **Configuration Schema Documentation**
209
- - .uap.json schema incomplete
210
- - Missing validation rules
211
- - Environment variables not fully listed
212
-
213
- 4. **Database Schema Accuracy**
214
- - API_REFERENCE.md shows outdated table structures
215
- - Missing tables: deploy_queue, pattern_index, task_events
216
- - Qdrant collection schemas not documented
217
-
218
- 5. **Hook System Implementation Details**
219
- - Pre-edit build gate enforcement mechanism
220
- - Worktree file guard blocking logic
221
- - Completion gate verification steps
222
-
223
- ### HIGH PRIORITY (Should-Have)
224
-
225
- 6. **Memory System Architecture Diagram**
226
- - Current diagram has placeholder text
227
- - 4-layer architecture needs visual representation
228
- - Data flow between tiers unclear
229
-
230
- 7. **Pattern Library Reference**
231
- - All 23+ patterns need detailed descriptions
232
- - Pattern selection criteria missing
233
- - Pattern composition examples
234
-
235
- 8. **Multi-Agent Coordination Flow**
236
- - Heartbeat mechanism details
237
- - Overlap detection algorithm
238
- - Message priority handling
239
- - Deadlock prevention
240
-
241
- 9. **Policy Enforcement Workflow**
242
- - Policy evaluation order
243
- - Violation handling procedures
244
- - Audit trail query examples
245
-
246
- 10. **Testing and Quality Gates**
247
- - Test coverage requirements (50% threshold)
248
- - Build gate enforcement
249
- - Completion gate verification steps
250
-
251
- ### MEDIUM PRIORITY (Nice-to-Have)
252
-
253
- 11. **Benchmark Methodology**
254
- - Terminal-Bench adapter details
255
- - Harbor integration workflow
256
- - A/B comparison methodology
257
-
258
- 12. **Deployment Guides**
259
- - Production Qdrant setup
260
- - CI/CD pipeline configuration
261
- - Horizontal scaling patterns
262
-
263
- 13. **Troubleshooting Matrix**
264
- - Error code reference
265
- - Common failure modes
266
- - Recovery procedures
267
-
268
- 14. **Integration Patterns**
269
- - RTK token compression details
270
- - Platform-specific optimizations
271
- - Custom adapter development
272
-
273
- 15. **Performance Optimization Guide**
274
- - Token budget management
275
- - Cache warm strategies
276
- - Memory pruning thresholds
277
-
278
- ## Specific Recommendations
279
-
280
- ### Immediate Actions (Week 1-2)
281
-
282
- 1. **Add JSDoc to src/index.ts**
283
-
284
- ```typescript
285
- /**
286
- * Hierarchical memory manager with hot/warm/cold tiering
287
- * @see src/memory/hierarchical-memory.ts for implementation details
288
- */
289
- export { HierarchicalMemoryManager } from './memory/hierarchical-memory.js';
290
- - Replace placeholder text in docs/INDEX.md
291
- - Create Mermaid diagrams for memory flow
292
- - Document data persistence layers
293
-
294
- ```
295
-
296
- 2. **Complete CLI Reference**
297
- - Add all 109 commands with examples
298
- - Include exit codes and error messages
299
- - Document shell completion setup
300
-
301
- 3. **Fix Version Mismatch**
302
- - Update INDEX.md to v1.20.32
303
- - Ensure CHANGELOG.md is current
304
- - Sync README version numbers
305
-
306
- 4. **Document Database Schemas**
307
- - Update API_REFERENCE.md with actual tables
308
- - Add Qdrant collection schemas
309
- - Include migration guides
310
-
311
- ### Short-Term Actions (Week 3-4)
312
-
313
- 6. **Create Module-Level Documentation**
314
- - Add README.md to each src/ subdirectory
315
- - Document module responsibilities and dependencies
316
- - Include usage examples
317
-
318
- 7. **Build Pattern Library Reference**
319
- - Document all 23+ patterns with use cases
320
- - Add pattern selection decision tree
321
- - Create pattern composition examples
322
-
323
- 8. **Enhance Hook Documentation**
324
- - Document all hook types (pre/post tool-use)
325
- - Add hook failure recovery guide
326
- - Include custom hook templates
327
-
328
- 9. **Complete Configuration Guide**
329
- - Full .uap.json schema with validation
330
- - Environment variable reference
331
- - Platform-specific configs
332
-
333
- 10. **Add Testing Documentation**
334
- - Test coverage requirements
335
- - Build gate enforcement
336
- - Completion gate checklist
337
-
338
- ### Long-Term Actions (Month 2+)
339
-
340
- 11. **Generate API Documentation**
341
- - Use TypeDoc for TypeScript APIs
342
- - Integrate with GitHub Pages
343
- - Keep in sync with code changes
344
-
345
- 12. **Create Video Tutorials**
346
- - Quick start walkthrough
347
- - Advanced feature demonstrations
348
- - Troubleshooting guides
349
-
350
- 13. **Develop Interactive Examples**
351
- - Code sandbox for CLI commands
352
- - Memory system visualization
353
- - Multi-agent simulation
354
-
355
- 14. **Establish Documentation Review Process**
356
- - Require docs updates with PRs
357
- - Add docs linting to CI
358
- - Schedule quarterly reviews
359
-
360
- 15. **Create Contribution Guide**
361
- - Documentation standards
362
- - Template examples
363
- - Review process
364
-
365
- ## Proposed Documentation Structure
366
-
367
- ### Current Structure (Adequate)
368
-
369
- ```
370
- docs/
371
- ├── getting-started/ ✓ Good coverage
372
- ├── architecture/ ⚠ Needs updates
373
- ├── reference/ ✓ CLI ref good, API ref outdated
374
- ├── deployment/ ⚠ Incomplete
375
- ├── benchmarks/ ✓ Comprehensive
376
- ├── operations/ ⚠ Minimal
377
- ├── integrations/ ✓ Good coverage
378
- ├── research/ ⚠ Academic focus
379
- └── archive/ ℹ Historical reference
380
- ```
381
-
382
- ### Proposed Enhanced Structure:
383
-
384
- -74 test files covering major components
385
-
386
- - Tests for: policies, memory, coordination, models, benchmarks, CLI
387
- - Vitest configuration with coverage thresholds (50%)
388
-
389
- ### Gaps
390
-
391
- 1. **Browser module** - Minimal test coverage
392
- 2. **MCP router** - Only output-compressor tested
393
- 3. **Dashboard** - Server and event-stream not tested
394
- 4. **Telemetry** - Session telemetry untested
395
- 5. **Benchmarks** - Agent implementations not tested
396
-
397
- ### Recommendations
398
-
399
- 1. Add JSDoc to test files for clarity
400
- 2. Create integration test suite
401
- 3. Document test coverage requirements
402
- 4. Add performance test benchmarks
403
-
404
- ## Conclusion
405
-
406
- The UAP project has **solid foundational documentation** with comprehensive CLI references and good architectural overviews. However, there are significant gaps in:
407
-
408
- 1. code documentation (JSDoc)
409
- 2. Module-level documentation for internal components
410
- 3. Accurate database schemas
411
- 4. Configuration schema completeness
412
- 5. Hook system implementation details
413
-
414
- **Priority Ranking:**
415
-
416
- - **Must-Have**: JSDoc, CLI completeness, config schema, DB schemas, hook docs
417
- - Architecture diagrams, pattern library, coordination flows, policy workflows, testing docs
418
- - **Nice-to-Have**: Video tutorials, interactive examples, contribution guide, API generation
419
- - Critical fixes: 2-3 weeks
420
- - High priority: 4-6 weeks
421
- - Medium priority: 8-12 weeks
422
-
423
- The documentation quality is sufficient for current users but needs improvement to support new contributors and maintain long-term project health.