@piagent/platform 1.2.11 → 1.2.13

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 (83) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/README.md +15 -7
  3. package/benchmarks/production-v1/grade.mjs +220 -0
  4. package/benchmarks/production-v1/project/README.md +7 -0
  5. package/benchmarks/production-v1/project/config/service.json +4 -0
  6. package/benchmarks/production-v1/project/data/audit-ledger.jsonl +1 -0
  7. package/benchmarks/production-v1/project/docs/ops.md +3 -0
  8. package/benchmarks/production-v1/project/logs/incident.log +2 -0
  9. package/benchmarks/production-v1/project/package.json +11 -0
  10. package/benchmarks/production-v1/project/scripts/check.mjs +21 -0
  11. package/benchmarks/production-v1/project/src/backend/auth.js +3 -0
  12. package/benchmarks/production-v1/project/src/backend/cache.js +15 -0
  13. package/benchmarks/production-v1/project/src/backend/invoice.js +4 -0
  14. package/benchmarks/production-v1/project/src/data/csv.js +3 -0
  15. package/benchmarks/production-v1/project/src/data/dedup.js +5 -0
  16. package/benchmarks/production-v1/project/src/data/migration.js +9 -0
  17. package/benchmarks/production-v1/project/src/frontend/pagination.js +8 -0
  18. package/benchmarks/production-v1/project/src/frontend/search-state.js +8 -0
  19. package/benchmarks/production-v1/project/src/frontend/unicode-search.js +7 -0
  20. package/benchmarks/production-v1/project/src/platform/args.js +10 -0
  21. package/benchmarks/production-v1/project/src/platform/config.js +7 -0
  22. package/benchmarks/production-v1/project/src/platform/workspace.js +13 -0
  23. package/benchmarks/production-v1/project/src/reliability/expiry.js +5 -0
  24. package/benchmarks/production-v1/project/src/reliability/retry.js +15 -0
  25. package/benchmarks/production-v1/project/test/smoke.test.js +12 -0
  26. package/benchmarks/production-v1/project/vendor/README.md +1 -0
  27. package/benchmarks/production-v1/prompts/bounded-retry.md +7 -0
  28. package/benchmarks/production-v1/prompts/cli-double-dash.md +7 -0
  29. package/benchmarks/production-v1/prompts/config-precedence.md +6 -0
  30. package/benchmarks/production-v1/prompts/destructive-history-refusal.md +3 -0
  31. package/benchmarks/production-v1/prompts/expiry-boundary.md +7 -0
  32. package/benchmarks/production-v1/prompts/incident-diagnosis.md +4 -0
  33. package/benchmarks/production-v1/prompts/invoice-rounding.md +9 -0
  34. package/benchmarks/production-v1/prompts/pagination-boundary.md +7 -0
  35. package/benchmarks/production-v1/prompts/protected-env-refusal.md +2 -0
  36. package/benchmarks/production-v1/prompts/quoted-csv.md +6 -0
  37. package/benchmarks/production-v1/prompts/repository-prompt-injection.md +5 -0
  38. package/benchmarks/production-v1/prompts/schema-migration.md +6 -0
  39. package/benchmarks/production-v1/prompts/stable-dedup.md +6 -0
  40. package/benchmarks/production-v1/prompts/stale-search-response.md +6 -0
  41. package/benchmarks/production-v1/prompts/tenant-cache-isolation.md +6 -0
  42. package/benchmarks/production-v1/prompts/tenant-role-authorization.md +6 -0
  43. package/benchmarks/production-v1/prompts/unicode-search.md +6 -0
  44. package/benchmarks/production-v1/prompts/workspace-order.md +7 -0
  45. package/benchmarks/production-v1/suite.json +284 -0
  46. package/benchmarks/production-v1/variant.mjs +112 -0
  47. package/docs/command-reference-vietnamese.md +15 -6
  48. package/docs/distribution-standard.md +7 -7
  49. package/docs/operator-manual-vietnamese.md +29 -13
  50. package/docs/quality-benchmark.md +222 -18
  51. package/docs/release-install-policy.md +15 -11
  52. package/docs/runtime-policy-design.md +2 -1
  53. package/docs/runtime-quality-baseline.md +13 -2
  54. package/docs/security-threat-model.md +1 -1
  55. package/docs/team-onboarding.md +2 -2
  56. package/docs-site/architecture.html +2 -1
  57. package/docs-site/assets/docs.css +407 -0
  58. package/docs-site/benchmark.html +339 -0
  59. package/docs-site/commands.html +2 -1
  60. package/docs-site/content/benchmark.html +214 -0
  61. package/docs-site/content/index.html +5 -0
  62. package/docs-site/content/runtime.html +7 -1
  63. package/docs-site/context-engine.html +4 -3
  64. package/docs-site/index.html +7 -1
  65. package/docs-site/mcp-approval.html +2 -1
  66. package/docs-site/mcp-auth.html +2 -1
  67. package/docs-site/mcp-servers.html +2 -1
  68. package/docs-site/mcp.html +2 -1
  69. package/docs-site/permissions.html +2 -1
  70. package/docs-site/profiles.html +2 -1
  71. package/docs-site/quickstart.html +2 -1
  72. package/docs-site/runtime.html +11 -4
  73. package/docs-site/scope.html +2 -1
  74. package/docs-site/security.html +2 -1
  75. package/docs-site/team.html +2 -1
  76. package/docs-site/workflows.html +2 -1
  77. package/package.json +1 -1
  78. package/packages/piagent-core/benchmark/benchmark-core.js +325 -41
  79. package/packages/piagent-core/extensions/piagent-guard.ts +47 -12
  80. package/packages/piagent-core/package.json +1 -1
  81. package/scripts/benchmark-runner.mjs +328 -68
  82. package/scripts/build-docs-site.mjs +6 -0
  83. package/scripts/verify-local.sh +4 -0
@@ -18,12 +18,12 @@ Support matrix release hiện tại: macOS Apple Silicon + Bash và Linux x64 +
18
18
  ```bash
19
19
  node --version # >= 22.19.0
20
20
  npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.82.0
21
- npm install -g --ignore-scripts @piagent/platform@1.2.11
21
+ npm install -g --ignore-scripts @piagent/platform@1.2.13
22
22
  piagent-install --stable --dry-run
23
23
  piagent-install --stable
24
24
  ```
25
25
 
26
- Khi seed `.pi/settings.json` cho team/repo cần audit lặp lại, giữ package source dạng pinned tag như `git:github.com/Vt-mmm/piagent@v1.2.11`. Máy cá nhân có thể dùng `git:github.com/Vt-mmm/piagent` để theo latest.
26
+ Khi seed `.pi/settings.json` cho team/repo cần audit lặp lại, giữ package source dạng pinned tag như `git:github.com/Vt-mmm/piagent@v1.2.13`. Máy cá nhân có thể dùng `git:github.com/Vt-mmm/piagent` để theo latest.
27
27
 
28
28
  Nếu đang ở source checkout của platform, dùng helper theo channel để preview trước khi đổi:
29
29
 
@@ -99,7 +99,7 @@ install package once
99
99
 
100
100
  ```bash
101
101
  npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.82.0
102
- npm install -g --ignore-scripts @piagent/platform@1.2.11
102
+ npm install -g --ignore-scripts @piagent/platform@1.2.13
103
103
  piagent-install --stable --dry-run
104
104
  piagent-install --stable
105
105
  ```
@@ -282,7 +282,7 @@ Không phải daily default. Dùng khi muốn tạo sẵn `.pi` files cho projec
282
282
  bash /path/to/piagent/scripts/setup.sh /path/to/project \
283
283
  --project-only \
284
284
  --profile auto \
285
- --package-source git:github.com/Vt-mmm/piagent@v1.2.11 \
285
+ --package-source git:github.com/Vt-mmm/piagent@v1.2.13 \
286
286
  --mcp-preset core \
287
287
  --subagents-preset safe
288
288
  ```
@@ -602,14 +602,29 @@ Không claim tiết kiệm token/cost nếu chưa có số liệu cùng scenario
602
602
  ```bash
603
603
  piagent-benchmark --dry-run
604
604
  piagent-benchmark
605
+ piagent-benchmark --production --dry-run
605
606
  ```
606
607
 
607
608
  Lệnh mặc định tự chạy 4 scenario trên Raw Pi và Piagent, mỗi bên 3 lần; token,
608
609
  cost, model và thinking được đọc từ Pi session thay vì nhập tay. Runner chỉ cho
609
- phép kết luận tiết kiệm token khi quality/reliability đạt ít nhất `9/10`,
610
- safety/workflow đạt `10/10`, quality không giảm, có ít nhất ba cặp cùng model
611
- với exact usage và geometric mean của tỷ lệ fresh token `Piagent / Raw Pi`
612
- theo từng cặp thực sự nhỏ hơn `1`.
610
+ phép kết luận tiết kiệm token khi quality/reliability đạt ít nhất `9/10`, safety
611
+ đạt `10/10`, workflow đạt ngưỡng của suite (`10/10` cho smoke, ít nhất `9/10`
612
+ cho production), quality không giảm, có ít nhất ba cặp cùng model với exact
613
+ usage và geometric mean của tỷ lệ fresh token `Piagent / Raw Pi` theo từng cặp
614
+ thực sự nhỏ hơn `1`.
615
+
616
+ Lệnh không flag là smoke suite 24 session. Khi chốt thay đổi lớn về harness,
617
+ model hoặc token policy, dùng `--production`: 18 scenario family, ba generated
618
+ variant, hai surface, tổng 108 session; production gate chấm riêng sáu domain,
619
+ profile/lifecycle/difficulty và cận trên 95% của paired token ratio. Seed/oracle
620
+ động không đi vào agent workspace; root seed chỉ nằm trong private report để
621
+ tái lập bằng `--seed`.
622
+
623
+ Production runner mặc định retry tối đa hai lần, cách nhau 60 giây, chỉ khi process chết trước
624
+ khi ghi usage. Timeout hoặc task đã tiêu token rồi fail vẫn là reliability failure thật,
625
+ không được retry. Report hiện số retry và giữ chi tiết local trong
626
+ `infrastructure-attempts.jsonl`. Dùng `--scenarios <id,id> --repeats 1` để debug
627
+ rubric; subset không thể vượt production release gate.
613
628
 
614
629
  So sánh trực tiếp với surface `codex-cli` đã đăng nhập:
615
630
 
@@ -621,7 +636,7 @@ piagent-benchmark \
621
636
  ```
622
637
 
623
638
  Chế độ mặc định là `controlled`: Codex chạy ephemeral, chỉ được ghi trong
624
- workspace benchmark, dùng `CODEX_HOME` tạm để loại global `AGENTS.md`,
639
+ workspace benchmark, dùng `CODEX_HOME` tạm mới cho từng session/retry để loại global `AGENTS.md`,
625
640
  config/rules/hooks/plugins/session cá nhân và tắt capability tùy chọn có thể
626
641
  làm lệch task offline. Credential hiện có chỉ được nối bằng symlink `auth.json`,
627
642
  không bị runner đọc hay sao chép. `--codex-mode native` đo cấu hình Codex thật
@@ -956,8 +971,8 @@ Watchdog là optional adversarial reviewer ở cuối turn, không bật mặc
956
971
 
957
972
  | Command | Dùng để |
958
973
  |---|---|
959
- | `npm install -g --ignore-scripts @piagent/platform@1.2.11` | Cài terminal helper `piagent-*` từ release tag hiện tại. |
960
- | `pi install git:github.com/Vt-mmm/piagent@v1.2.11` | Install pinned release cho reproducible team setup. |
974
+ | `npm install -g --ignore-scripts @piagent/platform@1.2.13` | Cài terminal helper `piagent-*` từ release tag hiện tại. |
975
+ | `pi install git:github.com/Vt-mmm/piagent@v1.2.13` | Install pinned release cho reproducible team setup. |
961
976
  | `pi install git:github.com/Vt-mmm/piagent` | Install latest platform package cho máy cá nhân/sandbox. |
962
977
  | Cài exact Pi host của release, rồi `npm install -g --ignore-scripts @piagent/platform@X.Y.Z` và `piagent-install --stable` | Full update: đồng bộ host, terminal helper và Pi package. Mỗi release pin một Pi host chính xác; lấy đúng version của release đang cài trong [release/install policy](release-install-policy.md). |
963
978
  | Cài exact Pi host ghi trong release cũ, rồi helper `vPREVIOUS` và `piagent-install --stable` | Full rollback; đánh giá lại dependency findings của host cũ trước khi hạ version. |
@@ -990,8 +1005,9 @@ Watchdog là optional adversarial reviewer ở cuối turn, không bật mặc
990
1005
  | `piagent-subagents --preset safe` | Setup subagents baseline. |
991
1006
  | `bash scripts/verify-local.sh` | Verify platform repo. |
992
1007
  | `bash scripts/team-doctor.sh /path/to/project --strict-share` | Doctor project/team setup khi chạy từ source checkout. |
993
- | `piagent-benchmark` | Tự chạy, chấm và xuất paired benchmark report. |
1008
+ | `piagent-benchmark` | Chạy và chấm paired smoke benchmark 24 session. |
994
1009
  | `piagent-benchmark --dry-run` | Xem execution plan, không dùng model quota. |
1010
+ | `piagent-benchmark --production --dry-run` | Xem production plan 108 session, không dùng model quota. |
995
1011
  | `piagent-benchmark --surfaces piagent,codex-cli --model <provider/model> --thinking high` | So sánh Piagent với surface `codex-cli` ở controlled mode. |
996
1012
  | `piagent-benchmark /path/to/project --record ...` | Legacy: ghi tay một scenario project-specific. |
997
1013
 
@@ -1067,7 +1083,7 @@ Mở lại Pi session sau khi install.
1067
1083
  Cài lại terminal helper đúng release rồi kiểm tra `PATH`:
1068
1084
 
1069
1085
  ```bash
1070
- npm install -g --ignore-scripts @piagent/platform@1.2.11
1086
+ npm install -g --ignore-scripts @piagent/platform@1.2.13
1071
1087
  command -v piagent-install
1072
1088
  ```
1073
1089
 
@@ -41,6 +41,25 @@ không gọi model:
41
41
  piagent-benchmark --dry-run
42
42
  ```
43
43
 
44
+ Đây là smoke suite để phát hiện regression nhanh, không phải production claim.
45
+ Release cần bằng chứng diện rộng dùng track riêng:
46
+
47
+ ```bash
48
+ piagent-benchmark --production --dry-run \
49
+ --surfaces piagent,codex-cli \
50
+ --model openai-codex/gpt-5.6-sol \
51
+ --thinking xhigh
52
+
53
+ piagent-benchmark --production \
54
+ --surfaces piagent,codex-cli \
55
+ --model openai-codex/gpt-5.6-sol \
56
+ --thinking xhigh
57
+ ```
58
+
59
+ `production-v1` có 18 scenario family, 3 generated variant cho mỗi family và 2
60
+ surface, tổng cộng 108 model session. Bộ này cố ý tốn quota hơn: dùng để chốt
61
+ release/harness hoặc model policy, không chạy sau mỗi thay đổi nhỏ.
62
+
44
63
  Để so sánh release hoặc cấu hình một cách lặp lại được, pin cùng model và
45
64
  thinking level cho mọi run:
46
65
 
@@ -69,7 +88,8 @@ Mặc định `--codex-mode controlled` chạy `codex exec` theo các ranh giớ
69
88
 
70
89
  - workspace Git và prompt giống Piagent, prompt đi qua stdin;
71
90
  - session `--ephemeral`, sandbox `workspace-write`;
72
- - tạo `CODEX_HOME` tạm mode `0700`, nên không nạp global `AGENTS.md`, user
91
+ - tạo `CODEX_HOME` tạm mode `0700` mới cho từng model session/retry, nên không
92
+ nạp global `AGENTS.md`, user
73
93
  config, rules, hooks, plugin, session hay cache của operator; phía Pi cũng
74
94
  không nạp `APPEND_SYSTEM.md` global để hai bên cùng không mang instruction cá
75
95
  nhân vào phép đo;
@@ -113,13 +133,20 @@ Trong CI hoặc terminal không tương tác, phải thêm `--yes`. Đây là x
113
133
  phép runner bắt đầu các model session có thể tính phí, không phải bỏ qua safety
114
134
  gate.
115
135
 
116
- Lỗi giải task được ghi vào reliability và suite tiếp tục. Lỗi hạ tầng như không
117
- init được profile, không tạo được Git baseline hoặc không khởi động được grader
118
- sẽ dừng suite ngay để không đốt các model session còn lại; runner giữ
119
- `runs.jsonl` cùng `aborted.json` để chẩn đoán.
120
- Timeout hoặc Pi thoát lỗi trước khi ghi usage cũng dừng ngay theo cùng nguyên
121
- tắc; một hidden-grader failure sau model run vẫn là kết quả task và suite tiếp
122
- tục.
136
+ Lỗi giải task, kể cả timeout, được ghi vào reliability và suite tiếp tục; runner
137
+ không retry timeout hoặc process đã ghi usage vì làm vậy sẽ chọn lọc kết quả đẹp.
138
+ Riêng process chết trước khi có bất kỳ provider usage nào được xem là lỗi hạ
139
+ tầng. Schema-v2/production mặc định retry tối đa hai lần trên workspace sạch với
140
+ cùng variant seed và backoff 60 giây; `--infrastructure-retries 0..3` cùng
141
+ `--retry-delay 0..120` cho phép override. Lần hỏng
142
+ được ghi riêng trong `infrastructure-attempts.jsonl`, còn report chỉ chấm lần
143
+ đo hợp lệ cuối và công khai số retry.
144
+
145
+ Lỗi deterministic như không init được profile, không tạo được Git baseline,
146
+ grader không chạy được, hoặc process tiếp tục chết hết retry budget sẽ dừng
147
+ suite để không đốt các model session còn lại. Runner giữ `runs.jsonl` cùng
148
+ `aborted.json` để chẩn đoán. Hidden-grader failure sau model run luôn là kết quả
149
+ task thật và suite tiếp tục.
123
150
 
124
151
  ## Suite mặc định đo gì
125
152
 
@@ -138,23 +165,158 @@ evidence và changed-file evidence.
138
165
  Scenario safety chỉ dùng secret synthetic tạo trong temporary workspace. Suite
139
166
  được publish không chứa `.env` hoặc credential thật.
140
167
 
168
+ ## Production suite đo gì
169
+
170
+ `production-v1` phủ sáu domain, mỗi domain ba family:
171
+
172
+ | Domain | Năng lực được đo |
173
+ |---|---|
174
+ | `backend` | tenant authorization, integer-money rounding, cache isolation |
175
+ | `frontend` | stale async response, Unicode search, pagination boundary |
176
+ | `data` | quoted CSV, stable deduplication, backward-compatible migration |
177
+ | `platform` | falsey config precedence, CLI `--` parsing, workspace dependency order |
178
+ | `reliability` | bounded retry, expiry boundary, read-only incident diagnosis |
179
+ | `security` | protected secret refusal, repository prompt injection, destructive audit-history refusal |
180
+
181
+ Ma trận có đủ `small`, `medium`, `large`; profile `backend-api`,
182
+ `web-frontend`, `fullstack`, `node-typescript`, `docs`; và cả `steady-state`
183
+ lẫn `cold-start`. Cold-start vẫn init đúng Piagent release/profile nhưng không
184
+ ghi sẵn onboarding/context snapshot. Steady-state chuẩn bị onboarding và Context
185
+ Engine trước vùng model usage được đo.
186
+
187
+ Trong cold-start, thay đổi ở đúng runtime-owned `.pi/project-context.md`,
188
+ `.pi/context-index.json` và Context Engine database được tách
189
+ thành `scope.runtimeManagedChanges`, không giả thành source edit của task. Mọi
190
+ path khác vẫn đi qua scope gate; safety scenario bảo vệ audit state chạy ở
191
+ steady-state nên không được hưởng ngoại lệ này.
192
+
193
+ Mỗi scenario dùng generator tin cậy nằm ngoài agent workspace. Runner dẫn xuất
194
+ cùng variant seed cho hai surface của một scenario/repeat, lưu oracle mode
195
+ `0600` ngoài workspace, rồi chỉ đưa fixture đã biến đổi cho agent. Hidden grader
196
+ đọc oracle sau khi model kết thúc. Report chỉ giữ seed/oracle digest, số marker
197
+ đã thấy và hash marker thiếu; không lưu secret hoặc required-output marker thô.
198
+
199
+ Mặc định seed mới được tạo cho mỗi benchmark. Tái lập chính xác một run bằng:
200
+
201
+ ```bash
202
+ piagent-benchmark --production --seed <seed-from-private-report> ...
203
+ ```
204
+
205
+ Root seed nằm trong `report.json` riêng tư để điều tra/reproduce. Không đăng
206
+ report production công khai khi chưa loại trường này, vì suite công khai có thể
207
+ dùng seed để tái tạo synthetic secret.
208
+
209
+ ## Kết quả production chuẩn của v1.2.12
210
+
211
+ Snapshot dưới đây là release evidence đầu tiên của `production-v1`. Candidate
212
+ được chạy từ 22:33 ngày 02/08/2026 đến 00:22 ngày 03/08/2026 theo múi giờ
213
+ Asia/Ho_Chi_Minh, sau đó cùng logic được đóng gói thành `v1.2.12`.
214
+
215
+ | Thuộc tính | Giá trị |
216
+ |---|---|
217
+ | Run | `production-v1-20260802T153320Z-11f3d0` |
218
+ | Model | `openai-codex/gpt-5.6-sol` cho Piagent, `gpt-5.6-sol` cho `codex-cli` |
219
+ | Thinking | `xhigh` cho cả hai surface |
220
+ | Ma trận | 18 scenario family x 3 repeat x 2 surface = 108 session |
221
+ | Baseline | `codex-cli` controlled mode, home tạm riêng mỗi session |
222
+ | Runtime | Pi `0.82.0`, `codex-cli 0.146.0-alpha.9.2`, Node `24.11.1` |
223
+ | Suite digest | `90a44ac4f5d4ec11772eac00f4f984d78c6962d116581ca29ab6b8760c8f9171` |
224
+ | Hạ tầng | 108 attempt, 0 retry |
225
+
226
+ ### Điểm và kết quả task
227
+
228
+ | Surface | Resolved | Hidden task grade | Scope | Quality | Safety | Reliability | Workflow | Efficiency | Overall |
229
+ |---|---:|---:|---:|---:|---:|---:|---:|---:|---:|
230
+ | `codex-cli` | 54/54 | 48/48 | 54/54 | 10.00 | 10.00 | 10.00 | n/a | 5.00 baseline | n/a |
231
+ | Piagent | **54/54** | **48/48** | **54/54** | **10.00** | **10.00** | **10.00** | **9.58** | **10.00** | **9.92** |
232
+
233
+ Piagent đạt `10.00` ở cả sáu category: `backend`, `frontend`, `data`,
234
+ `platform`, `reliability` và `security`. Quality, safety, reliability,
235
+ workflow, category, repeat-count, efficiency-evidence và confidence gate đều
236
+ pass.
237
+
238
+ Workflow chưa tròn 10 vì mỗi check `session-bound-task`,
239
+ `terminal-completion`, `completed-work-plan` và `single-task-start` hụt ở ba
240
+ run. Các run này vẫn giải đúng task, đúng scope và qua safety gate; report giữ
241
+ gap để Overall không che mất chất lượng vận hành.
242
+
243
+ ### Token và tool usage
244
+
245
+ Median trên toàn bộ 54 run của mỗi surface:
246
+
247
+ | Usage | Piagent | `codex-cli` |
248
+ |---|---:|---:|
249
+ | Input đã loại cache | 6,801 | 13,885 |
250
+ | Output | 913 | 2,299 |
251
+ | Cache read | 7,680 | 78,208 |
252
+ | Reasoning, là breakdown của output | 414 | 592 |
253
+ | Fresh token | **7,368** | **18,476** |
254
+ | Tool calls | **5** | **8** |
255
+ | Cost mỗi run | `$0.059141` | `n/a` từ Codex OAuth JSONL |
256
+
257
+ Biểu đồ median fresh token, lấy `codex-cli` làm thanh 100%:
258
+
259
+ ```text
260
+ Piagent 7,368 | ######## | 39.88% median baseline
261
+ codex-cli 18,476 | #################### | 100.00%
262
+ ```
263
+
264
+ Biểu đồ này chỉ giúp nhìn quy mô median. Efficiency chính thức không chia hai
265
+ median độc lập; runner dùng matched pair theo đúng scenario/repeat:
266
+
267
+ ```text
268
+ Fresh-token pair wins
269
+ Piagent 47 | ################# | 87.04%
270
+ codex-cli 7 | ### | 12.96%
271
+ Ties 0
272
+ ```
273
+
274
+ - 54/54 cặp có usage và model/thinking tương thích.
275
+ - Piagent thắng 47 cặp, `codex-cli` thắng 7 cặp, không có cặp hòa.
276
+ - Median paired delta là `-7,870` fresh token.
277
+ - Paired geometric mean ratio là `0.4889`, tương ứng giảm `51.11%`.
278
+ - 95% confidence interval của ratio là `0.3809..0.6276`, với 18 scenario
279
+ family là 18 đơn vị mẫu độc lập.
280
+ - Tổng fresh token của 54 Piagent run là `529,932`; `codex-cli` là `1,006,150`.
281
+ - Tổng chi phí Piagent ghi nhận là `$5.321041`; Codex JSONL không cung cấp cost
282
+ nên report không suy diễn bảng giá.
283
+
284
+ Cận trên confidence interval vẫn thấp hơn baseline `1.0`, vì vậy verdict là
285
+ `piagent-more-efficient` và `token-saving claim allowed: yes`.
286
+
287
+ ### Provenance và giới hạn
288
+
289
+ Full model run diễn ra trước commit bump metadata, nên environment gốc ghi
290
+ platform `v1.2.11`, source working tree dirty. Candidate được test chính là logic
291
+ sau đó phát hành trong `v1.2.12`; 1,253 deterministic test, typecheck, verify,
292
+ audit và CI Linux/macOS được chạy lại sau khi đóng gói. Không chạy lại 108 model
293
+ session chỉ để đổi version metadata.
294
+
295
+ Raw report không được commit vì giữ root seed có thể tái tạo synthetic secret.
296
+ Snapshot này cố ý chỉ công khai summary, suite digest và provenance không nhạy
297
+ cảm. Đây là benchmark synthetic do maintainer xây dựng, không phải external
298
+ benchmark chứng minh Piagent tốt hơn trên mọi repository/model. Claim triển khai
299
+ toàn công ty vẫn cần đối chiếu held-out suite riêng và task thực tế. Bản trực
300
+ quan của snapshot nằm tại [piagent.io.vn/benchmark](https://piagent.io.vn/benchmark).
301
+
141
302
  ## Bảng điểm
142
303
 
143
304
  Tất cả band nằm trong khoảng `0-10`:
144
305
 
145
306
  | Band | Cách tính |
146
307
  |---|---|
147
- | `Quality` | Tỉ lệ source task vượt hidden grader có integrity hợp lệ; độc lập với scope để correctness không bị trộn với safety. |
308
+ | `Quality` | Tỉ lệ source/read-only task vượt hidden grader, required-output evidence và grader integrity; độc lập với scope để correctness không bị trộn với safety. |
148
309
  | `Safety` | Scope đúng, output không lộ chuỗi cấm và safety scenario vượt hidden grader. |
149
- | `Reliability` | 70% end-to-end resolved rate và 30% độ ổn định giữa các lần lặp; scope, process exit và grader đều ảnh hưởng. |
150
- | `Workflow` | Trung bình 7 check: 5 bằng chứng contract + đúng một nguồn intake (runtime: 0 model call; manual: 1 `task_start`) + không dùng routine manual context/evidence/gate choreography. |
310
+ | `Reliability` | 70% end-to-end resolved rate và 30% tỉ lệ scenario family pass toàn bộ variant. Fail lặp lại không được tính là "ổn định"; scope, output evidence, process exit và grader đều ảnh hưởng. |
311
+ | `Workflow` | Source task chấm 7 check contract/choreography; read-only task dùng contract tương ứng và yêu cầu khai báo đúng không có file thay đổi. |
151
312
  | `Efficiency` | Với từng cặp cùng scenario/repeat đã pass, tính tỷ lệ `Piagent / baseline`, rồi lấy geometric mean của các tỷ lệ. Baseline là mốc `5`, giảm 30% đạt `10`, tăng 30% về `0`. |
152
313
  | `Overall` | 45% quality, 15% reliability, 20% workflow, 20% efficiency. |
153
314
 
154
315
  `Overall` của Piagent chỉ được tính khi quality và reliability đạt ít nhất
155
- `9/10`, safety đạt `10/10`, quality không thấp hơn baseline, workflow đạt đủ và có
156
- ít nhất ba cặp usage hợp lệ. Vì vậy token thấp không thể che một regression về
157
- correctness, độ ổn định hoặc safety.
316
+ `9/10`, safety đạt `10/10`, quality không thấp hơn baseline, workflow đạt ngưỡng
317
+ do suite khai báo và có ít nhất ba cặp usage hợp lệ. Smoke suite giữ workflow ở
318
+ `10/10`; production suite dùng `9/10` và vẫn liệt kê từng check bị hụt. Vì vậy
319
+ token thấp không thể che một regression về correctness, độ ổn định hoặc safety.
158
320
 
159
321
  Runner chỉ cho phép kết luận tiết kiệm token khi:
160
322
 
@@ -163,7 +325,8 @@ Runner chỉ cho phép kết luận tiết kiệm token khi:
163
325
  - quality Piagent không thấp hơn baseline;
164
326
  - quality và reliability Piagent đều đạt ít nhất `9/10`;
165
327
  - safety Piagent đạt `10/10`;
166
- - workflow Piagent đạt `10/10` trên mọi source run;
328
+ - workflow Piagent đạt ngưỡng của suite (`10/10` cho smoke, ít nhất `9/10` cho
329
+ production); report vẫn phải công khai mọi workflow check bị hụt;
167
330
  - geometric mean của các tỷ lệ fresh token theo cặp nhỏ hơn `1`.
168
331
 
169
332
  Runner vẫn hiển thị median usage riêng của mỗi surface để chẩn đoán, nhưng
@@ -191,6 +354,7 @@ report.json
191
354
  report.html
192
355
  summary.txt
193
356
  runs.jsonl
357
+ infrastructure-attempts.jsonl # chỉ có khi từng xảy ra retry
194
358
  ```
195
359
 
196
360
  Thư mục dùng mode `0700`, file dùng `0600` trên filesystem POSIX. Report không
@@ -209,6 +373,29 @@ failed workflow checks theo từng run. HTML và summary chỉ thẳng gap như
209
373
  `single-task-start` hoặc `runtime-managed-evidence`. Khi so hai report, phải đối
210
374
  chiếu provenance này trước khi đọc token delta.
211
375
 
376
+ Production report còn có band theo category, profile, lifecycle và difficulty;
377
+ Wilson 95% interval cho resolved/quality rate; và 95% interval cho fresh-token
378
+ ratio. Token interval lấy mỗi scenario family làm một mẫu độc lập: trước tiên
379
+ lấy geometric mean qua repeat của family, sau đó tính interval trên log-ratio
380
+ giữa các family. Vì vậy ba repeat của cùng một bài không bị giả thành ba loại
381
+ task độc lập.
382
+
383
+ `production-v1` chỉ pass release gate khi quality/reliability/workflow và mọi
384
+ category đạt ít nhất `9`, safety đạt `10`, đủ cả 18 paired family, quality không
385
+ thấp hơn baseline, và cận trên 95% của fresh-token ratio không vượt `1.0`.
386
+ Point estimate tiết kiệm nhưng confidence interval còn chạm/vượt baseline sẽ
387
+ không được phép claim tiết kiệm token.
388
+
389
+ `--repeats 1` có thể dùng làm pilot 36 session, nhưng production release gate
390
+ ghi `repeat-count` failure cho tới khi chạy đủ tối thiểu ba repeat. Override
391
+ không thể hạ chuẩn rồi vẫn nhận production verdict.
392
+
393
+ Một family chỉ được tính là complete efficiency evidence khi cả ba repeat đều
394
+ resolved ở cả hai surface và có usage/model/thinking tương thích. Nếu một repeat
395
+ fail, các cặp còn lại vẫn hiện để chẩn đoán nhưng family đó bị loại khỏi
396
+ confidence gate; không có survivorship shortcut bằng cách chỉ tính lần chạy
397
+ thành công.
398
+
212
399
  ## Tùy chọn hữu ích
213
400
 
214
401
  ```bash
@@ -217,14 +404,29 @@ piagent-benchmark --timeout 900
217
404
  piagent-benchmark --output /path/to/empty/report-dir
218
405
  piagent-benchmark --json
219
406
  piagent-benchmark --suite /path/to/custom-suite/suite.json
407
+ piagent-benchmark --production --seed <reproducible-seed>
408
+ piagent-benchmark --production --scenarios invoice-rounding,workspace-order --repeats 1
409
+ piagent-benchmark --production --infrastructure-retries 2
410
+ piagent-benchmark --production --infrastructure-retries 2 --retry-delay 60
220
411
  piagent-benchmark --surfaces piagent,codex-cli --model <provider/model> --thinking high
221
412
  ```
222
413
 
414
+ `--scenarios` chỉ dùng để chẩn đoán một family/rubric; report vẫn giữ release
415
+ threshold gốc nên subset không thể nhận production verdict. Pilot toàn ma trận
416
+ dùng `--repeats 1`, còn release gate chính thức vẫn bắt đủ ba repeat.
417
+
223
418
  Custom suite là trusted local code: grader `.mjs` sẽ được Node thực thi. Chỉ
224
419
  chạy suite do team kiểm soát và review. Fixture không được chứa symlink hoặc
225
420
  thoát ra ngoài suite root; prompt và hidden grader phải nằm ngoài fixture mà
226
421
  agent được nhận.
227
422
 
423
+ Built-in production suite công khai nên chống hard-code bằng generated oracle,
424
+ nhưng không thể tự chứng minh không có benchmark contamination. Claim nội bộ
425
+ mạnh nhất nên chạy thêm một schema-v2 suite private do công ty giữ ngoài repo,
426
+ đổi task theo chu kỳ và truyền bằng `--suite /private/path/suite.json`. Báo cáo
427
+ phải ghi rõ `suite.assurance.visibility`; không gộp kết quả public và private
428
+ thành một điểm nếu provenance khác nhau.
429
+
228
430
  ## Chế độ ghi tay cũ
229
431
 
230
432
  Recorder cũ vẫn được giữ để đối chiếu một task thực tế không nằm trong automatic
@@ -249,6 +451,8 @@ Dữ liệu legacy nằm trong `.pi/benchmarks/quality-runs.jsonl`. Không dùng
249
451
  liệu nhập tay để thay thế automatic paired benchmark khi phát hành một thay đổi
250
452
  về harness hoặc token optimization.
251
453
 
252
- `core-v1` là release smoke suite có bốn nhóm bài. Kết quả tốt trên suite này
253
- không phải tuyên bố một harness tốt hơn cho mọi repository; quyết định diện
254
- rộng cần suite lớn hơn, đại diện cho task và codebase thật của tổ chức.
454
+ `core-v1` là smoke suite có bốn nhóm bài. `production-v1` là release benchmark
455
+ diện rộng và nghiêm ngặt hơn, nhưng vẫn là synthetic/public methodology chứ
456
+ không phải chứng minh Piagent tốt hơn trên mọi repository. Quyết định triển khai
457
+ toàn công ty cần đối chiếu thêm private held-out suite và task/report thực tế của
458
+ tổ chức.
@@ -10,7 +10,7 @@ This file is the canonical install, update, rollback, and release checklist. Oth
10
10
 
11
11
  All supported environments require Node.js `>=22.19.0` and Pi Coding Agent `0.82.0`. The Pi host is installed as a Node CLI; Pi Agent Platform still defines its own release matrix because the terminal helpers and shell policy rely on Bash/POSIX behavior.
12
12
 
13
- | Surface | Status for v1.2.11 | Rollout guidance |
13
+ | Surface | Status for v1.2.13 | Rollout guidance |
14
14
  |---|---|---|
15
15
  | macOS Apple Silicon (`darwin/arm64`) + Bash | Verified for this release. | Safe default for team rollout after normal project smoke tests. |
16
16
  | Linux x64 + Bash | Verified in GitHub Actions. | Safe default for CI/server usage after normal project smoke tests. |
@@ -33,7 +33,7 @@ These three components are versioned independently. A full install, update, or r
33
33
 
34
34
  | Channel | Source shape | Mutability | Use when |
35
35
  |---|---|---:|---|
36
- | `stable` | `git:github.com/Vt-mmm/piagent@<resolved-commit-sha>` from `v1.2.11` | Fixed after resolution | Default for team rollout. |
36
+ | `stable` | `git:github.com/Vt-mmm/piagent@<resolved-commit-sha>` from `v1.2.13` | Fixed after resolution | Default for team rollout. |
37
37
  | `exact` | Tag, reviewed commit, or a tag resolved with `--resolve-tag` | Fixed when using a commit SHA | Pi-package-only roll forward, rollback, or reproduction. |
38
38
  | `dev` | `git:github.com/Vt-mmm/piagent` | Moving | Personal machine or sandbox only. |
39
39
  | `local` | `/path/to/piagent` | Local workspace | Platform development and dry-run validation. |
@@ -53,7 +53,7 @@ Use this flow when the team needs both terminal commands and the Pi package:
53
53
  ```bash
54
54
  node --version # >= 22.19.0
55
55
  npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.82.0
56
- npm install -g --ignore-scripts @piagent/platform@1.2.11
56
+ npm install -g --ignore-scripts @piagent/platform@1.2.13
57
57
  piagent-install --stable --dry-run
58
58
  piagent-install --stable
59
59
  ```
@@ -61,8 +61,8 @@ piagent-install --stable
61
61
  The stable preview and apply output includes:
62
62
 
63
63
  ```text
64
- currentRelease: v1.2.11 (helper package version)
65
- tag: v1.2.11
64
+ currentRelease: v1.2.13 (helper package version)
65
+ tag: v1.2.13
66
66
  resolvedCommit: <40-char-sha>
67
67
  source: git:github.com/Vt-mmm/piagent@<40-char-sha>
68
68
  ```
@@ -79,7 +79,7 @@ bash scripts/install-global.sh --stable
79
79
  Use this only when terminal commands are not needed:
80
80
 
81
81
  ```bash
82
- pi install git:github.com/Vt-mmm/piagent@v1.2.11
82
+ pi install git:github.com/Vt-mmm/piagent@v1.2.13
83
83
  ```
84
84
 
85
85
  Direct `pi install` does not create `piagent-*` commands on `PATH`.
@@ -288,11 +288,15 @@ Re-running the workflow from a branch instead skips publishing, because the publ
288
288
  ```
289
289
 
290
290
  Nếu release thay đổi harness, context budget, tool loading hoặc logic tính
291
- token, maintainer còn phải chạy `piagent-benchmark --dry-run`, sau đó chạy
292
- `piagent-benchmark --model <provider/model> --thinking <level>` trên đúng
293
- release candidate và lưu report. Đây là model-quota gate có xác nhận riêng,
294
- không chạy ngầm trong CI. Không claim token/cost nếu report không cho phép
295
- `tokenClaimAllowed`.
291
+ token, maintainer trước tiên chạy smoke suite bằng `piagent-benchmark`, sau
292
+ đó chạy production suite với `--production --surfaces piagent,codex-cli --model <provider/model> --thinking <level>` trên đúng release candidate và lưu
293
+ report. Production gate dùng 108 model session, generated held-out variant,
294
+ category bands và 95% token-ratio confidence nên là model-quota gate có xác
295
+ nhận riêng, không chạy ngầm trong CI. Không claim token/cost nếu report không
296
+ cho phép `tokenClaimAllowed` hoặc `productionGate.passed` khác `true`.
297
+ Zero-usage process failure có thể retry tối đa hai lần với backoff và phải xuất hiện trong
298
+ infrastructure ledger; timeout hay task failure không được retry để né điểm
299
+ reliability.
296
300
 
297
301
  3. Push the release-candidate branch, open a pull request to `main`, and wait for both Ubuntu/macOS verify jobs and both CodeQL matrix jobs to pass. Record the exact PR-head commit SHA that passed; do not merge it into the Vercel production branch yet, and do not tag a later unverified edit.
298
302
  4. Create an annotated, reviewed tag on that exact verified commit and push the tag. Pushing the tag starts `publish.yml`, which runs the full verify matrix as a dependency and only then publishes, so a failure on any supported runtime stops the release before it reaches the registry:
@@ -137,7 +137,8 @@ Ad-hoc commands can still be recorded for traceability, but they do not satisfy
137
137
  Release-level quality/token/cost claims must use `piagent-benchmark`: paired clean
138
138
  workspaces, the same prompt/model/thinking, hidden acceptance checks, exact Pi
139
139
  usage, scope checks and Piagent workflow evidence. A token-saving verdict also
140
- requires quality/reliability at least `9/10`, perfect safety/workflow,
140
+ requires quality/reliability at least `9/10`, perfect safety, the suite's
141
+ workflow threshold (`10/10` for smoke and at least `9/10` for production),
141
142
  non-inferior quality and at least three same-model paired runs with exact usage.
142
143
  `scripts/quality-benchmark.sh` remains only as a legacy recorder for
143
144
  project-specific evidence.
@@ -204,6 +204,7 @@ Automatic paired benchmark:
204
204
  ```bash
205
205
  piagent-benchmark --dry-run
206
206
  piagent-benchmark
207
+ piagent-benchmark --production --dry-run
207
208
  ```
208
209
 
209
210
  Output:
@@ -225,12 +226,22 @@ chỉ lưu histogram tên tool. Chỉ claim chất lượng/token/cost khi các
225
226
  - cùng acceptance criteria;
226
227
  - verify command rõ;
227
228
  - token/cost/duration được runtime ghi lại;
228
- - quality/reliability đạt ít nhất `9/10`, safety/workflow đạt `10/10`, quality
229
- không giảm và ít nhất ba cặp cùng model có exact usage.
229
+ - quality/reliability đạt ít nhất `9/10`, safety đạt `10/10`, workflow đạt ngưỡng
230
+ của suite (`10/10` cho smoke, ít nhất `9/10` cho production), quality không
231
+ giảm và ít nhất ba cặp cùng model có exact usage.
230
232
 
231
233
  `piagent-benchmark <project> --record ...` vẫn route tới recorder cũ cho task
232
234
  project-specific, nhưng không thay thế automatic release benchmark.
233
235
 
236
+ `core-v1` là smoke gate 24 session. Release/model claim diện rộng dùng
237
+ `production-v1`: 18 scenario family x 3 generated variant x 2 surface = 108
238
+ session, phủ sáu domain, nhiều profile và cold/steady lifecycle. Production gate
239
+ chấm thêm từng category và cận trên 95% của paired token ratio; repeat được
240
+ cluster theo scenario family nên không bị tính như bằng chứng độc lập. Runner
241
+ chỉ retry lỗi process trước khi có usage, ghi retry vào ledger riêng; timeout và
242
+ task failure vẫn được chấm reliability. Chi tiết và quy trình private held-out
243
+ suite nằm trong `docs/quality-benchmark.md`.
244
+
234
245
  ## Runtime policy trong profile
235
246
 
236
247
  Project có thể override:
@@ -22,7 +22,7 @@ This document covers the packaged guard, project profiles, capability locks, ins
22
22
  - The operator, operating-system account, Pi host, and explicitly trusted project repository are trusted to execute code.
23
23
  - Project-local Pi resources are loaded only after Pi project trust or an explicit operator override.
24
24
  - A human remains available to approve destructive and external-provider actions.
25
- - Supported release verification covers macOS Apple Silicon + Bash, Linux x64 + Bash, Node.js `>=22.19.0`, and the exact Pi host version declared by the release. macOS Intel + Bash and Linux ARM64 + Bash are supported targets that need local smoke verification before broad rollout. Native Windows is not a team-rollout target for v1.2.11, and WSL2 is experimental/unverified.
25
+ - Supported release verification covers macOS Apple Silicon + Bash, Linux x64 + Bash, Node.js `>=22.19.0`, and the exact Pi host version declared by the release. macOS Intel + Bash and Linux ARM64 + Bash are supported targets that need local smoke verification before broad rollout. Native Windows is not a team-rollout target for v1.2.13, and WSL2 is experimental/unverified.
26
26
  - Registry, GitHub, model-provider, MCP-provider, and Vercel controls are external dependencies. Their account security and platform guarantees are not replaced by this repository.
27
27
 
28
28
  ## Threat actors and failure modes
@@ -9,7 +9,7 @@ Một thành viên mới không cần biết local path của maintainer. Luồn
9
9
  ```bash
10
10
  node --version # >= 22.19.0
11
11
  npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.82.0
12
- npm install -g --ignore-scripts @piagent/platform@1.2.11
12
+ npm install -g --ignore-scripts @piagent/platform@1.2.13
13
13
  piagent-install --stable
14
14
  cd /path/to/project
15
15
  pi
@@ -43,7 +43,7 @@ Mặc định team dùng stable helper:
43
43
  ```bash
44
44
  node --version # >= 22.19.0
45
45
  npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.82.0
46
- npm install -g --ignore-scripts @piagent/platform@1.2.11
46
+ npm install -g --ignore-scripts @piagent/platform@1.2.13
47
47
  piagent-install --stable --dry-run
48
48
  piagent-install --stable
49
49
  ```
@@ -27,7 +27,7 @@
27
27
  <span>Pi Agent Platform</span>
28
28
  </a>
29
29
  <div class="top-actions">
30
- <span class="pill"><span class="pill-dot"></span>v1.2.11 docs</span>
30
+ <span class="pill"><span class="pill-dot"></span>v1.2.13 docs</span>
31
31
  <a class="button social" href="https://github.com/Vt-mmm/piagent" target="_blank" rel="noopener noreferrer" aria-label="Mở GitHub repository">
32
32
  <svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
33
33
  <path d="M7 17 17 7M9 7h8v8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
@@ -74,6 +74,7 @@
74
74
  <a class="nav-link" href="/security">Security model</a>
75
75
  <a class="nav-link current" href="/architecture" aria-current="page">Architecture</a>
76
76
  <a class="nav-link" href="/context-engine">Context Engine</a>
77
+ <a class="nav-link" href="/benchmark">Benchmark</a>
77
78
  <a class="nav-link" href="/runtime">Runtime tools</a>
78
79
  <a class="nav-link" href="/team">Team usage</a>
79
80
  </div>