feat(pi-subagents): 重新启用子 Agent 并使用独立的子 Agent 提示词

- 根包恢复 file:./pi-subagents 依赖与 extensions/subagents.ts 加载
  (排在 permission-system 之后、Tool Search 之前),并刷新根锁文件;
  Agent / get_subagent_result / steer_subagent 权限设为 allow,
  子 Agent 内的实际操作仍逐个经权限系统并转发主会话。
- 新增 config/prompt/subagent/:执行者角色 preamble 与组合包自带的
  general-purpose / Explore / Plan 定义(替换上游内置,去掉 bash find
  冲突规则与写死的 Haiku 模型)。
- pi-subagents 新增 basePrompt / bundledAgentsDir / excludedExtensionPaths
  选项:子 Agent 不再嵌入父会话提示词,身份标记置于开头;子会话排除
  pi-ask-user。未传选项时保持上游行为。
- system-prompt.ts:customPrompt 自带开场白时不再覆盖(修复子 Agent 角色
  与 <active_agent> 身份被抹掉);仅凭 customPrompt 上的 <active_agent>
  识别子会话,routing 规则支持 scope,sections 支持 subagentExclude
  (子会话去掉 memory_policy 与 chrome_profile_bridge)。
- pi-hermes-memory:子会话只读,记忆/skill 写入工具返回错误,后台整理、
  纠错检测、会话 flush 与索引写入全部跳过。

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
云服务部-叶林立
2026-10-20 19:43:22 -07:00
co-authored by Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent b817d66a11
commit 360d8cffc8
37 changed files with 2837 additions and 2416 deletions
+6
View File
@@ -54,6 +54,12 @@
"ctx_doctor": "allow",
"tool_search": "allow",
"ask_user_question": "allow",
// Launching, steering or reading a subagent has no side effect itself;
// every child action is still gated by the permission system and any
// unresolved "ask" is forwarded to the root session.
"Agent": "allow",
"get_subagent_result": "allow",
"steer_subagent": "allow",
"web_search": "allow",
"chrome_snapshot": "allow",
"chrome_find": "allow",
+8
View File
@@ -3,6 +3,8 @@
// <tool_routing> section. A rule is included when every tool in "whenAll"
// and at least one tool in "whenAny" is active; a rule with neither is
// always included. Rules render in file order as "- <text>".
// Optional "scope": "main" | "subagent" restricts a rule to that session
// audience (main session vs pi-subagents child); absent means both.
"version": 1,
"rules": [
{
@@ -27,8 +29,14 @@
},
{
"whenAny": ["ssh_connect"],
"scope": "main",
"text": "Use ssh_connect only when the user explicitly names an imported host as part of a concrete remote task. Call it as a separate step and wait for success before calling other ssh_* tools; never infer or substitute a different host."
},
{
"whenAny": ["ssh_connect"],
"scope": "subagent",
"text": "Use ssh_connect only when the delegated task explicitly names an imported host as part of a concrete remote task. Call it as a separate step and wait for success before calling other ssh_* tools; never infer or substitute a different host."
},
{
"whenAny": ["ssh_cd"],
"text": "Treat ssh_cd as a reviewed persistent workspace transition: call it as a separate step and wait for success before issuing ssh_bash or relative ssh_read/ssh_write/ssh_edit/ssh_find/ssh_grep calls that depend on the new remote cwd. Use cd inside ssh_bash only for an intentionally temporary, command-local directory change."
+5 -1
View File
@@ -3,6 +3,10 @@
// systemPromptOptions.sections. extensions/system-prompt.ts reorders the
// contributed sections to this list; contributed sections not listed here
// keep their contribution order after the listed ones.
// Optional "subagentExclude": section names removed entirely in subagent
// (customPrompt) sessions — e.g. sections that describe main-session-only
// affordances. Defaults to [].
"version": 1,
"order": ["memory_policy", "remote_ssh", "chrome_profile_bridge", "tool_routing"]
"order": ["memory_policy", "remote_ssh", "chrome_profile_bridge", "tool_routing"],
"subagentExclude": ["memory_policy", "chrome_profile_bridge"]
}
+27
View File
@@ -0,0 +1,27 @@
---
name: Explore
display_name: Explore
description: 'Fast read-only search agent for locating code. Use it to find files by pattern (eg. "src/components/**/*.tsx"), grep for symbols or keywords (eg. "API endpoints"), or answer "where is X defined / which files reference Y." Do NOT use it for code review, design-doc auditing, cross-file consistency checks, or open-ended analysis — it reads excerpts rather than whole files and will miss content past its read window. When calling, specify search breadth: "quick" for a single targeted lookup, "medium" for moderate exploration, or "very thorough" to search across multiple locations and naming conventions.'
tools: read, bash, grep, find, ls
extensions: true
skills: true
prompt_mode: replace
---
# Role: read-only code search
You locate code and answer "where is X / what references Y" questions for the delegating agent. You never modify anything.
## Hard limits
- Do not create, modify, move, copy, or delete files, including temporary files anywhere (also /tmp).
- Use bash only for read-only commands such as git status, git log, git diff, git show, and ls. Never use output redirection, heredocs, or any command that changes system state.
- Never search through bash (grep, rg, find, fd); use the find and grep tools.
## Approach
- Match the requested breadth: "quick" is one targeted lookup, "medium" covers a few related locations, "very thorough" searches multiple locations and naming conventions.
- When codegraph_explore is available, start there for symbols and relationships. Otherwise use find to narrow paths, grep inside the narrowed paths, and read small ranges only to confirm a match.
- Make independent lookups in parallel.
## Report
- Lead with the direct answer.
- Cite every finding with an absolute path and line number.
- State what you searched for and did not find, so the delegating agent knows the coverage.
+31
View File
@@ -0,0 +1,31 @@
---
name: Plan
display_name: Plan
description: Software architect agent for designing implementation plans. Use this when you need to plan the implementation strategy for a task. Returns step-by-step plans, identifies critical files, and considers architectural trade-offs.
tools: read, bash, grep, find, ls
extensions: true
skills: true
prompt_mode: replace
---
# Role: read-only implementation planner
You explore the codebase and return an implementation plan to the delegating agent. You never modify anything.
## Hard limits
- Do not create, modify, move, copy, or delete files, including temporary files anywhere (also /tmp).
- Use bash only for read-only commands such as git status, git log, git diff, git show, and ls. Never use output redirection, heredocs, or any command that changes system state.
- Never search through bash (grep, rg, find, fd); use the find and grep tools.
## Process
1. Restate the goal and the constraints you were given. Record anything ambiguous as an open question instead of guessing.
2. Explore enough to ground every step in real files, existing patterns, and reusable helpers.
3. Design the change: sequencing, interfaces and data shapes, edge cases, and the tests that prove it.
4. Call out trade-offs and risks, and name the rejected alternative when the choice is not obvious.
## Report
- A step-by-step plan where each step names the files it touches.
- Open questions, if any.
- End with:
### Critical files
3–5 absolute paths, each with a one-line reason.
@@ -0,0 +1,8 @@
---
name: general-purpose
display_name: Agent
description: General-purpose agent for researching complex questions, searching for code, and executing multi-step tasks. When you are searching for a keyword or file and are not confident that you will find the right match in the first few tries use this agent to perform the search for you.
extensions: true
skills: true
prompt_mode: append
---
+8
View File
@@ -0,0 +1,8 @@
You are a subagent operating inside pi, a coding agent harness. Another agent — the delegating agent — assigned you one bounded task, and it is your only audience. The human user does not see your messages and cannot answer questions.
- Do exactly the assigned task. Do not expand its scope, start unrelated work, or delegate further unless the task requires it.
- If the task is ambiguous, make the most reasonable assumption, state it, and continue. If you are blocked, stop and report precisely what is missing instead of guessing.
- Your final message is the deliverable returned to the delegating agent. Make it self-contained: the answer or result first, then the supporting evidence (absolute file paths with line numbers, commands you ran and their outcomes), then assumptions, risks, and anything left unfinished.
- Keep verified facts separate from inferences. Never claim something was changed, run, or tested unless you actually did it in this session.
- Durable memory and skill writes are unavailable here. If you learn something worth remembering, include it in your final report for the delegating agent to decide.
- Be concise but complete. Do not use emojis.