Chuẩn bị runtime
Dùng Node.js 20 trở lên và Pi Coding Agent 0.80.10. Pi Company Platform v0.4.7 đang pin compatibility với runtime này qua package metadata.
node --version # >= 20
npm install -g @earendil-works/pi-coding-agent@0.80.10
pi --version
Team operating docs
Tài liệu này gom phần cài đặt, profile, quyền chạy, bảo mật và workflow vào một nơi duy nhất. Mục tiêu là thành viên mới chỉ cần mở trang này, chọn đúng command, chạy đúng chế độ và biết ranh giới an toàn.
Positioning
Codex CLI và Claude Code là agent coding tổng quát và đều có cơ chế governance native như permission, approval, sandbox/trust, hooks, subagents, MCP hoặc managed settings tuỳ bề mặt sử dụng. Pi Company Platform đưa các cơ chế governance tương tự vào Pi, rồi đóng gói thành workflow đội nhóm: profile, policy guard, capability lock, MCP, subagents, memory và verify gate dùng lại được trên nhiều repo.
| Hạng mục | Codex CLI | Claude Code | Pi Company Platform |
|---|---|---|---|
| Vai trò chính | Coding agent chạy trong terminal, làm việc trực tiếp trên local repo. | Agent coding đa bề mặt: terminal, IDE, desktop, web và tích hợp dev tools. | Governance layer cho Pi: chuẩn hoá cách team dùng agent theo policy, profile và workflow vận hành. |
| Tuỳ biến team | Dùng AGENTS.md, config, skills, plugins, MCP và command native. | Dùng CLAUDE.md, settings, permissions, hooks, skills và MCP. | Dùng adapter profile, base policy, command guard, capability pack, docs và scripts. |
| Quyền chạy | Có sandbox, approval policy, permission profiles, network controls và workflow read-only/workspace-write tuỳ môi trường. | Có permissions, working-directory boundary, sandboxed bash option, hooks và managed settings cho team. | Có read-only, workspace-write, trusted-full-access ở lớp policy extension của Pi. |
| Bảo mật secret | Dựa trên OS-enforced sandbox, approval, network policy và bề mặt Codex đang dùng. | Dựa trên permission architecture, sandbox option, trust verification, allowlist và security best practices. | Application-level policy layer cho controlled tools: protected paths, shell checks, symlink alias, output redaction và integrity lock. |
| Điểm mạnh riêng | Trải nghiệm terminal gọn, tích hợp Git và local tooling. | Hệ sinh thái command, hooks, memory, multi-surface mạnh. | Tạo chuẩn nội bộ: mọi repo dùng cùng profile, cùng guard, cùng verify discipline. |
Quickstart
Luồng dưới đây là đường đi chuẩn cho team: chuẩn bị Node.js và Pi Coding Agent, cài Pi Company Platform bằng release tag đã pin, kiểm tra compatibility, mở repo, chọn profile, bật quyền phù hợp, chạy task, rồi verify bằng command thật. Bản latest chỉ nên dùng cho máy cá nhân hoặc sandbox chấp nhận cập nhật nhanh.
Dùng Node.js 20 trở lên và Pi Coding Agent 0.80.10. Pi Company Platform v0.4.7 đang pin compatibility với runtime này qua package metadata.
node --version # >= 20
npm install -g @earendil-works/pi-coding-agent@0.80.10
pi --version
Team, production và docs quickstart nên pin release tag hoặc commit cụ thể. Máy cá nhân có thể dùng source không pin nếu chấp nhận cập nhật theo nhánh hiện tại.
pi install git:github.com/Vt-mmm/pi_agent@v0.4.7
pi update --extensions
Dùng latest khi muốn nhận thay đổi nhanh trên máy riêng. Khi đưa vào repo/team, đổi sang tag hoặc commit đã review để mọi developer nhận cùng một cấu hình.
pi install git:github.com/Vt-mmm/pi_agent
pi update --extensions
Chạy Pi từ thư mục repo. Với repo đã tin cậy, dùng wrapper trusted-run khi cần tự động hoá có kiểm soát.
cd /path/to/project
pi
Chạy một lần ở repo mới để ghi context, verify matrix và protected areas vào .pi/.
/onboard-project
Dùng /profile auto để áp profile được detect, hoặc chọn profile rõ theo loại repo.
/profile auto
Scout thì read-only, code bình thường thì workspace-write, automation tin cậy thì full-access có guard.
/permission-status
/workspace-write
Dùng command đúng mục tiêu để agent không phải diễn giải quá dài. Task nào nặng context thì dùng fresh session.
/task Implement the requested bounded change.
/review
/fresh-task Implement the requested bounded change.
Final gate chỉ tin kết quả command đã chạy thật, exit 0, và khớp verify plan. Với setup team, chạy doctor và smoke test sau khi pin hoặc nâng version.
pi-company-doctor /path/to/project --strict-share
# in pi_agent source repo:
npm run smoke
npm run verify
npm test
npm run typecheck
Architecture
Repo này không nhét business logic vào core. Core chỉ giữ policy, prompts, guard, skills, subagents và scripts đủ chung để áp cho nhiều dự án.
packages/pi-company-core chứa extension guard, prompts, skills và subagent roles.
adapters/ chứa profile dùng lại: frontend, backend, fullstack, data, devops, docs.
packs/ gom policy, lifecycle, recipes và eval scenarios theo manifest có lock.
Base policy định nghĩa protected paths, command rules, permission modes và human-action gates.
Setup, doctor, model scope, MCP, subagents, benchmark và trusted-run wrapper đều có CLI riêng.
docs/ giữ manual dài. docs-site/ là trang HTML gọn cho team.
Security model
Platform ưu tiên fail-closed trong bề mặt tool được kiểm soát: khi lock sai, profile sai hoặc command đụng vùng nhạy cảm, guard cố gắng chặn trước khi tool chạy. Đây là application-level policy enforcement layer, không phải lớp cách ly hoàn chỉnh; với code hoặc prompt không tin cậy vẫn cần container/VM và giới hạn credential, filesystem, process, network.
Chặn đọc/ghi qua controlled tools đối với file như .env, auth.json, local trust files, profile lock và settings nhạy cảm.
Guard dựa vào shell parser và rule cho command được kiểm soát để bắt glob, brace, redirection, bare-word symlink và xargs composition trước khi shell mở rộng runtime.
Tool output text đi qua redactor để che token, provider keys, secret keyword patterns và giá trị nhạy cảm phổ biến. Benchmark hiện là synthetic/internal và model vẫn đang hoàn thiện.
Pack lock có digest và tamper detection. Lock hỏng thì fail-closed, không tự nới quyền.
Destructive hoặc external-provider action vẫn cần operator xác nhận rõ, kể cả khi full-access đang bật.
Handoff hoàn tất cần bằng chứng verify từ bash result đã quan sát, không nhận câu trả lời “đã test” suông.
Guard phụ thuộc vào tool path, controlled tools và shell parser mà platform quan sát được. Nó không ngăn một process khác chạy cùng quyền OS đọc/ghi ngoài guard, và không thay thế sandbox của hệ điều hành.
Các benchmark hiện tại là kiểm thử synthetic/internal cho regression và release gate, chưa tương đương external security audit. Trước khi xem redaction như bảo đảm an toàn mạnh, cần threat model rõ, attack vectors, matrix Linux/macOS/Windows và shell, fuzz parser, kiểm tra symlink/path traversal, third-party audit, quy trình issue/CVE và chính sách LTS support.
Profiles
Profile ghi vào .pi/company-profile.json và lock tương ứng. Command profile hiện đã chạy trực tiếp, không kích thêm câu trả lời dài từ model.
/profile
/profile list
/profile auto
/profile web-frontend
/profile fe
/profile backend-api
/profile be-readonly-fe
/profile be-fe
/profile fullstack
/profile full
/profile docs
Permissions
Permission mode là session-local override. Đổi mode không sửa project profile. Nếu truyền thêm nội dung sau command, Pi đổi quyền rồi gửi phần còn lại thành task kế tiếp.
| Mode | Dùng khi nào | Ranh giới | Command |
|---|---|---|---|
| read-only | Scout, audit, mapping, review không chỉnh source. | Cho read, grep, find, ls và company tools; chặn shell/write/unknown tools. | /read-only |
| workspace-write | Implementation bình thường trong repo. | Default guarded mode; giữ protected path, shell policy, capability và verify gate. | /workspace-write |
| trusted-full-access | Automation trên repo đã tin và task đã rõ. | Nới autonomy trong guard, nhưng vẫn giữ protected path, redaction, lock và confirmation. | /full-access |
/permission-status
/read-only
/workspace-write
/full-access Run the trusted local verification suite.
Command catalog
Ưu tiên dùng slash command vì mỗi command đã gói policy và flow. Thành viên không cần paste lại hướng dẫn dài trong từng prompt.
Dùng để setup session, chọn model, xem profile/usage và quyết định có cần fresh session trước task lớn không.
Áp profile trực tiếp, output ngắn, không yêu cầu model giải thích dài.
Gói sẵn read context, task contract, implementation, verify evidence và final handoff.
Không cần namespace /git. Commit/PR đi qua shell guard; push và stage rộng như git add -A cần xác nhận.
Dùng khi context đã nặng hoặc cần một session sạch cho workflow mới.
Kiểm tra và cấu hình tool servers theo preset core, popular hoặc design.
Kiểm tra runtime, model routing, background runs và cost khi dùng multi-agent.
Workflows
Chọn workflow theo intent thay vì mô tả lại policy trong prompt. Cách này giảm context lặp và giữ output tập trung hơn.
Không có namespace /git riêng. Dùng /commit để commit local đã review, dùng /pr để chuẩn bị PR. Các hành động như git push hoặc stage rộng git add -A vẫn cần operator xác nhận.
/task Fix the failing checkout test and verify.
/scout Map the auth flow and risk areas.
/plan Add multi-tenant billing support.
/review
/commit "feat: add guarded git workflow"
/pr "Prepare PR for guarded git workflow"
/profile be-readonly-fe
/be-to-fe Implement frontend support for the new user status endpoint.
/platform-improve Harden command docs and run verification.
Runtime tools
Nhóm command này chạy ngoài slash command, dùng cho setup, doctor, benchmark, capability lock và automation.
pi-company-setup --mcp-preset core --subagents-preset safe
pi-company-install --stable --dry-run
pi-company-install --stable
pi-company-install --version v0.4.7
pi-company-init /path/to/project
pi-company-doctor /path/to/project
pi-company-auto --read-only -p "Scout payment mapping. Do not edit source."
pi-company-auto --full-access -p "Run the trusted local benchmark suite."
pi-company-capabilities catalog --check
pi-company-capabilities doctor --profile .pi/company-profile.json
npm run verify
npm test
npm run typecheck
Team usage
Mỗi repo chỉ cần link package, chọn profile đúng và giữ tài liệu project-specific ở repo của dự án đó. Core vẫn sạch, nhỏ và audit được.
Chạy /onboard-project, áp /profile auto, dùng workflow command, verify thật và ghi blockers rõ ràng.
Đưa token, auth file, cache, session, private examples hoặc business logic riêng vào core package public.
Final response nên nói ngắn: đã đổi gì, verify nào đã chạy, có dùng subagent không, và còn rủi ro hoặc next step nào cần người review.