@piagent/platform 1.5.5 → 1.6.1
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 +166 -0
- package/README.md +25 -21
- package/README.vi.md +34 -5
- package/adapters/web-frontend/profile.json +2 -4
- package/architecture/layers.json +18 -3
- package/benchmarks/deep-logic-v1/SPECIALIST_PROTOCOL.vi.md +122 -0
- package/benchmarks/deep-logic-v1/grade.mjs +272 -10
- package/benchmarks/deep-logic-v1/project/apps/admin/src/billing-summary.js +3 -0
- package/benchmarks/deep-logic-v1/project/benchmark-contract/public-smoke.test.js +166 -0
- package/benchmarks/deep-logic-v1/project/package.json +1 -1
- package/benchmarks/deep-logic-v1/project/packages/billing/src/close-period.js +3 -0
- package/benchmarks/deep-logic-v1/project/packages/billing/src/plan-timeline.js +3 -0
- package/benchmarks/deep-logic-v1/project/test/smoke.test.js +7 -1
- package/benchmarks/deep-logic-v1/prompts/budgeted-context-graph.md +2 -0
- package/benchmarks/deep-logic-v1/prompts/fair-dependency-scheduler.md +2 -0
- package/benchmarks/deep-logic-v1/prompts/layered-policy-resolution.md +2 -0
- package/benchmarks/deep-logic-v1/prompts/resumable-stream-assembly.md +3 -1
- package/benchmarks/deep-logic-v1/prompts/revision-event-reconciliation.md +2 -0
- package/benchmarks/deep-logic-v1/prompts/temporal-usage-billing-close.md +123 -0
- package/benchmarks/deep-logic-v1/prompts/transactional-config-merge.md +2 -0
- package/benchmarks/deep-logic-v1/suite.json +51 -3
- package/benchmarks/deep-logic-v1/variant.mjs +22 -1
- package/benchmarks/production-v1/spend-control.v1.json +92 -0
- package/benchmarks/production-v1/suite.json +46 -3
- package/catalog/capabilities.json +18 -18
- package/docs/authority-manifest.md +1 -1
- package/docs/auto-delegation-policy.md +38 -73
- package/docs/command-reference-vietnamese.md +27 -35
- package/docs/context-engine.md +12 -4
- package/docs/context-window-policy.md +37 -1
- package/docs/distribution-standard.md +7 -7
- package/docs/en/architecture.md +27 -13
- package/docs/languages.json +4 -4
- package/docs/model-options.md +8 -5
- package/docs/operator-manual-vietnamese.md +27 -45
- package/docs/project-adapters.md +2 -2
- package/docs/publishing-for-teams.md +10 -0
- package/docs/quality-benchmark.md +427 -62
- package/docs/release-install-policy.md +10 -9
- package/docs/runtime-harness-standard.md +3 -3
- package/docs/runtime-policy-design.md +4 -4
- package/docs/runtime-quality-baseline.md +13 -6
- package/docs/security-threat-model.md +2 -2
- package/docs/subagent-orchestration-capabilities.md +19 -51
- package/docs/subagents-and-multiagent.md +21 -47
- package/docs/task-implementation-contract.md +3 -3
- package/docs/task-lifecycle-vietnamese.md +3 -3
- package/docs/team-onboarding.md +2 -2
- package/docs/usage-observability.md +7 -2
- package/docs/vi/architecture.md +27 -13
- package/docs-site/architecture.html +1 -1
- package/docs-site/benchmark.html +89 -95
- package/docs-site/commands.html +1 -1
- package/docs-site/content/benchmark.html +88 -94
- package/docs-site/content/en/benchmark.html +134 -90
- package/docs-site/content/en/index.html +19 -19
- package/docs-site/content/en/runtime.html +4 -4
- package/docs-site/content/en/whats-new.html +12 -1
- package/docs-site/content/en/workflows.html +2 -2
- package/docs-site/content/index.html +19 -19
- package/docs-site/content/runtime.html +4 -4
- package/docs-site/content/whats-new.html +12 -1
- package/docs-site/content/workflows.html +2 -2
- package/docs-site/context-engine.html +1 -1
- package/docs-site/en/architecture.html +1 -1
- package/docs-site/en/benchmark.html +135 -91
- package/docs-site/en/commands.html +1 -1
- package/docs-site/en/context-engine.html +1 -1
- package/docs-site/en/index.html +20 -20
- package/docs-site/en/mcp-approval.html +1 -1
- package/docs-site/en/mcp-auth.html +1 -1
- package/docs-site/en/mcp-servers.html +1 -1
- package/docs-site/en/mcp.html +1 -1
- package/docs-site/en/permissions.html +1 -1
- package/docs-site/en/profiles.html +1 -1
- package/docs-site/en/quickstart.html +1 -1
- package/docs-site/en/runtime.html +5 -5
- package/docs-site/en/scope.html +1 -1
- package/docs-site/en/security.html +1 -1
- package/docs-site/en/team.html +1 -1
- package/docs-site/en/whats-new.html +13 -2
- package/docs-site/en/workflows.html +3 -3
- package/docs-site/index.html +20 -20
- 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 +5 -5
- package/docs-site/scope.html +1 -1
- package/docs-site/security.html +1 -1
- package/docs-site/team.html +1 -1
- package/docs-site/whats-new.html +13 -2
- package/docs-site/workflows.html +3 -3
- package/evals/fixtures/benchmark-assurance-evidence.invalid.json +1 -1
- package/evals/fixtures/benchmark-assurance-evidence.valid.json +1 -1
- package/evals/fixtures/codex-relative-efficiency-v1.invalid.json +4 -0
- package/evals/fixtures/codex-relative-efficiency-v1.valid.json +94 -0
- package/evals/fixtures/helper-request.invalid.json +1 -1
- package/evals/fixtures/helper-request.valid.json +1 -1
- package/evals/fixtures/piagent-webui/session-live-state-v1.invalid.json +18 -0
- package/evals/fixtures/piagent-webui/session-live-state-v1.valid.json +27 -0
- package/evals/fixtures/piagent-webui/subagent-tree-v1.valid.json +7 -0
- package/evals/fixtures/task-authority-snapshot.valid.json +4 -4
- package/evals/fs4-readiness-matrix.v1.json +2 -2
- package/evals/fs5-causal-arm.v1.json +3 -3
- package/evals/fs5-pilot-protocol.v1.json +3 -3
- package/evals/fs5-pilot-protocol.v2.json +8 -8
- package/evals/fs5-pilot-protocol.v3.json +8 -8
- package/evals/fs5-pilot-protocol.v4.json +7 -6
- package/evals/fs5-pilot-protocol.v5.json +9 -7
- package/evals/private-holdout-v1/public-exposure.v1.json +1 -1
- package/evals/runtime-conformance-v1/README.md +43 -0
- package/evals/runtime-conformance-v1/evaluate-paid-canary.mjs +198 -0
- package/evals/runtime-conformance-v1/lane.json +57 -0
- package/evals/runtime-conformance-v1/paid-canary.json +31 -0
- package/evals/runtime-conformance-v1/runner.mjs +456 -0
- package/package.json +3 -1
- package/packages/piagent-core/README.md +13 -4
- package/packages/piagent-core/benchmark/benchmark-assurance.js +4 -1
- package/packages/piagent-core/benchmark/benchmark-bootstrap.js +91 -9
- package/packages/piagent-core/benchmark/benchmark-claim-restrictions.js +38 -7
- package/packages/piagent-core/benchmark/benchmark-cli.js +7 -7
- package/packages/piagent-core/benchmark/benchmark-codex-relative-efficiency.js +698 -0
- package/packages/piagent-core/benchmark/benchmark-codex.js +3 -1
- package/packages/piagent-core/benchmark/benchmark-comparison.js +271 -2
- package/packages/piagent-core/benchmark/benchmark-core.js +736 -664
- package/packages/piagent-core/benchmark/benchmark-execution-guard.js +7 -5
- package/packages/piagent-core/benchmark/benchmark-forensics.js +441 -4
- package/packages/piagent-core/benchmark/benchmark-host-readiness.js +639 -0
- package/packages/piagent-core/benchmark/benchmark-matrix.js +22 -4
- package/packages/piagent-core/benchmark/benchmark-normalized-cost.js +317 -0
- package/packages/piagent-core/benchmark/benchmark-preflight.js +5 -1
- package/packages/piagent-core/benchmark/benchmark-process.js +6 -5
- package/packages/piagent-core/benchmark/benchmark-provider-free-evidence.js +345 -0
- package/packages/piagent-core/benchmark/benchmark-provider-wire.js +126 -0
- package/packages/piagent-core/benchmark/benchmark-record-validation.js +252 -0
- package/packages/piagent-core/benchmark/benchmark-report.js +130 -12
- package/packages/piagent-core/benchmark/benchmark-resume-recovery.js +14 -0
- package/packages/piagent-core/benchmark/benchmark-runner-policy.js +26 -0
- package/packages/piagent-core/benchmark/benchmark-runtime-causal.js +244 -0
- package/packages/piagent-core/benchmark/benchmark-stage-diagnostic.js +979 -0
- package/packages/piagent-core/benchmark/benchmark-statistics.js +64 -0
- package/packages/piagent-core/benchmark/benchmark-stop-policy.js +8 -5
- package/packages/piagent-core/benchmark/benchmark-suite-identity.js +31 -0
- package/packages/piagent-core/benchmark/benchmark-suite-runtime.js +13 -9
- package/packages/piagent-core/benchmark/benchmark-suite.js +149 -2
- package/packages/piagent-core/benchmark/benchmark-summary-support.js +380 -0
- package/packages/piagent-core/benchmark/benchmark-timing-diagnostics.js +971 -0
- package/packages/piagent-core/benchmark/benchmark-usage.js +322 -0
- package/packages/piagent-core/benchmark/benchmark-workflow.js +166 -0
- package/packages/piagent-core/capabilities/runtime-integrity.js +3 -0
- package/packages/piagent-core/docs/context-efficiency-improvement-plan.md +1080 -0
- package/packages/piagent-core/extensions/acceptance-behavior-proof.js +806 -0
- package/packages/piagent-core/extensions/acceptance-contract-semantics.js +83 -69
- package/packages/piagent-core/extensions/acceptance-error-classes.js +160 -0
- package/packages/piagent-core/extensions/acceptance-executable-evidence.js +12 -9
- package/packages/piagent-core/extensions/acceptance-receipt.js +123 -59
- package/packages/piagent-core/extensions/acceptance-state-machine-evidence.js +518 -0
- package/packages/piagent-core/extensions/acceptance-test-binding-evidence.js +60 -0
- package/packages/piagent-core/extensions/context-efficiency-metrics.js +302 -0
- package/packages/piagent-core/extensions/context-efficiency-report.js +167 -0
- package/packages/piagent-core/extensions/context-engine.js +149 -156
- package/packages/piagent-core/extensions/context-evidence.js +48 -0
- package/packages/piagent-core/extensions/context-import-links.js +296 -0
- package/packages/piagent-core/extensions/context-index-policy.js +4 -0
- package/packages/piagent-core/extensions/context-query-paths.js +57 -0
- package/packages/piagent-core/extensions/context-telemetry-integrity.js +65 -0
- package/packages/piagent-core/extensions/criterion-context-pack.js +435 -7
- package/packages/piagent-core/extensions/criterion-graph.js +82 -9
- package/packages/piagent-core/extensions/fallback-base-policy.ts +101 -0
- package/packages/piagent-core/extensions/guard-types.ts +6 -0
- package/packages/piagent-core/extensions/javascript-regex-evidence.js +32 -0
- package/packages/piagent-core/extensions/piagent-guard.ts +420 -260
- package/packages/piagent-core/extensions/task-contract-view.js +17 -3
- package/packages/piagent-core/extensions/task-lifecycle.js +39 -2
- package/packages/piagent-core/extensions/task-state.js +109 -142
- package/packages/piagent-core/extensions/verification-intelligence.js +52 -13
- package/packages/piagent-core/extensions/workspace-evidence-roots.js +193 -0
- package/packages/piagent-core/package.json +1 -1
- package/packages/piagent-core/policies/base-policy.json +44 -2
- package/packages/piagent-core/policy/authority-manifest.v1.json +3 -3
- package/packages/piagent-core/prompts/be-to-fe.md +2 -8
- package/packages/piagent-core/prompts/plan.md +1 -1
- package/packages/piagent-core/prompts/platform-improve.md +2 -6
- package/packages/piagent-core/prompts/review.md +2 -7
- package/packages/piagent-core/prompts/scout.md +1 -1
- package/packages/piagent-core/prompts/task.md +4 -3
- package/packages/piagent-core/runtime/context/context-delivery.ts +103 -0
- package/packages/piagent-core/runtime/context/context-delta-shadow.ts +53 -0
- package/packages/piagent-core/runtime/context/context-efficiency-format.ts +47 -0
- package/packages/piagent-core/runtime/context/context-evidence-qualification.ts +32 -0
- package/packages/piagent-core/runtime/context/prefix-telemetry.ts +47 -0
- package/packages/piagent-core/runtime/context/repository-memory-hints.ts +27 -0
- package/packages/piagent-core/runtime/hooks/agent-prompt-telemetry.ts +56 -0
- package/packages/piagent-core/runtime/hooks/agent-start-hook.ts +162 -102
- package/packages/piagent-core/runtime/hooks/completion-hook.ts +12 -12
- package/packages/piagent-core/runtime/hooks/input-hook.ts +17 -1
- package/packages/piagent-core/runtime/hooks/session-hooks.ts +22 -2
- package/packages/piagent-core/runtime/hooks/session-start-hook.ts +107 -3
- package/packages/piagent-core/runtime/hooks/tool-result-content-guards.ts +95 -0
- package/packages/piagent-core/runtime/hooks/tool-result-hook.ts +134 -166
- package/packages/piagent-core/runtime/hooks/tool-result-value-helpers.ts +66 -0
- package/packages/piagent-core/runtime/inspection/activity-event-adapter.ts +4 -2
- package/packages/piagent-core/runtime/inspection/activity-recovery.ts +104 -0
- package/packages/piagent-core/runtime/inspection/bounded-emission-guard.ts +286 -0
- package/packages/piagent-core/runtime/inspection/runtime-event-store.ts +37 -7
- package/packages/piagent-core/runtime/inspection/task-compaction-history.ts +1 -1
- package/packages/piagent-core/runtime/inspection/task-handoff-history.ts +1 -1
- package/packages/piagent-core/runtime/inspection/task-subagent-tree.ts +27 -4
- package/packages/piagent-core/runtime/inspection/tool-failure-classification.ts +70 -0
- package/packages/piagent-core/runtime/inspection/webui-snapshot.ts +73 -9
- package/packages/piagent-core/runtime/model/authenticated-catalog.ts +17 -9
- package/packages/piagent-core/runtime/model/openai-codex-reasoning.ts +83 -0
- package/packages/piagent-core/runtime/model/provider-wire-fingerprint.ts +238 -0
- package/packages/piagent-core/runtime/orchestration/helper-lifecycle.ts +16 -12
- package/packages/piagent-core/runtime/orchestration/minimal-delegation-policy.ts +71 -0
- package/packages/piagent-core/runtime/orchestration/owned-work-budget.ts +28 -20
- package/packages/piagent-core/runtime/orchestration/role-policy.ts +27 -9
- package/packages/piagent-core/runtime/orchestration/subagent-tool-policy.ts +329 -0
- package/packages/piagent-core/runtime/policy/block-remedy.ts +0 -4
- package/packages/piagent-core/runtime/product/activity-inspector.ts +7 -2
- package/packages/piagent-core/runtime/product/efficiency-metrics.ts +7 -2
- package/packages/piagent-core/runtime/quality/edit-freshness-guard.ts +102 -0
- package/packages/piagent-core/runtime/quality/exact-output-contract.ts +22 -11
- package/packages/piagent-core/runtime/quality/performance-assurance-signals.ts +23 -0
- package/packages/piagent-core/runtime/quality/performance-assurance.ts +9 -5
- package/packages/piagent-core/runtime/recovery/continuation-budget.ts +1 -1
- package/packages/piagent-core/runtime/recovery/edit-recovery-context.ts +113 -0
- package/packages/piagent-core/runtime/recovery/edit-recovery-delivery.ts +42 -0
- package/packages/piagent-core/runtime/recovery/handoff-projection.ts +4 -1
- package/packages/piagent-core/runtime/recovery/pristine-task-policy-refresh.ts +91 -0
- package/packages/piagent-core/runtime/recovery/recovery-policy.ts +7 -4
- package/packages/piagent-core/runtime/recovery/resume-state.ts +112 -14
- package/packages/piagent-core/runtime/recovery/semantic-repair-handshake.ts +60 -13
- package/packages/piagent-core/runtime/recovery/semantic-repair-runtime.ts +55 -2
- package/packages/piagent-core/runtime/recovery/task-evidence-coverage-refresh.ts +217 -0
- package/packages/piagent-core/runtime/registration/context-commands.ts +82 -7
- package/packages/piagent-core/runtime/registration/knowledge-tools.ts +9 -5
- package/packages/piagent-core/runtime/registration/operator-request-intake.ts +49 -0
- package/packages/piagent-core/runtime/registration/policy-tools.ts +50 -15
- package/packages/piagent-core/runtime/registration/session-commands.ts +1 -1
- package/packages/piagent-core/runtime/registration/task-completion-tools.ts +61 -25
- package/packages/piagent-core/runtime/registration/task-evidence-tools.ts +21 -12
- package/packages/piagent-core/runtime/registration/task-start-guidance.ts +169 -0
- package/packages/piagent-core/runtime/registration/task-start-manifest.ts +54 -0
- package/packages/piagent-core/runtime/registration/task-start-retry-helpers.ts +37 -0
- package/packages/piagent-core/runtime/registration/task-start-tool.ts +108 -103
- package/packages/piagent-core/runtime/runtime-limits.ts +16 -2
- package/packages/piagent-core/runtime/session/adaptive-context-analysis.ts +461 -0
- package/packages/piagent-core/runtime/session/adaptive-context-governor.ts +464 -0
- package/packages/piagent-core/runtime/session/adaptive-context-ledger.ts +265 -0
- package/packages/piagent-core/runtime/session/message-signals.ts +7 -3
- package/packages/piagent-core/runtime/session/operator-request-carry.ts +44 -0
- package/packages/piagent-core/runtime/session/runtime-state.ts +161 -5
- package/packages/piagent-core/runtime/session/source-checkout-read-grants.ts +35 -0
- package/packages/piagent-core/runtime/session/system-prompt.ts +76 -14
- package/packages/piagent-core/runtime/session/task-contract-presentation.ts +39 -0
- package/packages/piagent-core/runtime/tools/apply-patch-tool.ts +500 -0
- package/packages/piagent-core/runtime/tools/phase-tools.ts +8 -8
- package/packages/piagent-core/runtime/tools/tool-groups.ts +12 -2
- package/packages/piagent-core/runtime/trajectory/trajectory-runtime.ts +2 -1
- package/packages/piagent-core/runtime/verification/exact-verifier-reuse.ts +101 -0
- package/packages/piagent-core/runtime/workflows/runtime-intake-compaction.ts +164 -0
- package/packages/piagent-core/runtime/workflows/task-intake.ts +207 -38
- package/packages/piagent-core/security/sensitive-data.js +13 -218
- package/packages/piagent-core/security/sensitive-project-file.js +42 -0
- package/packages/piagent-core/security/sensitive-source-expression.js +330 -0
- package/packages/piagent-core/security/sensitive-source-formats.js +394 -0
- package/packages/piagent-core/security/sensitive-text.js +234 -0
- package/packages/piagent-core/subagents/piagent-oracle.md +5 -3
- package/packages/piagent-core/subagents/piagent-planner.md +6 -4
- package/packages/piagent-core/subagents/piagent-reviewer.md +5 -3
- package/packages/piagent-core/subagents/piagent-scout.md +4 -2
- package/packages/piagent-core/subagents/piagent-worker.md +7 -5
- package/packages/piagent-webui/dist/client/assets/{MarkdownMessage-rD9WJKxs.js → MarkdownMessage-B4XehTCU.js} +1 -1
- package/packages/piagent-webui/dist/client/assets/index-CgOEyRPG.js +176 -0
- package/packages/piagent-webui/dist/client/index.html +1 -1
- package/packages/piagent-webui/extension/piagent-webui.ts +3 -1
- package/packages/piagent-webui/extension/same-session-bridge.ts +1 -1
- package/packages/piagent-webui/extension/session-stream-adapter.ts +33 -10
- package/packages/piagent-webui/gateway/gateway-events.ts +109 -5
- package/packages/piagent-webui/gateway/gateway-service.ts +3 -0
- package/packages/piagent-webui/gateway/gateway-session-stream.ts +122 -20
- package/packages/piagent-webui/gateway/session-command-controller.ts +18 -3
- package/packages/piagent-webui/gateway/session-effective-options.ts +47 -0
- package/packages/piagent-webui/gateway/session-live-state.ts +21 -0
- package/packages/piagent-webui/gateway/session-operation-lifecycle.ts +237 -0
- package/packages/piagent-webui/gateway/session-operation-retry-control.ts +38 -0
- package/packages/piagent-webui/gateway/session-operation-start.ts +5 -1
- package/packages/piagent-webui/gateway/session-operation-watchdog.ts +165 -0
- package/packages/piagent-webui/gateway/session-runtime-factory.ts +45 -0
- package/packages/piagent-webui/gateway/session-runtime-supervisor.ts +141 -125
- package/packages/piagent-webui/ownership/session-lease-store.ts +5 -2
- package/packages/piagent-webui/server/core-inspection-provider.ts +2 -1
- package/packages/piagent-webui/server/loopback-server.ts +8 -0
- package/packages/piagent-webui/server/transcript-projection.ts +113 -9
- package/packages/piagent-webui/shared/text-visibility.ts +10 -0
- package/schemas/codex-relative-efficiency-v1.schema.json +155 -0
- package/schemas/piagent-webui/catalog-v1.json +9 -0
- package/schemas/piagent-webui/gateway-protocol-v1.schema.json +53 -3
- package/schemas/piagent-webui/runtime-event-v2.schema.json +15 -5
- package/schemas/piagent-webui/session-live-state-v1.schema.json +76 -0
- package/schemas/piagent-webui/subagent-tree-v1.schema.json +11 -1
- package/schemas/project-profile.schema.json +1 -1
- package/schemas/task-contract.schema.json +27 -1
- package/scripts/benchmark-runner-core.mjs +367 -363
- package/scripts/benchmark-runner-finalization.mjs +313 -0
- package/scripts/benchmark-runner-host-readiness.mjs +94 -0
- package/scripts/benchmark-runner-support.mjs +200 -0
- package/scripts/benchmark-session.mjs +95 -41
- package/scripts/configure-model-scope.sh +4 -3
- package/scripts/configure-subagents.sh +42 -34
- package/scripts/helper-evaluation.mjs +2 -2
- package/scripts/install-global.sh +2 -2
- package/scripts/pi-usage-history.mjs +37 -10
- package/scripts/setup.sh +2 -2
- package/scripts/team-doctor.sh +1 -1
- package/scripts/verify-local.sh +10 -1
- package/templates/global/settings.json +2 -1
- package/packages/piagent-webui/dist/client/assets/index-BZRFw1u6.js +0 -174
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Solo-first orchestration policy
|
|
2
2
|
<!-- language: vi; english-index: docs-site/content/en/workflows.html -->
|
|
3
3
|
|
|
4
|
-
Mục tiêu:
|
|
4
|
+
Mục tiêu: parent model tự làm trọn task với đầy đủ năng lực. Helper không còn là phase mặc định để scout/plan/review; nó chỉ là một tối ưu token ngoại lệ. Piagent chỉ cho tối đa **một helper read-only, context fresh** khi runtime chứng minh có ít nhất hai lane độc lập và tổng token dự kiến sau handoff/merge giảm tối thiểu **30%**. Alias cũ như `/task` giữ cùng policy.
|
|
5
5
|
|
|
6
6
|
Kiểm tra policy hiện tại trong Pi:
|
|
7
7
|
|
|
@@ -15,11 +15,11 @@ Slash command này chỉ hiện status compact, không gửi follow-up cho model
|
|
|
15
15
|
|
|
16
16
|
Subagent không nên hiểu là “luôn tự sinh khi task lớn”. Hành vi đúng là:
|
|
17
17
|
|
|
18
|
-
1. Parent
|
|
19
|
-
2.
|
|
20
|
-
3.
|
|
21
|
-
4.
|
|
22
|
-
5.
|
|
18
|
+
1. Parent làm trực tiếp nếu runtime chưa có bằng chứng định lượng.
|
|
19
|
+
2. Helper chỉ đủ điều kiện khi có ít nhất hai workstream độc lập, helper không chờ output tiếp theo của parent, context transfer không quá 2.048 token, không inherit transcript, và tổng dự kiến tiết kiệm ít nhất 30%.
|
|
20
|
+
3. Mỗi task run chỉ có một lần thử helper. Lỗi runtime/scope xác định không được relaunch.
|
|
21
|
+
4. Helper luôn read-only; worker/writer helper bị tắt. Parent giữ toàn bộ mutation và quyết định.
|
|
22
|
+
5. UI/telemetry phải ghi `dispatch` hoặc `skip`, reason codes, và projected net saving; không có số liệu thì `skip`.
|
|
23
23
|
|
|
24
24
|
Nếu bundled skill `pi-subagents` có trong skill list của parent, parent nên dùng skill đó cho orchestration patterns thay vì tự đoán syntax. Skill này là parent-only; child subagents không nhận nó.
|
|
25
25
|
|
|
@@ -28,43 +28,45 @@ Nếu bundled skill `pi-subagents` có trong skill list của parent, parent nê
|
|
|
28
28
|
| Setting | Default |
|
|
29
29
|
|---|---|
|
|
30
30
|
| Mode | `solo-first` |
|
|
31
|
-
|
|
|
31
|
+
| Helper budget | `1` read-only total; concurrent `1`; retry `0`; worker `0` |
|
|
32
|
+
| Minimum projected net saving | `30%` |
|
|
33
|
+
| Context transfer | fresh/isolated; tối đa `2.048` token; không inherit parent history |
|
|
32
34
|
| Review lenses | `correctness`, `tests`, `scope` |
|
|
33
35
|
| Field Guide | `.pi/memory/MEMORY.md`, advisory, explicit-write only |
|
|
34
|
-
| Writer policy |
|
|
36
|
+
| Writer policy | Parent model là writer duy nhất. |
|
|
35
37
|
|
|
36
38
|
Model role guidance:
|
|
37
39
|
|
|
38
40
|
- planner: model mạnh nhất hợp lý cho decomposition, architecture, risk, acceptance criteria;
|
|
39
|
-
- worker:
|
|
40
|
-
- reviewer:
|
|
41
|
-
- watchdog
|
|
41
|
+
- worker: disabled; parent model implement trực tiếp;
|
|
42
|
+
- reviewer/oracle: role read-only ngoại lệ; không tự chạy chỉ vì review quan trọng;
|
|
43
|
+
- builtin agents và watchdog: disabled trong baseline Piagent.
|
|
42
44
|
|
|
43
45
|
## Khi nào parent nên tự spawn
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
Chỉ spawn khi **đồng thời** thỏa tất cả điều kiện:
|
|
46
48
|
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
- task có từ 3 touchpoint trở lên;
|
|
54
|
-
- task medium/high-risk nhưng có phần audit read-only trước khi edit;
|
|
55
|
-
- context có nguy cơ phình to nếu parent tự đọc toàn bộ log/spec/source.
|
|
49
|
+
- runtime xác định ít nhất hai workstream thật sự độc lập;
|
|
50
|
+
- helper có thể hoàn tất mà không chờ output tiếp theo của parent;
|
|
51
|
+
- helper chỉ cần read/grep/find/ls;
|
|
52
|
+
- request dùng fresh isolated context, seed không quá 2.048 token;
|
|
53
|
+
- estimate gồm parent + helper + transfer + merge thấp hơn solo ít nhất 30%;
|
|
54
|
+
- task run chưa từng launch helper và không retry một lỗi runtime/scope xác định.
|
|
56
55
|
|
|
57
56
|
## Khi nào không nên tự spawn
|
|
58
57
|
|
|
59
58
|
Không spawn nếu:
|
|
60
59
|
|
|
61
60
|
- task nhỏ, một file, verify đơn giản;
|
|
61
|
+
- không có runtime estimate hoặc projected saving dưới 30%;
|
|
62
62
|
- requirement chưa rõ và cần hỏi user trước;
|
|
63
63
|
- chỉ có một write target nhỏ;
|
|
64
64
|
- subagent tool/package chưa available;
|
|
65
65
|
- repo dirty hoặc write set có nguy cơ overlap mà chưa phân tách được;
|
|
66
66
|
- task high-risk cần human gate trước khi edit;
|
|
67
|
-
-
|
|
67
|
+
- cần bất kỳ mutation nào từ child;
|
|
68
|
+
- muốn planner/reviewer chỉ để “tăng chất lượng” nhưng không giảm tổng token;
|
|
69
|
+
- đã có một helper attempt, kể cả attempt failed/orphaned.
|
|
68
70
|
|
|
69
71
|
## Default agent mapping
|
|
70
72
|
|
|
@@ -72,13 +74,10 @@ Không spawn nếu:
|
|
|
72
74
|
|---|---|---|
|
|
73
75
|
| Map unfamiliar repo/module/spec | `piagent-scout` | read-only |
|
|
74
76
|
| Build implementation plan | `piagent-planner` | read-only |
|
|
75
|
-
| Implement approved bounded change | `piagent-worker` | single writer |
|
|
76
77
|
| Review current diff | `piagent-reviewer` | review-first |
|
|
77
78
|
| Challenge architecture/risk | `piagent-oracle` | read-only |
|
|
78
|
-
| External docs/web research | builtin `researcher` | read-only; requires web tools |
|
|
79
|
-
| Large context handoff | builtin `context-builder` or `piagent-scout` | writes handoff artifact only |
|
|
80
79
|
|
|
81
|
-
Default rule:
|
|
80
|
+
Default rule: parent direct. Tối đa một role read-only ở bảng trên; không parallel và không worker.
|
|
82
81
|
|
|
83
82
|
## Workflow policy
|
|
84
83
|
|
|
@@ -89,42 +88,26 @@ Parent should:
|
|
|
89
88
|
1. load piagent context/profile/memory/project context;
|
|
90
89
|
2. load `piagent_orchestration_policy`;
|
|
91
90
|
3. create a compact task tree/workPlan and review lenses in `piagent_task_start`;
|
|
92
|
-
4.
|
|
93
|
-
5.
|
|
94
|
-
6.
|
|
91
|
+
4. runtime tính projected total tokens; thiếu estimate hoặc saving dưới 30% thì skip;
|
|
92
|
+
5. nếu đủ điều kiện, spawn đúng một helper fresh/read-only;
|
|
93
|
+
6. parent tự implement và review;
|
|
95
94
|
7. summarize subagent outputs into task contract/context manifest/final response.
|
|
96
95
|
|
|
97
96
|
### `/workflow be-to-fe`
|
|
98
97
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
- `piagent-scout`: map backend contract read-only;
|
|
102
|
-
- `piagent-scout`: map frontend touchpoints read-only;
|
|
103
|
-
- `piagent-planner`: produce FE implementation plan;
|
|
104
|
-
- parent or `piagent-worker`: implement FE only;
|
|
105
|
-
- `piagent-reviewer`: review diff and verify coverage.
|
|
98
|
+
Parent map BE contract, map FE touchpoints, implement và review. Runtime chỉ được chọn **một** trong hai lane mapping cho `piagent-scout` nếu estimate toàn task đạt ngưỡng 30%; lane còn lại vẫn do parent làm.
|
|
106
99
|
|
|
107
100
|
### `/workflow platform-improve`
|
|
108
101
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
- `piagent-scout`: inspect current platform source/docs;
|
|
112
|
-
- builtin `researcher`: inspect official docs/web evidence when `pi-web-access` is installed;
|
|
113
|
-
- builtin `context-builder`: create handoff context/meta-prompt for large platform changes;
|
|
114
|
-
- `piagent-scout`: inspect official docs/external source repo targeted evidence;
|
|
115
|
-
- `piagent-planner`: produce implementation matrix;
|
|
116
|
-
- parent or `piagent-worker`: implement bounded changes;
|
|
117
|
-
- `piagent-reviewer`: review docs/runtime behavior.
|
|
102
|
+
Parent inspect, research, plan, implement và review. Một fresh read-only helper chỉ được map một lane độc lập khi runtime estimate tổng token đạt ngưỡng; không dùng chain scout → planner → worker → reviewer.
|
|
118
103
|
|
|
119
104
|
### `/review`
|
|
120
105
|
|
|
121
|
-
|
|
106
|
+
Parent-owned review:
|
|
122
107
|
|
|
123
108
|
- select explicit review lenses first;
|
|
124
|
-
-
|
|
125
|
-
-
|
|
126
|
-
- optional parallel `piagent-reviewer` for scope/protected-path drift;
|
|
127
|
-
- optional `piagent-oracle` for architecture/high-risk concerns.
|
|
109
|
+
- parent cover các lens trong cùng context;
|
|
110
|
+
- chỉ dùng một fresh read-only reviewer/oracle nếu nó thay thế một lane độc lập và estimate tiết kiệm ít nhất 30%.
|
|
128
111
|
|
|
129
112
|
If the user explicitly asks for a review loop, use `/review-loop` or an equivalent parent-controlled loop with max rounds. Do not blindly apply all reviewer suggestions.
|
|
130
113
|
|
|
@@ -136,17 +119,7 @@ Single scout:
|
|
|
136
119
|
Use piagent-scout to map the target module read-only. Return files, ownership, invariants, and likely change points only.
|
|
137
120
|
```
|
|
138
121
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
```text
|
|
142
|
-
Run parallel piagent-scout agents: one maps backend contract read-only, one maps frontend touchpoints read-only. Wait for both and summarize the contract-to-FE map.
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
Parallel review:
|
|
146
|
-
|
|
147
|
-
```text
|
|
148
|
-
Run parallel piagent-reviewer agents for correctness, tests/verification, and scope/protected-path drift. Wait for all and summarize findings by severity.
|
|
149
|
-
```
|
|
122
|
+
The parent must attach runtime evidence equivalent to: `independent lanes >= 2`, `context=fresh`, `inheritedParentTokens=0`, and `projectedNetSaving>=30%`. Without it, do not call the helper tool.
|
|
150
123
|
|
|
151
124
|
Tool syntax fallback:
|
|
152
125
|
|
|
@@ -159,7 +132,7 @@ subagent({ agent: "piagent-scout", task: "Map target area read-only. Return conc
|
|
|
159
132
|
Final response should include one line:
|
|
160
133
|
|
|
161
134
|
```text
|
|
162
|
-
|
|
135
|
+
Helper: <skip reason=<code> projectedSaving=<unknown|N%> / dispatch role=<role> projectedSaving=N%>
|
|
163
136
|
```
|
|
164
137
|
|
|
165
138
|
If not used, give the reason briefly:
|
|
@@ -172,19 +145,11 @@ If not used, give the reason briefly:
|
|
|
172
145
|
|
|
173
146
|
## Token rule
|
|
174
147
|
|
|
175
|
-
|
|
148
|
+
Projected saving phải so sánh **tổng parent + child + handoff + merge**, không so child với một đoạn parent context riêng lẻ. Ngưỡng 30% là dispatch gate, không phải bằng chứng rằng Piagent đã rẻ hơn `codex-cli` 30–40%; kết luận đó chỉ được đưa ra từ paired benchmark Piagent/`codex-cli` cùng model, thinking, task và success gate.
|
|
176
149
|
|
|
177
|
-
## Package shortcuts
|
|
150
|
+
## Package shortcuts
|
|
178
151
|
|
|
179
|
-
|
|
180
|
-
|---|---|
|
|
181
|
-
| `/parallel-review` | Need distinct review angles; add `autofix` only when user permits fixes. |
|
|
182
|
-
| `/review-loop` | Need worker/reviewer/fix loop until clean or capped. |
|
|
183
|
-
| `/parallel-research` | Need external evidence + local code context. |
|
|
184
|
-
| `/parallel-context-build` | Need context/meta-prompt handoff before a large plan. |
|
|
185
|
-
| `/parallel-handoff-plan` | Need research + context-builder + implementation handoff. |
|
|
186
|
-
| `/gather-context-and-clarify` | Need scout/research first, then ask only meaningful questions. |
|
|
187
|
-
| `/parallel-cleanup` | Need post-implementation cleanup review. |
|
|
152
|
+
Các shortcut `/parallel-*`, worker/reviewer loop và grant-spawn-budget thuộc package upstream nhưng không nằm trong Piagent governed default. Absolute Piagent budget vẫn là một read-only helper total; daily workflow không dùng các shortcut này.
|
|
188
153
|
|
|
189
154
|
See `docs/subagent-orchestration-capabilities.md`.
|
|
190
155
|
|
|
@@ -325,7 +325,7 @@ Các command này thuộc Pi core hoặc package Pi chính. Tên/availability c
|
|
|
325
325
|
|
|
326
326
|
Các command này đến từ package `pi-subagents`. Tên hơi “package terminology”, nên bảng dưới dịch ra nghĩa thực tế.
|
|
327
327
|
|
|
328
|
-
Quan trọng:
|
|
328
|
+
Quan trọng: Piagent mặc định parent-direct và helpers `off`. Các lệnh dưới đây phần lớn là capability upstream để inspect/debug. Piagent config chặn builtin, worker, parallel, nested và retry; operator chỉ có thể opt-in một helper read-only context fresh, và runtime vẫn yêu cầu hai lane độc lập cùng projected net saving từ 30%.
|
|
329
329
|
|
|
330
330
|
| Command | Dịch nghĩa dễ hiểu | Dùng khi nào | Kết quả mong đợi |
|
|
331
331
|
|---|---|---|---|
|
|
@@ -342,16 +342,10 @@ Quan trọng: daily flow không bắt anh phải nhớ các lệnh này. Các wo
|
|
|
342
342
|
| `/subagents-generate-profiles <provider>` | Sinh quota/quality profiles | Khi muốn profile model theo quota/chất lượng. | Tạo profile cho provider. |
|
|
343
343
|
| `/subagents-check-profile <name>` | Check profile | Khi profile/model có thể stale. | Re-check model availability/auth. |
|
|
344
344
|
| `/run <agent> "<task>"` | Chạy 1 subagent | Khi cần 1 scout/reviewer/planner riêng context. | Child session chạy task rồi trả summary về parent. |
|
|
345
|
-
| `/run <agent> "<task>" --bg` |
|
|
346
|
-
| `/run <agent> "<task>" --fork` |
|
|
347
|
-
| `/parallel
|
|
348
|
-
| `/
|
|
349
|
-
| `/run-chain <name>` | Chạy chain đã lưu | Khi có workflow lặp lại. | Package chạy recipe chain đã định nghĩa. |
|
|
350
|
-
| `/parallel-review` | Review song song | Khi cần nhiều reviewer theo góc nhìn độc lập. | Có thể thêm `autofix` nếu đã cho phép sửa. |
|
|
351
|
-
| `/review-loop` | Worker/reviewer/fix loop | Khi muốn review đến khi sạch hoặc hết vòng. | Nên set max rounds, thường dùng tối đa 3 vòng. |
|
|
352
|
-
| `/parallel-research` | Research song song | Khi cần external evidence + local scout. | Builtin `researcher` cần `pi-web-access`. |
|
|
353
|
-
| `/parallel-context-build` | Build context handoff | Khi task lớn cần `context.md`/meta-prompt trước planning. | Dùng `context-builder` agents. |
|
|
354
|
-
| `/parallel-handoff-plan` | Research + context + plan | Khi muốn handoff plan đầy đủ cho implementation. | Tốt cho architecture hoặc platform change lớn. |
|
|
345
|
+
| `/run <agent> "<task>" --bg` | Capability upstream | Piagent không bật async mặc định. | Không dùng trong governed default. |
|
|
346
|
+
| `/run <agent> "<task>" --fork` | Capability upstream | Inherit history trái policy context fresh. | Piagent từ chối. |
|
|
347
|
+
| `/parallel ...`, `/chain ...`, `/run-chain ...` | Capability upstream | Nhân số turn/context. | Piagent config giới hạn 1 và không dispatch parallel/chain. |
|
|
348
|
+
| `/parallel-review`, `/review-loop`, `/parallel-research`, `/parallel-context-build`, `/parallel-handoff-plan` | Capability upstream | Tạo nhiều helper hoặc retry loop. | Piagent config không cho dùng. |
|
|
355
349
|
| `/gather-context-and-clarify` | Scout rồi hỏi đúng câu | Khi requirement chưa rõ nhưng cần đọc trước. | Trả clarification questions có evidence. |
|
|
356
350
|
| `/parallel-cleanup` | Cleanup review sau implement | Khi muốn rà cleanup đáng làm. | Có thể thêm `autofix`. |
|
|
357
351
|
|
|
@@ -364,7 +358,7 @@ Glossary:
|
|
|
364
358
|
| `fleet` | “Đội” child sessions đang chạy hoặc vừa chạy xong. |
|
|
365
359
|
| `scout` | Agent đọc/map code read-only. |
|
|
366
360
|
| `planner` | Agent lập plan và verify gate, không sửa code. |
|
|
367
|
-
| `worker` |
|
|
361
|
+
| `worker` | Metadata compatibility; bị Piagent disable. |
|
|
368
362
|
| `reviewer` | Agent review diff/test/scope. |
|
|
369
363
|
| `oracle` | Agent phản biện/risk challenge. |
|
|
370
364
|
| `researcher` | Builtin agent nghiên cứu web/docs có nguồn; cần `pi-web-access`. |
|
|
@@ -372,7 +366,7 @@ Glossary:
|
|
|
372
366
|
| `chain` | Làm A rồi dùng kết quả A để làm B. |
|
|
373
367
|
| `parallel` | Làm nhiều nhánh độc lập cùng lúc. |
|
|
374
368
|
| `bg` | Background run, không block parent ngay. |
|
|
375
|
-
| `fork` |
|
|
369
|
+
| `fork` | Capability upstream; Piagent cấm vì helper phải context fresh. |
|
|
376
370
|
| `watchdog` | Opt-in adversarial reviewer ở cuối turn; không phải `reviewer` subagent. |
|
|
377
371
|
| `worktree` | Checkout riêng cho parallel writers để tránh đè file nhau. |
|
|
378
372
|
|
|
@@ -382,7 +376,7 @@ Piagent subagents:
|
|
|
382
376
|
|---|---|---|
|
|
383
377
|
| `piagent-scout` | Map repo/module/spec trước khi sửa. | Read-only. |
|
|
384
378
|
| `piagent-planner` | Lập implementation plan. | Read-only. |
|
|
385
|
-
| `piagent-worker` |
|
|
379
|
+
| `piagent-worker` | Compatibility metadata; bị Piagent config disable. | Không dispatch. |
|
|
386
380
|
| `piagent-reviewer` | Review diff, verify coverage, scope drift. | Review-first. |
|
|
387
381
|
| `piagent-oracle` | Challenge architecture/risk. | Read-only. |
|
|
388
382
|
|
|
@@ -416,24 +410,21 @@ Một số option hữu ích:
|
|
|
416
410
|
```text
|
|
417
411
|
/run reviewer[model=anthropic/claude-sonnet-5:high] "Review this diff"
|
|
418
412
|
/run scout[output=context.md,outputMode=file-only] "Map auth flow"
|
|
419
|
-
/chain scout[output=context.md,as=context] "Scan" -> planner[reads=context.md] "Plan from {outputs.context}"
|
|
420
413
|
subagent({ action: "status", view: "fleet" })
|
|
421
414
|
subagent({ action: "status", id: "<run-id>", view: "transcript", lines: 120 })
|
|
422
|
-
subagent({ action: "grant-spawn-budget", additional: 10 })
|
|
423
415
|
```
|
|
424
416
|
|
|
425
417
|
`outputMode=file-only` hữu ích khi child tạo report dài: parent chỉ nhận đường dẫn file, không bị nhồi full report vào context.
|
|
426
418
|
|
|
427
419
|
## Khi nào nên spawn subagent
|
|
428
420
|
|
|
429
|
-
|
|
421
|
+
Trong Piagent, helper chỉ được dispatch khi tất cả điều kiện sau đúng:
|
|
430
422
|
|
|
431
|
-
-
|
|
432
|
-
-
|
|
433
|
-
-
|
|
434
|
-
-
|
|
435
|
-
-
|
|
436
|
-
- compress context trước khi parent/worker implement.
|
|
423
|
+
- operator đã bật `PIAGENT_HELPERS_MODE=on`;
|
|
424
|
+
- runtime chứng minh ít nhất hai lane độc lập;
|
|
425
|
+
- helper không cần chờ output tiếp theo của parent;
|
|
426
|
+
- handoff context fresh, không inherit history, tối đa 2.048 token;
|
|
427
|
+
- projected tổng token sau cả handoff/merge tiết kiệm ít nhất 30%.
|
|
437
428
|
|
|
438
429
|
Không nên spawn bừa khi:
|
|
439
430
|
|
|
@@ -446,11 +437,11 @@ Không nên spawn bừa khi:
|
|
|
446
437
|
Default của platform là an toàn:
|
|
447
438
|
|
|
448
439
|
- `maxSubagentDepth: 1`: parent spawn child, child không fan-out tiếp.
|
|
449
|
-
- `parallel.concurrency:
|
|
440
|
+
- `parallel.concurrency: 1`: compatibility ceiling, không chạy song song.
|
|
450
441
|
- `asyncByDefault: false`: không tự chạy background nếu anh không yêu cầu.
|
|
451
|
-
-
|
|
442
|
+
- Tổng 1 read-only helper, 0 worker, 0 retry.
|
|
452
443
|
|
|
453
|
-
Nếu anh không
|
|
444
|
+
Nếu anh không bật gì thêm, `/workflow task` chạy parent-direct và không tạo model turn phụ. Alias `/task` giữ cùng policy.
|
|
454
445
|
|
|
455
446
|
## Prompt mẫu cho bài toán thật
|
|
456
447
|
|
|
@@ -480,7 +471,7 @@ Use piagent-reviewer before final.
|
|
|
480
471
|
Nếu muốn parallel read-only:
|
|
481
472
|
|
|
482
473
|
```text
|
|
483
|
-
|
|
474
|
+
Keep the parent direct. If helper mode was explicitly enabled and the runtime proves at least 30% net saving, run one fresh read-only piagent-scout for the single highest-value independent lane.
|
|
484
475
|
```
|
|
485
476
|
|
|
486
477
|
### Review trước khi ship
|
|
@@ -502,8 +493,8 @@ Các lệnh này chạy ngoài Pi.
|
|
|
502
493
|
| Command | Dùng khi nào |
|
|
503
494
|
|---|---|
|
|
504
495
|
| `npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.84.1` | Cài Pi CLI tương thích với release hiện tại. |
|
|
505
|
-
| `npm install -g --ignore-scripts @piagent/platform@1.
|
|
506
|
-
| `pi install git:github.com/Vt-mmm/piagent@v1.
|
|
496
|
+
| `npm install -g --ignore-scripts @piagent/platform@1.6.1` | Cài terminal helper `piagent-*` từ release tag hiện tại. |
|
|
497
|
+
| `pi install git:github.com/Vt-mmm/piagent@v1.6.1` | Cài pinned release khi cần reproducible team setup. |
|
|
507
498
|
| `pi install git:github.com/Vt-mmm/piagent` | Cài latest package platform cho máy cá nhân/sandbox. |
|
|
508
499
|
| `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ì. |
|
|
509
500
|
| `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. |
|
|
@@ -547,17 +538,18 @@ Các lệnh này chạy ngoài Pi.
|
|
|
547
538
|
| `piagent-uninstall --apply` | Gỡ Pi package của platform khỏi Pi settings global. |
|
|
548
539
|
| `piagent-uninstall --apply --with-addons --with-host` | Gỡ thêm pi-mcp-adapter, pi-subagents, pi-web-access và Pi host. |
|
|
549
540
|
| `piagent-uninstall --apply --project /path/to/project` | Gỡ thêm state của platform trong project: profile, lock, `piagent-state/`. |
|
|
550
|
-
| `piagent-benchmark` | Chạy smoke suite `core-v1`: paired
|
|
541
|
+
| `piagent-benchmark` | Chạy smoke suite `core-v1`: paired Piagent/controlled `codex-cli` bằng Luna/medium, 24 session, hidden grader + scope + workflow + exact usage. |
|
|
551
542
|
| `piagent-benchmark --dry-run` | Validate suite và xem số model session, không gọi model. |
|
|
552
|
-
| `npm run benchmark:deep -- --dry-run` | Validate `deep-logic-v1`:
|
|
553
|
-
| `npm run benchmark:deep` | Chạy paired deep-logic benchmark Luna/medium cho event/state, scheduler, policy, context graph, stream recovery và
|
|
543
|
+
| `npm run benchmark:deep -- --dry-run` | Validate `deep-logic-v1`: 7 family difficulty large × 3 repeat × Piagent/`codex-cli` = 42 session, khóa Luna/medium và chưa dùng quota. |
|
|
544
|
+
| `npm run benchmark:deep` | Chạy paired deep-logic benchmark Luna/medium cho event/state, scheduler, policy, context graph, stream recovery, transactional config và temporal usage billing chính xác. |
|
|
554
545
|
| `piagent-benchmark --production --dry-run` | Xem ma trận production 18 family x 3 variant x 2 surface = 108 session, chưa dùng quota. |
|
|
555
|
-
| `piagent-benchmark --production --
|
|
546
|
+
| `piagent-benchmark --production --preflight-only` | Trước lượt trả phí, tự chạy/cache ba lane provider-free cùng exact source/tree/config/runner binding; lần đầu có long-horizon tối thiểu 30 phút, 0 provider call/model token. |
|
|
547
|
+
| `piagent-benchmark --production --surfaces piagent,codex-cli --model openai-codex/gpt-5.6-luna --thinking medium --piagent-treatment candidate` | Chạy production release gate đa domain/profile/lifecycle với controlled Codex; S12/S36/S72 chặn pooled fresh ratio >1.10, observed family >1.25 hoặc subagent vượt 1 attempt/5% traffic; S108 dùng upper-95 <=0.60. |
|
|
556
548
|
| `piagent-benchmark --piagent-treatment release-defaults\|local-safe\|candidate\|feature-off ...` | Pin treatment Piagent; chỉ surface `piagent` nhận feature env, manifest/resume/replay/report giữ nguyên treatment. |
|
|
557
549
|
| `piagent-benchmark --codex-mode native ...` | Đo UX Codex theo cấu hình operator; protocol gate fail closed nên report không được claim tiết kiệm token. |
|
|
558
550
|
| `piagent-benchmark --production --seed <value> ...` | Tái lập đúng generated variant của một production report riêng tư. |
|
|
559
551
|
| `piagent-benchmark --production --scenarios <id,id> --repeats 1 ...` | Chẩn đoán family/rubric đã chọn; không đủ điều kiện nhận production verdict. |
|
|
560
|
-
| `piagent-benchmark --production --infrastructure-retries 2 ...` |
|
|
552
|
+
| `piagent-benchmark --production --infrastructure-retries 2 ...` | Diagnostic recovery run; retry chỉ áp lỗi process chết trước usage, được report đầy đủ và làm production claim fail. |
|
|
561
553
|
| `piagent-benchmark --production --retry-delay 60 ...` | Đặt backoff trước infrastructure retry; production mặc định 60 giây. |
|
|
562
554
|
| `bash scripts/verify-local.sh` | Verify repo platform trước khi commit/tag. |
|
|
563
555
|
| `bash scripts/verify-local.sh --offline` | Verify trong CI/máy sạch, bỏ qua local Pi model catalog. |
|
|
@@ -576,7 +568,7 @@ Khi đang develop chính repo `piagent`, có thể dùng npm scripts tương ứ
|
|
|
576
568
|
| `npm run init-project -- <project>` | `bash scripts/init-project.sh <project>` |
|
|
577
569
|
| `npm run doctor -- <project> --strict-share` | `bash scripts/team-doctor.sh <project> --strict-share` |
|
|
578
570
|
| `npm run benchmark -- ...` | `node scripts/benchmark-runner.mjs ...` |
|
|
579
|
-
| `npm run benchmark:webui-parity` | Gate provider-free cho 10 workflow, 32 Project Controls, contract/security, Chromium flow và ba cỡ performance stress. |
|
|
571
|
+
| `npm run benchmark:webui-parity` | Gate provider-free cho 10 workflow, 32 Project Controls, contract/security, bảy deterministic UI-stability suite, Chromium flow và ba cỡ performance stress. |
|
|
580
572
|
| `npm run usage -- <project>` | `bash scripts/pi-session-stats.sh <project>` |
|
|
581
573
|
| `npm run usage -- --history <project> --days 7` | `bash scripts/pi-session-stats.sh --history <project> --days 7` |
|
|
582
574
|
| `npm run models` | `bash scripts/pi-model-catalog.sh` |
|
package/docs/context-engine.md
CHANGED
|
@@ -21,9 +21,11 @@ task
|
|
|
21
21
|
|
|
22
22
|
## P0: runtime context controls
|
|
23
23
|
|
|
24
|
-
- Piagent tools được chia thành `governance`, `policy`, `retrieval`,
|
|
25
|
-
`knowledge`, `onboarding`, và `usage`.
|
|
26
|
-
|
|
24
|
+
- Piagent tools được chia thành `governance`, `policy`, `retrieval`, `source`,
|
|
25
|
+
`knowledge`, `onboarding`, và `usage`. URL GitHub/GitLab/Bitbucket do operator
|
|
26
|
+
cung cấp chỉ bật schema `source`; code retrieval không tự kéo theo memory,
|
|
27
|
+
document intake hoặc orchestration. Checkout được cấp quyền đọc đúng session
|
|
28
|
+
qua `read`/`grep`/`find`/`ls`, còn shared cache không mở cho shell hay mutation.
|
|
27
29
|
- Session bắt đầu không mang schema quản trị Piagent. Input hook bật thẳng nhóm
|
|
28
30
|
tối thiểu cần cho task trước khi system prompt được tạo.
|
|
29
31
|
- `piagent_tools` chỉ xuất hiện khi operator yêu cầu rõ tool loader; runtime
|
|
@@ -46,6 +48,10 @@ task
|
|
|
46
48
|
- Telemetry không lưu prompt hoặc tool output thô. Nó lưu hash, kích thước, tool,
|
|
47
49
|
model, thinking, active-tool count, usage, retrieval confidence và đường dẫn
|
|
48
50
|
tương đối đã được guard redaction.
|
|
51
|
+
- Mỗi telemetry row có provenance envelope do writer đóng sau payload; event
|
|
52
|
+
không thể ghi đè schema/provenance. Nếu source snapshot phải redact, receipt
|
|
53
|
+
chỉ giữ `sanitizedContentDigest` và `fileContentHash` trên nội dung đã sanitize;
|
|
54
|
+
raw-content digest không được tính hoặc lưu.
|
|
49
55
|
|
|
50
56
|
Bốn cơ chế `PIAGENT_DYNAMIC_TOOLS`, `PIAGENT_AUTO_CONTEXT`,
|
|
51
57
|
`PIAGENT_CONTEXT_TELEMETRY` và `PIAGENT_AUTO_RECOVERY` đều **bật mặc định**.
|
|
@@ -180,7 +186,9 @@ không bị trừ điểm. `contextSelections`, `contextSelectionsUsed` và
|
|
|
180
186
|
ranking. Runtime chỉ đọc phần đuôi telemetry có giới hạn khi tính report hoặc
|
|
181
187
|
feedback, nên lịch sử dài không làm chậm từng prompt theo thời gian.
|
|
182
188
|
|
|
183
|
-
`contextWasteScore` nằm trong khoảng `0..100`,
|
|
189
|
+
Khi toàn bộ evidence lane đầy đủ, `contextWasteScore` nằm trong khoảng `0..100`,
|
|
190
|
+
thấp hơn là tốt hơn. Nếu coverage chưa đầy đủ, score chính là `null` và chỉ
|
|
191
|
+
`contextWasteScoreEstimate` được giữ như chẩn đoán partial:
|
|
184
192
|
|
|
185
193
|
```text
|
|
186
194
|
30% duplicate read rate
|
|
@@ -36,7 +36,11 @@ Trước task lớn/risk cao trong Pi TUI:
|
|
|
36
36
|
/context compact
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
Với task/phase tiếp theo trong cùng phiên hiển thị, runtime tự tạo working set
|
|
40
|
+
gọn trước mỗi provider call; người dùng không phải mở session mới chỉ để đổi từ
|
|
41
|
+
scout sang plan, implement hay verify. `/fresh task`, `/fresh scout` và
|
|
42
|
+
`/fresh be-to-fe` vẫn là đường phục hồi tường minh khi preflight xác định input
|
|
43
|
+
quá lớn hoặc working set không thể rút gọn an toàn.
|
|
40
44
|
|
|
41
45
|
## Context manifest
|
|
42
46
|
|
|
@@ -68,6 +72,38 @@ Pi settings template dùng:
|
|
|
68
72
|
}
|
|
69
73
|
```
|
|
70
74
|
|
|
75
|
+
Host compaction trên chỉ là overflow guard. Adaptive context governor của
|
|
76
|
+
Piagent chạy sớm hơn và không đổi model/thinking:
|
|
77
|
+
|
|
78
|
+
- phát hiện ranh giới task/phase, context pressure, số tool round, read-output
|
|
79
|
+
cũ và kết quả lặp;
|
|
80
|
+
- giữ yêu cầu/quyết định gần nhất của người dùng, Task Contract, acceptance
|
|
81
|
+
criteria, changed files, verifier và lỗi chưa giải quyết;
|
|
82
|
+
- bỏ raw read/test log cũ khỏi provider working set nhưng giữ nguyên transcript
|
|
83
|
+
hiển thị và audit source;
|
|
84
|
+
- giữ nguyên nhóm assistant tool-call/tool-result để không tạo orphan protocol;
|
|
85
|
+
- giữ nguyên tối thiểu 6 nhóm ranh giới gần nhất; nếu transcript hoặc projected
|
|
86
|
+
candidate đã có orphan tool message thì fail closed và không thay context;
|
|
87
|
+
- chỉ project khi ước tính tiết kiệm đạt ngưỡng thích ứng: ít nhất 8K token,
|
|
88
|
+
15% transcript occupancy và không đòi quá 20K; không đạt thì no-op thay vì gọi
|
|
89
|
+
thêm một model summarizer có phí;
|
|
90
|
+
- chỉ ghi durable compaction sau khi agent đã settled; coding task dùng summary
|
|
91
|
+
deterministic từ state/file-backed evidence để không tốn thêm model call;
|
|
92
|
+
- trước khi lặp exact verifier, dùng current-tree gate: một durable pass trên
|
|
93
|
+
cùng working-tree digest được tái sử dụng bằng receipt nhỏ thay vì chạy lại.
|
|
94
|
+
Code đổi, pass thiếu/stale, test từng fail, hoặc operator yêu cầu chạy lại thì
|
|
95
|
+
verifier thật vẫn chạy;
|
|
96
|
+
- giữ model summarizer cho thảo luận không có Task Contract và ít tool evidence,
|
|
97
|
+
nơi sắc thái hội thoại quan trọng hơn tiết kiệm tuyệt đối.
|
|
98
|
+
|
|
99
|
+
Telemetry tách `contextOccupancy` (working set ước tính/được provider báo) khỏi
|
|
100
|
+
`billedTraffic` (input/output/cache thực sự đo được). Vì context hook không có
|
|
101
|
+
usage hóa đơn theo lần gọi, runtime không được suy diễn hai con số này là một.
|
|
102
|
+
|
|
103
|
+
Mốc vận hành hiện tại bắt đầu tạo áp lực ở khoảng 160K token, giữ provider prompt
|
|
104
|
+
dưới 240K khi có thể và chủ động tránh vùng pricing 272K+. Đây là giới hạn
|
|
105
|
+
working set, không phải giới hạn năng lực hay context window của model.
|
|
106
|
+
|
|
71
107
|
## Rule
|
|
72
108
|
|
|
73
109
|
- Nếu task là read-only, không mở write-capable prompt.
|
|
@@ -15,9 +15,9 @@ Repo này phải chạy được cho nhiều project/domain khác nhau. Vì vậ
|
|
|
15
15
|
|
|
16
16
|
| Use case | Package source |
|
|
17
17
|
|---|---|
|
|
18
|
-
| Team pinned release | `git:github.com/Vt-mmm/piagent@v1.
|
|
18
|
+
| Team pinned release | `git:github.com/Vt-mmm/piagent@v1.6.1` |
|
|
19
19
|
| Personal/sandbox dev | `git:github.com/Vt-mmm/piagent` |
|
|
20
|
-
| Registry distribution | `npm:@piagent/platform@1.
|
|
20
|
+
| Registry distribution | `npm:@piagent/platform@1.6.1` |
|
|
21
21
|
| Enterprise npm (fork under another scope) | `npm:@your-scope/platform@x.y.z` |
|
|
22
22
|
| Local platform dev | `/path/to/piagent` |
|
|
23
23
|
|
|
@@ -27,7 +27,7 @@ Latest tiện cho máy cá nhân muốn nhận cập nhật nhanh. Pin tag/commi
|
|
|
27
27
|
|
|
28
28
|
| Channel | Command | Target | Policy |
|
|
29
29
|
|---|---|---|---|
|
|
30
|
-
| `stable` | `bash scripts/install-global.sh --stable` | Helper release tag resolved to commit SHA, currently `v1.
|
|
30
|
+
| `stable` | `bash scripts/install-global.sh --stable` | Helper release tag resolved to commit SHA, currently `v1.6.1` | Install the Pi package matching the helper. |
|
|
31
31
|
| `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. |
|
|
32
32
|
| `dev` | `bash scripts/install-global.sh --dev` | Moving Git source | Personal/sandbox only; do not commit into project settings. |
|
|
33
33
|
| `local` | `bash scripts/install-global.sh --local` | Current checkout path | Platform development only. |
|
|
@@ -54,7 +54,7 @@ Root `package.json` có `pi` manifest trỏ tới:
|
|
|
54
54
|
Do đó team có thể:
|
|
55
55
|
|
|
56
56
|
```bash
|
|
57
|
-
pi install git:github.com/Vt-mmm/piagent@v1.
|
|
57
|
+
pi install git:github.com/Vt-mmm/piagent@v1.6.1
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
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.
|
|
@@ -66,12 +66,12 @@ Team nên install global package một lần:
|
|
|
66
66
|
```bash
|
|
67
67
|
node --version # >= 22.19.0
|
|
68
68
|
npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.84.1
|
|
69
|
-
npm install -g --ignore-scripts @piagent/platform@1.
|
|
69
|
+
npm install -g --ignore-scripts @piagent/platform@1.6.1
|
|
70
70
|
piagent-install --stable --dry-run
|
|
71
71
|
piagent-install --stable
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
`pi install git:github.com/Vt-mmm/piagent@v1.
|
|
74
|
+
`pi install git:github.com/Vt-mmm/piagent@v1.6.1` 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.6.1`.
|
|
75
75
|
|
|
76
76
|
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).
|
|
77
77
|
|
|
@@ -121,7 +121,7 @@ Nếu muốn commit sẵn `.pi/piagent-profile.json` vào repo hoặc bootstrap
|
|
|
121
121
|
```bash
|
|
122
122
|
bash scripts/setup.sh /path/to/project \
|
|
123
123
|
--profile be-readonly-fe \
|
|
124
|
-
--package-source git:github.com/Vt-mmm/piagent@v1.
|
|
124
|
+
--package-source git:github.com/Vt-mmm/piagent@v1.6.1 \
|
|
125
125
|
--mcp-preset core \
|
|
126
126
|
--subagents-preset safe
|
|
127
127
|
```
|
package/docs/en/architecture.md
CHANGED
|
@@ -44,6 +44,7 @@ The machine-readable rule is `architecture/layers.json`; `npm run architecture:c
|
|
|
44
44
|
| Security foundation | `packages/piagent-core/security/` | Sensitive-data primitives | Workflow behavior |
|
|
45
45
|
| Benchmark | `packages/piagent-core/benchmark/`, `benchmarks/` | Suite validation, scoring, evidence | Runtime enforcement |
|
|
46
46
|
| WebUI contracts | `packages/piagent-webui/contracts/` | Wire types shared by browser and server | Any runtime behavior; it depends on nothing |
|
|
47
|
+
| WebUI shared | `packages/piagent-webui/shared/` | Dependency-free deterministic helpers shared by browser, server, and gateway | Browser state, transport, filesystem access, or runtime policy |
|
|
47
48
|
| WebUI client | `packages/piagent-webui/client/` | Browser views, view models, UI preferences | Server state, filesystem, Pi APIs |
|
|
48
49
|
| WebUI server | `packages/piagent-webui/server/` | HTTP/WS endpoints, session reads, diff assembly | Browser rendering; it may not import the client |
|
|
49
50
|
| WebUI extension | `packages/piagent-webui/extension/` | The in-Pi `/piagent-webui` command surface | Wire types the client also needs |
|
|
@@ -93,10 +94,23 @@ the verified journal second; corruption blocks automatic resume for review.
|
|
|
93
94
|
The journal hash chain and acceptance receipts are same-runtime operational
|
|
94
95
|
evidence, not independent attestation or a separate audit authority.
|
|
95
96
|
|
|
97
|
+
The Gateway binds each browser send to one operation lifecycle shared by the
|
|
98
|
+
stream and supervisor. It permits at most one pristine provider retry within an
|
|
99
|
+
8-second delay, and refuses replay after any visible assistant output or tool
|
|
100
|
+
call. Compaction has a separate phase, terminal settlement is emitted once, and
|
|
101
|
+
post-settlement events cannot put the UI back into `Working`. A bounded local
|
|
102
|
+
emission guard removes repeated/filler activity or reviewer notes, while final
|
|
103
|
+
assistant messages always bypass that guard.
|
|
104
|
+
|
|
105
|
+
Exact edits and local patches may also bind to the full-file digest from the
|
|
106
|
+
latest successful read in the same task run. Proven concurrent drift blocks the
|
|
107
|
+
whole mutation before the first hunk and requires one fresh read; an unobserved
|
|
108
|
+
file retains the host's normal exact-anchor behavior.
|
|
109
|
+
|
|
96
110
|
Recovery is classification-driven and bounded across task attempts. Only an
|
|
97
|
-
|
|
111
|
+
evidence-backed source-owned failure may receive one repair pass; transient verifier or
|
|
98
112
|
provider failures receive at most one exact retry and never source-mutation
|
|
99
|
-
authority. Environment, permission, policy,
|
|
113
|
+
authority. Environment, permission, protected-path policy, and unknown failures stay
|
|
100
114
|
non-mutating. `PIAGENT_AUTO_RECOVERY=off` restores ordinary P3 handoff behavior
|
|
101
115
|
without migrating state. Every final path writes a redacted Handoff v1
|
|
102
116
|
projection from operational truth. Resume binds task/session identity, journal
|
|
@@ -110,7 +124,7 @@ Semantic specialist review is a separate strict-high-risk CAP-13 path, not a
|
|
|
110
124
|
universal parser-driven recovery path. It is pinned to one shared continuation,
|
|
111
125
|
one current-tree diff, two targeted reads, exact eligible source/test paths, and
|
|
112
126
|
the configured verifier after any mutation. Denied, failed, no-op, stale,
|
|
113
|
-
|
|
127
|
+
target-unresolved, unsupported, or exhausted work locks the opportunity and hands
|
|
114
128
|
off. Broad-default observation/advice never schedules this review or blocks a
|
|
115
129
|
tool call.
|
|
116
130
|
|
|
@@ -126,7 +140,7 @@ Task Contract v2 also carries an additive Criterion Graph v1 planning
|
|
|
126
140
|
projection. It maps every operator criterion exactly once to a closed planning
|
|
127
141
|
kind, scoped target hints, proof kinds, and dependency order. The graph has no
|
|
128
142
|
`satisfied` state and cannot override acceptance or exact-verifier truth. It
|
|
129
|
-
selects relevant
|
|
143
|
+
selects relevant focus-ranked context before older observations, survives
|
|
130
144
|
compaction/resume by digest, and adds no tool-schema change or provider follow-up
|
|
131
145
|
turn. `PIAGENT_INTELLIGENCE_ENGINE=off` selects the mechanical control for
|
|
132
146
|
causal tests and emergency rollback; new tasks otherwise use the criterion
|
|
@@ -165,17 +179,17 @@ authority, and combined automatic dispatch authority is capped at one unit per
|
|
|
165
179
|
task. These interaction checks are snapshot-bound and cannot change the
|
|
166
180
|
provider-visible tool schema.
|
|
167
181
|
|
|
168
|
-
Piagent-owned helpers use RolePolicy v1 and HelperRequest
|
|
169
|
-
a hashed session/task identity, bounded objective, read
|
|
182
|
+
Piagent-owned helpers use RolePolicy v1 and HelperRequest v2. The request binds
|
|
183
|
+
a hashed session/task identity, bounded objective, read-only scope, exact tool
|
|
170
184
|
allowlist, authenticated model/effort source, context/time/call ceilings, output
|
|
171
185
|
schema, stopping rule, approval restrictions, and deduplication key. Read-only
|
|
172
|
-
roles cannot receive mutation tools
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
186
|
+
roles cannot receive mutation tools, and worker dispatch is disabled.
|
|
187
|
+
`PIAGENT_HELPERS_MODE=off|recommend|on` defaults to `off`; `on` is explicit
|
|
188
|
+
opt-in but still requires two independent lanes and at least 30% projected net
|
|
189
|
+
token saving. CAP-14 and the lower-level owner budget enforce one fresh read-only
|
|
190
|
+
helper total and concurrent, zero writers, zero retries, eight calls, and at most
|
|
191
|
+
2,048 transferred context tokens. Failed or expired work consumes the only slot,
|
|
192
|
+
and late work is cancelled when the
|
|
179
193
|
parent Task Contract becomes terminal. It does not claim control over unrelated
|
|
180
194
|
Pi sessions or account usage, and never changes the user-pinned parent model.
|
|
181
195
|
Dispatch enforces the request's time, call, and token ceilings at result merge:
|