@piagent/platform 1.2.10 → 1.2.11
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 +137 -0
- package/README.md +27 -4
- package/adapters/backend-api/profile.json +1 -1
- package/adapters/be-readonly-fe/profile.json +2 -2
- package/adapters/data/profile.json +1 -1
- package/adapters/devops/profile.json +1 -3
- package/adapters/docs/profile.json +1 -1
- package/adapters/fullstack/profile.json +2 -4
- package/adapters/generic/profile.json +1 -1
- package/adapters/mobile/profile.json +1 -2
- package/adapters/node-typescript/profile.json +1 -3
- package/benchmarks/core-v1/suite.json +51 -0
- package/benchmarks/core-v1/tasks/discount-order/grade.mjs +17 -0
- package/benchmarks/core-v1/tasks/discount-order/project/package.json +8 -0
- package/benchmarks/core-v1/tasks/discount-order/project/src/discount.js +3 -0
- package/benchmarks/core-v1/tasks/discount-order/project/src/order.js +6 -0
- package/benchmarks/core-v1/tasks/discount-order/project/test/order.test.js +7 -0
- package/benchmarks/core-v1/tasks/discount-order/prompt.md +4 -0
- package/benchmarks/core-v1/tasks/invoice-quantity/grade.mjs +17 -0
- package/benchmarks/core-v1/tasks/invoice-quantity/project/package.json +8 -0
- package/benchmarks/core-v1/tasks/invoice-quantity/project/src/invoice.js +3 -0
- package/benchmarks/core-v1/tasks/invoice-quantity/project/test/invoice.test.js +7 -0
- package/benchmarks/core-v1/tasks/invoice-quantity/prompt.md +3 -0
- package/benchmarks/core-v1/tasks/protected-env-refusal/grade.mjs +11 -0
- package/benchmarks/core-v1/tasks/protected-env-refusal/project/README.md +4 -0
- package/benchmarks/core-v1/tasks/protected-env-refusal/project/package.json +8 -0
- package/benchmarks/core-v1/tasks/protected-env-refusal/project/test/smoke.test.js +4 -0
- package/benchmarks/core-v1/tasks/protected-env-refusal/prompt.md +4 -0
- package/benchmarks/core-v1/tasks/targeted-session/grade.mjs +14 -0
- package/benchmarks/core-v1/tasks/targeted-session/project/package.json +8 -0
- package/benchmarks/core-v1/tasks/targeted-session/project/src/auth/session.js +3 -0
- package/benchmarks/core-v1/tasks/targeted-session/project/src/billing/currency.js +3 -0
- package/benchmarks/core-v1/tasks/targeted-session/project/src/catalog/search.js +3 -0
- package/benchmarks/core-v1/tasks/targeted-session/project/src/notifications/channel.js +3 -0
- package/benchmarks/core-v1/tasks/targeted-session/project/src/search/tokenize.js +3 -0
- package/benchmarks/core-v1/tasks/targeted-session/project/test/session.test.js +7 -0
- package/benchmarks/core-v1/tasks/targeted-session/prompt.md +4 -0
- package/catalog/capabilities.json +10 -10
- package/docs/command-reference-vietnamese.md +10 -6
- package/docs/context-engine.md +33 -11
- package/docs/distribution-standard.md +11 -8
- package/docs/mcp-and-tools.md +13 -7
- package/docs/model-options.md +7 -10
- package/docs/operator-manual-vietnamese.md +82 -33
- package/docs/package-architecture-notes.md +3 -1
- package/docs/publishing-for-teams.md +4 -0
- package/docs/quality-benchmark.md +225 -58
- package/docs/quickstart-vietnamese.md +5 -0
- package/docs/release-install-policy.md +41 -7
- package/docs/runtime-harness-standard.md +47 -29
- package/docs/runtime-policy-design.md +23 -12
- package/docs/runtime-quality-baseline.md +31 -17
- package/docs/security-threat-model.md +1 -1
- package/docs/task-implementation-contract.md +113 -177
- package/docs/task-lifecycle-vietnamese.md +129 -125
- package/docs/team-onboarding.md +12 -4
- package/docs/usage-observability.md +15 -8
- package/docs-site/architecture.html +1 -1
- package/docs-site/commands.html +1 -1
- package/docs-site/content/runtime.html +10 -0
- package/docs-site/context-engine.html +1 -1
- package/docs-site/index.html +1 -1
- package/docs-site/mcp-approval.html +1 -1
- package/docs-site/mcp-auth.html +1 -1
- package/docs-site/mcp-servers.html +1 -1
- package/docs-site/mcp.html +1 -1
- package/docs-site/permissions.html +1 -1
- package/docs-site/profiles.html +1 -1
- package/docs-site/quickstart.html +1 -1
- package/docs-site/runtime.html +11 -1
- package/docs-site/scope.html +1 -1
- package/docs-site/security.html +1 -1
- package/docs-site/team.html +1 -1
- package/docs-site/workflows.html +1 -1
- package/evals/fixtures/task-contract.invalid.json +15 -1
- package/evals/fixtures/task-contract.valid.json +18 -2
- package/package.json +3 -2
- package/packages/piagent-core/README.md +37 -3
- package/packages/piagent-core/benchmark/benchmark-core.js +691 -0
- package/packages/piagent-core/extensions/context-engine.js +81 -57
- package/packages/piagent-core/extensions/guard-types.ts +35 -3
- package/packages/piagent-core/extensions/local-state-path.js +59 -0
- package/packages/piagent-core/extensions/piagent-guard.ts +1865 -171
- package/packages/piagent-core/extensions/policy-core.js +11 -1
- package/packages/piagent-core/extensions/runtime-evidence.js +39 -19
- package/packages/piagent-core/extensions/state-retention.js +218 -0
- package/packages/piagent-core/extensions/task-lifecycle.js +138 -0
- package/packages/piagent-core/extensions/task-state.js +630 -0
- package/packages/piagent-core/package.json +1 -1
- package/packages/piagent-core/policies/base-policy.json +1 -0
- package/packages/piagent-core/prompts/be-to-fe.md +14 -22
- package/packages/piagent-core/prompts/platform-improve.md +12 -17
- package/packages/piagent-core/prompts/review.md +7 -11
- package/packages/piagent-core/prompts/scout.md +6 -10
- package/packages/piagent-core/prompts/task.md +11 -17
- package/packages/piagent-core/skills/piagent-ops/SKILL.md +12 -15
- package/schemas/task-contract.schema.json +267 -104
- package/scripts/benchmark-runner.mjs +1172 -0
- package/scripts/install-global.sh +1 -1
- package/scripts/migrate-project-state.mjs +94 -3
- package/scripts/piagent-cli.mjs +1 -1
- package/scripts/update-global.mjs +36 -3
- package/scripts/verify-local.sh +15 -0
- package/templates/project/.pi/task-contract.template.json +19 -2
- package/templates/project/AGENTS.md +10 -20
|
@@ -133,7 +133,18 @@ Runtime behavior:
|
|
|
133
133
|
- yêu cầu observed passing verify khớp exact `task.verifyCommands` khi task có source changes;
|
|
134
134
|
- block `piagent_trace_record completed` nếu final gate đang enforce và proof chưa đủ.
|
|
135
135
|
|
|
136
|
-
Agent
|
|
136
|
+
Agent không phải gọi các tool evidence/trace/gate trong task thường. Hook
|
|
137
|
+
`tool_result` tự ghi targeted reads, changed files và exact verifier; hook
|
|
138
|
+
`message_end` dựng final contract, chạy gate rồi ghi terminal trace khi đủ proof.
|
|
139
|
+
Các tool thủ công vẫn tồn tại cho diagnostics/recovery và high-risk/custom plan.
|
|
140
|
+
|
|
141
|
+
Passing evidence còn phải khớp `workingTreeDigest` hiện tại. Bất kỳ mutation nào
|
|
142
|
+
sau verify làm evidence cũ stale. Việc chạm một file rồi revert về đúng digest
|
|
143
|
+
baseline chỉ được giữ trong audit history, không được tính là final source diff.
|
|
144
|
+
|
|
145
|
+
Automatic/assisted plan được phép một `followUp` correction turn khi projected
|
|
146
|
+
gate fail. Lượt này nhận đúng missing reasons, không tự lặp; rollback bằng
|
|
147
|
+
`PIAGENT_AUTO_RECOVERY=off`.
|
|
137
148
|
|
|
138
149
|
`piagent_verify_record` không còn tin `exitCode` tự khai báo. Lệnh verify phải khớp một bash tool result đã quan sát sau `task.createdAt`, và claimed `exitCode` phải khớp trạng thái `isError` của Pi. Observed result được ghi vào `.pi/piagent-state/observed-bash.jsonl` để parent/subagent process có thể share evidence trong cùng project cwd.
|
|
139
150
|
|
|
@@ -158,7 +169,7 @@ Guard state tự bảo vệ:
|
|
|
158
169
|
- mọi text block trong `tool_result` và string leaf trong JSON-like `details` có thêm shared sensitive-data redaction; key như `password`, `token`, `credential` được dùng làm context phát hiện;
|
|
159
170
|
- `npm run benchmark:redaction` gate contextual recall, benign preservation, structured objects/arrays, và large-output correctness bằng synthetic data; opaque entropy không có credential context được báo riêng và không gate release;
|
|
160
171
|
- bash evidence chỉ giữ command text đã redact ở memory/disk; raw command hash vẫn dùng để exact-match verify evidence;
|
|
161
|
-
- `piagent_task_start`,
|
|
172
|
+
- `piagent_task_start`, lifecycle hooks và các recovery tools vẫn ghi state được qua internal extension path.
|
|
162
173
|
|
|
163
174
|
## 5. Local verification
|
|
164
175
|
|
|
@@ -188,34 +199,37 @@ pi list --approve
|
|
|
188
199
|
|
|
189
200
|
## 6. Quality benchmark
|
|
190
201
|
|
|
191
|
-
|
|
202
|
+
Automatic paired benchmark:
|
|
192
203
|
|
|
193
204
|
```bash
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
--scenario bounded-source-fix \
|
|
197
|
-
--surface pi \
|
|
198
|
-
--result pass \
|
|
199
|
-
--tokens 12345 \
|
|
200
|
-
--cost 0.12 \
|
|
201
|
-
--verify "npm test" \
|
|
202
|
-
--notes "verify passed; no manual correction"
|
|
205
|
+
piagent-benchmark --dry-run
|
|
206
|
+
piagent-benchmark
|
|
203
207
|
```
|
|
204
208
|
|
|
205
209
|
Output:
|
|
206
210
|
|
|
207
211
|
```text
|
|
208
|
-
|
|
209
|
-
|
|
212
|
+
~/.pi/agent/benchmarks/piagent/<run-id>/report.json
|
|
213
|
+
~/.pi/agent/benchmarks/piagent/<run-id>/report.html
|
|
214
|
+
~/.pi/agent/benchmarks/piagent/<run-id>/summary.txt
|
|
215
|
+
~/.pi/agent/benchmarks/piagent/<run-id>/runs.jsonl
|
|
210
216
|
```
|
|
211
217
|
|
|
212
|
-
|
|
218
|
+
Runner dùng clean Git fixture, hidden grader và exact Pi session usage. Piagent
|
|
219
|
+
fixture được init/onboard và build context trước measured run để benchmark task
|
|
220
|
+
steady-state; mọi context/index mutation sau Git baseline vẫn bị scope gate bắt.
|
|
221
|
+
Report tách hidden correctness khỏi scope/reliability, hiện usage của mọi run và
|
|
222
|
+
chỉ lưu histogram tên tool. Chỉ claim chất lượng/token/cost khi các paired run có:
|
|
213
223
|
|
|
214
224
|
- cùng task prompt/spec;
|
|
215
225
|
- cùng acceptance criteria;
|
|
216
226
|
- verify command rõ;
|
|
217
|
-
- token/cost/duration được ghi lại;
|
|
218
|
-
- quality
|
|
227
|
+
- token/cost/duration được runtime ghi lại;
|
|
228
|
+
- quality/reliability đạt ít nhất `9/10`, safety/workflow đạt `10/10`, quality
|
|
229
|
+
không giảm và ít nhất ba cặp cùng model có exact usage.
|
|
230
|
+
|
|
231
|
+
`piagent-benchmark <project> --record ...` vẫn route tới recorder cũ cho task
|
|
232
|
+
project-specific, nhưng không thay thế automatic release benchmark.
|
|
219
233
|
|
|
220
234
|
## Runtime policy trong profile
|
|
221
235
|
|
|
@@ -22,7 +22,7 @@ This document covers the packaged guard, project profiles, capability locks, ins
|
|
|
22
22
|
- The operator, operating-system account, Pi host, and explicitly trusted project repository are trusted to execute code.
|
|
23
23
|
- Project-local Pi resources are loaded only after Pi project trust or an explicit operator override.
|
|
24
24
|
- A human remains available to approve destructive and external-provider actions.
|
|
25
|
-
- Supported release verification covers macOS Apple Silicon + Bash, Linux x64 + Bash, Node.js `>=22.19.0`, and the exact Pi host version declared by the release. macOS Intel + Bash and Linux ARM64 + Bash are supported targets that need local smoke verification before broad rollout. Native Windows is not a team-rollout target for v1.2.
|
|
25
|
+
- Supported release verification covers macOS Apple Silicon + Bash, Linux x64 + Bash, Node.js `>=22.19.0`, and the exact Pi host version declared by the release. macOS Intel + Bash and Linux ARM64 + Bash are supported targets that need local smoke verification before broad rollout. Native Windows is not a team-rollout target for v1.2.11, and WSL2 is experimental/unverified.
|
|
26
26
|
- Registry, GitHub, model-provider, MCP-provider, and Vercel controls are external dependencies. Their account security and platform guarantees are not replaced by this repository.
|
|
27
27
|
|
|
28
28
|
## Threat actors and failure modes
|
|
@@ -1,200 +1,136 @@
|
|
|
1
|
-
# Task Implementation Contract
|
|
2
|
-
|
|
3
|
-
##
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
## Contract fields
|
|
8
|
-
|
|
9
|
-
| Field | Required | Ý nghĩa |
|
|
10
|
-
|---|---:|---|
|
|
11
|
-
| `taskId` | yes | ID ổn định cho task. |
|
|
12
|
-
| `summary` | yes | Một câu mô tả outcome. |
|
|
13
|
-
| `riskLane` | yes | `tiny`, `normal`, hoặc `high-risk`. |
|
|
14
|
-
| `expectedOutput` | yes | Artifact/behavior cụ thể. |
|
|
15
|
-
| `acceptanceCriteria` | yes | Điều kiện pass/fail. |
|
|
16
|
-
| `scope` | yes | File/module được phép đụng. |
|
|
17
|
-
| `outOfScope` | yes | Cái không làm. |
|
|
18
|
-
| `protectedPaths` | yes | Vùng cấm từ profile/policy. |
|
|
19
|
-
| `requiredContext` | yes | Context bắt buộc đọc. |
|
|
20
|
-
| `contextManifest` | yes | Bằng chứng context đã dùng. |
|
|
21
|
-
| `memoryCitations` | no | Memory file dùng làm advisory context, nếu có. |
|
|
22
|
-
| `mcpCapabilities` | no | Tool/MCP được phép. |
|
|
23
|
-
| `verifyCommands` | yes | Command phải chạy trước DONE. |
|
|
24
|
-
| `workPlan` | no | Task tree compact: step, role, mode, trạng thái, dependency. |
|
|
25
|
-
| `reviewLenses` | no | Góc review rõ ràng, mặc định `correctness`, `tests`, `scope`. |
|
|
26
|
-
| `orchestration` | no | Snapshot solo-first policy khi task bắt đầu: mode, subagent stance, Field Guide, model-role guidance. |
|
|
27
|
-
| `verifyEvidence` | yes before done | Observed command result. Passing gate requires exact match with `verifyCommands`. |
|
|
28
|
-
| `changedFiles` | yes before done | File đã sửa. |
|
|
29
|
-
| `trace` | yes before done | Handoff/audit record. |
|
|
30
|
-
|
|
31
|
-
## JSON example
|
|
32
|
-
|
|
33
|
-
```json
|
|
34
|
-
{
|
|
35
|
-
"taskId": "TASK-0001",
|
|
36
|
-
"summary": "Fix listing filter reset behavior",
|
|
37
|
-
"riskLane": "normal",
|
|
38
|
-
"expectedOutput": "Filter reset returns listing page to default query and preserves route owner.",
|
|
39
|
-
"acceptanceCriteria": [
|
|
40
|
-
"Reset button clears selected filters",
|
|
41
|
-
"URL query returns to canonical default",
|
|
42
|
-
"No protected paths are modified"
|
|
43
|
-
],
|
|
44
|
-
"scope": [
|
|
45
|
-
"src/features/listings/**"
|
|
46
|
-
],
|
|
47
|
-
"outOfScope": [
|
|
48
|
-
"backend API changes",
|
|
49
|
-
"database changes"
|
|
50
|
-
],
|
|
51
|
-
"protectedPaths": [
|
|
52
|
-
"backend/**"
|
|
53
|
-
],
|
|
54
|
-
"requiredContext": [
|
|
55
|
-
"AGENTS.md",
|
|
56
|
-
".pi/project-context.md",
|
|
57
|
-
"docs/frontend/structure-guide.md"
|
|
58
|
-
],
|
|
59
|
-
"contextManifest": [
|
|
60
|
-
{
|
|
61
|
-
"path": "AGENTS.md",
|
|
62
|
-
"reason": "root rules"
|
|
63
|
-
}
|
|
64
|
-
],
|
|
65
|
-
"memoryCitations": [],
|
|
66
|
-
"mcpCapabilities": [
|
|
67
|
-
"filesystem-readonly",
|
|
68
|
-
"browser"
|
|
69
|
-
],
|
|
70
|
-
"verifyCommands": [
|
|
71
|
-
"npm run test"
|
|
72
|
-
],
|
|
73
|
-
"workPlan": [
|
|
74
|
-
{
|
|
75
|
-
"id": "plan",
|
|
76
|
-
"title": "Confirm scope and verify gate before editing.",
|
|
77
|
-
"role": "parent",
|
|
78
|
-
"mode": "read-only",
|
|
79
|
-
"status": "done"
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
"id": "implement",
|
|
83
|
-
"title": "Apply the bounded source change.",
|
|
84
|
-
"role": "piagent-worker",
|
|
85
|
-
"mode": "single-writer",
|
|
86
|
-
"status": "pending",
|
|
87
|
-
"dependsOn": [
|
|
88
|
-
"plan"
|
|
89
|
-
]
|
|
90
|
-
}
|
|
91
|
-
],
|
|
92
|
-
"reviewLenses": [
|
|
93
|
-
"correctness",
|
|
94
|
-
"tests",
|
|
95
|
-
"scope"
|
|
96
|
-
],
|
|
97
|
-
"orchestration": {
|
|
98
|
-
"mode": "solo-first",
|
|
99
|
-
"subagents": "not-used",
|
|
100
|
-
"reason": "Task starts in solo-first mode; use bounded subagents only for independent scout, planning, or review work.",
|
|
101
|
-
"fieldGuidePath": ".pi/memory/MEMORY.md",
|
|
102
|
-
"modelRoles": {
|
|
103
|
-
"planner": "Use the strongest available model for decomposition, architecture, risk, and acceptance criteria.",
|
|
104
|
-
"worker": "Use the fastest reliable model for a bounded, already-planned single write set.",
|
|
105
|
-
"reviewer": "Use a model or thinking setting decorrelated from the worker when review quality matters.",
|
|
106
|
-
"watchdog": "Use a strong model only for final risk review, security, release, or high-impact changes."
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
"verifyEvidence": [
|
|
110
|
-
{
|
|
111
|
-
"command": "npm run test",
|
|
112
|
-
"exitCode": 0,
|
|
113
|
-
"summary": "Unit test suite passed.",
|
|
114
|
-
"observed": true,
|
|
115
|
-
"matchedProfileCommand": true
|
|
116
|
-
}
|
|
117
|
-
],
|
|
118
|
-
"changedFiles": [],
|
|
119
|
-
"trace": {
|
|
120
|
-
"outcome": "pending"
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
```
|
|
1
|
+
# Task Implementation Contract v2
|
|
2
|
+
|
|
3
|
+
## Muc tieu
|
|
4
|
+
|
|
5
|
+
Contract la state machine cuc bo giup Pi chung minh mot task da doc gi, duoc sua
|
|
6
|
+
gi, da thay doi gi, verify bang lenh nao va ket thuc ra sao. File nam tai:
|
|
124
7
|
|
|
125
|
-
|
|
8
|
+
```text
|
|
9
|
+
.pi/piagent-state/tasks/<taskRunId>.json
|
|
10
|
+
.pi/piagent-state/session-tasks/<session-id-hash>.json
|
|
11
|
+
```
|
|
126
12
|
|
|
127
|
-
|
|
13
|
+
`taskId` la ten logic cua cong viec. `taskRunId` la identity duy nhat cua mot
|
|
14
|
+
attempt. `sessionId` rang attempt vao dung Pi session; `sessionName` de resume va
|
|
15
|
+
Agent Watch/report hien ten task ma operator da dat.
|
|
16
|
+
|
|
17
|
+
## Field groups
|
|
18
|
+
|
|
19
|
+
| Nhom | Field | Quy tac |
|
|
20
|
+
|---|---|---|
|
|
21
|
+
| Schema | `schemaVersion` | Luon la `2`. |
|
|
22
|
+
| Identity | `taskRunId`, `taskId`, `sessionId`, `sessionName`, `intakeMode` | Run ID/Task ID normalized; mot session chi co mot task; intake la `runtime` hoac `model`. |
|
|
23
|
+
| Mode | `changeMode` | `source-change` hoac `read-only`. |
|
|
24
|
+
| Retry | `attempt`, `maxAttempts`, `previousAttempts` | Tran lay tu attempt dau, khong duoc nang o retry sau. |
|
|
25
|
+
| Intent | `summary`, `riskLane`, `expectedOutput`, `acceptanceCriteria` | Chot truoc khi implementation. |
|
|
26
|
+
| Scope | `scope`, `outOfScope`, `protectedPaths` | Direct write bi chan ngoai scope; final gate doi chieu Git. |
|
|
27
|
+
| Context | `requiredContext`, `contextManifest`, `memoryCitations`, `mcpCapabilities` | Citation co path va reason. |
|
|
28
|
+
| Verify | `verifyGroup`, `verifyCommands`, `verifyEvidence` | Moi command phai observed, exact-match va pass. |
|
|
29
|
+
| Plan | `workPlan`, `reviewLenses`, `orchestration` | Toi da 12 step, dependency DAG, single writer. |
|
|
30
|
+
| Changes | baseline/observed/final file lists va digests, `changedFiles` | Phan biet dirty truoc task voi thay doi trong task; ghi ca hai dau rename. |
|
|
31
|
+
| Outcome | `trace`, `failedAt`, `failureReason`, `ruledOut` | Terminal contract immutable. |
|
|
32
|
+
| Time | `createdAt`, `updatedAt` | Timestamp parseable, dung de sap xep/migration/report. |
|
|
33
|
+
|
|
34
|
+
Template day du nam tai
|
|
35
|
+
[`templates/project/.pi/task-contract.template.json`](../templates/project/.pi/task-contract.template.json).
|
|
36
|
+
Schema chinh thuc nam tai
|
|
37
|
+
[`schemas/task-contract.schema.json`](../schemas/task-contract.schema.json).
|
|
38
|
+
|
|
39
|
+
## Runtime lifecycle
|
|
128
40
|
|
|
129
41
|
```text
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
Check large context with piagent_context_budget.
|
|
137
|
-
Check complex/high-impact shell with piagent_exec_policy_check.
|
|
138
|
-
Check non-piagent tools with piagent_tool_policy_check.
|
|
139
|
-
Do not edit before scope + verify command are known.
|
|
140
|
-
Before final, run the exact verify command from task.verifyCommands through Pi bash, record observed verify evidence, and trace.
|
|
141
|
-
Call piagent_task_gate_check before DONE.
|
|
142
|
-
If verify cannot run, final outcome is blocked/partial, not done.
|
|
42
|
+
runtime automatic intake OR piagent_task_start fallback
|
|
43
|
+
-> ordinary targeted reads + project tool calls
|
|
44
|
+
-> runtime-observed context and changed files
|
|
45
|
+
-> exact bash verify commands
|
|
46
|
+
-> current-tree verify evidence from tool_result
|
|
47
|
+
-> completion hook projects trace + final gate
|
|
143
48
|
```
|
|
144
49
|
|
|
145
|
-
|
|
50
|
+
Bounded default source tasks are created and completed through runtime hooks
|
|
51
|
+
without model management calls. Broad/high-risk/custom source tasks use manual
|
|
52
|
+
intake and explicit checkpoints when required.
|
|
53
|
+
Read-only defaults use `scout`/`review`, never an implementation step. Manual
|
|
54
|
+
context/verify/trace/gate tools are recovery surfaces for custom/high-risk work.
|
|
55
|
+
|
|
56
|
+
Task start tu choi khi:
|
|
146
57
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
| Final gate | trace completion block khi `finalGate=enforce`; hard assistant stop-hook khi Pi API hỗ trợ | Cao nhất |
|
|
58
|
+
- session da thuoc task khac hoac task terminal;
|
|
59
|
+
- cung `taskId` dang pending o session khac;
|
|
60
|
+
- task da completed;
|
|
61
|
+
- retry vuot `maxAttempts`;
|
|
62
|
+
- source task khong o trong Git working tree;
|
|
63
|
+
- profile khong co meaningful verifier;
|
|
64
|
+
- work plan trung ID, thieu dependency, tu tham chieu hoac co cycle.
|
|
155
65
|
|
|
156
|
-
|
|
66
|
+
Truoc task start, governed project chi cho phep inspection. Guard chi coi shell la
|
|
67
|
+
mutation khi command that su co kha nang ghi project (write redirection, mutating
|
|
68
|
+
Git/package/file command, interpreter write, `sed -i`, `find -delete`...). Read,
|
|
69
|
+
search va test khong bi gan nham thanh write.
|
|
157
70
|
|
|
158
|
-
-
|
|
159
|
-
- `piagent_exec_policy_check`
|
|
160
|
-
- `piagent_context_budget`
|
|
161
|
-
- `piagent_context_index_status`
|
|
162
|
-
- `piagent_context_index_search`
|
|
163
|
-
- `piagent_context_index_record`
|
|
164
|
-
- `piagent_tool_policy_check`
|
|
165
|
-
- `piagent_context_record`
|
|
166
|
-
- `piagent_verify_record`
|
|
167
|
-
- `piagent_trace_record`
|
|
168
|
-
- `piagent_task_gate_check`
|
|
169
|
-
- local task/trace/observed-bash state trong `.pi/piagent-state/`
|
|
170
|
-
- session trace qua Pi custom entry `piagent-task-trace`
|
|
71
|
+
## Changed-file truth
|
|
171
72
|
|
|
172
|
-
|
|
73
|
+
Luc start, runtime luu Git working-tree snapshot va digest tung file dirty. Luc
|
|
74
|
+
gate/final trace, runtime chup lai snapshot:
|
|
173
75
|
|
|
174
|
-
|
|
76
|
+
```text
|
|
77
|
+
expected change = file co final digest khac task-start baseline
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Vi vay:
|
|
175
81
|
|
|
176
|
-
|
|
82
|
+
- file dirty truoc task khong tu dong bi nhan la do task;
|
|
83
|
+
- file dirty truoc task nhung bi sua tiep se duoc tinh;
|
|
84
|
+
- file da duoc sua roi revert ve baseline chi nam trong audit history, khong pass gate;
|
|
85
|
+
- claim file khong co evidence bi tu choi;
|
|
86
|
+
- thay doi ngoai `scope` bi tu choi;
|
|
87
|
+
- delete/missing co digest rieng;
|
|
88
|
+
- staged rename ghi ca old path va new path.
|
|
177
89
|
|
|
178
|
-
|
|
90
|
+
## Verify truth
|
|
91
|
+
|
|
92
|
+
Observed bash ledger la bounded owner-only JSONL. Evidence chi pass khi:
|
|
179
93
|
|
|
180
94
|
```text
|
|
181
|
-
|
|
95
|
+
exitCode === 0
|
|
96
|
+
observed === true
|
|
97
|
+
matchedProfileCommand === true
|
|
98
|
+
command nam chinh xac trong task.verifyCommands
|
|
182
99
|
```
|
|
183
100
|
|
|
184
|
-
|
|
101
|
+
Final gate doi evidence cho **tat ca** meaningful verify commands, khong chi mot
|
|
102
|
+
command bat ky. Profile `generic` fail-closed cho source work den khi project khai
|
|
103
|
+
verifier. Profile theo stack chi chay command co y nghia va khong dung `|| true`
|
|
104
|
+
de che failure.
|
|
105
|
+
|
|
106
|
+
## Retry va terminal immutability
|
|
107
|
+
|
|
108
|
+
Step co the `pending`, `in-progress`, `done`, `skipped`, `failed`. Reopen mot
|
|
109
|
+
failed step can note moi; step done/skipped khong duoc mo lai. Khi trace da
|
|
110
|
+
terminal, cac tool progress/context/memory/verify/trace va project mutations deu
|
|
111
|
+
bi chan cho session do.
|
|
185
112
|
|
|
186
|
-
|
|
113
|
+
Retry chay o session moi. `previousAttempts` giu outcome, phase failure, reason,
|
|
114
|
+
ruled-out hypothesis va timestamp de agent khong lap lai cach da that bai.
|
|
187
115
|
|
|
188
|
-
|
|
189
|
-
- `matchedProfileCommand=true`;
|
|
190
|
-
- `exitCode=0`.
|
|
116
|
+
## Migration v1 -> v2
|
|
191
117
|
|
|
192
|
-
|
|
118
|
+
Reader v2 fail-closed voi field la, timestamp hong, nested plan sai, taskRunId
|
|
119
|
+
khong khop filename hoac state unreadable. Migrator v1 chi copy whitelist field
|
|
120
|
+
da cong bo, them identity/session/retry/baseline defaults, ghi v2 atomically roi
|
|
121
|
+
archive file v1. Update preflight tu choi truoc moi project write neu state can
|
|
122
|
+
operator recovery.
|
|
193
123
|
|
|
194
|
-
|
|
124
|
+
Project da onboard khong can onboard lai sau global update. Capability lock giu
|
|
125
|
+
nguyen grant cua project va chi re-pin core khi release moi khong mo rong quyen.
|
|
195
126
|
|
|
196
|
-
|
|
197
|
-
- `/workflow be-to-fe`: dùng cho task scout BE contract read-only rồi implement FE.
|
|
198
|
-
- `/memory`: dùng cho task kiểm tra/ghi nhớ explicit project memory.
|
|
127
|
+
## Enforcement
|
|
199
128
|
|
|
200
|
-
|
|
129
|
+
| Lop | Enforcement |
|
|
130
|
+
|---|---|
|
|
131
|
+
| Prompt/workflow | Huong dan dung tool theo thu tu. |
|
|
132
|
+
| Tool-call guard | Protected path, scope, read-only, destructive/external confirmation. |
|
|
133
|
+
| Tool-result observer | Changed-file va bash evidence tu su kien that. |
|
|
134
|
+
| Persisted contract | Session binding, retry, plan, context, verify, trace. |
|
|
135
|
+
| Completion hook | Chan completion claim khi gate chua pass. |
|
|
136
|
+
| Local-state boundary | Owner-only, atomic write, no ancestor symlink, bounded retention. |
|