opencode-agent-skill 13.0.0-beta.2 → 14.2.0-beta.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 (93) hide show
  1. package/README.md +1556 -607
  2. package/bin/ocskill.mjs +172 -24
  3. package/docs/OPENCODE-COMPAT.md +34 -97
  4. package/docs/PI-COMPAT.md +188 -0
  5. package/docs/V14-CONTEXT-MEMORY-FABRIC.md +70 -0
  6. package/docs/V14.1-QUALITY-PERFORMANCE-FABRIC.md +114 -0
  7. package/docs/V14.2-TURBO-WEAK-MODEL-RUNTIME.md +448 -0
  8. package/evals/v14/tasks.json +46 -0
  9. package/global-config/agents/executor.md +7 -0
  10. package/global-config/agents/visual-verifier.md +22 -3
  11. package/global-config/plugins/ues-router/index.js +13 -8
  12. package/global-config/plugins/ues-router/policy-runtime.js +7 -0
  13. package/global-config/plugins/ues-router/router.js +12 -2
  14. package/global-config/skills/ecommerce-engineering/SKILL.md +1 -1
  15. package/global-config/skills/file-upload-engineering/SKILL.md +1 -1
  16. package/global-config/skills/git-safety/SKILL.md +1 -1
  17. package/global-config/skills/nestjs-engineering/SKILL.md +1 -1
  18. package/global-config/skills/performance-engineering/SKILL.md +1 -1
  19. package/global-config/skills/react-native-engineering/SKILL.md +1 -1
  20. package/global-config/skills/rest-api-design/SKILL.md +1 -1
  21. package/global-config/skills/ui-ux-engineering/SKILL.md +1 -1
  22. package/lib/adaptive-context-budget.mjs +97 -0
  23. package/lib/affected-tests.mjs +260 -0
  24. package/lib/benchmark-confidence.mjs +41 -2
  25. package/lib/browser-mcp-routing.mjs +166 -0
  26. package/lib/capability-fabric.mjs +336 -0
  27. package/lib/capability-registry.mjs +9 -0
  28. package/lib/context-engine-v11.mjs +65 -1
  29. package/lib/context-graph-rank.mjs +118 -0
  30. package/lib/context-manifest.mjs +97 -18
  31. package/lib/control-center.mjs +19 -1
  32. package/lib/dynamic-workflow.mjs +3 -1
  33. package/lib/evidence-store.mjs +82 -1
  34. package/lib/hierarchical-context.mjs +215 -0
  35. package/lib/memory-engine.mjs +465 -0
  36. package/lib/model-performance.mjs +33 -8
  37. package/lib/model-policy.mjs +3 -3
  38. package/lib/orchestrator-policy.mjs +5 -209
  39. package/lib/performance-fabric.mjs +229 -0
  40. package/lib/pi-rpc-pool.mjs +433 -0
  41. package/lib/process-hang-detector.mjs +83 -0
  42. package/lib/process-supervisor.mjs +193 -0
  43. package/lib/prompt-cache.mjs +2 -0
  44. package/lib/repo-graph.mjs +53 -2
  45. package/lib/runtime-config.mjs +31 -0
  46. package/lib/safety.mjs +132 -0
  47. package/lib/semantic-index.mjs +52 -3
  48. package/lib/skill-compiler.mjs +128 -0
  49. package/lib/skill-quality.mjs +48 -2
  50. package/lib/task-engine.mjs +66 -5
  51. package/lib/task-policy.mjs +235 -0
  52. package/lib/verification-broker.mjs +284 -0
  53. package/lib/verification-command.mjs +111 -0
  54. package/lib/windows-shim.mjs +35 -0
  55. package/lib/workspace-fingerprint.mjs +198 -0
  56. package/package.json +52 -42
  57. package/pi/extensions/ues-child-runtime.ts +238 -0
  58. package/pi/extensions/ues.ts +3200 -0
  59. package/pi/prompts/ues-audit.md +9 -0
  60. package/pi/prompts/ues-critique.md +9 -0
  61. package/pi/prompts/ues-debug.md +9 -0
  62. package/pi/prompts/ues-feature.md +9 -0
  63. package/pi/prompts/ues-fix.md +9 -0
  64. package/pi/prompts/ues-plan.md +9 -0
  65. package/pi/prompts/ues-research.md +9 -0
  66. package/pi/prompts/ues-resume.md +9 -0
  67. package/pi/prompts/ues-review.md +7 -0
  68. package/pi/prompts/ues-run.md +17 -0
  69. package/pi/prompts/ues-verify.md +9 -0
  70. package/scripts/check-release-consistency.mjs +119 -185
  71. package/scripts/check-runtime-exports.mjs +66 -0
  72. package/scripts/check-source-integrity.mjs +184 -0
  73. package/scripts/eval-pi.mjs +492 -0
  74. package/scripts/install.mjs +16 -0
  75. package/scripts/smoke-package-closure.mjs +110 -0
  76. package/scripts/smoke-packed-install.mjs +24 -11
  77. package/scripts/smoke-pi-extension.mjs +144 -0
  78. package/scripts/uninstall.mjs +44 -0
  79. package/CHANGELOG.md +0 -415
  80. package/docs/DETERMINISTIC-TOOLS.md +0 -105
  81. package/docs/ENGINEERING-DESIGN.md +0 -194
  82. package/docs/EVALS.md +0 -158
  83. package/docs/GITHUB-RULESET.md +0 -50
  84. package/docs/NPM-PUBLISH.md +0 -116
  85. package/docs/RESEARCH-SOURCES.md +0 -37
  86. package/docs/TRACE-SCHEMA.md +0 -122
  87. package/docs/V11-PERCEPTION-ADAPTIVE-EXECUTION.md +0 -75
  88. package/docs/V11-PERCEPTION-ADAPTIVE.md +0 -220
  89. package/docs/V12-WEAK-MODEL-INTELLIGENCE.md +0 -27
  90. package/docs/V13-PARALLEL-WEAK-MODEL-RUNTIME.md +0 -86
  91. package/docs/V7-INTELLIGENCE-RUNTIME.md +0 -166
  92. package/docs/V8-INTELLIGENCE-RELIABILITY.md +0 -206
  93. package/docs/V9-SPEED-INTELLIGENCE.md +0 -102
package/README.md CHANGED
@@ -1,849 +1,1798 @@
1
- # OpenCode Universal Engineering System (UES)
1
+ # UES for Pi Agent
2
2
 
3
- > **V13 beta: 13.0.0-beta.2** — parallel weak-model runtime với same-model worker pool, event-driven DAG, transactional worktree integration và hardened CLI/Windows runtime.
4
- > **Stable latest vẫn là V11: 11.0.0.** V13 được đóng gói dưới prerelease `13.0.0-beta.2`; npm prerelease dùng dist-tag `next`, còn `latest` tiếp tục giữ V11 cho đến khi V13 được promote stable.
3
+ > Universal Engineering System (UES) là một engineering runtime dành cho **Pi Agent**, tập trung vào việc giúp model coding nhỏ/yếu làm việc có cấu trúc hơn trên repository thật: lấy đúng context, chia task, giữ trạng thái dài hạn, cô lập thay đổi, thu evidence và chỉ kết luận khi có verification.
5
4
 
6
- [![npm version](https://img.shields.io/npm/v/opencode-agent-skill.svg)](https://www.npmjs.com/package/opencode-agent-skill)
7
- [![license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
5
+ **Package:** <code>opencode-agent-skill</code>
6
+ **Host chính:** Pi Agent
7
+ **Phiên bản package hiện tại:** <code>14.2.0-beta.1</code>
8
+ **Nhánh phát triển hiện tại:** V14.2 Turbo Weak-Model Runtime
9
+ **Runtime:** Node.js 22.19+
10
+ **License:** MIT
8
11
 
9
- ## Giới thiệu
12
+ > UES không biến một model nhỏ thành model lớn theo nghĩa năng lực nền tảng. UES cố gắng giảm phần suy luận hạ tầng mà model phải tự gánh bằng deterministic tooling, bounded context, specialist roles, durable state và evidence-gated verification.
10
13
 
11
- **OpenCode Universal Engineering System (UES)** là một engineering harness dành cho OpenCode. UES không thay đổi năng lực nền tảng của model, mà tổ chức cách model làm việc để:
14
+ ---
15
+
16
+ ## Mục lục
17
+
18
+ 1. [UES giải quyết vấn đề gì?](#ues-giải-quyết-vấn-đề-gì)
19
+ 2. [Kiến trúc tổng thể](#kiến-trúc-tổng-thể)
20
+ 3. [Luồng /ues-run end-to-end](#luồng-ues-run-end-to-end)
21
+ 4. [Task Policy: FAST / STANDARD / DEEP](#task-policy-fast--standard--deep)
22
+ 5. [12 specialist agents](#12-specialist-agents)
23
+ 6. [48 skills](#48-skills)
24
+ 7. [11 slash prompts](#11-slash-prompts)
25
+ 8. [Context Engine L0/L1/L2](#context-engine-l0l1l2)
26
+ 9. [Semantic index, repo graph và ACI](#semantic-index-repo-graph-và-aci)
27
+ 10. [Model routing và recovery](#model-routing-và-recovery)
28
+ 11. [Task graph, Dynamic Workflow và parallel runtime](#task-graph-dynamic-workflow-và-parallel-runtime)
29
+ 12. [Worktree sandbox](#worktree-sandbox)
30
+ 13. [Evidence Store, receipts và verification gates](#evidence-store-receipts-và-verification-gates)
31
+ 14. [V14.1 reversible output compaction](#v141-reversible-output-compaction)
32
+ 15. [V14.2 Turbo Weak-Model Runtime](#v142-turbo-weak-model-runtime)
33
+ 16. [Verified Persistent Memory](#verified-persistent-memory)
34
+ 17. [Capability Fabric](#capability-fabric)
35
+ 18. [Playwright / Browser MCP on-demand](#playwright--browser-mcp-on-demand)
36
+ 19. [Trajectory và observability](#trajectory-và-observability)
37
+ 20. [Learning engine và benchmark confidence](#learning-engine-và-benchmark-confidence)
38
+ 21. [Durable long-horizon work](#durable-long-horizon-work)
39
+ 22. [Control Center](#control-center)
40
+ 23. [Safety model](#safety-model)
41
+ 24. [Cài đặt](#cài-đặt)
42
+ 25. [Cập nhật](#cập-nhật)
43
+ 26. [Đóng gói npm](#đóng-gói-npm)
44
+ 27. [Các CLI quan trọng](#các-cli-quan-trọng)
45
+ 28. [Benchmark model yếu](#benchmark-model-yếu)
46
+ 29. [Cấu trúc repository](#cấu-trúc-repository)
47
+ 30. [Triết lý thiết kế](#triết-lý-thiết-kế)
48
+ 31. [Giới hạn có chủ đích](#giới-hạn-có-chủ-đích)
49
+
50
+ ---
51
+
52
+ # UES giải quyết vấn đề gì?
12
53
 
13
- - giảm lượng thông tin phải giữ trong một context dài;
14
- - chia tác vụ lớn thành các bước rõ ràng;
15
- - lưu trạng thái ra filesystem để có thể tiếp tục sau khi session bị ngắt;
16
- - chạy executor bằng context mới cho từng tác vụ;
17
- - yêu cầu bằng chứng kiểm thử trước khi đánh dấu hoàn tất;
18
- - kiểm tra thay đổi ở mức task và mức tích hợp toàn hệ thống;
19
- - hỗ trợ routing skill, model tier, task policy và recovery theo trạng thái thực tế của repository.
54
+ Một coding model yếu thường gặp các vấn đề sau khi làm việc trên repository thật:
20
55
 
21
- Mục tiêu của UES là giúp quá trình làm việc với coding agent **ổn định hơn, có thể kiểm chứng hơn và phù hợp hơn với repository lớn**.
56
+ | Vấn đề | Nếu để model tự xử lý | UES xử lý thế nào |
57
+ |---|---|---|
58
+ | Repository lớn | đọc quá nhiều file, mất context | semantic index + hierarchy L0/L1/L2 + bounded context |
59
+ | Task dài | quên mục tiêu, lặp lại việc | durable work state + PLAN/STATE/EVENTS |
60
+ | Nhiều thay đổi song song | đụng file, ghi đè nhau | task graph + safe waves + worktree sandbox |
61
+ | Không biết test gì | chạy full CI hoặc đoán | detect-tests + verification plan + declared verification commands |
62
+ | Model báo xong quá sớm | false PASS | verifier + integration-verifier + receipts |
63
+ | Retry mù | vá chồng vá | diagnosis-first recovery policy |
64
+ | Log quá lớn | token phình | reversible model-visible compaction |
65
+ | Tool quá nhiều | model chọn sai tool | role allowlist + capability-based routing |
66
+ | UI/browser | đoán thay vì quan sát | Playwright/Browser MCP lane + visual verifier |
67
+ | Kinh nghiệm cũ | nhớ sai hoặc nhiễm | verified persistent memory |
68
+ | Tối ưu không có bằng chứng | nhanh hơn nhưng yếu đi | baseline-vs-UES eval + promotion confidence |
22
69
 
23
70
  ---
24
71
 
72
+ # Kiến trúc tổng thể
73
+
74
+ ~~~mermaid
75
+ flowchart TD
76
+ U[User task] --> P[Pi Agent]
77
+ P --> X[UES extension]
78
+
79
+ X --> TP[Task Policy]
80
+ TP --> C[Context Engine]
81
+ TP --> M[Model Policy]
82
+ TP --> W[Workflow Policy]
83
+
84
+ C --> H[Hierarchy L0 L1 L2]
85
+ C --> SI[Semantic Index]
86
+ C --> MEM[Verified Memory]
87
+ C --> CAP[Capability Fabric]
88
+ C --> EV[Evidence Store]
89
+
90
+ W --> A[Specialist Agents]
91
+ W --> TG[Task Graph]
92
+ W --> DW[Dynamic Workflow]
93
+ W --> SB[Worktree Sandbox]
94
+
95
+ A --> EX[Executor]
96
+ A --> VE[Verifier]
97
+ A --> IV[Integration Verifier]
98
+ A --> VV[Visual Verifier]
99
+
100
+ EX --> CHECK[Project-native checks]
101
+ VE --> CHECK
102
+ IV --> CHECK
103
+ VV --> BROWSER[Playwright Browser evidence]
25
104
 
26
- ## V13 beta: Parallel Weak-Model Runtime
105
+ CHECK --> R[Fresh Evidence]
106
+ BROWSER --> R
107
+ R --> G{Verification gates}
108
+ G -->|PASS| DONE[Verified completion]
109
+ G -->|FAIL| REC[Diagnosis and bounded retry]
110
+ REC --> C
111
+ ~~~
27
112
 
28
- V13 cho phép **một model duy nhất** chạy nhiều fresh child sessions song song. `ues.dispatch_parallel` chọn một shared model (hoặc giữ OpenCode default model), chạy các task độc lập theo event-driven DAG, dùng resource lease để tránh writer conflict, tạo worktree riêng cho writer, dùng fresh same-model `ues-verifier`, rồi tích hợp tuần tự. Nếu bước receipt/complete thất bại sau khi patch đã áp dụng, integration transaction tự rollback patch của task đó.
113
+ ## Các lớp chính
29
114
 
30
- ```text
31
- approved PLAN
32
- ↓
33
- event-driven DAG
34
- ↓
35
- same model × N fresh sessions
36
- ↓
37
- isolated worktrees + resource leases
38
- ↓
39
- fresh same-model verifier
40
- ↓
41
- transactional integration queue
42
- ↓
43
- unlock dependencies immediately
44
- ```
115
+ ### 1. Pi host layer
45
116
 
46
- CLI V13 cũng xử lý `--help` trước positional parsing, hỗ trợ `ocskill work status .`, structured errors với `--json`, đọc UTF-8/UTF-16 an toàn và cung cấp `ocskill diff . --out dirty.diff` để tránh PowerShell tạo diff UTF-16 bị OpenCode nhận nhầm là binary.
117
+ Pi chịu trách nhiệm session, model provider, thinking level, built-in tools và extension runtime.
47
118
 
48
- Parallel resume không còn yêu cầu root phải sạch tuyệt đối. Nếu repository đã có dirty diff hợp lệ từ phiên trước, V13 chụp baseline đó vào worktree cô lập và chỉ tích hợp delta của task; thay đổi cũ được giữ nguyên. Root vẫn phải là Git repository và resource leases vẫn chặn các writer xung đột.
119
+ ### 2. UES Pi extension
49
120
 
50
- > **Compatibility:** V13 CLI/durable-state/verification hardening vẫn dùng được trên OpenCode 1.x. Native `ues.dispatch_task` / `ues.dispatch_parallel` cần router plugin và fresh-session APIs của OpenCode V2; nếu capability không đủ, runtime fail closed thay vì giả vờ chạy song song.
121
+ File chính: <code>pi/extensions/ues.ts</code>.
51
122
 
52
- ### V13 beta validation gate
123
+ Extension đăng ký ba tool orchestration:
53
124
 
54
- Mỗi V13 prerelease, bao gồm beta.2, chỉ được publish sau khi full gate hiện tại PASS. Không hard-code số lượng test vào tài liệu này vì suite tiếp tục tăng; nguồn đúng là output của chính các lệnh gate:
125
+ | Tool | Vai trò |
126
+ |---|---|
127
+ | <code>ues_execute</code> | Chạy task engineering end-to-end |
128
+ | <code>ues_cli</code> | Gọi deterministic UES CLI không qua shell interpolation |
129
+ | <code>ues_dispatch</code> | Gọi specialist child agents theo single / chain / bounded parallel |
130
+
131
+ ### 3. Deterministic engine
132
+
133
+ Thư mục <code>lib/</code> chứa các engine cho:
134
+
135
+ - task/risk classification;
136
+ - semantic index;
137
+ - repo graph;
138
+ - context manifest;
139
+ - evidence storage;
140
+ - receipts;
141
+ - work state;
142
+ - task graph;
143
+ - safe-wave scheduling;
144
+ - model routing;
145
+ - memory;
146
+ - capability selection;
147
+ - browser evidence;
148
+ - benchmark/learning;
149
+ - safety;
150
+ - Windows compatibility.
151
+
152
+ ### 4. Specialist layer
153
+
154
+ UES không dùng một prompt khổng lồ cho mọi việc. Nó có 12 specialist roles với tool boundary khác nhau.
55
155
 
56
- - `npm run evals:v13`;
57
- - `npm test`;
58
- - `npm run ci`;
59
- - `npm pack --dry-run`;
60
- - packed-install smoke và plain-install smoke;
61
- - live OpenCode V2 check: router load, `/ues-run` FAST/STANDARD/DEEP admission, prompt dài, MCP/provider path và restart trên session mới;
62
- - npm 11+ có thể chặn lifecycle script theo `allowScripts`; `ocskill install` vẫn là resource-sync fallback chính thức.
156
+ ### 5. Verification layer
63
157
 
158
+ Hoàn thành không đồng nghĩa model nói “done”. UES cố gắng ràng buộc completion với fresh evidence, receipt và verifier độc lập.
64
159
 
65
160
  ---
66
161
 
162
+ # Luồng /ues-run end-to-end
163
+
164
+ <code>/ues-run</code> là entry point khuyến nghị cho engineering task.
165
+
166
+ ~~~mermaid
167
+ sequenceDiagram
168
+ participant U as User
169
+ participant P as Pi
170
+ participant UES as UES Controller
171
+ participant CTX as Context Engine
172
+ participant EX as Executor
173
+ participant V as Verifier
174
+ participant IV as Integration Verifier
175
+ participant VV as Visual Verifier
176
+
177
+ U->>P: /ues-run task
178
+ P->>UES: ues_execute(task)
179
+ UES->>UES: classify task/risk/profile
180
+ UES->>CTX: build bounded context
181
+ CTX-->>UES: hierarchy + evidence + memory + capability hints
182
+
183
+ alt long/high risk
184
+ UES->>UES: architect + structured plan
185
+ UES->>UES: plan-checker gate
186
+ end
187
+
188
+ UES->>EX: fresh specialist execution
189
+ EX-->>UES: implementation handoff
190
+
191
+ UES->>V: independent verification
192
+ V-->>UES: PASS / FAIL / PARTIAL
193
+
194
+ alt integration required
195
+ UES->>IV: cross-task/final repository verification
196
+ IV-->>UES: PASS / FAIL / PARTIAL
197
+ end
198
+
199
+ alt visual/browser evidence required
200
+ UES->>VV: rendered-state verification
201
+ VV-->>UES: PASS / FAIL / PARTIAL
202
+ end
203
+
204
+ alt all required gates PASS
205
+ UES-->>P: verified completion
206
+ P-->>U: final result
207
+ else failure
208
+ UES->>UES: diagnosis / recovery / bounded retry
209
+ end
210
+ ~~~
211
+
212
+ ## UES không làm gì ở luồng này?
213
+
214
+ - không tự push;
215
+ - không tự publish npm;
216
+ - không tự deploy production;
217
+ - không coi executor report là bằng chứng hoàn thành;
218
+ - không bỏ verifier chỉ vì compile pass;
219
+ - không lưu hidden chain-of-thought.
220
+
221
+ ---
222
+
223
+ # Task Policy: FAST / STANDARD / DEEP
224
+
225
+ Task Policy nằm trong <code>lib/task-policy.mjs</code> và phân loại task theo tín hiệu có thể quan sát.
226
+
227
+ ~~~mermaid
228
+ flowchart LR
229
+ T[Task text + repo facts] --> S[Risk and complexity signals]
67
230
 
68
- ## Cài đặt
231
+ S --> F{Classification}
232
+ F -->|low + bounded| FAST[FAST]
233
+ F -->|medium| STD[STANDARD]
234
+ F -->|long horizon or high risk| DEEP[DEEP]
69
235
 
70
- Yêu cầu:
236
+ FAST --> F1[8k context budget]
237
+ FAST --> F2[max 2 skills]
238
+ FAST --> F3[targeted verification]
71
239
 
72
- - Node.js 20 trở lên;
73
- - npm;
74
- - OpenCode.
240
+ STD --> S1[20k context budget]
241
+ STD --> S2[max 4 skills]
242
+ STD --> S3[targeted + affected verification]
75
243
 
76
- Cài đặt stable hiện tại từ npm:
244
+ DEEP --> D1[48k context budget]
245
+ DEEP --> D2[max 5 skills]
246
+ DEEP --> D3[plan + integration + durable state]
247
+ ~~~
77
248
 
78
- ```cmd
79
- npm install -g opencode-agent-skill
80
- ```
249
+ ## FAST
81
250
 
82
- Cài V13 beta từ npm sau khi prerelease đã có trên registry:
251
+ Dành cho task nhỏ, low-risk, bounded.
83
252
 
84
- ```cmd
85
- npm install -g opencode-agent-skill@next
86
- ocskill install
87
- ```
253
+ Đặc điểm:
88
254
 
89
- Nếu đang kiểm thử một commit mới hơn bản registry, cài trực tiếp từ checkout:
255
+ - context budget mặc định khoảng 8k;
256
+ - tối đa 2 skills;
257
+ - direct skill loading;
258
+ - không bắt durable work;
259
+ - verification targeted;
260
+ - không bật full CI mặc định.
90
261
 
91
- ```cmd
92
- npm install -g .
93
- ocskill install
94
- ```
262
+ ## STANDARD
95
263
 
96
- Kiểm tra:
264
+ Dành cho task vừa, có debugging/change scope đáng kể.
97
265
 
98
- ```cmd
99
- ocskill version
100
- ocskill status
101
- ocskill doctor
102
- ```
266
+ Đặc điểm:
103
267
 
104
- Nếu npm không chạy lifecycle script trong lúc cài đặt (npm 11+ có thể cảnh báo `install-scripts ... not yet covered by allowScripts`), package CLI vẫn có thể đã được cài. Chạy resource sync rõ ràng:
268
+ - context budget khoảng 20k;
269
+ - tối đa 4 skills;
270
+ - selective skill loading;
271
+ - affected verification;
272
+ - worktree khi có conflict.
105
273
 
106
- ```cmd
107
- ocskill install
108
- ```
274
+ ## DEEP
109
275
 
110
- Đây là fallback được CI smoke kiểm tra; không cần dùng `--force` chỉ để vượt cảnh báo lifecycle script.
276
+ Dành cho long-horizon/high-risk.
111
277
 
112
- Sau khi cài hoặc cập nhật UES, hãy restart OpenCode service rồi mở một session mới để skill, command, subagent và plugin được nạp lại đầy đủ:
278
+ Đặc điểm:
113
279
 
114
- ```cmd
115
- opencode service restart
116
- ```
280
+ - context budget đến khoảng 48k;
281
+ - tối đa 5 skills;
282
+ - structured plan;
283
+ - durable state;
284
+ - plan checker;
285
+ - worktree cho writers;
286
+ - integration verification;
287
+ - full CI policy;
288
+ - critic ở high-risk/final paths.
117
289
 
118
- Trên OpenCode V2 có thể kiểm tra router bằng `/plugins`, sau đó gọi `ues.capabilities`. Native parallel chỉ nên dùng khi `freshDispatch` báo `true`.
290
+ ## High-risk signals
291
+
292
+ UES phân biệt “chỉ nhắc tới database/security” với “thực sự thay đổi database/security”.
293
+
294
+ Những thay đổi như sau có thể nâng risk:
295
+
296
+ - auth/permission/security mutation;
297
+ - payment flow;
298
+ - database/schema migration;
299
+ - production deploy;
300
+ - secret/credential rotation;
301
+ - breaking public API;
302
+ - destructive Git/database action.
119
303
 
120
304
  ---
121
305
 
122
- ## Bắt đầu nhanh
306
+ # 12 specialist agents
307
+
308
+ Thư mục: <code>global-config/agents/</code>.
309
+
310
+ | Agent | Nhiệm vụ | Có ghi file? | Khi dùng |
311
+ |---|---|---:|---|
312
+ | architect | thiết kế plan/contract/dependency | không | task phức tạp, long-horizon |
313
+ | codebase-mapper | đọc repo và map scope | không | repo lớn/không rõ vị trí |
314
+ | critic | phản biện plan/solution | không | high-risk hoặc recovery sâu |
315
+ | debugger | tìm nguyên nhân gốc từ evidence | không | bug/failure/retry |
316
+ | executor | thực thi thay đổi nhỏ nhất hợp lý | có | implementation |
317
+ | integration-verifier | kiểm tra final cross-task state | không | standard/deep/high-risk |
318
+ | merge-arbiter | xử lý integration/merge boundary | có | conflict/merge workflow |
319
+ | plan-checker | kiểm tra plan có grounded không | không | trước long/high-risk execution |
320
+ | researcher | nghiên cứu bằng chứng | không | uncertainty/external facts |
321
+ | reviewer | review thay đổi | không | code review/audit |
322
+ | verifier | fresh independent verification | không | completion gate |
323
+ | visual-verifier | verify rendered UI/browser state | không | visual/browser task |
324
+
325
+ ## Quan hệ giữa các agent
326
+
327
+ ~~~mermaid
328
+ flowchart TD
329
+ MAP[codebase-mapper] --> ARCH[architect]
330
+ ARCH --> PC[plan-checker]
331
+ PC --> EX[executor]
332
+
333
+ EX --> V[verifier]
334
+ V -->|PASS| IV[integration-verifier]
335
+ V -->|FAIL| D[debugger]
336
+
337
+ D --> EX
338
+ D --> C[critic]
339
+ C --> ARCH
340
+
341
+ IV -->|visual task| VV[visual-verifier]
342
+ IV -->|non visual| DONE[complete]
343
+ VV --> DONE
344
+
345
+ R[researcher] -. evidence .-> ARCH
346
+ R -. evidence .-> D
347
+ REV[reviewer] -. review .-> V
348
+ ~~~
123
349
 
124
- Với tác vụ lớn, dùng:
350
+ ---
125
351
 
126
- ```text
127
- /ues-run <yêu cầu>
128
- ```
352
+ # 48 skills
353
+
354
+ UES hiện có 48 skill directories trong <code>global-config/skills/</code>. Skills không phải 48 agent độc lập; chúng là bounded domain instructions để UES chỉ nạp đúng chuyên môn cần thiết.
355
+
356
+ ## Nhóm orchestration và reasoning
357
+
358
+ - engineering-orchestrator
359
+ - dynamic-workflow
360
+ - task-planner
361
+ - software-architect
362
+ - context-engineering
363
+ - change-impact-analysis
364
+ - repo-explorer
365
+ - research-verification
366
+ - long-task-state
367
+ - implementation-engineer
368
+ - bug-diagnosis
369
+ - code-review
370
+ - skill-authoring
371
+ - skill-evaluation
372
+
373
+ ## Nhóm verification và testing
374
+
375
+ - test-driven-development
376
+ - test-verification
377
+ - accessibility
378
+ - responsive-verification
379
+ - component-visual-testing
380
+ - visual-fidelity
381
+ - browser-qa
382
+ - browser-security
383
+ - web-security-review
384
+ - performance-engineering
385
+
386
+ ## Nhóm backend / API / data
387
+
388
+ - api-contract
389
+ - rest-api-design
390
+ - auth-security
391
+ - database-engineering
392
+ - payment-engineering
393
+ - ecommerce-engineering
394
+ - file-upload-engineering
395
+ - dependency-management
396
+ - devops-engineering
397
+ - documentation-engineering
398
+ - git-safety
399
+
400
+ ## Nhóm framework / language
401
+
402
+ - nodejs-engineering
403
+ - nextjs-engineering
404
+ - react-engineering
405
+ - react-native-engineering
406
+ - nestjs-engineering
407
+ - fastapi-engineering
408
+ - django-engineering
409
+ - python-engineering
410
+ - java-spring-engineering
411
+ - dotnet-engineering
412
+ - flutter-engineering
413
+
414
+ ## Nhóm UI/design
415
+
416
+ - ui-ux-engineering
417
+ - design-source
418
+
419
+ > Mục tiêu của skill routing là progressive disclosure: model không phải đọc tất cả 48 skills cho một task.
129
420
 
130
- Nếu session bị ngắt hoặc context bị compact:
421
+ ---
131
422
 
132
- ```text
133
- /ues-resume <slug>
134
- ```
423
+ # 11 slash prompts
135
424
 
136
- Một số lệnh hữu ích:
425
+ Pi package cung cấp 11 slash prompts:
137
426
 
138
- ```cmd
139
- ocskill inspect .
140
- ocskill repo-graph . --compact
141
- ocskill verification-plan .
142
- ocskill task-policy "refactor auth across the whole repository"
143
- ocskill dashboard . --serve
144
- ```
427
+ | Command | Ý nghĩa |
428
+ |---|---|
429
+ | <code>/ues-run</code> | controller end-to-end |
430
+ | <code>/ues-plan</code> | lập kế hoạch |
431
+ | <code>/ues-feature</code> | triển khai feature |
432
+ | <code>/ues-fix</code> | sửa bug |
433
+ | <code>/ues-debug</code> | điều tra failure |
434
+ | <code>/ues-review</code> | review code/scope |
435
+ | <code>/ues-verify</code> | xác minh claim |
436
+ | <code>/ues-audit</code> | audit scope |
437
+ | <code>/ues-research</code> | research |
438
+ | <code>/ues-critique</code> | phản biện proposal |
439
+ | <code>/ues-resume</code> | tiếp tục durable work |
440
+
441
+ ~~~mermaid
442
+ flowchart LR
443
+ CMD[Slash command] --> ROUTE[UES router/controller]
444
+ ROUTE --> POLICY[Task policy]
445
+ POLICY --> AGENT[Relevant specialist path]
446
+ AGENT --> EVIDENCE[Fresh evidence]
447
+ EVIDENCE --> RESULT[Result]
448
+ ~~~
145
449
 
146
450
  ---
147
451
 
148
- ## V11 có gì?
452
+ # Context Engine L0/L1/L2
149
453
 
150
- V11 chuyển UES từ một reliability harness thành **perception-aware adaptive execution engine**. Mục tiêu là model yếu chỉ nhận đúng bằng chứng cần thiết, dùng đúng capability/model/tool và có thể kiểm chứng UI bằng semantic structure + geometry + pixels thay vì đoán từ screenshot.
454
+ Một trong các mục tiêu lớn của UES là **nạp ít context hơn nhưng đúng hơn**.
151
455
 
152
- - content-addressed Evidence Store dưới `.ues-cache/evidence-v1/`; output lớn được lưu theo SHA-256 và context nhận bounded excerpt + `evidence:sha256:...` pointer;
153
- - adaptive EvidenceBudget chia context cho instructions/task/source/tests/references/history/tools theo rủi ro và loại task thay vì luôn tiêu hết FAST/STANDARD/DEEP budget;
154
- - prompt-envelope telemetry tách stable prefix và dynamic tail để đo cacheable ratio/repeated stable input;
155
- - capability-aware model routing bổ sung `vision`, `browser`, `reasoning`, `toolCalling`, `filesystem`, `longContext` nhưng vẫn giữ light/standard/heavy để tương thích;
156
- - `VISUAL_SPEC.json` + geometry receipt kiểm tra vị trí/kích thước element có tolerance rõ ràng;
157
- - zero-dependency PNG diff/crop định vị vùng pixel sai rồi chỉ đưa crop cần thiết cho vision model;
158
- - browser QA dùng targeted semantic/accessibility evidence + bounding boxes + screenshots; webpage content luôn được xem là untrusted;
159
- - responsive viewport matrix và component visual testing/Storybook routing;
160
- - dynamic workflow scheduler tách deterministic task khỏi LLM/vision fan-out, serialize overlapping writers và giới hạn concurrency;
161
- - skill linter đo entrypoint size và description collisions; catalog tăng từ 39 lên **48 skills** nhưng router chỉ load skill có tín hiệu hẹp;
162
- - hai subagent mới: `ues-visual-verifier` và `ues-merge-arbiter`, tổng **12 subagents**;
163
- - Hermes được nâng thành optional sidecar: UES vẫn sở hữu durable state/evidence/safety, Hermes chỉ nhận bounded schedule/context khi được dùng;
164
- - Control Center hiển thị Evidence Store và V11 runtime efficiency state.
456
+ ~~~mermaid
457
+ flowchart TD
458
+ Q[Task query] --> TERM[Extract bounded terms]
459
+ TERM --> IDX[Semantic index]
460
+ IDX --> H0[L0 routing abstract]
461
+ H0 --> H1[L1 subtree overview]
462
+ H1 --> H2[L2 exact excerpts on demand]
165
463
 
166
- Các CLI V11 chính:
464
+ GIT[Git changed files] --> RANK[Ranking]
465
+ DECL[Declared files] --> RANK
466
+ TEST[Likely tests] --> RANK
467
+ SYM[Symbol hits] --> RANK
468
+ MEM[Verified memory] --> RANK
167
469
 
168
- ```cmd
169
- ocskill store status .
170
- ocskill store get evidence:sha256:<hash> . --max 12000
171
- ocskill capabilities "match this screenshot in the browser"
172
- ocskill visual spec VISUAL_SPEC.json
173
- ocskill visual geometry VISUAL_SPEC.json actual-boxes.json
174
- ocskill visual compare expected.png actual.png --threshold 16
175
- ocskill visual crop actual.png failed-region.png --x 10 --y 20 --width 300 --height 120
176
- ocskill visual viewports
177
- ocskill browser capability .
178
- ocskill browser plan http://localhost:3000 --target Checkout
179
- ocskill browser inspect http://localhost:3000 . --selector "button" --width 1440 --height 900
180
- ocskill ui tokens src/styles.css
181
- ocskill ui layout boxes.json --width 390 --height 844
182
- ocskill workflow-plan PLAN.json --max-concurrent 4
183
- ocskill skills lint .
184
- ocskill models capability provider/model --vision on --browser on --quality 0.9
185
- ```
186
-
187
- V11 stable được promote sau full local CI trên Windows PASS: 234 tests, 232 pass, 0 fail, 2 platform-specific skips; router/contract/package/install smoke đều PASS. Stable npm install dùng `npm install -g opencode-agent-skill`.
188
-
189
- ---
190
-
191
- ## V10 có gì?
192
-
193
- V10 tập trung vào **minimum context necessary for maximum task success**: giảm context luôn nạp nhưng không cắt các lớp correctness, verification hay recovery.
194
-
195
- - telemetry đo riêng **initial input tokens** bên cạnh total tokens, tool calls, latency và cost;
196
- - global `AGENTS.md` được nén đáng kể, giữ lại contract, evidence, verification, safety và long-horizon invariants;
197
- - FAST context budget giảm từ 12k xuống **8k**, STANDARD từ 24k xuống **20k**, còn DEEP vẫn giữ **48k** cho task rủi ro/lớn;
198
- - OpenCode V2 runtime dùng policy-aware selective routing: FAST ưu tiên domain/debug/review skill trực tiếp thay vì tự động nạp generic orchestrator;
199
- - failed attempt tự mở rộng context theo tầng `initial -> diagnose -> deep-recovery`; retry tăng evidence, graph/critic và model tier khi cấu hình cho phép;
200
- - FAST không tự hạ executor thấp hơn tier đã cấu hình, nên tối ưu context không đồng nghĩa hạ năng lực model;
201
- - benchmark confidence gate kiểm tra thêm initial-input ratio và total-token ratio;
202
- - `npm run evals:ablation -- <reference> <candidate> --require-gate` so V10 với một reference run và từ chối candidate giảm pass-rate dù token có thấp hơn;
203
- - runtime reliability guard phát hiện no-progress/stall, chặn duplicate `read/grep/glob`, phát hiện loop và cắt output exploration quá lớn trước khi nó làm ngập context;
204
- - pre-compaction checkpoint lưu `currentTaskId`, `runId`, plan hash, workspace fingerprint, evidence pointers và structured `nextAction`; post-compaction bắt buộc thực thi action trước khi session được coi là hoàn tất;
205
- - provider recovery thử fresh session cùng model một lần, sau lỗi lặp lại dùng configured escalation model/provider nếu có;
206
- - lease supervisor tự thu hồi executor lease hết hạn sang trạng thái `retryable`, và explicit `long/high-risk` hard-override FAST thành DEEP/heavy.
207
-
208
- V10 stable kế thừa toàn bộ RC.2 reliability hardening. Local full gate trên Windows/Node 24 đã PASS với 182 test pass, 0 fail, 2 skip cùng package/install smoke PASS trước khi promote.
209
-
210
- ---
211
-
212
- ## UES 9.0.0 có gì?
213
-
214
- UES 9.0.0 cung cấp các khả năng sau (kế thừa từ 8.0.0):
215
-
216
- - **39 engineering skills**;
217
- - **11 slash commands**;
218
- - **10 subagents**;
219
- - long-task engine bền vững dưới `.ues-work/<slug>/`;
220
- - `PLAN.json`, `STATE.json`, `EVIDENCE.json` và append-only `EVENTS.jsonl`;
221
- - structured plan/integration receipts gắn với plan hash hoặc workspace fingerprint;
222
- - task lease với `runId`, heartbeat, session owner, lease expiry và task-scoped stale recovery;
223
- - strict verification cho long/high-risk task: receipt phải PASS đúng active run và đúng workspace hiện tại;
224
- - context manifest v3 với Git-change awareness, symbol hits, TF-IDF-style relevance, tests/instructions và centered excerpts;
225
- - task policy `inline / standard / long-horizon` cùng model tier `light / standard / heavy`;
226
- - bounded fresh executor với hard timeout, interrupt/cancel và recovery;
227
- - safe-wave scheduling cùng Git worktree isolation/integration có conflict detection;
228
- - learning v2: failure clustering, explicit acceptance và shadow-benchmark promotion;
229
- - benchmark matrix standard + long-horizon + polyglot;
230
- - optional Hermes adapter;
231
- - UES Control Center hiển thị runtime events, receipts và stale recovery;
232
- - OpenCode V2 router plugin với multilingual routing, safety gate, cancel/recover tools và fresh-session dispatch.
233
-
234
- V9 bổ sung:
235
-
236
- - persistent incremental source index dưới `.ues-cache/semantic-index-v1.json` cùng ACI search/refs/view/text;
237
- - FAST / STANDARD / DEEP execution profiles với bounded context budget, skill cap và verification depth;
238
- - context manifest v4 tiêu thụ incremental evidence index trước khi mở rộng graph;
239
- - redacted operational trajectory dưới `.ues-traces/*.jsonl` để replay/debug mà không lưu hidden chain-of-thought;
240
- - optional container verification sandbox (Docker/Podman) với network-off, dropped capabilities và resource bounds;
241
- - paired baseline-vs-UES confidence gate qua `npm run evals:matrix:gate`.
242
-
243
- ---
244
-
245
- ## Kiến trúc tác vụ dài
246
-
247
- Luồng long-horizon chính:
248
-
249
- ```text
250
- Yêu cầu
251
- ↓
252
- Khảo sát repository / bằng chứng
253
- ↓
254
- SPEC.md
255
- ↓
256
- PLAN.json
257
- ↓
258
- ues-plan-checker
259
- ↓
260
- Phê duyệt kế hoạch
261
- ↓
262
- Các task theo dependency graph
263
- ↓
264
- Fresh ues-executor session cho từng task
265
- ↓
266
- Task evidence + durable state
267
- ↓
268
- ues-integration-verifier
269
- ↓
270
- Integration PASS
271
- ↓
272
- Kiểm tra workspace không thay đổi
273
- ↓
274
- Finalize
275
- ```
276
-
277
- Mỗi work item dùng cấu trúc:
278
-
279
- ```text
280
- .ues-work/<slug>/
281
- ├── SPEC.md
282
- ├── PLAN.json
283
- ├── STATE.json
284
- ├── EVIDENCE.json
285
- ├── EVENTS.jsonl
286
- ├── tasks/
287
- └── reports/
288
- ```
470
+ H2 --> RANK
471
+ RANK --> PACK[Bounded context pack]
472
+ PACK --> CHILD[Fresh child agent]
473
+ ~~~
474
+
475
+ ## L0
476
+
477
+ Routing abstract rất ngắn:
478
+
479
+ - khu vực nào có vẻ liên quan;
480
+ - key symbols;
481
+ - child areas.
482
+
483
+ ## L1
484
+
485
+ Scope overview:
486
+
487
+ - file count;
488
+ - extension mix;
489
+ - symbols;
490
+ - bounded file names;
491
+ - subtree relation.
492
+
493
+ ## L2
494
+
495
+ Exact excerpts chỉ load khi cần.
496
+
497
+ ## Context pack có thể bao gồm
498
+
499
+ - declared files;
500
+ - import neighbors;
501
+ - likely tests;
502
+ - nearby instructions;
503
+ - Git-changed files;
504
+ - semantic references;
505
+ - symbol hits;
506
+ - evidence refs;
507
+ - verified memories;
508
+ - provider hints;
509
+ - recent failure.
510
+
511
+ ---
512
+
513
+ # Semantic index, repo graph và ACI
514
+
515
+ UES có ba lớp khác nhau; chúng không phải một thứ.
289
516
 
290
- `.ues-work/` là trạng thái thực thi của workflow, không phải hidden chain-of-thought.
517
+ ## Semantic Index
291
518
 
292
- ### Gate 1 — Phê duyệt kế hoạch
519
+ <code>lib/semantic-index.mjs</code>
293
520
 
294
- Sau khi tạo plan, task chưa được chạy ngay. Trạng thái sẽ ở:
521
+ Dùng để tạo persistent incremental index phục vụ retrieval.
295
522
 
296
- ```text
297
- awaiting-plan-approval
298
- ```
523
+ ~~~mermaid
524
+ flowchart LR
525
+ SRC[Source files] --> PARSE[Bounded parse]
526
+ PARSE --> SYMBOLS[Symbols]
527
+ PARSE --> TERMS[Terms]
528
+ SYMBOLS --> INDEX[Persistent semantic index]
529
+ TERMS --> INDEX
530
+ INDEX --> QUERY[Task query]
531
+ QUERY --> RANK[Ranked references]
532
+ ~~~
299
533
 
300
- Sau khi `ues-plan-checker` trả PASS, với long/high-risk work hãy tạo receipt gắn với đúng plan hiện tại rồi mới approve:
534
+ CLI:
301
535
 
302
- ```cmd
303
- ocskill work gate-receipt <slug> plan . --verifier ues-plan-checker --evidence "plan checker PASS" --out .ues-work/<slug>/reports/plan-receipt.json
304
- ocskill work approve-plan <slug> . --evidence "plan checker PASS" --receipt-file .ues-work/<slug>/reports/plan-receipt.json
305
- ```
536
+ ~~~text
537
+ ues index status .
538
+ ues index build .
539
+ ues index rebuild .
540
+ ~~~
306
541
 
307
- Nếu thiếu structured receipt ở workflow strict, `ocskill work start` sẽ không được mở gate.
542
+ ## Repo Graph
308
543
 
309
- ### Gate 2 — Bằng chứng cho từng task
544
+ <code>lib/repo-graph.mjs</code>
310
545
 
311
- Có thể ghi verification receipt trực tiếp từ command:
546
+ Tạo bounded import/dependency graph:
312
547
 
313
- ```cmd
314
- ocskill work verify-command <slug> <task-id> . --run-id <run-id> -- npm test
315
- ```
548
+ - local edges;
549
+ - external imports;
550
+ - coupling hotspots.
316
551
 
317
- Receipt gắn kết kết quả command với đúng task run. Với long/high-risk work, receipt PASS còn phải khớp workspace fingerprint hiện tại; nếu code thay đổi sau khi test thì phải verify lại.
552
+ Nó **không tự nhận là full language-server call graph**.
318
553
 
319
- ### Gate 3 — Kiểm tra tích hợp
554
+ ~~~mermaid
555
+ flowchart LR
556
+ FILES[Source files] --> IMPORTS[Import extraction]
557
+ IMPORTS --> LOCAL[Local dependency edges]
558
+ IMPORTS --> EXT[External import frequency]
559
+ LOCAL --> HOT[Coupling hotspots]
560
+ EXT --> HOT
561
+ ~~~
320
562
 
321
- Sau khi toàn bộ task hoàn tất, tạo integration receipt gắn với workspace hiện tại rồi ghi PASS:
563
+ CLI:
322
564
 
323
- ```cmd
324
- ocskill work gate-receipt <slug> integration . --verifier ues-integration-verifier --verdict PASS --evidence "integration PASS" --out .ues-work/<slug>/reports/integration-receipt.json
325
- ocskill work verify-integration <slug> . --verdict PASS --evidence "integration PASS" --receipt-file .ues-work/<slug>/reports/integration-receipt.json
326
- ```
565
+ ~~~text
566
+ ues repo-graph .
567
+ ues repo-graph . --compact
568
+ ~~~
327
569
 
328
- Sau đó:
570
+ ## ACI
329
571
 
330
- ```cmd
331
- ocskill work finalize <slug> . --evidence "final acceptance verified"
332
- ```
572
+ <code>lib/aci.mjs</code>
333
573
 
334
- `finalize` sẽ bị từ chối nếu còn task chưa hoàn tất, còn blocker, chưa có integration PASS hoặc workspace đã thay đổi sau lần kiểm tra tích hợp.
574
+ Evidence-first code interface cho:
575
+
576
+ - search;
577
+ - references;
578
+ - view;
579
+ - bounded text search.
580
+
581
+ CLI:
582
+
583
+ ~~~text
584
+ ues aci search ...
585
+ ues aci refs ...
586
+ ues aci view ...
587
+ ues aci text ...
588
+ ~~~
335
589
 
336
590
  ---
337
591
 
338
- ## Fresh-context executor trên OpenCode V2
592
+ # Model routing và recovery
593
+
594
+ UES không hard-code tên model “mạnh nhất”. Model IDs do người dùng cấu hình.
595
+
596
+ ## Tier
597
+
598
+ - light
599
+ - standard
600
+ - heavy
339
601
 
340
- OpenCode V2 plugin cung cấp tool:
602
+ Role có default tier, và attempt có thể escalate trong giới hạn cấu hình.
341
603
 
342
- ```text
343
- ues.dispatch_task
344
- ```
604
+ ~~~mermaid
605
+ flowchart TD
606
+ TASK[Task] --> CLASS[Task class + risk]
607
+ CLASS --> BASE[Base tier]
608
+ BASE --> CAPS[Required capabilities]
609
+ CAPS --> PERF[Historical model performance]
610
+ PERF --> SELECT[Select configured model]
345
611
 
346
- Luồng thực thi:
612
+ SELECT --> RUN[Attempt]
613
+ RUN -->|PASS| DONE[Done]
614
+ RUN -->|FAIL attempt 1| DIAG[Diagnosis]
615
+ DIAG --> RETRY[Attempt 2]
616
+ RETRY -->|FAIL| DEEP[Deep recovery + critic]
617
+ DEEP --> STRONGER[Eligible stronger tier]
618
+ ~~~
347
619
 
348
- ```text
349
- work start
350
- ↓
351
- đọc bounded context pack
352
- ↓
353
- chọn model tier theo task + attempt
354
- ↓
355
- tạo OpenCode session mới
356
- ↓
357
- switchAgent(ues-executor)
358
- ↓
359
- switchModel(...) nếu đã cấu hình
360
- ↓
361
- gửi đúng một task
362
- ↓
363
- heartbeat + bounded wait
364
- ↓
365
- interrupt nếu timeout/cancel
366
- ↓
367
- isolate writer khi cần
368
- ↓
369
- trả child-session report
370
- ```
620
+ ## Recovery policy
371
621
 
372
- Parent session vẫn chịu trách nhiệm kiểm tra diff, evidence và quyết định gọi `work complete` hoặc `work fail`.
622
+ ### Attempt 1
373
623
 
374
- Child session không được tự động merge, push, publish hoặc deploy.
624
+ - normal bounded context;
625
+ - smallest coherent implementation.
626
+
627
+ ### Attempt 2
628
+
629
+ - dedicated diagnosis;
630
+ - mở rộng context vừa phải;
631
+ - caller/test/failure-adjacent evidence;
632
+ - không vá speculative chồng lên patch cũ.
633
+
634
+ ### Attempt 3
635
+
636
+ - deep recovery;
637
+ - semantic + graph + Git context;
638
+ - critic;
639
+ - re-investigate failed hypothesis;
640
+ - architecture/coupling review khi cần.
375
641
 
376
642
  ---
377
643
 
378
- ## Subagents
644
+ # Task graph, Dynamic Workflow và parallel runtime
379
645
 
380
- | Subagent | Vai trò |
381
- |---|---|
382
- | `ues-codebase-mapper` | Lập bản đồ repository, entry point, boundary, hotspot, contract và test surface |
383
- | `ues-architect` | Phân tích kiến trúc và phạm vi ảnh hưởng |
384
- | `ues-plan-checker` | Kiểm tra SPEC/PLAN trước khi cho phép thực thi |
385
- | `ues-executor` | Thực hiện một task đã được phê duyệt trong context mới |
386
- | `ues-debugger` | Điều tra nguyên nhân gốc của lỗi |
387
- | `ues-researcher` | Kiểm tra tài liệu, API và phiên bản hiện hành |
388
- | `ues-reviewer` | Review correctness, regression, security và compatibility |
389
- | `ues-critic` | Tìm giả định sai, counterexample và điểm yếu trong phương án |
390
- | `ues-verifier` | Xác minh độc lập theo acceptance criteria |
391
- | `ues-integration-verifier` | Kiểm tra tích hợp giữa nhiều task và luồng end-to-end |
392
- | `ues-visual-verifier` | Xác minh độc lập screenshot/geometry/responsive/interaction mà không sửa code |
393
- | `ues-merge-arbiter` | Hòa giải conflict giữa các task đã verify theo intent/evidence, không push/publish/deploy |
646
+ Structured plan dùng JSON schema version 1.
647
+
648
+ Mỗi task có thể khai báo:
649
+
650
+ - id;
651
+ - title;
652
+ - summary;
653
+ - dependsOn;
654
+ - files create/modify/test/delete/read;
655
+ - acceptance;
656
+ - verification;
657
+ - optional verificationCommands;
658
+ - risk.
659
+
660
+ ## Dependency validation
661
+
662
+ UES kiểm tra:
663
+
664
+ - duplicate IDs;
665
+ - missing dependency;
666
+ - self dependency;
667
+ - cycles;
668
+ - path escape;
669
+ - acceptance/verification thiếu;
670
+ - invalid risk.
671
+
672
+ ## Safe waves
673
+
674
+ ~~~mermaid
675
+ flowchart TD
676
+ PLAN[PLAN tasks] --> DAG[Dependency DAG]
677
+ DAG --> READY[Ready tasks]
678
+ READY --> FILES[Read/write file scope]
679
+ FILES --> CONFLICT{Conflict?}
680
+
681
+ CONFLICT -->|No| SAME[Same safe wave]
682
+ CONFLICT -->|Yes| SERIAL[Serialize]
683
+
684
+ SAME --> PAR[Bounded parallel execution]
685
+ SERIAL --> NEXT[Later wave]
686
+ ~~~
687
+
688
+ Read/read overlap có thể chạy cùng wave. Writer xung đột với reader/writer sẽ bị serialize nếu scope overlap hoặc không đủ rõ.
394
689
 
395
- `ues-executor` là subagent chính có quyền sửa code theo scope được giao. Các agent còn lại chủ yếu phục vụ phân tích, review và xác minh.
690
+ ## Dynamic Workflow
691
+
692
+ <code>lib/dynamic-workflow.mjs</code> phân task thành:
693
+
694
+ - deterministic;
695
+ - inline;
696
+ - agent;
697
+ - vision-related work.
698
+
699
+ ~~~mermaid
700
+ flowchart LR
701
+ T[Task] --> K{Kind}
702
+ K -->|test lint typecheck compile| DET[Deterministic]
703
+ K -->|small bounded reasoning| INLINE[Inline]
704
+ K -->|independent substantial work| AG[Agent]
705
+ K -->|visual judgment| VISION[Vision agent]
706
+
707
+ DET --> SAVE[No unnecessary executor slot]
708
+ INLINE --> SAVE
709
+ AG --> SLOT[LLM slot]
710
+ VISION --> VSLOT[Vision slot]
711
+ ~~~
712
+
713
+ V14.1 có fast path: deterministic read-only task có thể bỏ executor nhưng **verifier vẫn phải PASS**.
396
714
 
397
715
  ---
398
716
 
399
- ## Slash commands
717
+ # Worktree sandbox
400
718
 
401
- Trên OpenCode 1.x, UES tiếp tục cài các command Markdown native. Trên OpenCode V2, 11 lệnh `/ues-*` được cài dưới dạng **prompt aliases** của `ues-router`: UI gửi chúng qua đường `session.prompt` đang ổn định, router mới mở rộng template UES. Cách này tránh phụ thuộc vào `session.command` V2 khi endpoint custom-command trả lỗi transport/content-type. Cú pháp người dùng không đổi, cả hai dạng đều hợp lệ:
719
+ Parallel writers không được cùng sửa một checkout.
402
720
 
403
- ```text
404
- /ues-run <yêu cầu>
405
- ```
721
+ ~~~mermaid
722
+ sequenceDiagram
723
+ participant R as Root repo
724
+ participant U as UES Scheduler
725
+ participant W1 as Worktree T1
726
+ participant W2 as Worktree T2
406
727
 
407
- hoặc:
728
+ U->>R: inspect dirty state
729
+ U->>W1: create isolated worktree
730
+ U->>W2: create isolated worktree
408
731
 
409
- ```text
410
- /ues-run
732
+ W1->>W1: execute + verify T1
733
+ W2->>W2: execute + verify T2
411
734
 
412
- <yêu cầu nhiều dòng>
413
- ```
735
+ U->>W1: inspect changed files
736
+ U->>W2: inspect changed files
737
+ U->>R: conflict check
414
738
 
415
- Trên V2 các alias này có thể không xuất hiện trong autocomplete slash menu vì UES chủ động không đăng ký native custom-command để tránh đường `session.command` đang lỗi; vẫn có thể gõ trực tiếp `/ues-run`, `/ues-fix`, v.v.
739
+ alt safe integration
740
+ U->>R: apply T1 patch
741
+ U->>R: apply T2 patch
742
+ else conflict/failure
743
+ U->>R: refuse or rollback integrated wave
744
+ end
745
+ ~~~
416
746
 
417
- Sau khi nâng cấp từ bản V13 cũ, chạy `ocskill install`; installer sẽ xóa các native UES command file cũ do chính UES quản lý để OpenCode V2 không còn bắt chúng qua `session.command`.
747
+ ## Safety của worktree
418
748
 
419
- | Lệnh | Công dụng |
420
- |---|---|
421
- | `/ues-feature` | Triển khai feature theo workflow UES |
422
- | `/ues-fix` | Điều tra nguyên nhân rồi sửa bug |
423
- | `/ues-plan` | Lập kế hoạch triển khai có thể thực thi |
424
- | `/ues-debug` | Điều tra lỗi build, runtime hoặc test |
425
- | `/ues-research` | Kiểm tra docs, API, package hoặc version |
426
- | `/ues-review` | Review code hoặc diff |
427
- | `/ues-verify` | Xác minh bằng evidence mới |
428
- | `/ues-critique` | Tìm assumption sai và counterexample |
429
- | `/ues-audit` | Audit repository hoặc một khu vực |
430
- | `/ues-run` | Chạy workflow long-horizon với durable state |
431
- | `/ues-resume` | Tiếp tục work item từ `.ues-work` |
749
+ - root dirty mặc định bị chặn nếu không dùng explicit inheritance;
750
+ - dirty root có thể được snapshot vào sandbox theo policy;
751
+ - integration kiểm tra overlap với thay đổi root;
752
+ - branch cleanup chỉ xóa branch namespace UES;
753
+ - rollback dùng reverse patch;
754
+ - không force-push.
432
755
 
433
756
  ---
434
757
 
435
- ## Task policy và model policy
758
+ # Evidence Store, receipts và verification gates
436
759
 
437
- Phân loại yêu cầu kỹ thuật:
760
+ ## Evidence Store
438
761
 
439
- ```cmd
440
- ocskill task-policy "your engineering request"
441
- ```
762
+ UES có content-addressed Evidence Store.
442
763
 
443
- Kiểm tra model policy:
764
+ ~~~mermaid
765
+ flowchart LR
766
+ RAW[Raw output / artifact] --> HASH[SHA-256]
767
+ HASH --> STORE[Evidence Store]
768
+ STORE --> REF[evidence:sha256:...]
769
+ REF --> RECEIPT[Verification / memory / gate receipt]
770
+ REF --> GET[Bounded retrieval]
771
+ ~~~
444
772
 
445
- ```cmd
446
- ocskill model-policy executor --attempt 1 --text "your engineering request"
447
- ```
773
+ CLI:
448
774
 
449
- UES dùng ba model tier:
775
+ ~~~text
776
+ ues store status .
777
+ ues store put ...
778
+ ues store get evidence:sha256:<hash>
779
+ ues store gc .
780
+ ~~~
450
781
 
451
- ```text
452
- light
453
- standard
454
- heavy
455
- ```
782
+ ## Verification receipts
456
783
 
457
- Xem cấu hình:
784
+ Receipt có thể bind:
458
785
 
459
- ```cmd
460
- ocskill models status
461
- ```
786
+ - command result;
787
+ - output digest;
788
+ - before/after workspace fingerprint;
789
+ - verifier;
790
+ - verdict;
791
+ - active run/task.
462
792
 
463
- Bật model policy:
793
+ Mục tiêu là tránh tình trạng:
464
794
 
465
- ```cmd
466
- ocskill models on
467
- ```
795
+ ~~~text
796
+ test từng PASS ở trạng thái A
797
+ → code thay đổi sang trạng thái B
798
+ → model vẫn dùng PASS cũ để tuyên bố hoàn thành
799
+ ~~~
468
800
 
469
- Gán model cho từng tier:
801
+ ## Gate model
470
802
 
471
- ```cmd
472
- ocskill models set light provider/cheap
473
- ocskill models set standard provider/mid
474
- ocskill models set heavy provider/strong
475
- ```
803
+ ~~~mermaid
804
+ flowchart TD
805
+ PLAN[Plan] --> PG[Plan checker]
806
+ PG --> PR[Plan receipt]
807
+ PR --> EXEC[Execution]
476
808
 
477
- Gán tier theo role:
809
+ EXEC --> TV[Task verifier]
810
+ TV --> TR[Task verification receipt]
478
811
 
479
- ```cmd
480
- ocskill models role executor standard
481
- ocskill models role plan-checker heavy
482
- ```
812
+ TR --> INT[Integration verifier]
813
+ INT --> IR[Integration receipt]
483
814
 
484
- Model ID do người dùng cấu hình vẫn là nguồn quyết định cuối cùng; UES không tự đoán provider/model ID.
815
+ IR --> FP{Workspace fingerprint unchanged?}
816
+ FP -->|Yes| FINAL[Finalize]
817
+ FP -->|No| INVALID[Receipt stale - reverify]
818
+ ~~~
485
819
 
486
820
  ---
487
821
 
488
- ## Công cụ CLI
822
+ # V14.1 reversible output compaction
823
+
824
+ Mục tiêu của V14.1 là giảm model-visible noise mà **không bỏ raw evidence**.
825
+
826
+ ~~~mermaid
827
+ flowchart TD
828
+ OUT[Large CLI/tool output] --> SIZE{Over limit?}
829
+ SIZE -->|No| RAW[Return unchanged]
830
+ SIZE -->|Yes| SAVE[Store exact raw bytes in Evidence Store]
831
+ SAVE --> PREVIEW[Build head + high-signal + tail preview]
832
+ PREVIEW --> MODEL[Send bounded preview to model]
833
+ MODEL --> NEED{Need more?}
834
+ NEED -->|Yes| REF[Retrieve exact slices by evidence ref]
835
+ NEED -->|No| CONT[Continue]
836
+ ~~~
837
+
838
+ Default model-visible limit hiện khoảng 64 KiB.
839
+
840
+ High-signal lines ưu tiên các pattern như:
841
+
842
+ - error;
843
+ - failed;
844
+ - exception;
845
+ - warning;
846
+ - timeout;
847
+ - traceback;
848
+ - mismatch;
849
+ - conflict;
850
+ - passed;
851
+ - tests;
852
+ - exit code;
853
+ - changed.
854
+
855
+ ## Quan trọng
856
+
857
+ - thinking level không bị hạ bởi compaction;
858
+ - raw output được lưu trước khi compact;
859
+ - small output giữ nguyên;
860
+ - failure của compaction fail-open về raw output.
489
861
 
490
- | Lệnh | Công dụng |
491
- |---|---|
492
- | `ocskill inspect [dir]` | Phát hiện stack, package manager, root và test command |
493
- | `ocskill repo-graph [dir] [--compact] [--max-files N]` | Lập import graph; dùng `--compact` để lấy hotspot/counts trước, tránh đổ toàn bộ edges trên repo lớn |
494
- | `ocskill impact <query> [dir]` | Tìm phạm vi ảnh hưởng theo symbol hoặc từ khóa |
495
- | `ocskill evidence [dir]` | Thu thập snapshot về repository, verification và Git |
496
- | `ocskill working-tree [dir]` | Kiểm tra branch, HEAD và working tree |
497
- | `ocskill text-read <file> [--start N] [--max N]` | Đọc bounded UTF-8/UTF-16 an toàn khi generic Read nhận nhầm text là binary |
498
- | `ocskill review-scope [base] [dir]` | Phân tích changed-file coverage và risk hint |
499
- | `ocskill verification-plan [dir]` | Đề xuất verification phù hợp với project |
500
- | `ocskill task-graph <PLAN.json>` | Kiểm tra DAG và tính safe waves |
501
- | `ocskill context-pack <slug> <task> [dir]` | Tạo bounded handoff cho executor |
502
- | `ocskill work ...` | Điều khiển durable long-task state machine |
862
+ ---
503
863
 
504
- Ví dụ:
864
+ # V14.2 Turbo Weak-Model Runtime
865
+
866
+ V14.2 tối ưu hot path cho model yếu/siêu yếu mà không hạ thinking hoặc bỏ verification gate.
867
+
868
+ ~~~mermaid
869
+ flowchart TD
870
+ T[Task] --> P[Task Policy]
871
+ P --> C[Adaptive context]
872
+ C --> G[Semantic + dependency graph rank]
873
+ G --> S[Bounded micro-skills]
874
+ S --> W[Warm Pi RPC worker]
875
+
876
+ W --> E[Executor]
877
+ E --> R[Tool-boundary verification receipts]
878
+ R --> V[Verifier]
879
+
880
+ V -->|fresh receipt fully covers check| REUSE[Reuse exact PASS receipt]
881
+ V -->|missing/stale/high-risk| RUN[Run fresh check]
882
+
883
+ REUSE --> IV[Integration verification when required]
884
+ RUN --> IV
885
+
886
+ E --> O[Large tool output]
887
+ O --> COMP[Command-aware compaction]
888
+ COMP --> RAW[Raw bytes in Evidence Store]
889
+ RAW --> REC[Selective recovery on demand]
890
+ ~~~
891
+
892
+ Các thay đổi chính:
893
+
894
+ - warm Pi RPC worker pool với fresh session giữa specialist runs;
895
+ - interactive steering/abort khi một child đang active;
896
+ - unified process-tree supervisor + bounded I/O drain;
897
+ - rolling Jest/open-handle detection;
898
+ - adaptive role-aware context budgets;
899
+ - runtime context + dependency-graph cache theo workspace fingerprint;
900
+ - bounded micro-skill compiler thay vì load toàn bộ skill catalog;
901
+ - affected-test hints;
902
+ - verification receipt reuse chỉ khi fingerprint còn nguyên;
903
+ - high-risk verifier không dùng receipt reuse optimization;
904
+ - child test/lint/typecheck/build có timeout theo profile;
905
+ - full shell output được recover từ Pi `fullOutputPath` khi có;
906
+ - command-aware reversible compaction ngay ở child tool-result boundary;
907
+ - JSON evidence selector để lấy đúng subtree;
908
+ - personalized dependency graph ranking;
909
+ - task-specific Browser MCP subset;
910
+ - confidence-bound weak-model routing;
911
+ - DEEP task auto-promote sang `.ues-work` durable workflow;
912
+ - paired benchmark có turbo promotion gate: **quality non-regression + efficiency gain + zero controller false-PASS**.
913
+
914
+ Các optimization quan trọng có thể rollback riêng:
915
+
916
+ ~~~text
917
+ UES_CHILD_RUNTIME=cli
918
+ UES_ADAPTIVE_CONTEXT=0
919
+ UES_MICRO_SKILLS=0
920
+ UES_AFFECTED_TEST_HINTS=0
921
+ UES_CHILD_TOOL_COMPACTION=0
922
+ ~~~
923
+
924
+ Chi tiết: `docs/V14.2-TURBO-WEAK-MODEL-RUNTIME.md`.
925
+
926
+ ---
505
927
 
506
- ```cmd
507
- ocskill repo-graph . --compact
508
- ocskill review-scope main .
509
- ocskill verification-plan .
510
- ocskill task-graph .ues-work/checkout/PLAN.json
511
- ocskill work status checkout .
512
- ```
928
+ # Verified Persistent Memory
929
+
930
+ Memory của UES không phải “chat memory tự do”. Retrieval chỉ dùng memory đủ điều kiện.
931
+
932
+ ~~~mermaid
933
+ flowchart TD
934
+ EXPERIENCE[Task outcome] --> CAND[Memory candidate]
935
+ CAND --> EVID{Has durable evidence?}
936
+ EVID -->|No| DROP[Not retrievable]
937
+ EVID -->|Yes| VER{Verifier PASS?}
938
+ VER -->|No| DROP
939
+ VER -->|Yes| VM[Verified memory]
940
+
941
+ VM --> RANK[Hybrid retrieval]
942
+ RANK --> LEX[Lexical relevance]
943
+ RANK --> VEC[Deterministic vector similarity]
944
+ RANK --> FILE[File affinity]
945
+ RANK --> REC[Recency/confidence]
946
+ RANK --> TASK[Task-class affinity]
947
+
948
+ LEX --> TOP[Bounded top memories]
949
+ VEC --> TOP
950
+ FILE --> TOP
951
+ REC --> TOP
952
+ TASK --> TOP
953
+ ~~~
954
+
955
+ Memory hỗ trợ:
956
+
957
+ - candidate / verified / superseded lifecycle;
958
+ - confidence;
959
+ - expiry;
960
+ - task-class affinity;
961
+ - usage accounting;
962
+ - evidence references;
963
+ - supersession.
964
+
965
+ CLI:
966
+
967
+ ~~~text
968
+ ues memory status .
969
+ ues memory retrieve ...
970
+ ues memory propose ...
971
+ ues memory verify ...
972
+ ues memory supersede ...
973
+ ~~~
513
974
 
514
975
  ---
515
976
 
516
- ## Skills
977
+ # Capability Fabric
517
978
 
518
- V11 stable hiện có **48 skills**; V10 stable có 39. Router vẫn chỉ chọn tập skill phù hợp thay vì nạp toàn bộ catalog vào mỗi task.
979
+ Capability Fabric giúp model không phải tự đoán backend/tool nào đang khỏe.
519
980
 
520
- Một số process skill quan trọng:
981
+ ## Built-in capability groups
521
982
 
522
- - `ues-engineering-orchestrator`
523
- - `ues-repo-explorer`
524
- - `ues-context-engineering`
525
- - `ues-task-planner`
526
- - `ues-change-impact-analysis`
527
- - `ues-bug-diagnosis`
528
- - `ues-test-driven-development`
529
- - `ues-test-verification`
530
- - `ues-code-review`
531
- - `ues-research-verification`
532
- - `ues-long-task-state`
533
- - `ues-git-safety`
983
+ Source hiện có các nhóm như:
534
984
 
535
- Nhóm domain/framework hiện bao gồm React, Next.js, React Native, Node.js, NestJS, Python, Django, FastAPI, .NET, Java/Spring, Flutter, database, REST/API contract, authentication/security, payment, ecommerce, file upload, DevOps, UI/UX, accessibility và performance.
985
+ - code.search;
986
+ - memory;
987
+ - evidence;
988
+ - output.compaction;
989
+ - filesystem;
990
+ - git;
991
+ - agent.host;
992
+ - github;
993
+ - browser.
994
+
995
+ ~~~mermaid
996
+ flowchart TD
997
+ NEED[Required capability] --> REG[Provider registry]
998
+ REG --> PROBE[Health probe]
999
+ PROBE --> SCORE[Score]
1000
+
1001
+ OBS[Persisted success/failure/latency] --> SCORE
1002
+ QUALITY[Quality] --> SCORE
1003
+ COST[Cost class] --> SCORE
1004
+ LAT[Latency class] --> SCORE
1005
+
1006
+ SCORE --> PRIMARY[Selected provider]
1007
+ SCORE --> FALLBACK[Fallback providers]
1008
+ ~~~
1009
+
1010
+ Provider score xét:
1011
+
1012
+ - configured priority;
1013
+ - quality;
1014
+ - current health;
1015
+ - historical success/failure;
1016
+ - cost class;
1017
+ - latency class.
1018
+
1019
+ ## Output compaction providers
1020
+
1021
+ V14.1 có registry cho:
1022
+
1023
+ - built-in <code>ues-reversible-compactor</code> — mặc định;
1024
+ - RTK CLI — optional;
1025
+ - Caveman CLI — optional experimental;
1026
+ - Headroom CLI — optional experimental.
1027
+
1028
+ Detection **không có nghĩa auto-enable** external provider.
536
1029
 
537
1030
  ---
538
1031
 
539
- ## Tương thích OpenCode
1032
+ # Playwright / Browser MCP on-demand
1033
+
1034
+ UES có browser adapter/runtime riêng và thêm routing cho Playwright/Browser MCP đang có trong Pi host.
540
1035
 
541
- ### OpenCode 1.x
1036
+ Mục tiêu: browser tools chỉ xuất hiện khi task thực sự cần browser/visual evidence.
542
1037
 
543
- - cài skill, command và subagent;
544
- - dùng frontmatter tương thích V1;
545
- - không cài V2 runtime plugin;
546
- - durable long-task CLI vẫn dùng được;
547
- - không có V2 `ues.dispatch_task`.
1038
+ ~~~mermaid
1039
+ flowchart TD
1040
+ TASK[Task] --> NEED{Needs browser or visual evidence?}
548
1041
 
549
- ### OpenCode 2.x
1042
+ NEED -->|No| NORMAL[Normal agent tool allowlist]
1043
+ NEED -->|Yes| DISCOVER[Inspect host Pi tool registry]
550
1044
 
551
- Ngoài resource file, UES cài managed plugin tại:
1045
+ DISCOVER --> SELECT[Select Playwright/browser tools]
1046
+ SELECT --> CHILD[Add selected names to child --tools]
552
1047
 
553
- ```text
554
- ~/.config/opencode/plugins/ues-router/
555
- ```
1048
+ CHILD --> SNAP[Semantic/accessibility snapshot]
1049
+ CHILD --> INT[Targeted interaction]
1050
+ CHILD --> LOG[Console/network evidence]
1051
+ CHILD --> SHOT[Screenshot when visual proof needed]
556
1052
 
557
- Plugin cung cấp:
1053
+ SNAP --> VV[Visual verifier]
1054
+ INT --> VV
1055
+ LOG --> VV
1056
+ SHOT --> VV
558
1057
 
559
- - automatic skill routing;
560
- - context guardrail;
561
- - permission safety gate;
562
- - read-only long-task helpers;
563
- - fresh-session executor runtime qua `ues.dispatch_task` và same-model parallel runtime qua `ues.dispatch_parallel`.
1058
+ VV -->|PASS| DONE[Visual claim verified]
1059
+ VV -->|FAIL / no evidence| STOP[No browser-visible PASS claim]
1060
+ ~~~
564
1061
 
565
- Điều khiển router:
1062
+ ## Routing behavior
566
1063
 
567
- ```cmd
568
- ocskill router status
569
- ocskill router on --max 4
570
- ocskill router off
571
- ```
1064
+ ### Backend task
1065
+
1066
+ Ví dụ:
1067
+
1068
+ ~~~text
1069
+ /ues-run sửa transaction inventory backend và chạy test
1070
+ ~~~
1071
+
1072
+ Playwright không cần được thêm vào child agent.
1073
+
1074
+ ### Browser E2E task
1075
+
1076
+ Ví dụ:
1077
+
1078
+ ~~~text
1079
+ /ues-run kiểm tra checkout form bằng browser, click flow và console error
1080
+ ~~~
1081
+
1082
+ Browser MCP lane được yêu cầu.
1083
+
1084
+ ### Visual task
1085
+
1086
+ Ví dụ:
1087
+
1088
+ ~~~text
1089
+ /ues-run sửa giao diện theo ảnh mẫu và kiểm tra responsive
1090
+ ~~~
1091
+
1092
+ Sau code verifier/integration verifier, UES có thể chạy thêm <code>ues-visual-verifier</code>.
1093
+
1094
+ ## Evidence order
1095
+
1096
+ UES ưu tiên:
1097
+
1098
+ 1. semantic/accessibility snapshot;
1099
+ 2. DOM/target state;
1100
+ 3. targeted interaction;
1101
+ 4. console/network evidence;
1102
+ 5. viewport checks;
1103
+ 6. screenshot khi cần visual proof.
1104
+
1105
+ ## Browser security
1106
+
1107
+ Webpage text, accessibility content, console output và network payload được coi là **untrusted external evidence**.
1108
+
1109
+ Page content không được:
1110
+
1111
+ - thay đổi permissions;
1112
+ - yêu cầu secret;
1113
+ - override system/task instructions;
1114
+ - tự cấp quyền external/destructive side effect.
1115
+
1116
+ ## Optional overrides
1117
+
1118
+ Nếu Browser MCP dùng tên tool lạ:
1119
+
1120
+ ~~~cmd
1121
+ set UES_BROWSER_MCP_TOOL_NAMES=browser_navigate,browser_snapshot,browser_screenshot,browser_click
1122
+ set UES_BROWSER_MCP_TOOL_LIMIT=14
1123
+ ~~~
572
1124
 
573
1125
  ---
574
1126
 
575
- ## Safety
1127
+ # Trajectory và observability
1128
+
1129
+ <code>lib/trajectory.mjs</code> lưu **operational events**, không lưu hidden chain-of-thought.
1130
+
1131
+ ~~~mermaid
1132
+ flowchart LR
1133
+ RUN[Agent run] --> EVT[Observable event]
1134
+ EVT --> SCRUB[Secret redaction]
1135
+ SCRUB --> LIMIT[Bound event size]
1136
+ LIMIT --> JSONL[.ues-traces trace.jsonl]
1137
+
1138
+ JSONL --> SHOW[trace show]
1139
+ JSONL --> DEBUG[Debug/replay analysis]
1140
+ ~~~
1141
+
1142
+ Trajectory scrub các dạng dữ liệu như:
576
1143
 
577
- OpenCode V2 permission gate yêu cầu xác nhận rõ ràng trước các thao tác có tác động lớn, ví dụ:
1144
+ - Authorization Bearer;
1145
+ - OpenAI-style API keys;
1146
+ - GitHub tokens;
1147
+ - npm tokens;
1148
+ - generic api_key/token/secret/password/credential fields.
578
1149
 
579
- - `git push --force` hoặc `git push -f`;
580
- - `git reset --hard`;
581
- - destructive `git clean`;
582
- - `npm publish`;
583
- - recursive forced deletion;
584
- - `DROP` hoặc `TRUNCATE`;
585
- - Terraform, Kubernetes hoặc Helm action có tác động lớn.
1150
+ Large event payload được bounded và có SHA-256 digest.
586
1151
 
587
- Safety hook là lớp bảo vệ deterministic bổ sung, không thay thế review của người dùng.
1152
+ CLI:
1153
+
1154
+ ~~~text
1155
+ ues trace append ...
1156
+ ues trace show ...
1157
+ ~~~
588
1158
 
589
1159
  ---
590
1160
 
591
- ## Learning loop
1161
+ # Learning engine và benchmark confidence
1162
+
1163
+ Learning của UES được thiết kế theo hướng **proposal → shadow evidence → promotion**, không phải “agent fail một lần rồi tự sửa rule vĩnh viễn”.
592
1164
 
593
- Phân tích eval trace:
1165
+ ~~~mermaid
1166
+ flowchart TD
1167
+ EVAL[Eval artifacts] --> ANALYZE[Analyze recurring failures]
1168
+ ANALYZE --> PROP[Learning proposal]
1169
+ PROP --> ACCEPT[Manual acceptance]
1170
+ ACCEPT --> SHADOW[Shadow benchmark required]
594
1171
 
595
- ```cmd
596
- ocskill learn analyze . --eval-dir .ues-evals
597
- ```
1172
+ SHADOW --> PAIR[Paired baseline vs UES]
1173
+ PAIR --> CONF[Statistical confidence checks]
598
1174
 
599
- Xem trạng thái:
1175
+ CONF -->|Eligible| PROMOTE[Promote learning]
1176
+ CONF -->|Not eligible| HOLD[Keep unpromoted]
1177
+ ~~~
600
1178
 
601
- ```cmd
602
- ocskill learn status .
603
- ```
1179
+ ## Failure patterns được phân tích
604
1180
 
605
- Chấp nhận một proposal trước khi thử nghiệm:
1181
+ Ví dụ:
606
1182
 
607
- ```cmd
608
- ocskill learn accept <proposal-id> .
609
- ```
1183
+ - hard-timeout;
1184
+ - idle-timeout;
1185
+ - agent-exit;
1186
+ - grader-failure;
1187
+ - orchestration-failure;
1188
+ - telemetry parse errors.
610
1189
 
611
- Sau khi shadow benchmark chứng minh candidate tốt hơn baseline:
1190
+ ## Promotion confidence
612
1191
 
613
- ```cmd
614
- ocskill learn promote <proposal-id> . --baseline 0.50 --candidate 0.75 --samples 4
615
- ```
1192
+ <code>lib/benchmark-confidence.mjs</code> so sánh paired baseline/UES:
616
1193
 
617
- Proposal có `shadowRequired` chỉ được đưa trở lại context sau khi vừa được chấp nhận rõ ràng vừa có benchmark improvement đo được.
1194
+ - total paired samples;
1195
+ - both pass;
1196
+ - both fail;
1197
+ - baseline-only win;
1198
+ - UES-only win;
1199
+ - pass-rate delta;
1200
+ - exact sign-test p-value;
1201
+ - per-suite regression;
1202
+ - duration ratio;
1203
+ - initial input ratio;
1204
+ - token ratio;
1205
+ - cost summary.
1206
+
1207
+ Promotion yêu cầu nhiều điều kiện cùng đạt, không chỉ “UES thắng một vài task”.
618
1208
 
619
1209
  ---
620
1210
 
621
- ## Hermes adapter
1211
+ # Durable long-horizon work
622
1212
 
623
- V11 giữ Hermes theo dạng **optional sidecar**, không nhúng Hermes runtime vào core. UES vẫn sở hữu durable state, evidence và safety boundaries:
1213
+ Task dài có thể dùng <code>.ues-work/&lt;slug&gt;/</code> làm source of truth.
624
1214
 
625
- ```cmd
626
- ocskill hermes status
627
- ocskill hermes prompt <slug> <task> .
628
- ocskill hermes exec <slug> <task> .
629
- ```
1215
+ ~~~text
1216
+ .ues-work/<slug>/
1217
+ SPEC.md
1218
+ PLAN.json
1219
+ STATE.json
1220
+ EVIDENCE.json
1221
+ EVENTS.jsonl
1222
+ ACTIVE_PLAN.json
1223
+ tasks/
1224
+ reports/
1225
+ plans/
1226
+ ~~~
1227
+
1228
+ ## State machine khái quát
1229
+
1230
+ ~~~mermaid
1231
+ stateDiagram-v2
1232
+ [*] --> Initialized
1233
+ Initialized --> Planned
1234
+ Planned --> PlanApproved
1235
+ PlanApproved --> Running
1236
+ Running --> Running: next task
1237
+ Running --> Blocked
1238
+ Blocked --> Running
1239
+ Running --> IntegrationVerification
1240
+ IntegrationVerification --> Finalized: PASS + fresh fingerprint
1241
+ IntegrationVerification --> Running: FAIL / rework
1242
+ Running --> Recovering: stale lease / interruption
1243
+ Recovering --> Running
1244
+ ~~~
1245
+
1246
+ ## Locking
1247
+
1248
+ State/evidence mutation dùng:
1249
+
1250
+ - per-work lock;
1251
+ - heartbeat;
1252
+ - stale lock recovery;
1253
+ - atomic file replacement.
1254
+
1255
+ ## Runtime events
1256
+
1257
+ <code>EVENTS.jsonl</code> append-only cho operational observability.
630
1258
 
631
- Nếu máy không có Hermes CLI, các tính năng Hermes chỉ báo unavailable và không ảnh hưởng đến core UES.
1259
+ ---
1260
+
1261
+ # Control Center
1262
+
1263
+ UES có local Control Center qua:
1264
+
1265
+ ~~~text
1266
+ ues dashboard .
1267
+ ues dashboard . --serve
1268
+ ~~~
1269
+
1270
+ Control Center tổng hợp các loại dữ liệu như:
1271
+
1272
+ - durable work;
1273
+ - task state;
1274
+ - blockers;
1275
+ - receipts;
1276
+ - recent events;
1277
+ - eval summaries;
1278
+ - learning state;
1279
+ - evidence store;
1280
+ - verified memory;
1281
+ - capability fabric health.
1282
+
1283
+ ~~~mermaid
1284
+ flowchart LR
1285
+ WORK[.ues-work] --> CC[Control Center]
1286
+ EVENTS[EVENTS.jsonl] --> CC
1287
+ EV[Evidence Store] --> CC
1288
+ MEM[Memory] --> CC
1289
+ CAP[Capability Fabric] --> CC
1290
+ LEARN[Learning] --> CC
1291
+ EVAL[Eval artifacts] --> CC
1292
+ ~~~
1293
+
1294
+ Control Center là observer/controller cục bộ; nó không bypass verification/safety gates.
632
1295
 
633
1296
  ---
634
1297
 
635
- ## UES Control Center
1298
+ # Safety model
1299
+
1300
+ UES cố gắng đưa safety vào code thay vì chỉ nhắc model.
1301
+
1302
+ ## Shell safety
1303
+
1304
+ Có detection/gate cho các thao tác rủi ro như:
1305
+
1306
+ - force push;
1307
+ - history rewrite;
1308
+ - reset hard;
1309
+ - recursive destructive deletion;
1310
+ - destructive database commands;
1311
+ - deploy/apply;
1312
+ - publish.
1313
+
1314
+ ## Scope safety
1315
+
1316
+ Structured task phải khai báo file scope. Scheduler kiểm tra actual changed files so với declared write scope.
1317
+
1318
+ ## Parallel safety
1319
+
1320
+ Writer agents chạy parallel phải ở distinct worktree/cwd.
636
1321
 
637
- Tạo dashboard tĩnh:
1322
+ ## Evidence safety
638
1323
 
639
- ```cmd
640
- ocskill dashboard .
641
- ```
1324
+ Old PASS không tự được coi là hợp lệ nếu workspace đã thay đổi.
642
1325
 
643
- Chạy dashboard có tự refresh:
1326
+ ## Browser safety
644
1327
 
645
- ```cmd
646
- ocskill dashboard . --serve --port 4177
647
- ```
1328
+ External page content là untrusted.
648
1329
 
649
- Control Center hiển thị work state, verification receipts, runtime events, learning proposals và eval summary; server mode có safe stale-recovery action.
1330
+ ## Memory safety
1331
+
1332
+ Candidate hoặc superseded memory không được retrieval như verified memory.
1333
+
1334
+ ## Learning safety
1335
+
1336
+ Proposal không tự promote nếu chưa có benchmark evidence phù hợp.
650
1337
 
651
1338
  ---
652
1339
 
653
- ## Sandbox cho tác vụ ghi song song
1340
+ # Cài đặt
654
1341
 
655
- Tạo isolated Git worktree:
1342
+ ## Yêu cầu
656
1343
 
657
- ```cmd
658
- ocskill sandbox create <slug> <task-id> .
659
- ```
1344
+ - Node.js 22.19+
1345
+ - Git
1346
+ - Pi Agent
660
1347
 
661
- Tích hợp sandbox sau khi đã inspect/verify:
1348
+ Cài Pi:
662
1349
 
663
- ```cmd
664
- ocskill sandbox integrate <worktree-path> .
665
- ```
1350
+ ~~~cmd
1351
+ npm install -g @earendil-works/pi-coding-agent
1352
+ pi --version
1353
+ ~~~
666
1354
 
667
- Liệt kê sandbox:
1355
+ Cài UES trực tiếp từ GitHub:
668
1356
 
669
- ```cmd
670
- ocskill sandbox list .
671
- ```
1357
+ ~~~cmd
1358
+ pi install git:github.com/laivannha0202/opencode-agent-skill-
1359
+ pi list
1360
+ pi
1361
+ ~~~
672
1362
 
673
- Integration sẽ từ chối ghi đè lên file đang dirty ở root. Safe-wave scheduling chỉ bảo vệ declared file scope. Generated file, lockfile hoặc shared write surface ngầm định vẫn nên được serialize khi cần.
1363
+ Nếu đã clone repo local:
1364
+
1365
+ ~~~cmd
1366
+ cd /d E:\Code\opencode-agent-skill-
1367
+ npm install
1368
+ pi install .
1369
+ ~~~
674
1370
 
675
1371
  ---
676
1372
 
677
- ## Evaluation
1373
+ # Cập nhật
678
1374
 
679
- V11 hiện có:
1375
+ Nếu cài từ clone local:
680
1376
 
681
- - **43 static skill-routing scenarios** phủ 48 skills;
682
- - **129 V2 router cases** với required routes và negative guards;
683
- - **13 V11 contract tasks** across 6 categories;
684
- - **20 standard live tasks**;
685
- - **5 long-horizon tasks**;
686
- - **8 polyglot tasks** cho Python, Java, .NET, Next.js, React Native, SQL migration, monorepo và generated contract;
687
- - benchmark matrix baseline-vs-UES nhiều trial;
688
- - một long task tích hợp tới **15 source modules**.
1377
+ ~~~cmd
1378
+ cd /d E:\Code\opencode-agent-skill-
1379
+ git status
1380
+ git pull --ff-only origin main
1381
+ pi install .
1382
+ ~~~
689
1383
 
690
- Kiểm tra static routing:
1384
+ Nếu local có thay đổi chưa commit, hãy backup/stash hoặc xử lý diff trước khi pull. Không nên reset/clean mù quáng.
691
1385
 
692
- ```cmd
693
- npm run evals
694
- ```
1386
+ ---
695
1387
 
696
- Kiểm tra V2 router:
1388
+ # Đóng gói npm
697
1389
 
698
- ```cmd
699
- npm run evals:router
700
- ```
1390
+ Kiểm tra đầy đủ trước khi pack:
701
1391
 
702
- Kiểm tra standard hidden graders:
1392
+ ~~~cmd
1393
+ npm install
1394
+ npm run ci
1395
+ npm pack --dry-run
1396
+ npm pack
1397
+ ~~~
703
1398
 
704
- ```cmd
705
- npm run evals:live:validate
706
- ```
1399
+ Package version hiện tại trong <code>package.json</code> là:
707
1400
 
708
- Kiểm tra long-horizon và polyglot suite:
1401
+ ~~~text
1402
+ 14.2.0-beta.1
1403
+ ~~~
709
1404
 
710
- ```cmd
711
- npm run evals:long:validate
712
- npm run evals:polyglot:validate
713
- npm run evals:v11:validate
714
- ```
1405
+ V14.2 Turbo Weak-Model Runtime hiện là incremental work trên package version đó.
715
1406
 
716
- Chạy benchmark với model thật:
1407
+ Test file packed với Pi:
717
1408
 
718
- ```cmd
719
- ocskill eval-live --model provider/model --trials 3
720
- ocskill eval-live --suite long --model provider/model --trials 3
721
- npm run evals:matrix -- --model provider/model --trials 3
722
- ```
1409
+ ~~~cmd
1410
+ pi install .\opencode-agent-skill-14.2.0-beta.1.tgz
1411
+ pi list
1412
+ ~~~
723
1413
 
724
- Live eval hỗ trợ heartbeat, hard timeout, idle timeout và Ctrl+C process-tree cancellation.
1414
+ Publish thật chỉ nên thực hiện sau khi CI và package smoke tests PASS.
725
1415
 
726
- Với long suite, một run UES chỉ được tính PASS khi hidden grader PASS, durable work state tồn tại, plan approval hợp lệ, toàn bộ task hoàn tất, integration verification PASS và finalization hoàn tất.
1416
+ ---
1417
+
1418
+ # Các CLI quan trọng
1419
+
1420
+ CLI ưu tiên là <code>ues</code>; <code>ocskill</code> vẫn là compatibility alias.
1421
+
1422
+ ## Repository intelligence
1423
+
1424
+ ~~~text
1425
+ ues inspect .
1426
+ ues impact <query> .
1427
+ ues evidence .
1428
+ ues working-tree .
1429
+ ues repo-graph .
1430
+ ues index status .
1431
+ ues index build .
1432
+ ues aci search ...
1433
+ ~~~
1434
+
1435
+ ## Task và verification
1436
+
1437
+ ~~~text
1438
+ ues task-policy "<task>"
1439
+ ues verification-plan .
1440
+ ues task-graph PLAN.json
1441
+ ues workflow-plan PLAN.json
1442
+ ues review-scope main .
1443
+ ~~~
1444
+
1445
+ ## Durable work
1446
+
1447
+ ~~~text
1448
+ ues work init <slug> . --goal "..."
1449
+ ues work plan <slug> PLAN.json .
1450
+ ues work approve-plan <slug> . --evidence "..."
1451
+ ues work start <slug> <task-id> .
1452
+ ues work verify-command <slug> <task-id> . --run-id <id> -- npm test
1453
+ ues work complete <slug> <task-id> . --run-id <id> --evidence "..."
1454
+ ues work verify-integration <slug> . --verdict PASS --evidence "..."
1455
+ ues work finalize <slug> . --evidence "..."
1456
+ ues work events <slug> .
1457
+ ues work resume <slug> .
1458
+ ~~~
1459
+
1460
+ ## Sandbox
1461
+
1462
+ ~~~text
1463
+ ues sandbox list .
1464
+ ues sandbox create ...
1465
+ ues sandbox integrate ...
1466
+ ues sandbox rollback ...
1467
+ ues sandbox remove ...
1468
+ ~~~
1469
+
1470
+ ## Context / memory / capability
1471
+
1472
+ ~~~text
1473
+ ues hierarchy "<query>" .
1474
+ ues hierarchy "<query>" . --full
1475
+ ues memory status .
1476
+ ues capability-fabric status .
1477
+ ues capabilities "<task>"
1478
+ ~~~
1479
+
1480
+ ## Evidence / trace
1481
+
1482
+ ~~~text
1483
+ ues store status .
1484
+ ues store get evidence:sha256:<hash>
1485
+ ues trace show ...
1486
+ ~~~
1487
+
1488
+ ## Browser / visual
1489
+
1490
+ ~~~text
1491
+ ues browser capability .
1492
+ ues browser plan ...
1493
+ ues browser inspect ...
1494
+ ues visual ...
1495
+ ues ui tokens ...
1496
+ ues ui layout ...
1497
+ ~~~
1498
+
1499
+ ## Models
1500
+
1501
+ ~~~text
1502
+ ues models status
1503
+ ues models on
1504
+ ues models set light <provider/model>
1505
+ ues models set standard <provider/model>
1506
+ ues models set heavy <provider/model>
1507
+ ues models role verifier standard
1508
+ ~~~
1509
+
1510
+ ## Learning / eval
1511
+
1512
+ ~~~text
1513
+ ues eval-pi --model provider/model --thinking low --suite live --trials 3 --mode both
1514
+ ues learn analyze . --eval-dir .ues-evals
1515
+ ~~~
727
1516
 
728
1517
  ---
729
1518
 
730
- ## Phát triển và CI
1519
+ # Benchmark model yếu
731
1520
 
732
- Yêu cầu:
1521
+ UES có Pi-native baseline-vs-UES benchmark.
733
1522
 
734
- - Node.js 20+;
735
- - npm;
736
- - Git.
1523
+ ~~~mermaid
1524
+ flowchart LR
1525
+ TASKS[Same benchmark tasks] --> B[Baseline Pi]
1526
+ TASKS --> U[Pi + UES]
737
1527
 
738
- Cài dependency mà không chạy lifecycle script:
1528
+ B --> BG[External grader]
1529
+ U --> UG[External grader]
739
1530
 
740
- ```cmd
741
- npm ci --ignore-scripts
742
- ```
1531
+ B --> BT[Tokens/cost/tool telemetry]
1532
+ U --> UT[Tokens/cost/tool telemetry]
743
1533
 
744
- Chạy toàn bộ CI:
1534
+ BG --> PAIR[Paired comparison]
1535
+ UG --> PAIR
1536
+ BT --> PAIR
1537
+ UT --> PAIR
745
1538
 
746
- ```cmd
747
- npm run ci
748
- ```
1539
+ PAIR --> CONF[Confidence / regression checks]
1540
+ ~~~
749
1541
 
750
- Pipeline hiện kiểm tra:
1542
+ Ví dụ:
1543
+
1544
+ ~~~cmd
1545
+ ues eval-pi --model provider/model --thinking low --suite live --trials 3 --mode both
1546
+ ~~~
1547
+
1548
+ Eval script thu thập:
1549
+
1550
+ - pass/fail;
1551
+ - duration;
1552
+ - parent tool calls;
1553
+ - child tool calls;
1554
+ - input/output/cache token telemetry;
1555
+ - reported cost;
1556
+ - controller usage;
1557
+ - workspace changes;
1558
+ - external grader result.
1559
+
1560
+ ## Eval suites trong repo
751
1561
 
752
- ```text
753
- syntax
754
- → resource validation
755
- → docs:check
756
- → static skill routing
757
- → V2 router matrix
758
- → standard hidden-grader integrity
759
- → long hidden-grader integrity
760
- → polyglot hidden-grader integrity
761
- → V11 contract validation
762
- → Node tests
763
- → npm pack --dry-run
764
- → packed global-install smoke
765
- → plain one-command install compatibility smoke
766
- ```
1562
+ Hiện có các nhóm như:
767
1563
 
768
- Packed smoke xác minh package cài được từ tarball và kiểm tra OpenCode V2 path, skills, commands, subagents, router plugin, task graph, durable state và model config.
1564
+ - live;
1565
+ - long;
1566
+ - polyglot;
1567
+ - repo-scale;
1568
+ - v11;
1569
+ - v14;
1570
+ - routing/router trigger suites.
769
1571
 
770
1572
  ---
771
1573
 
772
- ## Cập nhật và gỡ cài đặt
1574
+ # Cấu trúc repository
1575
+
1576
+ ~~~text
1577
+ opencode-agent-skill-/
1578
+ ├─ bin/
1579
+ │ └─ ocskill.mjs
1580
+ │
1581
+ ├─ lib/
1582
+ │ ├─ task-policy.mjs
1583
+ │ ├─ task-engine.mjs
1584
+ │ ├─ task-graph.mjs
1585
+ │ ├─ dynamic-workflow.mjs
1586
+ │ ├─ context-engine-v11.mjs
1587
+ │ ├─ hierarchical-context.mjs
1588
+ │ ├─ semantic-index.mjs
1589
+ │ ├─ repo-graph.mjs
1590
+ │ ├─ aci.mjs
1591
+ │ ├─ evidence-store.mjs
1592
+ │ ├─ evidence-receipt.mjs
1593
+ │ ├─ gate-receipt.mjs
1594
+ │ ├─ memory-engine.mjs
1595
+ │ ├─ capability-fabric.mjs
1596
+ │ ├─ model-policy.mjs
1597
+ │ ├─ model-performance.mjs
1598
+ │ ├─ worktree-sandbox.mjs
1599
+ │ ├─ container-sandbox.mjs
1600
+ │ ├─ performance-fabric.mjs
1601
+ │ ├─ trajectory.mjs
1602
+ │ ├─ learning-engine.mjs
1603
+ │ ├─ benchmark-confidence.mjs
1604
+ │ ├─ browser-adapter.mjs
1605
+ │ ├─ browser-runtime.mjs
1606
+ │ ├─ browser-mcp-routing.mjs
1607
+ │ └─ ...
1608
+ │
1609
+ ├─ pi/
1610
+ │ ├─ extensions/
1611
+ │ │ └─ ues.ts
1612
+ │ └─ prompts/
1613
+ │ └─ 11 UES slash prompts
1614
+ │
1615
+ ├─ global-config/
1616
+ │ ├─ agents/
1617
+ │ │ └─ 12 specialist agents
1618
+ │ └─ skills/
1619
+ │ └─ 48 domain/workflow skills
1620
+ │
1621
+ ├─ evals/
1622
+ │ ├─ live/
1623
+ │ ├─ long/
1624
+ │ ├─ polyglot/
1625
+ │ ├─ repo-scale/
1626
+ │ ├─ v11/
1627
+ │ └─ v14/
1628
+ │
1629
+ ├─ scripts/
1630
+ │ └─ eval, validation, smoke, install helpers
1631
+ │
1632
+ ├─ test/
1633
+ │ └─ deterministic/runtime/regression tests
1634
+ │
1635
+ └─ docs/
1636
+ ├─ ENGINEERING-DESIGN.md
1637
+ ├─ DETERMINISTIC-TOOLS.md
1638
+ ├─ V11-PERCEPTION-ADAPTIVE-EXECUTION.md
1639
+ ├─ V12-WEAK-MODEL-INTELLIGENCE.md
1640
+ ├─ V13-PARALLEL-WEAK-MODEL-RUNTIME.md
1641
+ ├─ V14-CONTEXT-MEMORY-FABRIC.md
1642
+ └─ V14.1-QUALITY-PERFORMANCE-FABRIC.md
1643
+ ~~~
1644
+
1645
+ ---
1646
+
1647
+ # Một ví dụ đầy đủ
1648
+
1649
+ Task:
1650
+
1651
+ ~~~text
1652
+ /ues-run sửa checkout inventory reservation, chạy test liên quan và xác minh UI checkout
1653
+ ~~~
773
1654
 
774
- Cập nhật lên bản npm mới nhất:
1655
+ Luồng có thể diễn ra:
775
1656
 
776
- ```cmd
777
- ocskill update
778
- ```
1657
+ ~~~mermaid
1658
+ flowchart TD
1659
+ T[User task] --> P[Task Policy STANDARD/DEEP]
1660
+ P --> C[Context selection]
1661
+ C --> R[Repo graph + semantic refs + likely tests]
1662
+ R --> E[Executor]
1663
+ E --> TEST[Targeted backend tests]
1664
+ TEST --> V[Verifier]
779
1665
 
780
- Gỡ UES:
1666
+ V -->|PASS| I[Integration verifier]
1667
+ V -->|FAIL| D[Debugger]
1668
+ D --> E
781
1669
 
782
- ```cmd
783
- ocskill remove
784
- ```
1670
+ I --> B{Visual/browser required?}
1671
+ B -->|No| DONE[Verified completion]
1672
+ B -->|Yes| MCP[Playwright MCP lane]
1673
+ MCP --> VV[Visual verifier]
1674
+ VV -->|PASS| DONE
1675
+ VV -->|FAIL| D
1676
+ ~~~
785
1677
 
786
- UES chỉ quản lý resource có namespace/marker của chính nó và cố gắng giữ nguyên resource không thuộc quyền quản lý của UES.
1678
+ Điểm khác với “một model tự làm tất cả” là:
1679
+
1680
+ 1. context được bounded;
1681
+ 2. implementation và verification tách vai;
1682
+ 3. browser evidence chỉ nạp khi cần;
1683
+ 4. retry có diagnosis;
1684
+ 5. long task có state;
1685
+ 6. parallel writers có isolation;
1686
+ 7. completion bị ràng buộc bởi evidence.
787
1687
 
788
1688
  ---
789
1689
 
790
- ## Tài liệu
1690
+ # Triết lý thiết kế
1691
+
1692
+ ## Deterministic facts trước probabilistic reasoning
1693
+
1694
+ Những việc có thể tính bằng code thì ưu tiên tính bằng code:
1695
+
1696
+ - Git state;
1697
+ - dependency graph;
1698
+ - changed files;
1699
+ - plan cycle;
1700
+ - file overlap;
1701
+ - command exit status;
1702
+ - workspace fingerprint;
1703
+ - provider health;
1704
+ - token/cost telemetry.
1705
+
1706
+ Model tập trung vào phần cần semantic judgment.
1707
+
1708
+ ## Progressive disclosure
1709
+
1710
+ Không nạp:
1711
+
1712
+ - toàn repo;
1713
+ - toàn bộ 48 skills;
1714
+ - mọi MCP tool;
1715
+ - mọi memory;
1716
+ - mọi log.
1717
+
1718
+ Chỉ nạp bounded evidence phù hợp.
1719
+
1720
+ ## Fresh specialists
1721
+
1722
+ Child specialist được tạo với prompt/tool boundary hẹp hơn để giảm contamination từ conversation dài.
791
1723
 
792
- - [Thiết kế hệ thống](docs/ENGINEERING-DESIGN.md)
793
- - [Tương thích OpenCode](docs/OPENCODE-COMPAT.md)
794
- - [Công cụ deterministic](docs/DETERMINISTIC-TOOLS.md)
795
- - [Evaluation](docs/EVALS.md)
796
- - [Trace schema](docs/TRACE-SCHEMA.md)
797
- - [Hướng dẫn publish npm](docs/NPM-PUBLISH.md)
798
- - [Nguồn nghiên cứu](docs/RESEARCH-SOURCES.md)
799
- - [V7 Intelligence Runtime](docs/V7-INTELLIGENCE-RUNTIME.md)
800
- - [V8 Intelligence & Reliability](docs/V8-INTELLIGENCE-RELIABILITY.md)
801
- - [V9 Speed & Intelligence](docs/V9-SPEED-INTELLIGENCE.md)
802
- - [V12 Weak-Model Intelligence (beta)](docs/V12-WEAK-MODEL-INTELLIGENCE.md)
803
- - [V13 Parallel Weak-Model Runtime (beta)](docs/V13-PARALLEL-WEAK-MODEL-RUNTIME.md)
1724
+ ## Evidence-first completion
1725
+
1726
+ “Agent nói đã xong” không phải completion gate.
1727
+
1728
+ ## Reversible optimization
1729
+
1730
+ Tối ưu output/context phải giữ đường lấy raw evidence trở lại.
1731
+
1732
+ ## Benchmark-gated learning
1733
+
1734
+ Không promote rule/tool/provider chỉ vì cảm giác “có vẻ nhanh”.
804
1735
 
805
1736
  ---
806
1737
 
807
- ## npm
1738
+ # Giới hạn có chủ đích
808
1739
 
809
- Package:
1740
+ UES cố ý **không**:
810
1741
 
811
- ```text
812
- opencode-agent-skill
813
- ```
1742
+ - tạo hàng trăm agents;
1743
+ - load mọi skill cho mọi task;
1744
+ - auto push;
1745
+ - auto publish;
1746
+ - auto deploy;
1747
+ - ghi hidden chain-of-thought;
1748
+ - coi keyword routing là semantic truth tuyệt đối;
1749
+ - coi import scan là full compiler/LSP semantic graph;
1750
+ - coi một benchmark là bằng chứng model-equivalence;
1751
+ - bỏ verifier chỉ để tăng tốc;
1752
+ - dùng browser tool cho backend task không cần browser.
814
1753
 
815
- Cài đặt:
1754
+ ---
816
1755
 
817
- ```cmd
818
- npm install -g opencode-agent-skill
819
- ```
1756
+ # Quick start
820
1757
 
821
- Phiên bản hiện tại:
1758
+ ~~~cmd
1759
+ npm install -g @earendil-works/pi-coding-agent
1760
+ pi install git:github.com/laivannha0202/opencode-agent-skill-
1761
+ pi
1762
+ ~~~
822
1763
 
823
- ```text
824
- 13.0.0-beta.2
825
- ```
1764
+ Trong Pi:
826
1765
 
827
- V13 beta dùng npm dist-tag `next`; `latest` tiếp tục trỏ tới V11 stable cho đến khi các release gate V13 hoàn tất.
1766
+ ~~~text
1767
+ /ues-run kiểm tra project, tìm lỗi, sửa lỗi cần thiết và chạy test xác minh
1768
+ ~~~
828
1769
 
829
- Maintainer packaging gate:
1770
+ Kiểm tra deterministic runtime:
830
1771
 
831
- ```cmd
832
- npm run ci
833
- npm pack --dry-run
834
- npm pack
835
- ```
1772
+ ~~~cmd
1773
+ ues task-policy "fix checkout bug" --json
1774
+ ues capability-fabric status .
1775
+ ues hierarchy "checkout inventory" .
1776
+ ues memory status .
1777
+ ~~~
836
1778
 
837
- Trước khi publish, kiểm tra version chưa tồn tại trên registry:
1779
+ ---
838
1780
 
839
- ```cmd
840
- npm view opencode-agent-skill@13.0.0-beta.2 version --registry=https://registry.npmjs.org/
841
- ```
1781
+ # Tài liệu sâu hơn
842
1782
 
843
- Nếu version chưa tồn tại, prerelease được publish với dist-tag `next`.
1783
+ - <code>docs/ENGINEERING-DESIGN.md</code> — engineering architecture.
1784
+ - <code>docs/DETERMINISTIC-TOOLS.md</code> — deterministic CLI/evidence tools.
1785
+ - <code>docs/V11-PERCEPTION-ADAPTIVE-EXECUTION.md</code> — perception/adaptive execution.
1786
+ - <code>docs/V12-WEAK-MODEL-INTELLIGENCE.md</code> — weak-model intelligence.
1787
+ - <code>docs/V13-PARALLEL-WEAK-MODEL-RUNTIME.md</code> — parallel runtime.
1788
+ - <code>docs/V14-CONTEXT-MEMORY-FABRIC.md</code> — context, memory, capability fabric.
1789
+ - <code>docs/V14.1-QUALITY-PERFORMANCE-FABRIC.md</code> — quality-preserving performance.
1790
+ - <code>docs/EVALS.md</code> — evaluation.
1791
+ - <code>docs/PI-COMPAT.md</code> — Pi compatibility.
1792
+ - <code>docs/NPM-PUBLISH.md</code> — npm publishing.
844
1793
 
845
1794
  ---
846
1795
 
847
- ## License
1796
+ # License
848
1797
 
849
- MIT
1798
+ MIT