personal-bot 0.2.12 → 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 (79) 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 +33 -16
  5. package/README.zh-CN.md +33 -16
  6. package/docs/README.md +6 -4
  7. package/docs/adr/0001-claude-skill-discovery.md +3 -0
  8. package/docs/adr/0002-claude-native-collaboration.md +3 -0
  9. package/docs/agent-collaboration.md +20 -8
  10. package/docs/architecture-guidelines.md +1 -1
  11. package/docs/capability-design.md +10 -4
  12. package/docs/claude-code-design.md +45 -0
  13. package/docs/claude-code.md +64 -0
  14. package/docs/dsh.md +3 -3
  15. package/docs/file-storage.md +18 -9
  16. package/docs/history.md +17 -9
  17. package/docs/interaction-design.md +9 -1
  18. package/docs/model-context.md +37 -14
  19. package/docs/model-instruction-guidelines.md +3 -3
  20. package/docs/release.md +13 -5
  21. package/docs/technical-design.md +40 -18
  22. package/docs/workspace-configuration.md +34 -26
  23. package/hooks/hooks.json +19 -0
  24. package/lib/claude.d.ts +1 -0
  25. package/lib/claude.js +20 -0
  26. package/lib/client.js +1 -1
  27. package/lib/extension/acp-worker.js +6 -3
  28. package/lib/extension/claude-hooks.d.ts +15 -0
  29. package/lib/extension/claude-hooks.js +104 -0
  30. package/lib/extension/dsh/history.js +1 -1
  31. package/lib/integrations/agent-resources.d.ts +1 -1
  32. package/lib/integrations/agent-resources.js +3 -1
  33. package/lib/integrations/dsh/history-summary.js +5 -9
  34. package/lib/integrations/dsh/history.js +13 -5
  35. package/lib/integrations/history-summary.d.ts +2 -0
  36. package/lib/integrations/history-summary.js +21 -10
  37. package/lib/model/agent.d.ts +1 -1
  38. package/lib/model/history.d.ts +11 -4
  39. package/lib/services/history/history-service.d.ts +8 -6
  40. package/lib/services/history/history-service.js +90 -48
  41. package/lib/services/workspace/python-environment-service.d.ts +6 -0
  42. package/lib/services/workspace/python-environment-service.js +25 -9
  43. package/lib/storage/agent-files.js +3 -0
  44. package/lib/storage/history-files.d.ts +2 -1
  45. package/lib/storage/history-files.js +26 -15
  46. package/lib/tools/history/contract.d.ts +7 -7
  47. package/lib/tools/history/contract.js +2 -2
  48. package/lib/ui/dsh/management.js +1 -1
  49. package/npm-shrinkwrap.json +10 -27
  50. package/package.json +33 -29
  51. package/python/README.md +17 -14
  52. package/resources/agents/coordinator.md +1 -1
  53. package/resources/claude/agents/general-purpose.md +12 -0
  54. package/resources/claude/skills/pbot/SKILL.md +17 -0
  55. package/resources/prompts/claude-coordinator.md +1 -0
  56. package/resources/prompts/native-coordinator.md +1 -0
  57. package/resources/prompts/workspace.md +2 -2
  58. package/resources/references/compute.md +2 -2
  59. package/resources/references/task-conductor.md +3 -2
  60. package/resources/skills/provider-connections/SKILL.md +17 -1
  61. package/scripts/README.md +24 -6
  62. package/src/claude.ts +19 -0
  63. package/src/extension/acp-worker.ts +2 -2
  64. package/src/extension/claude-hooks.ts +94 -0
  65. package/src/extension/dsh/history.ts +1 -1
  66. package/src/integrations/agent-resources.ts +2 -1
  67. package/src/integrations/dsh/history-summary.ts +5 -9
  68. package/src/integrations/dsh/history.ts +12 -6
  69. package/src/integrations/history-summary.ts +18 -8
  70. package/src/integrations/pi/history.ts +16 -15
  71. package/src/model/agent.ts +1 -1
  72. package/src/model/history.ts +12 -4
  73. package/src/pbot.ts +2 -2
  74. package/src/services/history/history-service.ts +82 -41
  75. package/src/services/workspace/python-environment-service.ts +26 -9
  76. package/src/storage/agent-files.ts +4 -1
  77. package/src/storage/history-files.ts +20 -11
  78. package/src/tools/history/contract.ts +2 -2
  79. package/src/ui/dsh/management.ts +1 -1
@@ -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,9 +76,23 @@ 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
+
77
93
  ### Optional: ACP specialist programs
78
94
 
79
- Both Pi and dsh main sessions can delegate to other hosts through ACP. Install each target you need on the machine running the main host:
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:
80
96
 
81
97
  | Target | Installation | Authentication and model |
82
98
  | --- | --- | --- |
@@ -84,7 +100,7 @@ Both Pi and dsh main sessions can delegate to other hosts through ACP. Install e
84
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`. |
85
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. |
86
102
 
87
- 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 configuration changes, run `/reload` in Pi or restart dsh.
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.
88
104
 
89
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.
90
106
 
@@ -98,7 +114,7 @@ npm run build:cli
98
114
  node bin/pbot.mjs setup
99
115
  ```
100
116
 
101
- 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. 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).
102
118
 
103
119
  ### Optional: Task Conductor
104
120
 
@@ -110,7 +126,7 @@ Notifications return to the session that submitted the task. Service tasks conti
110
126
 
111
127
  ## Daily use
112
128
 
113
- 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.
114
130
 
115
131
  | Command | Purpose |
116
132
  | --- | --- |
@@ -125,9 +141,9 @@ Describe the task directly: organize materials, compare findings, delegate a rev
125
141
 
126
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`.
127
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).
128
- - **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).
129
- - **Specialists and teams:** Delegate independent work, continue a conversation, or organize ordered discussions and parallel rounds. Default Pi specialists require tmux; dsh uses native sessions. Either main host can also call Pi, dsh, and Claude Code through ACP for independent conversations, reports, and restoration. ACP model and thinking are independently optional; omitted values use the target host defaults. A running team reserves its members. Pause and drain in-flight work before private tasks. See [specialist collaboration](docs/agent-collaboration.md).
130
- - **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.
131
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.
132
148
 
133
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.
@@ -136,20 +152,21 @@ Use `pi --resume` to select the main session explicitly; `pi --continue` can sel
136
152
 
137
153
  | Location | Purpose |
138
154
  | --- | --- |
139
- | `.pbot/config.json` | Shared Pi/dsh workspace activation and configuration |
155
+ | `.pbot/config.json` | Shared Pi/dsh/Claude workspace activation and configuration |
140
156
  | `AGENTS.md` | Navigation and working agreements |
141
157
  | `areas/`, `projects/` | Long-term goals, tasks, conclusions, and deliverables |
142
158
  | `knowledge/` | Reusable concepts, methods, and analysis definitions |
143
- | `.pbot/history/` | Pi/dsh exchanges, summaries, and node links |
159
+ | `.pbot/history/` | Pi/dsh exchanges, summaries, and node links; preserved Claude archives |
144
160
  | `providers/` | External tool guidance, data definitions, and sources |
145
161
  | `scratch/` | Temporary scripts, calculation data, downloads, and environments |
146
- | `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 |
147
164
 
148
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).
149
166
 
150
167
  ## Updates and operating scope
151
168
 
152
- Current release: **0.2.12**. 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.
153
170
 
154
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.
155
172
 
@@ -157,7 +174,7 @@ Task Conductor nodes need their own tools, environment, skills, and authenticati
157
174
 
158
175
  ## Development and documentation
159
176
 
160
- 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:
161
178
 
162
179
  ```bash
163
180
  npm run check
@@ -166,7 +183,7 @@ git diff --check
166
183
  npm pack --dry-run
167
184
  ```
168
185
 
169
- `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).
170
187
 
171
188
  - [Documentation index](docs/README.md): current architecture, usage, and development guidance.
172
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,9 +76,23 @@ 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
+
77
93
  ### 可选安装 ACP 专家程序
78
94
 
79
- Pi 和 dsh 主会话都可通过 ACP 委派其他宿主。先在运行主宿主的机器上安装所需目标:
95
+ Pi/dsh 使用 ACP 向 Pi、dsh 或 Claude 委派独立工作。先在运行主宿主的机器上安装所需目标:
80
96
 
81
97
  | 目标 | 安装 | 认证与模型 |
82
98
  | --- | --- | --- |
@@ -84,7 +100,7 @@ Pi 和 dsh 主会话都可通过 ACP 委派其他宿主。先在运行主宿主
84
100
  | dsh | 已安装命令行 dsh 即可;否则运行 `npm install -g @deepseek-ai/dsh@latest` | 按 dsh 原生方式配置目标 profile 的模型与认证;默认入口为 `dsh --profile acp` |
85
101
  | Claude Code | `npm install -g @agentclientprotocol/claude-agent-acp` | 按 [Claude Code 指南](https://code.claude.com/docs/en/quickstart)完成登录或 API 配置,并设置默认模型 |
86
102
 
87
- 在启动主宿主的同一终端检查目标程序,例如 `command -v claude-agent-acp`。安装后重试原 start 请求。已安装但 PATH 不可见时,将输出的绝对路径写入工作区 [acp 配置](docs/workspace-configuration.md#acp-启动配置)。PATH 变化后重启主宿主;只修改工作区配置时,Pi 执行 `/reload`,dsh 重启宿主。
103
+ 在启动主宿主的同一终端检查目标程序,例如 `command -v claude-agent-acp`。安装后重试原 start 请求。已安装但 PATH 不可见时,将输出的绝对路径写入工作区 [acp 配置](docs/workspace-configuration.md#acp-启动配置)。PATH 变化后重启主宿主;只修改工作区 ACP 配置时,Pi 执行 `/reload`,dsh 重启宿主。
88
104
 
89
105
  缺少程序时,工具会返回对应安装命令、认证提示和路径配置示例。调用参数与持续对话见[ACP 成员](docs/agent-collaboration.md#acp-成员)。
90
106
 
@@ -98,7 +114,7 @@ npm run build:cli
98
114
  node bin/pbot.mjs setup
99
115
  ```
100
116
 
101
- 只加载 Pi 源码扩展时,在工作区执行 `pi install --local /absolute/path/to/personal-bot`,并保留该目录和依赖。使用 ACP 成员前先运行完整的 `npm run build`。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#依赖与开发检查)。
102
118
 
103
119
  ### 可选安装 Task Conductor
104
120
 
@@ -110,7 +126,7 @@ Pi 用户从工作区运行 `pi install --local npm:task-conductor-plugin`,重
110
126
 
111
127
  ## 日常使用
112
128
 
113
- 直接说明任务,例如整理资料、比较研究结论、委派复核或运行计算。以下命令面向 Pi,dsh 命令见其指南。
129
+ 直接说明任务,例如整理资料、比较研究结论、委派复核或运行计算。以下命令面向 Pi;[dsh](docs/dsh.md) 与 [Claude](docs/claude-code.md) 使用各自指南中的原生入口。
114
130
 
115
131
  | 命令 | 用途 |
116
132
  | --- | --- |
@@ -125,9 +141,9 @@ Pi 用户从工作区运行 `pi install --local npm:task-conductor-plugin`,重
125
141
 
126
142
  - **初始化与资料准备**:`/pbot init` 补建资料并启用工作区,保留已有资料与其他配置字段。Pi 首次启用时自动重载;已启动时补建的根 AGENTS 经 `/reload` 加载。
127
143
  - **原生工具**:CLI 通过 Bash 使用,MCP 使用宿主配置。Pi 新增项目连接时执行 `pi mcp add --local <server> ...`,通过 `/mcp` 查看来源。接入方法见[技能](resources/skills/provider-connections/SKILL.md)。
128
- - **历史回溯**:Pi 与 dsh 共同查询工作区归档。原文先可查询,主交互结束后用当前模型补齐摘要,会产生额外模型调用;新输入优先取消整理。详见[历史对话](docs/history.md)。
129
- - **专家与团队**:可独立委派、持续对话,或组织轮流讨论和并行轮次。默认 Pi 专家需要 tmux,dsh 使用原生会话;两种主会话也可通过 ACP 调用 Pi、dsh 和 Claude Code,支持独立对话、报告及恢复。ACP 的 model、thinking 均可单独省略,省略项使用目标宿主默认值。团队运行时占用成员,切换私人工作前先暂停并等待在途工作结束。详见[专家协作](docs/agent-collaboration.md)。
130
- - **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)。
131
147
  - **资料维护**:可请助手整理项目、按既有口径重做分析或检查交付。按[维护技能](resources/skills/project-maintenance/SKILL.md)更新当前说明、提炼方法,保留正式资料、历史与备份。
132
148
 
133
149
  Pi 主会话恢复用 `pi --resume` 明确选择;`pi --continue` 可能选中最近活跃的子会话。受管专家从 `/pbot agents` 进入,停止后打开原会话会保持待命,携新要求继续时使用 resume。运行中的会话只保留一个写入进程。
@@ -136,20 +152,21 @@ Pi 主会话恢复用 `pi --resume` 明确选择;`pi --continue` 可能选中
136
152
 
137
153
  | 位置 | 用途 |
138
154
  | --- | --- |
139
- | `.pbot/config.json` | Pi/dsh 共用的工作区启用与配置 |
155
+ | `.pbot/config.json` | Pi/dsh/Claude 共用的工作区启用与配置 |
140
156
  | `AGENTS.md` | 资料导航与工作约定 |
141
157
  | `areas/`、`projects/` | 长期目标、任务、结论与交付物 |
142
158
  | `knowledge/` | 可复用的概念、方法与口径 |
143
- | `.pbot/history/` | Pi/dsh 问答原文、摘要与节点关系 |
159
+ | `.pbot/history/` | Pi/dsh 问答原文、摘要与节点关系,以及保留的 Claude 归档 |
144
160
  | `providers/` | 外部工具的使用说明、数据口径与来源 |
145
161
  | `scratch/` | 临时脚本、计算数据、下载与运行环境 |
146
- | `agents/`、`.agents/skills/` | 职责补充与工作区技能 |
162
+ | `agents/` | 职责补充 |
163
+ | `.agents/skills/`(Pi/dsh)、`.claude/skills/`(Claude) | 当前宿主原生发现的工作区技能 |
147
164
 
148
165
  已有布局与工作约定优先。可再次查询的数据在需要时按记录的口径获取。复制工作区前停止旧实例的写入,不支持多机同时写同步目录。详细位置与保留规则见[文件存储](docs/file-storage.md)。
149
166
 
150
167
  ## 更新与操作范围
151
168
 
152
- 当前版本为 **0.2.12**。通过宿主原生包管理更新;本地 Pi 来源更新源码,依赖变化后运行 `npm ci --ignore-scripts`,再重载或重启。更换版本前停止活动专家;不同兼容线的专家需重新创建,旧资料、历史和备份保留。
169
+ 当前版本为 **0.2.13**。通过宿主原生包管理更新;本地 Pi 来源更新源码,依赖变化后运行 `npm ci --ignore-scripts`,再重载或重启。更换版本前停止活动专家;不同兼容线的专家需重新创建,旧资料、历史和备份保留。
153
170
 
154
171
  操作按用户请求、已有约定和必要确认执行。Bash、Python、MCP 和扩展使用实际账户与凭据权限;硬限制应由只读凭据、服务端控制或受限环境提供。交易、转账和账本修改需要相应授权。取消、超时或断连后,先查原生状态再决定是否重试,避免重复执行。
155
172
 
@@ -157,7 +174,7 @@ Task Conductor 节点单独配置工具、环境、技能与认证;需要人
157
174
 
158
175
  ## 开发与文档
159
176
 
160
- 双宿主开发使用 Linux、Node.js 24.9+。安装锁定依赖后运行:
177
+ 三宿主开发与完整验收使用 Linux、Node.js 24.9+。安装锁定依赖后运行:
161
178
 
162
179
  ```bash
163
180
  npm run check
@@ -166,7 +183,7 @@ git diff --check
166
183
  npm pack --dry-run
167
184
  ```
168
185
 
169
- `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)。
170
187
 
171
188
  - [文档索引](docs/README.md):当前架构、使用与开发说明。
172
189
  - [npm 发布](docs/release.md):候选检查、发布配置与操作。
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。两种主会话也可通过 ACP 调用 Pi、dsh 和 Claude Code 成员。每位成员保留自己的上下文,恢复时继续使用原后端。主模型负责组织与验收,成员原文由代码同步,不需要主模型逐条转述。
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,14 @@ 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
+
35
45
  ## ACP 成员
36
46
 
37
47
  在 start 中指定 backend,使用目标宿主的 ACP 会话:
@@ -40,7 +50,7 @@ dsh 使用原生 provider/model/reasoning effort,拒绝 Pi 专属扩展、提
40
50
  { "action": "start", "backend": "claude", "name": "实现专家", "message": "检查项目并实现当前要求" }
41
51
  ```
42
52
 
43
- backend 可选 pi、dsh、claude;省略时保持当前宿主原生专家。两种主会话都支持这三个目标。目标宿主使用自己的模型、认证、工具、技能和项目配置,恢复保留原会话的模型选择。
53
+ backend 可选 pi、dsh、claude;Pi/dsh 中省略时使用当前宿主原生专家。两个主宿主共享 ACP 目标实现。目标使用自己的模型、认证、工具、技能和项目配置,恢复保留原会话的模型选择。Claude 作为 ACP 目标的能力独立于标准 Claude 插件,所需 Claude SDK 保留为可选 peer 与开发依赖。
44
54
 
45
55
  model 和 thinking 均为可选,可单独提供;两者都省略时使用目标默认模型和默认思考等级。只指定 model 时使用所选模型的原生默认思考配置;只指定 thinking 时将该等级用于默认模型。主会话的模型和思考默认值不传给 ACP 目标。
46
56
 
@@ -64,9 +74,11 @@ ACP 成员支持待命、独立委派、持续对话、状态、固定周期报
64
74
 
65
75
  成员加载公共约定、general-purpose 职责和工作区同名补充,并按需使用包内技能。Claude 的原生技能目录中可见 personal-bot:provider-connections 和 personal-bot:project-maintenance,用户与项目技能继续沿用 Claude 配置。worker 准备并激活共享 Python 环境,准备失败时继续提供协作能力,并向成员报告环境状态。
66
76
 
67
- Pi 的 `/pbot agents` 对 ACP 成员提供任务、报告、补充要求及携新要求恢复;原生 Pi 成员继续通过 tmux 进入。dsh 专家页展示 ACP 任务与报告,也支持人工消息和附件。Pi 权限请求进入已有确认队列,使用一次性选项;dsh 工作区页展示待确认请求,也可用 `/pbot approval` 提交选项。
77
+ Pi 的 `/pbot agents` 对 ACP 成员提供任务、报告、补充要求及携新要求恢复;原生 Pi 成员继续通过 tmux 进入。dsh 专家页展示 ACP 任务与报告,也支持人工消息和附件。
78
+
79
+ Pi 权限请求进入已有确认队列;dsh 工作区页展示待确认请求,也可用 `/pbot approval` 提交选项。各入口按 generation/requestId 核对请求,取消回写 null,过期选择被拒绝。
68
80
 
69
- ACP 工作由独立 worker 持有。Pi reload 保留仍启用工作区的 worker;退出、切换主会话或 dsh 父会话释放时停止所属成员。恢复前校验已绑定的对端会话,旧输入不重放。Pi/Claude 从未交付输入的空待命会话恢复时可重新建立空上下文;已经交付的会话只恢复原引用。
81
+ ACP 工作由独立 worker 持有。Pi reload 保留仍启用工作区的 worker;退出、切换主会话或 dsh 父会话释放时停止所属成员。休眠后先查状态,携新要求显式继续。恢复前校验已绑定的对端会话,旧输入不重放。Pi/Claude 目标从未交付输入的空待命会话可重新建立空上下文;已经交付的会话只恢复原引用。
70
82
 
71
83
  ## Pi 原生会话与恢复入口
72
84
 
@@ -76,7 +88,7 @@ ACP 工作由独立 worker 持有。Pi reload 保留仍启用工作区的 worker
76
88
 
77
89
  `/pbot agents` 的“进入会话”连接运行中的成员;成员已停止时,“打开原会话”加载原会话并启动待命进程,不入队新要求、不调用模型、不重放旧工作。尚无对话文件的空会话仍以原 agentId 待命。运行中不另开进程同时写同一 JSONL。停止后从原生列表打开属于普通 Pi 对话,不恢复 pbot 成员身份或团队资格;模型工具 `pbot_agent resume` 仍用于携新要求继续工作。
78
90
 
79
- ## 团队与两种策略
91
+ ## Pi/dsh 团队与两种策略
80
92
 
81
93
  一个团队固定一组成员,限于同一工作区、同一父 session 的可操作分支。一个 agent 最多属于一个未关闭团队。加入团队不创建新进程,关闭团队也不停止成员;换人时关闭旧团队,再用原 agent 创建新团队。
82
94
 
@@ -149,7 +161,7 @@ read 的文本结果也使用 Markdown,同时保留工具的结构化结果。
149
161
 
150
162
  Pi 独立周期的 read 结果进入当前分支后领取该周期通知,包括只读取部分正文的情况。dsh 以持久化的上下文消费或成功模型 read 领取;PTC 内层 read 还需根调用成功,排队仅防重,不视为已消费。人工管理页不领取模型通知。nextOffset 非空时,以同一 agentId、返回的 cycle.cycleId 和 nextOffset 续读,避免默认最新周期发生变化;status 不领取通知。团队关联周期不重复发个人完成通知;主模型只收到批次结束、暂停和收尾状态。普通 post 不唤醒主模型。团队通知按 teamId/runId/状态去重,UI 或工具 read 不领取模型通知。
151
163
 
152
- 团队与成员均绑定父 session/分支。失去归属时暂停新安排,不向当前主分支投递结果。fork 不接管旧团队;返回原分支不会自动恢复旧批次。公共记录与外部工作不会随树导航回滚。
164
+ Pi/dsh 的团队与受管成员均绑定父 session/分支。失去归属时暂停新安排,不向当前主分支投递结果。fork 不接管旧团队;返回原分支不会自动恢复旧批次。公共记录与外部工作不会随树导航回滚。
153
165
 
154
166
  | 事件 | 行为 |
155
167
  | --- | --- |
@@ -168,7 +180,7 @@ pause 返回时可能仍有在途请求。unresolved 区分排队、已接收、
168
180
 
169
181
  ## 界面与故障恢复
170
182
 
171
- dsh 的管理界面与命令见[dsh 使用说明](dsh.md)。下面介绍 Pi 的 TUI。
183
+ dsh 的管理界面与命令见[dsh 使用说明](dsh.md),Claude 的原生专家、技能与恢复规则见[Claude 使用说明](claude-code.md)。下面介绍 Pi 的 TUI。
172
184
 
173
185
  `/pbot` 打开工作区菜单。`/pbot agents` 提供专家列表、详情、会话入口、补充要求、重命名和停止;`/pbot teams` 提供团队状态、公共消息、批次及成员入口。长记录使用只读阅读页。完整报告仍通过 `pbot_agent read` 获取;非 TUI 模式保留结构化输出。
174
186
 
@@ -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,9 +24,15 @@ 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
+
27
33
  ## ACP 子会话
28
34
 
29
- 主会话可通过 pbot_agent 的 backend 选择 Pi、dsh 或 Claude Code。目标保留自己的原生配置、认证、工具和资源发现,模型选择不跨宿主继承。Pi 目标使用 pi-acp,dsh 使用原生 acp profile,Claude 使用 claude-agent-acp;启动与持续对话见[专家协作](agent-collaboration.md#acp-成员)。
35
+ Pi/dsh 主会话可通过 pbot_agent 的 backend 选择 Pi、dsh 或 Claude Code。目标保留自己的原生配置、认证、工具和资源发现,模型选择不跨宿主继承。Pi 目标使用 pi-acp,dsh 使用原生 acp profile,Claude 使用 claude-agent-acp;启动与持续对话见[专家协作](agent-collaboration.md#acp-成员)。
30
36
 
31
37
  ACP 权限请求按目标提供的选项交给人工:Pi 使用现有确认队列,dsh 在工作区页显示待确认操作。目标自己的工具政策继续生效。初始附件保留绝对来源;文本按预算读取,图片经协商后传入,其他二进制文件交给目标的原生工具沿来源读取。
32
38
 
@@ -40,7 +46,7 @@ Bash、Python、MCP 和扩展拥有其实际账户与凭据权限。dsh 的原
40
46
 
41
47
  ## 可选 Task Conductor
42
48
 
43
- 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)。
44
50
 
45
51
  Personal Bot 提供按需参考入口,工具调用、连接和通知由 Task Conductor 插件与宿主管理。通知绑定提交任务的原生持久会话,恢复原会话后继续接收。
46
52
 
@@ -0,0 +1,45 @@
1
+ # Claude Code 标准插件接入
2
+
3
+ Claude 接入聚焦工作区资料、专业技能、原生通用专家与共享 Python。使用公开的 command hooks、Markdown skills 和 Markdown agents;主会话、原生工具、MCP、团队和恢复由 Claude 管理。使用操作见[Claude 指南](claude-code.md),共用模块见[技术设计](technical-design.md)。
4
+
5
+ ## 范围与依赖
6
+
7
+ Claude 插件不实现 pbot 面板、历史采集与检索、摘要、ACP 委派或 pbot 团队调度。Pi/dsh 的历史和 ACP 保留,其中 Claude 作为 ACP 目标的 SDK 适配继续由 ACP 模块负责。现有归档、控制记录和备份保留;持久合同不因功能收敛而迁移。
8
+
9
+ 插件不依赖 function-hooks/mod、`claude-code` 类型声明、Node MCP server、内部 transcript、私有团队配置、父进程启动参数或原生消息收据。Claude hooks 使用 Node 内置模块和共用工作区/Python 服务。Claude SDK 仍是 Pi/dsh 的 Claude ACP 目标所需可选 peer 与精确开发依赖,Claude 插件本身不加载它。
10
+
11
+ ## 入口与行为
12
+
13
+ | 入口 | 责任 |
14
+ | --- | --- |
15
+ | `.claude-plugin/plugin.json` | 声明共用技能、Claude 管理技能、原生通用专家与最低宿主版本 |
16
+ | `hooks/hooks.json` | 用 command + args 启动独立 Node hook,JSON 经 stdin/stdout 传递 |
17
+ | `src/claude.ts` | hook/CLI 进程入口;错误写 stderr |
18
+ | `src/extension/claude-hooks.ts` | 固定根目录、启用检查、资料组装与命令执行 |
19
+ | `resources/claude/skills/pbot/SKILL.md` | 通过原生技能执行 init、status、python setup |
20
+ | `resources/claude/agents/general-purpose.md` | 构建时由共用专家职责生成的原生 Agent 声明 |
21
+
22
+ 根目录使用公开 `CLAUDE_PROJECT_DIR`;普通 Node 命令无此变量时使用 cwd。仅检查该根的 `.pbot/config.json`。缺失、false 或无效配置不准备 Python或加入业务资料。初始化沿用共用 `initializeWorkspace`,保留用户文件、`CLAUDE.md` 与未知配置字段。
23
+
24
+ | hook | 行为 |
25
+ | --- | --- |
26
+ | `SessionStart` | 已启用时检查并按需准备共享 Python;未启用时提供初始化入口 |
27
+ | `UserPromptSubmit` | 重读配置和当前资料,加入公共约定、角色、AGENTS 与环境状态 |
28
+ | `SubagentStart` | 仅为插件的 `personal-bot:general-purpose` 加入当前专家资料 |
29
+ | `PreToolUse` / `Skill`、`UserPromptExpansion` | 检查模型调用和用户直接展开的 pbot 工作方法;未启用时拦截并提供初始化提示,保留 pbot 管理技能入口 |
30
+
31
+ 每次 hook 都是短生命周期进程,不保存宿主实例、心跳或租约。受管 ACP 目标用 pbot 自有环境标记跳过重复注入。宿主明确提供子代理身份时使用专家职责;独立原生团队的职责仍由 Claude 自己组织,不读取私有身份文件。
32
+
33
+ ## Python 与关闭
34
+
35
+ 共享环境使用现有准备脚本和锁定依赖。只读 inspect 判断是否需要准备,准备失败时在当次 hook 或命令结果中显示错误,任务上下文包含当前状态。后续 status 只检查当前环境,不持久保存安装日志。ready 状态提供完整 `python.executable`;Claude 的 Bash 按此路径运行计算。插件不修改父宿主环境,因此停用、重载和卸载无需恢复 PATH 或终止插件业务进程。
36
+
37
+ `status` 不安装依赖。`init` 和 `python setup` 运行同一准备入口,错误状态与资料初始化结果分别呈现。原生 `/personal-bot:pbot` 是模型技能;需要确定性执行时直接运行 Node 命令。
38
+
39
+ ## 升级与验证
40
+
41
+ 最低及当前原生检查基线是 Claude Code 2.1.325;Node 消费基线为 22.19+,完整开发使用 Linux、Node 24.9+。后续升级检查公开 hook 输入/输出、manifest、技能与专家发现,不再维护 Claude 内部记录版本白名单或大型宿主声明快照。
42
+
43
+ 本地测试使用真实临时目录、Node/Python 进程及共用服务,核对固定根、停用无副作用、配置保留、错误处理和结构化 hook 输出。消费检查安装实际 tarball,在不安装 Pi/dsh/Claude SDK 的目录执行原生 `claude plugin validate`、确定性命令和 hook。
44
+
45
+ 真实模型验收在已批准且不含个人凭据的环境完成,核对:首任务资料与环境可见;工作区资料修改在下一轮生效;技能加载;原生专家职责与继续;用户选择的原生团队行为;Python 完整路径执行。无模型的进程测试与静态校验只报告实际覆盖范围,不替代这些模型行为检查。结果写任务、PR 或 CI,不维护验证日记。