personal-bot 0.2.11 → 0.2.13

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 (151) hide show
  1. package/.claude-plugin/marketplace.json +18 -0
  2. package/.claude-plugin/plugin.json +15 -0
  3. package/CONTEXT.md +11 -5
  4. package/README.md +45 -14
  5. package/README.zh-CN.md +45 -14
  6. package/bin/pbot-pi-acp.mjs +20 -0
  7. package/docs/README.md +6 -4
  8. package/docs/adr/0001-claude-skill-discovery.md +3 -0
  9. package/docs/adr/0002-claude-native-collaboration.md +3 -0
  10. package/docs/agent-collaboration.md +54 -6
  11. package/docs/architecture-guidelines.md +1 -1
  12. package/docs/capability-design.md +15 -3
  13. package/docs/claude-code-design.md +45 -0
  14. package/docs/claude-code.md +64 -0
  15. package/docs/dsh.md +12 -11
  16. package/docs/file-storage.md +26 -9
  17. package/docs/history.md +17 -9
  18. package/docs/interaction-design.md +11 -3
  19. package/docs/model-context.md +43 -12
  20. package/docs/model-instruction-guidelines.md +3 -3
  21. package/docs/release.md +13 -5
  22. package/docs/technical-design.md +59 -19
  23. package/docs/workspace-configuration.md +50 -23
  24. package/hooks/hooks.json +19 -0
  25. package/lib/claude.d.ts +1 -0
  26. package/lib/claude.js +20 -0
  27. package/lib/client.js +41 -8
  28. package/lib/dsh.js +2 -0
  29. package/lib/extension/acp-member.d.ts +16 -0
  30. package/lib/extension/acp-member.js +45 -0
  31. package/lib/extension/acp-worker.d.ts +1 -0
  32. package/lib/extension/acp-worker.js +159 -0
  33. package/lib/extension/claude-hooks.d.ts +15 -0
  34. package/lib/extension/claude-hooks.js +104 -0
  35. package/lib/extension/dsh/acp-member.d.ts +4 -0
  36. package/lib/extension/dsh/acp-member.js +48 -0
  37. package/lib/extension/dsh/command.js +11 -1
  38. package/lib/extension/dsh/history.js +1 -1
  39. package/lib/extension/dsh/management.js +3 -1
  40. package/lib/extension/dsh/workspace.d.ts +35 -1
  41. package/lib/extension/dsh/workspace.js +21 -3
  42. package/lib/integrations/acp/agents.d.ts +24 -0
  43. package/lib/integrations/acp/agents.js +168 -0
  44. package/lib/integrations/acp/claude.d.ts +18 -0
  45. package/lib/integrations/acp/claude.js +33 -0
  46. package/lib/integrations/acp/connection.d.ts +27 -0
  47. package/lib/integrations/acp/connection.js +167 -0
  48. package/lib/integrations/acp/input.d.ts +4 -0
  49. package/lib/integrations/acp/input.js +45 -0
  50. package/lib/integrations/acp/launch.d.ts +4 -0
  51. package/lib/integrations/acp/launch.js +52 -0
  52. package/lib/integrations/acp/model-selection.d.ts +12 -0
  53. package/lib/integrations/acp/model-selection.js +65 -0
  54. package/lib/integrations/agent-resources.d.ts +1 -1
  55. package/lib/integrations/agent-resources.js +3 -1
  56. package/lib/integrations/dsh/dsh-agents.d.ts +2 -1
  57. package/lib/integrations/dsh/dsh-agents.js +4 -0
  58. package/lib/integrations/dsh/history-summary.js +5 -9
  59. package/lib/integrations/dsh/history.js +13 -5
  60. package/lib/integrations/history-summary.d.ts +2 -0
  61. package/lib/integrations/history-summary.js +21 -10
  62. package/lib/model/acp.d.ts +59 -0
  63. package/lib/model/acp.js +1 -0
  64. package/lib/model/agent.d.ts +15 -1
  65. package/lib/model/history.d.ts +11 -4
  66. package/lib/model/workspace-config.d.ts +3 -0
  67. package/lib/services/agents/acp-run.d.ts +42 -0
  68. package/lib/services/agents/acp-run.js +149 -0
  69. package/lib/services/agents/agent-service.d.ts +114 -6
  70. package/lib/services/agents/agent-service.js +81 -10
  71. package/lib/services/agents/team-service.js +4 -2
  72. package/lib/services/history/history-service.d.ts +8 -6
  73. package/lib/services/history/history-service.js +90 -48
  74. package/lib/services/workspace/python-environment-service.d.ts +6 -0
  75. package/lib/services/workspace/python-environment-service.js +25 -9
  76. package/lib/services/workspace/workspace-config.js +12 -1
  77. package/lib/storage/acp-files.d.ts +9 -0
  78. package/lib/storage/acp-files.js +50 -0
  79. package/lib/storage/agent-files.d.ts +5 -4
  80. package/lib/storage/agent-files.js +14 -2
  81. package/lib/storage/history-files.d.ts +2 -1
  82. package/lib/storage/history-files.js +26 -15
  83. package/lib/tools/agents/actions.d.ts +16 -2
  84. package/lib/tools/agents/actions.js +3 -1
  85. package/lib/tools/agents/contract.d.ts +48 -3
  86. package/lib/tools/agents/contract.js +15 -9
  87. package/lib/tools/agents/dsh-contract.d.ts +8 -15
  88. package/lib/tools/agents/dsh-contract.js +12 -8
  89. package/lib/tools/history/contract.d.ts +7 -7
  90. package/lib/tools/history/contract.js +2 -2
  91. package/lib/ui/dsh/management.js +37 -9
  92. package/npm-shrinkwrap.json +975 -51
  93. package/package.json +40 -29
  94. package/python/README.md +17 -14
  95. package/resources/agents/coordinator.md +1 -1
  96. package/resources/claude/agents/general-purpose.md +12 -0
  97. package/resources/claude/skills/pbot/SKILL.md +17 -0
  98. package/resources/prompts/claude-coordinator.md +1 -0
  99. package/resources/prompts/native-coordinator.md +1 -0
  100. package/resources/prompts/workspace.md +2 -2
  101. package/resources/references/compute.md +2 -2
  102. package/resources/references/task-conductor.md +3 -2
  103. package/resources/skills/.claude-plugin/plugin.json +4 -0
  104. package/resources/skills/provider-connections/SKILL.md +17 -1
  105. package/scripts/README.md +29 -5
  106. package/src/claude.ts +19 -0
  107. package/src/dsh.ts +1 -0
  108. package/src/extension/acp-member.ts +44 -0
  109. package/src/extension/acp-worker.ts +124 -0
  110. package/src/extension/agent-events.ts +28 -3
  111. package/src/extension/agents-command.ts +33 -5
  112. package/src/extension/claude-hooks.ts +94 -0
  113. package/src/extension/dsh/acp-member.ts +44 -0
  114. package/src/extension/dsh/command.ts +10 -1
  115. package/src/extension/dsh/history.ts +1 -1
  116. package/src/extension/dsh/management.ts +2 -1
  117. package/src/extension/dsh/workspace.ts +21 -3
  118. package/src/extension/lifecycle.ts +2 -2
  119. package/src/extension/pi-acp-member.ts +64 -0
  120. package/src/integrations/acp/agents.ts +118 -0
  121. package/src/integrations/acp/claude.ts +40 -0
  122. package/src/integrations/acp/connection.ts +152 -0
  123. package/src/integrations/acp/input.ts +39 -0
  124. package/src/integrations/acp/launch.ts +50 -0
  125. package/src/integrations/acp/model-selection.ts +66 -0
  126. package/src/integrations/agent-resources.ts +2 -1
  127. package/src/integrations/dsh/dsh-agents.ts +4 -1
  128. package/src/integrations/dsh/history-summary.ts +5 -9
  129. package/src/integrations/dsh/history.ts +12 -6
  130. package/src/integrations/history-summary.ts +18 -8
  131. package/src/integrations/pi/history.ts +16 -15
  132. package/src/integrations/pi/pi-agents.ts +4 -1
  133. package/src/model/acp.ts +26 -0
  134. package/src/model/agent.ts +7 -1
  135. package/src/model/history.ts +12 -4
  136. package/src/model/workspace-config.ts +4 -0
  137. package/src/pbot.ts +5 -4
  138. package/src/services/agents/acp-run.ts +123 -0
  139. package/src/services/agents/agent-service.ts +85 -12
  140. package/src/services/agents/team-service.ts +3 -2
  141. package/src/services/history/history-service.ts +82 -41
  142. package/src/services/workspace/python-environment-service.ts +26 -9
  143. package/src/services/workspace/workspace-config.ts +10 -1
  144. package/src/storage/acp-files.ts +50 -0
  145. package/src/storage/agent-files.ts +15 -4
  146. package/src/storage/history-files.ts +20 -11
  147. package/src/tools/agents/actions.ts +4 -2
  148. package/src/tools/agents/contract.ts +16 -9
  149. package/src/tools/agents/dsh-contract.ts +12 -8
  150. package/src/tools/history/contract.ts +2 -2
  151. package/src/ui/dsh/management.ts +32 -9
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "personal-bot",
3
+ "owner": {
4
+ "name": "Personal Bot maintainers"
5
+ },
6
+ "plugins": [
7
+ {
8
+ "name": "personal-bot",
9
+ "version": "0.2.13",
10
+ "description": "Workspace materials, skills, native experts, and shared Python.",
11
+ "source": {
12
+ "source": "npm",
13
+ "package": "personal-bot",
14
+ "version": "0.2.13"
15
+ }
16
+ }
17
+ ]
18
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "personal-bot",
3
+ "version": "0.2.13",
4
+ "description": "Workspace materials, skills, native experts, and shared Python.",
5
+ "skills": [
6
+ "./resources/skills",
7
+ "./resources/claude/skills"
8
+ ],
9
+ "agents": [
10
+ "./resources/claude/agents/general-purpose.md"
11
+ ],
12
+ "engines": {
13
+ "claude-code": ">=2.1.325"
14
+ }
15
+ }
package/CONTEXT.md CHANGED
@@ -8,11 +8,13 @@
8
8
 
9
9
  **专业方法**:按任务选择的研究、计算、分析或复核方法,包含适用条件与判断依据。
10
10
 
11
- **工作区**:组织资料和开展工作的目录范围。两种宿主共享业务资料与历史归档,各自管理原生会话、配置和运行状态。
11
+ **Personal Bot 宿主**:用户直接与 Personal Bot 主会话交互的 AI 助手环境,区别于受委派执行任务的子会话。
12
+
13
+ **工作区**:组织资料和开展工作的目录范围。不同宿主共享业务资料与启用配置,各自管理原生会话和运行状态;Pi/dsh 维护工作区历史归档。
12
14
 
13
15
  **工作区记忆**:跨会话查找、使用与修正资料的能力,同一主题维护一份当前正文。
14
16
 
15
- **历史消息树(history)**:问答原文、分层摘要、父子关系和来源引用组成的检索资料。完整工具日志、图片与会话恢复由原生存储负责。
17
+ **历史消息树(history)**:Pi/dsh 提供的问答原文、分层摘要、父子关系和来源引用检索资料,兼容读取既有 Claude 归档。完整工具日志、图片与会话恢复由原生存储负责。
16
18
 
17
19
  **资料维护**:根据任务进展更新相关说明,归集成果,提炼可复用的方法与口径。
18
20
 
@@ -24,7 +26,7 @@
24
26
 
25
27
  **调用约定**:当前工具版本的输入、结果与执行要求。
26
28
 
27
- **Personal Bot 启用**:宿主按原生配置加载扩展。资料准备使用可选的 `/pbot init`。
29
+ **Personal Bot 启用**:用户为当前工作区开启 Personal Bot 业务能力。安装或加载插件、显示技能目录与启用工作区是分别的操作。
28
30
 
29
31
  **配套插件**:独立安装的附加能力。所需外部服务按该插件的流程准备。
30
32
 
@@ -36,9 +38,13 @@
36
38
 
37
39
  **通用专家(general-purpose)**:具有独立上下文和任务归属的子会话,在委派范围内完成研究、实现、计算或复核。工作区可在 `agents/general-purpose.md` 补充职责,协调者对应 `agents/coordinator.md`。
38
40
 
39
- **子会话(agent)**:由 start 创建,以 agentId 标识,绑定所属宿主、父会话和分支。存活时可 send,停止后用 resume 携新要求恢复。
41
+ **pbot 子会话(agent)**:Pi/dsh 由 start 创建的受管会话,以 agentId 标识,绑定所属宿主、父会话和分支。存活时可 send,停止后用 resume 携新要求恢复;ACP 目标可为 Pi、dsh 或 Claude。
42
+
43
+ **宿主原生子代理**:由宿主管理的独立任务会话,任务完成后的继续对话与恢复遵循宿主规则。
44
+
45
+ **pbot 团队(team)**:Pi/dsh 同一父会话中的固定成员、共同目标与公共记录,以 teamId 标识。关闭团队保留成员与历史。
40
46
 
41
- **团队(team)**:同一父会话中的固定成员、共同目标与公共记录,以 teamId 标识。关闭团队保留成员与历史。
47
+ **宿主原生团队**:由宿主管理的协作成员及其通信关系,团队组织与成员状态遵循宿主的协作模型。
42
48
 
43
49
  **团队批次(team run)**:以 runId 标识的有限轮次。roundRobin 按成员顺序执行;parallel 同轮并行,完成后进入下一轮。继续讨论使用新批次。
44
50
 
package/README.md CHANGED
@@ -4,17 +4,19 @@ English | [简体中文](README.zh-CN.md)
4
4
 
5
5
  **A personal assistant connecting knowledge, research, and action.**
6
6
 
7
- Personal Bot provides a workspace-scoped [Pi](https://pi.dev) extension and a native dsh Web integration for organizing materials, project work, research, specialist collaboration, and authorized operations. The model handles analysis and coordination; the plugin adds workspace materials, specialist sessions, history search, and a shared Python environment.
7
+ Personal Bot provides a workspace-scoped [Pi](https://pi.dev) extension, a native dsh Web integration, and a standard Claude Code plugin. It supports organizing materials, project work, research, specialist collaboration, and authorized operations. Pi/dsh add managed specialists, teams, and history search. Claude uses native skills, Agent/teams, and Node command hooks. All three share workspace materials and a Python environment.
8
+
9
+ Claude's model-driven context, skills, and specialist behavior still need validation in an approved native model environment. See the [Claude Code guide](docs/claude-code.md) (Chinese) for operations.
8
10
 
9
11
  ## Enable a workspace
10
12
 
11
- After installation, open Pi or dsh in the target workspace and run `/pbot init` to initialize and enable it. Pi and dsh share the `.pbot/config.json` created by this command:
13
+ After installation, open the host in the target workspace. Pi/dsh use `/pbot init`; Claude uses the native skill `/personal-bot:pbot init`. These initialize materials and enable the shared `.pbot/config.json`:
12
14
 
13
15
  ```json
14
16
  { "enabled": true }
15
17
  ```
16
18
 
17
- A missing file or false leaves Personal Bot inactive, without packaged skills or pbot prompts, and directs the user to `init`. Pi's status bar and the dsh workspace page show the runtime state; `/pbot status` remains available. After manual configuration edits, use `/reload` in Pi or restart dsh. See [workspace configuration](docs/workspace-configuration.md) (Chinese).
19
+ A missing, disabled, or invalid config leaves Personal Bot inactive; only the current workspace root is checked, with no automatic configuration migration. Pi/dsh withhold packaged skills and pbot prompts. Claude can display static skill names and descriptions; its hooks block work methods invoked through Skill or direct slash commands while leaving the pbot initialization skill available. Inspect state with Pi/dsh `/pbot status` or Claude `/personal-bot:pbot status`. After manual edits, use `/reload` in Pi or restart dsh; Claude reads current configuration at its hooks and CLI operations, with the root fixed by `CLAUDE_PROJECT_DIR`. See [workspace configuration](docs/workspace-configuration.md) (Chinese).
18
20
 
19
21
  ## Install
20
22
 
@@ -74,6 +76,34 @@ dsh plugin --profile pbot update personal-bot --latest
74
76
 
75
77
  The desktop application installs `personal-bot@latest` through its native Plugins page and uses a separate desktop profile. See the [dsh guide](docs/dsh.md) (Chinese) for launcher options, updates, and chat commands.
76
78
 
79
+ ### Claude Code
80
+
81
+ Use an interactive Claude Code terminal on Linux or macOS with **Claude Code 2.1.325+**, **Node.js 22.19+**, and Python 3.11+ with venv/ensurepip. Install through Claude's native marketplace command:
82
+
83
+ ```text
84
+ /plugin install personal-bot --marketplace realqiyan/personal-bot
85
+ ```
86
+
87
+ Choose the installation scope through Claude's plugin manager, then use `/personal-bot:pbot init` and `/personal-bot:pbot status` in the target workspace. These are native skills: the model runs the corresponding Node CLI through Bash. For deterministic execution, run `node /absolute/path/to/plugin/lib/claude.js init`, `status`, or `python setup` with `CLAUDE_PROJECT_DIR` set to the workspace root. Claude owns login, models, permissions, native agents, teams, and MCP configuration; `pbot setup` remains the Pi installer.
88
+
89
+ For native teams, the user enables Claude's experimental feature with `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` before starting Claude. pbot does not change this setting or provide pbot team scheduling in Claude. Continue work explicitly after returning to a session; native resume/rewind does not restore in-process teammates.
90
+
91
+ The enabled plugin prepares shared Python and supplies its full executable path for native Bash; it does not change Claude's PATH or environment variables. The standard plugin provides materials, skills, and native specialists. Existing Claude history archives and old control records remain preserved. See the [Claude guide](docs/claude-code.md) (Chinese) for operations and Python use.
92
+
93
+ ### Optional: ACP specialist programs
94
+
95
+ Pi/dsh use ACP to delegate independent work to Pi, dsh, or Claude. Install each target you need on the machine running the main host:
96
+
97
+ | Target | Installation | Authentication and model |
98
+ | --- | --- | --- |
99
+ | Pi | With Pi installed, run `npm install -g pi-acp`. Install Pi itself with `npm install -g @earendil-works/pi-coding-agent` if needed. | Run `pi` to sign in and select a default model. |
100
+ | dsh | An existing command-line dsh installation is sufficient; otherwise run `npm install -g @deepseek-ai/dsh@latest`. | Configure the target profile's model and authentication through dsh. The default entry is `dsh --profile acp`. |
101
+ | Claude Code | `npm install -g @agentclientprotocol/claude-agent-acp` | Follow the [Claude Code guide](https://code.claude.com/docs/en/quickstart) to sign in or configure API access, then set a default model. |
102
+
103
+ Check the target from the same terminal that starts your main host, for example with `command -v claude-agent-acp`. Retry the original start request after installation. If the program is installed but absent from the host's PATH, put its absolute path in the workspace [acp configuration](docs/workspace-configuration.md#acp-启动配置) (Chinese). Restart the main host after PATH changes. For workspace ACP configuration changes, run `/reload` in Pi or restart dsh.
104
+
105
+ When a program is missing, the tool returns its installation command, authentication guidance, and a path configuration example. See [ACP members](docs/agent-collaboration.md#acp-成员) (Chinese) for calls and continued conversations.
106
+
77
107
  ### Use from source
78
108
 
79
109
  ```bash
@@ -84,7 +114,7 @@ npm run build:cli
84
114
  node bin/pbot.mjs setup
85
115
  ```
86
116
 
87
- To load only the Pi source extension, run `pi install --local /absolute/path/to/personal-bot` from the workspace and keep that source directory and its dependencies available. For dsh, follow the [source installation steps](docs/dsh.md#从源码安装) (Chinese).
117
+ To load only the Pi source extension, run `pi install --local /absolute/path/to/personal-bot` from the workspace and keep that source directory and its dependencies available. Run the full `npm run build` before using ACP members or the Claude plugin. The build order is CLI → dsh → Claude because the CLI build clears `lib/`. For dsh, follow the [source installation steps](docs/dsh.md#从源码安装); for Claude, use the [development checks](docs/claude-code.md#依赖与开发检查) (Chinese).
88
118
 
89
119
  ### Optional: Task Conductor
90
120
 
@@ -96,7 +126,7 @@ Notifications return to the session that submitted the task. Service tasks conti
96
126
 
97
127
  ## Daily use
98
128
 
99
- Describe the task directly: organize materials, compare findings, delegate a review, or run calculations. These commands are for Pi; dsh commands are in its guide.
129
+ Describe the task directly: organize materials, compare findings, delegate a review, or run calculations. These commands are for Pi; see the [dsh](docs/dsh.md) and [Claude](docs/claude-code.md) guides for their native interfaces.
100
130
 
101
131
  | Command | Purpose |
102
132
  | --- | --- |
@@ -111,9 +141,9 @@ Describe the task directly: organize materials, compare findings, delegate a rev
111
141
 
112
142
  - **Initialization and materials:** `/pbot init` creates missing materials and enables the workspace, preserving existing materials and other configuration fields. Pi reloads on first activation; an already running workspace loads a newly created root AGENTS after `/reload`.
113
143
  - **Native tools:** Use CLI tools through Bash and MCP through the host's configuration. Add Pi project connections with `pi mcp add --local <server> ...` and inspect their source with `/mcp`. See the [connection skill](resources/skills/provider-connections/SKILL.md).
114
- - **History:** Pi and dsh query shared workspace archives. Originals are searchable first; after a main interaction, the current model fills pending summaries through additional model calls. New input cancels that work first. See [history](docs/history.md).
115
- - **Specialists and teams:** Delegate independent work, continue a conversation, or organize ordered discussions and parallel rounds. Pi specialists require tmux; dsh uses native sessions. A running team reserves its members. Pause and drain in-flight work before private tasks. See [specialist collaboration](docs/agent-collaboration.md).
116
- - **Python:** Enabled workspaces share one venv for the current user. Workspace activation prepares it and activates it in the host process. Use `python` or `python3` through Bash. Stop scripts using the environment before dependency updates. See the [Python guide](python/README.md) for paths, troubleshooting, and licenses.
144
+ - **History:** Pi/dsh refresh and summarize their own sources and query all existing archives, including preserved Claude archives. Originals are searchable first; after a main interaction, the current model fills pending summaries through additional model calls. New input cancels that work first. Claude uses native session history. See [history](docs/history.md).
145
+ - **Specialists and teams:** Default Pi specialists require tmux; dsh uses native sessions. Pi/dsh pbot teams support ordered discussions and parallel rounds; pause and drain their work before private tasks. Claude uses native Agent and native team tools. Pi/dsh ACP calls Pi, dsh, and Claude Code for independent conversations, reports, and explicit restoration. ACP model and thinking are independently optional; omitted values use the target host defaults. See [specialist collaboration](docs/agent-collaboration.md).
146
+ - **Python:** Enabled workspaces share one venv for the current user. Pi/dsh prepare and activate it in the host process for Bash `python` or `python3`. Claude prepares it and uses the full `python.executable` path through Bash. Stop scripts using the environment before dependency updates. See the [Python guide](python/README.md) for paths, troubleshooting, and licenses.
117
147
  - **Material maintenance:** Ask the assistant to organize a project, repeat an analysis with its existing definitions, or check a delivery. The [maintenance skill](resources/skills/project-maintenance/SKILL.md) updates current guidance and extracts reusable methods while preserving formal materials, history, and backups.
118
148
 
119
149
  Use `pi --resume` to select the main session explicitly; `pi --continue` can select the most recently active child. Enter managed specialists through `/pbot agents`. Opening a stopped specialist's saved session leaves it idle; use resume with a new instruction to continue work. Keep one writer per running session.
@@ -122,20 +152,21 @@ Use `pi --resume` to select the main session explicitly; `pi --continue` can sel
122
152
 
123
153
  | Location | Purpose |
124
154
  | --- | --- |
125
- | `.pbot/config.json` | Shared Pi/dsh workspace activation and configuration |
155
+ | `.pbot/config.json` | Shared Pi/dsh/Claude workspace activation and configuration |
126
156
  | `AGENTS.md` | Navigation and working agreements |
127
157
  | `areas/`, `projects/` | Long-term goals, tasks, conclusions, and deliverables |
128
158
  | `knowledge/` | Reusable concepts, methods, and analysis definitions |
129
- | `.pbot/history/` | Pi/dsh exchanges, summaries, and node links |
159
+ | `.pbot/history/` | Pi/dsh exchanges, summaries, and node links; preserved Claude archives |
130
160
  | `providers/` | External tool guidance, data definitions, and sources |
131
161
  | `scratch/` | Temporary scripts, calculation data, downloads, and environments |
132
- | `agents/`, `.agents/skills/` | Role additions and workspace skills |
162
+ | `agents/` | Role additions |
163
+ | `.agents/skills/` (Pi/dsh), `.claude/skills/` (Claude) | Workspace skills discovered by the current host |
133
164
 
134
165
  Existing layouts and agreements take precedence. Fetch queryable data when needed using the recorded definitions. Stop writes in the old instance before copying a workspace; concurrent writes from multiple machines to a synchronized directory are unsupported. See [file storage](docs/file-storage.md).
135
166
 
136
167
  ## Updates and operating scope
137
168
 
138
- Current release: **0.2.11**. Update through the host's native package manager. For a local Pi source, update the checkout, run `npm ci --ignore-scripts` when dependencies change, then reload or restart. Stop active specialists before changing versions. Recreate specialists across compatibility lines; existing materials, history, and backups are preserved.
169
+ Current release: **0.2.13**. Update through the host's native package manager. For a local Pi source, update the checkout, run `npm ci --ignore-scripts` when dependencies change, then reload or restart. Stop active specialists before changing versions. Recreate specialists across compatibility lines; existing materials, history, and backups are preserved.
139
170
 
140
171
  Operations follow the user's request, existing agreements, and required confirmations. Bash, Python, MCP, and extensions use the actual account and credential permissions. Enforce hard limits through read-only credentials, service controls, or restricted environments. Trades, transfers, and ledger changes require authorization for those operations. After cancellation, timeout, or disconnection, query native status before retrying to avoid duplicate execution.
141
172
 
@@ -143,7 +174,7 @@ Task Conductor nodes need their own tools, environment, skills, and authenticati
143
174
 
144
175
  ## Development and documentation
145
176
 
146
- Development for both hosts uses Linux and Node.js 24.9+. After installing locked dependencies, run:
177
+ Development and complete acceptance for all three hosts use Linux and Node.js 24.9+. After installing locked dependencies, run:
147
178
 
148
179
  ```bash
149
180
  npm run check
@@ -152,7 +183,7 @@ git diff --check
152
183
  npm pack --dry-run
153
184
  ```
154
185
 
155
- `npm test` includes smoke and E2E tests and generates `dist/` for tests and `lib/` for distribution. Pi loads source at runtime.
186
+ `npm test` builds `dist/` for tests and `lib/` for distribution and runs local Pi/dsh checks plus Claude Node hook-process tests. Pi loads source at runtime. Claude package checks install the actual tarball, run native plugin validation, and exercise hooks/CLI without models or host SDKs. Real-model ACP and Claude context, skills, and specialist validation run separately in explicitly approved environments with dedicated authentication. See [release checks](docs/release.md).
156
187
 
157
188
  - [Documentation index](docs/README.md): current architecture, usage, and development guidance.
158
189
  - [npm release](docs/release.md): candidate checks, configuration, and publication.
package/README.zh-CN.md CHANGED
@@ -4,17 +4,19 @@
4
4
 
5
5
  **连接知识、研究与行动的个人助手。**
6
6
 
7
- Personal Bot 提供按工作区加载的 [Pi](https://pi.dev) 扩展和原生 dsh Web 接入,支持资料整理、项目推进、研究分析、专家协作和已授权的业务操作。模型负责分析与协调,插件提供资料目录、专家会话、历史查询和共享 Python 环境。
7
+ Personal Bot 提供按工作区加载的 [Pi](https://pi.dev) 扩展、原生 dsh Web 接入和标准 Claude Code 插件,支持资料整理、项目推进、研究分析、专家协作和已授权的业务操作。Pi/dsh 提供受管专家、团队和历史查询;Claude 使用原生技能、Agent/teams 与 Node command hooks。三个宿主共用工作区资料和 Python 环境。
8
+
9
+ Claude 的模型上下文、技能调用与专家行为还需在批准的原生模型环境验证。操作见 [Claude Code 指南](docs/claude-code.md)。
8
10
 
9
11
  ## 工作区启用
10
12
 
11
- 安装后,从目标工作区打开 Pi 或 dsh,执行 `/pbot init` 初始化并启用。Pi 和 dsh 共用该命令创建的 `.pbot/config.json`:
13
+ 安装后,从目标工作区打开宿主。Pi/dsh 执行 `/pbot init`,Claude 使用原生技能 `/personal-bot:pbot init`,初始化资料并启用共用的 `.pbot/config.json`:
12
14
 
13
15
  ```json
14
16
  { "enabled": true }
15
17
  ```
16
18
 
17
- 文件缺失或设为 false 时,Personal Bot 保持未启用,不加载包内技能和提示词,并引导执行 `init`。Pi 状态栏和 dsh 工作区页显示启动状态;`/pbot status` 随时可用。手工修改配置后,Pi 执行 `/reload`,dsh 重启宿主。规则见[工作区配置](docs/workspace-configuration.md)。
19
+ 配置缺失、停用或无效时,Personal Bot 保持未启用;只检查当前工作区根目录,不自动迁移配置。Pi/dsh 不加载包内技能及 pbot 提示词;Claude 仍可显示静态技能名称和简介,hooks 拦截 Skill 调用和直接斜杠命令中的工作方法并保留 pbot 初始化技能可用。状态入口为 Pi/dsh `/pbot status` 或 Claude `/personal-bot:pbot status`。手工修改后,Pi 执行 `/reload`,dsh 重启宿主;Claude 在 hook 与 CLI 操作时读取当前配置,工作区根由 `CLAUDE_PROJECT_DIR` 固定。规则见[工作区配置](docs/workspace-configuration.md)。
18
20
 
19
21
  ## 安装
20
22
 
@@ -74,6 +76,34 @@ dsh plugin --profile pbot update personal-bot --latest
74
76
 
75
77
  桌面应用通过原生“插件”页面安装 `personal-bot@latest`,使用独立的 desktop profile。完整终端参数、更新步骤与聊天命令见 [dsh 指南](docs/dsh.md)。
76
78
 
79
+ ### Claude Code
80
+
81
+ 使用 Linux 或 macOS 的交互式 Claude Code 终端,需要 **Claude Code 2.1.325+**、**Node.js 22.19+**,以及 Python 3.11+ 和 venv/ensurepip。通过 Claude 原生 marketplace 命令安装:
82
+
83
+ ```text
84
+ /plugin install personal-bot --marketplace realqiyan/personal-bot
85
+ ```
86
+
87
+ 安装范围由 Claude 原生插件管理选择,再在目标工作区使用 `/personal-bot:pbot init` 和 `/personal-bot:pbot status`。它们是原生技能,由模型通过 Bash 执行对应 Node CLI。需要确定性执行时,将 `CLAUDE_PROJECT_DIR` 设为工作区根,直接运行 `node /absolute/path/to/plugin/lib/claude.js init`、`status` 或 `python setup`。登录、模型、权限、原生专家、团队和 MCP 由 Claude 管理;`pbot setup` 仍是 Pi 安装器。
88
+
89
+ 原生团队由用户在启动 Claude 前设置 `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` 启用。pbot 不修改该设置,也不在 Claude 中提供 pbot 团队调度。返回会话后明确要求继续工作;原生 resume/rewind 不恢复进程内 teammate。
90
+
91
+ 启用后自动准备共享 Python,并提供完整可执行路径供原生 Bash 使用,不修改 Claude 的 PATH 或环境变量。标准插件提供资料、技能与原生专家,既有 Claude 历史归档和旧控制记录原地保留。操作与 Python 使用见 [Claude 指南](docs/claude-code.md)。
92
+
93
+ ### 可选安装 ACP 专家程序
94
+
95
+ Pi/dsh 使用 ACP 向 Pi、dsh 或 Claude 委派独立工作。先在运行主宿主的机器上安装所需目标:
96
+
97
+ | 目标 | 安装 | 认证与模型 |
98
+ | --- | --- | --- |
99
+ | Pi | 已有 Pi 时运行 `npm install -g pi-acp`;Pi 本身可通过 `npm install -g @earendil-works/pi-coding-agent` 安装 | 运行 `pi` 完成登录并选择默认模型 |
100
+ | dsh | 已安装命令行 dsh 即可;否则运行 `npm install -g @deepseek-ai/dsh@latest` | 按 dsh 原生方式配置目标 profile 的模型与认证;默认入口为 `dsh --profile acp` |
101
+ | Claude Code | `npm install -g @agentclientprotocol/claude-agent-acp` | 按 [Claude Code 指南](https://code.claude.com/docs/en/quickstart)完成登录或 API 配置,并设置默认模型 |
102
+
103
+ 在启动主宿主的同一终端检查目标程序,例如 `command -v claude-agent-acp`。安装后重试原 start 请求。已安装但 PATH 不可见时,将输出的绝对路径写入工作区 [acp 配置](docs/workspace-configuration.md#acp-启动配置)。PATH 变化后重启主宿主;只修改工作区 ACP 配置时,Pi 执行 `/reload`,dsh 重启宿主。
104
+
105
+ 缺少程序时,工具会返回对应安装命令、认证提示和路径配置示例。调用参数与持续对话见[ACP 成员](docs/agent-collaboration.md#acp-成员)。
106
+
77
107
  ### 从源码使用
78
108
 
79
109
  ```bash
@@ -84,7 +114,7 @@ npm run build:cli
84
114
  node bin/pbot.mjs setup
85
115
  ```
86
116
 
87
- 只加载 Pi 源码扩展时,在工作区执行 `pi install --local /absolute/path/to/personal-bot`,并保留该目录和依赖。dsh 的源码打包安装见[专门说明](docs/dsh.md#从源码安装)。
117
+ 只加载 Pi 源码扩展时,在工作区执行 `pi install --local /absolute/path/to/personal-bot`,并保留该目录和依赖。使用 ACP 成员或 Claude 插件前先运行完整的 `npm run build`。构建顺序是 CLI → dsh → Claude,因为 CLI 构建会清理 `lib/`。dsh 见[源码安装](docs/dsh.md#从源码安装),Claude 见[开发检查](docs/claude-code.md#依赖与开发检查)。
88
118
 
89
119
  ### 可选安装 Task Conductor
90
120
 
@@ -96,7 +126,7 @@ Pi 用户从工作区运行 `pi install --local npm:task-conductor-plugin`,重
96
126
 
97
127
  ## 日常使用
98
128
 
99
- 直接说明任务,例如整理资料、比较研究结论、委派复核或运行计算。以下命令面向 Pi,dsh 命令见其指南。
129
+ 直接说明任务,例如整理资料、比较研究结论、委派复核或运行计算。以下命令面向 Pi;[dsh](docs/dsh.md) 与 [Claude](docs/claude-code.md) 使用各自指南中的原生入口。
100
130
 
101
131
  | 命令 | 用途 |
102
132
  | --- | --- |
@@ -111,9 +141,9 @@ Pi 用户从工作区运行 `pi install --local npm:task-conductor-plugin`,重
111
141
 
112
142
  - **初始化与资料准备**:`/pbot init` 补建资料并启用工作区,保留已有资料与其他配置字段。Pi 首次启用时自动重载;已启动时补建的根 AGENTS 经 `/reload` 加载。
113
143
  - **原生工具**:CLI 通过 Bash 使用,MCP 使用宿主配置。Pi 新增项目连接时执行 `pi mcp add --local <server> ...`,通过 `/mcp` 查看来源。接入方法见[技能](resources/skills/provider-connections/SKILL.md)。
114
- - **历史回溯**:Pi 与 dsh 共同查询工作区归档。原文先可查询,主交互结束后用当前模型补齐摘要,会产生额外模型调用;新输入优先取消整理。详见[历史对话](docs/history.md)。
115
- - **专家与团队**:可独立委派、持续对话,或组织轮流讨论和并行轮次。Pi 专家需要 tmux;dsh 使用原生会话。团队运行时占用成员,切换私人工作前先暂停并等待在途工作结束。详见[专家协作](docs/agent-collaboration.md)。
116
- - **Python**:所有已启用工作区共用当前用户的一份 venv,启用后自动准备并在宿主进程激活,通过 Bash 使用 `python` 或 `python3`。更新依赖前停止使用该环境的脚本。路径、排障与许可见 [Python 说明](python/README.md)。
144
+ - **历史回溯**:Pi/dsh 刷新和整理自己的来源,查询已有各来源归档,包括保留的 Claude 归档。原文先可查询,主交互结束后用当前模型补齐摘要,会产生额外模型调用;新输入优先取消整理。Claude 使用原生会话历史。详见[历史对话](docs/history.md)。
145
+ - **专家与团队**:默认 Pi 专家需要 tmux,dsh 使用原生会话。Pi/dsh 的 pbot 团队可组织轮流讨论与并行轮次,切换私人工作前先暂停并等待在途工作结束;Claude 使用原生 Agent 与团队工具。Pi/dsh 的 ACP 调用 Pi、dsh 和 Claude Code,支持独立对话、报告及显式恢复。ACP 的 model、thinking 均可单独省略,省略项使用目标宿主默认值。详见[专家协作](docs/agent-collaboration.md)。
146
+ - **Python**:所有已启用工作区共用当前用户的一份 venv。Pi/dsh 自动准备并在宿主进程激活,通过 Bash 使用 `python` 或 `python3`;Claude 准备环境后,通过 Bash 使用 `python.executable` 完整路径。更新依赖前停止使用该环境的脚本。路径、排障与许可见 [Python 说明](python/README.md)。
117
147
  - **资料维护**:可请助手整理项目、按既有口径重做分析或检查交付。按[维护技能](resources/skills/project-maintenance/SKILL.md)更新当前说明、提炼方法,保留正式资料、历史与备份。
118
148
 
119
149
  Pi 主会话恢复用 `pi --resume` 明确选择;`pi --continue` 可能选中最近活跃的子会话。受管专家从 `/pbot agents` 进入,停止后打开原会话会保持待命,携新要求继续时使用 resume。运行中的会话只保留一个写入进程。
@@ -122,20 +152,21 @@ Pi 主会话恢复用 `pi --resume` 明确选择;`pi --continue` 可能选中
122
152
 
123
153
  | 位置 | 用途 |
124
154
  | --- | --- |
125
- | `.pbot/config.json` | Pi/dsh 共用的工作区启用与配置 |
155
+ | `.pbot/config.json` | Pi/dsh/Claude 共用的工作区启用与配置 |
126
156
  | `AGENTS.md` | 资料导航与工作约定 |
127
157
  | `areas/`、`projects/` | 长期目标、任务、结论与交付物 |
128
158
  | `knowledge/` | 可复用的概念、方法与口径 |
129
- | `.pbot/history/` | Pi/dsh 问答原文、摘要与节点关系 |
159
+ | `.pbot/history/` | Pi/dsh 问答原文、摘要与节点关系,以及保留的 Claude 归档 |
130
160
  | `providers/` | 外部工具的使用说明、数据口径与来源 |
131
161
  | `scratch/` | 临时脚本、计算数据、下载与运行环境 |
132
- | `agents/`、`.agents/skills/` | 职责补充与工作区技能 |
162
+ | `agents/` | 职责补充 |
163
+ | `.agents/skills/`(Pi/dsh)、`.claude/skills/`(Claude) | 当前宿主原生发现的工作区技能 |
133
164
 
134
165
  已有布局与工作约定优先。可再次查询的数据在需要时按记录的口径获取。复制工作区前停止旧实例的写入,不支持多机同时写同步目录。详细位置与保留规则见[文件存储](docs/file-storage.md)。
135
166
 
136
167
  ## 更新与操作范围
137
168
 
138
- 当前版本为 **0.2.11**。通过宿主原生包管理更新;本地 Pi 来源更新源码,依赖变化后运行 `npm ci --ignore-scripts`,再重载或重启。更换版本前停止活动专家;不同兼容线的专家需重新创建,旧资料、历史和备份保留。
169
+ 当前版本为 **0.2.13**。通过宿主原生包管理更新;本地 Pi 来源更新源码,依赖变化后运行 `npm ci --ignore-scripts`,再重载或重启。更换版本前停止活动专家;不同兼容线的专家需重新创建,旧资料、历史和备份保留。
139
170
 
140
171
  操作按用户请求、已有约定和必要确认执行。Bash、Python、MCP 和扩展使用实际账户与凭据权限;硬限制应由只读凭据、服务端控制或受限环境提供。交易、转账和账本修改需要相应授权。取消、超时或断连后,先查原生状态再决定是否重试,避免重复执行。
141
172
 
@@ -143,7 +174,7 @@ Task Conductor 节点单独配置工具、环境、技能与认证;需要人
143
174
 
144
175
  ## 开发与文档
145
176
 
146
- 双宿主开发使用 Linux、Node.js 24.9+。安装锁定依赖后运行:
177
+ 三宿主开发与完整验收使用 Linux、Node.js 24.9+。安装锁定依赖后运行:
147
178
 
148
179
  ```bash
149
180
  npm run check
@@ -152,7 +183,7 @@ git diff --check
152
183
  npm pack --dry-run
153
184
  ```
154
185
 
155
- `npm test` 包含冒烟与 E2E 测试,并生成测试用 `dist/` 和发布用 `lib/`。Pi 运行时加载源码。
186
+ `npm test` 构建测试用 `dist/` 与发布用 `lib/`,运行 Pi/dsh 本地检查与 Claude Node hook 进程测试;Pi 运行时加载源码。Claude 安装包检查实际安装 tarball、执行原生 plugin validate 和 hook/CLI,不调用模型或安装宿主 SDK。真实模型 ACP 与 Claude 上下文、技能、专家验证在明确批准的专用认证环境单独进行。详见[发布说明](docs/release.md)。
156
187
 
157
188
  - [文档索引](docs/README.md):当前架构、使用与开发说明。
158
189
  - [npm 发布](docs/release.md):候选检查、发布配置与操作。
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ import { spawn } from "node:child_process";
3
+ import { readFileSync } from "node:fs";
4
+ import { join } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+
7
+ // pi-acp supplies RPC arguments. Add the managed member's native resource options.
8
+ const directory = process.env.PBOT_SUBAGENT_DIR;
9
+ if (!directory || !process.env.PBOT_ACP_PI_COMMAND) throw new Error("Missing Personal Bot Pi ACP launch context");
10
+ const { options } = JSON.parse(readFileSync(join(directory, "descriptor.json"), "utf8"));
11
+ const args = [...process.argv.slice(2), "--extension", fileURLToPath(new URL("../src/extension/pi-acp-member.ts", import.meta.url))];
12
+ if (options.noExtensions !== false) args.push("--no-extensions", "--extension", "builtin:mcp", "--extension", "builtin:codemode", "--extension", "builtin:tool-search");
13
+ if (options.noSkills) args.push("--no-skills");
14
+ if (options.noPromptTemplates) args.push("--no-prompt-templates");
15
+ if (options.noContextFiles) args.push("--no-context-files");
16
+ if (options.tools) args.push("--tools", options.tools.join(","));
17
+ const child = spawn(process.env.PBOT_ACP_PI_COMMAND, args, { stdio: "inherit", env: process.env });
18
+ child.on("error", error => { console.error(error.message); process.exitCode = 1; });
19
+ for (const termination of ["SIGINT", "SIGTERM"]) process.on(termination, () => child.kill(termination));
20
+ child.on("exit", (code, termination) => { process.exitCode = termination ? 1 : code ?? 1; });
package/docs/README.md CHANGED
@@ -4,9 +4,10 @@
4
4
 
5
5
  - [项目介绍与安装](../README.zh-CN.md) / [English](../README.md)
6
6
  - [dsh 使用](dsh.md):profile、插件、Web 管理与聊天命令
7
- - [工作区配置](workspace-configuration.md):Pi/dsh 共用配置、启用范围与重载
8
- - [专家协作](agent-collaboration.md):独立委派、团队、通知与恢复
9
- - [历史对话](history.md):查询、摘要与归档
7
+ - [Claude Code 使用](claude-code.md):标准插件安装、原生技能、CLI、专家与 Python
8
+ - [工作区配置](workspace-configuration.md):三宿主共用启用、静态技能例外与配置生效
9
+ - [专家协作](agent-collaboration.md):原生专家、Pi/dsh 的 pbot 团队、Claude 原生团队与 ACP
10
+ - [历史对话](history.md):Pi/dsh 查询、摘要与既有归档兼容
10
11
  - [Python 环境](../python/README.md):准备、排障、计算库与许可
11
12
  - [领域术语](../CONTEXT.md)
12
13
 
@@ -16,9 +17,10 @@
16
17
  | --- | --- |
17
18
  | [架构原则](architecture-guidelines.md) | 模块划分、依赖与开发方法 |
18
19
  | [技术设计](technical-design.md) | 系统组成、生命周期与分发 |
20
+ | [Claude Code 接入方案](claude-code-design.md) | 标准 command hooks、原生技能与 agent 边界,以及模型验证范围 |
19
21
  | [模型指令编写原则](model-instruction-guidelines.md) | 提示、角色、技能与工具说明的取舍 |
20
22
  | [模型上下文](model-context.md) | 内容来源、加载时机与更新 |
21
- | [界面设计](interaction-design.md) | Pi TUI 与 dsh GUI |
23
+ | [界面设计](interaction-design.md) | Pi TUI、dsh GUI 与 Claude 原生入口 |
22
24
  | [工具与执行](capability-design.md) | CLI/MCP、操作范围与外部任务 |
23
25
  | [文件存储](file-storage.md) | 数据位置、写入规则与历史保留 |
24
26
  | [安装器设计](installation-design.md) | setup 的计划、来源、作用域与失败恢复 |
@@ -0,0 +1,3 @@
1
+ # Claude Code 保留原生技能发现
2
+
3
+ Claude Code 标准插件采用原生静态技能发现,允许未启用的工作区显示 Personal Bot 技能名称与简介。共用 `.pbot/config.json` 控制上下文注入与 Python 准备;PreToolUse 对 Skill 调用、UserPromptExpansion 对用户直接展开的技能拦截未启用工作区的 pbot 工作方法,保留 `personal-bot:pbot` 初始化技能可用。技能发现、正文加载和模型调用遵循宿主机制,不增加动态目录或私有技能加载器。
@@ -0,0 +1,3 @@
1
+ # Claude Code 协作采用原生语义
2
+
3
+ Claude Code 标准插件提供原生 Markdown agent,持续对话、团队成员通信、完成通知和运行状态由 Claude 管理。用户管理实验团队开关与 teammate mode;返回会话后显式继续,原生 resume/rewind 不恢复进程内 teammate。pbot 不在 Claude 中装配协作控制服务或管理面板。Pi/dsh 保留现有 pbot 团队及独立 ACP 委派,Claude 仍可作为其 ACP 目标。
@@ -1,8 +1,10 @@
1
1
  # 专家协作
2
2
 
3
- Personal Bot 保留独立工作和团队工作。Pi 成员由 tmux 和独立进程运行;dsh 成员使用同进程的独立 Agent/Session。各自保留原生上下文,不跨宿主恢复。主模型负责组织与验收,成员原文由代码同步,不需要主模型逐条转述。
3
+ Personal Bot 保留独立工作和团队工作。Pi 原生专家由 tmux 和独立进程运行,dsh 原生专家使用同进程的独立 Agent/Session;Claude 使用原生 Agent 与原生团队。Pi/dsh 可通过 ACP 委派 Pi、dsh 或 Claude,目标保留自己的上下文与原生配置。Claude 标准插件的入口见[使用指南](claude-code.md)。
4
4
 
5
- ## 独立工作
5
+ 本文的 `pbot_team`、轮次、批次、占用与公共消息规则适用于 Pi/dsh;Claude 原生团队由宿主管理。主模型按任务组织工作,成员原文通过对应宿主或 ACP 报告取得。
6
+
7
+ ## Pi/dsh 独立工作
6
8
 
7
9
  | pbot_agent action | 行为 |
8
10
  | --- | --- |
@@ -32,6 +34,52 @@ dsh 使用原生 provider/model/reasoning effort,拒绝 Pi 专属扩展、提
32
34
 
33
35
  `/pbot` Web 管理页提供人工对话、完整原生记录、停止和携新要求恢复。离页不停止已接纳工作;父 Agent 或组件关闭会暂停安排并释放其拥有的专家。重新打开页面不会恢复或重放旧工作。详情见[dsh 使用](dsh.md)。
34
36
 
37
+ ## Claude 原生专家与团队
38
+
39
+ Claude 插件通过静态 Markdown agent 提供 `personal-bot:general-purpose`,由原生 Agent 创建专家。构建从共享职责生成该文件;工作区启用后,SubagentStart 仅为这一类型补充公共约定、工作区专家职责、根资料与环境。模型、effort、权限、完成通知与会话记录遵循 Claude 原生规则,pbot 不读取私有团队格式来判断成员身份。
40
+
41
+ 完成后明确发送要求可继续原生专家上下文。团队需要用户在启动环境中设置 `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`,并自行选择原生 teammateMode;pbot 安装与 init 不修改开关。成员通过原生消息与任务工具交流,组织和状态由 Claude 管理。
42
+
43
+ Claude 的 resume/rewind 不恢复进程内 teammate。返回主会话后明确要求继续工作;普通子代理继续与重启后恢复团队分别遵循宿主能力,需要新建成员时保留原记录。Claude 标准插件不提供 pbot ACP、团队调度或管理面板。实际首任务上下文、技能和专家行为还需原生模型验证,见[Claude 接入设计](claude-code-design.md)。
44
+
45
+ ## ACP 成员
46
+
47
+ 在 start 中指定 backend,使用目标宿主的 ACP 会话:
48
+
49
+ ```json
50
+ { "action": "start", "backend": "claude", "name": "实现专家", "message": "检查项目并实现当前要求" }
51
+ ```
52
+
53
+ backend 可选 pi、dsh、claude;Pi/dsh 中省略时使用当前宿主原生专家。两个主宿主共享 ACP 目标实现。目标使用自己的模型、认证、工具、技能和项目配置,恢复保留原会话的模型选择。Claude 作为 ACP 目标的能力独立于标准 Claude 插件,所需 Claude SDK 保留为可选 peer 与开发依赖。
54
+
55
+ model 和 thinking 均为可选,可单独提供;两者都省略时使用目标默认模型和默认思考等级。只指定 model 时使用所选模型的原生默认思考配置;只指定 thinking 时将该等级用于默认模型。主会话的模型和思考默认值不传给 ACP 目标。
56
+
57
+ model 支持目标的原生模型 ID,也支持 ACP 完整模型值。Pi 和 dsh 的同名模型优先使用目标当前默认提供方;仍有重名时指定 provider 或完整模型值。thinking 使用目标公开的等级 ID,支持范围随所选模型变化。例如:
58
+
59
+ ```json
60
+ { "action": "start", "backend": "dsh", "model": "deepseek-flash", "thinking": "high", "message": "检查项目并实现当前要求" }
61
+ ```
62
+
63
+ 首次使用前按[ACP 专家程序安装说明](../README.zh-CN.md#可选安装-acp-专家程序)准备目标程序、认证和默认模型。默认入口分别为 pi-acp、dsh --profile acp 和 claude-agent-acp;Claude 适配器需支持 ACP systemPrompt。缺少程序时,start 返回该目标的安装命令和路径配置示例,修复后重试原请求。
64
+
65
+ 自定义可执行路径与 profile 参数放在工作区的 [acp 配置](workspace-configuration.md#acp-启动配置)。从源码使用 ACP 前先运行完整的 `npm run build`,以生成 worker 和 dsh 成员入口。
66
+
67
+ ACP 成员支持待命、独立委派、持续对话、状态、固定周期报告、停止和恢复。运行中的追加要求使用 followUp:
68
+
69
+ ```json
70
+ { "action": "send", "agentId": "返回的成员 ID", "message": "完成当前任务后继续检查相关调用", "delivery": "followUp" }
71
+ ```
72
+
73
+ 返回的 transport 为 acp,selection 给出 provider、model 和有效 thinking,包含宿主默认值。Claude 的 model 保留配置别名,resolvedModel 在原生会话报告后给出实际模型 ID;Pi 详情与 dsh 工作区页一起显示两者。Claude 的默认思考等级遵循原生环境设置,显式 thinking 只覆盖当前成员的启动配置。capabilities 给出当前能力。首批不提供运行中 steer、团队通信和完整原生记录;工具在忙碌时拒绝 steer,团队使用原生专家。Pi 专属启动开关只对 Pi 目标生效;Claude 的工具与技能通过 Claude 原生配置选择。
74
+
75
+ 成员加载公共约定、general-purpose 职责和工作区同名补充,并按需使用包内技能。Claude 的原生技能目录中可见 personal-bot:provider-connections 和 personal-bot:project-maintenance,用户与项目技能继续沿用 Claude 配置。worker 准备并激活共享 Python 环境,准备失败时继续提供协作能力,并向成员报告环境状态。
76
+
77
+ Pi 的 `/pbot agents` 对 ACP 成员提供任务、报告、补充要求及携新要求恢复;原生 Pi 成员继续通过 tmux 进入。dsh 专家页展示 ACP 任务与报告,也支持人工消息和附件。
78
+
79
+ Pi 权限请求进入已有确认队列;dsh 工作区页展示待确认请求,也可用 `/pbot approval` 提交选项。各入口按 generation/requestId 核对请求,取消回写 null,过期选择被拒绝。
80
+
81
+ ACP 工作由独立 worker 持有。Pi reload 保留仍启用工作区的 worker;退出、切换主会话或 dsh 父会话释放时停止所属成员。休眠后先查状态,携新要求显式继续。恢复前校验已绑定的对端会话,旧输入不重放。Pi/Claude 目标从未交付输入的空待命会话可重新建立空上下文;已经交付的会话只恢复原引用。
82
+
35
83
  ## Pi 原生会话与恢复入口
36
84
 
37
85
  新建 agent 的 agentId 也是 Pi session ID。对话由 Pi 保存在原生 sessions 目录或其原生配置指定的位置,按子进程 cwd 归组;pbot 只保存控制记录和文件引用。无任务待命不伪造对话,也可能尚无 JSONL 文件。首次输入前固定路径,之后恢复只打开这个文件;文件缺失或不匹配时不新建空白替代。具体规则见[文件存储](file-storage.md)。
@@ -40,7 +88,7 @@ dsh 使用原生 provider/model/reasoning effort,拒绝 Pi 专属扩展、提
40
88
 
41
89
  `/pbot agents` 的“进入会话”连接运行中的成员;成员已停止时,“打开原会话”加载原会话并启动待命进程,不入队新要求、不调用模型、不重放旧工作。尚无对话文件的空会话仍以原 agentId 待命。运行中不另开进程同时写同一 JSONL。停止后从原生列表打开属于普通 Pi 对话,不恢复 pbot 成员身份或团队资格;模型工具 `pbot_agent resume` 仍用于携新要求继续工作。
42
90
 
43
- ## 团队与两种策略
91
+ ## Pi/dsh 团队与两种策略
44
92
 
45
93
  一个团队固定一组成员,限于同一工作区、同一父 session 的可操作分支。一个 agent 最多属于一个未关闭团队。加入团队不创建新进程,关闭团队也不停止成员;换人时关闭旧团队,再用原 agent 创建新团队。
46
94
 
@@ -113,7 +161,7 @@ read 的文本结果也使用 Markdown,同时保留工具的结构化结果。
113
161
 
114
162
  Pi 独立周期的 read 结果进入当前分支后领取该周期通知,包括只读取部分正文的情况。dsh 以持久化的上下文消费或成功模型 read 领取;PTC 内层 read 还需根调用成功,排队仅防重,不视为已消费。人工管理页不领取模型通知。nextOffset 非空时,以同一 agentId、返回的 cycle.cycleId 和 nextOffset 续读,避免默认最新周期发生变化;status 不领取通知。团队关联周期不重复发个人完成通知;主模型只收到批次结束、暂停和收尾状态。普通 post 不唤醒主模型。团队通知按 teamId/runId/状态去重,UI 或工具 read 不领取模型通知。
115
163
 
116
- 团队与成员均绑定父 session/分支。失去归属时暂停新安排,不向当前主分支投递结果。fork 不接管旧团队;返回原分支不会自动恢复旧批次。公共记录与外部工作不会随树导航回滚。
164
+ Pi/dsh 的团队与受管成员均绑定父 session/分支。失去归属时暂停新安排,不向当前主分支投递结果。fork 不接管旧团队;返回原分支不会自动恢复旧批次。公共记录与外部工作不会随树导航回滚。
117
165
 
118
166
  | 事件 | 行为 |
119
167
  | --- | --- |
@@ -132,11 +180,11 @@ pause 返回时可能仍有在途请求。unresolved 区分排队、已接收、
132
180
 
133
181
  ## 界面与故障恢复
134
182
 
135
- dsh 的管理界面与命令见[dsh 使用说明](dsh.md)。下面介绍 Pi 的 TUI。
183
+ dsh 的管理界面与命令见[dsh 使用说明](dsh.md),Claude 的原生专家、技能与恢复规则见[Claude 使用说明](claude-code.md)。下面介绍 Pi 的 TUI。
136
184
 
137
185
  `/pbot` 打开工作区菜单。`/pbot agents` 提供专家列表、详情、会话入口、补充要求、重命名和停止;`/pbot teams` 提供团队状态、公共消息、批次及成员入口。长记录使用只读阅读页。完整报告仍通过 `pbot_agent read` 获取;非 TUI 模式保留结构化输出。
138
186
 
139
- 后台扫描遇到短暂的 `.control` 锁竞争时,在下一次扫描重试;连续至少 5 秒仍无法取得锁,包括主会话中断后暂停团队仍被锁阻塞的情况,会保留 UI 错误并通知模型。暂停未成功时,通知明确说明暂停尚未确认。报告或控制记录读取失败也会通知模型。同一持续故障在当前分支去重;恢复要求升级时补发一次通知。主会话中断期间延后投递,恢复输入后再通知。
187
+ 当前父会话没有团队记录时,团队恢复、暂停和调度直接返回,不申请 `.control` 锁。后台扫描遇到短暂的 `.control` 锁竞争时,在下一次扫描重试;连续至少 5 秒仍无法取得锁,包括主会话中断后暂停团队仍被锁阻塞的情况,会保留 UI 错误并通知模型。暂停未成功时,通知明确说明暂停尚未确认。报告或控制记录读取失败也会通知模型。同一持续故障在当前分支去重;恢复要求升级时补发一次通知。主会话中断期间延后投递,恢复输入后再通知。
140
188
 
141
189
  通知按实际服务状态说明恢复方式:锁释放后自动恢复扫描;可恢复的读取错误先排障,修复后由后台重试;团队服务或协作存储已停用时,修复文件仍不能恢复当前实例,须请用户在当前 Pi 会话执行 `/reload`。重载前不反复调用 pbot_team,可通过 pbot_agent list/status/read 核对仍可读取的成员状态与报告;重载后再用 pbot_team status/read 核对团队。完整扫描成功且待暂停、待入队操作不再受阻后清除故障状态。当前实例中已恢复的故障若曾在当前分支通知,会补发一次关联的恢复消息;中断期间延后投递,成员结果优先交付。未投递的故障不补发恢复消息,重载不追认旧实例的恢复。通知不重发任务、不删除锁,命令和工具的错误仍直接返回。
142
190
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  ## 复用宿主
10
10
 
11
- 各宿主负责自己的主会话、模型配置、工具、UI、资源发现与会话恢复。Pi 和 dsh 分别加载,共享业务服务与资料;不构建通用 Host 平台。Personal Bot 补充资料准备、专家协作和 Python 环境。
11
+ 各宿主负责自己的主会话、模型配置、工具、UI、资源发现与会话恢复。Pi/dsh 共享专家、团队与历史服务;Claude 使用标准 command hooks、原生技能和 Markdown agent,共享资料准备与 Python 环境。Claude 的专家及团队交给原生 Agent/teams,跨宿主 ACP 委派保留在 Pi/dsh。按宿主实际需要装配能力,不构建通用 Host 平台。
12
12
 
13
13
  角色定义职责,技能描述专业方法,代码实现需要确定执行的规则。优先使用原生 CLI/MCP,执行权限由实际凭据、外部服务和运行环境约束。
14
14
 
@@ -1,6 +1,6 @@
1
1
  # 工具与执行
2
2
 
3
- Personal Bot 使用当前 Pi 或 dsh 宿主的原生工具与配置。接入方法见[接入技能](../resources/skills/provider-connections/SKILL.md)。
3
+ Personal Bot 使用当前 Pi、dsh 或 Claude 宿主的原生工具与配置。Claude 接入的当前状态见[使用指南](claude-code.md),接入方法见[接入技能](../resources/skills/provider-connections/SKILL.md)。
4
4
 
5
5
  ## 责任划分
6
6
 
@@ -16,7 +16,7 @@ Personal Bot 使用当前 Pi 或 dsh 宿主的原生工具与配置。接入方
16
16
 
17
17
  ## CLI 与 MCP
18
18
 
19
- CLI 通过 Bash 使用。新增 MCP 默认仅接入当前项目:从工作区根目录执行 `pi mcp add --local <server> ...`,写入项目 `.pi/mcp.json`;删除项目连接也显式使用 `--local`。第三方 setup 或接入向导同样核对项目范围,不接受其全局默认值。只有用户明确要求跨项目使用时才修改当前 Pi agent dir 的 `mcp.json`,已有用户级连接不自动迁移或删除。
19
+ CLI 通过 Bash 使用,MCP 由各宿主管理,配置、认证与模型不自动同步。Pi 新增项目连接时从工作区根目录执行 `pi mcp add --local <server> ...`,写入 `.pi/mcp.json`;删除也显式使用 `--local`。第三方 setup 采用项目范围。只有用户明确要求跨项目使用时才修改当前 Pi agent dir 的 mcp.json,已有用户级连接保留。
20
20
 
21
21
  Pi 处理信任、认证与工具暴露。使用 /mcp 查看连接、工具和配置来源,确认新增连接来自当前项目;配置变更后按 Pi 要求重载。项目配置使用原生认证或环境变量引用,不保存凭据值。
22
22
 
@@ -24,6 +24,18 @@ Pi 处理信任、认证与工具暴露。使用 /mcp 查看连接、工具和
24
24
 
25
25
  dsh 使用当前安装版本的原生 MCP 组件和 profile 配置,模型与认证也由 dsh 管理。不得将上述 Pi 命令、配置目录或安装包声明直接用于 dsh,也不自动同步两套配置。同进程专家遵循 dsh 的原生作用域与工具可见性;不模拟 Pi 子进程的扩展开关。
26
26
 
27
+ Claude 新增项目连接使用 `claude mcp add --scope project <server> ...`,写入工作区 `.mcp.json`;删除使用 `claude mcp remove --scope project <server>`。local、project、user 是不同原生范围,按实际用途选择;用户未要求跨项目时使用 project。通过当前会话 `/mcp` 检查连接、认证、配置来源和工具,CLI 状态不替代活动会话状态。原生 Agent、团队、消息和任务工具沿用 Claude 权限与认证,实验团队开关由用户管理。
28
+
29
+ Claude 插件通过标准 Node command hooks 准备上下文与 Python,通过原生 `/personal-bot:pbot init|status|python setup` 技能调用同一 CLI。确定性操作可直接运行 `node <plugin>/lib/claude.js init|status|python setup`。工作区根固定为 `CLAUDE_PROJECT_DIR`,不随 Bash cwd 改变。Claude 的 Agent、团队、MCP 与会话由宿主管理;pbot 不在该宿主注册业务工具或 MCP 服务。
30
+
31
+ Claude 的 Python 脚本通过原生 Bash 使用 `python.executable` 的完整路径;插件不修改 Claude 的 PATH 或环境变量。原生技能与专家的上下文加载方式见[模型上下文](model-context.md)。
32
+
33
+ ## ACP 子会话
34
+
35
+ Pi/dsh 主会话可通过 pbot_agent 的 backend 选择 Pi、dsh 或 Claude Code。目标保留自己的原生配置、认证、工具和资源发现,模型选择不跨宿主继承。Pi 目标使用 pi-acp,dsh 使用原生 acp profile,Claude 使用 claude-agent-acp;启动与持续对话见[专家协作](agent-collaboration.md#acp-成员)。
36
+
37
+ ACP 权限请求按目标提供的选项交给人工:Pi 使用现有确认队列,dsh 在工作区页显示待确认操作。目标自己的工具政策继续生效。初始附件保留绝对来源;文本按预算读取,图片经协商后传入,其他二进制文件交给目标的原生工具沿来源读取。
38
+
27
39
  ## 执行范围与结果
28
40
 
29
41
  模型按用户请求、已有约定和委派范围行动。提示说明具体操作,不为普通任务额外建立授权、证据收集或独立复核流程。必要的交互确认由当前任务及宿主原生机制决定。
@@ -34,7 +46,7 @@ Bash、Python、MCP 和扩展拥有其实际账户与凭据权限。dsh 的原
34
46
 
35
47
  ## 可选 Task Conductor
36
48
 
37
- Task Conductor 通过原生 MCP 提供周期任务、重复流程和 DAG,独立管理任务定义与运行状态。两种宿主使用 `task-conductor-plugin` 和 `using-task-conductor` 技能。安装见[项目 README](../README.zh-CN.md#可选安装-task-conductor),服务配置见[上游接入指南](https://github.com/realqiyan/task-conductor/blob/master/docs/host-integrations.md)。
49
+ Task Conductor 通过原生 MCP 提供周期任务、重复流程和 DAG,独立管理任务定义与运行状态。Pi/dsh 的现有接入使用 `task-conductor-plugin` 和 `using-task-conductor` 技能;Claude 通过自己实际可用的原生 MCP 接入及上游说明使用服务。安装见[项目 README](../README.zh-CN.md#可选安装-task-conductor),服务配置见[上游接入指南](https://github.com/realqiyan/task-conductor/blob/master/docs/host-integrations.md)。
38
50
 
39
51
  Personal Bot 提供按需参考入口,工具调用、连接和通知由 Task Conductor 插件与宿主管理。通知绑定提交任务的原生持久会话,恢复原会话后继续接收。
40
52