@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,164 @@
|
|
|
1
|
+
# Memory policy cho Pi Agent Platform
|
|
2
|
+
|
|
3
|
+
## Tóm tắt quyết định
|
|
4
|
+
|
|
5
|
+
Áp dụng memory theo hướng **explicit-only, project-scoped, markdown-first**.
|
|
6
|
+
|
|
7
|
+
Nghĩa là:
|
|
8
|
+
|
|
9
|
+
- project có `.pi/memory/memory_summary.md` và `.pi/memory/MEMORY.md`;
|
|
10
|
+
- agent chỉ ghi memory khi user yêu cầu rõ kiểu “remember this” hoặc workflow yêu cầu explicit;
|
|
11
|
+
- memory là hint để giảm scout lại, không phải source of truth;
|
|
12
|
+
- không bật background session extraction/consolidation mặc định trong public platform;
|
|
13
|
+
- nếu team muốn native/third-party Pi memory package thì install riêng sau khi review source.
|
|
14
|
+
|
|
15
|
+
## Vì sao không bật auto background memory ngay
|
|
16
|
+
|
|
17
|
+
Bài “How Pi remembers” mô tả hệ thống đầy đủ gồm:
|
|
18
|
+
|
|
19
|
+
- read path trước turn: nạp summary vào prompt;
|
|
20
|
+
- write path nền: đọc session cũ, trích raw memory, consolidate thành notebook;
|
|
21
|
+
- SQLite catalog để quản lý job/lease/usage;
|
|
22
|
+
- git snapshot để đọc bản memory sạch;
|
|
23
|
+
- `/memory` control panel.
|
|
24
|
+
|
|
25
|
+
Đó là kiến trúc tốt, nhưng với repo public dùng cho nhiều team, bật mặc định có 3 rủi ro:
|
|
26
|
+
|
|
27
|
+
1. **Token/cost khó đo:** background extraction có thể gọi model sau session.
|
|
28
|
+
2. **Ghi nhớ sai:** transcript cũ có thể chứa kết luận chưa verify nếu extractor không đủ chặt.
|
|
29
|
+
3. **Secret/privacy:** memory tự động phải có redaction + audit mạnh trước khi rollout.
|
|
30
|
+
|
|
31
|
+
Do đó bản platform hiện tại lấy phần chắc chắn nhất:
|
|
32
|
+
|
|
33
|
+
- memory file markdown dễ đọc/sửa, nhưng mặc định là private local state;
|
|
34
|
+
- write explicit-only;
|
|
35
|
+
- search/read bằng tool;
|
|
36
|
+
- context index chỉ lưu pointer/citation ngắn để định tuyến context, không lưu transcript thô;
|
|
37
|
+
- profile knobs để sau này bật external package hoặc assisted mode.
|
|
38
|
+
|
|
39
|
+
## File layout
|
|
40
|
+
|
|
41
|
+
Trong project được init:
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
.pi/memory/
|
|
45
|
+
├─ memory_summary.md compact index, bắt đầu bằng v1, ignored by default
|
|
46
|
+
├─ MEMORY.md durable project memory handbook, ignored by default
|
|
47
|
+
└─ local/ private local notes, ignored by git
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Memory markdown mặc định không commit vì nội dung có thể đến từ model/user free-text. Nếu team muốn shared handbook, hãy review/redact thủ công rồi opt-in bằng cách bỏ rule ignore ở `.pi/.gitignore`.
|
|
51
|
+
|
|
52
|
+
Runtime/experimental files không commit:
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
.pi/memory/MEMORY.md
|
|
56
|
+
.pi/memory/memory_summary.md
|
|
57
|
+
.pi/memory/state.sqlite
|
|
58
|
+
.pi/memory/raw_memories.md
|
|
59
|
+
.pi/memory/rollout_summaries/
|
|
60
|
+
.pi/memory/extensions/ad_hoc/
|
|
61
|
+
.pi/memory/local/
|
|
62
|
+
.pi/memory/.git/
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Profile config
|
|
66
|
+
|
|
67
|
+
Mỗi `.pi/piagent-profile.json` có block:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"memory": {
|
|
72
|
+
"enabled": true,
|
|
73
|
+
"mode": "manual",
|
|
74
|
+
"scope": "project",
|
|
75
|
+
"summaryFile": ".pi/memory/memory_summary.md",
|
|
76
|
+
"handbookFile": ".pi/memory/MEMORY.md",
|
|
77
|
+
"localDir": ".pi/memory/local",
|
|
78
|
+
"readBeforeTask": true,
|
|
79
|
+
"writePolicy": "explicit-only",
|
|
80
|
+
"maxInjectedChars": 4000,
|
|
81
|
+
"externalPackages": []
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Mode hiện tại:
|
|
87
|
+
|
|
88
|
+
| Mode | Ý nghĩa |
|
|
89
|
+
|---|---|
|
|
90
|
+
| `off` | Không dùng project memory. |
|
|
91
|
+
| `manual` | Mặc định. Tool đọc/search/write explicit-only. |
|
|
92
|
+
| `assisted` | Dành cho tương lai: agent có thể đề xuất memory note nhưng vẫn cần user approve. |
|
|
93
|
+
| `external-package` | Project/team dùng thêm package memory riêng như `pi-memory`. |
|
|
94
|
+
|
|
95
|
+
## Tools trong platform
|
|
96
|
+
|
|
97
|
+
| Tool | Mục đích |
|
|
98
|
+
|---|---|
|
|
99
|
+
| `piagent_memory_status` | Xem memory config/files/rules. |
|
|
100
|
+
| `piagent_memory_note` | Ghi durable note khi user explicit ask. Có redaction cho token/key/connection-string phổ biến. |
|
|
101
|
+
| `piagent_memory_search` | Keyword-search memory markdown. |
|
|
102
|
+
| `piagent_memory_citation_record` | Ghi memory file đã ảnh hưởng task contract. |
|
|
103
|
+
| `piagent_context_index_status` | Kiểm tra `.pi/context-index.json` có tồn tại/fresh/có citation không. |
|
|
104
|
+
| `piagent_context_index_search` | Tìm node/edge/citation trong context index trước khi scout rộng. |
|
|
105
|
+
| `piagent_context_index_record` | Ghi compact context graph sau onboarding hoặc approved handoff; không ghi transcript thô. |
|
|
106
|
+
|
|
107
|
+
## Workflow khuyến nghị
|
|
108
|
+
|
|
109
|
+
### First run
|
|
110
|
+
|
|
111
|
+
```text
|
|
112
|
+
/login
|
|
113
|
+
/onboard-project
|
|
114
|
+
/memory-policy
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Ghi nhớ explicit
|
|
118
|
+
|
|
119
|
+
```text
|
|
120
|
+
Remember: this repo uses pnpm, never npm.
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Agent nên gọi `piagent_memory_note` với category `preference`.
|
|
124
|
+
|
|
125
|
+
### Trước implementation
|
|
126
|
+
|
|
127
|
+
1. `piagent_context`
|
|
128
|
+
2. `piagent_context_index_status` hoặc `/context-index` để lấy điểm vào repo nếu đã onboard
|
|
129
|
+
3. `piagent_memory_status`
|
|
130
|
+
4. `piagent_memory_search` nếu task có keyword liên quan
|
|
131
|
+
5. đọc repo files hiện tại để verify
|
|
132
|
+
6. implement
|
|
133
|
+
|
|
134
|
+
Memory và context index giúp giảm token scout lại, nhưng không thay thế việc đọc source hiện tại. Không paste secret vào memory hoặc context index; redaction là lớp phòng tai nạn, không phải bảo đảm dữ liệu nhạy cảm có thể được lưu an toàn.
|
|
135
|
+
|
|
136
|
+
## Khi muốn dùng package memory ngoài
|
|
137
|
+
|
|
138
|
+
Pi package chạy code và ảnh hưởng hành vi agent, nên phải review source trước khi install.
|
|
139
|
+
|
|
140
|
+
Candidate phổ biến:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
pi install npm:pi-memory@0.4.0
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Package này lưu markdown ở local memory dir, có tools `memory_write`, `memory_read`, `scratchpad`, `memory_status`; search nâng cao cần qmd.
|
|
147
|
+
|
|
148
|
+
Nếu dùng external package, set profile:
|
|
149
|
+
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"memory": {
|
|
153
|
+
"mode": "external-package",
|
|
154
|
+
"externalPackages": ["npm:pi-memory@0.4.0"]
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Tài liệu chính
|
|
160
|
+
|
|
161
|
+
- Pi memory explainer: https://tuyenhx.com/docs/memory-explainer.html
|
|
162
|
+
- Pi extensions docs: https://pi.dev/docs/latest/extensions
|
|
163
|
+
- Pi settings/project trust docs: https://pi.dev/docs/latest/settings
|
|
164
|
+
- Pi package `pi-memory`: https://pi.dev/packages/pi-memory
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Model selector and scope
|
|
2
|
+
|
|
3
|
+
Pi Agent Platform không khóa vào một provider. OpenAI Codex và Claude/Anthropic đều là first-class option.
|
|
4
|
+
|
|
5
|
+
Quan trọng: flow chính là user chọn model bằng native Pi selector, không phải hỏi agent recommend.
|
|
6
|
+
|
|
7
|
+
## Flow chuẩn sau OAuth
|
|
8
|
+
|
|
9
|
+
Trong Pi:
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
/login
|
|
13
|
+
/model # hoặc Ctrl+L
|
|
14
|
+
/scoped-models # optional, edit danh sách Ctrl+P cycle
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Hotkeys:
|
|
18
|
+
|
|
19
|
+
```text
|
|
20
|
+
Ctrl+L # mở model selector
|
|
21
|
+
Ctrl+P # cycle model trong enabledModels
|
|
22
|
+
Shift+Ctrl+P # cycle ngược
|
|
23
|
+
Shift+Tab # cycle thinking level
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Global setup của repo sẽ seed `enabledModels` vào `~/.pi/agent/settings.json`, nên sau OAuth anh chọn/đổi model bằng option selector của Pi.
|
|
27
|
+
|
|
28
|
+
## Kiểm tra model hiện có
|
|
29
|
+
|
|
30
|
+
Trong Pi:
|
|
31
|
+
|
|
32
|
+
```text
|
|
33
|
+
/login
|
|
34
|
+
/model
|
|
35
|
+
/settings
|
|
36
|
+
/scoped-models
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Từ terminal:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pi --list-models
|
|
43
|
+
pi --list-models openai-codex
|
|
44
|
+
pi --list-models claude
|
|
45
|
+
pi --list-models anthropic
|
|
46
|
+
piagent-models
|
|
47
|
+
piagent-models --provider openai-codex
|
|
48
|
+
piagent-models --provider anthropic
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Lưu ý: `--list-models` chỉ hiện model mà Pi xem là available với credential/provider hiện tại. Nếu chưa login Anthropic, Claude có thể chưa hiện dù model catalog local có metadata.
|
|
52
|
+
|
|
53
|
+
## Thinking levels
|
|
54
|
+
|
|
55
|
+
Pi hỗ trợ:
|
|
56
|
+
|
|
57
|
+
```text
|
|
58
|
+
off, minimal, low, medium, high, xhigh, max
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Không phải model nào cũng hỗ trợ mọi level. Pi sẽ clamp theo capability của model. Cách chọn:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pi --model openai-codex/gpt-5.5:high
|
|
65
|
+
pi --model anthropic/claude-sonnet-5:xhigh
|
|
66
|
+
pi --thinking medium
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Current latest-family catalog
|
|
70
|
+
|
|
71
|
+
Đừng giới hạn vào vài ví dụ. Sau `pi update --models`, kiểm tra catalog local bằng `piagent-models`. Ở release hiện tại, các family/presets chính cần nhớ:
|
|
72
|
+
|
|
73
|
+
### OpenAI Codex
|
|
74
|
+
|
|
75
|
+
| Model | Role gợi ý | Khi dùng |
|
|
76
|
+
|---|---|---|
|
|
77
|
+
| `openai-codex/gpt-5.3-codex-spark` | fast scout | hỏi nhanh, thao tác nhỏ, chi phí thấp |
|
|
78
|
+
| `openai-codex/gpt-5.4-mini` | fast/cheap | scout nhẹ, docs, simple fix |
|
|
79
|
+
| `openai-codex/gpt-5.4` | balanced | task bình thường |
|
|
80
|
+
| `openai-codex/gpt-5.5` | balanced/hard default | default mạnh cho implement |
|
|
81
|
+
| `openai-codex/gpt-5.6-luna` | focused hard | debug/review/test khó, cần reasoning sâu nhưng scope hẹp |
|
|
82
|
+
| `openai-codex/gpt-5.6-sol` | strategic/deep | architecture, large refactor, planning lớn |
|
|
83
|
+
| `openai-codex/gpt-5.6-terra` | huge-context scout | đọc nhiều docs/source, tổng hợp repo lớn |
|
|
84
|
+
|
|
85
|
+
### Claude / Anthropic
|
|
86
|
+
|
|
87
|
+
| Model | Role gợi ý | Khi dùng |
|
|
88
|
+
|---|---|---|
|
|
89
|
+
| `anthropic/claude-haiku-4-5` | fast/cheap | hỏi nhanh, docs/scout nhẹ |
|
|
90
|
+
| `anthropic/claude-sonnet-4-5` | balanced | task source bình thường |
|
|
91
|
+
| `anthropic/claude-sonnet-4-6` | balanced/deep | source task lớn hơn, max-capable |
|
|
92
|
+
| `anthropic/claude-sonnet-5` | balanced/hard default | Claude default mạnh cho implement |
|
|
93
|
+
| `anthropic/claude-opus-4-5` | deep | review/refactor lớn |
|
|
94
|
+
| `anthropic/claude-opus-4-6` | deep/max | architecture/reasoning nặng |
|
|
95
|
+
| `anthropic/claude-opus-4-7` | deep/xhigh/max | high-risk/debug/architecture |
|
|
96
|
+
| `anthropic/claude-opus-4-8` | deep/xhigh/max | deep default nếu có quyền dùng |
|
|
97
|
+
| `anthropic/claude-fable-5` | huge-context/deep | repo/docs rất lớn, synthesis dài |
|
|
98
|
+
|
|
99
|
+
Pi catalog có thể có thêm dated variants như `*-2025xxxx`. Dùng alias latest-family ở trên cho team flow, dùng dated version khi cần reproducibility.
|
|
100
|
+
|
|
101
|
+
## Recommended presets
|
|
102
|
+
|
|
103
|
+
Preset dưới đây là cách mình seed `enabledModels`, không phải giới hạn hard. User vẫn có thể mở `/model` để chọn bất kỳ model available nào trong provider catalog.
|
|
104
|
+
|
|
105
|
+
| Preset | OpenAI Codex example | Claude/Anthropic example | Khi dùng |
|
|
106
|
+
|---|---|---|---|
|
|
107
|
+
| Fast scout | `openai-codex/gpt-5.4-mini:low` | `anthropic/claude-haiku-4-5:low` | đọc nhanh, hỏi đáp, grep/scout nhẹ |
|
|
108
|
+
| Balanced implement | `openai-codex/gpt-5.5:medium` | `anthropic/claude-sonnet-5:medium` | task source bình thường |
|
|
109
|
+
| Hard implement | `openai-codex/gpt-5.6-luna:xhigh` hoặc `openai-codex/gpt-5.5:xhigh` | `anthropic/claude-sonnet-5:xhigh` | task nhiều file, contract mapping, debug khó |
|
|
110
|
+
| Strategic/deep | `openai-codex/gpt-5.6-sol:xhigh` | `anthropic/claude-opus-4-7:max` hoặc `anthropic/claude-opus-4-8:max` | architecture, large refactor, high-risk review |
|
|
111
|
+
| Huge-context scout | `openai-codex/gpt-5.6-terra:xhigh` | `anthropic/claude-fable-5:max` | đọc nhiều docs/context, tổng hợp repo lớn |
|
|
112
|
+
|
|
113
|
+
Tên model có thể đổi theo Pi model catalog. Khi không chắc, ưu tiên `/model` hoặc `pi --list-models`.
|
|
114
|
+
|
|
115
|
+
## Practical routing
|
|
116
|
+
|
|
117
|
+
Global setup mặc định:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
piagent-model-scope --preset full --default-model openai-codex/gpt-5.5:xhigh
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Scope này ghi vào settings:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
~/.pi/agent/settings.json
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Sau đó dùng selector:
|
|
130
|
+
|
|
131
|
+
```text
|
|
132
|
+
/model
|
|
133
|
+
/scoped-models
|
|
134
|
+
Ctrl+P
|
|
135
|
+
Shift+Tab
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Nếu muốn đặt default khác:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
piagent-model-scope --preset full --default-model openai-codex/gpt-5.6-sol:xhigh
|
|
142
|
+
piagent-model-scope --preset full --default-model anthropic/claude-sonnet-5:xhigh
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Benchmark rule
|
|
146
|
+
|
|
147
|
+
Không claim “Pi + provider X tiết kiệm hơn provider Y” bằng cảm giác. Chạy cùng scenario rồi ghi bằng:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
piagent-usage /path/to/project
|
|
151
|
+
bash scripts/quality-benchmark.sh /path/to/project --record \
|
|
152
|
+
--scenario bounded-source-fix \
|
|
153
|
+
--surface pi \
|
|
154
|
+
--result pass \
|
|
155
|
+
--tokens <total> \
|
|
156
|
+
--cost <cost> \
|
|
157
|
+
--verify "<verify-command>" \
|
|
158
|
+
--notes "provider/model/thinking=<provider/model:thinking>"
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
So sánh tối thiểu:
|
|
162
|
+
|
|
163
|
+
- Pi + Codex fast/balanced/deep;
|
|
164
|
+
- Pi + Claude fast/balanced/deep;
|
|
165
|
+
- any other approved setup nếu team muốn so sánh bằng số liệu.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# OAuth providers trong Pi
|
|
2
|
+
|
|
3
|
+
## Mục tiêu
|
|
4
|
+
|
|
5
|
+
Dùng provider/model được Pi hỗ trợ mà không đưa token hoặc local auth file vào repository.
|
|
6
|
+
|
|
7
|
+
## Setup
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pi
|
|
11
|
+
/login
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Chọn provider theo danh sách Pi hiển thị. Sau đó kiểm tra:
|
|
15
|
+
|
|
16
|
+
```text
|
|
17
|
+
/model
|
|
18
|
+
/model-options
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Hoặc:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pi --list-models
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Credential boundary
|
|
28
|
+
|
|
29
|
+
Không đưa những file này vào source:
|
|
30
|
+
|
|
31
|
+
- `~/.pi/agent/auth.json`
|
|
32
|
+
- custom agent dir `auth.json`
|
|
33
|
+
- `.env`
|
|
34
|
+
- API keys
|
|
35
|
+
- session dumps có token
|
|
36
|
+
|
|
37
|
+
## Team usage
|
|
38
|
+
|
|
39
|
+
Mỗi dev login OAuth bằng account được công ty cho phép. Repo platform chỉ chứa:
|
|
40
|
+
|
|
41
|
+
- hướng dẫn login
|
|
42
|
+
- package source
|
|
43
|
+
- profile/policy
|
|
44
|
+
- template config không có secret
|
|
45
|
+
|
|
46
|
+
## CI/automation
|
|
47
|
+
|
|
48
|
+
Không dùng OAuth local cho CI. Nếu sau này cần headless automation, dùng secret manager riêng và policy riêng.
|
|
49
|
+
|
|
50
|
+
## Tài liệu chính
|
|
51
|
+
|
|
52
|
+
- Pi providers/OAuth: https://pi.dev/docs/latest/providers
|
|
53
|
+
- Pi settings/trust: https://pi.dev/docs/latest/settings
|