@piagent/platform 1.2.2 → 1.2.3
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 +18 -0
- package/README.md +34 -27
- package/catalog/capabilities.json +8 -8
- package/docs/auto-delegation-policy.md +4 -4
- package/docs/command-reference-vietnamese.md +119 -85
- package/docs/context-window-policy.md +7 -7
- package/docs/distribution-standard.md +27 -10
- package/docs/herdr-workflow.md +3 -2
- package/docs/memory-policy.md +6 -3
- package/docs/operator-manual-vietnamese.md +81 -72
- package/docs/package-architecture-notes.md +6 -6
- package/docs/project-adapters.md +4 -4
- package/docs/project-onboarding.md +12 -11
- package/docs/publishing-for-teams.md +2 -2
- package/docs/quickstart-vietnamese.md +25 -23
- package/docs/release-install-policy.md +6 -6
- package/docs/runtime-harness-standard.md +7 -7
- package/docs/runtime-policy-design.md +1 -1
- package/docs/runtime-quality-baseline.md +1 -1
- package/docs/security-threat-model.md +1 -1
- package/docs/subagent-orchestration-capabilities.md +3 -3
- package/docs/subagents-and-multiagent.md +4 -4
- package/docs/task-implementation-contract.md +4 -4
- package/docs/task-lifecycle-vietnamese.md +2 -2
- package/docs/team-onboarding.md +22 -18
- package/docs/usage-observability.md +13 -12
- package/docs/workflow-recipes.md +12 -9
- package/docs-site/architecture.html +1 -1
- package/docs-site/commands.html +19 -15
- package/docs-site/content/commands.html +18 -14
- package/docs-site/content/permissions.html +11 -11
- package/docs-site/content/quickstart.html +12 -11
- package/docs-site/content/team.html +1 -1
- package/docs-site/content/workflows.html +17 -17
- package/docs-site/index.html +1 -1
- 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 +12 -12
- package/docs-site/profiles.html +1 -1
- package/docs-site/quickstart.html +13 -12
- package/docs-site/runtime.html +1 -1
- package/docs-site/scope.html +1 -1
- package/docs-site/security.html +1 -1
- package/docs-site/team.html +2 -2
- package/docs-site/workflows.html +18 -18
- package/package.json +1 -1
- package/packages/piagent-core/README.md +27 -27
- package/packages/piagent-core/extensions/piagent-guard.ts +1055 -190
- package/packages/piagent-core/package.json +1 -1
- package/packages/piagent-core/prompts/be-to-fe.md +3 -3
- package/packages/piagent-core/prompts/discuss.md +2 -2
- package/packages/piagent-core/prompts/plan.md +1 -1
- package/packages/piagent-core/prompts/platform-improve.md +1 -1
- package/packages/piagent-core/prompts/pr.md +1 -1
- package/packages/piagent-core/prompts/review.md +1 -1
- package/packages/piagent-core/prompts/scout.md +2 -2
- package/packages/piagent-core/prompts/task.md +2 -2
- package/scripts/init-project.sh +4 -3
- package/scripts/install-global.sh +47 -1
- package/scripts/profile-doctor.sh +1 -1
- package/scripts/setup.sh +4 -3
- package/scripts/team-doctor.sh +6 -8
- package/scripts/verify-local.sh +18 -17
- package/templates/project/.pi/context-index.json +2 -2
- package/templates/project/.pi/project-context.md +3 -3
- package/templates/project/AGENTS.md +4 -4
- package/packages/piagent-core/prompts/memory-policy.md +0 -52
- package/packages/piagent-core/prompts/model-options.md +0 -68
- package/packages/piagent-core/prompts/onboard-project.md +0 -147
- package/packages/piagent-core/prompts/piagent-commands.md +0 -69
|
@@ -20,11 +20,11 @@ Use this for tasks like:
|
|
|
20
20
|
|
|
21
21
|
Mandatory flow:
|
|
22
22
|
|
|
23
|
-
0. Call `piagent_context_preflight` with `workflow=be-to-fe`. If it recommends `fresh-session`, stop loading context in this session and tell the user to use `/fresh
|
|
23
|
+
0. Call `piagent_context_preflight` with `workflow=be-to-fe`. If it recommends `fresh-session`, stop loading context in this session and tell the user to use `/piagent-session fresh be-to-fe <request>` unless this command already runs in a fresh session.
|
|
24
24
|
1. Call `piagent_context` with `detail=full` and confirm profile/protected backend paths.
|
|
25
25
|
2. Call `piagent_orchestration_policy`; keep the workflow solo-first unless bounded BE/FE scouting or review is worth the extra token/tool cost.
|
|
26
26
|
3. Call `piagent_memory_status`; search memory or Field Guide for prior BE/FE mapping decisions if relevant, record citations with `piagent_memory_citation_record`, then verify against current BE/FE files.
|
|
27
|
-
4. Read `.pi/project-context.md`. If pending, stop and ask for `/onboard-project`.
|
|
27
|
+
4. Read `.pi/project-context.md`. If pending, stop and ask for `/onboard-project run`.
|
|
28
28
|
5. Read required context from the active profile and call `piagent_context_budget` for BE/FE files that look large.
|
|
29
29
|
6. Classify the task:
|
|
30
30
|
- BE scout: read-only.
|
|
@@ -67,7 +67,7 @@ Mandatory flow:
|
|
|
67
67
|
|
|
68
68
|
For generic projects, use profile `be-readonly-fe` when the repo policy is “BE scout only, FE write allowed”.
|
|
69
69
|
|
|
70
|
-
Do not ask the user to paste the mandatory flow. The platform prompt already contains it. If the user asks only for scout/audit, stay read-only and prefer `/scout` or `/fresh
|
|
70
|
+
Do not ask the user to paste the mandatory flow. The platform prompt already contains it. If the user asks only for scout/audit, stay read-only and prefer `/workflow scout` or `/piagent-session fresh scout`.
|
|
71
71
|
|
|
72
72
|
Final output:
|
|
73
73
|
|
|
@@ -13,7 +13,7 @@ Operating rules:
|
|
|
13
13
|
|
|
14
14
|
1. Call `piagent_context` first when available.
|
|
15
15
|
2. Call `piagent_memory_status`; use memory only to avoid repeated context questions, not as authority.
|
|
16
|
-
3. Read `.pi/project-context.md` if available; if it is still pending, recommend `/onboard-project` before implementation.
|
|
16
|
+
3. Read `.pi/project-context.md` if available; if it is still pending, recommend `/onboard-project run` before implementation.
|
|
17
17
|
4. Inspect relevant files/docs before asking; do not ask what can be answered from the project.
|
|
18
18
|
5. Identify the next unresolved decision, dependency, constraint, or risk.
|
|
19
19
|
6. Ask at most 3 focused questions per round.
|
|
@@ -32,4 +32,4 @@ Final output when clear:
|
|
|
32
32
|
- implementation approach
|
|
33
33
|
- required context
|
|
34
34
|
- verify commands
|
|
35
|
-
- recommended next command: `/plan` or `/task`
|
|
35
|
+
- recommended next command: `/workflow plan` or `/workflow task`
|
|
@@ -14,7 +14,7 @@ Rules:
|
|
|
14
14
|
1. Call `piagent_context`.
|
|
15
15
|
2. Call `piagent_orchestration_policy`; default to solo-first and choose review lenses/model roles before considering subagents.
|
|
16
16
|
3. Call `piagent_memory_status`; search memory or Field Guide if it can reduce re-scouting, but treat it as advisory.
|
|
17
|
-
4. Read `.pi/project-context.md`; if it is missing or still pending, recommend `/onboard-project` before implementation.
|
|
17
|
+
4. Read `.pi/project-context.md`; if it is missing or still pending, recommend `/onboard-project run` before implementation.
|
|
18
18
|
5. Read required context.
|
|
19
19
|
6. Identify protected paths and external/high-risk actions.
|
|
20
20
|
7. Decide whether subagents are useful enough to justify extra token/tool cost. If the bundled `pi-subagents` parent skill is available, use it for delegation patterns and safety boundaries. If `pi-subagents`/`subagent(...)` is available, use `piagent-scout` for independent read-only repo/spec mapping before medium/large plans. Use builtin `context-builder` when the task needs a handoff context/meta-prompt. Use `piagent-oracle` for architecture/risk challenge when the decision is non-obvious. Continue single-agent for tiny plans or unavailable subagent tooling.
|
|
@@ -23,7 +23,7 @@ Mandatory flow:
|
|
|
23
23
|
1. Call `piagent_context` with `detail=full` and inspect the active project profile.
|
|
24
24
|
2. Call `piagent_orchestration_policy`; keep the platform change solo-first unless bounded scout/planning/review lanes are useful.
|
|
25
25
|
3. Call `piagent_memory_status`; if prior decisions or Field Guide notes are relevant, search memory and record citations with `piagent_memory_citation_record`.
|
|
26
|
-
4. Read `.pi/project-context.md`. If pending, stop and ask the user to run `/onboard-project`.
|
|
26
|
+
4. Read `.pi/project-context.md`. If pending, stop and ask the user to run `/onboard-project run`.
|
|
27
27
|
5. Read the required context declared by the active profile. Before loading large files, call `piagent_context_budget`.
|
|
28
28
|
6. Classify the task risk lane and create a task contract with `piagent_task_start`, including review lenses and a compact workPlan, before source edits.
|
|
29
29
|
7. Decide whether bounded subagents are useful enough to justify extra token/tool cost:
|
|
@@ -16,7 +16,7 @@ Rules:
|
|
|
16
16
|
1. Do not merge. Do not publish, release, deploy, or tag.
|
|
17
17
|
2. Use normal shell Git/GitHub commands so the piagent guard and confirmation gates remain active.
|
|
18
18
|
3. Start with `git status --short`, `git branch --show-current`, and `git remote -v`.
|
|
19
|
-
4. If there are uncommitted changes, stop and ask the operator to run `/commit` first, unless the operator explicitly asks this command to include a commit.
|
|
19
|
+
4. If there are uncommitted changes, stop and ask the operator to run `/workflow commit` first, unless the operator explicitly asks this command to include a commit.
|
|
20
20
|
5. Run the relevant verification command before opening the PR. At minimum use `git diff --check`; for source or policy changes, run the project verify/test/typecheck commands that apply.
|
|
21
21
|
6. If the branch is not pushed, ask for explicit operator confirmation before `git push -u origin <branch>`.
|
|
22
22
|
7. Create the PR only after the operator explicitly confirms the external GitHub action. Prefer `gh pr create --draft` with a clear title/body derived from the current diff and commits, unless the operator explicitly asks for a ready-for-review PR.
|
|
@@ -11,7 +11,7 @@ $ARGUMENTS
|
|
|
11
11
|
|
|
12
12
|
Rules:
|
|
13
13
|
|
|
14
|
-
0. Call `piagent_context_preflight` with `workflow=review` for large diffs or long requests. If it recommends `fresh-session`, prefer `/fresh
|
|
14
|
+
0. Call `piagent_context_preflight` with `workflow=review` for large diffs or long requests. If it recommends `fresh-session`, prefer `/piagent-session fresh scout` for read-only evidence gathering or ask the user to resume in a fresh session.
|
|
15
15
|
1. Call `piagent_context`.
|
|
16
16
|
2. Call `piagent_orchestration_policy` and select explicit review lenses before reading the diff deeply.
|
|
17
17
|
3. Read `.pi/project-context.md` if available.
|
|
@@ -14,11 +14,11 @@ Use this when the user needs evidence before deciding whether to implement. Do n
|
|
|
14
14
|
Preflight first:
|
|
15
15
|
|
|
16
16
|
1. Call `piagent_context_preflight` with `workflow=scout`.
|
|
17
|
-
2. If it recommends `fresh-session`, stop loading context in this session and tell the user to use `/fresh
|
|
17
|
+
2. If it recommends `fresh-session`, stop loading context in this session and tell the user to use `/piagent-session fresh scout <request>` unless this command already runs in a fresh session.
|
|
18
18
|
3. Call `piagent_context` with `detail=full`.
|
|
19
19
|
4. Call `piagent_orchestration_policy`; keep scout solo-first unless independent read-only lanes are useful.
|
|
20
20
|
5. Call `piagent_memory_status`; cite relevant memory or Field Guide only with `piagent_memory_citation_record`, then verify against current repo files.
|
|
21
|
-
6. Read `.pi/project-context.md`; if pending, stop and ask for `/onboard-project`.
|
|
21
|
+
6. Read `.pi/project-context.md`; if pending, stop and ask for `/onboard-project run`.
|
|
22
22
|
7. Create a read-only task contract with `piagent_task_start` before broad scouting:
|
|
23
23
|
- risk lane;
|
|
24
24
|
- expected output;
|
|
@@ -11,11 +11,11 @@ $ARGUMENTS
|
|
|
11
11
|
|
|
12
12
|
Mandatory flow:
|
|
13
13
|
|
|
14
|
-
0. Call `piagent_context_preflight` with `workflow=task`. If it recommends `fresh-session`, stop loading context in this session and tell the user to use `/fresh
|
|
14
|
+
0. Call `piagent_context_preflight` with `workflow=task`. If it recommends `fresh-session`, stop loading context in this session and tell the user to use `/piagent-session fresh task <request>` unless this command already runs in a fresh session.
|
|
15
15
|
1. Call `piagent_context` and read the project profile/runtime policy.
|
|
16
16
|
2. Call `piagent_orchestration_policy` and keep the task solo-first unless the policy and task shape make bounded subagents clearly useful.
|
|
17
17
|
3. Call `piagent_memory_status`. If memory or the Field Guide is enabled and relevant to the task, search/read it as advisory context, record citations with `piagent_memory_citation_record`, then verify against current repo files.
|
|
18
|
-
4. Call `piagent_context_index_status` when available, then read `.pi/project-context.md`. If `.pi/project-context.md` is missing or still says `Generated: not yet`, stop and ask the user to run `/onboard-project` after login/model selection before implementation.
|
|
18
|
+
4. Call `piagent_context_index_status` when available, then read `.pi/project-context.md`. If `.pi/project-context.md` is missing or still says `Generated: not yet`, stop and ask the user to run `/onboard-project run` after login/model selection before implementation.
|
|
19
19
|
- Use `piagent_context_index_search` for navigation hints when the task touches an unfamiliar module/tech/risk area.
|
|
20
20
|
- Treat context-index hits as advisory; open and verify cited files before editing.
|
|
21
21
|
5. Build a Task Implementation Contract with `piagent_task_start` before editing:
|
package/scripts/init-project.sh
CHANGED
|
@@ -315,10 +315,11 @@ echo "Next:"
|
|
|
315
315
|
echo " cd \"$PROJECT_PATH\""
|
|
316
316
|
echo " pi"
|
|
317
317
|
echo " /login # first time only"
|
|
318
|
-
echo " /onboard
|
|
318
|
+
echo " /onboard # open onboarding menu/status"
|
|
319
|
+
echo " /onboard run # first project-read after model selection"
|
|
319
320
|
echo " /mcp # MCP servers come from the global install, not from this project"
|
|
320
|
-
echo " /context
|
|
321
|
-
echo " /memory
|
|
321
|
+
echo " /context index # inspect compact project context index"
|
|
322
|
+
echo " /memory # inspect project memory policy when needed"
|
|
322
323
|
echo
|
|
323
324
|
echo "Note: .mcp.json and .pi/mcp.json are written empty on purpose. They exist so this"
|
|
324
325
|
echo "project can add its own servers later; the shared baseline lives in the global"
|
|
@@ -178,6 +178,50 @@ run_cmd() {
|
|
|
178
178
|
fi
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
+
resolve_user_package_path() {
|
|
182
|
+
local source="$1"
|
|
183
|
+
local pi_agent_dir="${PI_CODING_AGENT_DIR:-"${HOME}/.pi/agent"}"
|
|
184
|
+
node --input-type=module - "$pi_agent_dir" "$source" <<'NODE'
|
|
185
|
+
import path from "node:path";
|
|
186
|
+
|
|
187
|
+
const base = process.argv[2];
|
|
188
|
+
const source = process.argv[3];
|
|
189
|
+
console.log(path.resolve(base, source));
|
|
190
|
+
NODE
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
is_piagent_platform_source() {
|
|
194
|
+
local source="$1"
|
|
195
|
+
case "$source" in
|
|
196
|
+
git:github.com/Vt-mmm/piagent|git:github.com/Vt-mmm/piagent@*|https://github.com/Vt-mmm/piagent*|npm:@piagent/platform|npm:@piagent/platform@*)
|
|
197
|
+
return 0
|
|
198
|
+
;;
|
|
199
|
+
npm:*|git:*|http:*|https:*)
|
|
200
|
+
return 1
|
|
201
|
+
;;
|
|
202
|
+
esac
|
|
203
|
+
|
|
204
|
+
local resolved_source
|
|
205
|
+
resolved_source="$(resolve_user_package_path "$source" 2>/dev/null || true)"
|
|
206
|
+
[[ "$resolved_source" == "$PLATFORM_ROOT" ]]
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
remove_existing_piagent_platform_sources() {
|
|
210
|
+
local source
|
|
211
|
+
while IFS= read -r source; do
|
|
212
|
+
[[ -n "$source" ]] || continue
|
|
213
|
+
if is_piagent_platform_source "$source"; then
|
|
214
|
+
run_cmd pi remove "$source"
|
|
215
|
+
fi
|
|
216
|
+
done < <(
|
|
217
|
+
pi list --approve 2>/dev/null | awk '
|
|
218
|
+
$0 == "User packages:" { in_user = 1; next }
|
|
219
|
+
$0 == "Project packages:" { in_user = 0; next }
|
|
220
|
+
in_user && $0 ~ /^ [^ ]/ { sub(/^ /, ""); print }
|
|
221
|
+
'
|
|
222
|
+
)
|
|
223
|
+
}
|
|
224
|
+
|
|
181
225
|
verify_npm_integrity() {
|
|
182
226
|
local source="$1"
|
|
183
227
|
local expected="$2"
|
|
@@ -496,6 +540,8 @@ if [[ -n "$RESOLVED_PACKAGE_COMMIT" ]]; then
|
|
|
496
540
|
echo " resolvedCommit: $RESOLVED_PACKAGE_COMMIT"
|
|
497
541
|
fi
|
|
498
542
|
echo " source: $PACKAGE_SOURCE"
|
|
543
|
+
echo "Removing previous Pi Agent Platform package registrations:"
|
|
544
|
+
remove_existing_piagent_platform_sources
|
|
499
545
|
run_cmd pi install "$PACKAGE_SOURCE"
|
|
500
546
|
|
|
501
547
|
if [[ "$WITH_MCP" == true ]]; then
|
|
@@ -562,4 +608,4 @@ if [[ "$WITH_MCP" == true ]]; then
|
|
|
562
608
|
echo " /mcp # inspect MCP servers; authenticate Figma/GitHub only when needed"
|
|
563
609
|
fi
|
|
564
610
|
echo " /subagents-doctor"
|
|
565
|
-
echo " /task Implement <task> # parent may auto-delegate scout/planner/reviewer"
|
|
611
|
+
echo " /workflow task Implement <task> # parent may auto-delegate scout/planner/reviewer"
|
|
@@ -198,7 +198,7 @@ if (contextIndex.enabled && contextIndex.writePolicy !== "off") {
|
|
|
198
198
|
if (relativeIndexPath.startsWith("..") || path.isAbsolute(relativeIndexPath)) {
|
|
199
199
|
errors.push(`contextIndex.path escapes project root: ${contextIndex.path}`);
|
|
200
200
|
} else if (!fs.existsSync(indexPath)) {
|
|
201
|
-
warnings.push(`context index missing: ${contextIndex.path}; run /onboard
|
|
201
|
+
warnings.push(`context index missing: ${contextIndex.path}; run /onboard run or record piagent_context_index_record`);
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
|
package/scripts/setup.sh
CHANGED
|
@@ -452,12 +452,13 @@ if [[ "$DO_PROJECT" == true ]]; then
|
|
|
452
452
|
echo " /scoped-models # optional: edit Ctrl+P model cycle scope"
|
|
453
453
|
echo " /mcp # inspect MCP servers; run /mcp setup for guided changes"
|
|
454
454
|
echo " /subagents-doctor # inspect subagent setup"
|
|
455
|
-
echo " /onboard
|
|
456
|
-
echo " /
|
|
455
|
+
echo " /onboard # open onboarding menu/status"
|
|
456
|
+
echo " /onboard run # first project-read snapshot before implementation"
|
|
457
|
+
echo " /memory # inspect project memory policy when needed"
|
|
457
458
|
fi
|
|
458
459
|
echo
|
|
459
460
|
echo "Daily flow after setup:"
|
|
460
461
|
echo " herdr # optional"
|
|
461
462
|
echo " cd <project>"
|
|
462
463
|
echo " pi"
|
|
463
|
-
echo " /task Implement <task> # parent may auto-delegate scout/planner/reviewer"
|
|
464
|
+
echo " /workflow task Implement <task> # parent may auto-delegate scout/planner/reviewer"
|
package/scripts/team-doctor.sh
CHANGED
|
@@ -149,8 +149,6 @@ if (!runtime.teamRolloutReady) {
|
|
|
149
149
|
for (const rel of [
|
|
150
150
|
"package.json",
|
|
151
151
|
"packages/piagent-core/extensions/piagent-guard.ts",
|
|
152
|
-
"packages/piagent-core/prompts/onboard-project.md",
|
|
153
|
-
"packages/piagent-core/prompts/memory-policy.md",
|
|
154
152
|
"packages/piagent-core/prompts/platform-improve.md",
|
|
155
153
|
"packages/piagent-core/prompts/be-to-fe.md",
|
|
156
154
|
"packages/piagent-core/prompts/task.md",
|
|
@@ -374,10 +372,10 @@ const projectContextPath = path.join(projectPath, ".pi", "project-context.md");
|
|
|
374
372
|
if (fs.existsSync(projectContextPath)) {
|
|
375
373
|
const projectContext = fs.readFileSync(projectContextPath, "utf8");
|
|
376
374
|
if (/Generated:\s*not yet/i.test(projectContext)) {
|
|
377
|
-
warnings.push("project onboarding snapshot is still pending; run /onboard
|
|
375
|
+
warnings.push("project onboarding snapshot is still pending; run /onboard run in Pi after login/model selection");
|
|
378
376
|
}
|
|
379
377
|
} else {
|
|
380
|
-
warnings.push("project has no .pi/project-context.md; run setup/init or /onboard
|
|
378
|
+
warnings.push("project has no .pi/project-context.md; run setup/init or /onboard run");
|
|
381
379
|
}
|
|
382
380
|
|
|
383
381
|
const contextIndexConfig = projectProfile && typeof projectProfile.contextIndex === "object" && !Array.isArray(projectProfile.contextIndex)
|
|
@@ -402,8 +400,8 @@ if (contextIndexEscapes) {
|
|
|
402
400
|
const edges = Array.isArray(contextIndex.edges) ? contextIndex.edges : [];
|
|
403
401
|
const citations = Array.isArray(contextIndex.citations) ? contextIndex.citations : [];
|
|
404
402
|
if (contextIndex.schemaVersion !== 1) warnings.push("project context index schemaVersion should be 1");
|
|
405
|
-
if (
|
|
406
|
-
warnings.push("project context index is still pending; run /onboard
|
|
403
|
+
if (/Pending\.\s+Run \/onboard(?: run)? after login\/model selection/i.test(String(contextIndex.summary ?? ""))) {
|
|
404
|
+
warnings.push("project context index is still pending; run /onboard run after login/model selection");
|
|
407
405
|
}
|
|
408
406
|
if (nodes.length === 0) warnings.push("project context index has no nodes yet");
|
|
409
407
|
if (contextIndex?.policy?.requireCitations !== false && citations.length === 0) warnings.push("project context index has no citations yet");
|
|
@@ -411,13 +409,13 @@ if (contextIndexEscapes) {
|
|
|
411
409
|
if (edges.length > (contextIndex?.policy?.maxEdges ?? 240)) warnings.push("project context index has more edges than policy maxEdges");
|
|
412
410
|
}
|
|
413
411
|
} else {
|
|
414
|
-
warnings.push(`project has no ${contextIndexRelativePath}; run setup/init or /onboard
|
|
412
|
+
warnings.push(`project has no ${contextIndexRelativePath}; run setup/init or /onboard run`);
|
|
415
413
|
}
|
|
416
414
|
|
|
417
415
|
const memorySummaryPath = path.join(projectPath, ".pi", "memory", "memory_summary.md");
|
|
418
416
|
const memoryHandbookPath = path.join(projectPath, ".pi", "memory", "MEMORY.md");
|
|
419
417
|
if (!fs.existsSync(memorySummaryPath) || !fs.existsSync(memoryHandbookPath)) {
|
|
420
|
-
warnings.push("project has no .pi/memory scaffold; run setup/init or use /memory
|
|
418
|
+
warnings.push("project has no .pi/memory scaffold; run setup/init or use /memory before relying on project memory");
|
|
421
419
|
}
|
|
422
420
|
|
|
423
421
|
if (strictShare) {
|
package/scripts/verify-local.sh
CHANGED
|
@@ -56,10 +56,6 @@ required_files=(
|
|
|
56
56
|
"$ROOT/packages/piagent-core/extensions/runtime-evidence.js"
|
|
57
57
|
"$ROOT/packages/piagent-core/security/sensitive-data.js"
|
|
58
58
|
"$ROOT/packages/piagent-core/capabilities/capability-core.js"
|
|
59
|
-
"$ROOT/packages/piagent-core/prompts/onboard-project.md"
|
|
60
|
-
"$ROOT/packages/piagent-core/prompts/piagent-commands.md"
|
|
61
|
-
"$ROOT/packages/piagent-core/prompts/model-options.md"
|
|
62
|
-
"$ROOT/packages/piagent-core/prompts/memory-policy.md"
|
|
63
59
|
"$ROOT/packages/piagent-core/prompts/platform-improve.md"
|
|
64
60
|
"$ROOT/packages/piagent-core/prompts/be-to-fe.md"
|
|
65
61
|
"$ROOT/packages/piagent-core/prompts/scout.md"
|
|
@@ -329,10 +325,15 @@ require_documented "piagent_context_budget" "$ROOT/packages/piagent-core" "$ROOT
|
|
|
329
325
|
require_documented "piagent_tool_policy_check" "$ROOT/packages/piagent-core" "$ROOT/docs" "$ROOT/templates/project/AGENTS.md"
|
|
330
326
|
require_documented "piagent_task_gate_check" "$ROOT/packages/piagent-core" "$ROOT/docs" "$ROOT/templates/project/AGENTS.md"
|
|
331
327
|
require_documented "piagent_usage_snapshot" "$ROOT/packages/piagent-core" "$ROOT/docs" "$ROOT/templates/project/AGENTS.md"
|
|
332
|
-
require_documented "/
|
|
328
|
+
require_documented "/usage" "$ROOT/packages/piagent-core" "$ROOT/docs" "$ROOT/README.md"
|
|
333
329
|
require_documented "piagent_document_read" "$ROOT/packages/piagent-core" "$ROOT/docs"
|
|
334
330
|
require_documented "additionalReadRoots" "$ROOT/docs" "$ROOT/schemas/project-profile.schema.json"
|
|
335
|
-
require_documented "/
|
|
331
|
+
require_documented "/commands" "$ROOT/README.md" "$ROOT/docs" "$ROOT/packages/piagent-core/extensions/piagent-guard.ts"
|
|
332
|
+
require_documented "/workflow" "$ROOT/README.md" "$ROOT/docs" "$ROOT/packages/piagent-core/extensions/piagent-guard.ts"
|
|
333
|
+
require_documented "/name" "$ROOT/README.md" "$ROOT/docs" "$ROOT/packages/piagent-core/extensions/piagent-guard.ts"
|
|
334
|
+
require_documented "/fresh" "$ROOT/README.md" "$ROOT/docs" "$ROOT/packages/piagent-core/extensions/piagent-guard.ts"
|
|
335
|
+
require_documented "/context" "$ROOT/README.md" "$ROOT/docs" "$ROOT/packages/piagent-core/extensions/piagent-guard.ts"
|
|
336
|
+
require_documented "/permission" "$ROOT/README.md" "$ROOT/docs" "$ROOT/packages/piagent-core/extensions/piagent-guard.ts"
|
|
336
337
|
require_documented "auto-delegation" "$ROOT/README.md" "$ROOT/docs" "$ROOT/packages/piagent-core/prompts" "$ROOT/templates/project/AGENTS.md"
|
|
337
338
|
require_documented "Subagents used/not used" "$ROOT/packages/piagent-core/prompts" "$ROOT/docs/auto-delegation-policy.md"
|
|
338
339
|
require_documented "Subagent orchestration capabilities" "$ROOT/README.md" "$ROOT/docs/subagent-orchestration-capabilities.md"
|
|
@@ -415,13 +416,13 @@ require_documented "piagent_memory_citation_record" "$ROOT/packages/piagent-core
|
|
|
415
416
|
require_documented "piagent_context_index_status" "$ROOT/packages/piagent-core" "$ROOT/docs"
|
|
416
417
|
require_documented "piagent_context_index_record" "$ROOT/packages/piagent-core" "$ROOT/docs"
|
|
417
418
|
require_documented "piagent_context_index_search" "$ROOT/packages/piagent-core" "$ROOT/docs"
|
|
418
|
-
require_documented "/context
|
|
419
|
-
require_documented "/onboard
|
|
420
|
-
require_documented "/memory
|
|
421
|
-
require_documented "/model-options" "$ROOT/README.md" "$ROOT/docs" "$ROOT/packages/piagent-core/
|
|
422
|
-
require_documented "anthropic/claude" "$ROOT/README.md" "$ROOT/docs/model-options.md" "$ROOT/packages/piagent-core/
|
|
423
|
-
require_documented "gpt-5.6" "$ROOT/README.md" "$ROOT/docs/model-options.md" "$ROOT/packages/piagent-core/
|
|
424
|
-
require_documented "claude-fable-5" "$ROOT/README.md" "$ROOT/docs/model-options.md" "$ROOT/packages/piagent-core/
|
|
419
|
+
require_documented "/context index" "$ROOT/README.md" "$ROOT/docs" "$ROOT/packages/piagent-core/extensions/piagent-guard.ts"
|
|
420
|
+
require_documented "/onboard" "$ROOT/README.md" "$ROOT/docs" "$ROOT/templates/project/AGENTS.md"
|
|
421
|
+
require_documented "/memory" "$ROOT/README.md" "$ROOT/docs" "$ROOT/packages/piagent-core/extensions/piagent-guard.ts"
|
|
422
|
+
require_documented "/model-options" "$ROOT/README.md" "$ROOT/docs" "$ROOT/packages/piagent-core/extensions/piagent-guard.ts"
|
|
423
|
+
require_documented "anthropic/claude" "$ROOT/README.md" "$ROOT/docs/model-options.md" "$ROOT/packages/piagent-core/extensions/piagent-guard.ts"
|
|
424
|
+
require_documented "gpt-5.6" "$ROOT/README.md" "$ROOT/docs/model-options.md" "$ROOT/packages/piagent-core/extensions/piagent-guard.ts"
|
|
425
|
+
require_documented "claude-fable-5" "$ROOT/README.md" "$ROOT/docs/model-options.md" "$ROOT/packages/piagent-core/extensions/piagent-guard.ts"
|
|
425
426
|
require_documented "piagent-models" "$ROOT/README.md" "$ROOT/docs/model-options.md"
|
|
426
427
|
require_documented "enabledModels" "$ROOT/templates/global/settings.json" "$ROOT/docs/model-options.md" "$ROOT/scripts/configure-model-scope.sh"
|
|
427
428
|
require_documented "piagent-mcp" "$ROOT/README.md" "$ROOT/docs/mcp-and-tools.md" "$ROOT/scripts/mcp-manage.mjs"
|
|
@@ -455,9 +456,9 @@ if grep -E '@latest|"@upstash/context7-mcp"|"chrome-devtools-mcp"|"@playwright/m
|
|
|
455
456
|
exit 1
|
|
456
457
|
fi
|
|
457
458
|
require_documented "Ctrl+L" "$ROOT/README.md" "$ROOT/docs/model-options.md" "$ROOT/docs/team-onboarding.md" "$ROOT/docs/quickstart-vietnamese.md"
|
|
458
|
-
require_documented "/platform-improve" "$ROOT/
|
|
459
|
-
require_documented "/be-to-fe" "$ROOT/
|
|
460
|
-
require_documented "/scout" "$ROOT/
|
|
459
|
+
require_documented "/workflow platform-improve" "$ROOT/README.md" "$ROOT/docs" "$ROOT/packages/piagent-core/extensions/piagent-guard.ts"
|
|
460
|
+
require_documented "/workflow be-to-fe" "$ROOT/README.md" "$ROOT/docs" "$ROOT/packages/piagent-core/extensions/piagent-guard.ts"
|
|
461
|
+
require_documented "/workflow scout" "$ROOT/README.md" "$ROOT/docs" "$ROOT/packages/piagent-core/extensions/piagent-guard.ts"
|
|
461
462
|
require_documented "piagent_context_preflight" "$ROOT/packages/piagent-core" "$ROOT/docs"
|
|
462
463
|
require_documented ".pi/task-inbox" "$ROOT/.gitignore" "$ROOT/templates/project/.pi/.gitignore" "$ROOT/docs"
|
|
463
464
|
require_documented "Task Implementation Contract" "$ROOT/docs" "$ROOT/packages/piagent-core/prompts"
|
|
@@ -478,7 +479,7 @@ test -s "$ROOT/tests/policy-core.test.mjs"
|
|
|
478
479
|
# the file readable.
|
|
479
480
|
non_text_sources="$(
|
|
480
481
|
cd "$ROOT" && git ls-files -z -- '*.js' '*.mjs' '*.ts' '*.json' '*.md' '*.sh' '*.html' '*.css' \
|
|
481
|
-
| LC_ALL=C xargs -0 -
|
|
482
|
+
| LC_ALL=C xargs -0 -n 1 sh -c '[ ! -f "$1" ] || grep -qI "" "$1" 2>/dev/null || echo "$1"' sh
|
|
482
483
|
)"
|
|
483
484
|
if [[ -n "$non_text_sources" ]]; then
|
|
484
485
|
echo "Source files contain control bytes, so grep-based gates and diffs skip them:"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"projectId": "replace-me",
|
|
4
4
|
"profileMode": "generic",
|
|
5
5
|
"source": "manual",
|
|
6
|
-
"summary": "Pending. Run /onboard
|
|
6
|
+
"summary": "Pending. Run /onboard run after login/model selection to generate the compact project context index.",
|
|
7
7
|
"generatedAt": "not-configured",
|
|
8
8
|
"updatedAt": "not-configured",
|
|
9
9
|
"policy": {
|
|
@@ -20,6 +20,6 @@
|
|
|
20
20
|
"edges": [],
|
|
21
21
|
"citations": [],
|
|
22
22
|
"warnings": [
|
|
23
|
-
"context index pending; run /onboard
|
|
23
|
+
"context index pending; run /onboard run"
|
|
24
24
|
]
|
|
25
25
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
- Generated: not yet
|
|
6
6
|
- Profile: see `.pi/piagent-profile.json`
|
|
7
|
-
- Model/pass: run `/onboard
|
|
7
|
+
- Model/pass: run `/onboard run` after Pi login and model selection
|
|
8
8
|
- Scope: pending
|
|
9
9
|
|
|
10
10
|
## Purpose
|
|
@@ -16,13 +16,13 @@ Before the first real implementation task in this project:
|
|
|
16
16
|
1. Open Pi in the project.
|
|
17
17
|
2. Run `/login` if needed.
|
|
18
18
|
3. Select the intended provider/model.
|
|
19
|
-
4. Run `/onboard
|
|
19
|
+
4. Run `/onboard run`.
|
|
20
20
|
|
|
21
21
|
The selected model should inspect the project read-only, then replace this file with a concise project map, required context, verification matrix, and high-risk areas.
|
|
22
22
|
|
|
23
23
|
## Update triggers
|
|
24
24
|
|
|
25
|
-
Regenerate with `/onboard
|
|
25
|
+
Regenerate with `/onboard run` when:
|
|
26
26
|
|
|
27
27
|
- source layout changes;
|
|
28
28
|
- architecture or domain ownership changes;
|
|
@@ -7,8 +7,8 @@ This project uses Pi Agent Platform.
|
|
|
7
7
|
Before implementation:
|
|
8
8
|
|
|
9
9
|
1. Load `.pi/piagent-profile.json` with `piagent_context`.
|
|
10
|
-
2. If `.pi/project-context.md` still says "Generated: not yet", run `/onboard
|
|
11
|
-
3. Check `.pi/context-index.json` with `/context
|
|
10
|
+
2. If `.pi/project-context.md` still says "Generated: not yet", run `/onboard run` after login/model selection before the first implementation task.
|
|
11
|
+
3. Check `.pi/context-index.json` with `/context index` or `piagent_context_index_status` when available; use it only as an advisory navigation map.
|
|
12
12
|
4. Read `.pi/project-context.md` and required context files listed in the profile; use `piagent_context_budget` for large files.
|
|
13
13
|
5. Check project memory with `piagent_memory_status` when relevant; memory is advisory, source files are authoritative.
|
|
14
14
|
6. Start source-changing work with `piagent_task_start`.
|
|
@@ -16,10 +16,10 @@ Before implementation:
|
|
|
16
16
|
8. Use `piagent_exec_policy_check` before high-impact or complex shell commands.
|
|
17
17
|
9. Use `piagent_tool_policy_check` before non-piagent MCP/app tools.
|
|
18
18
|
10. Use MCP/tools only when declared in profile.
|
|
19
|
-
11. Use `piagent_usage_snapshot` or `/
|
|
19
|
+
11. Use `piagent_usage_snapshot` or `/usage` when the user asks about token/context usage or session follow-up.
|
|
20
20
|
12. Record context/verify/trace with `piagent_context_record`, `piagent_verify_record`, and `piagent_trace_record`. Passing verify evidence must be the exact command from `task.verifyCommands`.
|
|
21
21
|
13. Run `piagent_task_gate_check` before DONE.
|
|
22
|
-
14. For unclear tasks, use `/discuss` first; do not implement while requirements are unresolved.
|
|
22
|
+
14. For unclear tasks, use `/workflow discuss` first; do not implement while requirements are unresolved.
|
|
23
23
|
15. For external source repos, use `piagent-source-cache` and read targeted files only.
|
|
24
24
|
16. For medium/large tasks, auto-delegate independent read-only scout/planning/review work to `piagent-scout`, `piagent-planner`, `piagent-reviewer`, or `piagent-oracle` when `pi-subagents` is available. Do not require the user to type `/run` for normal task orchestration.
|
|
25
25
|
17. Keep implementation single-writer by default. Use parallel writers only with explicit user approval or safe worktree isolation and disjoint write sets.
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# Memory Policy
|
|
2
|
-
|
|
3
|
-
Use this workflow to inspect or configure project memory for a Pi Agent Platform project.
|
|
4
|
-
|
|
5
|
-
## Goals
|
|
6
|
-
|
|
7
|
-
- Keep durable project knowledge across sessions without forcing the model to re-scout the whole repo.
|
|
8
|
-
- Keep memory explicit, compact, inspectable, and safe.
|
|
9
|
-
- Avoid storing secrets, credentials, raw private data, or large source excerpts.
|
|
10
|
-
|
|
11
|
-
## Workflow
|
|
12
|
-
|
|
13
|
-
1. Call `piagent_context` with `detail=full`.
|
|
14
|
-
2. Call `piagent_memory_status` with `detail=full`.
|
|
15
|
-
3. If memory files are missing, explain that project memory can be initialized by project init/setup or by saving the first explicit note.
|
|
16
|
-
4. If the user asks to remember a stable fact, call `piagent_memory_note`.
|
|
17
|
-
5. If the user asks what is remembered, call `piagent_memory_search` or inspect the memory files.
|
|
18
|
-
6. If the user asks about automatic/background memory, explain the tradeoff:
|
|
19
|
-
- default platform memory is explicit-only and project-scoped;
|
|
20
|
-
- external Pi memory packages can be installed separately after source review;
|
|
21
|
-
- background extraction should be benchmarked before being enabled for teams.
|
|
22
|
-
|
|
23
|
-
## Rules
|
|
24
|
-
|
|
25
|
-
- Memory is advisory. Current repo files, task contracts, and user instructions are authoritative.
|
|
26
|
-
- Do not rely on memory alone for implementation decisions.
|
|
27
|
-
- Cite memory use visibly in the response when it materially affects a decision: `Memory cited: <file/path>`.
|
|
28
|
-
- Do not hand-edit generated memory state, SQLite catalogs, snapshots, or runtime cache files.
|
|
29
|
-
- Keep reusable workflow names and prompts in English.
|
|
30
|
-
|
|
31
|
-
## Recommended outputs
|
|
32
|
-
|
|
33
|
-
For status:
|
|
34
|
-
|
|
35
|
-
```text
|
|
36
|
-
Memory mode: manual
|
|
37
|
-
Scope: project
|
|
38
|
-
Summary: .pi/memory/memory_summary.md
|
|
39
|
-
Handbook: .pi/memory/MEMORY.md
|
|
40
|
-
Write policy: explicit-only
|
|
41
|
-
External packages: optional, review before install
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
For a remember request:
|
|
45
|
-
|
|
46
|
-
```text
|
|
47
|
-
Saved memory:
|
|
48
|
-
- category:
|
|
49
|
-
- title:
|
|
50
|
-
- path:
|
|
51
|
-
- redacted:
|
|
52
|
-
```
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Explain native Pi model selector/scope options across model families
|
|
3
|
-
argument-hint: "[task type, budget, or provider preference]"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Explain Pi provider/model/thinking selector options for:
|
|
7
|
-
|
|
8
|
-
```text
|
|
9
|
-
$ARGUMENTS
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
Mandatory flow:
|
|
13
|
-
|
|
14
|
-
1. Call `piagent_context`.
|
|
15
|
-
2. Call `piagent_usage_snapshot` if the user asks about current model/context/cost.
|
|
16
|
-
3. Make clear that model switching is done by Pi native UI, not by agent deciding for the user:
|
|
17
|
-
- `/model` or Ctrl+L for selector;
|
|
18
|
-
- `/scoped-models` for cycle scope;
|
|
19
|
-
- Ctrl+P / Shift+Ctrl+P for model cycling;
|
|
20
|
-
- Shift+Tab for thinking level.
|
|
21
|
-
4. Include both model families — the OpenAI Codex models and the Anthropic Claude models — unless the user explicitly restricts the provider. Name them as model families, never as another tool.
|
|
22
|
-
5. Do not limit the answer to one or two legacy examples. Include the current latest-family options: the Codex 5.5/5.6 models and the Claude Sonnet/Opus/Fable models, where relevant.
|
|
23
|
-
6. If the user needs available model versions, recommend `piagent-models`, `/model`, or `pi --list-models`.
|
|
24
|
-
7. Explain thinking levels as task effort, not as quality guarantee.
|
|
25
|
-
8. Do not claim token/cost savings without benchmark evidence.
|
|
26
|
-
|
|
27
|
-
Current latest-family catalog to consider:
|
|
28
|
-
|
|
29
|
-
OpenAI Codex models (provider `openai-codex`):
|
|
30
|
-
|
|
31
|
-
- `openai-codex/gpt-5.3-codex-spark`
|
|
32
|
-
- `openai-codex/gpt-5.4-mini`
|
|
33
|
-
- `openai-codex/gpt-5.4`
|
|
34
|
-
- `openai-codex/gpt-5.5`
|
|
35
|
-
- `openai-codex/gpt-5.6-luna`
|
|
36
|
-
- `openai-codex/gpt-5.6-sol`
|
|
37
|
-
- `openai-codex/gpt-5.6-terra`
|
|
38
|
-
|
|
39
|
-
Anthropic Claude models (provider `anthropic`):
|
|
40
|
-
|
|
41
|
-
- `anthropic/claude-haiku-4-5`
|
|
42
|
-
- `anthropic/claude-sonnet-4-5`
|
|
43
|
-
- `anthropic/claude-sonnet-4-6`
|
|
44
|
-
- `anthropic/claude-sonnet-5`
|
|
45
|
-
- `anthropic/claude-opus-4-5`
|
|
46
|
-
- `anthropic/claude-opus-4-6`
|
|
47
|
-
- `anthropic/claude-opus-4-7`
|
|
48
|
-
- `anthropic/claude-opus-4-8`
|
|
49
|
-
- `anthropic/claude-fable-5`
|
|
50
|
-
|
|
51
|
-
Default selector scope seeded by setup:
|
|
52
|
-
|
|
53
|
-
| Preset | OpenAI Codex model | Anthropic Claude model | Use when |
|
|
54
|
-
|---|---|---|---|
|
|
55
|
-
| Fast scout | `openai-codex/gpt-5.4-mini:low` | `anthropic/claude-haiku-4-5:low` | quick reads, simple Q&A |
|
|
56
|
-
| Balanced implement | `openai-codex/gpt-5.5:medium` | `anthropic/claude-sonnet-5:medium` | normal source tasks |
|
|
57
|
-
| Hard implement | `openai-codex/gpt-5.6-luna:xhigh` or `openai-codex/gpt-5.5:xhigh` | `anthropic/claude-sonnet-5:xhigh` | multi-file/debug/contract mapping |
|
|
58
|
-
| Strategic/deep | `openai-codex/gpt-5.6-sol:xhigh` | `anthropic/claude-opus-4-7:max` or `anthropic/claude-opus-4-8:max` | architecture, large refactor, high-risk review |
|
|
59
|
-
| Huge-context scout | `openai-codex/gpt-5.6-terra:xhigh` | `anthropic/claude-fable-5:max` | large repo/docs synthesis |
|
|
60
|
-
|
|
61
|
-
Output:
|
|
62
|
-
|
|
63
|
-
- Current model/context if available.
|
|
64
|
-
- How to open/select/change model in Pi UI.
|
|
65
|
-
- What `enabledModels`/scope contains.
|
|
66
|
-
- Codex model family options.
|
|
67
|
-
- Claude model family options.
|
|
68
|
-
- How to inspect/re-apply model scope from terminal.
|