@piagent/platform 1.2.5 → 1.2.7
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/CHANGELOG.md +34 -0
- package/README.md +3 -2
- package/catalog/capabilities.json +4 -4
- package/docs/command-reference-vietnamese.md +9 -8
- package/docs/context-engine.md +177 -0
- package/docs/context-window-policy.md +13 -8
- package/docs/distribution-standard.md +7 -7
- package/docs/operator-manual-vietnamese.md +7 -7
- package/docs/publishing-for-teams.md +5 -0
- package/docs/quality-benchmark.md +14 -1
- package/docs/release-install-policy.md +7 -7
- package/docs/runtime-harness-standard.md +16 -7
- package/docs/security-threat-model.md +1 -1
- package/docs/subagents-and-multiagent.md +1 -1
- package/docs/task-lifecycle-vietnamese.md +4 -4
- package/docs/team-onboarding.md +2 -2
- package/docs/usage-observability.md +6 -0
- package/docs-site/architecture.html +4 -3
- package/docs-site/commands.html +2 -1
- package/docs-site/content/context-engine.html +47 -0
- package/docs-site/context-engine.html +171 -0
- package/docs-site/index.html +2 -1
- package/docs-site/mcp-approval.html +2 -1
- package/docs-site/mcp-auth.html +2 -1
- package/docs-site/mcp-servers.html +2 -1
- package/docs-site/mcp.html +2 -1
- package/docs-site/permissions.html +2 -1
- package/docs-site/profiles.html +2 -1
- package/docs-site/quickstart.html +2 -1
- package/docs-site/runtime.html +4 -3
- package/docs-site/scope.html +2 -1
- package/docs-site/security.html +2 -1
- package/docs-site/team.html +2 -1
- package/docs-site/workflows.html +2 -1
- package/package.json +3 -2
- package/packages/piagent-core/README.md +8 -2
- package/packages/piagent-core/capabilities/capability-core.js +4 -0
- package/packages/piagent-core/extensions/context-engine.js +1175 -0
- package/packages/piagent-core/extensions/piagent-guard.ts +785 -17
- package/packages/piagent-core/package.json +1 -1
- package/packages/piagent-core/policies/base-policy.json +2 -0
- package/packages/piagent-core/prompts/scout.md +10 -24
- package/packages/piagent-core/prompts/task.md +25 -45
- package/scripts/audit-runtime-host.sh +3 -3
- package/scripts/build-docs-site.mjs +6 -0
- package/scripts/check-runtime-advisories.mjs +4 -3
- package/scripts/context-engine.mjs +115 -0
- package/scripts/install-global.sh +68 -13
- package/scripts/piagent-cli.mjs +2 -1
- package/scripts/quality-benchmark.sh +71 -1
- package/scripts/setup.sh +5 -3
- package/scripts/team-doctor.sh +2 -2
- package/scripts/verify-local.sh +12 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,40 @@
|
|
|
2
2
|
|
|
3
3
|
This file records release-facing changes for Pi Agent Platform. Copy the relevant version block into GitHub Releases when publishing a tag.
|
|
4
4
|
|
|
5
|
+
## v1.2.7 - 2026-07-31
|
|
6
|
+
|
|
7
|
+
### Security
|
|
8
|
+
|
|
9
|
+
- Updated the pinned MCP and subagent add-ons to `pi-mcp-adapter@2.15.0` and `pi-subagents@0.38.0`. Their resolved runtime tree uses patched `fast-uri@3.1.4`, `@hono/node-server@2.0.12`, and MCP SDK `1.30.0`; a clean resolution reports no add-on advisories.
|
|
10
|
+
|
|
11
|
+
- Raised the runtime release gate from high/critical to moderate/high/critical. The only remaining accepted finding is the separately documented `brace-expansion` denial of service pinned inside Pi host `0.82.0`.
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- Global install/update now removes older registrations for platform-owned MCP and subagent add-ons before installing their reviewed exact versions. This forces npm to refresh stale transitive dependencies instead of retaining a vulnerable version from an older shared Pi package lock.
|
|
16
|
+
|
|
17
|
+
- An existing `pi-subagents` installation is detected and upgraded during a normal platform update. Clean machines still require `--with-subagents`, and `--no-subagents` remains an explicit opt-out.
|
|
18
|
+
|
|
19
|
+
## v1.2.6 - 2026-07-31
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- Added Pi Context Engine v2: a local incremental SQLite FTS5 index with symbol and import extraction, hybrid Reciprocal Rank Fusion and personalized PageRank retrieval, hard-budget context packs, reverse-import test impact, and the `piagent-context` terminal command.
|
|
24
|
+
|
|
25
|
+
- Added Agent Watch compatible context telemetry keyed by Pi session ID and session name. It records model/thinking metadata, active tool counts, usage, retrieval confidence, context-pack utilization, duplicate reads/output, and transparent context-waste metrics without duplicating raw prompts or tool output.
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- Piagent now starts with a one-tool loader and activates governance, policy, code retrieval, knowledge, onboarding, and usage groups by task shape. Tiny tasks expose 11 of 30 Piagent tools and ordinary tasks expose 15, while runtime guards remain active regardless of the visible tool schema.
|
|
30
|
+
|
|
31
|
+
- Task and scout workflows are risk-adaptive. Unfamiliar work receives one bounded Context Engine pack, low-confidence retrieval permits at most one read-only finder pass, repeated read/search results collapse to a delta marker, and session compaction preserves task state instead of raw logs.
|
|
32
|
+
|
|
33
|
+
- Quality benchmarks now record fresh input, output and cache-read tokens, first-correct-edit time, rework count, and a context-efficiency snapshot so token savings are compared against acceptance and verification quality.
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
|
|
37
|
+
- Release installation now removes an older local `@piagent/platform` registration as well as older Git registrations before installing the pinned release, preventing the local checkout and released package from loading together.
|
|
38
|
+
|
|
5
39
|
## v1.2.5 - 2026-07-30
|
|
6
40
|
|
|
7
41
|
### Fixed
|
package/README.md
CHANGED
|
@@ -74,7 +74,7 @@ Removal targets what is registered in Pi's settings rather than what the current
|
|
|
74
74
|
- Runtime profile selection via `/profile`, plus select-style tech stack setup via `/profile setup` and `/profile tech`.
|
|
75
75
|
- Runtime usage/session controls via `/usage`, `/name`, `/fresh`, plus Pi native `/session`.
|
|
76
76
|
- Explicit project memory via `/memory` or `/memory-policy` and `piagent_memory_*` tools.
|
|
77
|
-
-
|
|
77
|
+
- Local Context Engine controls via `/context`: incremental code index, hybrid search, token-budgeted packs, test impact, efficiency telemetry, and semantic compaction. Results remain advisory, not a security boundary or source of truth.
|
|
78
78
|
- MCP setup helpers for Context7, Chrome DevTools, GitHub, Playwright, and Figma.
|
|
79
79
|
- Subagent setup helpers for read-only scouting, planning, implementation, review, and risk challenge.
|
|
80
80
|
- Chat image-path intake: paste a local screenshot path into the Pi chat box and the guard attaches it as `[image1]` before the model sees the prompt.
|
|
@@ -261,6 +261,7 @@ This repository intentionally excludes:
|
|
|
261
261
|
- [Operator manual tiếng Việt](docs/operator-manual-vietnamese.md)
|
|
262
262
|
- [Quickstart tiếng Việt](docs/quickstart-vietnamese.md)
|
|
263
263
|
- [Command reference tiếng Việt](docs/command-reference-vietnamese.md)
|
|
264
|
+
- [Pi Context Engine](docs/context-engine.md)
|
|
264
265
|
- [Team onboarding](docs/team-onboarding.md)
|
|
265
266
|
- [Project onboarding](docs/project-onboarding.md)
|
|
266
267
|
- [Workflow recipes](docs/workflow-recipes.md)
|
|
@@ -290,7 +291,7 @@ This repository intentionally excludes:
|
|
|
290
291
|
|
|
291
292
|
## Maturity
|
|
292
293
|
|
|
293
|
-
The current package version is read from package metadata and release tags. Personal machines may follow the unpinned package source when accepting ongoing updates; production/team quickstarts and committed project settings should pin an explicit tag such as `v1.2.
|
|
294
|
+
The current package version is read from package metadata and release tags. Personal machines may follow the unpinned package source when accepting ongoing updates; production/team quickstarts and committed project settings should pin an explicit tag such as `v1.2.7` or a reviewed commit.
|
|
294
295
|
|
|
295
296
|
Ready for:
|
|
296
297
|
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"path": "evals/scenarios/capability-resolution.json"
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
|
-
"byteSize":
|
|
30
|
-
"digest": "sha256:
|
|
29
|
+
"byteSize": 6201,
|
|
30
|
+
"digest": "sha256:35398d414c6fd57f63c81990881410ad4286074c2c63fbf53a808b6cfb27b343",
|
|
31
31
|
"id": "base-policy",
|
|
32
32
|
"kind": "policies",
|
|
33
33
|
"path": "packages/piagent-core/policies/base-policy.json"
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"path": "packages/piagent-core/prompts/review.md"
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
|
-
"byteSize":
|
|
65
|
-
"digest": "sha256:
|
|
64
|
+
"byteSize": 3452,
|
|
65
|
+
"digest": "sha256:d06f189c7cf6484cc60d79c200e85ff60f543651264b9233cb23686145cc35d8",
|
|
66
66
|
"id": "task",
|
|
67
67
|
"kind": "prompts",
|
|
68
68
|
"path": "packages/piagent-core/prompts/task.md"
|
|
@@ -37,8 +37,8 @@ Command ngắn của PiAgent dùng cho workflow và guard local:
|
|
|
37
37
|
|---|---|
|
|
38
38
|
| `/commands` | Menu/help command, không gọi model. |
|
|
39
39
|
| `/workflow` | Launcher task/scout/plan/review/git/onboard. |
|
|
40
|
-
| `/usage` | Usage live/history/preflight/compact/logs. |
|
|
41
|
-
| `/context` |
|
|
40
|
+
| `/usage` | Usage live/history/preflight/compact/logs/efficiency. |
|
|
41
|
+
| `/context` | Smart index/rebuild/search/pack/impact/efficiency/preflight/compact. |
|
|
42
42
|
| `/permission` | Permission mode của session. |
|
|
43
43
|
| `/profile` | Profile và tech stack. |
|
|
44
44
|
| `/memory` | Project memory policy. |
|
|
@@ -65,6 +65,7 @@ Trong Pi:
|
|
|
65
65
|
/commands
|
|
66
66
|
/onboard
|
|
67
67
|
/context index
|
|
68
|
+
/context rebuild
|
|
68
69
|
/memory
|
|
69
70
|
```
|
|
70
71
|
|
|
@@ -107,10 +108,10 @@ Nếu task còn mơ hồ:
|
|
|
107
108
|
Pi Agent dùng ít namespace nhưng mỗi namespace có subcommand/menu rõ:
|
|
108
109
|
|
|
109
110
|
- `/workflow` là cửa chính cho task/scout/review/git/onboard workflow. Workflow cần agent turn là cố ý và được nói rõ.
|
|
110
|
-
- `/usage` gom live usage, history/report hint, preflight, compact, logs.
|
|
111
|
+
- `/usage` gom live usage, history/report hint, preflight, compact, logs, efficiency.
|
|
111
112
|
- `/name` đặt tên session theo task để Agent Watch/report map đúng việc.
|
|
112
113
|
- `/fresh` mở session mới cho `task`, `scout`, hoặc `be-to-fe` khi phiên hiện tại đã nặng.
|
|
113
|
-
- `/context` gom
|
|
114
|
+
- `/context` gom architecture map, code index, search, context pack, test impact, efficiency, preflight và semantic compact.
|
|
114
115
|
- `/permission` gom permission status/read-only/workspace-write/full-access.
|
|
115
116
|
- `/profile` là namespace duy nhất cho profile và tech stack.
|
|
116
117
|
- `/commands` là runtime help/menu, không còn bắt agent đọc docs để giải thích.
|
|
@@ -137,10 +138,10 @@ Các command này đến từ package `piagent-core`.
|
|
|
137
138
|
| `/onboard` | First-run setup/status. | Mở menu onboarding: status, run, profile, setup. |
|
|
138
139
|
| `/profile` | Xem/áp profile và chọn tech. | Chạy ngay, không gọi model. |
|
|
139
140
|
| `/profile setup` | Chọn profile + tech bằng option. | Ghi profile/lock/tech manifest. |
|
|
140
|
-
| `/usage` | Xem live usage hoặc report hint. | Menu live/history/preflight/compact/logs. |
|
|
141
|
+
| `/usage` | Xem live usage hoặc report hint. | Menu live/history/preflight/compact/logs/efficiency. |
|
|
141
142
|
| `/name <name>` | Đặt tên session theo task. | Agent Watch/report map đúng task. |
|
|
142
143
|
| `/fresh task|scout|be-to-fe <request>` | Phiên hiện tại đã nặng hoặc muốn tách việc. | Mở session mới có tên và replay workflow prompt gọn. |
|
|
143
|
-
| `/context` | Xem
|
|
144
|
+
| `/context` | Xem index/search/pack/impact/efficiency/preflight/compact. | Menu context, không gọi model. |
|
|
144
145
|
| `/permission` | Xem/đổi quyền runtime. | Menu status/read-only/workspace-write/full-access. |
|
|
145
146
|
| `/memory` hoặc `/memory-policy` | Xem memory policy. | Chạy ngay, không gọi model. |
|
|
146
147
|
| `/model-options` | Xem hướng dẫn model/thinking. | Chạy ngay; chọn model vẫn dùng `/model` hoặc `Ctrl+L`. |
|
|
@@ -464,8 +465,8 @@ Các lệnh này chạy ngoài Pi.
|
|
|
464
465
|
| Command | Dùng khi nào |
|
|
465
466
|
|---|---|
|
|
466
467
|
| `npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.82.0` | Cài Pi CLI tương thích với release hiện tại. |
|
|
467
|
-
| `npm install -g --ignore-scripts @piagent/platform@1.2.
|
|
468
|
-
| `pi install git:github.com/Vt-mmm/piagent@v1.2.
|
|
468
|
+
| `npm install -g --ignore-scripts @piagent/platform@1.2.7` | Cài terminal helper `piagent-*` từ release tag hiện tại. |
|
|
469
|
+
| `pi install git:github.com/Vt-mmm/piagent@v1.2.7` | Cài pinned release khi cần reproducible team setup. |
|
|
469
470
|
| `pi install git:github.com/Vt-mmm/piagent` | Cài latest package platform cho máy cá nhân/sandbox. |
|
|
470
471
|
| `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ì. |
|
|
471
472
|
| `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. |
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# Pi Context Engine
|
|
2
|
+
|
|
3
|
+
## Mục tiêu
|
|
4
|
+
|
|
5
|
+
Pi Context Engine giảm token bằng cách giảm context nhiễu, không đổi model chính
|
|
6
|
+
và không hạ thinking level. Runtime chọn đúng tool, file, symbol và test trước khi
|
|
7
|
+
model bắt đầu scout rộng.
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
task
|
|
11
|
+
-> deterministic task signals
|
|
12
|
+
-> dynamic tool groups
|
|
13
|
+
-> explicit path + FTS5 + symbol/import graph + git/test signals
|
|
14
|
+
-> Reciprocal Rank Fusion + personalized PageRank
|
|
15
|
+
-> token-budgeted context pack
|
|
16
|
+
-> selected parent model
|
|
17
|
+
-> delta tool results + semantic compaction
|
|
18
|
+
-> local telemetry for Agent Watch
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## P0: runtime context controls
|
|
22
|
+
|
|
23
|
+
- Piagent tools được chia thành `governance`, `policy`, `retrieval`,
|
|
24
|
+
`knowledge`, `onboarding`, và `usage`. Code retrieval không tự kéo theo
|
|
25
|
+
memory, document intake, source checkout hoặc orchestration.
|
|
26
|
+
- Session bắt đầu với loader nhỏ. Input hook bật nhóm cần cho task trước khi
|
|
27
|
+
system prompt được tạo.
|
|
28
|
+
- `piagent_tools` chỉ mở thêm nhóm được yêu cầu; runtime guard vẫn chạy kể cả
|
|
29
|
+
khi policy tool không hiện với model.
|
|
30
|
+
- Tool order cố định để giữ prompt prefix ổn định cho provider có prompt cache.
|
|
31
|
+
- Read/grep/find/ls lặp lại với cùng input và cùng output trả delta marker thay
|
|
32
|
+
vì chèn lại toàn bộ kết quả.
|
|
33
|
+
- Telemetry không lưu prompt hoặc tool output thô. Nó lưu hash, kích thước, tool,
|
|
34
|
+
model, thinking, active-tool count, usage, retrieval confidence và đường dẫn
|
|
35
|
+
tương đối đã được guard redaction.
|
|
36
|
+
|
|
37
|
+
Rollback flags:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
PIAGENT_DYNAMIC_TOOLS=off pi
|
|
41
|
+
PIAGENT_AUTO_CONTEXT=off pi
|
|
42
|
+
PIAGENT_CONTEXT_TELEMETRY=off pi
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## P1: code index và retrieval
|
|
46
|
+
|
|
47
|
+
Index nằm tại:
|
|
48
|
+
|
|
49
|
+
```text
|
|
50
|
+
.pi/piagent-state/context-engine/context-v2.sqlite
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Nó dùng SQLite FTS5 có sẵn trong Node.js `>=22.19.0`, không cần native package
|
|
54
|
+
hoặc install script. File được nhận diện bằng SHA-256; lần refresh sau tái sử
|
|
55
|
+
dụng record có `mtime` và size không đổi. `.gitignore`, binary, file quá lớn,
|
|
56
|
+
secret file, protected paths, dependency/build output và toàn bộ guard state
|
|
57
|
+
không được index.
|
|
58
|
+
|
|
59
|
+
Symbol layer hiện dùng parser adapter zero-dependency cho TypeScript/JavaScript,
|
|
60
|
+
Python, Go, Rust, Java/Kotlin/C#, C/C++, Swift, Dart, Ruby, PHP, Elixir, Lua,
|
|
61
|
+
SQL và Markdown. Schema parser-neutral để có thể thêm Tree-sitter sau này mà
|
|
62
|
+
không migrate consumer. Tree-sitter không phải dependency mặc định vì native
|
|
63
|
+
grammar size và install reliability phải thắng benchmark trước khi rollout.
|
|
64
|
+
|
|
65
|
+
Candidate ranking gồm:
|
|
66
|
+
|
|
67
|
+
1. Explicit path/basename.
|
|
68
|
+
2. FTS5 BM25 lexical match.
|
|
69
|
+
3. Exact và partial symbol match.
|
|
70
|
+
4. Current Git changes.
|
|
71
|
+
5. Test filename/path relation.
|
|
72
|
+
6. Positive-only session feedback.
|
|
73
|
+
7. Personalized PageRank trên import graph.
|
|
74
|
+
|
|
75
|
+
Các ranked list được hợp nhất bằng Reciprocal Rank Fusion:
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
score(file) = sum(weight(source) / (60 + rank(source, file)))
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Context pack tách repo map và source snippets, sau đó dừng cứng tại token
|
|
82
|
+
budget. Index chỉ là navigation evidence; model phải đọc file hiện tại trước
|
|
83
|
+
khi edit.
|
|
84
|
+
|
|
85
|
+
## P2: compaction, finder và test impact
|
|
86
|
+
|
|
87
|
+
- `/context impact` đi ngược import graph từ file thay đổi và tìm test liên quan.
|
|
88
|
+
- Context pack trả `high`, `medium`, `low`, hoặc `none` confidence.
|
|
89
|
+
- Với `low/none`, runtime đề xuất đúng một bounded read-only finder pass, không
|
|
90
|
+
tự spawn và không tự đổi model.
|
|
91
|
+
- `/context compact` giữ goal, acceptance criteria, quyết định, invariant,
|
|
92
|
+
changed files, verify evidence, blocker và next action. Nó loại log thô,
|
|
93
|
+
repeated reads, kế hoạch đã bị thay thế và source excerpt có thể đọc lại.
|
|
94
|
+
|
|
95
|
+
## P3: Agent Watch telemetry và feedback
|
|
96
|
+
|
|
97
|
+
Event append-only nằm tại:
|
|
98
|
+
|
|
99
|
+
```text
|
|
100
|
+
.pi/piagent-state/context-engine/events.jsonl
|
|
101
|
+
.pi/piagent-state/context-engine/efficiency-report.json
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Mỗi event có:
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"schemaVersion": 1,
|
|
109
|
+
"source": "piagent",
|
|
110
|
+
"recordedAt": "ISO-8601",
|
|
111
|
+
"event": "agent_prompt | tool_activation | context_pack | tool_call | tool_result | turn_end | session_compact",
|
|
112
|
+
"sessionId": "Pi session id",
|
|
113
|
+
"sessionName": "operator session name",
|
|
114
|
+
"model": "provider/model",
|
|
115
|
+
"thinkingLevel": "off|minimal|low|medium|high|xhigh"
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Agent Watch có thể join event với Pi session JSONL bằng `sessionId` và
|
|
120
|
+
`sessionName`. Không cần polling realtime; import lúc mở app hoặc lúc xuất
|
|
121
|
+
report vẫn thấy đủ event đã ghi.
|
|
122
|
+
|
|
123
|
+
Feedback không phải model học ngầm. Khi một context pack chọn file và chính
|
|
124
|
+
session đó sau đó thực sự đọc hoặc sửa file, file nhận một boost nhỏ ở những
|
|
125
|
+
lần retrieval sau. File chưa có lịch sử hoặc từng được chọn nhưng chưa dùng
|
|
126
|
+
không bị trừ điểm. `contextSelections`, `contextSelectionsUsed` và
|
|
127
|
+
`contextUtilizationRate` trong efficiency report cho phép audit hiệu quả của
|
|
128
|
+
ranking. Runtime chỉ đọc phần đuôi telemetry có giới hạn khi tính report hoặc
|
|
129
|
+
feedback, nên lịch sử dài không làm chậm từng prompt theo thời gian.
|
|
130
|
+
|
|
131
|
+
`contextWasteScore` nằm trong khoảng `0..100`, thấp hơn là tốt hơn:
|
|
132
|
+
|
|
133
|
+
```text
|
|
134
|
+
30% duplicate read rate
|
|
135
|
+
25% duplicate output rate
|
|
136
|
+
20% tool schema share
|
|
137
|
+
15% low-confidence retrieval rate
|
|
138
|
+
10% active-tool excess
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Đây là operational signal, không phải quality verdict. Report phải đối chiếu
|
|
142
|
+
với task gate, acceptance result, verify evidence, token usage và rework.
|
|
143
|
+
|
|
144
|
+
## Sử dụng
|
|
145
|
+
|
|
146
|
+
Trong Pi:
|
|
147
|
+
|
|
148
|
+
```text
|
|
149
|
+
/context index
|
|
150
|
+
/context rebuild
|
|
151
|
+
/context search <symbol or keyword>
|
|
152
|
+
/context pack <task>
|
|
153
|
+
/context impact [changed files]
|
|
154
|
+
/context efficiency
|
|
155
|
+
/usage efficiency
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Ngoài terminal, không chạy model:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
piagent-context status
|
|
162
|
+
piagent-context rebuild
|
|
163
|
+
piagent-context search calculateInvoiceTotal
|
|
164
|
+
piagent-context pack "Fix invoice total calculation" --tokens 4000
|
|
165
|
+
piagent-context impact src/invoice.ts
|
|
166
|
+
piagent-context efficiency
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Benchmark gate
|
|
170
|
+
|
|
171
|
+
So sánh cùng task, repository commit, model, thinking và verify command. Mỗi
|
|
172
|
+
variant chạy ít nhất ba lần. Chỉ bật mặc định khi:
|
|
173
|
+
|
|
174
|
+
- acceptance/pass rate không giảm;
|
|
175
|
+
- rework và failed verification không tăng;
|
|
176
|
+
- fresh input tokens, duplicate reads và time-to-first-correct-edit giảm;
|
|
177
|
+
- protected-path, secret-redaction và final-gate tests vẫn pass.
|
|
@@ -4,19 +4,20 @@
|
|
|
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 run` sau login/model selection để tạo `.pi/project-context.md
|
|
7
|
+
Lần đầu gắn project vào platform, chạy `/onboard run` sau login/model selection để tạo `.pi/project-context.md`, `.pi/context-index.json` và local Context Engine index. Các task sau dùng 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
|
|
|
11
11
|
1. `AGENTS.md` gần project nhất.
|
|
12
12
|
2. Project profile: `.pi/piagent-profile.json`.
|
|
13
|
-
3.
|
|
14
|
-
4. Project context
|
|
15
|
-
5.
|
|
16
|
-
6.
|
|
17
|
-
7.
|
|
18
|
-
8.
|
|
19
|
-
9.
|
|
13
|
+
3. Context Engine pack cho task unfamiliar/cross-module nếu index tồn tại và không stale.
|
|
14
|
+
4. Project context index: `.pi/context-index.json` nếu tồn tại và không stale.
|
|
15
|
+
5. Project context snapshot: `.pi/project-context.md`.
|
|
16
|
+
6. Memory summary nếu profile bật memory và task liên quan: `.pi/memory/memory_summary.md`.
|
|
17
|
+
7. Required context từ profile.
|
|
18
|
+
8. Task-specific files.
|
|
19
|
+
9. Related tests/docs.
|
|
20
|
+
10. External docs only khi cần và ưu tiên official docs.
|
|
20
21
|
|
|
21
22
|
Trước khi ghi context manifest hoặc dự định đưa file lớn vào prompt, dùng:
|
|
22
23
|
|
|
@@ -30,6 +31,7 @@ Trước task lớn/risk cao trong Pi TUI:
|
|
|
30
31
|
|
|
31
32
|
```text
|
|
32
33
|
/context preflight
|
|
34
|
+
/context pack <task>
|
|
33
35
|
/context compact
|
|
34
36
|
```
|
|
35
37
|
|
|
@@ -72,6 +74,8 @@ Pi settings template dùng:
|
|
|
72
74
|
- Không paste full mandatory-flow boilerplate vào task hằng ngày; platform prompts/tools đã chứa flow đó.
|
|
73
75
|
- Nếu context vượt budget, tạo summary theo module thay vì nhồi full files.
|
|
74
76
|
- 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.
|
|
77
|
+
- Dùng `/context rebuild` sau structural changes; incremental refresh tái sử dụng file không đổi.
|
|
78
|
+
- Context pack low-confidence chỉ được mở rộng bằng một bounded finder pass, không loop scout vô hạn.
|
|
75
79
|
- 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
80
|
- File context vượt hard cap phải được summarize hoặc đọc targeted slices, không inject full.
|
|
77
81
|
- 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.
|
|
@@ -79,6 +83,7 @@ Pi settings template dùng:
|
|
|
79
83
|
- 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.
|
|
80
84
|
- Memory chỉ là hint. Phải verify bằng source hiện tại trước khi sửa code.
|
|
81
85
|
- 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.
|
|
86
|
+
- Context Engine telemetry chỉ lưu operational metadata/hash dưới `.pi/piagent-state/`; prompt và tool output thô vẫn nằm trong Pi session/audit source hiện có.
|
|
82
87
|
|
|
83
88
|
## Nguồn
|
|
84
89
|
|
|
@@ -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.
|
|
17
|
+
| Team pinned release | `git:github.com/Vt-mmm/piagent@v1.2.7` |
|
|
18
18
|
| Personal/sandbox dev | `git:github.com/Vt-mmm/piagent` |
|
|
19
|
-
| Registry distribution | `npm:@piagent/platform@1.2.
|
|
19
|
+
| Registry distribution | `npm:@piagent/platform@1.2.7` |
|
|
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.
|
|
29
|
+
| `stable` | `bash scripts/install-global.sh --stable` | Helper release tag resolved to commit SHA, currently `v1.2.7` | 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.
|
|
56
|
+
pi install git:github.com/Vt-mmm/piagent@v1.2.7
|
|
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.
|
|
68
|
+
npm install -g --ignore-scripts @piagent/platform@1.2.7
|
|
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.
|
|
73
|
+
`pi install git:github.com/Vt-mmm/piagent@v1.2.7` 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.7`.
|
|
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
|
|
|
@@ -120,7 +120,7 @@ Nếu muốn commit sẵn `.pi/piagent-profile.json` vào repo hoặc bootstrap
|
|
|
120
120
|
```bash
|
|
121
121
|
bash scripts/setup.sh /path/to/project \
|
|
122
122
|
--profile be-readonly-fe \
|
|
123
|
-
--package-source git:github.com/Vt-mmm/piagent@v1.2.
|
|
123
|
+
--package-source git:github.com/Vt-mmm/piagent@v1.2.7 \
|
|
124
124
|
--mcp-preset core \
|
|
125
125
|
--subagents-preset safe
|
|
126
126
|
```
|
|
@@ -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.
|
|
21
|
+
npm install -g --ignore-scripts @piagent/platform@1.2.7
|
|
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.
|
|
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.7`. 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.
|
|
102
|
+
npm install -g --ignore-scripts @piagent/platform@1.2.7
|
|
103
103
|
piagent-install --stable --dry-run
|
|
104
104
|
piagent-install --stable
|
|
105
105
|
```
|
|
@@ -282,7 +282,7 @@ Không phải daily default. Dùng khi muốn tạo sẵn `.pi` files cho projec
|
|
|
282
282
|
bash /path/to/piagent/scripts/setup.sh /path/to/project \
|
|
283
283
|
--project-only \
|
|
284
284
|
--profile auto \
|
|
285
|
-
--package-source git:github.com/Vt-mmm/piagent@v1.2.
|
|
285
|
+
--package-source git:github.com/Vt-mmm/piagent@v1.2.7 \
|
|
286
286
|
--mcp-preset core \
|
|
287
287
|
--subagents-preset safe
|
|
288
288
|
```
|
|
@@ -894,8 +894,8 @@ Watchdog là optional adversarial reviewer ở cuối turn, không bật mặc
|
|
|
894
894
|
|
|
895
895
|
| Command | Dùng để |
|
|
896
896
|
|---|---|
|
|
897
|
-
| `npm install -g --ignore-scripts @piagent/platform@1.2.
|
|
898
|
-
| `pi install git:github.com/Vt-mmm/piagent@v1.2.
|
|
897
|
+
| `npm install -g --ignore-scripts @piagent/platform@1.2.7` | Cài terminal helper `piagent-*` từ release tag hiện tại. |
|
|
898
|
+
| `pi install git:github.com/Vt-mmm/piagent@v1.2.7` | Install pinned release cho reproducible team setup. |
|
|
899
899
|
| `pi install git:github.com/Vt-mmm/piagent` | Install latest platform package cho máy cá nhân/sandbox. |
|
|
900
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). |
|
|
901
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. |
|
|
@@ -1002,7 +1002,7 @@ Mở lại Pi session sau khi install.
|
|
|
1002
1002
|
Cài lại terminal helper đúng release rồi kiểm tra `PATH`:
|
|
1003
1003
|
|
|
1004
1004
|
```bash
|
|
1005
|
-
npm install -g --ignore-scripts @piagent/platform@1.2.
|
|
1005
|
+
npm install -g --ignore-scripts @piagent/platform@1.2.7
|
|
1006
1006
|
command -v piagent-install
|
|
1007
1007
|
```
|
|
1008
1008
|
|
|
@@ -55,6 +55,11 @@ pi install /path/to/piagent
|
|
|
55
55
|
- `1.2.0`: `piagent-mcp` quản lý server đầy đủ, server do repo mang theo phải được duyệt mới dùng được, và `/piagent-mcp` là command trong session chứ không phải nhờ model chạy bash.
|
|
56
56
|
- `1.2.1`: approval gate thật sự phủ direct tool và server đến qua `imports` — hai đường vòng mà bản `1.2.0` để hở; kèm một loạt fix về containment khi vendor, độ sâu shell guard, và credential trong URL.
|
|
57
57
|
- `1.2.2`: tool output dài được compact vào preview trong Pi và capture local cho Agent Watch/report; thêm `/setname` và `/logs` cho session naming và log audit gọn.
|
|
58
|
+
- `1.2.3`: gom command hằng ngày về `/workflow`, `/usage`, `/context`, `/permission`, `/onboard`, `/name` và `/fresh`.
|
|
59
|
+
- `1.2.4`: update global có fallback về user-writable npm prefix và project migration/doctor là bước hậu kiểm tùy chọn.
|
|
60
|
+
- `1.2.5`: updater đọc đúng metadata singleton-array của npm 12.
|
|
61
|
+
- `1.2.6`: Context Engine v2, dynamic tool loading, hard-budget retrieval, semantic compaction, Agent Watch telemetry/feedback và quality benchmark theo context efficiency.
|
|
62
|
+
- `1.2.7`: refresh exact MCP/subagent add-on pins, loại dependency URL/static-server có advisory và chặn cả moderate advisory trong runtime release gate.
|
|
58
63
|
|
|
59
64
|
## Không publish
|
|
60
65
|
|
|
@@ -41,7 +41,12 @@ bash scripts/quality-benchmark.sh /path/to/project --record \
|
|
|
41
41
|
--surface pi \
|
|
42
42
|
--result pass \
|
|
43
43
|
--tokens 8200 \
|
|
44
|
+
--input-tokens 6900 \
|
|
45
|
+
--output-tokens 1300 \
|
|
46
|
+
--cache-read-tokens 2400 \
|
|
44
47
|
--duration 540 \
|
|
48
|
+
--first-correct-edit 210 \
|
|
49
|
+
--rework 0 \
|
|
45
50
|
--notes "good plan, no edits"
|
|
46
51
|
```
|
|
47
52
|
|
|
@@ -58,8 +63,14 @@ Output:
|
|
|
58
63
|
| `result` | `pass`, `fail`, hoặc `partial` theo verify và acceptance criteria. |
|
|
59
64
|
| `surface` | Agent surface/workflow/model preset được dùng cho run. |
|
|
60
65
|
| `tokens` | Tổng token do runtime/provider báo. |
|
|
66
|
+
| `inputTokens` | Fresh input token, tách khỏi cache read để so context thực. |
|
|
67
|
+
| `outputTokens` | Token model sinh ra. |
|
|
68
|
+
| `cacheReadTokens` | Input được provider phục vụ từ prompt cache. |
|
|
61
69
|
| `cost` | Cost nếu provider báo được. |
|
|
62
70
|
| `durationSeconds` | Thời gian wall-clock. |
|
|
71
|
+
| `firstCorrectEditSeconds` | Thời gian tới edit đầu tiên còn tồn tại trong nghiệm cuối. |
|
|
72
|
+
| `reworkCount` | Số lượt edit bị bỏ hoặc phải làm lại. |
|
|
73
|
+
| `contextEfficiency` | Snapshot tool surface, duplicate read/output, retrieval utilization và context waste từ Pi Context Engine. |
|
|
63
74
|
| `notes` | Số lần sửa lại, missing context, wrong file, verify failure, hoặc quality observation. |
|
|
64
75
|
|
|
65
76
|
## Quy tắc claim
|
|
@@ -71,4 +82,6 @@ Chỉ claim một setup tốt hơn khi:
|
|
|
71
82
|
- cùng verify command;
|
|
72
83
|
- ít nhất 3 lần chạy hoặc 3 scenario khác nhau;
|
|
73
84
|
- pass rate không thấp hơn setup hiện tại;
|
|
74
|
-
- token/cost giảm mà không tăng manual rework
|
|
85
|
+
- fresh input token/cost giảm mà không tăng manual rework;
|
|
86
|
+
- time-to-first-correct-edit giảm hoặc không xấu đi;
|
|
87
|
+
- context waste giảm nhưng acceptance và verify vẫn giữ nguyên.
|
|
@@ -10,7 +10,7 @@ This file is the canonical install, update, rollback, and release checklist. Oth
|
|
|
10
10
|
|
|
11
11
|
All supported environments require Node.js `>=22.19.0` and Pi Coding Agent `0.82.0`. The Pi host is installed as a Node CLI; Pi Agent Platform still defines its own release matrix because the terminal helpers and shell policy rely on Bash/POSIX behavior.
|
|
12
12
|
|
|
13
|
-
| Surface | Status for v1.2.
|
|
13
|
+
| Surface | Status for v1.2.7 | Rollout guidance |
|
|
14
14
|
|---|---|---|
|
|
15
15
|
| macOS Apple Silicon (`darwin/arm64`) + Bash | Verified for this release. | Safe default for team rollout after normal project smoke tests. |
|
|
16
16
|
| Linux x64 + Bash | Verified in GitHub Actions. | Safe default for CI/server usage after normal project smoke tests. |
|
|
@@ -33,7 +33,7 @@ These three components are versioned independently. A full install, update, or r
|
|
|
33
33
|
|
|
34
34
|
| Channel | Source shape | Mutability | Use when |
|
|
35
35
|
|---|---|---:|---|
|
|
36
|
-
| `stable` | `git:github.com/Vt-mmm/piagent@<resolved-commit-sha>` from `v1.2.
|
|
36
|
+
| `stable` | `git:github.com/Vt-mmm/piagent@<resolved-commit-sha>` from `v1.2.7` | Fixed after resolution | Default for team rollout. |
|
|
37
37
|
| `exact` | Tag, reviewed commit, or a tag resolved with `--resolve-tag` | Fixed when using a commit SHA | Pi-package-only roll forward, rollback, or reproduction. |
|
|
38
38
|
| `dev` | `git:github.com/Vt-mmm/piagent` | Moving | Personal machine or sandbox only. |
|
|
39
39
|
| `local` | `/path/to/piagent` | Local workspace | Platform development and dry-run validation. |
|
|
@@ -53,7 +53,7 @@ Use this flow when the team needs both terminal commands and the Pi package:
|
|
|
53
53
|
```bash
|
|
54
54
|
node --version # >= 22.19.0
|
|
55
55
|
npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.82.0
|
|
56
|
-
npm install -g --ignore-scripts @piagent/platform@1.2.
|
|
56
|
+
npm install -g --ignore-scripts @piagent/platform@1.2.7
|
|
57
57
|
piagent-install --stable --dry-run
|
|
58
58
|
piagent-install --stable
|
|
59
59
|
```
|
|
@@ -61,8 +61,8 @@ piagent-install --stable
|
|
|
61
61
|
The stable preview and apply output includes:
|
|
62
62
|
|
|
63
63
|
```text
|
|
64
|
-
currentRelease: v1.2.
|
|
65
|
-
tag: v1.2.
|
|
64
|
+
currentRelease: v1.2.7 (helper package version)
|
|
65
|
+
tag: v1.2.7
|
|
66
66
|
resolvedCommit: <40-char-sha>
|
|
67
67
|
source: git:github.com/Vt-mmm/piagent@<40-char-sha>
|
|
68
68
|
```
|
|
@@ -79,7 +79,7 @@ bash scripts/install-global.sh --stable
|
|
|
79
79
|
Use this only when terminal commands are not needed:
|
|
80
80
|
|
|
81
81
|
```bash
|
|
82
|
-
pi install git:github.com/Vt-mmm/piagent@v1.2.
|
|
82
|
+
pi install git:github.com/Vt-mmm/piagent@v1.2.7
|
|
83
83
|
```
|
|
84
84
|
|
|
85
85
|
Direct `pi install` does not create `piagent-*` commands on `PATH`.
|
|
@@ -317,5 +317,5 @@ Re-running the workflow from a branch instead skips publishing, because the publ
|
|
|
317
317
|
- Do not use a moving source in committed project settings.
|
|
318
318
|
- Do not publish local trust files, OAuth tokens, `auth.json`, sessions, caches, or `.env` files.
|
|
319
319
|
- Review the resolved commit SHA before rollout; tag resolution improves reproducibility but is not signed package provenance by itself.
|
|
320
|
-
- `npm audit --audit-level=high` covers this repository's helper dependency tree. `npm run audit:runtime` separately builds
|
|
320
|
+
- `npm audit --audit-level=high` covers this repository's helper dependency tree. `npm run audit:runtime` separately builds the exact optional Pi host and pinned add-on dependency tree and blocks unaccepted moderate, high, or critical findings so stale or permissive peer resolution cannot hide deployed runtime risk.
|
|
321
321
|
- Run doctor after install, update, or rollback so package source, project profile, protected paths, and share policy are checked together.
|
|
@@ -24,7 +24,7 @@ Project cụ thể chỉ cần adapter/profile riêng. Core package giữ lifecy
|
|
|
24
24
|
|---|---|---|
|
|
25
25
|
| Risk lane | `riskLane` + profile `hardGates` | Chặn auth, release, provider config, destructive action, database migration. |
|
|
26
26
|
| Intake | `piagent_task_start` | Mỗi task có scope, output, acceptance criteria trước khi edit. |
|
|
27
|
-
| Context rules | `/onboard run`, `.pi/project-context.md`, `requiredContext`, context manifest | Giảm token và tránh đọc toàn repo. |
|
|
27
|
+
| Context rules | `/onboard run`, Pi Context Engine, `.pi/project-context.md`, `requiredContext`, context manifest | Giảm token và tránh đọc toàn repo. |
|
|
28
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
29
|
| Trace | `piagent_trace_record`, `.pi/piagent-state/traces.jsonl`, session entry | Có audit trail cho task. |
|
|
30
30
|
| Protected paths | `protectedPaths` trong profile + extension guard | Mỗi project có vùng cấm riêng. |
|
|
@@ -52,6 +52,9 @@ Project cụ thể chỉ cần adapter/profile riêng. Core package giữ lifecy
|
|
|
52
52
|
|
|
53
53
|
## Task lifecycle chuẩn
|
|
54
54
|
|
|
55
|
+
Vòng đời thích nghi theo mức rủi ro. Runtime guard luôn hoạt động, nhưng các
|
|
56
|
+
tool context mang tính advisory chỉ được nạp khi task thực sự cần.
|
|
57
|
+
|
|
55
58
|
```text
|
|
56
59
|
1. Intake
|
|
57
60
|
- risk lane
|
|
@@ -61,10 +64,10 @@ Project cụ thể chỉ cần adapter/profile riêng. Core package giữ lifecy
|
|
|
61
64
|
- protected paths
|
|
62
65
|
|
|
63
66
|
2. Context
|
|
64
|
-
- load piagent_context
|
|
65
|
-
-
|
|
66
|
-
- read requiredContext
|
|
67
|
-
- check large files with piagent_context_budget
|
|
67
|
+
- load concise piagent_context once
|
|
68
|
+
- use one token-budgeted Context Engine pack for unfamiliar/cross-module work
|
|
69
|
+
- read only targeted requiredContext
|
|
70
|
+
- check only large/unfamiliar files with piagent_context_budget
|
|
68
71
|
- record context manifest
|
|
69
72
|
|
|
70
73
|
3. Plan
|
|
@@ -73,8 +76,8 @@ Project cụ thể chỉ cần adapter/profile riêng. Core package giữ lifecy
|
|
|
73
76
|
- rollback/handoff if high-risk
|
|
74
77
|
|
|
75
78
|
4. Implement
|
|
76
|
-
- check risky shell with piagent_exec_policy_check
|
|
77
|
-
- check non-piagent tools
|
|
79
|
+
- check complex/risky shell with piagent_exec_policy_check
|
|
80
|
+
- check non-piagent tools only when capability is unclear
|
|
78
81
|
- edit only in scope
|
|
79
82
|
- avoid protected paths
|
|
80
83
|
|
|
@@ -92,6 +95,12 @@ Project cụ thể chỉ cần adapter/profile riêng. Core package giữ lifecy
|
|
|
92
95
|
- piagent_task_gate_check before DONE
|
|
93
96
|
```
|
|
94
97
|
|
|
98
|
+
| Lane | Extra context/orchestration |
|
|
99
|
+
|---|---|
|
|
100
|
+
| `tiny` | Core lifecycle only; parent agent, targeted reads, exact verify. |
|
|
101
|
+
| `normal` | Index/memory only for unfamiliar areas; bounded read-only delegation when it saves context. |
|
|
102
|
+
| `high-risk` | Relevant index/memory/vendor evidence plus explicit security/data/release review. |
|
|
103
|
+
|
|
95
104
|
## Maturity phases
|
|
96
105
|
|
|
97
106
|
| Phase | Output | Đủ để implement task? |
|