@piagent/platform 1.6.0 → 1.6.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 (213) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +17 -14
  3. package/README.vi.md +26 -1
  4. package/benchmarks/production-v1/spend-control.v1.json +27 -3
  5. package/benchmarks/production-v1/suite.json +5 -1
  6. package/catalog/capabilities.json +16 -16
  7. package/docs/authority-manifest.md +1 -1
  8. package/docs/auto-delegation-policy.md +38 -73
  9. package/docs/command-reference-vietnamese.md +23 -31
  10. package/docs/context-engine.md +5 -3
  11. package/docs/context-window-policy.md +37 -1
  12. package/docs/distribution-standard.md +7 -7
  13. package/docs/en/architecture.md +26 -13
  14. package/docs/languages.json +4 -4
  15. package/docs/operator-manual-vietnamese.md +21 -41
  16. package/docs/publishing-for-teams.md +5 -0
  17. package/docs/quality-benchmark.md +179 -23
  18. package/docs/release-install-policy.md +6 -6
  19. package/docs/runtime-harness-standard.md +3 -3
  20. package/docs/security-threat-model.md +1 -1
  21. package/docs/subagent-orchestration-capabilities.md +19 -51
  22. package/docs/subagents-and-multiagent.md +21 -47
  23. package/docs/task-implementation-contract.md +3 -3
  24. package/docs/task-lifecycle-vietnamese.md +1 -1
  25. package/docs/team-onboarding.md +2 -2
  26. package/docs/vi/architecture.md +26 -13
  27. package/docs-site/architecture.html +1 -1
  28. package/docs-site/benchmark.html +89 -95
  29. package/docs-site/commands.html +1 -1
  30. package/docs-site/content/benchmark.html +88 -94
  31. package/docs-site/content/en/benchmark.html +134 -90
  32. package/docs-site/content/en/index.html +19 -19
  33. package/docs-site/content/en/runtime.html +4 -4
  34. package/docs-site/content/en/whats-new.html +12 -1
  35. package/docs-site/content/en/workflows.html +2 -2
  36. package/docs-site/content/index.html +19 -19
  37. package/docs-site/content/runtime.html +4 -4
  38. package/docs-site/content/whats-new.html +12 -1
  39. package/docs-site/content/workflows.html +2 -2
  40. package/docs-site/context-engine.html +1 -1
  41. package/docs-site/en/architecture.html +1 -1
  42. package/docs-site/en/benchmark.html +135 -91
  43. package/docs-site/en/commands.html +1 -1
  44. package/docs-site/en/context-engine.html +1 -1
  45. package/docs-site/en/index.html +20 -20
  46. package/docs-site/en/mcp-approval.html +1 -1
  47. package/docs-site/en/mcp-auth.html +1 -1
  48. package/docs-site/en/mcp-servers.html +1 -1
  49. package/docs-site/en/mcp.html +1 -1
  50. package/docs-site/en/permissions.html +1 -1
  51. package/docs-site/en/profiles.html +1 -1
  52. package/docs-site/en/quickstart.html +1 -1
  53. package/docs-site/en/runtime.html +5 -5
  54. package/docs-site/en/scope.html +1 -1
  55. package/docs-site/en/security.html +1 -1
  56. package/docs-site/en/team.html +1 -1
  57. package/docs-site/en/whats-new.html +13 -2
  58. package/docs-site/en/workflows.html +3 -3
  59. package/docs-site/index.html +20 -20
  60. package/docs-site/mcp-approval.html +1 -1
  61. package/docs-site/mcp-auth.html +1 -1
  62. package/docs-site/mcp-servers.html +1 -1
  63. package/docs-site/mcp.html +1 -1
  64. package/docs-site/permissions.html +1 -1
  65. package/docs-site/profiles.html +1 -1
  66. package/docs-site/quickstart.html +1 -1
  67. package/docs-site/runtime.html +5 -5
  68. package/docs-site/scope.html +1 -1
  69. package/docs-site/security.html +1 -1
  70. package/docs-site/team.html +1 -1
  71. package/docs-site/whats-new.html +13 -2
  72. package/docs-site/workflows.html +3 -3
  73. package/evals/fixtures/benchmark-assurance-evidence.invalid.json +1 -1
  74. package/evals/fixtures/benchmark-assurance-evidence.valid.json +1 -1
  75. package/evals/fixtures/codex-relative-efficiency-v1.invalid.json +4 -0
  76. package/evals/fixtures/codex-relative-efficiency-v1.valid.json +94 -0
  77. package/evals/fixtures/helper-request.invalid.json +1 -1
  78. package/evals/fixtures/helper-request.valid.json +1 -1
  79. package/evals/fixtures/piagent-webui/subagent-tree-v1.valid.json +7 -0
  80. package/evals/fixtures/task-authority-snapshot.valid.json +4 -4
  81. package/evals/fs4-readiness-matrix.v1.json +2 -2
  82. package/evals/fs5-causal-arm.v1.json +2 -2
  83. package/evals/fs5-pilot-protocol.v1.json +3 -3
  84. package/evals/fs5-pilot-protocol.v2.json +8 -8
  85. package/evals/fs5-pilot-protocol.v3.json +8 -8
  86. package/evals/fs5-pilot-protocol.v4.json +6 -6
  87. package/evals/fs5-pilot-protocol.v5.json +7 -6
  88. package/evals/private-holdout-v1/public-exposure.v1.json +1 -1
  89. package/evals/runtime-conformance-v1/README.md +43 -0
  90. package/evals/runtime-conformance-v1/evaluate-paid-canary.mjs +198 -0
  91. package/evals/runtime-conformance-v1/lane.json +57 -0
  92. package/evals/runtime-conformance-v1/paid-canary.json +31 -0
  93. package/evals/runtime-conformance-v1/runner.mjs +456 -0
  94. package/package.json +1 -1
  95. package/packages/piagent-core/README.md +13 -4
  96. package/packages/piagent-core/benchmark/benchmark-codex-relative-efficiency.js +698 -0
  97. package/packages/piagent-core/benchmark/benchmark-core.js +4 -3
  98. package/packages/piagent-core/benchmark/benchmark-forensics.js +4 -2
  99. package/packages/piagent-core/benchmark/benchmark-preflight.js +3 -1
  100. package/packages/piagent-core/benchmark/benchmark-provider-free-evidence.js +345 -0
  101. package/packages/piagent-core/benchmark/benchmark-record-validation.js +74 -5
  102. package/packages/piagent-core/benchmark/benchmark-report.js +15 -1
  103. package/packages/piagent-core/benchmark/benchmark-runtime-causal.js +244 -0
  104. package/packages/piagent-core/benchmark/benchmark-stage-diagnostic.js +201 -4
  105. package/packages/piagent-core/benchmark/benchmark-suite.js +22 -1
  106. package/packages/piagent-core/benchmark/benchmark-summary-support.js +4 -0
  107. package/packages/piagent-core/benchmark/benchmark-usage.js +15 -4
  108. package/packages/piagent-core/capabilities/runtime-integrity.js +3 -0
  109. package/packages/piagent-core/extensions/acceptance-behavior-proof.js +806 -0
  110. package/packages/piagent-core/extensions/acceptance-receipt.js +89 -48
  111. package/packages/piagent-core/extensions/context-engine.js +1 -11
  112. package/packages/piagent-core/extensions/context-index-policy.js +4 -0
  113. package/packages/piagent-core/extensions/context-query-paths.js +57 -0
  114. package/packages/piagent-core/extensions/criterion-context-pack.js +16 -3
  115. package/packages/piagent-core/extensions/criterion-graph.js +4 -1
  116. package/packages/piagent-core/extensions/fallback-base-policy.ts +101 -0
  117. package/packages/piagent-core/extensions/guard-types.ts +4 -0
  118. package/packages/piagent-core/extensions/piagent-guard.ts +194 -226
  119. package/packages/piagent-core/extensions/task-lifecycle.js +32 -0
  120. package/packages/piagent-core/extensions/task-state.js +69 -8
  121. package/packages/piagent-core/extensions/verification-intelligence.js +49 -12
  122. package/packages/piagent-core/extensions/workspace-evidence-roots.js +52 -16
  123. package/packages/piagent-core/package.json +1 -1
  124. package/packages/piagent-core/policies/base-policy.json +42 -2
  125. package/packages/piagent-core/policy/authority-manifest.v1.json +3 -3
  126. package/packages/piagent-core/prompts/be-to-fe.md +2 -8
  127. package/packages/piagent-core/prompts/plan.md +1 -1
  128. package/packages/piagent-core/prompts/platform-improve.md +2 -6
  129. package/packages/piagent-core/prompts/review.md +2 -7
  130. package/packages/piagent-core/prompts/scout.md +1 -1
  131. package/packages/piagent-core/prompts/task.md +4 -3
  132. package/packages/piagent-core/runtime/hooks/completion-hook.ts +7 -6
  133. package/packages/piagent-core/runtime/hooks/input-hook.ts +6 -0
  134. package/packages/piagent-core/runtime/hooks/session-start-hook.ts +100 -1
  135. package/packages/piagent-core/runtime/hooks/tool-result-hook.ts +58 -72
  136. package/packages/piagent-core/runtime/hooks/tool-result-value-helpers.ts +66 -0
  137. package/packages/piagent-core/runtime/inspection/bounded-emission-guard.ts +286 -0
  138. package/packages/piagent-core/runtime/inspection/runtime-event-store.ts +37 -7
  139. package/packages/piagent-core/runtime/inspection/task-subagent-tree.ts +27 -4
  140. package/packages/piagent-core/runtime/inspection/tool-failure-classification.ts +20 -3
  141. package/packages/piagent-core/runtime/inspection/webui-snapshot.ts +47 -11
  142. package/packages/piagent-core/runtime/orchestration/helper-lifecycle.ts +16 -12
  143. package/packages/piagent-core/runtime/orchestration/minimal-delegation-policy.ts +71 -0
  144. package/packages/piagent-core/runtime/orchestration/owned-work-budget.ts +28 -20
  145. package/packages/piagent-core/runtime/orchestration/role-policy.ts +27 -9
  146. package/packages/piagent-core/runtime/orchestration/subagent-tool-policy.ts +329 -0
  147. package/packages/piagent-core/runtime/policy/block-remedy.ts +0 -4
  148. package/packages/piagent-core/runtime/product/efficiency-metrics.ts +3 -0
  149. package/packages/piagent-core/runtime/quality/edit-freshness-guard.ts +102 -0
  150. package/packages/piagent-core/runtime/quality/exact-output-contract.ts +20 -10
  151. package/packages/piagent-core/runtime/quality/performance-assurance.ts +3 -3
  152. package/packages/piagent-core/runtime/recovery/continuation-budget.ts +1 -1
  153. package/packages/piagent-core/runtime/recovery/handoff-projection.ts +4 -1
  154. package/packages/piagent-core/runtime/recovery/pristine-task-policy-refresh.ts +91 -0
  155. package/packages/piagent-core/runtime/recovery/recovery-policy.ts +7 -4
  156. package/packages/piagent-core/runtime/recovery/resume-state.ts +112 -14
  157. package/packages/piagent-core/runtime/recovery/semantic-repair-handshake.ts +7 -13
  158. package/packages/piagent-core/runtime/recovery/task-evidence-coverage-refresh.ts +217 -0
  159. package/packages/piagent-core/runtime/registration/context-commands.ts +16 -2
  160. package/packages/piagent-core/runtime/registration/knowledge-tools.ts +9 -5
  161. package/packages/piagent-core/runtime/registration/operator-request-intake.ts +49 -0
  162. package/packages/piagent-core/runtime/registration/policy-tools.ts +4 -4
  163. package/packages/piagent-core/runtime/registration/session-commands.ts +1 -1
  164. package/packages/piagent-core/runtime/registration/task-completion-tools.ts +12 -9
  165. package/packages/piagent-core/runtime/registration/task-evidence-tools.ts +21 -12
  166. package/packages/piagent-core/runtime/registration/task-start-guidance.ts +19 -13
  167. package/packages/piagent-core/runtime/registration/task-start-manifest.ts +54 -0
  168. package/packages/piagent-core/runtime/registration/task-start-tool.ts +57 -57
  169. package/packages/piagent-core/runtime/runtime-limits.ts +16 -2
  170. package/packages/piagent-core/runtime/session/adaptive-context-analysis.ts +461 -0
  171. package/packages/piagent-core/runtime/session/adaptive-context-governor.ts +464 -0
  172. package/packages/piagent-core/runtime/session/adaptive-context-ledger.ts +265 -0
  173. package/packages/piagent-core/runtime/session/message-signals.ts +7 -3
  174. package/packages/piagent-core/runtime/session/operator-request-carry.ts +44 -0
  175. package/packages/piagent-core/runtime/session/runtime-state.ts +11 -7
  176. package/packages/piagent-core/runtime/session/source-checkout-read-grants.ts +35 -0
  177. package/packages/piagent-core/runtime/session/system-prompt.ts +76 -14
  178. package/packages/piagent-core/runtime/session/task-contract-presentation.ts +39 -0
  179. package/packages/piagent-core/runtime/tools/phase-tools.ts +8 -8
  180. package/packages/piagent-core/runtime/tools/tool-groups.ts +12 -2
  181. package/packages/piagent-core/runtime/verification/exact-verifier-reuse.ts +101 -0
  182. package/packages/piagent-core/runtime/workflows/runtime-intake-compaction.ts +164 -0
  183. package/packages/piagent-core/runtime/workflows/task-intake.ts +167 -39
  184. package/packages/piagent-core/subagents/piagent-oracle.md +5 -3
  185. package/packages/piagent-core/subagents/piagent-planner.md +6 -4
  186. package/packages/piagent-core/subagents/piagent-reviewer.md +5 -3
  187. package/packages/piagent-core/subagents/piagent-scout.md +4 -2
  188. package/packages/piagent-core/subagents/piagent-worker.md +6 -4
  189. package/packages/piagent-webui/dist/client/assets/{MarkdownMessage-CxeZqTte.js → MarkdownMessage-B4XehTCU.js} +1 -1
  190. package/packages/piagent-webui/dist/client/assets/{index-DynIMe8I.js → index-CgOEyRPG.js} +4 -4
  191. package/packages/piagent-webui/dist/client/index.html +1 -1
  192. package/packages/piagent-webui/extension/piagent-webui.ts +3 -1
  193. package/packages/piagent-webui/extension/same-session-bridge.ts +1 -1
  194. package/packages/piagent-webui/extension/session-stream-adapter.ts +33 -10
  195. package/packages/piagent-webui/gateway/gateway-session-stream.ts +37 -21
  196. package/packages/piagent-webui/gateway/session-operation-lifecycle.ts +237 -0
  197. package/packages/piagent-webui/gateway/session-operation-retry-control.ts +38 -0
  198. package/packages/piagent-webui/gateway/session-operation-watchdog.ts +9 -2
  199. package/packages/piagent-webui/gateway/session-runtime-supervisor.ts +8 -7
  200. package/packages/piagent-webui/ownership/session-lease-store.ts +5 -2
  201. package/packages/piagent-webui/server/core-inspection-provider.ts +2 -1
  202. package/packages/piagent-webui/server/transcript-projection.ts +91 -5
  203. package/schemas/codex-relative-efficiency-v1.schema.json +155 -0
  204. package/schemas/piagent-webui/runtime-event-v2.schema.json +15 -5
  205. package/schemas/piagent-webui/subagent-tree-v1.schema.json +11 -1
  206. package/schemas/project-profile.schema.json +1 -1
  207. package/schemas/task-contract.schema.json +15 -0
  208. package/scripts/benchmark-runner-core.mjs +14 -6
  209. package/scripts/benchmark-runner-finalization.mjs +4 -0
  210. package/scripts/configure-subagents.sh +42 -34
  211. package/scripts/helper-evaluation.mjs +1 -1
  212. package/scripts/team-doctor.sh +1 -1
  213. package/scripts/verify-local.sh +5 -0
@@ -325,7 +325,7 @@ Các command này thuộc Pi core hoặc package Pi chính. Tên/availability c
325
325
 
326
326
  Các command này đến từ package `pi-subagents`. Tên hơi “package terminology”, nên bảng dưới dịch ra nghĩa thực tế.
327
327
 
328
- Quan trọng: daily flow không bắt anh phải nhớ các lệnh này. Các workflow `/workflow task`, `/workflow be-to-fe`, `/workflow platform-improve`, `/workflow plan`, `/workflow review` dùng solo-first orchestration: parent agent lập task tree/review lenses trước, rồi chỉ spawn subagent khi task có phần việc độc lập và đáng token. Slash command dưới đây dùng khi anh muốn ép orchestration cụ thể hoặc debug.
328
+ Quan trọng: Piagent mặc định parent-direct và helpers `off`. Các lệnh dưới đây phần lớn là capability upstream để inspect/debug. Piagent config chặn builtin, worker, parallel, nested và retry; operator chỉ có thể opt-in một helper read-only context fresh, và runtime vẫn yêu cầu hai lane độc lập cùng projected net saving từ 30%.
329
329
 
330
330
  | Command | Dịch nghĩa dễ hiểu | Dùng khi nào | Kết quả mong đợi |
331
331
  |---|---|---|---|
@@ -342,16 +342,10 @@ Quan trọng: daily flow không bắt anh phải nhớ các lệnh này. Các wo
342
342
  | `/subagents-generate-profiles <provider>` | Sinh quota/quality profiles | Khi muốn profile model theo quota/chất lượng. | Tạo profile cho provider. |
343
343
  | `/subagents-check-profile <name>` | Check profile | Khi profile/model có thể stale. | Re-check model availability/auth. |
344
344
  | `/run <agent> "<task>"` | Chạy 1 subagent | Khi cần 1 scout/reviewer/planner riêng context. | Child session chạy task rồi trả summary về parent. |
345
- | `/run <agent> "<task>" --bg` | Chạy background | Khi muốn agent chạy nền rồi mình xem sau. | Dùng `/subagents-fleet` để follow. |
346
- | `/run <agent> "<task>" --fork` | Chạy từ forked session | Khi child cần inherited conversation/context branch. | Fork thật từ parent leaf; dùng fresh nếu không cần history. |
347
- | `/parallel ...` | Chạy nhiều agent song song | Khi các việc độc lập, nhất là read-only review/scout/test analysis. | Parent đợi hoặc gom kết quả tùy flow. |
348
- | `/chain ...` | Chạy tuần tự | Khi output agent trước là input agent sau. | Dùng `{previous}` để truyền summary trước đó. |
349
- | `/run-chain <name>` | Chạy chain đã lưu | Khi có workflow lặp lại. | Package chạy recipe chain đã định nghĩa. |
350
- | `/parallel-review` | Review song song | Khi cần nhiều reviewer theo góc nhìn độc lập. | Có thể thêm `autofix` nếu đã cho phép sửa. |
351
- | `/review-loop` | Worker/reviewer/fix loop | Khi muốn review đến khi sạch hoặc hết vòng. | Nên set max rounds, thường dùng tối đa 3 vòng. |
352
- | `/parallel-research` | Research song song | Khi cần external evidence + local scout. | Builtin `researcher` cần `pi-web-access`. |
353
- | `/parallel-context-build` | Build context handoff | Khi task lớn cần `context.md`/meta-prompt trước planning. | Dùng `context-builder` agents. |
354
- | `/parallel-handoff-plan` | Research + context + plan | Khi muốn handoff plan đầy đủ cho implementation. | Tốt cho architecture hoặc platform change lớn. |
345
+ | `/run <agent> "<task>" --bg` | Capability upstream | Piagent không bật async mặc định. | Không dùng trong governed default. |
346
+ | `/run <agent> "<task>" --fork` | Capability upstream | Inherit history trái policy context fresh. | Piagent từ chối. |
347
+ | `/parallel ...`, `/chain ...`, `/run-chain ...` | Capability upstream | Nhân số turn/context. | Piagent config giới hạn 1 và không dispatch parallel/chain. |
348
+ | `/parallel-review`, `/review-loop`, `/parallel-research`, `/parallel-context-build`, `/parallel-handoff-plan` | Capability upstream | Tạo nhiều helper hoặc retry loop. | Piagent config không cho dùng. |
355
349
  | `/gather-context-and-clarify` | Scout rồi hỏi đúng câu | Khi requirement chưa rõ nhưng cần đọc trước. | Trả clarification questions có evidence. |
356
350
  | `/parallel-cleanup` | Cleanup review sau implement | Khi muốn rà cleanup đáng làm. | Có thể thêm `autofix`. |
357
351
 
@@ -364,7 +358,7 @@ Glossary:
364
358
  | `fleet` | “Đội” child sessions đang chạy hoặc vừa chạy xong. |
365
359
  | `scout` | Agent đọc/map code read-only. |
366
360
  | `planner` | Agent lập plan và verify gate, không sửa code. |
367
- | `worker` | Agent sửa code theo plan. |
361
+ | `worker` | Metadata compatibility; bị Piagent disable. |
368
362
  | `reviewer` | Agent review diff/test/scope. |
369
363
  | `oracle` | Agent phản biện/risk challenge. |
370
364
  | `researcher` | Builtin agent nghiên cứu web/docs có nguồn; cần `pi-web-access`. |
@@ -372,7 +366,7 @@ Glossary:
372
366
  | `chain` | Làm A rồi dùng kết quả A để làm B. |
373
367
  | `parallel` | Làm nhiều nhánh độc lập cùng lúc. |
374
368
  | `bg` | Background run, không block parent ngay. |
375
- | `fork` | Child bắt đầu từ nhánh session hiện tại thay vì context fresh. |
369
+ | `fork` | Capability upstream; Piagent cấm vì helper phải context fresh. |
376
370
  | `watchdog` | Opt-in adversarial reviewer ở cuối turn; không phải `reviewer` subagent. |
377
371
  | `worktree` | Checkout riêng cho parallel writers để tránh đè file nhau. |
378
372
 
@@ -382,7 +376,7 @@ Piagent subagents:
382
376
  |---|---|---|
383
377
  | `piagent-scout` | Map repo/module/spec trước khi sửa. | Read-only. |
384
378
  | `piagent-planner` | Lập implementation plan. | Read-only. |
385
- | `piagent-worker` | Implement task đã rõ/đã approve. | Có thể write trong scope. |
379
+ | `piagent-worker` | Compatibility metadata; bị Piagent config disable. | Không dispatch. |
386
380
  | `piagent-reviewer` | Review diff, verify coverage, scope drift. | Review-first. |
387
381
  | `piagent-oracle` | Challenge architecture/risk. | Read-only. |
388
382
 
@@ -416,24 +410,21 @@ Một số option hữu ích:
416
410
  ```text
417
411
  /run reviewer[model=anthropic/claude-sonnet-5:high] "Review this diff"
418
412
  /run scout[output=context.md,outputMode=file-only] "Map auth flow"
419
- /chain scout[output=context.md,as=context] "Scan" -> planner[reads=context.md] "Plan from {outputs.context}"
420
413
  subagent({ action: "status", view: "fleet" })
421
414
  subagent({ action: "status", id: "<run-id>", view: "transcript", lines: 120 })
422
- subagent({ action: "grant-spawn-budget", additional: 10 })
423
415
  ```
424
416
 
425
417
  `outputMode=file-only` hữu ích khi child tạo report dài: parent chỉ nhận đường dẫn file, không bị nhồi full report vào context.
426
418
 
427
419
  ## Khi nào nên spawn subagent
428
420
 
429
- Theo provider docs, subagent tốt nhất cho việc độc lập và bounded:
421
+ Trong Piagent, helper chỉ được dispatch khi tất cả điều kiện sau đúng:
430
422
 
431
- - codebase exploration;
432
- - map contract/API/schema;
433
- - đọc docs/spec dài rồi tóm tắt;
434
- - review correctness/security/tests/scope drift theo nhiều góc nhìn;
435
- - chạy/test analysis không cần sửa cùng file;
436
- - compress context trước khi parent/worker implement.
423
+ - operator đã bật `PIAGENT_HELPERS_MODE=on`;
424
+ - runtime chứng minh ít nhất hai lane độc lập;
425
+ - helper không cần chờ output tiếp theo của parent;
426
+ - handoff context fresh, không inherit history, tối đa 2.048 token;
427
+ - projected tổng token sau cả handoff/merge tiết kiệm ít nhất 30%.
437
428
 
438
429
  Không nên spawn bừa khi:
439
430
 
@@ -446,11 +437,11 @@ Không nên spawn bừa khi:
446
437
  Default của platform là an toàn:
447
438
 
448
439
  - `maxSubagentDepth: 1`: parent spawn child, child không fan-out tiếp.
449
- - `parallel.concurrency: 3`: không mở quá nhiều child cùng lúc.
440
+ - `parallel.concurrency: 1`: compatibility ceiling, không chạy song song.
450
441
  - `asyncByDefault: false`: không tự chạy background nếu anh không yêu cầu.
451
- - Một `piagent-worker` tại một thời điểm; parallel chủ yếu dùng cho scout/reviewer.
442
+ - Tổng 1 read-only helper, 0 worker, 0 retry.
452
443
 
453
- Nếu anh không gọi gì thêm, `/workflow task` vẫn chạy solo-first và chỉ tự dùng subagent theo `docs/auto-delegation-policy.md` khi có scout/planning/review độc lập đáng làm. Alias `/task` giữ cùng policy.
444
+ Nếu anh không bật gì thêm, `/workflow task` chạy parent-direct và không tạo model turn phụ. Alias `/task` giữ cùng policy.
454
445
 
455
446
  ## Prompt mẫu cho bài toán thật
456
447
 
@@ -480,7 +471,7 @@ Use piagent-reviewer before final.
480
471
  Nếu muốn parallel read-only:
481
472
 
482
473
  ```text
483
- Run parallel piagent-scout agents: one maps backend contract read-only, one maps frontend route/state usage. Wait for both, then plan FE implementation.
474
+ Keep the parent direct. If helper mode was explicitly enabled and the runtime proves at least 30% net saving, run one fresh read-only piagent-scout for the single highest-value independent lane.
484
475
  ```
485
476
 
486
477
  ### Review trước khi ship
@@ -502,8 +493,8 @@ Các lệnh này chạy ngoài Pi.
502
493
  | Command | Dùng khi nào |
503
494
  |---|---|
504
495
  | `npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.84.1` | Cài Pi CLI tương thích với release hiện tại. |
505
- | `npm install -g --ignore-scripts @piagent/platform@1.6.0` | Cài terminal helper `piagent-*` từ release tag hiện tại. |
506
- | `pi install git:github.com/Vt-mmm/piagent@v1.6.0` | Cài pinned release khi cần reproducible team setup. |
496
+ | `npm install -g --ignore-scripts @piagent/platform@1.6.1` | Cài terminal helper `piagent-*` từ release tag hiện tại. |
497
+ | `pi install git:github.com/Vt-mmm/piagent@v1.6.1` | Cài pinned release khi cần reproducible team setup. |
507
498
  | `pi install git:github.com/Vt-mmm/piagent` | Cài latest package platform cho máy cá nhân/sandbox. |
508
499
  | `piagent-update --check` | Báo version hiện tại vs version sẽ lên cho cả ba thành phần; không cài gì. |
509
500
  | `piagent-update` | Full update global một lệnh cho cả máy: Pi host → npm-global helper → Pi package, đúng thứ tự release yêu cầu. |
@@ -552,7 +543,8 @@ Các lệnh này chạy ngoài Pi.
552
543
  | `npm run benchmark:deep -- --dry-run` | Validate `deep-logic-v1`: 7 family difficulty large × 3 repeat × Piagent/`codex-cli` = 42 session, khóa Luna/medium và chưa dùng quota. |
553
544
  | `npm run benchmark:deep` | Chạy paired deep-logic benchmark Luna/medium cho event/state, scheduler, policy, context graph, stream recovery, transactional config và temporal usage billing chính xác. |
554
545
  | `piagent-benchmark --production --dry-run` | Xem ma trận production 18 family x 3 variant x 2 surface = 108 session, chưa dùng quota. |
555
- | `piagent-benchmark --production --surfaces piagent,codex-cli --model <provider/model> --thinking high --piagent-treatment candidate` | Chạy production release gate đa domain/profile/lifecycle với controlled Codex, treatment Piagent đã pin, paired outcome và 95% token-ratio confidence. |
546
+ | `piagent-benchmark --production --preflight-only` | Trước lượt trả phí, tự chạy/cache ba lane provider-free cùng exact source/tree/config/runner binding; lần đầu có long-horizon tối thiểu 30 phút, 0 provider call/model token. |
547
+ | `piagent-benchmark --production --surfaces piagent,codex-cli --model openai-codex/gpt-5.6-luna --thinking medium --piagent-treatment candidate` | Chạy production release gate đa domain/profile/lifecycle với controlled Codex; S12/S36/S72 chặn pooled fresh ratio >1.10, observed family >1.25 hoặc subagent vượt 1 attempt/5% traffic; S108 dùng upper-95 <=0.60. |
556
548
  | `piagent-benchmark --piagent-treatment release-defaults\|local-safe\|candidate\|feature-off ...` | Pin treatment Piagent; chỉ surface `piagent` nhận feature env, manifest/resume/replay/report giữ nguyên treatment. |
557
549
  | `piagent-benchmark --codex-mode native ...` | Đo UX Codex theo cấu hình operator; protocol gate fail closed nên report không được claim tiết kiệm token. |
558
550
  | `piagent-benchmark --production --seed <value> ...` | Tái lập đúng generated variant của một production report riêng tư. |
@@ -576,7 +568,7 @@ Khi đang develop chính repo `piagent`, có thể dùng npm scripts tương ứ
576
568
  | `npm run init-project -- <project>` | `bash scripts/init-project.sh <project>` |
577
569
  | `npm run doctor -- <project> --strict-share` | `bash scripts/team-doctor.sh <project> --strict-share` |
578
570
  | `npm run benchmark -- ...` | `node scripts/benchmark-runner.mjs ...` |
579
- | `npm run benchmark:webui-parity` | Gate provider-free cho 10 workflow, 32 Project Controls, contract/security, Chromium flow và ba cỡ performance stress. |
571
+ | `npm run benchmark:webui-parity` | Gate provider-free cho 10 workflow, 32 Project Controls, contract/security, bảy deterministic UI-stability suite, Chromium flow và ba cỡ performance stress. |
580
572
  | `npm run usage -- <project>` | `bash scripts/pi-session-stats.sh <project>` |
581
573
  | `npm run usage -- --history <project> --days 7` | `bash scripts/pi-session-stats.sh --history <project> --days 7` |
582
574
  | `npm run models` | `bash scripts/pi-model-catalog.sh` |
@@ -21,9 +21,11 @@ task
21
21
 
22
22
  ## P0: runtime context controls
23
23
 
24
- - Piagent tools được chia thành `governance`, `policy`, `retrieval`,
25
- `knowledge`, `onboarding`, và `usage`. Code retrieval không tự kéo theo
26
- memory, document intake, source checkout hoặc orchestration.
24
+ - Piagent tools được chia thành `governance`, `policy`, `retrieval`, `source`,
25
+ `knowledge`, `onboarding`, và `usage`. URL GitHub/GitLab/Bitbucket do operator
26
+ cung cấp chỉ bật schema `source`; code retrieval không tự kéo theo memory,
27
+ document intake hoặc orchestration. Checkout được cấp quyền đọc đúng session
28
+ qua `read`/`grep`/`find`/`ls`, còn shared cache không mở cho shell hay mutation.
27
29
  - Session bắt đầu không mang schema quản trị Piagent. Input hook bật thẳng nhóm
28
30
  tối thiểu cần cho task trước khi system prompt được tạo.
29
31
  - `piagent_tools` chỉ xuất hiện khi operator yêu cầu rõ tool loader; runtime
@@ -36,7 +36,11 @@ Trước task lớn/risk cao trong Pi TUI:
36
36
  /context compact
37
37
  ```
38
38
 
39
- Nếu recommendation là `fresh-session`, dùng `/fresh task`, `/fresh scout`, hoặc `/fresh be-to-fe` thay vì tiếp tục nhồi context vào session hiện tại.
39
+ Với task/phase tiếp theo trong cùng phiên hiển thị, runtime tự tạo working set
40
+ gọn trước mỗi provider call; người dùng không phải mở session mới chỉ để đổi từ
41
+ scout sang plan, implement hay verify. `/fresh task`, `/fresh scout` và
42
+ `/fresh be-to-fe` vẫn là đường phục hồi tường minh khi preflight xác định input
43
+ quá lớn hoặc working set không thể rút gọn an toàn.
40
44
 
41
45
  ## Context manifest
42
46
 
@@ -68,6 +72,38 @@ Pi settings template dùng:
68
72
  }
69
73
  ```
70
74
 
75
+ Host compaction trên chỉ là overflow guard. Adaptive context governor của
76
+ Piagent chạy sớm hơn và không đổi model/thinking:
77
+
78
+ - phát hiện ranh giới task/phase, context pressure, số tool round, read-output
79
+ cũ và kết quả lặp;
80
+ - giữ yêu cầu/quyết định gần nhất của người dùng, Task Contract, acceptance
81
+ criteria, changed files, verifier và lỗi chưa giải quyết;
82
+ - bỏ raw read/test log cũ khỏi provider working set nhưng giữ nguyên transcript
83
+ hiển thị và audit source;
84
+ - giữ nguyên nhóm assistant tool-call/tool-result để không tạo orphan protocol;
85
+ - giữ nguyên tối thiểu 6 nhóm ranh giới gần nhất; nếu transcript hoặc projected
86
+ candidate đã có orphan tool message thì fail closed và không thay context;
87
+ - chỉ project khi ước tính tiết kiệm đạt ngưỡng thích ứng: ít nhất 8K token,
88
+ 15% transcript occupancy và không đòi quá 20K; không đạt thì no-op thay vì gọi
89
+ thêm một model summarizer có phí;
90
+ - chỉ ghi durable compaction sau khi agent đã settled; coding task dùng summary
91
+ deterministic từ state/file-backed evidence để không tốn thêm model call;
92
+ - trước khi lặp exact verifier, dùng current-tree gate: một durable pass trên
93
+ cùng working-tree digest được tái sử dụng bằng receipt nhỏ thay vì chạy lại.
94
+ Code đổi, pass thiếu/stale, test từng fail, hoặc operator yêu cầu chạy lại thì
95
+ verifier thật vẫn chạy;
96
+ - giữ model summarizer cho thảo luận không có Task Contract và ít tool evidence,
97
+ nơi sắc thái hội thoại quan trọng hơn tiết kiệm tuyệt đối.
98
+
99
+ Telemetry tách `contextOccupancy` (working set ước tính/được provider báo) khỏi
100
+ `billedTraffic` (input/output/cache thực sự đo được). Vì context hook không có
101
+ usage hóa đơn theo lần gọi, runtime không được suy diễn hai con số này là một.
102
+
103
+ Mốc vận hành hiện tại bắt đầu tạo áp lực ở khoảng 160K token, giữ provider prompt
104
+ dưới 240K khi có thể và chủ động tránh vùng pricing 272K+. Đây là giới hạn
105
+ working set, không phải giới hạn năng lực hay context window của model.
106
+
71
107
  ## Rule
72
108
 
73
109
  - Nếu task là read-only, không mở write-capable prompt.
@@ -15,9 +15,9 @@ Repo này phải chạy được cho nhiều project/domain khác nhau. Vì vậ
15
15
 
16
16
  | Use case | Package source |
17
17
  |---|---|
18
- | Team pinned release | `git:github.com/Vt-mmm/piagent@v1.6.0` |
18
+ | Team pinned release | `git:github.com/Vt-mmm/piagent@v1.6.1` |
19
19
  | Personal/sandbox dev | `git:github.com/Vt-mmm/piagent` |
20
- | Registry distribution | `npm:@piagent/platform@1.6.0` |
20
+ | Registry distribution | `npm:@piagent/platform@1.6.1` |
21
21
  | Enterprise npm (fork under another scope) | `npm:@your-scope/platform@x.y.z` |
22
22
  | Local platform dev | `/path/to/piagent` |
23
23
 
@@ -27,7 +27,7 @@ Latest tiện cho máy cá nhân muốn nhận cập nhật nhanh. Pin tag/commi
27
27
 
28
28
  | Channel | Command | Target | Policy |
29
29
  |---|---|---|---|
30
- | `stable` | `bash scripts/install-global.sh --stable` | Helper release tag resolved to commit SHA, currently `v1.6.0` | Install the Pi package matching the helper. |
30
+ | `stable` | `bash scripts/install-global.sh --stable` | Helper release tag resolved to commit SHA, currently `v1.6.1` | Install the Pi package matching the helper. |
31
31
  | `exact` | `bash scripts/install-global.sh --version vX.Y.Z --resolve-tag` | Requested tag resolved to commit SHA | Pi-package-only rollout, rollback, and incident recovery. |
32
32
  | `dev` | `bash scripts/install-global.sh --dev` | Moving Git source | Personal/sandbox only; do not commit into project settings. |
33
33
  | `local` | `bash scripts/install-global.sh --local` | Current checkout path | Platform development only. |
@@ -54,7 +54,7 @@ Root `package.json` có `pi` manifest trỏ tới:
54
54
  Do đó team có thể:
55
55
 
56
56
  ```bash
57
- pi install git:github.com/Vt-mmm/piagent@v1.6.0
57
+ pi install git:github.com/Vt-mmm/piagent@v1.6.1
58
58
  ```
59
59
 
60
60
  Không cần biết internal folder `packages/piagent-core`. Source không pin chỉ dành cho personal/sandbox như bảng channel ở trên.
@@ -66,12 +66,12 @@ Team nên install global package một lần:
66
66
  ```bash
67
67
  node --version # >= 22.19.0
68
68
  npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.84.1
69
- npm install -g --ignore-scripts @piagent/platform@1.6.0
69
+ npm install -g --ignore-scripts @piagent/platform@1.6.1
70
70
  piagent-install --stable --dry-run
71
71
  piagent-install --stable
72
72
  ```
73
73
 
74
- `pi install git:github.com/Vt-mmm/piagent@v1.6.0` vẫn hợp lệ nếu chỉ cần cài Pi package. Lệnh đó không tự tạo các binary terminal `piagent-*`; muốn có helper global thì dùng `npm install -g --ignore-scripts @piagent/platform@1.6.0`.
74
+ `pi install git:github.com/Vt-mmm/piagent@v1.6.1` vẫn hợp lệ nếu chỉ cần cài Pi package. Lệnh đó không tự tạo các binary terminal `piagent-*`; muốn có helper global thì dùng `npm install -g --ignore-scripts @piagent/platform@1.6.1`.
75
75
 
76
76
  Support matrix hiện tại: macOS Apple Silicon + Bash và Linux x64 + Bash đã được verify; macOS Intel + Bash và Linux ARM64 + Bash là supported target cần chạy smoke trước rollout; native Windows chưa phải target rollout team; WSL2 experimental. Chi tiết và version runtime nằm trong [release/install policy](release-install-policy.md).
77
77
 
@@ -121,7 +121,7 @@ Nếu muốn commit sẵn `.pi/piagent-profile.json` vào repo hoặc bootstrap
121
121
  ```bash
122
122
  bash scripts/setup.sh /path/to/project \
123
123
  --profile be-readonly-fe \
124
- --package-source git:github.com/Vt-mmm/piagent@v1.6.0 \
124
+ --package-source git:github.com/Vt-mmm/piagent@v1.6.1 \
125
125
  --mcp-preset core \
126
126
  --subagents-preset safe
127
127
  ```
@@ -94,10 +94,23 @@ the verified journal second; corruption blocks automatic resume for review.
94
94
  The journal hash chain and acceptance receipts are same-runtime operational
95
95
  evidence, not independent attestation or a separate audit authority.
96
96
 
97
+ The Gateway binds each browser send to one operation lifecycle shared by the
98
+ stream and supervisor. It permits at most one pristine provider retry within an
99
+ 8-second delay, and refuses replay after any visible assistant output or tool
100
+ call. Compaction has a separate phase, terminal settlement is emitted once, and
101
+ post-settlement events cannot put the UI back into `Working`. A bounded local
102
+ emission guard removes repeated/filler activity or reviewer notes, while final
103
+ assistant messages always bypass that guard.
104
+
105
+ Exact edits and local patches may also bind to the full-file digest from the
106
+ latest successful read in the same task run. Proven concurrent drift blocks the
107
+ whole mutation before the first hunk and requires one fresh read; an unobserved
108
+ file retains the host's normal exact-anchor behavior.
109
+
97
110
  Recovery is classification-driven and bounded across task attempts. Only an
98
- in-scope source-owned failure may receive one repair pass; transient verifier or
111
+ evidence-backed source-owned failure may receive one repair pass; transient verifier or
99
112
  provider failures receive at most one exact retry and never source-mutation
100
- authority. Environment, permission, policy, scope, and unknown failures stay
113
+ authority. Environment, permission, protected-path policy, and unknown failures stay
101
114
  non-mutating. `PIAGENT_AUTO_RECOVERY=off` restores ordinary P3 handoff behavior
102
115
  without migrating state. Every final path writes a redacted Handoff v1
103
116
  projection from operational truth. Resume binds task/session identity, journal
@@ -111,7 +124,7 @@ Semantic specialist review is a separate strict-high-risk CAP-13 path, not a
111
124
  universal parser-driven recovery path. It is pinned to one shared continuation,
112
125
  one current-tree diff, two targeted reads, exact eligible source/test paths, and
113
126
  the configured verifier after any mutation. Denied, failed, no-op, stale,
114
- out-of-scope, unsupported, or exhausted work locks the opportunity and hands
127
+ target-unresolved, unsupported, or exhausted work locks the opportunity and hands
115
128
  off. Broad-default observation/advice never schedules this review or blocks a
116
129
  tool call.
117
130
 
@@ -127,7 +140,7 @@ Task Contract v2 also carries an additive Criterion Graph v1 planning
127
140
  projection. It maps every operator criterion exactly once to a closed planning
128
141
  kind, scoped target hints, proof kinds, and dependency order. The graph has no
129
142
  `satisfied` state and cannot override acceptance or exact-verifier truth. It
130
- selects relevant in-scope context before older observations, survives
143
+ selects relevant focus-ranked context before older observations, survives
131
144
  compaction/resume by digest, and adds no tool-schema change or provider follow-up
132
145
  turn. `PIAGENT_INTELLIGENCE_ENGINE=off` selects the mechanical control for
133
146
  causal tests and emergency rollback; new tasks otherwise use the criterion
@@ -166,17 +179,17 @@ authority, and combined automatic dispatch authority is capped at one unit per
166
179
  task. These interaction checks are snapshot-bound and cannot change the
167
180
  provider-visible tool schema.
168
181
 
169
- Piagent-owned helpers use RolePolicy v1 and HelperRequest v1. The request binds
170
- a hashed session/task identity, bounded objective, read/write scope, exact tool
182
+ Piagent-owned helpers use RolePolicy v1 and HelperRequest v2. The request binds
183
+ a hashed session/task identity, bounded objective, read-only scope, exact tool
171
184
  allowlist, authenticated model/effort source, context/time/call ceilings, output
172
185
  schema, stopping rule, approval restrictions, and deduplication key. Read-only
173
- roles cannot receive mutation tools. Worker remains disabled by default and
174
- requires an explicit single-writer lease. `PIAGENT_HELPERS_MODE=off|recommend|on`
175
- defaults to `recommend`; `on` permits only read-only dispatch through an
176
- installed provider adapter. CAP-14 permits at most one automatic helper dispatch
177
- per task/run; the lower-level owner budget still caps two concurrent and three
178
- total explicitly owned helper reservations, deduplicates equivalent work, recovers
179
- expired reservations without adding budget, and cancels late work when the
186
+ roles cannot receive mutation tools, and worker dispatch is disabled.
187
+ `PIAGENT_HELPERS_MODE=off|recommend|on` defaults to `off`; `on` is explicit
188
+ opt-in but still requires two independent lanes and at least 30% projected net
189
+ token saving. CAP-14 and the lower-level owner budget enforce one fresh read-only
190
+ helper total and concurrent, zero writers, zero retries, eight calls, and at most
191
+ 2,048 transferred context tokens. Failed or expired work consumes the only slot,
192
+ and late work is cancelled when the
180
193
  parent Task Contract becomes terminal. It does not claim control over unrelated
181
194
  Pi sessions or account usage, and never changes the user-pinned parent model.
182
195
  Dispatch enforces the request's time, call, and token ceilings at result merge:
@@ -21,8 +21,8 @@
21
21
  "en": "README.md",
22
22
  "vi": "README.vi.md",
23
23
  "consistentAt": {
24
- "en": "c2b6f830977bff9eff7ebdc97f1aa15502ce3e2c",
25
- "vi": "a6533b41f285b3dc05a594e21cc208ca28b5569b"
24
+ "en": "ec5765bc81848d3cd43806ef5a7003e8a23e3ad7",
25
+ "vi": "51d117e51003133b84540cb7ea732577f5a603d9"
26
26
  }
27
27
  },
28
28
  {
@@ -39,8 +39,8 @@
39
39
  "en": "docs/en/architecture.md",
40
40
  "vi": "docs/vi/architecture.md",
41
41
  "consistentAt": {
42
- "en": "7902186a3bf9cc8c344bd27ea352cf4a6d5eae2a",
43
- "vi": "64575dc18be0167324bfba396d7162c74af28048"
42
+ "en": "6a8a6f73bd6b0bde3fad00f0996426eaa101a8a9",
43
+ "vi": "580addecc766aa7317c3c49d9d740bc05f1bb43d"
44
44
  }
45
45
  },
46
46
  {
@@ -19,12 +19,12 @@ Support matrix release hiện tại: macOS Apple Silicon + Bash và Linux x64 +
19
19
  ```bash
20
20
  node --version # >= 22.19.0
21
21
  npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.84.1
22
- npm install -g --ignore-scripts @piagent/platform@1.6.0
22
+ npm install -g --ignore-scripts @piagent/platform@1.6.1
23
23
  piagent-install --stable --dry-run
24
24
  piagent-install --stable
25
25
  ```
26
26
 
27
- 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.6.0`. Máy cá nhân có thể dùng `git:github.com/Vt-mmm/piagent` để theo latest.
27
+ 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.6.1`. Máy cá nhân có thể dùng `git:github.com/Vt-mmm/piagent` để theo latest.
28
28
 
29
29
  Nếu đang ở source checkout của platform, dùng helper theo channel để preview trước khi đổi:
30
30
 
@@ -100,7 +100,7 @@ install package once
100
100
 
101
101
  ```bash
102
102
  npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.84.1
103
- npm install -g --ignore-scripts @piagent/platform@1.6.0
103
+ npm install -g --ignore-scripts @piagent/platform@1.6.1
104
104
  piagent-install --stable --dry-run
105
105
  piagent-install --stable
106
106
  ```
@@ -283,7 +283,7 @@ Không phải daily default. Dùng khi muốn tạo sẵn `.pi` files cho projec
283
283
  bash /path/to/piagent/scripts/setup.sh /path/to/project \
284
284
  --project-only \
285
285
  --profile auto \
286
- --package-source git:github.com/Vt-mmm/piagent@v1.6.0 \
286
+ --package-source git:github.com/Vt-mmm/piagent@v1.6.1 \
287
287
  --mcp-preset core \
288
288
  --subagents-preset safe
289
289
  ```
@@ -924,13 +924,13 @@ Default safe config:
924
924
 
925
925
  - `toolDescriptionMode: compact`;
926
926
  - `asyncByDefault: false`;
927
- - `parallel.concurrency: 3`;
928
- - `parallel.maxTasks: 6`;
927
+ - `parallel.concurrency: 1`;
928
+ - `parallel.maxTasks: 1`;
929
929
  - `maxSubagentDepth: 1`;
930
- - `maxSubagentSpawnsPerSession: 32`;
930
+ - `maxSubagentSpawnsPerSession: 1`;
931
931
  - scheduled runs off;
932
932
  - worktree base stable;
933
- - intercom bridge on.
933
+ - wait/intercom bridge off; builtin và worker disabled.
934
934
 
935
935
  ### Piagent agents
936
936
 
@@ -938,13 +938,13 @@ Default safe config:
938
938
  |---|---|---|
939
939
  | `piagent-scout` | Map source/spec read-only. | No write. |
940
940
  | `piagent-planner` | Plan implementation + verify gates. | No write. |
941
- | `piagent-worker` | Implement approved bounded task. | Write in scope. |
941
+ | `piagent-worker` | Compatibility metadata only; Piagent config disables it. | Không được dispatch. |
942
942
  | `piagent-reviewer` | Review diff/tests/scope. | Review-first. |
943
943
  | `piagent-oracle` | Risk/architecture challenge. | No write. |
944
944
 
945
945
  ### Auto-delegation
946
946
 
947
- Với `/workflow task`, `/workflow be-to-fe`, `/workflow platform-improve`, `/workflow plan`, `/workflow review`, parent agent dùng solo-first orchestration: lập task tree/review lenses trước, rồi chỉ spawn subagent khi có phần việc độc lập và đáng token. Alias cũ như `/task` vẫn giữ cùng policy.
947
+ Với `/workflow task`, `/workflow be-to-fe`, `/workflow platform-improve`, `/workflow plan`, `/workflow review`, parent agent tự suy luận và implement. Helper mặc định tắt. Khi operator bật rõ, runtime chỉ được dispatch một helper read-only, context fresh, nếu có ít nhất hai lane độc lập và projected net token saving từ 30% sau handoff/merge. Worker, retry, nested và parallel helper đều tắt. Alias cũ như `/task` giữ cùng policy.
948
948
 
949
949
  Kiểm tra nhanh policy:
950
950
 
@@ -954,13 +954,12 @@ Kiểm tra nhanh policy:
954
954
 
955
955
  Không cần tự gọi `/run` cho task bình thường. Chỉ dùng `/run` khi muốn ép rõ role hoặc debug.
956
956
 
957
- Parent nên spawn khi:
957
+ Helper chỉ đủ điều kiện khi đồng thời:
958
958
 
959
- - cần scout codebase rộng;
960
- - cần map BE/spec read-only trước khi FE implement;
961
- - cần reviewer độc lập;
962
- - cần context builder cho task lớn;
963
- - cần oracle/risk challenge.
959
+ - operator đã opt-in;
960
+ - có ít nhất hai workstream độc lập và helper không phụ thuộc output tiếp theo của parent;
961
+ - context chuyển giao fresh, tối đa 2.048 token và không inherit history;
962
+ - tổng token parent + helper + handoff + merge được dự báo thấp hơn solo ít nhất 30%.
964
963
 
965
964
  Không nên spawn khi:
966
965
 
@@ -975,27 +974,15 @@ Không nên spawn khi:
975
974
  ```text
976
975
  /run piagent-scout "Map listing page state flow. Read-only."
977
976
  /run piagent-planner "Plan FE implementation from this backend contract."
978
- /run piagent-worker "Implement the approved plan. Do not touch backend."
979
977
  /run piagent-reviewer "Review current diff for correctness, tests, and scope drift."
980
978
  /run piagent-oracle "Challenge this architecture decision before implementation."
981
979
  ```
982
980
 
983
- Parallel read-only review:
984
-
985
- ```text
986
- /parallel piagent-reviewer "Review correctness" -> piagent-reviewer "Review tests" -> piagent-reviewer "Review scope drift"
987
- ```
988
-
989
- Chain:
990
-
991
- ```text
992
- /chain piagent-scout "Scout target area" -> piagent-planner "Plan from {previous}" -> piagent-worker "Implement from {previous}" -> piagent-reviewer "Review implementation"
993
- ```
981
+ `/parallel`, `/chain` và writer role là capability upstream của package `pi-subagents`, nhưng Piagent config chủ động chặn các surface đó để tránh nhân context và token.
994
982
 
995
983
  Background:
996
984
 
997
985
  ```text
998
- /run piagent-scout "Map this module" --bg
999
986
  /subagents-fleet
1000
987
  ```
1001
988
 
@@ -1007,26 +994,19 @@ subagent({ action: "status", view: "fleet" })
1007
994
  subagent({ action: "status", id: "<run-id>", view: "transcript" })
1008
995
  subagent({ action: "steer", id: "<run-id>", message: "Focus only on tests." })
1009
996
  subagent({ action: "stop", id: "<run-id>" })
1010
- subagent({ action: "resume", id: "<run-id>", message: "Continue after this clarification." })
1011
997
  ```
1012
998
 
1013
999
  Output file mode để giảm parent context:
1014
1000
 
1015
1001
  ```text
1016
1002
  /run scout[output=context.md,outputMode=file-only] "Map target area"
1017
- /chain scout[output=context.md,as=context] "Scan" -> planner[reads=context.md] "Plan from {outputs.context}"
1018
1003
  ```
1019
1004
 
1020
1005
  ### Worktree isolation
1021
1006
 
1022
- Chỉ bật writer parallel/worktree khi:
1023
-
1024
- - repo là Git repo;
1025
- - worktree clean;
1026
- - write sets không overlap;
1027
- - parent review/merge outputs.
1007
+ Piagent không bật writer parallel/worktree; parent là writer duy nhất.
1028
1008
 
1029
- Default solo/internal: một `piagent-worker`, parallel read-only reviewers/scouts.
1009
+ Default: parent là writer duy nhất; không worker, không parallel helper.
1030
1010
 
1031
1011
  ### Watchdog
1032
1012
 
@@ -1044,8 +1024,8 @@ Watchdog là optional adversarial reviewer ở cuối turn, không bật mặc
1044
1024
 
1045
1025
  | Command | Dùng để |
1046
1026
  |---|---|
1047
- | `npm install -g --ignore-scripts @piagent/platform@1.6.0` | Cài terminal helper `piagent-*` từ release tag hiện tại. |
1048
- | `pi install git:github.com/Vt-mmm/piagent@v1.6.0` | Install pinned release cho reproducible team setup. |
1027
+ | `npm install -g --ignore-scripts @piagent/platform@1.6.1` | Cài terminal helper `piagent-*` từ release tag hiện tại. |
1028
+ | `pi install git:github.com/Vt-mmm/piagent@v1.6.1` | Install pinned release cho reproducible team setup. |
1049
1029
  | `pi install git:github.com/Vt-mmm/piagent` | Install latest platform package cho máy cá nhân/sandbox. |
1050
1030
  | 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). |
1051
1031
  | 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. |
@@ -1157,7 +1137,7 @@ Mở lại Pi session sau khi install.
1157
1137
  Cài lại terminal helper đúng release rồi kiểm tra `PATH`:
1158
1138
 
1159
1139
  ```bash
1160
- npm install -g --ignore-scripts @piagent/platform@1.6.0
1140
+ npm install -g --ignore-scripts @piagent/platform@1.6.1
1161
1141
  command -v piagent-install
1162
1142
  ```
1163
1143
 
@@ -98,6 +98,11 @@ pi install /path/to/piagent
98
98
  Inspector; projection Task Changes / Working Tree / Staged có bounded diff,
99
99
  provenance và enforce protected path; session lease bền, recovery khi restart
100
100
  hoặc owner cũ treo, doctor có repair tường minh.
101
+ - `1.6.1`: patch ổn định runtime và chi phí — transcript chỉ hiện response khi
102
+ durable task đã terminal, Activity phân loại đúng retry/helper failure, review
103
+ repo ngoài chỉ nhận read grant session-scoped cho checkout chính xác, và direct
104
+ subagent bị khóa solo-first với một helper read-only có budget hữu hạn. Benchmark
105
+ thêm gate provider-free/Codex-relative nhưng không đưa ra claim chi phí mới.
101
106
  - `1.6.0`: context evidence khóa đúng turn/session/task run; WebUI có canonical
102
107
  live state, watchdog và Stop an toàn qua reload/multi-tab; chat chỉ hiện kết
103
108
  quả thành công còn retry/lỗi nằm trong Activity; deep-logic benchmark có bài