@piagent/platform 1.2.1 → 1.2.3

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 (72) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +34 -27
  3. package/catalog/capabilities.json +8 -8
  4. package/docs/auto-delegation-policy.md +4 -4
  5. package/docs/command-reference-vietnamese.md +121 -81
  6. package/docs/context-window-policy.md +7 -6
  7. package/docs/distribution-standard.md +27 -10
  8. package/docs/herdr-workflow.md +3 -2
  9. package/docs/memory-policy.md +6 -3
  10. package/docs/operator-manual-vietnamese.md +107 -69
  11. package/docs/package-architecture-notes.md +6 -6
  12. package/docs/project-adapters.md +4 -4
  13. package/docs/project-onboarding.md +12 -11
  14. package/docs/publishing-for-teams.md +2 -1
  15. package/docs/quickstart-vietnamese.md +26 -22
  16. package/docs/release-install-policy.md +6 -6
  17. package/docs/runtime-harness-standard.md +7 -7
  18. package/docs/runtime-policy-design.md +1 -1
  19. package/docs/runtime-quality-baseline.md +1 -1
  20. package/docs/security-threat-model.md +1 -1
  21. package/docs/subagent-orchestration-capabilities.md +3 -3
  22. package/docs/subagents-and-multiagent.md +4 -4
  23. package/docs/task-implementation-contract.md +4 -4
  24. package/docs/task-lifecycle-vietnamese.md +2 -2
  25. package/docs/team-onboarding.md +22 -18
  26. package/docs/usage-observability.md +29 -8
  27. package/docs/workflow-recipes.md +12 -9
  28. package/docs-site/architecture.html +1 -1
  29. package/docs-site/commands.html +19 -15
  30. package/docs-site/content/commands.html +18 -14
  31. package/docs-site/content/permissions.html +11 -11
  32. package/docs-site/content/quickstart.html +12 -11
  33. package/docs-site/content/team.html +1 -1
  34. package/docs-site/content/workflows.html +17 -17
  35. package/docs-site/index.html +1 -1
  36. package/docs-site/mcp-approval.html +1 -1
  37. package/docs-site/mcp-auth.html +1 -1
  38. package/docs-site/mcp-servers.html +1 -1
  39. package/docs-site/mcp.html +1 -1
  40. package/docs-site/permissions.html +12 -12
  41. package/docs-site/profiles.html +1 -1
  42. package/docs-site/quickstart.html +13 -12
  43. package/docs-site/runtime.html +1 -1
  44. package/docs-site/scope.html +1 -1
  45. package/docs-site/security.html +1 -1
  46. package/docs-site/team.html +2 -2
  47. package/docs-site/workflows.html +18 -18
  48. package/package.json +1 -1
  49. package/packages/piagent-core/README.md +28 -26
  50. package/packages/piagent-core/extensions/piagent-guard.ts +1416 -196
  51. package/packages/piagent-core/package.json +1 -1
  52. package/packages/piagent-core/prompts/be-to-fe.md +4 -3
  53. package/packages/piagent-core/prompts/discuss.md +2 -2
  54. package/packages/piagent-core/prompts/plan.md +1 -1
  55. package/packages/piagent-core/prompts/platform-improve.md +2 -1
  56. package/packages/piagent-core/prompts/pr.md +1 -1
  57. package/packages/piagent-core/prompts/review.md +2 -1
  58. package/packages/piagent-core/prompts/scout.md +3 -2
  59. package/packages/piagent-core/prompts/task.md +3 -2
  60. package/scripts/init-project.sh +4 -3
  61. package/scripts/install-global.sh +47 -1
  62. package/scripts/profile-doctor.sh +1 -1
  63. package/scripts/setup.sh +4 -3
  64. package/scripts/team-doctor.sh +6 -8
  65. package/scripts/verify-local.sh +18 -17
  66. package/templates/project/.pi/context-index.json +2 -2
  67. package/templates/project/.pi/project-context.md +3 -3
  68. package/templates/project/AGENTS.md +4 -4
  69. package/packages/piagent-core/prompts/memory-policy.md +0 -52
  70. package/packages/piagent-core/prompts/model-options.md +0 -68
  71. package/packages/piagent-core/prompts/onboard-project.md +0 -147
  72. package/packages/piagent-core/prompts/piagent-commands.md +0 -68
@@ -4,7 +4,7 @@
4
4
 
5
5
  Không nhồi toàn bộ repo vào context. Agent phải load đúng lớp context theo task.
6
6
 
7
- Lần đầu gắn project vào platform, chạy `/onboard-project` sau login/model selection để tạo `.pi/project-context.md` và `.pi/context-index.json`. Các task sau dùng context index như bản đồ nhỏ để tìm đúng vùng cần đọc, rồi vẫn verify bằng files task-specific hiện tại.
7
+ Lần đầu gắn project vào platform, chạy `/onboard run` sau login/model selection để tạo `.pi/project-context.md` và `.pi/context-index.json`. Các task sau dùng context index như bản đồ nhỏ để tìm đúng vùng cần đọc, rồi vẫn verify bằng files task-specific hiện tại.
8
8
 
9
9
  ## Context order
10
10
 
@@ -29,11 +29,11 @@ piagent_context_index_status
29
29
  Trước task lớn/risk cao trong Pi TUI:
30
30
 
31
31
  ```text
32
- /task-preflight
33
- /task-preflight compact
32
+ /context preflight
33
+ /context compact
34
34
  ```
35
35
 
36
- 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.
36
+ 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.
37
37
 
38
38
  ## Context manifest
39
39
 
@@ -71,11 +71,12 @@ Pi settings template dùng:
71
71
  - Nếu task là source-write, phải biết verify command trước khi sửa.
72
72
  - Không paste full mandatory-flow boilerplate vào task hằng ngày; platform prompts/tools đã chứa flow đó.
73
73
  - Nếu context vượt budget, tạo summary theo module thay vì nhồi full files.
74
- - Dùng `/context-index` hoặc `piagent_context_index_search` để tìm điểm vào repo, nhưng không dùng index thay thế việc đọc source thật.
75
- - Không raw-read hoặc raw-edit `.pi/context-index.json` trong task thường ngày. Runtime coi index là advisory state, sanitize khi đọc qua tool/command, và ghi qua `/onboard-project` hoặc `piagent_context_index_record`.
74
+ - Dùng `/context search` hoặc `piagent_context_index_search` để tìm điểm vào repo, nhưng không dùng index thay thế việc đọc source thật.
75
+ - Không raw-read hoặc raw-edit `.pi/context-index.json` trong task thường ngày. Runtime coi index là advisory state, sanitize khi đọc qua tool/command, và ghi qua `/onboard run` hoặc `piagent_context_index_record`.
76
76
  - File context vượt hard cap phải được summarize hoặc đọc targeted slices, không inject full.
77
77
  - Nếu input quá dài thật, lưu intake vào file project/local gitignored rồi reference file; không dán toàn bộ spec vào một turn.
78
78
  - Nếu input chứa local screenshot/image path, để input guard attach thành `[image1]` thay vì đọc ảnh như text context. Ảnh lớn hơn giới hạn chat nên dùng Pi `read` để resize.
79
+ - Tool output dài chỉ nên hiện preview. Dùng `/logs` hoặc command targeted hơn để debug; không paste full test/build log vào chat/final.
79
80
  - Memory chỉ là hint. Phải verify bằng source hiện tại trước khi sửa code.
80
81
  - Context index cũng chỉ là hint. Nó có node/edge/citation để giảm scout lại, không phải security boundary hoặc source of truth.
81
82
 
@@ -14,9 +14,9 @@ Repo này phải chạy được cho nhiều project/domain khác nhau. Vì vậ
14
14
 
15
15
  | Use case | Package source |
16
16
  |---|---|
17
- | Team pinned release | `git:github.com/Vt-mmm/piagent@v1.2.1` |
17
+ | Team pinned release | `git:github.com/Vt-mmm/piagent@v1.2.3` |
18
18
  | Personal/sandbox dev | `git:github.com/Vt-mmm/piagent` |
19
- | Registry distribution | `npm:@piagent/platform@1.2.1` |
19
+ | Registry distribution | `npm:@piagent/platform@1.2.3` |
20
20
  | Enterprise npm (fork under another scope) | `npm:@your-scope/platform@x.y.z` |
21
21
  | Local platform dev | `/path/to/piagent` |
22
22
 
@@ -26,7 +26,7 @@ Latest tiện cho máy cá nhân muốn nhận cập nhật nhanh. Pin tag/commi
26
26
 
27
27
  | Channel | Command | Target | Policy |
28
28
  |---|---|---|---|
29
- | `stable` | `bash scripts/install-global.sh --stable` | Helper release tag resolved to commit SHA, currently `v1.2.1` | Install the Pi package matching the helper. |
29
+ | `stable` | `bash scripts/install-global.sh --stable` | Helper release tag resolved to commit SHA, currently `v1.2.3` | Install the Pi package matching the helper. |
30
30
  | `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. |
31
31
  | `dev` | `bash scripts/install-global.sh --dev` | Moving Git source | Personal/sandbox only; do not commit into project settings. |
32
32
  | `local` | `bash scripts/install-global.sh --local` | Current checkout path | Platform development only. |
@@ -53,7 +53,7 @@ Root `package.json` có `pi` manifest trỏ tới:
53
53
  Do đó team có thể:
54
54
 
55
55
  ```bash
56
- pi install git:github.com/Vt-mmm/piagent@v1.2.1
56
+ pi install git:github.com/Vt-mmm/piagent@v1.2.3
57
57
  ```
58
58
 
59
59
  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.
@@ -65,12 +65,12 @@ Team nên install global package một lần:
65
65
  ```bash
66
66
  node --version # >= 22.19.0
67
67
  npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.82.0
68
- npm install -g --ignore-scripts @piagent/platform@1.2.1
68
+ npm install -g --ignore-scripts @piagent/platform@1.2.3
69
69
  piagent-install --stable --dry-run
70
70
  piagent-install --stable
71
71
  ```
72
72
 
73
- `pi install git:github.com/Vt-mmm/piagent@v1.2.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.2.1`.
73
+ `pi install git:github.com/Vt-mmm/piagent@v1.2.3` 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.2.3`.
74
74
 
75
75
  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).
76
76
 
@@ -81,7 +81,7 @@ cd /path/to/project
81
81
  pi
82
82
  ```
83
83
 
84
- Project profile được chọn trong Pi bằng `/onboard-project` hoặc `/profile`, không bắt buộc chạy bash init.
84
+ Project profile được chọn trong Pi bằng `/onboard` hoặc `/profile`, không bắt buộc chạy bash init. `/onboard` là menu runtime; dùng `/onboard run` khi muốn model đọc project lần đầu và ghi snapshot.
85
85
 
86
86
  Sau setup, bước first-run trong Pi là:
87
87
 
@@ -90,12 +90,29 @@ Sau setup, bước first-run trong Pi là:
90
90
  <select provider/model>
91
91
  /mcp
92
92
  /subagents-doctor
93
- /onboard-project
93
+ /onboard
94
+ /onboard run
95
+ /context index
96
+ /memory
94
97
  ```
95
98
 
96
- `/onboard-project` ghi `.pi/project-context.md`; đây là snapshot context dùng chung cho các task sau.
99
+ `/onboard run` ghi `.pi/project-context.md`; đây là snapshot context dùng chung cho các task sau.
97
100
  Nó cũng ghi `.pi/context-index.json`; đây là compact advisory map có citation để agent tìm đúng điểm vào repo mà không scout rộng lại.
98
101
 
102
+ Command hằng ngày nên dạy theo namespace mới:
103
+
104
+ ```text
105
+ /commands
106
+ /workflow task <request>
107
+ /workflow scout <read-only request>
108
+ /name <task/session name>
109
+ /fresh task <request>
110
+ /context preflight
111
+ /usage
112
+ ```
113
+
114
+ Các alias cũ như `/task`, `/scout`, `/context index`, `/fresh-task` vẫn chạy để không gãy session cũ, nhưng không dùng làm đường onboard chính cho team mới.
115
+
99
116
  ## Optional preseed setup
100
117
 
101
118
  Nếu muốn commit sẵn `.pi/piagent-profile.json` vào repo hoặc bootstrap bằng CI:
@@ -103,7 +120,7 @@ Nếu muốn commit sẵn `.pi/piagent-profile.json` vào repo hoặc bootstrap
103
120
  ```bash
104
121
  bash scripts/setup.sh /path/to/project \
105
122
  --profile be-readonly-fe \
106
- --package-source git:github.com/Vt-mmm/piagent@v1.2.1 \
123
+ --package-source git:github.com/Vt-mmm/piagent@v1.2.3 \
107
124
  --mcp-preset core \
108
125
  --subagents-preset safe
109
126
  ```
@@ -50,10 +50,11 @@ Lần đầu trong project, mở pane Pi rồi chạy:
50
50
  ```text
51
51
  /login
52
52
  <select provider/model>
53
- /onboard-project
53
+ /onboard
54
+ /onboard run
54
55
  ```
55
56
 
56
- Sau khi `.pi/project-context.md` đã được ghi, mới chạy `/task` cho implementation.
57
+ Sau khi `.pi/project-context.md` đã được ghi, mới chạy `/workflow task` cho implementation.
57
58
 
58
59
  Pane đề xuất:
59
60
 
@@ -110,10 +110,13 @@ Mode hiện tại:
110
110
 
111
111
  ```text
112
112
  /login
113
- /onboard-project
114
- /memory-policy
113
+ /onboard
114
+ /onboard run
115
+ /memory
115
116
  ```
116
117
 
118
+ `/memory-policy` vẫn là alias để xem cùng runtime status.
119
+
117
120
  ### Ghi nhớ explicit
118
121
 
119
122
  ```text
@@ -125,7 +128,7 @@ Agent nên gọi `piagent_memory_note` với category `preference`.
125
128
  ### Trước implementation
126
129
 
127
130
  1. `piagent_context`
128
- 2. `piagent_context_index_status` hoặc `/context-index` để lấy điểm vào repo nếu đã onboard
131
+ 2. `piagent_context_index_status` hoặc `/context index` để lấy điểm vào repo nếu đã onboard
129
132
  3. `piagent_memory_status`
130
133
  4. `piagent_memory_search` nếu task có keyword liên quan
131
134
  5. đọc repo files hiện tại để verify
@@ -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.1
21
+ npm install -g --ignore-scripts @piagent/platform@1.2.3
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.1`. 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.3`. 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.1
102
+ npm install -g --ignore-scripts @piagent/platform@1.2.3
103
103
  piagent-install --stable --dry-run
104
104
  piagent-install --stable
105
105
  ```
@@ -204,14 +204,15 @@ Gợi ý:
204
204
  Sau `/login` và `/model`, chạy:
205
205
 
206
206
  ```text
207
- /piagent-commands
207
+ /commands
208
208
  /mcp
209
209
  /subagents-doctor
210
- /onboard-project
211
- /memory-policy
210
+ /onboard
211
+ /onboard run
212
+ /memory
212
213
  ```
213
214
 
214
- `/onboard-project` sẽ:
215
+ `/onboard` mở menu/status runtime. `/onboard run` sẽ:
215
216
 
216
217
  1. đọc repo theo context budget;
217
218
  2. detect profile phù hợp;
@@ -233,7 +234,7 @@ File chính được tạo/cập nhật:
233
234
  .pi/memory/MEMORY.md
234
235
  ```
235
236
 
236
- Nếu `.pi/project-context.md` còn `Generated: not yet`, hoặc `/context-index` báo index đang pending/stale, không nên chạy `/task` implementation lớn. Chạy lại `/onboard-project` trước.
237
+ Nếu `.pi/project-context.md` còn `Generated: not yet`, hoặc `/context index` báo index đang pending/stale, không nên chạy `/workflow task` implementation lớn. Chạy lại `/onboard run` trước.
237
238
 
238
239
  ### Đổi profile sau này
239
240
 
@@ -281,7 +282,7 @@ Không phải daily default. Dùng khi muốn tạo sẵn `.pi` files cho projec
281
282
  bash /path/to/piagent/scripts/setup.sh /path/to/project \
282
283
  --project-only \
283
284
  --profile auto \
284
- --package-source git:github.com/Vt-mmm/piagent@v1.2.1 \
285
+ --package-source git:github.com/Vt-mmm/piagent@v1.2.3 \
285
286
  --mcp-preset core \
286
287
  --subagents-preset safe
287
288
  ```
@@ -307,37 +308,37 @@ bash /path/to/piagent/scripts/configure-subagents.sh --preset safe
307
308
  ### Requirement chưa rõ
308
309
 
309
310
  ```text
310
- /discuss Cải tiến workflow onboarding cho team mới. Chưa implement, chỉ hỏi phần thiếu và đề xuất plan.
311
+ /workflow discuss Cải tiến workflow onboarding cho team mới. Chưa implement, chỉ hỏi phần thiếu và đề xuất plan.
311
312
  ```
312
313
 
313
314
  ### Cần plan trước
314
315
 
315
316
  ```text
316
- /plan Implement header sale menu hover stabilization. Include scope, files, verify commands, and risks.
317
+ /workflow plan Implement header sale menu hover stabilization. Include scope, files, verify commands, and risks.
317
318
  ```
318
319
 
319
320
  ### Task rõ, cho implement
320
321
 
321
322
  ```text
322
- /task Implement header sale menu hover stabilization. Add component tests and run relevant verify.
323
+ /workflow task Implement header sale menu hover stabilization. Add component tests and run relevant verify.
323
324
  ```
324
325
 
325
326
  ### Scout/audit read-only
326
327
 
327
328
  ```text
328
- /scout Scout payment FE mapping vs BE contract. Backend read-only. Do not edit source.
329
+ /workflow scout Scout payment FE mapping vs BE contract. Backend read-only. Do not edit source.
329
330
  ```
330
331
 
331
- Use `/scout` cho payment/auth/data/contract mapping khi mục tiêu là chốt evidence trước, chưa sửa code.
332
+ Use `/workflow scout` cho payment/auth/data/contract mapping khi mục tiêu là chốt evidence trước, chưa sửa code.
332
333
 
333
334
  ### Task mới khi session đã nặng
334
335
 
335
- Nếu `/piagent-usage` cho thấy context cao, hoặc Pi báo context overflow, dùng fresh workflow:
336
+ Nếu `/usage` cho thấy context cao, hoặc Pi báo context overflow, dùng fresh workflow:
336
337
 
337
338
  ```text
338
- /fresh-scout Scout payment FE mapping vs BE contract. Backend read-only. Do not edit source.
339
- /fresh-task Implement <bounded task>.
340
- /fresh-be-to-fe Implement FE support for <BE contract>. Backend read-only.
339
+ /fresh scout Scout payment FE mapping vs BE contract. Backend read-only. Do not edit source.
340
+ /fresh task Implement <bounded task>.
341
+ /fresh be-to-fe Implement FE support for <BE contract>. Backend read-only.
341
342
  ```
342
343
 
343
344
  Các command này tự mở session mới và replay prompt workflow ngắn. Anh không cần tự chạy `pi --name ...` rồi paste lại.
@@ -349,7 +350,7 @@ Input guard của platform cũng tự collapse prompt có full `Mandatory flow`
349
350
  Nếu Pi/chat box không tạo native image attachment mà chỉ hiện local path kiểu `/var/folders/.../Ảnh màn hình ...png`, cứ để nguyên path trong prompt:
350
351
 
351
352
  ```text
352
- /scout Scout UI issue from screenshot /var/folders/.../screenshot.png
353
+ /workflow scout Scout UI issue from screenshot /var/folders/.../screenshot.png
353
354
  ```
354
355
 
355
356
  Piagent guard sẽ xử lý trước khi model nhận input:
@@ -367,19 +368,19 @@ Nếu ảnh quá lớn, lưu ảnh nhỏ hơn hoặc yêu cầu agent dùng Pi `
367
368
 
368
369
  ```text
369
370
  /profile be-readonly-fe
370
- /be-to-fe Implement frontend support from backend endpoint/spec <name>. Backend is read-only.
371
+ /workflow be-to-fe Implement frontend support from backend endpoint/spec <name>. Backend is read-only.
371
372
  ```
372
373
 
373
374
  ### Cải tiến platform
374
375
 
375
376
  ```text
376
- /platform-improve Improve MCP setup docs and subagent command guidance for team usage.
377
+ /workflow platform-improve Improve MCP setup docs and subagent command guidance for team usage.
377
378
  ```
378
379
 
379
380
  ### Review trước final
380
381
 
381
382
  ```text
382
- /review current diff
383
+ /workflow review current diff
383
384
  ```
384
385
 
385
386
  ### Commit và pull request
@@ -387,11 +388,11 @@ Nếu ảnh quá lớn, lưu ảnh nhỏ hơn hoặc yêu cầu agent dùng Pi `
387
388
  Git trong Pi Agent là capability + guard, không có namespace `/git-*`. Khi muốn gom việc hiện tại:
388
389
 
389
390
  ```text
390
- /commit docs: update onboarding notes
391
- /pr Add guarded git workflow
391
+ /workflow commit docs: update onboarding notes
392
+ /workflow pr Add guarded git workflow
392
393
  ```
393
394
 
394
- `/commit` inspect status/diff, stage đúng scope, verify phù hợp, rồi commit local; không push. `/pr` inspect branch/diff/commit rồi hỏi xác nhận trước khi `git push` hoặc tạo/cập nhật GitHub PR. Các lệnh stage rộng như `git add .`, `git add -A`, `git add --all`, `git add -- .`, `git add :/` cũng phải qua confirmation.
395
+ `/workflow commit` inspect status/diff, stage đúng scope, verify phù hợp, rồi commit local; không push. `/workflow pr` inspect branch/diff/commit rồi hỏi xác nhận trước khi `git push` hoặc tạo/cập nhật GitHub PR. Alias `/commit` và `/pr` vẫn chạy cho power user. Các lệnh stage rộng như `git add .`, `git add -A`, `git add --all`, `git add -- .`, `git add :/` cũng phải qua confirmation.
395
396
 
396
397
  ## 5. Control flow của một task chuẩn
397
398
 
@@ -474,15 +475,16 @@ High-risk action phải human-gate:
474
475
  ### Trong Pi
475
476
 
476
477
  ```text
477
- /task-preflight
478
- /task-preflight compact
479
- /piagent-usage
478
+ /usage
479
+ /context preflight
480
+ /context compact
481
+ /usage logs
480
482
  /session
481
483
  ```
482
484
 
483
- `/task-preflight` cho biết task tiếp theo nên chạy trực tiếp, compact trước, hay mở fresh session. `compact` dùng khi muốn Pi nén session có hướng dẫn giữ lại decisions/open blockers/verify command.
485
+ `/context preflight` cho biết task tiếp theo nên chạy trực tiếp, compact trước, hay mở fresh session. `/context compact` dùng khi muốn Pi nén session có hướng dẫn giữ lại decisions/open blockers/verify command. Alias `/context preflight` và `/logs` vẫn chạy.
484
486
 
485
- `/piagent-usage` cho biết:
487
+ `/usage` cho biết:
486
488
 
487
489
  - session file;
488
490
  - session id/name;
@@ -492,6 +494,17 @@ High-risk action phải human-gate:
492
494
 
493
495
  Live context không phải billed tokens. Ví dụ `111k / 272k` là context đang giữ trong cửa sổ hiện tại, không phải tổng input/output/cost.
494
496
 
497
+ ### Log output gọn
498
+
499
+ Piagent giữ nguyên output nhỏ. Khi `bash/grep/find/ls` hoặc tool result khác trả output quá dài, guard sẽ:
500
+
501
+ - redact secret/protected content trước;
502
+ - chỉ trả preview ngắn vào Pi TUI gồm head, các dòng lỗi/cảnh báo đáng chú ý, và tail;
503
+ - ghi capture local vào `.pi/piagent-state/tool-results/YYYY-MM-DD/*.log`;
504
+ - ghi index `.pi/piagent-state/tool-results/index.jsonl` để Agent Watch/report đọc theo session/tool.
505
+
506
+ Trong Pi, chạy `/logs` để xem policy compact và các capture mới nhất. Không paste full test/build log vào chat trừ khi user thật sự cần một đoạn cụ thể; dùng command targeted hoặc đọc capture/report ở ngoài Pi để debug sâu.
507
+
495
508
  ### Từ terminal khác
496
509
 
497
510
  Nếu bin có trên PATH:
@@ -542,14 +555,14 @@ History mode đọc trực tiếp `~/.pi/agent/sessions/**/*.jsonl`. Mặc đị
542
555
  |---|---|
543
556
  | `< 50%` | Bình thường. |
544
557
  | `50-75%` | Tránh đọc file lớn không cần thiết. |
545
- | `> 75%` | Cân nhắc `/compact` trước task dài tiếp theo. |
558
+ | `> 75%` | Cân nhắc `/context compact` trước task dài tiếp theo. |
546
559
  | Task chuyển từ implement sang deploy monitor | Nên tách session mới hoặc compact. |
547
560
  | Task đã xong nhưng CI cần follow lâu | Tách session monitor riêng để không kéo context cũ. |
548
561
 
549
562
  Trong Pi:
550
563
 
551
564
  ```text
552
- /compact
565
+ /context compact
553
566
  ```
554
567
 
555
568
  Sau compact, agent phải đọc lại context quan trọng trước khi sửa tiếp.
@@ -611,20 +624,36 @@ Fork một session cũ sang session mới:
611
624
  pi --fork 019f7ad3-0ce3-77f3-b34d-72d8c37c5fb6
612
625
  ```
613
626
 
614
- Đặt tên session ngay từ đầu để dễ tìm:
627
+ Đặt tên session ngay từ đầu để dễ tìm và để Agent Watch map đúng task/report:
615
628
 
616
629
  ```bash
617
- pi --name "V-Nexus header menu fix"
630
+ pi --name "ABC-123 V-Nexus header menu fix"
631
+ ```
632
+
633
+ Nếu đã vào Pi rồi mới nhớ cần đổi tên, dùng command ngắn trong Pi:
634
+
635
+ ```text
636
+ /name ABC-123 V-Nexus header menu fix
618
637
  ```
619
638
 
620
639
  Trong Pi:
621
640
 
622
641
  ```text
623
642
  /session
624
- /piagent-usage
643
+ /usage live
644
+ /usage
645
+ ```
646
+
647
+ `/session` kiểm tra tên/id hiện tại. `/usage live` và `/usage` in session id/name và session file. Ghi lại khi task dài hoặc có nhiều pane Herdr. Alias `/setname` vẫn chạy nếu muốn gõ thật ngắn.
648
+
649
+ Nếu tắt terminal/app rồi mở lại:
650
+
651
+ ```bash
652
+ cd /path/to/project
653
+ pi --continue
625
654
  ```
626
655
 
627
- `/piagent-usage` sẽ in session id và session file. Ghi lại khi task dài hoặc có nhiều pane Herdr.
656
+ Nếu `--continue` không đúng phiên cần làm, mở selector bằng `pi --resume`, chọn theo session name đã đặt. Khi resume đúng session cũ, tên session vẫn là tên đã set; nếu cần chỉnh lại cho khớp task nội bộ thì chạy `/name <new name>` ngay trước khi làm tiếp.
628
657
 
629
658
  ### Khi nào nên resume, continue, fork
630
659
 
@@ -632,8 +661,9 @@ Trong Pi:
632
661
  |---|---|
633
662
  | Tắt nhầm, muốn quay lại phiên gần nhất | `pi --continue` |
634
663
  | Không nhớ phiên nào | `pi --resume` |
635
- | Có session id/file từ `/piagent-usage` | `pi --session <id-or-file>` |
664
+ | Có session id/file từ `/usage` | `pi --session <id-or-file>` |
636
665
  | Muốn thử hướng mới nhưng giữ history cũ | `pi --fork <id-or-file>` |
666
+ | Muốn đổi tên phiên đang mở | `/name <task/session name>` |
637
667
  | Muốn session mới sạch sau task quá dài | `pi --name "<new task>"` |
638
668
 
639
669
  ## 9. MCP setup và cách dùng
@@ -764,7 +794,7 @@ Default safe config:
764
794
 
765
795
  ### Auto-delegation
766
796
 
767
- Với `/task`, `/be-to-fe`, `/platform-improve`, `/plan`, `/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.
797
+ 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.
768
798
 
769
799
  Kiểm tra nhanh policy:
770
800
 
@@ -864,8 +894,8 @@ Watchdog là optional adversarial reviewer ở cuối turn, không bật mặc
864
894
 
865
895
  | Command | Dùng để |
866
896
  |---|---|
867
- | `npm install -g --ignore-scripts @piagent/platform@1.2.1` | Cài terminal helper `piagent-*` từ release tag hiện tại. |
868
- | `pi install git:github.com/Vt-mmm/piagent@v1.2.1` | Install pinned release cho reproducible team setup. |
897
+ | `npm install -g --ignore-scripts @piagent/platform@1.2.3` | Cài terminal helper `piagent-*` từ release tag hiện tại. |
898
+ | `pi install git:github.com/Vt-mmm/piagent@v1.2.3` | Install pinned release cho reproducible team setup. |
869
899
  | `pi install git:github.com/Vt-mmm/piagent` | Install latest platform package cho máy cá nhân/sandbox. |
870
900
  | 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). |
871
901
  | 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. |
@@ -889,6 +919,7 @@ Watchdog là optional adversarial reviewer ở cuối turn, không bật mặc
889
919
  | `pi --session <id-or-file>` | Resume session cụ thể. |
890
920
  | `pi --fork <id-or-file>` | Fork session cũ sang session mới. |
891
921
  | `pi --name "<name>"` | Đặt tên session. |
922
+ | `/setname <name>` | Đổi tên session đang mở, dùng cho Agent Watch/report. |
892
923
  | `pi --tools read,grep,find,ls -p "Review src"` | Read-only one-shot. |
893
924
  | `piagent-usage /path/to/project` | Exact token/cost stats của session mới nhất. |
894
925
  | `piagent-usage --history /path/to/project --days 7` | Tổng usage lịch sử của project. |
@@ -907,15 +938,19 @@ Watchdog là optional adversarial reviewer ở cuối turn, không bật mặc
907
938
  | `/model` / `Ctrl+L` | Chọn model. |
908
939
  | `Ctrl+P` | Cycle scoped models. |
909
940
  | `Shift+Tab` | Cycle thinking level. |
910
- | `/piagent-commands` | Xem command help theo ngữ cảnh. |
911
- | `/permission-status` | Xem permission profile hiện tại. |
912
- | `/read-only` | Chuyển session sang read-only. |
913
- | `/workspace-write` | Chuyển session sang write chuẩn. |
914
- | `/full-access` | Bật trusted full-access cho session hiện tại. |
915
- | `/full-access <task>` | Bật trusted full-access rồi gửi `<task>` cho agent làm tiếp. |
916
- | `/onboard-project` | Onboard/read project lần đầu. |
917
- | `/context-index` | Xem compact context index, không gọi model follow-up. |
918
- | `/context-index search <keyword>` | Tìm node/edge/citation trong context index. |
941
+ | `/commands` | Menu/help command runtime theo topic. |
942
+ | `/workflow` | Menu task/scout/review/git/onboard workflow. |
943
+ | `/permission` | Menu permission status/read-only/workspace-write/full-access. |
944
+ | `/permission status` | Xem permission profile hiện tại. |
945
+ | `/permission read-only` | Chuyển session sang read-only. |
946
+ | `/permission workspace-write` | Chuyển session sang write chuẩn. |
947
+ | `/permission full-access` | Bật trusted full-access cho session hiện tại. |
948
+ | `/permission full-access <task>` | Bật trusted full-access rồi gửi `<task>` cho agent làm tiếp. |
949
+ | `/onboard` | Menu/status onboarding runtime. |
950
+ | `/onboard run` | Onboard/read project lần đầu. |
951
+ | `/context` | Menu context index/search/preflight/compact. |
952
+ | `/context index` | Xem compact context index, không gọi model follow-up. |
953
+ | `/context search <keyword>` | Tìm node/edge/citation trong context index. |
919
954
  | `/profile` | Xem profile ngắn, không gọi model follow-up. |
920
955
  | `/profile list` | Xem profile có sẵn dạng compact. |
921
956
  | `/profile <profile>` | Áp profile ngay và cập nhật lock. |
@@ -924,28 +959,31 @@ Watchdog là optional adversarial reviewer ở cuối turn, không bật mặc
924
959
  | `/profile tech` | Xem tech stack và Context7 status hiện tại. |
925
960
  | `/profile tech setup [profile]` | Chọn tech theo role; fullstack chọn FE/BE/DB. |
926
961
  | `/profile tech apply ...` | Apply profile/tech bằng một lệnh deterministic. |
927
- | `/memory-policy` | Xem memory policy. |
928
- | `/task-preflight` | Check context trước task lớn/risk cao. |
929
- | `/task-preflight compact` | Compact session có hướng dẫn. |
930
- | `/piagent-usage` | Snapshot context/session. |
962
+ | `/memory` | Xem memory policy. |
963
+ | `/context preflight` | Check context trước task lớn/risk cao. |
964
+ | `/context compact` | Compact session có hướng dẫn. |
965
+ | `/usage` | Snapshot context/session. |
966
+ | `/usage logs` | Xem capture output dài đã compact. |
967
+ | `/name` | Đặt/đổi tên session theo task để report dễ map. |
968
+ | `/fresh` | Mở session mới cho task/scout/be-to-fe khi phiên hiện tại nặng. |
969
+ | `/name <name>` | Đổi tên session cho resume/report. |
931
970
  | `/session` | Pi native session stats/info. |
932
- | `/compact` | Nén context. |
933
971
  | `/mcp` / `/mcp tools` | Check MCP. |
934
972
  | `/subagents-doctor` | Check subagent setup. |
935
973
  | `/subagents-fleet` | Follow child sessions. |
936
974
  | `/subagent-cost` | Check subagent token/cost. |
937
- | `/discuss` | Làm rõ, không sửa. |
938
- | `/plan` | Lập plan. |
939
- | `/scout` | Scout/audit read-only. |
940
- | `/fresh-scout` | Tự mở session mới rồi chạy `/scout`. |
941
- | `/fresh-task` | Tự mở session mới rồi chạy `/task`. |
942
- | `/fresh-be-to-fe` | Tự mở session mới rồi chạy `/be-to-fe`. |
943
- | `/task` | Implement task. |
944
- | `/be-to-fe` | BE read-only, FE implementation. |
945
- | `/platform-improve` | Cải tiến platform. |
946
- | `/review` | Review diff/source. |
947
- | `/commit [message/scope]` | Commit local qua workflow có guard. |
948
- | `/pr [title/request]` | Chuẩn bị PR, hỏi trước khi push/GitHub write. |
975
+ | `/workflow discuss <request>` | Làm rõ, không sửa. |
976
+ | `/workflow plan <goal>` | Lập plan. |
977
+ | `/workflow scout <request>` | Scout/audit read-only. |
978
+ | `/fresh scout <request>` | Tự mở session mới rồi chạy scout workflow. |
979
+ | `/fresh task <request>` | Tự mở session mới rồi chạy task workflow. |
980
+ | `/fresh be-to-fe <request>` | Tự mở session mới rồi chạy BE-to-FE workflow. |
981
+ | `/workflow task <request>` | Implement task. |
982
+ | `/workflow be-to-fe <request>` | BE read-only, FE implementation. |
983
+ | `/workflow platform-improve <request>` | Cải tiến platform. |
984
+ | `/workflow review [scope]` | Review diff/source. |
985
+ | `/workflow commit [message/scope]` | Commit local qua workflow có guard. |
986
+ | `/workflow pr [title/request]` | Chuẩn bị PR, hỏi trước khi push/GitHub write. |
949
987
 
950
988
  ## 12. Troubleshooting
951
989
 
@@ -964,7 +1002,7 @@ Mở lại Pi session sau khi install.
964
1002
  Cài lại terminal helper đúng release rồi kiểm tra `PATH`:
965
1003
 
966
1004
  ```bash
967
- npm install -g --ignore-scripts @piagent/platform@1.2.1
1005
+ npm install -g --ignore-scripts @piagent/platform@1.2.3
968
1006
  command -v piagent-install
969
1007
  ```
970
1008
 
@@ -1024,7 +1062,7 @@ bash /path/to/piagent/scripts/configure-subagents.sh --preset safe
1024
1062
  ### Context quá cao
1025
1063
 
1026
1064
  ```text
1027
- /piagent-usage
1065
+ /usage
1028
1066
  /session
1029
1067
  ```
1030
1068
 
@@ -1042,7 +1080,7 @@ pi --name "Deploy monitor"
1042
1080
 
1043
1081
  ### Resume không đúng session
1044
1082
 
1045
- Lấy session id/file từ `/piagent-usage`, rồi:
1083
+ Lấy session id/file từ `/usage`, rồi:
1046
1084
 
1047
1085
  ```bash
1048
1086
  pi --session <session-id>
@@ -80,13 +80,13 @@ Manifest data never executes code. Invalid paths, symbolic links, dependency cyc
80
80
 
81
81
  | Capability | Implementation |
82
82
  |---|---|
83
- | Project onboarding | `/onboard-project` + `piagent_project_onboarding_record` |
84
- | Project context index | `/context-index` + `piagent_context_index_*` |
83
+ | Project onboarding | `/onboard run` + `piagent_project_onboarding_record` |
84
+ | Project context index | `/context` + `piagent_context_index_*` |
85
85
  | Profile switching | `/profile` + `piagent_profile_options` / `piagent_profile_apply` |
86
- | Explicit memory | `/memory-policy` + `piagent_memory_*` |
87
- | Task lifecycle | `/task` + task/context/verify/trace tools |
88
- | Platform workflow | `/platform-improve` |
89
- | Backend-readonly to frontend | `/be-to-fe` |
86
+ | Explicit memory | `/memory` + `piagent_memory_*` |
87
+ | Task lifecycle | `/workflow task` + task/context/verify/trace tools |
88
+ | Platform workflow | `/workflow platform-improve` |
89
+ | Backend-readonly to frontend | `/workflow be-to-fe` |
90
90
  | Source cache | `piagent-source-cache` + `piagent_source_checkout` |
91
91
  | Subagent roles | `piagent-scout`, `piagent-planner`, `piagent-worker`, `piagent-reviewer`, `piagent-oracle` |
92
92
  | Quality benchmark | `scripts/quality-benchmark.sh` |
@@ -91,7 +91,7 @@ Quy tắc:
91
91
  - Mọi key project tự khai **thay thế nguyên key** của adapter, không merge từng phần tử. Khai `protectedPaths` nghĩa là project sở hữu list đó và không nhận thay đổi từ adapter nữa.
92
92
  - Không khai `extends` thì profile giữ nguyên hành vi cũ, self-contained.
93
93
 
94
- `scripts/init-project.sh` và `/onboard-project` ghi dạng `extends` khi profile đến từ built-in adapter. Update platform sau đó không cần chạm vào project nào.
94
+ `scripts/init-project.sh` và `/onboard` ghi dạng `extends` khi profile đến từ built-in adapter. Update platform sau đó không cần chạm vào project nào.
95
95
 
96
96
  ## Monorepo và workspace
97
97
 
@@ -133,7 +133,7 @@ Rule nằm ở `packages/piagent-core/extensions/project-shape.js`. Cả `piagen
133
133
  Default UX không bắt buộc chạy bash để set profile. Sau global install, vào project chạy:
134
134
 
135
135
  ```text
136
- /onboard-project
136
+ /onboard
137
137
  ```
138
138
 
139
139
  Nếu chưa có `.pi/piagent-profile.json`, onboarding nên dùng select-style setup: chọn profile trước, rồi chọn tech theo role. Native command là:
@@ -158,7 +158,7 @@ Kết quả ghi:
158
158
 
159
159
  Sau khi agent đọc Context7 cho tech tương ứng, chỉ record snapshot ngắn bằng `piagent_profile_tech_context_record`; không lưu nguyên văn docs dài.
160
160
 
161
- `/onboard-project` cũng tạo `.pi/context-index.json`. Đây là advisory node/edge/citation map cho profile, tech, verify command, docs, risk và memory pointer; không dùng thay thế source hiện tại hoặc guard policy.
161
+ `/onboard run` cũng tạo `.pi/context-index.json`. Đây là advisory node/edge/citation map cho profile, tech, verify command, docs, risk và memory pointer; không dùng thay thế source hiện tại hoặc guard policy.
162
162
 
163
163
  Đổi profile sau này:
164
164
 
@@ -185,7 +185,7 @@ Sau khi agent đọc Context7 cho tech tương ứng, chỉ record snapshot ng
185
185
 
186
186
  Auto detect là bootstrap convenience, không phải policy cuối cùng. Sau init, `.pi/piagent-profile.json` là source of truth của project.
187
187
 
188
- Mọi built-in adapter đều đưa `.pi/project-context.md` vào `requiredContext`. File này được tạo dạng placeholder khi init project, rồi được model thay bằng snapshot thật sau `/onboard-project`.
188
+ Mọi built-in adapter đều đưa `.pi/project-context.md` vào `requiredContext`. File này được tạo dạng placeholder khi init project, rồi được model thay bằng snapshot thật sau `/onboard run`.
189
189
 
190
190
  ## Khi nào cần custom profile
191
191