@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,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"projectId": "generic-project",
|
|
4
|
+
"displayName": "Generic Project",
|
|
5
|
+
"mode": "generic",
|
|
6
|
+
"permissionProfile": "workspace-write",
|
|
7
|
+
"rootMarkers": [
|
|
8
|
+
"AGENTS.md",
|
|
9
|
+
"README.md",
|
|
10
|
+
"package.json",
|
|
11
|
+
"pyproject.toml",
|
|
12
|
+
"go.mod"
|
|
13
|
+
],
|
|
14
|
+
"protectedPaths": "not-an-array",
|
|
15
|
+
"requiredContext": [
|
|
16
|
+
"AGENTS.md",
|
|
17
|
+
".pi/project-context.md",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"taskModes": {
|
|
21
|
+
"readOnly": {
|
|
22
|
+
"tools": [
|
|
23
|
+
"read",
|
|
24
|
+
"grep",
|
|
25
|
+
"find",
|
|
26
|
+
"ls"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"sourceWrite": {
|
|
30
|
+
"requiresPlan": true,
|
|
31
|
+
"requiresVerify": true
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"verifyCommands": {
|
|
35
|
+
"docsOnly": [
|
|
36
|
+
"test -s README.md"
|
|
37
|
+
],
|
|
38
|
+
"source": [
|
|
39
|
+
"echo 'No project verify command configured; update .pi/piagent-profile.json'"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"mcpCapabilities": [
|
|
43
|
+
"filesystem-readonly",
|
|
44
|
+
"filesystem-write",
|
|
45
|
+
"shell",
|
|
46
|
+
"memory"
|
|
47
|
+
],
|
|
48
|
+
"capabilityPacks": [
|
|
49
|
+
{
|
|
50
|
+
"name": "engineering-base",
|
|
51
|
+
"version": "0.1.1"
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
"capabilityPolicy": {
|
|
55
|
+
"allowedOwners": [
|
|
56
|
+
"platform-maintainers"
|
|
57
|
+
],
|
|
58
|
+
"allowedLifecycles": [
|
|
59
|
+
"experimental"
|
|
60
|
+
],
|
|
61
|
+
"allowedFilesystemRead": [
|
|
62
|
+
"**/*"
|
|
63
|
+
],
|
|
64
|
+
"allowedFilesystemWrite": [
|
|
65
|
+
"**/*"
|
|
66
|
+
],
|
|
67
|
+
"allowedNetworkDomains": [],
|
|
68
|
+
"allowedExternalActions": []
|
|
69
|
+
},
|
|
70
|
+
"memory": {
|
|
71
|
+
"enabled": true,
|
|
72
|
+
"mode": "manual",
|
|
73
|
+
"scope": "project",
|
|
74
|
+
"summaryFile": ".pi/memory/memory_summary.md",
|
|
75
|
+
"handbookFile": ".pi/memory/MEMORY.md",
|
|
76
|
+
"localDir": ".pi/memory/local",
|
|
77
|
+
"readBeforeTask": true,
|
|
78
|
+
"writePolicy": "explicit-only",
|
|
79
|
+
"maxInjectedChars": 4000,
|
|
80
|
+
"externalPackages": []
|
|
81
|
+
},
|
|
82
|
+
"runtimePolicy": {
|
|
83
|
+
"execPolicy": "enforce",
|
|
84
|
+
"contextBudget": "enforce",
|
|
85
|
+
"toolRegistry": "advisory",
|
|
86
|
+
"finalGate": "enforce"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"projectId": "generic-project",
|
|
4
|
+
"displayName": "Generic Project",
|
|
5
|
+
"mode": "generic",
|
|
6
|
+
"permissionProfile": "workspace-write",
|
|
7
|
+
"rootMarkers": [
|
|
8
|
+
"AGENTS.md",
|
|
9
|
+
"README.md",
|
|
10
|
+
"package.json",
|
|
11
|
+
"pyproject.toml",
|
|
12
|
+
"go.mod"
|
|
13
|
+
],
|
|
14
|
+
"protectedPaths": [
|
|
15
|
+
".git/**",
|
|
16
|
+
"**/auth.json",
|
|
17
|
+
"**/.env",
|
|
18
|
+
"**/.env.*",
|
|
19
|
+
"**/node_modules/**",
|
|
20
|
+
"**/dist/**"
|
|
21
|
+
],
|
|
22
|
+
"requiredContext": [
|
|
23
|
+
"AGENTS.md",
|
|
24
|
+
".pi/project-context.md",
|
|
25
|
+
"README.md"
|
|
26
|
+
],
|
|
27
|
+
"taskModes": {
|
|
28
|
+
"readOnly": {
|
|
29
|
+
"tools": [
|
|
30
|
+
"read",
|
|
31
|
+
"grep",
|
|
32
|
+
"find",
|
|
33
|
+
"ls"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"sourceWrite": {
|
|
37
|
+
"requiresPlan": true,
|
|
38
|
+
"requiresVerify": true
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"verifyCommands": {
|
|
42
|
+
"docsOnly": [
|
|
43
|
+
"test -s README.md"
|
|
44
|
+
],
|
|
45
|
+
"source": [
|
|
46
|
+
"echo 'No project verify command configured; update .pi/piagent-profile.json'"
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"mcpCapabilities": [
|
|
50
|
+
"filesystem-readonly",
|
|
51
|
+
"filesystem-write",
|
|
52
|
+
"shell",
|
|
53
|
+
"memory"
|
|
54
|
+
],
|
|
55
|
+
"capabilityPacks": [
|
|
56
|
+
{
|
|
57
|
+
"name": "engineering-base",
|
|
58
|
+
"version": "0.1.1"
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"capabilityPolicy": {
|
|
62
|
+
"allowedOwners": [
|
|
63
|
+
"platform-maintainers"
|
|
64
|
+
],
|
|
65
|
+
"allowedLifecycles": [
|
|
66
|
+
"experimental"
|
|
67
|
+
],
|
|
68
|
+
"allowedFilesystemRead": [
|
|
69
|
+
"**/*"
|
|
70
|
+
],
|
|
71
|
+
"allowedFilesystemWrite": [
|
|
72
|
+
"**/*"
|
|
73
|
+
],
|
|
74
|
+
"allowedNetworkDomains": [],
|
|
75
|
+
"allowedExternalActions": []
|
|
76
|
+
},
|
|
77
|
+
"memory": {
|
|
78
|
+
"enabled": true,
|
|
79
|
+
"mode": "manual",
|
|
80
|
+
"scope": "project",
|
|
81
|
+
"summaryFile": ".pi/memory/memory_summary.md",
|
|
82
|
+
"handbookFile": ".pi/memory/MEMORY.md",
|
|
83
|
+
"localDir": ".pi/memory/local",
|
|
84
|
+
"readBeforeTask": true,
|
|
85
|
+
"writePolicy": "explicit-only",
|
|
86
|
+
"maxInjectedChars": 4000,
|
|
87
|
+
"externalPackages": []
|
|
88
|
+
},
|
|
89
|
+
"runtimePolicy": {
|
|
90
|
+
"execPolicy": "enforce",
|
|
91
|
+
"contextBudget": "enforce",
|
|
92
|
+
"toolRegistry": "advisory",
|
|
93
|
+
"finalGate": "enforce"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"summary": "Replace with one-sentence task outcome.",
|
|
3
|
+
"riskLane": "normal",
|
|
4
|
+
"expectedOutput": "Replace with exact artifact or behavior expected.",
|
|
5
|
+
"acceptanceCriteria": [
|
|
6
|
+
"Replace with pass/fail criterion."
|
|
7
|
+
],
|
|
8
|
+
"scope": [
|
|
9
|
+
"replace/with/allowed/path/**"
|
|
10
|
+
],
|
|
11
|
+
"outOfScope": [
|
|
12
|
+
"Replace with explicit non-goal."
|
|
13
|
+
],
|
|
14
|
+
"protectedPaths": [],
|
|
15
|
+
"requiredContext": [],
|
|
16
|
+
"contextManifest": [],
|
|
17
|
+
"memoryCitations": [],
|
|
18
|
+
"mcpCapabilities": [],
|
|
19
|
+
"verifyCommands": [
|
|
20
|
+
"Replace with verify command."
|
|
21
|
+
],
|
|
22
|
+
"workPlan": [
|
|
23
|
+
{
|
|
24
|
+
"id": "plan",
|
|
25
|
+
"title": "Confirm scope, context, acceptance criteria, and verify gate before editing.",
|
|
26
|
+
"role": "parent",
|
|
27
|
+
"mode": "read-only",
|
|
28
|
+
"status": "pending"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"id": "implement",
|
|
32
|
+
"title": "Implement the approved bounded change.",
|
|
33
|
+
"role": "parent",
|
|
34
|
+
"mode": "single-writer",
|
|
35
|
+
"status": "pending",
|
|
36
|
+
"dependsOn": [
|
|
37
|
+
"plan"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"id": "review",
|
|
42
|
+
"title": "Run explicit review lenses against the diff and verify evidence.",
|
|
43
|
+
"role": "piagent-reviewer",
|
|
44
|
+
"mode": "review",
|
|
45
|
+
"status": "pending",
|
|
46
|
+
"dependsOn": [
|
|
47
|
+
"implement"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"reviewLenses": [
|
|
52
|
+
"correctness",
|
|
53
|
+
"tests",
|
|
54
|
+
"scope"
|
|
55
|
+
],
|
|
56
|
+
"orchestration": {
|
|
57
|
+
"mode": "solo-first",
|
|
58
|
+
"subagents": "not-used",
|
|
59
|
+
"reason": "Task starts in solo-first mode; use bounded subagents only for independent scout, planning, or review work.",
|
|
60
|
+
"fieldGuidePath": ".pi/memory/MEMORY.md",
|
|
61
|
+
"modelRoles": {
|
|
62
|
+
"planner": "Use the strongest available model for decomposition, architecture, risk, and acceptance criteria.",
|
|
63
|
+
"worker": "Use the fastest reliable model for a bounded, already-planned single write set.",
|
|
64
|
+
"reviewer": "Use a model or thinking setting decorrelated from the worker when review quality matters.",
|
|
65
|
+
"watchdog": "Use a strong model only for final risk review, security, release, or high-impact changes."
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"changedFiles": [],
|
|
69
|
+
"verifyEvidence": [],
|
|
70
|
+
"trace": {
|
|
71
|
+
"outcome": "pending"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"taskId": "TASK-0001",
|
|
3
|
+
"summary": "Replace with one-sentence task outcome.",
|
|
4
|
+
"riskLane": "normal",
|
|
5
|
+
"expectedOutput": "Replace with exact artifact or behavior expected.",
|
|
6
|
+
"acceptanceCriteria": [
|
|
7
|
+
"Replace with pass/fail criterion."
|
|
8
|
+
],
|
|
9
|
+
"scope": [
|
|
10
|
+
"replace/with/allowed/path/**"
|
|
11
|
+
],
|
|
12
|
+
"outOfScope": [
|
|
13
|
+
"Replace with explicit non-goal."
|
|
14
|
+
],
|
|
15
|
+
"protectedPaths": [],
|
|
16
|
+
"requiredContext": [],
|
|
17
|
+
"contextManifest": [],
|
|
18
|
+
"memoryCitations": [],
|
|
19
|
+
"mcpCapabilities": [],
|
|
20
|
+
"verifyCommands": [
|
|
21
|
+
"Replace with verify command."
|
|
22
|
+
],
|
|
23
|
+
"workPlan": [
|
|
24
|
+
{
|
|
25
|
+
"id": "plan",
|
|
26
|
+
"title": "Confirm scope, context, acceptance criteria, and verify gate before editing.",
|
|
27
|
+
"role": "parent",
|
|
28
|
+
"mode": "read-only",
|
|
29
|
+
"status": "pending"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"id": "implement",
|
|
33
|
+
"title": "Implement the approved bounded change.",
|
|
34
|
+
"role": "parent",
|
|
35
|
+
"mode": "single-writer",
|
|
36
|
+
"status": "pending",
|
|
37
|
+
"dependsOn": [
|
|
38
|
+
"plan"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"id": "review",
|
|
43
|
+
"title": "Run explicit review lenses against the diff and verify evidence.",
|
|
44
|
+
"role": "piagent-reviewer",
|
|
45
|
+
"mode": "review",
|
|
46
|
+
"status": "pending",
|
|
47
|
+
"dependsOn": [
|
|
48
|
+
"implement"
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"reviewLenses": [
|
|
53
|
+
"correctness",
|
|
54
|
+
"tests",
|
|
55
|
+
"scope"
|
|
56
|
+
],
|
|
57
|
+
"orchestration": {
|
|
58
|
+
"mode": "solo-first",
|
|
59
|
+
"subagents": "not-used",
|
|
60
|
+
"reason": "Task starts in solo-first mode; use bounded subagents only for independent scout, planning, or review work.",
|
|
61
|
+
"fieldGuidePath": ".pi/memory/MEMORY.md",
|
|
62
|
+
"modelRoles": {
|
|
63
|
+
"planner": "Use the strongest available model for decomposition, architecture, risk, and acceptance criteria.",
|
|
64
|
+
"worker": "Use the fastest reliable model for a bounded, already-planned single write set.",
|
|
65
|
+
"reviewer": "Use a model or thinking setting decorrelated from the worker when review quality matters.",
|
|
66
|
+
"watchdog": "Use a strong model only for final risk review, security, release, or high-impact changes."
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"changedFiles": [],
|
|
70
|
+
"verifyEvidence": [],
|
|
71
|
+
"trace": {
|
|
72
|
+
"outcome": "pending"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "enforcement-decisions",
|
|
3
|
+
"description": "Golden decisions for the rules the guard exists to enforce. Cases run against the shipped base policy rather than a copy, so weakening the policy fails here. Each case names the invariant it protects so a future change has to argue with the rule rather than with a recorded output.",
|
|
4
|
+
"policySource": "packages/piagent-core/policies/base-policy.json",
|
|
5
|
+
"requiredPolicyEntries": {
|
|
6
|
+
"protectedPaths": [
|
|
7
|
+
".git/**",
|
|
8
|
+
"**/auth.json",
|
|
9
|
+
"**/.env",
|
|
10
|
+
"**/.env.*",
|
|
11
|
+
"**/node_modules/**",
|
|
12
|
+
".pi/piagent-state/**",
|
|
13
|
+
".pi/piagent-profile.json"
|
|
14
|
+
],
|
|
15
|
+
"shellProtectedPaths": [
|
|
16
|
+
".git/**",
|
|
17
|
+
"**/auth.json",
|
|
18
|
+
"**/.env",
|
|
19
|
+
"**/.env.*",
|
|
20
|
+
".pi/piagent-state/**",
|
|
21
|
+
".pi/piagent-profile.json"
|
|
22
|
+
],
|
|
23
|
+
"blockedCommandPatterns": [
|
|
24
|
+
"rm -rf /",
|
|
25
|
+
"rm -rf ~",
|
|
26
|
+
"rm -rf $HOME",
|
|
27
|
+
"git reset --hard",
|
|
28
|
+
"git clean -fd",
|
|
29
|
+
"sudo ",
|
|
30
|
+
"chmod -R 777"
|
|
31
|
+
],
|
|
32
|
+
"requireConfirmationPatterns": [
|
|
33
|
+
"deploy",
|
|
34
|
+
"release",
|
|
35
|
+
"publish",
|
|
36
|
+
"migration",
|
|
37
|
+
"terraform apply",
|
|
38
|
+
"kubectl apply",
|
|
39
|
+
"gh pr merge",
|
|
40
|
+
"git push"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"protectedPathCases": [
|
|
44
|
+
{
|
|
45
|
+
"invariant": "credential files are protected wherever they sit",
|
|
46
|
+
"path": "src/config/.env",
|
|
47
|
+
"expectProtected": true
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"invariant": "dotenv variants are protected too",
|
|
51
|
+
"path": ".env.production",
|
|
52
|
+
"expectProtected": true
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"invariant": "git internals are never writable",
|
|
56
|
+
"path": ".git/config",
|
|
57
|
+
"expectProtected": true
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"invariant": "auth tokens are protected at any depth",
|
|
61
|
+
"path": "packages/app/auth.json",
|
|
62
|
+
"expectProtected": true
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"invariant": "the profile cannot rewrite itself",
|
|
66
|
+
"path": ".pi/piagent-profile.json",
|
|
67
|
+
"expectProtected": true
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"invariant": "guard state is not editable by the agent",
|
|
71
|
+
"path": ".pi/piagent-state/tasks/one.json",
|
|
72
|
+
"expectProtected": true
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"invariant": "ordinary source stays writable",
|
|
76
|
+
"path": "src/index.ts",
|
|
77
|
+
"expectProtected": false
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"invariant": "documentation stays writable",
|
|
81
|
+
"path": "docs/architecture.md",
|
|
82
|
+
"expectProtected": false
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"invariant": "a filename merely containing env is not protected",
|
|
86
|
+
"path": "src/environment.ts",
|
|
87
|
+
"expectProtected": false
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"shellCommandCases": [
|
|
91
|
+
{
|
|
92
|
+
"invariant": "reading a protected file through the shell is still a protected-path access",
|
|
93
|
+
"command": "cat .env",
|
|
94
|
+
"expectProtectedPath": ".env",
|
|
95
|
+
"via": "literal"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"invariant": "redirection into a protected file is caught",
|
|
99
|
+
"command": "echo x > .env.local",
|
|
100
|
+
"expectProtectedPath": ".env.local",
|
|
101
|
+
"via": "literal"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"invariant": "a glob that would reach credentials is caught",
|
|
105
|
+
"command": "cat ./*.env",
|
|
106
|
+
"expectProtectedPath": "*.env",
|
|
107
|
+
"via": "glob"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"invariant": "protected paths behind a pipe are still seen",
|
|
111
|
+
"command": "grep TOKEN .env | head",
|
|
112
|
+
"expectProtectedPath": ".env",
|
|
113
|
+
"via": "literal"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"invariant": "chained commands do not hide a protected read",
|
|
117
|
+
"command": "ls && cat packages/app/auth.json",
|
|
118
|
+
"expectProtectedPath": "packages/app/auth.json",
|
|
119
|
+
"via": "literal"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"invariant": "unrelated commands are left alone",
|
|
123
|
+
"command": "npm run build",
|
|
124
|
+
"expectProtectedPath": null,
|
|
125
|
+
"via": "literal"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"invariant": "reading ordinary source is not a protected access",
|
|
129
|
+
"command": "cat src/index.ts",
|
|
130
|
+
"expectProtectedPath": null,
|
|
131
|
+
"via": "literal"
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
"execDecisionCases": [
|
|
135
|
+
{
|
|
136
|
+
"invariant": "recursive removal of the filesystem root is refused",
|
|
137
|
+
"command": "rm -rf /",
|
|
138
|
+
"expectDecision": "forbid"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"invariant": "recursive removal of the home directory is refused even when spelled as a variable",
|
|
142
|
+
"command": "rm -rf $HOME",
|
|
143
|
+
"expectDecision": "forbid"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"invariant": "privilege escalation is refused",
|
|
147
|
+
"command": "sudo rm file",
|
|
148
|
+
"expectDecision": "forbid"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"invariant": "discarding uncommitted work is refused",
|
|
152
|
+
"command": "git reset --hard HEAD~1",
|
|
153
|
+
"expectDecision": "forbid"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"invariant": "deleting untracked files is refused",
|
|
157
|
+
"command": "git clean -fd",
|
|
158
|
+
"expectDecision": "forbid"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"invariant": "world-writable recursive permissions are refused",
|
|
162
|
+
"command": "chmod -R 777 .",
|
|
163
|
+
"expectDecision": "forbid"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"invariant": "pruning docker volumes is refused because the data is unrecoverable",
|
|
167
|
+
"command": "docker volume prune -f",
|
|
168
|
+
"expectDecision": "forbid"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"invariant": "a destructive command nested inside another shell is still refused",
|
|
172
|
+
"command": "bash -c 'rm -rf /'",
|
|
173
|
+
"expectDecision": "forbid"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"invariant": "a destructive command after a harmless one is still refused",
|
|
177
|
+
"command": "echo hi && rm -rf /",
|
|
178
|
+
"expectDecision": "forbid"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"invariant": "pushing to a remote needs human confirmation",
|
|
182
|
+
"command": "git push origin main",
|
|
183
|
+
"expectDecision": "prompt"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"invariant": "deploying needs human confirmation",
|
|
187
|
+
"command": "npm run deploy",
|
|
188
|
+
"expectDecision": "prompt"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"invariant": "database migrations need human confirmation",
|
|
192
|
+
"command": "npx prisma migrate deploy",
|
|
193
|
+
"expectDecision": "prompt"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"invariant": "broad staging needs confirmation because it can sweep in unrelated changes",
|
|
197
|
+
"command": "git add -A",
|
|
198
|
+
"expectDecision": "prompt"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"invariant": "building is ordinary work and is not gated",
|
|
202
|
+
"command": "npm run build",
|
|
203
|
+
"expectDecision": "allow"
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"invariant": "running tests is ordinary work and is not gated",
|
|
207
|
+
"command": "npm test",
|
|
208
|
+
"expectDecision": "allow"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"invariant": "listing files is ordinary work and is not gated",
|
|
212
|
+
"command": "ls -la",
|
|
213
|
+
"expectDecision": "allow"
|
|
214
|
+
}
|
|
215
|
+
],
|
|
216
|
+
"verificationEvidenceCases": [
|
|
217
|
+
{
|
|
218
|
+
"invariant": "a command in the verify plan counts as verification",
|
|
219
|
+
"command": "npm test",
|
|
220
|
+
"verifyCommands": ["npm test", "npm run verify"],
|
|
221
|
+
"expectMatch": true
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"invariant": "a command outside the verify plan does not count as verification",
|
|
225
|
+
"command": "npm run build",
|
|
226
|
+
"verifyCommands": ["npm test", "npm run verify"],
|
|
227
|
+
"expectMatch": false
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"invariant": "appending arguments produces a different command and does not count",
|
|
231
|
+
"command": "npm test -- --watch",
|
|
232
|
+
"verifyCommands": ["npm test"],
|
|
233
|
+
"expectMatch": false
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"invariant": "echoing the verify command does not count as running it",
|
|
237
|
+
"command": "echo npm test",
|
|
238
|
+
"verifyCommands": ["npm test"],
|
|
239
|
+
"expectMatch": false
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"invariant": "an empty verify plan verifies nothing",
|
|
243
|
+
"command": "npm test",
|
|
244
|
+
"verifyCommands": [],
|
|
245
|
+
"expectMatch": false
|
|
246
|
+
}
|
|
247
|
+
],
|
|
248
|
+
"exitCodeCases": [
|
|
249
|
+
{
|
|
250
|
+
"invariant": "a claimed success matching the observed run is accepted",
|
|
251
|
+
"claimedExitCode": 0,
|
|
252
|
+
"observed": { "exitCode": 0 },
|
|
253
|
+
"expectMatch": true
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"invariant": "claiming success over a failed run is rejected",
|
|
257
|
+
"claimedExitCode": 0,
|
|
258
|
+
"observed": { "exitCode": 1 },
|
|
259
|
+
"expectMatch": false
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"invariant": "claiming success over an errored run is rejected",
|
|
263
|
+
"claimedExitCode": 0,
|
|
264
|
+
"observed": { "isError": true },
|
|
265
|
+
"expectMatch": false
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
"invariant": "a claimed failure matching an errored run is accepted",
|
|
269
|
+
"claimedExitCode": 1,
|
|
270
|
+
"observed": { "isError": true },
|
|
271
|
+
"expectMatch": true
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"invariant": "an absent claim is never treated as verified",
|
|
275
|
+
"claimedExitCode": null,
|
|
276
|
+
"observed": { "exitCode": 0 },
|
|
277
|
+
"expectMatch": false
|
|
278
|
+
}
|
|
279
|
+
],
|
|
280
|
+
"contextBudgetCases": [
|
|
281
|
+
{
|
|
282
|
+
"invariant": "context files stay bounded so a large file cannot crowd out the task",
|
|
283
|
+
"key": "maxContextFileChars",
|
|
284
|
+
"maximum": 50000
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
"invariant": "memory files stay bounded and smaller than context files",
|
|
288
|
+
"key": "maxMemoryFileChars",
|
|
289
|
+
"maximum": 20000
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"invariant": "the manifest stays small enough to read",
|
|
293
|
+
"key": "maxManifestFiles",
|
|
294
|
+
"maximum": 80
|
|
295
|
+
}
|
|
296
|
+
],
|
|
297
|
+
"redactionCases": [
|
|
298
|
+
{
|
|
299
|
+
"invariant": "bearer tokens never reach storage",
|
|
300
|
+
"text": "Authorization: Bearer sk-live-0123456789abcdefghij",
|
|
301
|
+
"expectRedacted": true
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
"invariant": "assigned secrets are redacted",
|
|
305
|
+
"text": "AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMIK7MDENGbPxRfiCYEXAMPLEKEY",
|
|
306
|
+
"expectRedacted": true
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
"invariant": "a complete private key block is redacted",
|
|
310
|
+
"text": "-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEA0Z3VS5JJcds3xfn\n-----END RSA PRIVATE KEY-----",
|
|
311
|
+
"expectRedacted": true
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"invariant": "ordinary prose is left intact",
|
|
315
|
+
"text": "The build finished in 12 seconds.",
|
|
316
|
+
"expectRedacted": false
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"invariant": "naming a variable is not the same as leaking it",
|
|
320
|
+
"text": "Set API_KEY in your shell before running.",
|
|
321
|
+
"expectRedacted": false
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"invariant": "a bare private-key header without a body is not treated as key material",
|
|
325
|
+
"text": "-----BEGIN RSA PRIVATE KEY-----",
|
|
326
|
+
"expectRedacted": false
|
|
327
|
+
}
|
|
328
|
+
]
|
|
329
|
+
}
|