opencode-agent-skill 7.7.0 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/CHANGELOG.md +112 -3
  2. package/README.md +396 -281
  3. package/bin/ocskill.mjs +382 -156
  4. package/docs/DETERMINISTIC-TOOLS.md +25 -8
  5. package/docs/ENGINEERING-DESIGN.md +31 -13
  6. package/docs/EVALS.md +34 -12
  7. package/docs/NPM-PUBLISH.md +6 -6
  8. package/docs/OPENCODE-COMPAT.md +11 -8
  9. package/docs/TRACE-SCHEMA.md +15 -2
  10. package/docs/V8-INTELLIGENCE-RELIABILITY.md +206 -0
  11. package/docs/V9-SPEED-INTELLIGENCE.md +102 -0
  12. package/evals/live/tasks.json +6 -6
  13. package/evals/polyglot/fixtures/polyglot-bench/api/generated/client.ts +2 -0
  14. package/evals/polyglot/fixtures/polyglot-bench/api/openapi.json +25 -0
  15. package/evals/polyglot/fixtures/polyglot-bench/db/migrations/20260920_add_order_key.sql +1 -0
  16. package/evals/polyglot/fixtures/polyglot-bench/dotnet/OrderService.cs +8 -0
  17. package/evals/polyglot/fixtures/polyglot-bench/java/PriceService.java +5 -0
  18. package/evals/polyglot/fixtures/polyglot-bench/monorepo/package.json +6 -0
  19. package/evals/polyglot/fixtures/polyglot-bench/monorepo/packages/api/package.json +4 -0
  20. package/evals/polyglot/fixtures/polyglot-bench/monorepo/packages/web/package.json +7 -0
  21. package/evals/polyglot/fixtures/polyglot-bench/monorepo/pnpm-lock.yaml +5 -0
  22. package/evals/polyglot/fixtures/polyglot-bench/next/app/api/products/route.ts +7 -0
  23. package/evals/polyglot/fixtures/polyglot-bench/python/tenant_auth.py +4 -0
  24. package/evals/polyglot/fixtures/polyglot-bench/react-native/keyboard.ts +3 -0
  25. package/evals/polyglot/graders/polyglot-bench.mjs +101 -0
  26. package/evals/polyglot/tasks.json +54 -0
  27. package/global-config/AGENTS.md +78 -160
  28. package/global-config/agents/integration-verifier.md +1 -1
  29. package/global-config/agents/plan-checker.md +1 -1
  30. package/global-config/commands/run.md +9 -5
  31. package/global-config/plugins/ues-router/capabilities.js +4 -0
  32. package/global-config/plugins/ues-router/index.js +784 -37
  33. package/global-config/plugins/ues-router/router.js +175 -23
  34. package/global-config/plugins/ues-router/runtime-guard.js +265 -0
  35. package/global-config/skills/engineering-orchestrator/references/long-horizon.md +6 -4
  36. package/lib/aci.mjs +128 -0
  37. package/lib/benchmark-confidence.mjs +173 -0
  38. package/lib/cli-utils.mjs +41 -0
  39. package/lib/container-sandbox.mjs +102 -0
  40. package/lib/context-manifest.mjs +300 -22
  41. package/lib/control-center.mjs +36 -3
  42. package/lib/eval-ablation.mjs +104 -0
  43. package/lib/eval-order.mjs +9 -0
  44. package/lib/eval-report.mjs +11 -0
  45. package/lib/eval-telemetry.mjs +8 -2
  46. package/lib/gate-receipt.mjs +52 -0
  47. package/lib/installer.mjs +39 -25
  48. package/lib/learning-engine.mjs +236 -38
  49. package/lib/model-policy.mjs +6 -0
  50. package/lib/opencode-compat.mjs +25 -10
  51. package/lib/orchestrator-policy.mjs +195 -21
  52. package/lib/process-runner.mjs +30 -9
  53. package/lib/runtime-events.mjs +31 -0
  54. package/lib/semantic-index.mjs +318 -0
  55. package/lib/task-engine.mjs +557 -28
  56. package/lib/trajectory.mjs +89 -0
  57. package/lib/windows-shim.mjs +227 -0
  58. package/lib/worktree-sandbox.mjs +85 -3
  59. package/package.json +11 -4
  60. package/scripts/check-release-tag.mjs +22 -0
  61. package/scripts/control-center.mjs +25 -0
  62. package/scripts/eval-ablation.mjs +44 -0
  63. package/scripts/eval-live.mjs +39 -58
  64. package/scripts/eval-matrix.mjs +166 -0
  65. package/scripts/smoke-packed-install.mjs +138 -4
  66. package/scripts/smoke-plain-install.mjs +91 -0
  67. package/scripts/validate-live-suite.mjs +3 -3
  68. package/scripts/validate.mjs +27 -5
package/README.md CHANGED
@@ -1,88 +1,36 @@
1
1
  # OpenCode Universal Engineering System (UES)
2
2
 
3
- **UES 7.7.0** là engineering harness cho OpenCode, tập trung vào việc giúp model hiện có xử lý repository lớn và task dài theo quy trình có trạng thái bền vững, fresh-context execution, deterministic evidence và verification gate.
3
+ > **V10 stable: 10.0.0** — bản phát hành chính thức của V10, dùng trực tiếp qua npm `latest`.
4
+ > UES là bộ công cụ hỗ trợ OpenCode xử lý dự án lớn, tác vụ dài và quy trình kỹ thuật cần kiểm chứng bằng bằng chứng thực tế.
4
5
 
5
- UES không tuyên bố biến một model yếu thành model mạnh hơn về bản chất. Mục tiêu là giảm lượng reasoning mà model phải tự giữ trong một context: chia task rõ, lưu state ra filesystem, dùng code cho các việc có thể xác định được, chạy subagent với context mới, và chỉ cho phép hoàn tất khi có evidence.
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)
6
8
 
7
- ## UES 7.7.0 có gì?
9
+ ## Giới thiệu
8
10
 
9
- Ngoài nền V6 (durable PLAN/STATE/EVIDENCE, fresh executors, plan/integration gates), V7.7 thêm:
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 để:
10
12
 
11
- - crash-safe task lease với `runId`, heartbeat, stale-task recovery
12
- - live benchmark heartbeat + hard/idle timeout + Ctrl+C process-tree cancellation
13
- - structured verification receipts gắn command/exit code/output hash/workspace fingerprint vào task run
14
- - context manifest tự chọn declared files, import neighbors, likely tests, manifests và accepted lessons
15
- - adaptive task policy: inline/standard/long-horizon + risk/model/context/retry guidance
16
- - read/write-aware safe waves và isolated Git worktree sandbox primitives cho parallel writers
17
- - evidence-gated learning loop từ `.ues-evals` → proposal → explicit accept → future context retrieval
18
- - optional Hermes bridge theo kiểu adapter, không nhúng Hermes runtime vào core
19
- - zero-dependency local **UES Control Center** cho work state, evidence, learning và eval summaries; chế độ `--serve` tự refresh dữ liệu
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.
20
20
 
21
- Xem chi tiết: [V7 Intelligence Runtime](docs/V7-INTELLIGENCE-RUNTIME.md)
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**.
22
22
 
23
- ### Lệnh V7 nhanh
24
-
25
- ```cmd
26
- ocskill task-policy "refactor auth across the whole repository"
27
- ocskill work recover <slug> .
28
- ocskill work verify-command <slug> <task> . -- npm test
29
- ocskill sandbox create <slug> <task> .
30
- ocskill learn analyze . --eval-dir .ues-evals
31
- ocskill hermes status
32
- ocskill dashboard . --serve
33
- ```
34
-
35
-
36
-
37
- - **39 engineering skills**
38
- - **11 slash commands**
39
- - **10 subagents**
40
- - durable long-task engine dưới `.ues-work/<slug>/`
41
- - machine-checkable `PLAN.json` + dependency DAG + safe execution waves
42
- - hard plan approval gate và integration verification gate
43
- - atomic/locked `STATE.json` + `EVIDENCE.json` để tránh mất state khi task độc lập hoàn tất đồng thời
44
- - OpenCode V2 runtime plugin với automatic skill routing, safety permission gate và fresh-session task dispatch
45
- - configurable `light / standard / heavy` model tiers với attempt-based escalation
46
- - deterministic repository tools: repo graph, impact, review scope, verification plan, task graph, context pack
47
- - **34 static skill-routing scenarios** phủ đủ 39 skill
48
- - **120 V2 router trigger cases** có positive/negative guards
49
- - **20 standard live hidden-graded tasks**
50
- - **5 long-horizon tasks**, gồm một bài tích hợp **15 source files**
51
- - hỗ trợ **OpenCode 1.x và 2.x**
23
+ ---
52
24
 
53
- Luồng long-horizon chính:
25
+ ## Cài đặt
54
26
 
55
- ```text
56
- request
57
- ↓
58
- repo evidence / codebase map
59
- ↓
60
- SPEC.md
61
- ↓
62
- PLAN.json
63
- ↓
64
- ues-plan-checker
65
- ↓
66
- machine approval gate
67
- ↓
68
- dependency-safe tasks
69
- ↓
70
- fresh ues-executor session / task
71
- ↓
72
- task evidence + durable state
73
- ↓
74
- ues-integration-verifier
75
- ↓
76
- machine integration PASS gate
77
- ↓
78
- workspace fingerprint unchanged
79
- ↓
80
- finalize
81
- ```
27
+ Yêu cầu:
82
28
 
83
- ---
29
+ - Node.js 20 trở lên;
30
+ - npm;
31
+ - OpenCode.
84
32
 
85
- ## Cài đặt
33
+ Cài đặt toàn cục từ npm:
86
34
 
87
35
  ```cmd
88
36
  npm install -g opencode-agent-skill
@@ -91,93 +39,134 @@ npm install -g opencode-agent-skill
91
39
  Kiểm tra:
92
40
 
93
41
  ```cmd
42
+ ocskill version
94
43
  ocskill status
95
44
  ocskill doctor
96
45
  ```
97
46
 
98
- Nếu npm không chạy lifecycle script:
47
+ Nếu npm không chạy lifecycle script trong lúc cài đặt, chạy thêm:
99
48
 
100
49
  ```cmd
101
50
  ocskill install
102
51
  ```
103
52
 
104
- Khi đồng bộ V7.7 đầy đủ, status sẽ phản ánh khoảng:
105
-
106
- ```text
107
- Package version: 7.7.0
108
- Resource version: 7.7.0
109
- Skills: 39/39
110
- Commands: 11/11
111
- Subagents: 10/10
112
- Workflow: OK
113
- ```
114
-
115
- Sau khi cài/cập nhật, nên mở OpenCode session mới để resource mới được nạp.
116
-
117
- ---
118
-
119
- # 1. Subagents
120
-
121
- | Subagent | Vai trò |
122
- |---|---|
123
- | `ues-codebase-mapper` | Map repository, entry point, boundary, hotspot, contract và test surface |
124
- | `ues-architect` | Architecture/change-impact analysis |
125
- | `ues-plan-checker` | Fresh-context gate kiểm tra SPEC/PLAN trước khi code |
126
- | `ues-executor` | Fresh-context implementation cho đúng một approved task |
127
- | `ues-debugger` | Root-cause debugging |
128
- | `ues-researcher` | Kiểm tra docs/API/version hiện hành |
129
- | `ues-reviewer` | Review correctness/regression/security/compatibility |
130
- | `ues-critic` | Adversarial falsification/counterexample |
131
- | `ues-verifier` | Verification độc lập theo acceptance criteria |
132
- | `ues-integration-verifier` | Cross-task/end-to-end integration verification |
133
-
134
- `ues-executor` là subagent 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/kiểm chứng và không được dùng để âm thầm mở rộng implementation.
53
+ Sau khi cài hoặc cập nhật UES, nên mở một OpenCode session mới để các skill, command, subagent và plugin được nạp lại đầy đủ.
135
54
 
136
55
  ---
137
56
 
138
- # 2. Slash commands
57
+ ## Bắt đầu nhanh
139
58
 
140
- | Lệnh | Công dụng |
141
- |---|---|
142
- | `/ues-feature` | Làm feature theo workflow UES |
143
- | `/ues-fix` | Điều tra root cause rồi sửa bug |
144
- | `/ues-plan` | Lập implementation-ready plan |
145
- | `/ues-debug` | Điều tra bug/build/test failure |
146
- | `/ues-research` | Kiểm tra docs/API/package/version |
147
- | `/ues-review` | Review diff/code |
148
- | `/ues-verify` | Verification bằng evidence mới |
149
- | `/ues-critique` | Tìm assumption sai/counterexample |
150
- | `/ues-audit` | Audit repository/khu vực |
151
- | `/ues-run` | Chạy long-horizon workflow với durable state + fresh executors |
152
- | `/ues-resume` | Resume work item từ `.ues-work` thay vì dựa vào chat history |
153
-
154
- Với task lớn, ưu tiên:
59
+ Với tác vụ lớn, dùng:
155
60
 
156
61
  ```text
157
62
  /ues-run <yêu cầu>
158
63
  ```
159
64
 
160
- Nếu session bị ngắt/compact:
65
+ Nếu session bị ngắt hoặc context bị compact:
161
66
 
162
67
  ```text
163
68
  /ues-resume <slug>
164
69
  ```
165
70
 
71
+ Một số lệnh hữu ích:
72
+
73
+ ```cmd
74
+ ocskill inspect .
75
+ ocskill repo-graph .
76
+ ocskill verification-plan .
77
+ ocskill task-policy "refactor auth across the whole repository"
78
+ ocskill dashboard . --serve
79
+ ```
80
+
166
81
  ---
167
82
 
168
- # 3. Long-horizon engine
83
+ ## V10 có gì?
169
84
 
170
- V7 task records additionally track `runId`, executor owner, heartbeat, lease expiry and evidence strength. `ocskill work resume` can recover stale running tasks, while the V2 dispatcher refreshes leases during fresh-session execution.
85
+ 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.
171
86
 
172
- Structured verification can be recorded with:
87
+ - telemetry đo riêng **initial input tokens** bên cạnh total tokens, tool calls, latency và cost;
88
+ - global `AGENTS.md` được nén đáng kể, giữ lại contract, evidence, verification, safety và long-horizon invariants;
89
+ - 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;
90
+ - 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;
91
+ - 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;
92
+ - 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;
93
+ - benchmark confidence gate kiểm tra thêm initial-input ratio và total-token ratio;
94
+ - `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;
95
+ - 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;
96
+ - 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;
97
+ - 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ó;
98
+ - 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.
173
99
 
174
- ```cmd
175
- ocskill work verify-command <slug> <task> . --run-id <run-id> -- npm test
176
- ```
100
+ 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.
177
101
 
102
+ ---
103
+
104
+ ## UES 9.0.0 có gì?
105
+
106
+ UES 9.0.0 cung cấp các khả năng sau (kế thừa từ 8.0.0):
107
+
108
+ - **39 engineering skills**;
109
+ - **11 slash commands**;
110
+ - **10 subagents**;
111
+ - long-task engine bền vững dưới `.ues-work/<slug>/`;
112
+ - `PLAN.json`, `STATE.json`, `EVIDENCE.json` và append-only `EVENTS.jsonl`;
113
+ - structured plan/integration receipts gắn với plan hash hoặc workspace fingerprint;
114
+ - task lease với `runId`, heartbeat, session owner, lease expiry và task-scoped stale recovery;
115
+ - strict verification cho long/high-risk task: receipt phải PASS đúng active run và đúng workspace hiện tại;
116
+ - context manifest v3 với Git-change awareness, symbol hits, TF-IDF-style relevance, tests/instructions và centered excerpts;
117
+ - task policy `inline / standard / long-horizon` cùng model tier `light / standard / heavy`;
118
+ - bounded fresh executor với hard timeout, interrupt/cancel và recovery;
119
+ - safe-wave scheduling cùng Git worktree isolation/integration có conflict detection;
120
+ - learning v2: failure clustering, explicit acceptance và shadow-benchmark promotion;
121
+ - benchmark matrix standard + long-horizon + polyglot;
122
+ - optional Hermes adapter;
123
+ - UES Control Center hiển thị runtime events, receipts và stale recovery;
124
+ - OpenCode V2 router plugin với multilingual routing, safety gate, cancel/recover tools và fresh-session dispatch.
125
+
126
+ V9 bổ sung:
127
+
128
+ - persistent incremental source index dưới `.ues-cache/semantic-index-v1.json` cùng ACI search/refs/view/text;
129
+ - FAST / STANDARD / DEEP execution profiles với bounded context budget, skill cap và verification depth;
130
+ - context manifest v4 tiêu thụ incremental evidence index trước khi mở rộng graph;
131
+ - redacted operational trajectory dưới `.ues-traces/*.jsonl` để replay/debug mà không lưu hidden chain-of-thought;
132
+ - optional container verification sandbox (Docker/Podman) với network-off, dropped capabilities và resource bounds;
133
+ - paired baseline-vs-UES confidence gate qua `npm run evals:matrix:gate`.
134
+
135
+ ---
178
136
 
137
+ ## Kiến trúc tác vụ dài
138
+
139
+ Luồng long-horizon chính:
140
+
141
+ ```text
142
+ Yêu cầu
143
+ ↓
144
+ Khảo sát repository / bằng chứng
145
+ ↓
146
+ SPEC.md
147
+ ↓
148
+ PLAN.json
149
+ ↓
150
+ ues-plan-checker
151
+ ↓
152
+ Phê duyệt kế hoạch
153
+ ↓
154
+ Các task theo dependency graph
155
+ ↓
156
+ Fresh ues-executor session cho từng task
157
+ ↓
158
+ Task evidence + durable state
159
+ ↓
160
+ ues-integration-verifier
161
+ ↓
162
+ Integration PASS
163
+ ↓
164
+ Kiểm tra workspace không thay đổi
165
+ ↓
166
+ Finalize
167
+ ```
179
168
 
180
- Mỗi work item dùng:
169
+ Mỗi work item dùng cấu trúc:
181
170
 
182
171
  ```text
183
172
  .ues-work/<slug>/
@@ -185,103 +174,157 @@ Mỗi work item dùng:
185
174
  ├── PLAN.json
186
175
  ├── STATE.json
187
176
  ├── EVIDENCE.json
177
+ ├── EVENTS.jsonl
188
178
  ├── tasks/
189
179
  └── reports/
190
180
  ```
191
181
 
192
- `.ues-work/` được git-ignore. Đây là execution state, không phải hidden chain-of-thought.
182
+ `.ues-work/` là trạng thái thực thi của workflow, không phải hidden chain-of-thought.
193
183
 
194
- ## Hard gate 1 — Plan approval
184
+ ### Gate 1 — Phê duyệt kế hoạch
195
185
 
196
- `ocskill work plan` không đưa task thẳng sang executable state. Nó để state ở:
186
+ Sau khi tạo plan, task chưa được chạy ngay. Trạng thái sẽ ở:
197
187
 
198
188
  ```text
199
189
  awaiting-plan-approval
200
190
  ```
201
191
 
202
- Sau khi `ues-plan-checker` trả PASS:
192
+ 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:
203
193
 
204
194
  ```cmd
205
- ocskill work approve-plan <slug> . --evidence "plan checker PASS: ..."
195
+ ocskill work gate-receipt <slug> plan . --verifier ues-plan-checker --evidence "plan checker PASS" --out .ues-work/<slug>/reports/plan-receipt.json
196
+ ocskill work approve-plan <slug> . --evidence "plan checker PASS" --receipt-file .ues-work/<slug>/reports/plan-receipt.json
206
197
  ```
207
198
 
208
- Nếu chưa có approval hợp lệ, `ocskill work start` sẽ từ chối.
199
+ Nếu thiếu structured receipt ở workflow strict, `ocskill work start` sẽ không được mở gate.
209
200
 
210
- ## Hard gate 2 — Concurrent durable state
201
+ ### Gate 2 — Bằng chứng cho từng task
211
202
 
212
- Mọi mutation của `STATE.json` và `EVIDENCE.json` dùng per-work-item lock + atomic replacement. Hai task độc lập có thể hoàn tất gần nhau mà không được phép ghi đè state/evidence của nhau.
203
+ Có thể ghi verification receipt trực tiếp từ command:
213
204
 
214
- Safe-wave chỉ bảo vệ declared file overlap. Nếu task có implicit shared write surface như generated files/lockfiles, hãy serialize.
205
+ ```cmd
206
+ ocskill work verify-command <slug> <task-id> . --run-id <run-id> -- npm test
207
+ ```
215
208
 
216
- ## Hard gate 3 — Integration completion
209
+ 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.
217
210
 
218
- Sau khi mọi task hoàn tất:
211
+ ### Gate 3 — Kiểm tra tích hợp
212
+
213
+ 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:
219
214
 
220
215
  ```cmd
221
- ocskill work verify-integration <slug> . --verdict PASS --evidence "..."
216
+ ocskill work gate-receipt <slug> integration . --verifier ues-integration-verifier --verdict PASS --evidence "integration PASS" --out .ues-work/<slug>/reports/integration-receipt.json
217
+ ocskill work verify-integration <slug> . --verdict PASS --evidence "integration PASS" --receipt-file .ues-work/<slug>/reports/integration-receipt.json
222
218
  ```
223
219
 
224
- PASS lưu workspace fingerprint. `finalize` sẽ bị từ chối nếu:
225
-
226
- - còn task incomplete
227
- - còn blocker
228
- - chưa có integration PASS
229
- - workspace đã thay đổi sau PASS
230
-
231
220
  Sau đó:
232
221
 
233
222
  ```cmd
234
223
  ocskill work finalize <slug> . --evidence "final acceptance verified"
235
224
  ```
236
225
 
226
+ `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.
227
+
237
228
  ---
238
229
 
239
- # 4. Fresh-context executor trên OpenCode V2
230
+ ## Fresh-context executor trên OpenCode V2
240
231
 
241
- V2 plugin expose tool:
232
+ OpenCode V2 plugin cung cấp tool:
242
233
 
243
234
  ```text
244
235
  ues.dispatch_task
245
236
  ```
246
237
 
247
- Nó thực hiện:
238
+ Luồng thực thi:
248
239
 
249
240
  ```text
250
241
  work start
251
242
  ↓
252
- read bounded context pack
243
+ đọc bounded context pack
253
244
  ↓
254
- resolve model tier theo attempt
245
+ chọn model tier theo task + attempt
255
246
  ↓
256
- create fresh OpenCode session
247
+ tạo OpenCode session mới
257
248
  ↓
258
249
  switchAgent(ues-executor)
259
250
  ↓
260
- switchModel(...) nếu được cấu hình
251
+ switchModel(...) nếu đã cấu hình
252
+ ↓
253
+ gửi đúng một task
254
+ ↓
255
+ heartbeat + bounded wait
261
256
  ↓
262
- prompt đúng 1 task
257
+ interrupt nếu timeout/cancel
263
258
  ↓
264
- wait
259
+ isolate writer khi cần
265
260
  ↓
266
- return child-session report
261
+ trả child-session report
267
262
  ```
268
263
 
269
- Parent vẫn phải inspect diff/evidence và gọi `work complete` hoặc `work fail`. Child session không được tự merge/push/publish/deploy.
264
+ 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`.
265
+
266
+ Child session không được tự động merge, push, publish hoặc deploy.
267
+
268
+ ---
269
+
270
+ ## Subagents
271
+
272
+ | Subagent | Vai trò |
273
+ |---|---|
274
+ | `ues-codebase-mapper` | Lập bản đồ repository, entry point, boundary, hotspot, contract và test surface |
275
+ | `ues-architect` | Phân tích kiến trúc và phạm vi ảnh hưởng |
276
+ | `ues-plan-checker` | Kiểm tra SPEC/PLAN trước khi cho phép thực thi |
277
+ | `ues-executor` | Thực hiện một task đã được phê duyệt trong context mới |
278
+ | `ues-debugger` | Điều tra nguyên nhân gốc của lỗi |
279
+ | `ues-researcher` | Kiểm tra tài liệu, API và phiên bản hiện hành |
280
+ | `ues-reviewer` | Review correctness, regression, security và compatibility |
281
+ | `ues-critic` | Tìm giả định sai, counterexample và điểm yếu trong phương án |
282
+ | `ues-verifier` | Xác minh độc lập theo acceptance criteria |
283
+ | `ues-integration-verifier` | Kiểm tra tích hợp giữa nhiều task và luồng end-to-end |
284
+
285
+ `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.
270
286
 
271
287
  ---
272
288
 
273
- # 5. Adaptive task + model policy
289
+ ## Slash commands
274
290
 
275
- V7 adds deterministic task classification:
291
+ | Lệnh | Công dụng |
292
+ |---|---|
293
+ | `/ues-feature` | Triển khai feature theo workflow UES |
294
+ | `/ues-fix` | Điều tra nguyên nhân rồi sửa bug |
295
+ | `/ues-plan` | Lập kế hoạch triển khai có thể thực thi |
296
+ | `/ues-debug` | Điều tra lỗi build, runtime hoặc test |
297
+ | `/ues-research` | Kiểm tra docs, API, package hoặc version |
298
+ | `/ues-review` | Review code hoặc diff |
299
+ | `/ues-verify` | Xác minh bằng evidence mới |
300
+ | `/ues-critique` | Tìm assumption sai và counterexample |
301
+ | `/ues-audit` | Audit repository hoặc một khu vực |
302
+ | `/ues-run` | Chạy workflow long-horizon với durable state |
303
+ | `/ues-resume` | Tiếp tục work item từ `.ues-work` |
304
+
305
+ ---
306
+
307
+ ## Task policy và model policy
308
+
309
+ Phân loại yêu cầu kỹ thuật:
276
310
 
277
311
  ```cmd
278
312
  ocskill task-policy "your engineering request"
313
+ ```
314
+
315
+ Kiểm tra model policy:
316
+
317
+ ```cmd
279
318
  ocskill model-policy executor --attempt 1 --text "your engineering request"
280
319
  ```
281
320
 
282
- Task risk/complexity can raise the base model tier before attempt-based escalation. User-configured provider/model IDs remain authoritative.
321
+ UES dùng ba model tier:
283
322
 
284
- ## Model tiers
323
+ ```text
324
+ light
325
+ standard
326
+ heavy
327
+ ```
285
328
 
286
329
  Xem cấu hình:
287
330
 
@@ -289,13 +332,13 @@ Xem cấu hình:
289
332
  ocskill models status
290
333
  ```
291
334
 
292
- Bật:
335
+ Bật model policy:
293
336
 
294
337
  ```cmd
295
338
  ocskill models on
296
339
  ```
297
340
 
298
- Gán model:
341
+ Gán model cho từng tier:
299
342
 
300
343
  ```cmd
301
344
  ocskill models set light provider/cheap
@@ -310,31 +353,24 @@ ocskill models role executor standard
310
353
  ocskill models role plan-checker heavy
311
354
  ```
312
355
 
313
- Kiểm tra attempt:
314
-
315
- ```cmd
316
- ocskill model-policy executor --attempt 1
317
- ocskill model-policy executor --attempt 2
318
- ```
319
-
320
- Mặc định role quan trọng như architect, plan-checker, critic và integration-verifier ưu tiên `heavy`; executor/debugger/reviewer thường bắt đầu ở `standard`. Retry có thể escalate lên tier cao hơn nếu đã cấu hình.
356
+ 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.
321
357
 
322
358
  ---
323
359
 
324
- # 6. Deterministic CLI tools
360
+ ## Công cụ CLI
325
361
 
326
362
  | Lệnh | Công dụng |
327
363
  |---|---|
328
- | `ocskill inspect [dir]` | Stack/package manager/root map/test commands |
329
- | `ocskill repo-graph [dir]` | Bounded import graph + coupling hotspots |
330
- | `ocskill impact <query> [dir]` | Bounded symbol/term impact search |
331
- | `ocskill evidence [dir]` | Repository + verification + Git evidence snapshot |
332
- | `ocskill working-tree [dir]` | Branch/HEAD/dirty state |
333
- | `ocskill review-scope [base] [dir]` | Changed-file coverage + deterministic risk hints |
334
- | `ocskill verification-plan [dir]` | Project-native verification recommendations |
335
- | `ocskill task-graph <PLAN.json>` | Validate DAG + compute safe waves |
336
- | `ocskill context-pack <slug> <task> [dir]` | Bounded handoff cho fresh executor |
337
- | `ocskill work ...` | Durable long-task state machine |
364
+ | `ocskill inspect [dir]` | Phát hiện stack, package manager, root và test command |
365
+ | `ocskill repo-graph [dir]` | Lập import graph có giới hạn và tìm hotspot |
366
+ | `ocskill impact <query> [dir]` | Tìm phạm vi ảnh hưởng theo symbol hoặc từ khóa |
367
+ | `ocskill evidence [dir]` | Thu thập snapshot về repository, verification và Git |
368
+ | `ocskill working-tree [dir]` | Kiểm tra branch, HEAD và working tree |
369
+ | `ocskill review-scope [base] [dir]` | Phân tích changed-file coverage và risk hint |
370
+ | `ocskill verification-plan [dir]` | Đề xuất verification phù hợp với project |
371
+ | `ocskill task-graph <PLAN.json>` | Kiểm tra DAG và tính safe waves |
372
+ | `ocskill context-pack <slug> <task> [dir]` | Tạo bounded handoff cho executor |
373
+ | `ocskill work ...` | Điều khiển durable long-task state machine |
338
374
 
339
375
  Ví dụ:
340
376
 
@@ -348,11 +384,11 @@ ocskill work status checkout .
348
384
 
349
385
  ---
350
386
 
351
- # 7. Skills
387
+ ## Skills
352
388
 
353
- UES giữ **39 skills**, không tăng catalog chỉ để tăng số lượng. Thông thường router chỉ cần 2–4 skill phù hợp.
389
+ UES hiện có **39 skills**. Router chỉ chọn các skill phù hợp thay vì nạp toàn bộ catalog vào mỗi task.
354
390
 
355
- Các process skill quan trọng:
391
+ Một số process skill quan trọng:
356
392
 
357
393
  - `ues-engineering-orchestrator`
358
394
  - `ues-repo-explorer`
@@ -367,23 +403,23 @@ Các process skill quan trọng:
367
403
  - `ues-long-task-state`
368
404
  - `ues-git-safety`
369
405
 
370
- Domain/framework skills bao gồm React, Next.js, React Native, Node.js, NestJS, Python, Django, FastAPI, .NET, Java/Spring, Flutter, database, REST/API contract, auth/security, payment, ecommerce, file upload, DevOps, UI/UX, accessibility và performance.
406
+ 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.
371
407
 
372
408
  ---
373
409
 
374
- # 8. OpenCode 1.x và 2.x
410
+ ## Tương thích OpenCode
375
411
 
376
- ## OpenCode 1.x
412
+ ### OpenCode 1.x
377
413
 
378
- - skill/command/subagent file vẫn được cài
379
- - dùng permission frontmatter tương thích V1
380
- - không cài V2 runtime plugin
381
- - long-task CLI/durable state vẫn dùng được
382
- - fresh child-session dispatch phụ thuộc khả năng subagent của runtime V1; không có V2 `ues.dispatch_task`
414
+ - cài skill, command và subagent;
415
+ - dùng frontmatter tương thích V1;
416
+ - không cài V2 runtime plugin;
417
+ - durable long-task CLI vẫn dùng được;
418
+ - không có V2 `ues.dispatch_task`.
383
419
 
384
- ## OpenCode 2.x
420
+ ### OpenCode 2.x
385
421
 
386
- Ngoài resource file, UES cài managed plugin:
422
+ Ngoài resource file, UES cài managed plugin tại:
387
423
 
388
424
  ```text
389
425
  ~/.config/opencode/plugins/ues-router/
@@ -391,13 +427,13 @@ Ngoài resource file, UES cài managed plugin:
391
427
 
392
428
  Plugin cung cấp:
393
429
 
394
- - prompt-time skill routing
395
- - context guardrail
396
- - permission safety gate cho destructive/high-impact shell action
397
- - read-only long-task helpers
398
- - `ues.dispatch_task` fresh-session executor runtime
430
+ - automatic skill routing;
431
+ - context guardrail;
432
+ - permission safety gate;
433
+ - read-only long-task helpers;
434
+ - fresh-session executor runtime qua `ues.dispatch_task`.
399
435
 
400
- Router:
436
+ Điều khiển router:
401
437
 
402
438
  ```cmd
403
439
  ocskill router status
@@ -407,175 +443,254 @@ ocskill router off
407
443
 
408
444
  ---
409
445
 
410
- # 9. Safety
446
+ ## Safety
411
447
 
412
- V2 permission gate nâng các thao tác nguy hiểm lên explicit confirmation, gồm nhóm như:
448
+ 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ụ:
413
449
 
414
- - `git push --force` / `git push -f`
415
- - `git reset --hard`
416
- - destructive `git clean`
417
- - `npm publish`
418
- - recursive forced deletion
419
- - `DROP/TRUNCATE`
420
- - Terraform/Kubernetes/Helm high-impact deployment actions
450
+ - `git push --force` hoặc `git push -f`;
451
+ - `git reset --hard`;
452
+ - destructive `git clean`;
453
+ - `npm publish`;
454
+ - recursive forced deletion;
455
+ - `DROP` hoặc `TRUNCATE`;
456
+ - Terraform, Kubernetes hoặc Helm action có tác động lớn.
421
457
 
422
- Instruction vẫn yêu cầu confirmation cho destructive/external side effects. Hook là lớp deterministic bổ sung, không thay thế review của người dùng.
458
+ Safety hook là lớp bảo vệ deterministic bổ sung, không thay thế review của người dùng.
423
459
 
424
460
  ---
425
461
 
426
- # 10. Evaluation
462
+ ## Learning loop
463
+
464
+ Phân tích eval trace:
465
+
466
+ ```cmd
467
+ ocskill learn analyze . --eval-dir .ues-evals
468
+ ```
469
+
470
+ Xem trạng thái:
427
471
 
428
- Live evals now print heartbeats and support `--heartbeat-ms`, `--idle-timeout-ms`, and `--timeout-ms`. Ctrl+C asks the harness to terminate the active OpenCode process tree cleanly.
472
+ ```cmd
473
+ ocskill learn status .
474
+ ```
429
475
 
476
+ Chấp nhận một proposal trước khi thử nghiệm:
430
477
 
478
+ ```cmd
479
+ ocskill learn accept <proposal-id> .
480
+ ```
431
481
 
432
- ## Static skill contract
482
+ Sau khi shadow benchmark chứng minh candidate tốt hơn baseline:
433
483
 
434
484
  ```cmd
435
- npm run evals
485
+ ocskill learn promote <proposal-id> . --baseline 0.50 --candidate 0.75 --samples 4
436
486
  ```
437
487
 
438
- Giữ **34 scenarios** để kiểm catalog và phủ đủ 39 skill.
488
+ 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.
439
489
 
440
- ## V2 router precision matrix
490
+ ---
491
+
492
+ ## Hermes adapter
493
+
494
+ UES hỗ trợ Hermes theo dạng adapter tùy chọn, không nhúng Hermes runtime vào core:
441
495
 
442
496
  ```cmd
443
- npm run evals:router
497
+ ocskill hermes status
498
+ ocskill hermes prompt <slug> <task> .
499
+ ocskill hermes exec <slug> <task> .
444
500
  ```
445
501
 
446
- V7.7 giữ **120 cases** với required routes và negative guards, cộng regression tests riêng cho cap-priority/capability runtime.
502
+ 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.
503
+
504
+ ---
505
+
506
+ ## UES Control Center
447
507
 
448
- ## Standard hidden graders
508
+ Tạo dashboard tĩnh:
449
509
 
450
510
  ```cmd
451
- npm run evals:live:validate
511
+ ocskill dashboard .
512
+ ```
513
+
514
+ Chạy dashboard có tự refresh:
515
+
516
+ ```cmd
517
+ ocskill dashboard . --serve --port 4177
518
+ ```
519
+
520
+ Control Center hiển thị work state, verification receipts, runtime events, learning proposals và eval summary; server mode có safe stale-recovery action.
521
+
522
+ ---
523
+
524
+ ## Sandbox cho tác vụ ghi song song
525
+
526
+ Tạo isolated Git worktree:
527
+
528
+ ```cmd
529
+ ocskill sandbox create <slug> <task-id> .
452
530
  ```
453
531
 
454
- Có **20 standard live tasks**.
532
+ Tích hợp sandbox sau khi đã inspect/verify:
455
533
 
456
- ## Long-horizon integrity
534
+ ```cmd
535
+ ocskill sandbox integrate <worktree-path> .
536
+ ```
537
+
538
+ Liệt kê sandbox:
457
539
 
458
540
  ```cmd
459
- npm run evals:long:validate
541
+ ocskill sandbox list .
542
+ ```
543
+
544
+ 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.
545
+
546
+ ---
547
+
548
+ ## Evaluation
549
+
550
+ UES 9.0.0 hiện có:
551
+
552
+ - **34 static skill-routing scenarios** phủ 39 skills;
553
+ - **120 V2 router cases** với required routes và negative guards;
554
+ - **20 standard live tasks**;
555
+ - **5 long-horizon tasks**;
556
+ - **8 polyglot tasks** cho Python, Java, .NET, Next.js, React Native, SQL migration, monorepo và generated contract;
557
+ - benchmark matrix baseline-vs-UES nhiều trial;
558
+ - một long task tích hợp tới **15 source modules**.
559
+
560
+ Kiểm tra static routing:
561
+
562
+ ```cmd
563
+ npm run evals
564
+ ```
565
+
566
+ Kiểm tra V2 router:
567
+
568
+ ```cmd
569
+ npm run evals:router
460
570
  ```
461
571
 
462
- Có **5 long tasks**, trong đó một task yêu cầu phối hợp **15 source modules**.
572
+ Kiểm tra standard hidden graders:
463
573
 
464
- ## Baseline vs UES model thật
574
+ ```cmd
575
+ npm run evals:live:validate
576
+ ```
577
+
578
+ Kiểm tra long-horizon và polyglot suite:
579
+
580
+ ```cmd
581
+ npm run evals:long:validate
582
+ npm run evals:polyglot:validate
583
+ ```
584
+
585
+ Chạy benchmark với model thật:
465
586
 
466
587
  ```cmd
467
588
  ocskill eval-live --model provider/model --trials 3
468
589
  ocskill eval-live --suite long --model provider/model --trials 3
590
+ npm run evals:matrix -- --model provider/model --trials 3
469
591
  ```
470
592
 
471
- Với suite `long`, UES mode chỉ được tính PASS khi:
593
+ Live eval hỗ trợ heartbeat, hard timeout, idle timeout và Ctrl+C process-tree cancellation.
472
594
 
473
- - hidden grader PASS
474
- - có durable `.ues-work`
475
- - plan approval PASS
476
- - plan có ít nhất 2 task
477
- - mọi task đã được attempt + completed
478
- - integration verification PASS
479
- - integration evidence tồn tại
480
- - finalization evidence tồn tại
481
- - state cuối là `completed`
482
-
483
- Vì vậy model giải code trực tiếp trong một context nhưng bỏ qua long-horizon engine sẽ không được tính là UES long PASS.
595
+ 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.
484
596
 
485
597
  ---
486
598
 
487
- # 11. CI / package release
599
+ ## Phát triển và CI
600
+
601
+ Yêu cầu:
488
602
 
489
- Yêu cầu phát triển:
603
+ - Node.js 20+;
604
+ - npm;
605
+ - Git.
490
606
 
491
- - Node.js 20+
492
- - npm
493
- - Git
607
+ Cài dependency mà không chạy lifecycle script:
494
608
 
495
609
  ```cmd
496
610
  npm ci --ignore-scripts
611
+ ```
612
+
613
+ Chạy toàn bộ CI:
614
+
615
+ ```cmd
497
616
  npm run ci
498
617
  ```
499
618
 
500
- Pipeline gồm:
619
+ Pipeline hiện kiểm tra:
501
620
 
502
621
  ```text
503
622
  syntax
504
623
  → resource validation
505
624
  → static skill routing
506
- → 120-case router eval
625
+ → V2 router matrix
507
626
  → standard hidden-grader integrity
508
627
  → long hidden-grader integrity
628
+ → polyglot hidden-grader integrity
509
629
  → Node tests
510
630
  → npm pack --dry-run
511
631
  → packed global-install smoke
632
+ → plain one-command install compatibility smoke
512
633
  ```
513
634
 
514
- Packed smoke kiểm tra OpenCode V2 path, 39 skills, 11 commands, 10 subagents, router plugin, task graph, durable work state và model config.
635
+ 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.
515
636
 
516
637
  ---
517
638
 
518
- # 12. Update / remove
639
+ ## Cập nhật và gỡ cài đặt
519
640
 
520
- Update:
641
+ Cập nhật lên bản npm mới nhất:
521
642
 
522
643
  ```cmd
523
644
  ocskill update
524
645
  ```
525
646
 
526
- Remove:
647
+ Gỡ UES:
527
648
 
528
649
  ```cmd
529
650
  ocskill remove
530
651
  ```
531
652
 
532
- UES chỉ quản lý resource có namespace/marker của chính nó, giữ unmanaged collisions và chống accidental downgrade.
653
+ 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.
533
654
 
534
655
  ---
535
656
 
536
- # Tài liệu
657
+ ## Tài liệu
537
658
 
538
- - [Engineering design](docs/ENGINEERING-DESIGN.md)
539
- - [OpenCode compatibility](docs/OPENCODE-COMPAT.md)
540
- - [Deterministic tools](docs/DETERMINISTIC-TOOLS.md)
659
+ - [Thiết kế hệ thống](docs/ENGINEERING-DESIGN.md)
660
+ - [Tương thích OpenCode](docs/OPENCODE-COMPAT.md)
661
+ - [Công cụ deterministic](docs/DETERMINISTIC-TOOLS.md)
541
662
  - [Evaluation](docs/EVALS.md)
542
663
  - [Trace schema](docs/TRACE-SCHEMA.md)
543
- - [npm publish](docs/NPM-PUBLISH.md)
544
- - [Research sources](docs/RESEARCH-SOURCES.md)
545
-
546
- # License
547
-
548
- MIT
664
+ - [Hướng dẫn publish npm](docs/NPM-PUBLISH.md)
665
+ - [Nguồn nghiên cứu](docs/RESEARCH-SOURCES.md)
666
+ - [V7 Intelligence Runtime](docs/V7-INTELLIGENCE-RUNTIME.md)
667
+ - [V8 Intelligence & Reliability](docs/V8-INTELLIGENCE-RELIABILITY.md)
668
+ - [V9 Speed & Intelligence](docs/V9-SPEED-INTELLIGENCE.md)
549
669
 
670
+ ---
550
671
 
551
- # 13. Learning, Hermes và Control Center
672
+ ## npm
552
673
 
553
- Evidence-gated learning:
674
+ Package:
554
675
 
555
- ```cmd
556
- ocskill learn analyze . --eval-dir .ues-evals
557
- ocskill learn status .
558
- ocskill learn accept <proposal-id> .
676
+ ```text
677
+ opencode-agent-skill
559
678
  ```
560
679
 
561
- Optional Hermes adapter:
680
+ Cài đặt:
562
681
 
563
682
  ```cmd
564
- ocskill hermes status
565
- ocskill hermes prompt <slug> <task> .
566
- ocskill hermes exec <slug> <task> .
683
+ npm install -g opencode-agent-skill
567
684
  ```
568
685
 
569
- Local Control Center:
686
+ Phiên bản hiện tại:
570
687
 
571
- ```cmd
572
- ocskill dashboard .
573
- ocskill dashboard . --serve --port 4177
688
+ ```text
689
+ 9.0.0
574
690
  ```
575
691
 
576
- Parallel write isolation primitives:
692
+ ---
577
693
 
578
- ```cmd
579
- ocskill sandbox create <slug> <task> .
580
- ocskill sandbox list .
581
- ```
694
+ ## License
695
+
696
+ MIT