@oyasmi/pipiclaw 0.9.2-beta.6 → 0.9.3-beta.1

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 (165) hide show
  1. package/README.en.md +250 -0
  2. package/README.md +2 -0
  3. package/dist/agent/channel-runner.d.ts +43 -2
  4. package/dist/agent/channel-runner.js +135 -75
  5. package/dist/agent/job-manager.d.ts +76 -21
  6. package/dist/agent/job-manager.js +447 -63
  7. package/dist/agent/maintenance-context.js +4 -5
  8. package/dist/agent/prompt/manifest.d.ts +0 -2
  9. package/dist/agent/prompt/manifest.js +2 -3
  10. package/dist/agent/prompt/sections.js +3 -3
  11. package/dist/agent/session-events.js +4 -8
  12. package/dist/agent/turn-prompt.d.ts +7 -7
  13. package/dist/agent/turn-prompt.js +6 -9
  14. package/dist/agent/types.d.ts +12 -0
  15. package/dist/agent/types.js +1 -0
  16. package/dist/channel/channel-context.d.ts +13 -0
  17. package/dist/channel/channel-context.js +21 -1
  18. package/dist/commands/catalog.js +47 -20
  19. package/dist/memory/commands.d.ts +8 -0
  20. package/dist/memory/commands.js +113 -148
  21. package/dist/memory/index-budget.d.ts +27 -0
  22. package/dist/memory/index-budget.js +99 -0
  23. package/dist/memory/journal.d.ts +20 -0
  24. package/dist/memory/journal.js +78 -0
  25. package/dist/memory/lifecycle.d.ts +9 -15
  26. package/dist/memory/lifecycle.js +55 -145
  27. package/dist/memory/maintenance-gates.d.ts +13 -47
  28. package/dist/memory/maintenance-gates.js +13 -92
  29. package/dist/memory/maintenance-state.d.ts +10 -16
  30. package/dist/memory/maintenance-state.js +12 -59
  31. package/dist/memory/maintenance-tuning.d.ts +7 -27
  32. package/dist/memory/maintenance-tuning.js +11 -28
  33. package/dist/memory/migrate.d.ts +15 -0
  34. package/dist/memory/migrate.js +364 -0
  35. package/dist/memory/reflect-job.d.ts +43 -0
  36. package/dist/memory/reflect-job.js +117 -0
  37. package/dist/memory/reflect.d.ts +52 -0
  38. package/dist/memory/reflect.js +313 -0
  39. package/dist/memory/render.d.ts +14 -0
  40. package/dist/memory/render.js +28 -0
  41. package/dist/memory/review-log.d.ts +2 -1
  42. package/dist/memory/scheduler.d.ts +2 -3
  43. package/dist/memory/scheduler.js +14 -49
  44. package/dist/memory/search.d.ts +35 -0
  45. package/dist/memory/search.js +297 -0
  46. package/dist/memory/session-search.js +1 -1
  47. package/dist/memory/store.d.ts +108 -0
  48. package/dist/memory/store.js +418 -0
  49. package/dist/memory/task-digest.d.ts +2 -2
  50. package/dist/memory/task-digest.js +29 -36
  51. package/dist/memory/tombstones.d.ts +0 -11
  52. package/dist/memory/tombstones.js +6 -37
  53. package/dist/playbooks/agent-delegation.md +4 -2
  54. package/dist/playbooks/background-jobs.md +1 -1
  55. package/dist/playbooks/event-scheduling.md +6 -2
  56. package/dist/playbooks/memory-and-learning.md +18 -11
  57. package/dist/playbooks/outbound-media.md +1 -1
  58. package/dist/playbooks/runtime-orientation.md +9 -8
  59. package/dist/playbooks/task-loop.md +88 -0
  60. package/dist/runtime/bootstrap.d.ts +3 -3
  61. package/dist/runtime/bootstrap.js +66 -41
  62. package/dist/runtime/events.d.ts +9 -0
  63. package/dist/runtime/events.js +43 -4
  64. package/dist/runtime/task-commands.d.ts +14 -15
  65. package/dist/runtime/task-commands.js +249 -485
  66. package/dist/runtime/task-driver.d.ts +41 -29
  67. package/dist/runtime/task-driver.js +170 -317
  68. package/dist/runtime/task-migration.d.ts +34 -30
  69. package/dist/runtime/task-migration.js +229 -183
  70. package/dist/runtime/task-wake.d.ts +6 -3
  71. package/dist/runtime/task-wake.js +26 -19
  72. package/dist/settings.d.ts +0 -29
  73. package/dist/settings.js +12 -35
  74. package/dist/shared/markdown-sections.d.ts +0 -1
  75. package/dist/shared/markdown-sections.js +0 -3
  76. package/dist/subagents/discovery.d.ts +2 -2
  77. package/dist/subagents/discovery.js +21 -10
  78. package/dist/subagents/external/progress-tail.js +6 -1
  79. package/dist/subagents/external/run.js +1 -0
  80. package/dist/subagents/runs.d.ts +19 -2
  81. package/dist/subagents/runs.js +73 -4
  82. package/dist/subagents/tool.d.ts +10 -8
  83. package/dist/subagents/tool.js +55 -94
  84. package/dist/tasks/brief.d.ts +17 -0
  85. package/dist/tasks/brief.js +57 -0
  86. package/dist/tasks/budget.d.ts +26 -0
  87. package/dist/tasks/budget.js +59 -0
  88. package/dist/tasks/cycle.d.ts +48 -0
  89. package/dist/tasks/cycle.js +94 -0
  90. package/dist/tasks/frontmatter.d.ts +73 -0
  91. package/dist/tasks/frontmatter.js +175 -0
  92. package/dist/tasks/ledger.d.ts +66 -106
  93. package/dist/tasks/ledger.js +90 -546
  94. package/dist/tasks/log.d.ts +88 -0
  95. package/dist/tasks/log.js +97 -0
  96. package/dist/tasks/rounds.d.ts +43 -0
  97. package/dist/tasks/rounds.js +57 -0
  98. package/dist/tasks/session-path.d.ts +9 -0
  99. package/dist/tasks/session-path.js +16 -0
  100. package/dist/tasks/steer.d.ts +8 -0
  101. package/dist/tasks/steer.js +79 -0
  102. package/dist/tasks/store.d.ts +60 -35
  103. package/dist/tasks/store.js +166 -107
  104. package/dist/tasks/ticket.d.ts +102 -0
  105. package/dist/tasks/ticket.js +209 -0
  106. package/dist/tasks/verification.d.ts +16 -0
  107. package/dist/tasks/verification.js +40 -1
  108. package/dist/tools/index.d.ts +13 -4
  109. package/dist/tools/index.js +5 -10
  110. package/dist/tools/memory-manage.d.ts +6 -16
  111. package/dist/tools/memory-manage.js +108 -129
  112. package/dist/tools/presentation.js +2 -1
  113. package/dist/tools/registry.d.ts +11 -2
  114. package/dist/tools/registry.js +17 -6
  115. package/dist/tools/subagent-manage.d.ts +0 -9
  116. package/dist/tools/subagent-manage.js +8 -17
  117. package/dist/tools/task-manage/create.js +2 -2
  118. package/dist/tools/task-manage/lifecycle.d.ts +9 -4
  119. package/dist/tools/task-manage/lifecycle.js +139 -187
  120. package/dist/tools/task-manage/log-view.d.ts +8 -0
  121. package/dist/tools/task-manage/log-view.js +24 -0
  122. package/dist/tools/task-manage/schema.d.ts +38 -14
  123. package/dist/tools/task-manage/schema.js +46 -27
  124. package/dist/tools/task-manage/shared.d.ts +24 -31
  125. package/dist/tools/task-manage/shared.js +103 -141
  126. package/dist/tools/task-manage/step-end.d.ts +11 -0
  127. package/dist/tools/task-manage/step-end.js +136 -0
  128. package/dist/tools/task-manage/types.d.ts +23 -32
  129. package/dist/tools/task-manage.d.ts +4 -3
  130. package/dist/tools/task-manage.js +30 -15
  131. package/dist/tools/tool-details.d.ts +1 -1
  132. package/dist/tui/app.js +0 -2
  133. package/package.json +1 -1
  134. package/dist/agent/effect-ledger.d.ts +0 -32
  135. package/dist/agent/effect-ledger.js +0 -89
  136. package/dist/memory/bootstrap.d.ts +0 -17
  137. package/dist/memory/bootstrap.js +0 -120
  138. package/dist/memory/candidates.d.ts +0 -26
  139. package/dist/memory/candidates.js +0 -202
  140. package/dist/memory/consolidation.d.ts +0 -54
  141. package/dist/memory/consolidation.js +0 -292
  142. package/dist/memory/extraction.d.ts +0 -54
  143. package/dist/memory/extraction.js +0 -240
  144. package/dist/memory/files.d.ts +0 -71
  145. package/dist/memory/files.js +0 -419
  146. package/dist/memory/maintenance-jobs.d.ts +0 -41
  147. package/dist/memory/maintenance-jobs.js +0 -265
  148. package/dist/memory/metadata.d.ts +0 -57
  149. package/dist/memory/metadata.js +0 -142
  150. package/dist/memory/probation.d.ts +0 -17
  151. package/dist/memory/probation.js +0 -44
  152. package/dist/memory/promotion.d.ts +0 -38
  153. package/dist/memory/promotion.js +0 -36
  154. package/dist/memory/recall.d.ts +0 -59
  155. package/dist/memory/recall.js +0 -746
  156. package/dist/memory/session.d.ts +0 -24
  157. package/dist/memory/session.js +0 -273
  158. package/dist/playbooks/task-driving.md +0 -92
  159. package/dist/playbooks/task-planning.md +0 -58
  160. package/dist/tasks/control.d.ts +0 -56
  161. package/dist/tasks/control.js +0 -169
  162. package/dist/tasks/transitions.d.ts +0 -16
  163. package/dist/tasks/transitions.js +0 -48
  164. package/dist/tools/task-manage/verification.d.ts +0 -19
  165. package/dist/tools/task-manage/verification.js +0 -91
package/README.en.md ADDED
@@ -0,0 +1,250 @@
1
+ # Pipiclaw
2
+
3
+ [简体中文](./README.md) | **English**
4
+
5
+ **Turn DingTalk into an AI engineering entry point that keeps working.**
6
+
7
+ Pipiclaw is an AI coding assistant runtime for individuals and teams. It lets an AI assistant do more than answer a single question: it stays in your DingTalk, understands context, operates your workspace, remembers long-term conventions, keeps tasks moving on a plan, and delegates the heavy lifting to Claude Code, Codex CLI, or your own executor.
8
+
9
+ What you see is one assistant, but behind it can be a well-divided AI engineering team: the main agent owns understanding goals and delivering results, lightweight sub-agents handle retrieval and triage, and external agents handle cross-file implementation, independent review, and verification runs. All work has state, artifacts, and control entry points, instead of being scattered across a few terminal windows as throwaway conversations.
10
+
11
+ - npm: [`@oyasmi/pipiclaw`](https://www.npmjs.com/package/@oyasmi/pipiclaw)
12
+ - Runtime: Node.js `>= 22.19.0`, Linux / macOS; on Windows use WSL2
13
+ - License: [GNU AGPL v3](./LICENSE)
14
+
15
+ ## Why Pipiclaw
16
+
17
+ ### One entry point, coordinating multiple agents
18
+
19
+ Pipiclaw supports two kinds of delegation at once: built-in sub-agents do lightweight work in-process such as retrieval and log triage; external agents launch real Claude Code, Codex CLI, or any script to handle heavy tasks that need long runs, many files, and repeated self-testing.
20
+
21
+ In DingTalk daemon mode, external tasks keep running in the background after dispatch and automatically wake the originating channel on completion. You can use `/subagents` at any time to check run status, the actual command, and outputs, use `/subagents cancel` to terminate directly, and let the main agent keep asking follow-up questions on a finished Claude Code / Codex session. The repo ships planner, builder, reviewer, verifier, and documenter role templates that are ready to adapt.
22
+
23
+ ### Work does not end when a conversation ends
24
+
25
+ Every session has its own current state, long-term memory, and history summary. The task ledger persists goals, done criteria, progress, next steps, and verification records to Markdown files; the built-in task driver resumes work at the right time — continuing when there is progress, backing off when stalled, and stopping and telling you when a boundary is crossed.
26
+
27
+ ### Natively at home in DingTalk
28
+
29
+ Pipiclaw uses DingTalk Stream Mode, so no self-hosted message relay or public IP is needed. AI Cards can continuously show thinking, tool execution, and status updates; while a task runs you can still use `/steer` to adjust direction, `/followup` to queue the next thing, and `/stop` to abort the current turn. Generated reports, screenshots, and exported files can be delivered as native DingTalk attachments.
30
+
31
+ A single bot instance can serve many direct and group chats at once: DMs get a channel per user, groups get a channel per group, and model turns in different channels can progress in parallel; within one channel turns run serially so one conversation's context is not modified by multiple turns at once. Note that session isolation is not code-directory isolation; if several channels point at the same project directory, you should still avoid having the main agent edit the same set of files concurrently, or prepare separate Git worktrees for parallel implementation. See [Scaling and concurrency](https://github.com/oyasmi/pipiclaw/blob/main/docs/scaling-and-concurrency.md) for the full boundaries.
32
+
33
+ ### Autonomous, and always interruptible
34
+
35
+ Scheduled events are good for reminders, periodic checks, and zero-token conditional sensors; the task ledger is good for long-running work that spans hours and sessions. Runtime status, model usage, tasks, memory, and delegation runs all have control commands that do not go through the LLM, so even when the model is unavailable or the current turn is stuck, you can still inspect and intervene.
36
+
37
+ ### Your config, data, and way of working
38
+
39
+ Models support built-in providers, OpenAI-compatible gateways, API keys, and subscription login. Memory, tasks, roles, events, and team rules are all stored in human-readable files on your machine. Pipiclaw provides command, path, and network guards plus an audit log; when you need stronger isolation, you can put the whole process in its own account or container.
40
+
41
+ ## What it's good for
42
+
43
+ - Providing an always-online dev assistant, internal tech support, or ops collaboration entry point in DingTalk
44
+ - Handing requirement analysis, implementation, review, verification, and documentation to different AI agents working together
45
+ - Following up on coding, investigation, migration, reporting, and periodic work that spans hours or days
46
+ - Keeping mutually isolated context and memory across many group and direct chats
47
+ - Reusing existing model gateways, Claude Code / Codex CLI accounts, and team working conventions
48
+
49
+ Pipiclaw today targets individuals and small teams, self-hosted, single-instance. It is not a hard multi-tenant SaaS, and it does not provide an OS-level sandbox; the real permissions an external agent holds are determined together by the target CLI's sandbox parameters, the run account, and the host environment.
50
+
51
+ ## Quick start
52
+
53
+ Below are three progressive paths: verify a model in the terminal first, then connect DingTalk, then enable external agents. If you already have a clear goal, jump straight to the relevant part.
54
+
55
+ ### 1. Install and confirm the CLI
56
+
57
+ ```bash
58
+ npm install -g @oyasmi/pipiclaw
59
+ pipiclaw tui --help
60
+ ```
61
+
62
+ The first real start of `pipiclaw` or `pipiclaw tui` creates:
63
+
64
+ ```text
65
+ ~/.pipiclaw/
66
+ ├── channel.json # DingTalk app
67
+ ├── auth.json # model credentials
68
+ ├── models.json # custom model providers
69
+ ├── settings.json # default model and runtime settings
70
+ ├── tools.json # capability switches for web tools, tasks, etc.
71
+ ├── security.json # command, path, and network guards
72
+ └── workspace/ # memory, tasks, events, skills, agent roles, and channel data
73
+ ```
74
+
75
+ Set `PIPICLAW_HOME=/your/path` to relocate this directory as a whole.
76
+
77
+ ### 2. Fastest taste: get it working in the terminal first
78
+
79
+ Terminal mode needs no DingTalk credentials, only a working model. Pick either way:
80
+
81
+ ```bash
82
+ # Option A: use an API key
83
+ export ANTHROPIC_API_KEY=sk-ant-...
84
+
85
+ # Option B: log in to a subscription provider supported by the SDK
86
+ pipiclaw auth login
87
+ ```
88
+
89
+ Then start:
90
+
91
+ ```bash
92
+ pipiclaw tui
93
+ ```
94
+
95
+ It can also be used for scripted one-shot requests:
96
+
97
+ ```bash
98
+ pipiclaw tui --print "Review the current project and give me the three highest-priority risks"
99
+ ```
100
+
101
+ To connect an enterprise gateway, a local model, or set a default model, see [Configuration reference](https://github.com/oyasmi/pipiclaw/blob/main/docs/configuration.md).
102
+
103
+ ### 3. Connect DingTalk
104
+
105
+ Create an enterprise internal app on the [DingTalk Open Platform](https://open-dev.dingtalk.com/):
106
+
107
+ 1. Get the `Client ID` and `Client Secret`
108
+ 2. Enable the bot capability
109
+ 3. Enable Stream Mode
110
+ 4. Recommended: create an AI Card template and get its `Card Template ID`
111
+
112
+ Edit `~/.pipiclaw/channel.json`:
113
+
114
+ ```json
115
+ {
116
+ "clientId": "your-dingtalk-client-id",
117
+ "clientSecret": "your-dingtalk-client-secret",
118
+ "robotCode": "",
119
+ "cardTemplateId": "",
120
+ "cardTemplateKey": "content",
121
+ "allowFrom": []
122
+ }
123
+ ```
124
+
125
+ - The only hard-required fields are `clientId` and `clientSecret`.
126
+ - When `robotCode` is empty it falls back to `clientId`.
127
+ - `cardTemplateId` can be left empty for now; configuring an AI Card is recommended for real use.
128
+ - `allowFrom: []` means all senders are allowed; during a limited rollout, fill in tester staff IDs.
129
+ - The file must not keep any `your-*` placeholder values.
130
+
131
+ Start the daemon:
132
+
133
+ ```bash
134
+ pipiclaw
135
+ ```
136
+
137
+ In DingTalk, send `/model` first to confirm the model is available, then send:
138
+
139
+ ```text
140
+ Please introduce yourself and explain what you can do right now
141
+ ```
142
+
143
+ If the first message does not succeed, start from [Deployment and operations](https://github.com/oyasmi/pipiclaw/blob/main/docs/deployment-and-operations.md).
144
+
145
+ ### 4. Enable external agent delegation
146
+
147
+ First install and log in to the target CLI under the same account that runs Pipiclaw, then copy the roles you need. The example below enables both a Claude Code builder and a Codex reviewer:
148
+
149
+ ```bash
150
+ mkdir -p ~/.pipiclaw/workspace/sub-agents
151
+ PIPICLAW_PACKAGE_DIR="$(npm root -g)/@oyasmi/pipiclaw"
152
+ cp "$PIPICLAW_PACKAGE_DIR"/examples/sub-agents/{builder,reviewer}.md \
153
+ ~/.pipiclaw/workspace/sub-agents/
154
+ ```
155
+
156
+ Role file changes are rediscovered at runtime. Send:
157
+
158
+ ```text
159
+ /subagents roles
160
+ ```
161
+
162
+ Once the roles show as available, you can describe a goal and name a role directly:
163
+
164
+ ```text
165
+ Please hand this cross-module implementation to the builder, and once it's done have the reviewer check it independently.
166
+ ```
167
+
168
+ Common control entry points:
169
+
170
+ ```text
171
+ /subagents # running and recently completed delegations
172
+ /subagents show <runId> # status, actual argv, artifact directory, stderr
173
+ /subagents output <runId> # view text output
174
+ /subagents cancel <runId|all> # terminate directly, not through the model
175
+ /subagents roles [name] # view the role directory and a single role's config
176
+ ```
177
+
178
+ External agents do not go through Pipiclaw's command and path guards. Before using the example roles, read the authorization, security boundary, and sandbox notes in the [Agent delegation guide](https://github.com/oyasmi/pipiclaw/blob/main/docs/sub-agents.md).
179
+
180
+ Long-running external delegations should run in the DingTalk daemon; the TUI currently does not provide completion notifications for external runs or re-adoption after exit.
181
+
182
+ ### 5. Optional: enable web tools
183
+
184
+ `web_search` / `web_fetch` are off by default. Edit `~/.pipiclaw/tools.json`, set `tools.web.enable: true`, and configure a search provider. DuckDuckGo, Brave, Tavily, Jina, and SearXNG are supported; see [Configuration reference](https://github.com/oyasmi/pipiclaw/blob/main/docs/configuration.md) for the full fields.
185
+
186
+ <details>
187
+ <summary>Let your favorite AI agent install it for you</summary>
188
+
189
+ Hand the following request to Claude Code, Codex, or another local AI agent:
190
+
191
+ ```text
192
+ Please install and initialize Pipiclaw for me:
193
+
194
+ 1. Check Node.js >= 22.19.0; stop and explain if it is not met.
195
+ 2. Run npm install -g @oyasmi/pipiclaw; on a permission failure do not sudo on your own.
196
+ 3. Run pipiclaw once to initialize ~/.pipiclaw/; it prompting you to complete channel.json and exiting because it is still a template is normal.
197
+ 4. Ask me whether I want to use an API key, a custom provider, or a subscription login supported by pipiclaw auth login; do not invent missing values.
198
+ 5. If I want to connect DingTalk, collect clientId, clientSecret, optional cardTemplateId, and allowFrom item by item, write them into channel.json, and remove all your-* placeholder values.
199
+ 6. When configuration is done, ask first whether to start. Terminal mode uses pipiclaw tui; DingTalk mode uses pipiclaw.
200
+ 7. Honestly list the operations performed, files changed, verification results, and information still missing; do not pretend it succeeded.
201
+ ```
202
+
203
+ </details>
204
+
205
+ ## Common commands
206
+
207
+ | Command | Purpose |
208
+ |---|---|
209
+ | `/help` | Full command help for the current version |
210
+ | `/stop` | Stop the current turn; a task-driven turn also pauses its task |
211
+ | `/steer <message>` | Adjust the running turn |
212
+ | `/followup <message>` | Queue the next request |
213
+ | `/status` | Execution status, model, context, uptime, and version |
214
+ | `/usage [7d\|month]` | Model usage and cost for this channel and globally |
215
+ | `/tasks ...` | View, diagnose, and control long-running tasks |
216
+ | `/subagents ...` | View and control delegation runs and the role directory |
217
+ | `/memory ...` | View this channel's long-term memory |
218
+ | `/model [ref]` | View or switch the model |
219
+
220
+ `/help`, `/stop`, `/steer`, `/followup`, `/events`, `/tasks`, `/status`, `/usage`, `/context`, and `/subagents` are handled directly by the runtime and work mid-turn. `/stop` does not cancel an already dispatched delegation run; use `/subagents cancel`.
221
+
222
+ See [Interaction and commands](https://github.com/oyasmi/pipiclaw/blob/main/docs/interaction-and-commands.md) for full interaction details.
223
+
224
+ ## Documentation
225
+
226
+ The full index is at **[docs/README.md](https://github.com/oyasmi/pipiclaw/blob/main/docs/README.md)**. Good starting points:
227
+
228
+ | I want to understand | Doc |
229
+ |---|---|
230
+ | DingTalk, TUI, AI Card, and control commands | [Interaction and commands](https://github.com/oyasmi/pipiclaw/blob/main/docs/interaction-and-commands.md) |
231
+ | Claude Code / Codex / built-in sub-agent delegation | [Agent delegation](https://github.com/oyasmi/pipiclaw/blob/main/docs/sub-agents.md) |
232
+ | Configuring models, tools, and the workspace | [Configuration reference](https://github.com/oyasmi/pipiclaw/blob/main/docs/configuration.md) |
233
+ | Memory, scheduled events, and long-running tasks | [Memory](https://github.com/oyasmi/pipiclaw/blob/main/docs/memory.md) · [Events and tasks](https://github.com/oyasmi/pipiclaw/blob/main/docs/events-and-tasks.md) |
234
+ | Default security boundaries and external agent authorization | [Security guide](https://github.com/oyasmi/pipiclaw/blob/main/docs/security.md) |
235
+ | Deployment, upgrades, backup, and troubleshooting | [Deployment and operations](https://github.com/oyasmi/pipiclaw/blob/main/docs/deployment-and-operations.md) |
236
+ | The concurrency model and capacity limits for many groups and DMs | [Scaling and concurrency](https://github.com/oyasmi/pipiclaw/blob/main/docs/scaling-and-concurrency.md) |
237
+
238
+ ## Development
239
+
240
+ ```bash
241
+ npm install
242
+ npm run build
243
+ npm run check # lint + typecheck + deadcode + test
244
+ ```
245
+
246
+ Minimal verification: `npm run typecheck` and `npm run test`. Real-model E2E uses `npm run test:e2e` and is not part of the daily unit tests.
247
+
248
+ ## License
249
+
250
+ GNU Affero General Public License v3.0. See [LICENSE](./LICENSE).
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Pipiclaw
2
2
 
3
+ **简体中文** | [English](./README.en.md)
4
+
3
5
  **把钉钉变成一个能持续工作的 AI 工程入口。**
4
6
 
5
7
  Pipiclaw 是一个面向个人和团队的 AI coding assistant runtime。它让 AI 助手不只回答一轮问题,而是能留在你的钉钉里理解上下文、操作工作区、记住长期约定、按计划继续任务,还能把重活委派给 Claude Code、Codex CLI 或你自己的执行器。
@@ -45,7 +45,6 @@ export declare class ChannelRunner implements AgentRunner {
45
45
  private modelRegistry;
46
46
  private readonly memoryLifecycle;
47
47
  private readonly ledger;
48
- private readonly memoryCandidateStore;
49
48
  private readonly memoryActivityRecorder;
50
49
  private readonly sessionResourceGate;
51
50
  private readonly sessionReady;
@@ -72,6 +71,13 @@ export declare class ChannelRunner implements AgentRunner {
72
71
  private firstTurnMemoryBootstrapPending;
73
72
  /** Mirror of `tools.tasks.enabled` from the last tools-config load (see buildRuntimeTools). */
74
73
  private tasksEnabled;
74
+ /**
75
+ * Set while this runner is bound to a task's own session (spec 051, D3). Turns are serialized
76
+ * per channel, so one runner can carry both surfaces by swapping which session file it is
77
+ * bound to between turns — which keeps busy state, `/stop`, steering and turn recovery with
78
+ * their existing single owner instead of splitting them across two runner instances.
79
+ */
80
+ private taskLoop?;
75
81
  /** Single owner of turn state; see TurnPhase in types.ts and TurnStateMachine in turn-state.ts. */
76
82
  private readonly turnState;
77
83
  /** Set once transport-level `/new` replaces this generation. A retired runner is never reused. */
@@ -217,6 +223,9 @@ export declare class ChannelRunner implements AgentRunner {
217
223
  private reloadSessionResources;
218
224
  private bindSessionExtensions;
219
225
  private ensureSessionReady;
226
+ /** Spec 050 §5: migrate this channel's memory to v2 on first use, before any turn reads it. */
227
+ private memoryMigrationChecked;
228
+ private ensureMemoryMigrated;
220
229
  private maybeRunPreventiveCompactionForIncomingText;
221
230
  private refreshSubAgentDiscovery;
222
231
  private reportSettingsDiagnostics;
@@ -234,7 +243,17 @@ export declare class ChannelRunner implements AgentRunner {
234
243
  private buildSystemPrompt;
235
244
  private createResourceLoader;
236
245
  private createAgentSessionServices;
237
- private createEmptyExtensionsResult;
246
+ /**
247
+ * Load a freshly constructed ResourceLoader before an `AgentSession` is built on top of it.
248
+ *
249
+ * `AgentSession` reads `resourceLoader.getExtensions()` in its constructor, and a loader that
250
+ * has never been loaded answers with an *empty* set. Skipping this leaves a replacement session
251
+ * with no extensions at all — no command extension (so `/model`, `/thinking`, `/session`,
252
+ * `/compact` and `/memory` fall through to the model as plain text), no memory lifecycle, no
253
+ * prompt-boundary footer, and no prompt templates. Tolerated on failure the same way
254
+ * `reloadSessionResources` tolerates a stuck reload: a degraded session still answers chat.
255
+ */
256
+ private loadSessionResources;
238
257
  /**
239
258
  * Resolve the initial thinking level using the same precedence as pi's SDK:
240
259
  * session history, configured default, then medium. The effective value is
@@ -242,6 +261,23 @@ export declare class ChannelRunner implements AgentRunner {
242
261
  */
243
262
  private initializeThinkingLevel;
244
263
  private createSessionRuntime;
264
+ /**
265
+ * Bind this runner to a task cycle's own session (spec 051, D3/INV-5).
266
+ *
267
+ * Task work must not accumulate in the channel's chat transcript: the one real channel on the
268
+ * author's machine had grown to 7.4 MB and been compacted six times because chat and two daily
269
+ * tasks shared it, so every compaction damaged all three at once. Swapping the bound session
270
+ * per turn gives each cycle its own bounded context while leaving turn state, `/stop`, and
271
+ * delivery exactly where they already are.
272
+ */
273
+ bindTaskSession(taskId: string, cycleId: string): Promise<void>;
274
+ /** Return to the channel's chat session after a task step. Safe to call when already bound. */
275
+ bindChatSession(): Promise<void>;
276
+ /** Which task loop this runner is currently bound to, if any. */
277
+ getTaskLoop(): {
278
+ taskId: string;
279
+ cycleId: string;
280
+ } | undefined;
245
281
  private buildRuntimeTools;
246
282
  private rebuildSessionTools;
247
283
  /**
@@ -255,5 +291,10 @@ export declare class ChannelRunner implements AgentRunner {
255
291
  private subscribeToSessionEvents;
256
292
  /** Gated by the same master autonomy switch as the task_* tools and the TaskDriver. */
257
293
  private buildTaskDigestForTurn;
294
+ /**
295
+ * Spec 050, D1: assemble `<memory_bootstrap>` for the first turn of a session — workspace
296
+ * MEMORY.md (whole H2 sections, budgeted) + the channel index (full, or budget-tiered). The
297
+ * journal subsection is added in P2.
298
+ */
258
299
  private buildFirstTurnMemoryBootstrap;
259
300
  }