@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.
Files changed (159) hide show
  1. package/.gitattributes +7 -0
  2. package/AGENTS.md +31 -0
  3. package/CHANGELOG.md +296 -0
  4. package/CODE_OF_CONDUCT.md +36 -0
  5. package/CONTRIBUTING.md +66 -0
  6. package/LICENSE +21 -0
  7. package/README.md +588 -0
  8. package/SECURITY.md +38 -0
  9. package/adapters/backend-api/profile.json +88 -0
  10. package/adapters/be-readonly-fe/profile.json +120 -0
  11. package/adapters/data/profile.json +88 -0
  12. package/adapters/devops/profile.json +92 -0
  13. package/adapters/docs/profile.json +74 -0
  14. package/adapters/fullstack/profile.json +94 -0
  15. package/adapters/generic/profile.json +95 -0
  16. package/adapters/mobile/profile.json +87 -0
  17. package/adapters/node-typescript/profile.json +76 -0
  18. package/adapters/python/profile.json +75 -0
  19. package/adapters/web-frontend/profile.json +101 -0
  20. package/catalog/capabilities.json +206 -0
  21. package/docs/architecture.md +64 -0
  22. package/docs/auto-delegation-policy.md +192 -0
  23. package/docs/capability-packs.md +234 -0
  24. package/docs/command-reference-vietnamese.md +484 -0
  25. package/docs/context-window-policy.md +85 -0
  26. package/docs/distribution-standard.md +229 -0
  27. package/docs/herdr-workflow.md +58 -0
  28. package/docs/mcp-and-tools.md +316 -0
  29. package/docs/memory-policy.md +164 -0
  30. package/docs/model-options.md +165 -0
  31. package/docs/oauth-providers.md +53 -0
  32. package/docs/operator-manual-vietnamese.md +1080 -0
  33. package/docs/package-architecture-notes.md +101 -0
  34. package/docs/project-adapters.md +174 -0
  35. package/docs/project-onboarding.md +135 -0
  36. package/docs/publishing-for-teams.md +64 -0
  37. package/docs/quality-benchmark.md +74 -0
  38. package/docs/quickstart-vietnamese.md +350 -0
  39. package/docs/release-install-policy.md +223 -0
  40. package/docs/runtime-harness-standard.md +118 -0
  41. package/docs/runtime-policy-design.md +132 -0
  42. package/docs/runtime-quality-baseline.md +257 -0
  43. package/docs/security-redaction-benchmark.md +56 -0
  44. package/docs/security-threat-model.md +66 -0
  45. package/docs/subagent-orchestration-capabilities.md +104 -0
  46. package/docs/subagents-and-multiagent.md +346 -0
  47. package/docs/task-implementation-contract.md +200 -0
  48. package/docs/team-onboarding.md +333 -0
  49. package/docs/usage-observability.md +130 -0
  50. package/docs/vercel-docs-site.md +115 -0
  51. package/docs/workflow-recipes.md +125 -0
  52. package/docs-site/assets/piagent-logo.svg +35 -0
  53. package/docs-site/favicon.svg +18 -0
  54. package/docs-site/index.html +1613 -0
  55. package/docs-site/vercel.json +24 -0
  56. package/evals/fixtures/action-proposal.invalid.json +34 -0
  57. package/evals/fixtures/action-proposal.valid.json +34 -0
  58. package/evals/fixtures/capability-pack.invalid.json +123 -0
  59. package/evals/fixtures/capability-pack.valid.json +123 -0
  60. package/evals/fixtures/capability-recipe.invalid.json +81 -0
  61. package/evals/fixtures/capability-recipe.valid.json +82 -0
  62. package/evals/fixtures/context-index.invalid.json +25 -0
  63. package/evals/fixtures/context-index.valid.json +25 -0
  64. package/evals/fixtures/eval-scenario.invalid.json +40 -0
  65. package/evals/fixtures/eval-scenario.valid.json +45 -0
  66. package/evals/fixtures/project-profile.invalid.json +88 -0
  67. package/evals/fixtures/project-profile.valid.json +95 -0
  68. package/evals/fixtures/task-contract.invalid.json +73 -0
  69. package/evals/fixtures/task-contract.valid.json +74 -0
  70. package/evals/golden/enforcement-decisions.json +329 -0
  71. package/evals/scenarios/capability-resolution.json +45 -0
  72. package/package.json +132 -0
  73. package/packages/piagent-core/README.md +147 -0
  74. package/packages/piagent-core/capabilities/capability-core.js +1023 -0
  75. package/packages/piagent-core/capabilities/capability-sources.js +265 -0
  76. package/packages/piagent-core/extensions/guard-io.js +45 -0
  77. package/packages/piagent-core/extensions/guard-shell-analysis.ts +558 -0
  78. package/packages/piagent-core/extensions/guard-types.ts +406 -0
  79. package/packages/piagent-core/extensions/piagent-guard.ts +5760 -0
  80. package/packages/piagent-core/extensions/policy-core.js +1070 -0
  81. package/packages/piagent-core/extensions/redaction-core.js +4 -0
  82. package/packages/piagent-core/extensions/runtime-evidence.js +215 -0
  83. package/packages/piagent-core/package.json +46 -0
  84. package/packages/piagent-core/policies/base-policy.json +249 -0
  85. package/packages/piagent-core/prompts/be-to-fe.md +82 -0
  86. package/packages/piagent-core/prompts/commit.md +27 -0
  87. package/packages/piagent-core/prompts/discuss.md +35 -0
  88. package/packages/piagent-core/prompts/memory-policy.md +52 -0
  89. package/packages/piagent-core/prompts/model-options.md +68 -0
  90. package/packages/piagent-core/prompts/onboard-project.md +147 -0
  91. package/packages/piagent-core/prompts/piagent-commands.md +68 -0
  92. package/packages/piagent-core/prompts/plan.md +35 -0
  93. package/packages/piagent-core/prompts/platform-improve.md +69 -0
  94. package/packages/piagent-core/prompts/pr.md +26 -0
  95. package/packages/piagent-core/prompts/review.md +38 -0
  96. package/packages/piagent-core/prompts/scout.md +50 -0
  97. package/packages/piagent-core/prompts/task.md +69 -0
  98. package/packages/piagent-core/security/sensitive-data.js +187 -0
  99. package/packages/piagent-core/skills/piagent-ops/SKILL.md +44 -0
  100. package/packages/piagent-core/skills/piagent-source-cache/SKILL.md +59 -0
  101. package/packages/piagent-core/skills/piagent-source-cache/checkout-source-repo.sh +144 -0
  102. package/packages/piagent-core/subagents/piagent-oracle.md +29 -0
  103. package/packages/piagent-core/subagents/piagent-planner.md +46 -0
  104. package/packages/piagent-core/subagents/piagent-reviewer.md +48 -0
  105. package/packages/piagent-core/subagents/piagent-scout.md +37 -0
  106. package/packages/piagent-core/subagents/piagent-worker.md +44 -0
  107. package/packs/engineering-base/pack.json +123 -0
  108. package/packs/engineering-base/recipes/bounded-change.json +82 -0
  109. package/packs/web-delivery/pack.json +72 -0
  110. package/packs/web-delivery/recipes/verified-web-change.json +57 -0
  111. package/schemas/action-proposal.schema.json +90 -0
  112. package/schemas/capability-pack.schema.json +190 -0
  113. package/schemas/capability-recipe.schema.json +72 -0
  114. package/schemas/context-index.schema.json +258 -0
  115. package/schemas/eval-scenario.schema.json +67 -0
  116. package/schemas/project-profile.schema.json +555 -0
  117. package/schemas/task-contract.schema.json +314 -0
  118. package/scripts/audit-runtime-host.sh +78 -0
  119. package/scripts/bootstrap-local.sh +25 -0
  120. package/scripts/capability-catalog.mjs +290 -0
  121. package/scripts/check-runtime-advisories.mjs +114 -0
  122. package/scripts/configure-mcp.sh +301 -0
  123. package/scripts/configure-model-scope.sh +143 -0
  124. package/scripts/configure-subagents.sh +241 -0
  125. package/scripts/import-agent-instructions.mjs +199 -0
  126. package/scripts/init-project.sh +369 -0
  127. package/scripts/install-global.sh +532 -0
  128. package/scripts/link-project.sh +25 -0
  129. package/scripts/migrate-project-state.mjs +176 -0
  130. package/scripts/pi-auto.sh +79 -0
  131. package/scripts/pi-model-catalog.sh +154 -0
  132. package/scripts/pi-session-stats.sh +135 -0
  133. package/scripts/piagent-cli.mjs +53 -0
  134. package/scripts/profile-doctor.sh +238 -0
  135. package/scripts/quality-benchmark.sh +185 -0
  136. package/scripts/redaction-benchmark.mjs +227 -0
  137. package/scripts/runtime-policy-smoke.sh +48 -0
  138. package/scripts/setup.sh +425 -0
  139. package/scripts/team-doctor.sh +461 -0
  140. package/scripts/verify-local.sh +540 -0
  141. package/scripts/verify-release-identity.mjs +85 -0
  142. package/scripts/verify-vercel-link.mjs +64 -0
  143. package/templates/global/mcp.json +9 -0
  144. package/templates/global/settings.json +37 -0
  145. package/templates/project/.mcp.json +9 -0
  146. package/templates/project/.pi/context-index.json +25 -0
  147. package/templates/project/.pi/gitignore.template +22 -0
  148. package/templates/project/.pi/mcp.json +9 -0
  149. package/templates/project/.pi/memory/MEMORY.md +11 -0
  150. package/templates/project/.pi/memory/memory_summary.md +9 -0
  151. package/templates/project/.pi/piagent-profile.json +107 -0
  152. package/templates/project/.pi/project-context.md +30 -0
  153. package/templates/project/.pi/settings.json +17 -0
  154. package/templates/project/.pi/task-contract.template.json +74 -0
  155. package/templates/project/.pi/tech-context/README.md +7 -0
  156. package/templates/project/.pi/tech-stack.json +10 -0
  157. package/templates/project/AGENTS.md +34 -0
  158. package/templates/project/REVIEW_GUIDELINES.md +23 -0
  159. package/types/pi-runtime-shims.d.ts +13 -0
@@ -0,0 +1,87 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "projectId": "mobile-project",
4
+ "displayName": "Mobile Project",
5
+ "mode": "mobile",
6
+ "permissionProfile": "workspace-write",
7
+ "rootMarkers": [
8
+ "AGENTS.md",
9
+ "README.md",
10
+ "package.json",
11
+ "pubspec.yaml",
12
+ "android",
13
+ "ios"
14
+ ],
15
+ "protectedPaths": [
16
+ ".git/**",
17
+ "**/auth.json",
18
+ "**/.env",
19
+ "**/.env.*",
20
+ "**/*.keystore",
21
+ "**/*.jks",
22
+ "**/*.mobileprovision",
23
+ "**/*.p12",
24
+ "**/node_modules/**",
25
+ "**/build/**",
26
+ "**/.dart_tool/**"
27
+ ],
28
+ "requiredContext": [
29
+ "AGENTS.md",
30
+ ".pi/project-context.md",
31
+ "README.md"
32
+ ],
33
+ "taskModes": {
34
+ "readOnly": {
35
+ "tools": [
36
+ "read",
37
+ "grep",
38
+ "find",
39
+ "ls"
40
+ ]
41
+ },
42
+ "sourceWrite": {
43
+ "requiresPlan": true,
44
+ "requiresVerify": true
45
+ },
46
+ "releaseSigning": {
47
+ "requiresPlan": true,
48
+ "requiresVerify": true,
49
+ "requiresHumanGate": true
50
+ }
51
+ },
52
+ "verifyCommands": {
53
+ "docsOnly": [
54
+ "test -s README.md"
55
+ ],
56
+ "source": [
57
+ "if test -f package.json; then npm test --if-present; fi",
58
+ "if test -f pubspec.yaml && command -v flutter >/dev/null 2>&1; then flutter test; else echo 'flutter test skipped'; fi"
59
+ ]
60
+ },
61
+ "mcpCapabilities": [
62
+ "filesystem-readonly",
63
+ "filesystem-write",
64
+ "shell",
65
+ "github",
66
+ "browser",
67
+ "memory"
68
+ ],
69
+ "memory": {
70
+ "enabled": true,
71
+ "mode": "manual",
72
+ "scope": "project",
73
+ "summaryFile": ".pi/memory/memory_summary.md",
74
+ "handbookFile": ".pi/memory/MEMORY.md",
75
+ "localDir": ".pi/memory/local",
76
+ "readBeforeTask": true,
77
+ "writePolicy": "explicit-only",
78
+ "maxInjectedChars": 4000,
79
+ "externalPackages": []
80
+ },
81
+ "runtimePolicy": {
82
+ "execPolicy": "enforce",
83
+ "contextBudget": "enforce",
84
+ "toolRegistry": "advisory",
85
+ "finalGate": "enforce"
86
+ }
87
+ }
@@ -0,0 +1,76 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "projectId": "node-typescript-project",
4
+ "displayName": "Node TypeScript Project",
5
+ "mode": "node-typescript",
6
+ "permissionProfile": "workspace-write",
7
+ "rootMarkers": [
8
+ "package.json",
9
+ "tsconfig.json"
10
+ ],
11
+ "protectedPaths": [
12
+ ".git/**",
13
+ "**/auth.json",
14
+ "**/.env",
15
+ "**/.env.*",
16
+ "**/node_modules/**",
17
+ "**/dist/**",
18
+ "**/coverage/**"
19
+ ],
20
+ "requiredContext": [
21
+ "AGENTS.md",
22
+ ".pi/project-context.md",
23
+ "README.md",
24
+ "package.json",
25
+ "tsconfig.json"
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
+ "npm run type-check --if-present",
47
+ "npm run lint --if-present",
48
+ "npm test --if-present"
49
+ ]
50
+ },
51
+ "mcpCapabilities": [
52
+ "filesystem-readonly",
53
+ "filesystem-write",
54
+ "shell",
55
+ "github",
56
+ "memory"
57
+ ],
58
+ "memory": {
59
+ "enabled": true,
60
+ "mode": "manual",
61
+ "scope": "project",
62
+ "summaryFile": ".pi/memory/memory_summary.md",
63
+ "handbookFile": ".pi/memory/MEMORY.md",
64
+ "localDir": ".pi/memory/local",
65
+ "readBeforeTask": true,
66
+ "writePolicy": "explicit-only",
67
+ "maxInjectedChars": 4000,
68
+ "externalPackages": []
69
+ },
70
+ "runtimePolicy": {
71
+ "execPolicy": "enforce",
72
+ "contextBudget": "enforce",
73
+ "toolRegistry": "advisory",
74
+ "finalGate": "enforce"
75
+ }
76
+ }
@@ -0,0 +1,75 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "projectId": "python-project",
4
+ "displayName": "Python Project",
5
+ "mode": "python",
6
+ "permissionProfile": "workspace-write",
7
+ "rootMarkers": [
8
+ "pyproject.toml",
9
+ "README.md"
10
+ ],
11
+ "protectedPaths": [
12
+ ".git/**",
13
+ "**/auth.json",
14
+ "**/.env",
15
+ "**/.env.*",
16
+ "**/.venv/**",
17
+ "**/__pycache__/**",
18
+ "**/.pytest_cache/**",
19
+ "**/dist/**",
20
+ "**/build/**"
21
+ ],
22
+ "requiredContext": [
23
+ "AGENTS.md",
24
+ ".pi/project-context.md",
25
+ "README.md",
26
+ "pyproject.toml"
27
+ ],
28
+ "taskModes": {
29
+ "readOnly": {
30
+ "tools": [
31
+ "read",
32
+ "grep",
33
+ "find",
34
+ "ls"
35
+ ]
36
+ },
37
+ "sourceWrite": {
38
+ "requiresPlan": true,
39
+ "requiresVerify": true
40
+ }
41
+ },
42
+ "verifyCommands": {
43
+ "docsOnly": [
44
+ "test -s README.md"
45
+ ],
46
+ "source": [
47
+ "uv run pytest"
48
+ ]
49
+ },
50
+ "mcpCapabilities": [
51
+ "filesystem-readonly",
52
+ "filesystem-write",
53
+ "shell",
54
+ "github",
55
+ "memory"
56
+ ],
57
+ "memory": {
58
+ "enabled": true,
59
+ "mode": "manual",
60
+ "scope": "project",
61
+ "summaryFile": ".pi/memory/memory_summary.md",
62
+ "handbookFile": ".pi/memory/MEMORY.md",
63
+ "localDir": ".pi/memory/local",
64
+ "readBeforeTask": true,
65
+ "writePolicy": "explicit-only",
66
+ "maxInjectedChars": 4000,
67
+ "externalPackages": []
68
+ },
69
+ "runtimePolicy": {
70
+ "execPolicy": "enforce",
71
+ "contextBudget": "enforce",
72
+ "toolRegistry": "advisory",
73
+ "finalGate": "enforce"
74
+ }
75
+ }
@@ -0,0 +1,101 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "projectId": "web-frontend",
4
+ "displayName": "Web Frontend Project",
5
+ "mode": "web-frontend",
6
+ "permissionProfile": "workspace-write",
7
+ "rootMarkers": [
8
+ "AGENTS.md",
9
+ "package.json"
10
+ ],
11
+ "protectedPaths": [
12
+ ".git/**",
13
+ "**/auth.json",
14
+ "**/.env",
15
+ "**/.env.*",
16
+ "**/node_modules/**",
17
+ "**/dist/**",
18
+ "**/.next/**"
19
+ ],
20
+ "requiredContext": [
21
+ "AGENTS.md",
22
+ ".pi/project-context.md",
23
+ "README.md",
24
+ "package.json"
25
+ ],
26
+ "taskModes": {
27
+ "readOnly": {
28
+ "tools": [
29
+ "read",
30
+ "grep",
31
+ "find",
32
+ "ls"
33
+ ]
34
+ },
35
+ "sourceWrite": {
36
+ "requiresPlan": true,
37
+ "requiresVerify": true
38
+ }
39
+ },
40
+ "verifyCommands": {
41
+ "docsOnly": [
42
+ "test -s README.md"
43
+ ],
44
+ "source": [
45
+ "npm run type-check",
46
+ "npm run lint",
47
+ "npm test"
48
+ ],
49
+ "runtime": [
50
+ "npm run test:e2e"
51
+ ]
52
+ },
53
+ "mcpCapabilities": [
54
+ "filesystem-readonly",
55
+ "filesystem-write",
56
+ "shell",
57
+ "github",
58
+ "browser",
59
+ "memory"
60
+ ],
61
+ "capabilityPacks": [
62
+ {
63
+ "name": "web-delivery",
64
+ "version": "0.1.1"
65
+ }
66
+ ],
67
+ "capabilityPolicy": {
68
+ "allowedOwners": [
69
+ "platform-maintainers"
70
+ ],
71
+ "allowedLifecycles": [
72
+ "experimental"
73
+ ],
74
+ "allowedFilesystemRead": [
75
+ "**/*"
76
+ ],
77
+ "allowedFilesystemWrite": [
78
+ "**/*"
79
+ ],
80
+ "allowedNetworkDomains": [],
81
+ "allowedExternalActions": []
82
+ },
83
+ "memory": {
84
+ "enabled": true,
85
+ "mode": "manual",
86
+ "scope": "project",
87
+ "summaryFile": ".pi/memory/memory_summary.md",
88
+ "handbookFile": ".pi/memory/MEMORY.md",
89
+ "localDir": ".pi/memory/local",
90
+ "readBeforeTask": true,
91
+ "writePolicy": "explicit-only",
92
+ "maxInjectedChars": 4000,
93
+ "externalPackages": []
94
+ },
95
+ "runtimePolicy": {
96
+ "execPolicy": "enforce",
97
+ "contextBudget": "enforce",
98
+ "toolRegistry": "advisory",
99
+ "finalGate": "enforce"
100
+ }
101
+ }
@@ -0,0 +1,206 @@
1
+ {
2
+ "coreApiVersion": 1,
3
+ "packs": [
4
+ {
5
+ "activation": {
6
+ "mode": "profile",
7
+ "profiles": [
8
+ "generic",
9
+ "platform-development"
10
+ ],
11
+ "triggers": []
12
+ },
13
+ "artifacts": [
14
+ {
15
+ "byteSize": 1901,
16
+ "digest": "sha256:4cf593f5ae8d2806d5d1262ea31f7814e087b0d599e66fc064467b8c22a6a075",
17
+ "id": "generic",
18
+ "kind": "adapters",
19
+ "path": "adapters/generic/profile.json"
20
+ },
21
+ {
22
+ "byteSize": 1134,
23
+ "digest": "sha256:8e3bbe4c8ab19ab46f02e02b0763b78fa4784160b11210b7350a35730b02ee81",
24
+ "id": "capability-resolution",
25
+ "kind": "evals",
26
+ "path": "evals/scenarios/capability-resolution.json"
27
+ },
28
+ {
29
+ "byteSize": 6146,
30
+ "digest": "sha256:a7a975b99ed2f45881d110582fb6990c500f7e081f865230bf9e4ae242cdd81e",
31
+ "id": "base-policy",
32
+ "kind": "policies",
33
+ "path": "packages/piagent-core/policies/base-policy.json"
34
+ },
35
+ {
36
+ "byteSize": 1746,
37
+ "digest": "sha256:e18426ee2b4ac2b9bb089789f146b43f1e0c2c5001327860ed583eb14cc08df7",
38
+ "id": "commit",
39
+ "kind": "prompts",
40
+ "path": "packages/piagent-core/prompts/commit.md"
41
+ },
42
+ {
43
+ "byteSize": 1601,
44
+ "digest": "sha256:bd00d48ba9272a721f58b406944917e5f4a44162c621d722bb5e9c8528f87eb5",
45
+ "id": "plan",
46
+ "kind": "prompts",
47
+ "path": "packages/piagent-core/prompts/plan.md"
48
+ },
49
+ {
50
+ "byteSize": 1532,
51
+ "digest": "sha256:bd66fccbdf9f1f9a518aab4b9bc9bb001f0ec3b0f35d52a64229dbd31d8dd8a0",
52
+ "id": "pr",
53
+ "kind": "prompts",
54
+ "path": "packages/piagent-core/prompts/pr.md"
55
+ },
56
+ {
57
+ "byteSize": 1528,
58
+ "digest": "sha256:046b91dd920eed4da920132e4f563fedd0a73603a206896a078536a75906335c",
59
+ "id": "review",
60
+ "kind": "prompts",
61
+ "path": "packages/piagent-core/prompts/review.md"
62
+ },
63
+ {
64
+ "byteSize": 4834,
65
+ "digest": "sha256:1e20fdfbf55ec71ec6f7a780aaf567556329571dcb1774831570e143e9d2b114",
66
+ "id": "task",
67
+ "kind": "prompts",
68
+ "path": "packages/piagent-core/prompts/task.md"
69
+ },
70
+ {
71
+ "byteSize": 1790,
72
+ "digest": "sha256:1f4262cf53cf527ea1b5f89a938f3aafb5006e1b091ad49132d810c13489db2c",
73
+ "id": "bounded-change",
74
+ "kind": "recipes",
75
+ "path": "packs/engineering-base/recipes/bounded-change.json"
76
+ },
77
+ {
78
+ "byteSize": 1356,
79
+ "digest": "sha256:8ee63773b66386fb1e278e178842d4bd2a725b73d60e1114529df4aa3bc628f4",
80
+ "id": "piagent-ops",
81
+ "kind": "skills",
82
+ "path": "packages/piagent-core/skills/piagent-ops/SKILL.md"
83
+ },
84
+ {
85
+ "byteSize": 1690,
86
+ "digest": "sha256:5916fcab12154317430cb40eb7861b807b07911835653a8eae7d3ca79a562e77",
87
+ "id": "piagent-planner",
88
+ "kind": "subagents",
89
+ "path": "packages/piagent-core/subagents/piagent-planner.md"
90
+ },
91
+ {
92
+ "byteSize": 1601,
93
+ "digest": "sha256:be1ec2282db3038717c1e66e91e3890b8d0d665fed039c903cc1e4a3c427f69e",
94
+ "id": "piagent-reviewer",
95
+ "kind": "subagents",
96
+ "path": "packages/piagent-core/subagents/piagent-reviewer.md"
97
+ },
98
+ {
99
+ "byteSize": 1244,
100
+ "digest": "sha256:ef11c88d37d4d2f760c9bd5fe66e7b4ce81cb5f2afd2dc1ce9df62749554dbe3",
101
+ "id": "piagent-scout",
102
+ "kind": "subagents",
103
+ "path": "packages/piagent-core/subagents/piagent-scout.md"
104
+ },
105
+ {
106
+ "byteSize": 1731,
107
+ "digest": "sha256:551b9722940b9e2ebd9053fcf520ebf22e7478f7286615683776e9d989bb7d89",
108
+ "id": "piagent-worker",
109
+ "kind": "subagents",
110
+ "path": "packages/piagent-core/subagents/piagent-worker.md"
111
+ }
112
+ ],
113
+ "dependencies": [],
114
+ "description": "Core engineering workflow, policy, verification, and task coordination capabilities.",
115
+ "digest": "sha256:b9671f0c2da79012b8638c98459d5bbe9e444fd39fdabe17f54477ec18cc9fdf",
116
+ "license": "MIT",
117
+ "lifecycle": "experimental",
118
+ "name": "engineering-base",
119
+ "origin": "workspace",
120
+ "owner": "platform-maintainers",
121
+ "permissions": {
122
+ "capabilities": [
123
+ "filesystem-readonly",
124
+ "filesystem-write",
125
+ "memory",
126
+ "shell"
127
+ ],
128
+ "externalActions": [],
129
+ "filesystemRead": [
130
+ "**/*"
131
+ ],
132
+ "filesystemWrite": [
133
+ "**/*"
134
+ ],
135
+ "networkDomains": []
136
+ },
137
+ "source": "workspace",
138
+ "tags": [
139
+ "engineering",
140
+ "governance"
141
+ ],
142
+ "version": "0.1.1"
143
+ },
144
+ {
145
+ "activation": {
146
+ "mode": "profile",
147
+ "profiles": [
148
+ "web-frontend"
149
+ ],
150
+ "triggers": []
151
+ },
152
+ "artifacts": [
153
+ {
154
+ "byteSize": 1950,
155
+ "digest": "sha256:84ac29dcbe0c692070be302707424ea16130a5938cff309c5d7755204b6c2dc1",
156
+ "id": "web-frontend",
157
+ "kind": "adapters",
158
+ "path": "adapters/web-frontend/profile.json"
159
+ },
160
+ {
161
+ "byteSize": 1276,
162
+ "digest": "sha256:96959d1f93a01c8e100d0ab72d1b820046491ba6220bc1361263c3258e2224c5",
163
+ "id": "verified-web-change",
164
+ "kind": "recipes",
165
+ "path": "packs/web-delivery/recipes/verified-web-change.json"
166
+ }
167
+ ],
168
+ "dependencies": [
169
+ {
170
+ "name": "engineering-base",
171
+ "version": "0.1.1"
172
+ }
173
+ ],
174
+ "description": "Web application delivery capabilities with browser-assisted verification.",
175
+ "digest": "sha256:b5a74b3ef869fe777a870b4b450ae9dc91d30e3370ce369a03d939abef8606cf",
176
+ "license": "MIT",
177
+ "lifecycle": "experimental",
178
+ "name": "web-delivery",
179
+ "origin": "workspace",
180
+ "owner": "platform-maintainers",
181
+ "permissions": {
182
+ "capabilities": [
183
+ "browser",
184
+ "filesystem-readonly",
185
+ "filesystem-write",
186
+ "shell"
187
+ ],
188
+ "externalActions": [],
189
+ "filesystemRead": [
190
+ "**/*"
191
+ ],
192
+ "filesystemWrite": [
193
+ "**/*"
194
+ ],
195
+ "networkDomains": []
196
+ },
197
+ "source": "workspace",
198
+ "tags": [
199
+ "frontend",
200
+ "web"
201
+ ],
202
+ "version": "0.1.1"
203
+ }
204
+ ],
205
+ "schemaVersion": 1
206
+ }
@@ -0,0 +1,64 @@
1
+ # Kiến trúc Pi Agent Platform
2
+
3
+ ## Mục tiêu
4
+
5
+ Tách phần agent platform khỏi từng project. Một core dùng chung, nhiều adapter tùy project.
6
+
7
+ ```text
8
+ User machine
9
+ ├─ ~/.pi/agent/
10
+ │ ├─ settings.json user/global Pi settings
11
+ │ ├─ auth.json OAuth token, không commit
12
+ │ └─ mcp.json Pi global MCP override
13
+ ├─ ~/.config/mcp/mcp.json shared global MCP config
14
+ └─ <platform-repo>/
15
+ ├─ package.json root Pi package manifest
16
+ ├─ packages/piagent-core reusable Pi package internals
17
+ ├─ adapters/*/profile.json project/domain profiles
18
+ └─ templates/project files copied into target projects
19
+
20
+ Any project
21
+ ├─ AGENTS.md project instructions
22
+ ├─ .mcp.json shared MCP config
23
+ └─ .pi/
24
+ ├─ settings.json project Pi settings
25
+ ├─ piagent-profile.json project adapter
26
+ ├─ memory/ project-scoped explicit memory
27
+ └─ mcp.json Pi project MCP override
28
+ ```
29
+
30
+ ## Layering
31
+
32
+ | Layer | Scope | Commit? | Nội dung |
33
+ |---|---|---:|---|
34
+ | OAuth/auth | user machine | Không | `auth.json`, API token, trust state. |
35
+ | Pi global settings | user machine | Không, chỉ template | provider/model, installed packages, telemetry/proxy. |
36
+ | Piagent core | platform repo | Có | extension guard, prompt, skill, policy engine. |
37
+ | Domain pack | platform repo | Có | frontend/backend/data profile chung. |
38
+ | Project adapter | project repo hoặc platform repo | Có | paths, context, verify, MCP capabilities. |
39
+ | Project memory | user/project machine | Không mặc định | `.pi/memory/MEMORY.md` và summary là private-by-default; team chỉ opt-in commit sau review/redaction. |
40
+
41
+ ## Luồng chạy
42
+
43
+ 1. User `cd <project>`.
44
+ 2. User chạy `pi`.
45
+ 3. Pi đọc global settings và package đã cài.
46
+ 4. Nếu project trusted, Pi đọc `.pi/settings.json` và `.pi/piagent-profile.json`.
47
+ 5. `piagent-core` extension intercept tool calls.
48
+ 6. Agent dùng prompts/skills, MCP registry, context policy, và memory policy.
49
+ 7. Memory được đọc/search như advisory context; source hiện tại vẫn là authority.
50
+ 8. Trước khi DONE, agent chạy verify theo profile.
51
+
52
+ ## Vì sao không hard-code vào prompt
53
+
54
+ Prompt chỉ hướng dẫn model. Guard extension có thể block tool call trước khi chạy. Các rule nguy hiểm phải nằm trong policy/extension:
55
+
56
+ - protected path
57
+ - destructive bash
58
+ - missing verify
59
+ - unsupported MCP capability
60
+ - credential handling
61
+
62
+ ## Project-specific examples
63
+
64
+ Project đặc thù có thể có backend freeze, structure guide, experience contract, e2e gate. Những thứ này không được đưa vào core; hãy đặt profile riêng trong chính repo project.