@piagent/platform 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitattributes +7 -0
- package/AGENTS.md +31 -0
- package/CHANGELOG.md +296 -0
- package/CODE_OF_CONDUCT.md +36 -0
- package/CONTRIBUTING.md +66 -0
- package/LICENSE +21 -0
- package/README.md +588 -0
- package/SECURITY.md +38 -0
- package/adapters/backend-api/profile.json +88 -0
- package/adapters/be-readonly-fe/profile.json +120 -0
- package/adapters/data/profile.json +88 -0
- package/adapters/devops/profile.json +92 -0
- package/adapters/docs/profile.json +74 -0
- package/adapters/fullstack/profile.json +94 -0
- package/adapters/generic/profile.json +95 -0
- package/adapters/mobile/profile.json +87 -0
- package/adapters/node-typescript/profile.json +76 -0
- package/adapters/python/profile.json +75 -0
- package/adapters/web-frontend/profile.json +101 -0
- package/catalog/capabilities.json +206 -0
- package/docs/architecture.md +64 -0
- package/docs/auto-delegation-policy.md +192 -0
- package/docs/capability-packs.md +234 -0
- package/docs/command-reference-vietnamese.md +484 -0
- package/docs/context-window-policy.md +85 -0
- package/docs/distribution-standard.md +229 -0
- package/docs/herdr-workflow.md +58 -0
- package/docs/mcp-and-tools.md +316 -0
- package/docs/memory-policy.md +164 -0
- package/docs/model-options.md +165 -0
- package/docs/oauth-providers.md +53 -0
- package/docs/operator-manual-vietnamese.md +1080 -0
- package/docs/package-architecture-notes.md +101 -0
- package/docs/project-adapters.md +174 -0
- package/docs/project-onboarding.md +135 -0
- package/docs/publishing-for-teams.md +64 -0
- package/docs/quality-benchmark.md +74 -0
- package/docs/quickstart-vietnamese.md +350 -0
- package/docs/release-install-policy.md +223 -0
- package/docs/runtime-harness-standard.md +118 -0
- package/docs/runtime-policy-design.md +132 -0
- package/docs/runtime-quality-baseline.md +257 -0
- package/docs/security-redaction-benchmark.md +56 -0
- package/docs/security-threat-model.md +66 -0
- package/docs/subagent-orchestration-capabilities.md +104 -0
- package/docs/subagents-and-multiagent.md +346 -0
- package/docs/task-implementation-contract.md +200 -0
- package/docs/team-onboarding.md +333 -0
- package/docs/usage-observability.md +130 -0
- package/docs/vercel-docs-site.md +115 -0
- package/docs/workflow-recipes.md +125 -0
- package/docs-site/assets/piagent-logo.svg +35 -0
- package/docs-site/favicon.svg +18 -0
- package/docs-site/index.html +1613 -0
- package/docs-site/vercel.json +24 -0
- package/evals/fixtures/action-proposal.invalid.json +34 -0
- package/evals/fixtures/action-proposal.valid.json +34 -0
- package/evals/fixtures/capability-pack.invalid.json +123 -0
- package/evals/fixtures/capability-pack.valid.json +123 -0
- package/evals/fixtures/capability-recipe.invalid.json +81 -0
- package/evals/fixtures/capability-recipe.valid.json +82 -0
- package/evals/fixtures/context-index.invalid.json +25 -0
- package/evals/fixtures/context-index.valid.json +25 -0
- package/evals/fixtures/eval-scenario.invalid.json +40 -0
- package/evals/fixtures/eval-scenario.valid.json +45 -0
- package/evals/fixtures/project-profile.invalid.json +88 -0
- package/evals/fixtures/project-profile.valid.json +95 -0
- package/evals/fixtures/task-contract.invalid.json +73 -0
- package/evals/fixtures/task-contract.valid.json +74 -0
- package/evals/golden/enforcement-decisions.json +329 -0
- package/evals/scenarios/capability-resolution.json +45 -0
- package/package.json +132 -0
- package/packages/piagent-core/README.md +147 -0
- package/packages/piagent-core/capabilities/capability-core.js +1023 -0
- package/packages/piagent-core/capabilities/capability-sources.js +265 -0
- package/packages/piagent-core/extensions/guard-io.js +45 -0
- package/packages/piagent-core/extensions/guard-shell-analysis.ts +558 -0
- package/packages/piagent-core/extensions/guard-types.ts +406 -0
- package/packages/piagent-core/extensions/piagent-guard.ts +5760 -0
- package/packages/piagent-core/extensions/policy-core.js +1070 -0
- package/packages/piagent-core/extensions/redaction-core.js +4 -0
- package/packages/piagent-core/extensions/runtime-evidence.js +215 -0
- package/packages/piagent-core/package.json +46 -0
- package/packages/piagent-core/policies/base-policy.json +249 -0
- package/packages/piagent-core/prompts/be-to-fe.md +82 -0
- package/packages/piagent-core/prompts/commit.md +27 -0
- package/packages/piagent-core/prompts/discuss.md +35 -0
- package/packages/piagent-core/prompts/memory-policy.md +52 -0
- package/packages/piagent-core/prompts/model-options.md +68 -0
- package/packages/piagent-core/prompts/onboard-project.md +147 -0
- package/packages/piagent-core/prompts/piagent-commands.md +68 -0
- package/packages/piagent-core/prompts/plan.md +35 -0
- package/packages/piagent-core/prompts/platform-improve.md +69 -0
- package/packages/piagent-core/prompts/pr.md +26 -0
- package/packages/piagent-core/prompts/review.md +38 -0
- package/packages/piagent-core/prompts/scout.md +50 -0
- package/packages/piagent-core/prompts/task.md +69 -0
- package/packages/piagent-core/security/sensitive-data.js +187 -0
- package/packages/piagent-core/skills/piagent-ops/SKILL.md +44 -0
- package/packages/piagent-core/skills/piagent-source-cache/SKILL.md +59 -0
- package/packages/piagent-core/skills/piagent-source-cache/checkout-source-repo.sh +144 -0
- package/packages/piagent-core/subagents/piagent-oracle.md +29 -0
- package/packages/piagent-core/subagents/piagent-planner.md +46 -0
- package/packages/piagent-core/subagents/piagent-reviewer.md +48 -0
- package/packages/piagent-core/subagents/piagent-scout.md +37 -0
- package/packages/piagent-core/subagents/piagent-worker.md +44 -0
- package/packs/engineering-base/pack.json +123 -0
- package/packs/engineering-base/recipes/bounded-change.json +82 -0
- package/packs/web-delivery/pack.json +72 -0
- package/packs/web-delivery/recipes/verified-web-change.json +57 -0
- package/schemas/action-proposal.schema.json +90 -0
- package/schemas/capability-pack.schema.json +190 -0
- package/schemas/capability-recipe.schema.json +72 -0
- package/schemas/context-index.schema.json +258 -0
- package/schemas/eval-scenario.schema.json +67 -0
- package/schemas/project-profile.schema.json +555 -0
- package/schemas/task-contract.schema.json +314 -0
- package/scripts/audit-runtime-host.sh +78 -0
- package/scripts/bootstrap-local.sh +25 -0
- package/scripts/capability-catalog.mjs +290 -0
- package/scripts/check-runtime-advisories.mjs +114 -0
- package/scripts/configure-mcp.sh +301 -0
- package/scripts/configure-model-scope.sh +143 -0
- package/scripts/configure-subagents.sh +241 -0
- package/scripts/import-agent-instructions.mjs +199 -0
- package/scripts/init-project.sh +369 -0
- package/scripts/install-global.sh +532 -0
- package/scripts/link-project.sh +25 -0
- package/scripts/migrate-project-state.mjs +176 -0
- package/scripts/pi-auto.sh +79 -0
- package/scripts/pi-model-catalog.sh +154 -0
- package/scripts/pi-session-stats.sh +135 -0
- package/scripts/piagent-cli.mjs +53 -0
- package/scripts/profile-doctor.sh +238 -0
- package/scripts/quality-benchmark.sh +185 -0
- package/scripts/redaction-benchmark.mjs +227 -0
- package/scripts/runtime-policy-smoke.sh +48 -0
- package/scripts/setup.sh +425 -0
- package/scripts/team-doctor.sh +461 -0
- package/scripts/verify-local.sh +540 -0
- package/scripts/verify-release-identity.mjs +85 -0
- package/scripts/verify-vercel-link.mjs +64 -0
- package/templates/global/mcp.json +9 -0
- package/templates/global/settings.json +37 -0
- package/templates/project/.mcp.json +9 -0
- package/templates/project/.pi/context-index.json +25 -0
- package/templates/project/.pi/gitignore.template +22 -0
- package/templates/project/.pi/mcp.json +9 -0
- package/templates/project/.pi/memory/MEMORY.md +11 -0
- package/templates/project/.pi/memory/memory_summary.md +9 -0
- package/templates/project/.pi/piagent-profile.json +107 -0
- package/templates/project/.pi/project-context.md +30 -0
- package/templates/project/.pi/settings.json +17 -0
- package/templates/project/.pi/task-contract.template.json +74 -0
- package/templates/project/.pi/tech-context/README.md +7 -0
- package/templates/project/.pi/tech-stack.json +10 -0
- package/templates/project/AGENTS.md +34 -0
- package/templates/project/REVIEW_GUIDELINES.md +23 -0
- package/types/pi-runtime-shims.d.ts +13 -0
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
# Quickstart tiếng Việt
|
|
2
|
+
|
|
3
|
+
> Nếu cần hướng dẫn đầy đủ từ setup, command, token/session, MCP đến subagents, xem `docs/operator-manual-vietnamese.md`.
|
|
4
|
+
|
|
5
|
+
## Mục tiêu
|
|
6
|
+
|
|
7
|
+
Sau setup, flow hằng ngày là:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
cd <project>
|
|
11
|
+
pi
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Phần còn lại — OAuth, package, context, harness, MCP, tool-call guard — nằm trong repo/package `piagent-platform`.
|
|
15
|
+
|
|
16
|
+
## Bước 1 — install runtime và package
|
|
17
|
+
|
|
18
|
+
Support matrix của release hiện tại:
|
|
19
|
+
|
|
20
|
+
| Runtime | Trạng thái |
|
|
21
|
+
|---|---|
|
|
22
|
+
| macOS Apple Silicon + Bash | Đã verify cho release này. |
|
|
23
|
+
| Linux x64 + Bash | Đã verify trong CI. |
|
|
24
|
+
| macOS Intel + Bash | Supported target; chạy `piagent-doctor` và smoke test project trước khi rollout rộng. |
|
|
25
|
+
| Linux ARM64 + Bash | Supported target; chạy `piagent-doctor` và smoke test project trước khi rollout rộng. |
|
|
26
|
+
| Native Windows | Chưa phải target rollout team; helper/shell policy cần Bash/POSIX semantics. |
|
|
27
|
+
| WSL2 | Experimental, chưa release-gate. |
|
|
28
|
+
|
|
29
|
+
Node.js phải từ `22.19.0` trở lên và Pi Coding Agent phải là `0.81.1`.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
node --version # >= 22.19.0
|
|
33
|
+
npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1
|
|
34
|
+
npm install -g --ignore-scripts github:Vt-mmm/piagent#v1.0.0
|
|
35
|
+
piagent-install --stable --dry-run
|
|
36
|
+
piagent-install --stable
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Lệnh trên cài Pi CLI, cài terminal command `piagent-*`, rồi install Pi Agent Platform bằng stable release đã resolve tag thành commit SHA. Trong output installer, `currentRelease` là version của terminal helper đang chạy. `v1.0.0` là release hiện tại của docs này.
|
|
40
|
+
|
|
41
|
+
Nếu chỉ cần cài package vào Pi và không cần terminal command helper:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pi install git:github.com/Vt-mmm/piagent@v1.0.0
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Nếu đang ở source checkout của platform, có thể preview và áp stable bằng helper:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
bash scripts/install-global.sh --stable --dry-run
|
|
51
|
+
bash scripts/install-global.sh --stable
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Helper stable sẽ resolve tag release hiện tại thành commit SHA trước khi install, nên user vẫn dùng lệnh ngắn nhưng team nhận source bất biến hơn.
|
|
55
|
+
|
|
56
|
+
Khi update toàn bộ platform, cập nhật exact Pi host trước rồi dùng helper target để cài Pi package tương ứng:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1
|
|
60
|
+
npm install -g --ignore-scripts github:Vt-mmm/piagent#vX.Y.Z
|
|
61
|
+
piagent-install --stable --dry-run
|
|
62
|
+
piagent-install --stable
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Rollback toàn bộ dùng cùng flow với `vPREVIOUS`, nhưng phải lấy exact host version từ release policy của target và đánh giá lại dependency risk trước khi hạ host. Nếu chủ ý chỉ đổi Pi package và giữ host/helper hiện tại:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
piagent-install --version vX.Y.Z --resolve-tag --dry-run
|
|
69
|
+
piagent-install --version vX.Y.Z --resolve-tag
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Checklist release canonical nằm tại [release-install-policy.md](release-install-policy.md).
|
|
73
|
+
|
|
74
|
+
Máy cá nhân hoặc sandbox có thể dùng latest nếu chấp nhận cập nhật nhanh:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
bash scripts/install-global.sh --dev --dry-run
|
|
78
|
+
bash scripts/install-global.sh --dev
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Sau bước này, project mới không cần chạy bash init profile. Chỉ cần:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
cd /path/to/project
|
|
85
|
+
pi
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Với project đã tin cậy, có thể dùng wrapper để Pi tự approve project-local resources cho lần chạy đó:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
piagent-auto
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Read-only auto-run:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
piagent-auto --read-only -p "Scout payment mapping. Do not edit source."
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Trusted full-access style run cho repo đã kiểm soát:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
piagent-auto --full-access -p "Run the trusted local benchmark suite."
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Wrapper này không bypass piagent guard; nó wrap `pi --approve` và set permission profile cho lần chạy. Dù dùng `--full-access`, protected paths, redaction, destructive shell checks, task gate, và verify evidence vẫn chạy.
|
|
107
|
+
|
|
108
|
+
Nếu đã ở trong Pi session, dùng slash command cho nhanh:
|
|
109
|
+
|
|
110
|
+
```text
|
|
111
|
+
/permission-status
|
|
112
|
+
/full-access Implement/refactor task trong repo trusted này.
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`/full-access <task>` chỉ bật full-access cho session hiện tại, không tự ghi `.pi/piagent-profile.json`.
|
|
116
|
+
|
|
117
|
+
Nếu chat box/ảnh chụp trả về local path thay vì attachment ảnh, dán path đó trực tiếp vào prompt:
|
|
118
|
+
|
|
119
|
+
```text
|
|
120
|
+
/scout Check UI issue from screenshot /var/folders/.../screenshot.png
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Platform sẽ tự attach ảnh và rewrite prompt thành `[image1]` trước khi model xử lý. Hỗ trợ `.png/.jpg/.jpeg/.gif/.webp/.bmp`, tối đa 4 ảnh, 8 MB mỗi ảnh.
|
|
124
|
+
|
|
125
|
+
## Bước 2 — login OAuth OpenAI Codex/ChatGPT hoặc Claude/Anthropic
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
pi
|
|
129
|
+
/login
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Chọn provider OpenAI/Codex/ChatGPT hoặc Anthropic/Claude trong danh sách Pi. Token được lưu local trong Pi agent dir, không nằm trong repo.
|
|
133
|
+
|
|
134
|
+
## Bước 3 — chọn model và chạy project onboarding
|
|
135
|
+
|
|
136
|
+
Sau khi login và chọn model intended cho project understanding:
|
|
137
|
+
|
|
138
|
+
```text
|
|
139
|
+
/model # hoặc Ctrl+L để chọn model bằng selector của Pi
|
|
140
|
+
/scoped-models # optional, chỉnh danh sách Ctrl+P cycle
|
|
141
|
+
/piagent-commands
|
|
142
|
+
/mcp # kiểm tra MCP adapter/server
|
|
143
|
+
/subagents-doctor # health check subagent setup
|
|
144
|
+
/onboard-project
|
|
145
|
+
/context-index
|
|
146
|
+
/memory-policy
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Global setup đã config sẵn `enabledModels` cho các provider model families. Anh đổi model bằng selector/hotkey:
|
|
150
|
+
|
|
151
|
+
```text
|
|
152
|
+
Ctrl+L # model selector
|
|
153
|
+
Ctrl+P # đổi model trong scope
|
|
154
|
+
Shift+Tab # đổi thinking
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Nếu muốn xem/re-apply model scope từ terminal: `piagent-models` và `piagent-model-scope --preset full`.
|
|
158
|
+
|
|
159
|
+
Nếu muốn xem/re-apply MCP baseline từ terminal:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
piagent-mcp --preset core --scope global --replace
|
|
163
|
+
piagent-mcp --preset popular --scope global --replace
|
|
164
|
+
piagent-mcp --list
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Nếu clone repo GitHub và chưa link npm bin, dùng fallback:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
bash /path/to/piagent/scripts/configure-mcp.sh --preset core --scope global --replace
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Nếu muốn xem/re-apply subagents baseline từ terminal:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
piagent-subagents --preset safe
|
|
177
|
+
# fallback:
|
|
178
|
+
bash /path/to/piagent/scripts/configure-subagents.sh --preset safe
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Nếu muốn dùng builtin `researcher` cho web/docs research trong Pi:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
pi install npm:pi-web-access@0.13.0
|
|
185
|
+
# hoặc setup từ đầu:
|
|
186
|
+
bash /path/to/piagent/scripts/setup.sh . --with-web-access
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Lệnh này yêu cầu model đọc qua project theo phạm vi có kiểm soát, rồi ghi:
|
|
190
|
+
|
|
191
|
+
```text
|
|
192
|
+
.pi/piagent-profile.json
|
|
193
|
+
.pi/piagent-profile.lock.json
|
|
194
|
+
.pi/tech-stack.json
|
|
195
|
+
.pi/tech-context/*.json
|
|
196
|
+
.pi/project-context.md
|
|
197
|
+
.pi/context-index.json
|
|
198
|
+
.pi/memory/memory_summary.md
|
|
199
|
+
.pi/memory/MEMORY.md
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Nếu chưa có profile/tech stack, dùng select-style flow để tránh agent trả lời dài:
|
|
203
|
+
|
|
204
|
+
```text
|
|
205
|
+
/profile setup
|
|
206
|
+
/profile tech setup fullstack
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
`web-frontend` chọn FE + database optional; `backend-api` chọn BE + database optional; `fullstack` chọn frontend, backend và database. Nếu Pi host chưa có native select, command sẽ trả card ngắn và lệnh deterministic `/profile tech apply ...`.
|
|
210
|
+
|
|
211
|
+
`.pi/project-context.md` là snapshot context cho task sau. `.pi/context-index.json` là bản đồ node/edge/citation compact để tìm đúng điểm vào repo; vẫn phải đọc source hiện tại trước khi sửa. Không đọc/ghi raw file index trong task thường ngày; dùng `/context-index`, `/onboard-project` hoặc `piagent_context_index_record` để runtime sanitize dữ liệu advisory. Nếu snapshot còn `Generated: not yet` hoặc `/context-index` báo pending/stale, agent phải dừng trước task lớn và yêu cầu chạy `/onboard-project`.
|
|
212
|
+
|
|
213
|
+
`/memory-policy` kiểm tra chính sách memory của project. Mặc định memory là explicit-only: chỉ ghi khi user yêu cầu rõ “remember this”, không tự học transcript nền.
|
|
214
|
+
|
|
215
|
+
## Bước 4 — init thêm project khác
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
bash /path/to/piagent/scripts/setup.sh /path/to/project \
|
|
219
|
+
--project-only \
|
|
220
|
+
--profile auto \
|
|
221
|
+
--package-source git:github.com/Vt-mmm/piagent@v1.0.0 \
|
|
222
|
+
--mcp-preset core \
|
|
223
|
+
--subagents-preset safe
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Đổi profile sau này trong Pi:
|
|
227
|
+
|
|
228
|
+
```text
|
|
229
|
+
/profile list
|
|
230
|
+
/profile setup
|
|
231
|
+
/profile tech setup
|
|
232
|
+
/profile be-readonly-fe
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Profile built-in: `generic`, `web-frontend`, `backend-api`, `be-readonly-fe`, `fullstack`, `node-typescript`, `python`, `data`, `devops`, `mobile`, `docs`.
|
|
236
|
+
|
|
237
|
+
## Bước 5 — setup split/preseed nếu cần
|
|
238
|
+
|
|
239
|
+
Script bash chỉ dùng khi muốn preseed config vào repo:
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
bash /path/to/piagent/scripts/setup.sh /path/to/project \
|
|
243
|
+
--profile be-readonly-fe \
|
|
244
|
+
--package-source git:github.com/Vt-mmm/piagent@v1.0.0 \
|
|
245
|
+
--mcp-preset core \
|
|
246
|
+
--subagents-preset safe
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
## Bước 6 — chạy hằng ngày
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
herdr
|
|
253
|
+
cd <project>
|
|
254
|
+
pi
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Prompt mẫu khi requirement chưa rõ:
|
|
258
|
+
|
|
259
|
+
```text
|
|
260
|
+
/discuss Cải tiến workflow onboarding cho team mới. Chưa implement, chỉ hỏi lại phần còn thiếu và đề xuất plan.
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Prompt mẫu khi đã rõ task:
|
|
264
|
+
|
|
265
|
+
```text
|
|
266
|
+
/task Implement this request. Use piagent_context, piagent_task_start, piagent_context_budget, piagent_exec_policy_check when shell is needed, piagent_verify_record, piagent_trace_record, and piagent_task_gate_check before done.
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
Prompt mẫu khi chỉ cần scout/read-only:
|
|
270
|
+
|
|
271
|
+
```text
|
|
272
|
+
/scout Scout payment FE mapping vs BE contract. Backend read-only. Do not edit source.
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
Nếu session đang nặng hoặc gặp context overflow:
|
|
276
|
+
|
|
277
|
+
```text
|
|
278
|
+
/fresh-scout Scout payment FE mapping vs BE contract. Backend read-only. Do not edit source.
|
|
279
|
+
/fresh-task Implement <bounded task>.
|
|
280
|
+
/fresh-be-to-fe Implement FE support from <BE contract>. Backend read-only.
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
Không paste full mandatory flow hằng ngày. Từ `v0.3.21`, input guard tự collapse mandatory-flow boilerplate và fresh workflow tự mở session mới khi cần.
|
|
284
|
+
|
|
285
|
+
Từ `v0.3.21`, `/task` có auto-delegation policy. Với task đủ lớn, parent agent phải tự cân nhắc dùng `piagent-scout`, `piagent-planner`, hoặc `piagent-reviewer`; anh không cần tự gọi `/run` nếu không muốn ép orchestration.
|
|
286
|
+
|
|
287
|
+
Các workflow package đáng dùng khi muốn ép rõ shape:
|
|
288
|
+
|
|
289
|
+
```text
|
|
290
|
+
/parallel-review current diff
|
|
291
|
+
/review-loop current diff max 3 rounds
|
|
292
|
+
/parallel-research <question cần external evidence + local code context>
|
|
293
|
+
/parallel-context-build <task lớn cần context handoff>
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
Prompt mẫu cho 2 recipe hay gặp:
|
|
297
|
+
|
|
298
|
+
```text
|
|
299
|
+
/piagent-commands subagents
|
|
300
|
+
/platform-improve Improve model selection, MCP setup, and onboarding docs for a public team package.
|
|
301
|
+
/be-to-fe Implement FE from BE spec <endpoint/spec>. Backend read-only.
|
|
302
|
+
/context-index search auth
|
|
303
|
+
/memory-policy Show project memory policy and safe remember workflow.
|
|
304
|
+
/run piagent-scout "Map target area read-only before planning."
|
|
305
|
+
/run piagent-reviewer "Review current diff before final handoff."
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
Cache external source repo để đọc targeted trong Pi:
|
|
309
|
+
|
|
310
|
+
```text
|
|
311
|
+
Use piagent_source_checkout for github.com/org/repo, inspect only relevant files, then summarize applicable patterns.
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
Runtime gate tools có sẵn:
|
|
315
|
+
|
|
316
|
+
```text
|
|
317
|
+
piagent_exec_policy_check # check shell command
|
|
318
|
+
piagent_context_budget # check context size/hard cap
|
|
319
|
+
piagent_tool_policy_check # check tool capability
|
|
320
|
+
piagent_task_gate_check # check before final DONE
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Fallback bằng shell nếu cần:
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
PIAGENT_PLATFORM_HOME=/path/to/piagent
|
|
327
|
+
bash "$PIAGENT_PLATFORM_HOME/packages/piagent-core/skills/piagent-source-cache/checkout-source-repo.sh" \
|
|
328
|
+
github.com/org/repo \
|
|
329
|
+
--path-only
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
## Việc user vẫn phải làm thủ công
|
|
333
|
+
|
|
334
|
+
- Login OAuth lần đầu trong browser.
|
|
335
|
+
- Chọn provider/model intended cho project.
|
|
336
|
+
- Chạy `/onboard-project` lần đầu để tạo `.pi/project-context.md` và `.pi/context-index.json`.
|
|
337
|
+
- Chạy `/memory-policy` nếu muốn kiểm tra hoặc dùng project memory.
|
|
338
|
+
- Approve project trust nếu Pi hỏi. Sau khi hiểu rõ repo, có thể dùng `piagent-auto` hoặc Pi native `--approve` cho từng lần chạy.
|
|
339
|
+
- Approve khi extension guard hỏi destructive/high-risk action.
|
|
340
|
+
|
|
341
|
+
Các việc này là credential/trust boundary, không nên automation mù.
|
|
342
|
+
|
|
343
|
+
## Tài liệu chính
|
|
344
|
+
|
|
345
|
+
- Command reference: `docs/command-reference-vietnamese.md`
|
|
346
|
+
- Pi packages: https://pi.dev/docs/latest/packages
|
|
347
|
+
- Pi extensions: https://pi.dev/docs/latest/extensions
|
|
348
|
+
- Pi providers/OAuth: https://pi.dev/docs/latest/providers
|
|
349
|
+
- Pi settings/trust: https://pi.dev/docs/latest/settings
|
|
350
|
+
- Pi MCP adapter: https://pi.dev/packages/pi-mcp-adapter
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# Release and install policy
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Pi Agent Platform uses explicit release sources for team rollout. Personal machines may follow a moving source when fast iteration matters, but team environments and committed project settings use exact tags or reviewed commits so every developer receives the same platform package.
|
|
6
|
+
|
|
7
|
+
This file is the canonical install, update, rollback, and release checklist. Other docs link here instead of maintaining a second release procedure.
|
|
8
|
+
|
|
9
|
+
## Supported runtime matrix
|
|
10
|
+
|
|
11
|
+
All supported environments require Node.js `>=22.19.0` and Pi Coding Agent `0.81.1`. 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
|
+
|
|
13
|
+
| Surface | Status for v1.0.0 | Rollout guidance |
|
|
14
|
+
|---|---|---|
|
|
15
|
+
| macOS Apple Silicon (`darwin/arm64`) + Bash | Verified for this release. | Safe default for team rollout after normal project smoke tests. |
|
|
16
|
+
| Linux x64 + Bash | Verified in GitHub Actions. | Safe default for CI/server usage after normal project smoke tests. |
|
|
17
|
+
| macOS Intel (`darwin/x64`) + Bash | Supported target; not currently a dedicated release-gate runner. | Run `piagent-doctor` plus the target project's smoke/verify suite before broad rollout. |
|
|
18
|
+
| Linux ARM64 + Bash | Supported target; not currently a dedicated release-gate runner. | Run `piagent-doctor` plus the target project's smoke/verify suite before broad rollout. |
|
|
19
|
+
| Native Windows x64/ARM64 | Not supported for team rollout in this release. | Node is available on Windows, but platform helper scripts and shell parsing assume Bash/POSIX semantics. Use a verified macOS/Linux surface for release-critical work. |
|
|
20
|
+
| WSL2 | Experimental and not release-gated. | Treat as local/personal until a WSL lane and smoke suite are added. |
|
|
21
|
+
|
|
22
|
+
## Runtime and two installation planes
|
|
23
|
+
|
|
24
|
+
| Component | Installed by | Provides |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| Pi host runtime | `npm install -g --ignore-scripts @earendil-works/pi-coding-agent@<exact-version>` | The compatible `pi` executable. |
|
|
27
|
+
| Terminal helper | `npm install -g --ignore-scripts github:Vt-mmm/piagent#vX.Y.Z` | `piagent-*` commands on `PATH`. |
|
|
28
|
+
| Pi package | `piagent-install`, or `pi install ...` | Extensions, prompts, skills, and subagents loaded by Pi. |
|
|
29
|
+
|
|
30
|
+
These three components are versioned independently. A full install, update, or rollback must use the exact Pi host declared by the target release, then install the target terminal helper, then let that helper install its matching Pi package. `piagent-install` changes only the Pi package; it does not replace the Pi host or the npm-global terminal helper currently executing. In installer output, `currentRelease` is the terminal helper package version.
|
|
31
|
+
|
|
32
|
+
## Release channels
|
|
33
|
+
|
|
34
|
+
| Channel | Source shape | Mutability | Use when |
|
|
35
|
+
|---|---|---:|---|
|
|
36
|
+
| `stable` | `git:github.com/Vt-mmm/piagent@<resolved-commit-sha>` from `v1.0.0` | Fixed after resolution | Default for team rollout. |
|
|
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
|
+
| `dev` | `git:github.com/Vt-mmm/piagent` | Moving | Personal machine or sandbox only. |
|
|
39
|
+
| `local` | `/path/to/piagent` | Local workspace | Platform development and dry-run validation. |
|
|
40
|
+
| `enterprise-npm` | `npm:@your-scope/platform@x.y.z` | Fixed | Private registry distribution when available. |
|
|
41
|
+
|
|
42
|
+
`--stable` reads the helper package version from its own `package.json`, resolves that release tag through GitHub, and installs the resulting commit SHA. If the tag cannot be resolved, install fails closed. Release CI additionally sets `PIAGENT_EXPECTED_RELEASE_COMMIT`; the installer then rejects a tag that resolves anywhere except the commit being verified.
|
|
43
|
+
|
|
44
|
+
Exactly one CLI package selector is accepted: `--package-source`, `--channel`, `--stable`, `--dev`, `--local`, `--version`, or `--tag`. The first CLI selector may replace environment defaults; a second CLI selector is rejected before any install command is printed or executed.
|
|
45
|
+
|
|
46
|
+
## First install — full platform
|
|
47
|
+
|
|
48
|
+
Use this flow when the team needs both terminal commands and the Pi package:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
node --version # >= 22.19.0
|
|
52
|
+
npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1
|
|
53
|
+
npm install -g --ignore-scripts github:Vt-mmm/piagent#v1.0.0
|
|
54
|
+
piagent-install --stable --dry-run
|
|
55
|
+
piagent-install --stable
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The stable preview and apply output includes:
|
|
59
|
+
|
|
60
|
+
```text
|
|
61
|
+
currentRelease: v1.0.0 (helper package version)
|
|
62
|
+
tag: v1.0.0
|
|
63
|
+
resolvedCommit: <40-char-sha>
|
|
64
|
+
source: git:github.com/Vt-mmm/piagent@<40-char-sha>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
From a checked-out platform repository, the same Pi-package install is available as:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
bash scripts/install-global.sh --stable --dry-run
|
|
71
|
+
bash scripts/install-global.sh --stable
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## First install — Pi package only
|
|
75
|
+
|
|
76
|
+
Use this only when terminal commands are not needed:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
pi install git:github.com/Vt-mmm/piagent@v1.0.0
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Direct `pi install` does not create `piagent-*` commands on `PATH`.
|
|
83
|
+
|
|
84
|
+
## Full platform update
|
|
85
|
+
|
|
86
|
+
Update the exact supported Pi host first, then the npm-global helper, then let that target helper resolve and install its matching stable Pi package:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.81.1
|
|
90
|
+
npm install -g --ignore-scripts github:Vt-mmm/piagent#vX.Y.Z
|
|
91
|
+
piagent-install --stable --dry-run
|
|
92
|
+
piagent-install --stable
|
|
93
|
+
piagent-doctor /path/to/project --strict-share
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Review the target `CHANGELOG.md` before applying the update. Confirm that `currentRelease`, `tag`, and `resolvedCommit` all describe the intended release.
|
|
97
|
+
|
|
98
|
+
## Pi-package-only update
|
|
99
|
+
|
|
100
|
+
This flow changes the Pi package but intentionally leaves the npm-global helper unchanged:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
piagent-install --version vX.Y.Z --resolve-tag --dry-run
|
|
104
|
+
piagent-install --version vX.Y.Z --resolve-tag
|
|
105
|
+
piagent-doctor /path/to/project --strict-share
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Alternatively, install a reviewed Pi source directly:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
pi install git:github.com/Vt-mmm/piagent@vX.Y.Z
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
`pi update --extensions` refreshes configured package refs. It does not move a pinned project from one tag or commit to a different target; install the new reviewed ref explicitly.
|
|
115
|
+
|
|
116
|
+
## Full platform rollback
|
|
117
|
+
|
|
118
|
+
Rollback the host, helper, and Pi package together. Determine the exact host version from the target release's compatibility section before running this sequence; do not assume the current host is supported by an older helper.
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
TARGET_PI_VERSION=x.y.z # replace from vPREVIOUS release policy before execution
|
|
122
|
+
npm install -g --ignore-scripts "@earendil-works/pi-coding-agent@$TARGET_PI_VERSION"
|
|
123
|
+
npm install -g --ignore-scripts github:Vt-mmm/piagent#vPREVIOUS
|
|
124
|
+
piagent-install --stable --dry-run
|
|
125
|
+
piagent-install --stable
|
|
126
|
+
piagent-doctor /path/to/project --strict-share
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Older host versions may reintroduce dependency findings fixed by the current release; treat that as an explicit rollback risk. Restore project state only if the older package cannot read a newer profile, lock, or runtime-state format. Preserve the current state separately before restoring a project snapshot.
|
|
130
|
+
|
|
131
|
+
## Pi-package-only rollback
|
|
132
|
+
|
|
133
|
+
Use this when terminal helpers must remain at their current version:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
piagent-install --version vPREVIOUS --resolve-tag --dry-run
|
|
137
|
+
piagent-install --version vPREVIOUS --resolve-tag
|
|
138
|
+
piagent-doctor /path/to/project --strict-share
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Canonical release checklist
|
|
142
|
+
|
|
143
|
+
Production docs must never advertise a tag that cannot yet be installed.
|
|
144
|
+
|
|
145
|
+
### Required GitHub repository controls
|
|
146
|
+
|
|
147
|
+
Before broad team access, a repository administrator must enable these external controls; source files cannot turn them on:
|
|
148
|
+
|
|
149
|
+
1. Create an active branch ruleset for `main` that requires a pull request, blocks force-push and deletion, and requires the checks shown by the workflows, including `verify (ubuntu-latest)`, `verify (macos-latest)`, `analyze (actions)`, and `analyze (javascript-typescript)`. Add one narrowly scoped release-maintainer bypass actor for the exact non-force fast-forward promotion described below; do not give this bypass to the normal team role.
|
|
150
|
+
2. Create an active tag ruleset targeting `v*`. Restrict creation to the maintainer/release role and block tag update and deletion. This is mandatory because the first npm-global helper install uses a release tag before that helper can resolve its Pi-package source to a commit SHA.
|
|
151
|
+
3. Enable Dependency graph, Dependabot alerts, and Dependabot security updates. Keep `.github/dependabot.yml` enabled for scheduled npm and GitHub Actions update pull requests.
|
|
152
|
+
4. Enable GitHub private vulnerability reporting so the form linked by `SECURITY.md` works before public rollout.
|
|
153
|
+
5. Keep secret scanning and push protection enabled. Review CodeQL results after the workflow's first successful run.
|
|
154
|
+
|
|
155
|
+
Verify these settings in GitHub **Settings → Rules** and **Settings → Code security and analysis**. Treat any missing control as an explicit rollout blocker, not as a passing source-code gate. Repository rules also close the remaining mutability risk of bootstrap-by-tag; tag-to-SHA resolution inside `piagent-install` alone cannot protect the helper package before it starts.
|
|
156
|
+
|
|
157
|
+
1. Update package versions, `CHANGELOG.md`, install examples, and docs metadata on a release-candidate branch.
|
|
158
|
+
2. Verify the exact release-candidate source:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
npm run verify
|
|
162
|
+
npm test
|
|
163
|
+
npm run typecheck
|
|
164
|
+
npm run smoke
|
|
165
|
+
npm run benchmark:redaction
|
|
166
|
+
npm audit --audit-level=high
|
|
167
|
+
npm run audit:runtime
|
|
168
|
+
npm run release:identity
|
|
169
|
+
npm pack --dry-run --json
|
|
170
|
+
bash scripts/setup.sh --global-only --package-source git:github.com/Vt-mmm/piagent@vX.Y.Z --dry-run
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
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.
|
|
174
|
+
4. Create an annotated, reviewed tag on that exact verified commit and push the tag:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
RC_COMMIT=<verified-40-char-pr-head-sha>
|
|
178
|
+
git tag -a vX.Y.Z "$RC_COMMIT" -m "Pi Agent Platform vX.Y.Z"
|
|
179
|
+
git push origin vX.Y.Z
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Use a signed tag when the maintainer signing setup is available. Tag CI requires an annotated tag, verifies that it equals `v<package-version>`, checks that its peeled commit equals the checked-out release SHA, confirms root/core/capability-lock/docs versions agree, requires the stable installer to resolve back to that same SHA, and runs high-severity dependency gates for both the helper tree and exact Pi host + pinned add-ons. Wait for the tag-triggered Ubuntu and macOS CI jobs to pass before continuing.
|
|
183
|
+
|
|
184
|
+
5. Verify the remote tag and confirm stable resolution points to the tagged commit:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
git ls-remote --tags origin refs/tags/vX.Y.Z 'refs/tags/vX.Y.Z^{}'
|
|
188
|
+
RELEASE_COMMIT="$(git rev-parse vX.Y.Z^{})"
|
|
189
|
+
PIAGENT_EXPECTED_RELEASE_COMMIT="$RELEASE_COMMIT" bash scripts/install-global.sh --stable --dry-run --no-model-scope
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
6. Create a draft GitHub release from the matching `CHANGELOG.md` section. Keep it unpublished until production docs are verified:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
gh release create vX.Y.Z --draft --verify-tag --title "vX.Y.Z" --notes-file /tmp/pi-agent-vX.Y.Z-release-notes.md
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
7. Only after tag CI and stable SHA verification pass, the designated release maintainer uses the ruleset bypass for a non-force fast-forward of the exact tagged commit to `main`. Do not merge, squash, rebase, or introduce a different commit during promotion:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
git fetch --tags origin main:refs/remotes/origin/main
|
|
202
|
+
RELEASE_COMMIT="$(git rev-parse vX.Y.Z^{})"
|
|
203
|
+
test "$(git merge-base origin/main "$RELEASE_COMMIT")" = "$(git rev-parse origin/main)"
|
|
204
|
+
git push origin "$RELEASE_COMMIT:refs/heads/main"
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
The open release pull request should then resolve against the same commit history. This bypass exists only to reconcile reviewed PR checks with tag-first Vercel promotion; it must never be used for an unreviewed commit or a force-push. If Vercel auto-deploys `main`, this exact fast-forward is the production promotion. For an explicit CLI deploy instead, check out the exact tag, run `vercel link --cwd docs-site --project pi-agent`, require `npm run vercel:preflight` to pass, then deploy with `vercel --cwd docs-site --prod`.
|
|
208
|
+
8. Verify the live docs version, links, canonical domain, and install commands.
|
|
209
|
+
9. Publish the already-reviewed draft only after production verification passes:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
gh release edit vX.Y.Z --draft=false
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
10. Announce the release, then roll out with the full platform update flow above and run doctor/smoke checks on representative team projects.
|
|
216
|
+
|
|
217
|
+
## Security notes
|
|
218
|
+
|
|
219
|
+
- Do not use a moving source in committed project settings.
|
|
220
|
+
- Do not publish local trust files, OAuth tokens, `auth.json`, sessions, caches, or `.env` files.
|
|
221
|
+
- Review the resolved commit SHA before rollout; tag resolution improves reproducibility but is not signed package provenance by itself.
|
|
222
|
+
- `npm audit --audit-level=high` covers this repository's helper dependency tree. `npm run audit:runtime` separately builds and audits the exact optional Pi host and pinned add-on dependency tree so `--legacy-peer-deps` cannot hide deployed runtime findings.
|
|
223
|
+
- Run doctor after install, update, or rollback so package source, project profile, protected paths, and share policy are checked together.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Runtime harness standard
|
|
2
|
+
|
|
3
|
+
## Mục tiêu
|
|
4
|
+
|
|
5
|
+
Runtime harness là “máy vận hành task” dùng chung cho nhiều project:
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
User request
|
|
9
|
+
-> project profile
|
|
10
|
+
-> intake/risk lane
|
|
11
|
+
-> required context manifest
|
|
12
|
+
-> plan / task contract
|
|
13
|
+
-> guarded tool calls
|
|
14
|
+
-> implementation
|
|
15
|
+
-> observed verify evidence
|
|
16
|
+
-> trace / handoff
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Project cụ thể chỉ cần adapter/profile riêng. Core package giữ lifecycle, policy, verification, và documentation flow.
|
|
20
|
+
|
|
21
|
+
## Reusable modules
|
|
22
|
+
|
|
23
|
+
| Module | Pi Agent Platform target | Lý do |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| Risk lane | `riskLane` + profile `hardGates` | Chặn auth, release, provider config, destructive action, database migration. |
|
|
26
|
+
| Intake | `piagent_task_start` | Mỗi task có scope, output, acceptance criteria trước khi edit. |
|
|
27
|
+
| Context rules | `/onboard-project`, `.pi/project-context.md`, `requiredContext`, context manifest | Giảm token và tránh đọc toàn repo. |
|
|
28
|
+
| Test matrix | `verifyCommands` + observed verify evidence | DONE phải có exact verify command thực chạy qua Pi bash hoặc `N/A` rõ lý do. |
|
|
29
|
+
| Trace | `piagent_trace_record`, `.pi/piagent-state/traces.jsonl`, session entry | Có audit trail cho task. |
|
|
30
|
+
| Protected paths | `protectedPaths` trong profile + extension guard | Mỗi project có vùng cấm riêng. |
|
|
31
|
+
| Tool registry | `mcpCapabilities` + `.mcp.json` | Không tự đoán tool/MCP. |
|
|
32
|
+
| Domain contract | Project docs/profile | Chỉ project cần UX/form/data strict mới bật. |
|
|
33
|
+
|
|
34
|
+
## Không đưa vào core
|
|
35
|
+
|
|
36
|
+
| Không đưa vào core | Lý do |
|
|
37
|
+
|---|---|
|
|
38
|
+
| Project-specific DB/state | Không portable giữa project. |
|
|
39
|
+
| Project-specific story IDs | Mỗi team cần namespace riêng. |
|
|
40
|
+
| Project-specific FE/BE rules | Làm core bị khóa vào một repo. |
|
|
41
|
+
| Toàn bộ skill library của một máy local | Gây collision và context bloat. |
|
|
42
|
+
| Prompt dài cho mọi trường hợp | Nên dùng lifecycle + profile + context manifest. |
|
|
43
|
+
|
|
44
|
+
## Workflow prompts
|
|
45
|
+
|
|
46
|
+
- `/platform-improve`: update package/platform behavior.
|
|
47
|
+
- `/be-to-fe`: scout backend/spec read-only, create contract snapshot, implement frontend only.
|
|
48
|
+
- `/task`: governed implementation lifecycle.
|
|
49
|
+
- `/plan`: create implementation plan.
|
|
50
|
+
- `/discuss`: clarify before work.
|
|
51
|
+
- `/review`: review diff/source with evidence.
|
|
52
|
+
|
|
53
|
+
## Task lifecycle chuẩn
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
1. Intake
|
|
57
|
+
- risk lane
|
|
58
|
+
- expected output
|
|
59
|
+
- acceptance criteria
|
|
60
|
+
- out of scope
|
|
61
|
+
- protected paths
|
|
62
|
+
|
|
63
|
+
2. Context
|
|
64
|
+
- load piagent_context
|
|
65
|
+
- read `.pi/project-context.md`
|
|
66
|
+
- read requiredContext
|
|
67
|
+
- check large files with piagent_context_budget
|
|
68
|
+
- record context manifest
|
|
69
|
+
|
|
70
|
+
3. Plan
|
|
71
|
+
- exact touchpoints
|
|
72
|
+
- verify command
|
|
73
|
+
- rollback/handoff if high-risk
|
|
74
|
+
|
|
75
|
+
4. Implement
|
|
76
|
+
- check risky shell with piagent_exec_policy_check
|
|
77
|
+
- check non-piagent tools with piagent_tool_policy_check
|
|
78
|
+
- edit only in scope
|
|
79
|
+
- avoid protected paths
|
|
80
|
+
|
|
81
|
+
5. Verify
|
|
82
|
+
- run exact mapped verify command
|
|
83
|
+
- store evidence
|
|
84
|
+
- if verify unavailable: not DONE
|
|
85
|
+
|
|
86
|
+
6. Trace
|
|
87
|
+
- changed files
|
|
88
|
+
- commands
|
|
89
|
+
- result
|
|
90
|
+
- friction
|
|
91
|
+
- next step
|
|
92
|
+
- piagent_task_gate_check before DONE
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Maturity phases
|
|
96
|
+
|
|
97
|
+
| Phase | Output | Đủ để implement task? |
|
|
98
|
+
|---|---|---|
|
|
99
|
+
| P0 | package core + profile + docs + protected path guard | Chỉ đủ pilot/read-only. |
|
|
100
|
+
| P1 | schema + task contract + doctor + verify-local + lean prompts | Dùng được cho task nhỏ có review. |
|
|
101
|
+
| P2 | extension tools for task/context/verify/trace + session entries | Dùng được cho source task có guard rõ. |
|
|
102
|
+
| P3 | exec policy + context budget + tool registry + task gate + benchmark recorder | Dùng được cho guarded project workflows. |
|
|
103
|
+
| P4 | stronger worktree/sandbox/team governance | Cần project-specific dry run trước khi làm default. |
|
|
104
|
+
|
|
105
|
+
## Chuẩn DONE
|
|
106
|
+
|
|
107
|
+
Một Pi task chỉ DONE khi có đủ:
|
|
108
|
+
|
|
109
|
+
- profile loaded;
|
|
110
|
+
- lane classified;
|
|
111
|
+
- protected paths known;
|
|
112
|
+
- context manifest exists;
|
|
113
|
+
- plan exists for source write;
|
|
114
|
+
- changed files listed;
|
|
115
|
+
- exact verify command ran and passed, hoặc explicitly `N/A` với reason;
|
|
116
|
+
- trace/handoff recorded;
|
|
117
|
+
- no secrets touched;
|
|
118
|
+
- no protected path writes.
|