@oyasmi/pipiclaw 0.9.6-beta.1 → 0.9.6-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (306) hide show
  1. package/README.en.md +279 -215
  2. package/README.md +274 -213
  3. package/dist/agent/builtin-commands.d.ts +1 -1
  4. package/dist/agent/builtin-commands.js +1 -1
  5. package/dist/agent/channel-runner.d.ts +3 -2
  6. package/dist/agent/channel-runner.js +18 -27
  7. package/dist/agent/maintenance-context.js +22 -3
  8. package/dist/agent/prompt/builder.d.ts +1 -1
  9. package/dist/agent/prompt/builder.js +1 -1
  10. package/dist/agent/prompt/extension.d.ts +1 -1
  11. package/dist/agent/prompt/extension.js +1 -1
  12. package/dist/agent/prompt/manifest.d.ts +6 -1
  13. package/dist/agent/prompt/manifest.js +12 -5
  14. package/dist/agent/prompt/resources.d.ts +0 -3
  15. package/dist/agent/prompt/resources.js +0 -6
  16. package/dist/agent/prompt/sections.d.ts +2 -2
  17. package/dist/agent/prompt/sections.js +36 -26
  18. package/dist/agent/prompt/types.d.ts +1 -1
  19. package/dist/agent/runner-factory.js +1 -1
  20. package/dist/agent/session/command-extension.js +3 -1
  21. package/dist/agent/session/compaction-summary.js +3 -6
  22. package/dist/agent/session/event-guards.d.ts +2 -1
  23. package/dist/agent/session/event-guards.js +6 -0
  24. package/dist/agent/session/model-selection.d.ts +2 -1
  25. package/dist/agent/session/model-selection.js +5 -5
  26. package/dist/agent/session/session-events.js +31 -4
  27. package/dist/agent/session/session-host.d.ts +4 -2
  28. package/dist/agent/session/session-host.js +17 -15
  29. package/dist/agent/status-render.js +3 -0
  30. package/dist/agent/turn/task-digest.d.ts +2 -5
  31. package/dist/agent/turn/task-digest.js +25 -45
  32. package/dist/agent/turn/turn-context.js +14 -12
  33. package/dist/agent/turn/turn-error.d.ts +1 -1
  34. package/dist/agent/turn/turn-error.js +9 -0
  35. package/dist/agent/turn/turn-pipeline.d.ts +10 -5
  36. package/dist/agent/turn/turn-pipeline.js +36 -7
  37. package/dist/agent/turn/turn-prompt.d.ts +2 -0
  38. package/dist/agent/turn/turn-prompt.js +2 -1
  39. package/dist/agent/turn/turn-recovery.js +4 -1
  40. package/dist/agent/types.d.ts +20 -2
  41. package/dist/agent/types.js +2 -0
  42. package/dist/app/auth-command.d.ts +25 -0
  43. package/dist/app/auth-command.js +200 -67
  44. package/dist/app/home.d.ts +7 -8
  45. package/dist/app/home.js +143 -56
  46. package/dist/channel/channel-context.d.ts +6 -0
  47. package/dist/channel/config.d.ts +3 -0
  48. package/dist/channel/config.js +11 -5
  49. package/dist/commands/catalog.js +22 -6
  50. package/dist/config/settings.d.ts +0 -2
  51. package/dist/config/settings.js +0 -2
  52. package/dist/config/tools.d.ts +8 -2
  53. package/dist/config/tools.js +35 -19
  54. package/dist/desk/commands.d.ts +31 -4
  55. package/dist/desk/commands.js +101 -15
  56. package/dist/desk/paths.d.ts +6 -0
  57. package/dist/desk/paths.js +21 -1
  58. package/dist/desk/registry.d.ts +11 -0
  59. package/dist/desk/registry.js +53 -9
  60. package/dist/desk/types.d.ts +66 -1
  61. package/dist/dingtalk/config.js +10 -10
  62. package/dist/dingtalk/delivery.js +2 -0
  63. package/dist/dingtalk/inbound.js +2 -3
  64. package/dist/events/watcher.d.ts +1 -1
  65. package/dist/events/watcher.js +2 -2
  66. package/dist/main.js +15 -3
  67. package/dist/memory/anchors.d.ts +5 -0
  68. package/dist/memory/anchors.js +49 -0
  69. package/dist/memory/boundary-work.d.ts +3 -1
  70. package/dist/memory/boundary-work.js +2 -1
  71. package/dist/memory/commands.js +23 -6
  72. package/dist/memory/index-budget.d.ts +16 -0
  73. package/dist/memory/index-budget.js +24 -2
  74. package/dist/memory/journal.d.ts +7 -12
  75. package/dist/memory/journal.js +9 -41
  76. package/dist/memory/lifecycle.d.ts +3 -1
  77. package/dist/memory/lifecycle.js +4 -2
  78. package/dist/memory/reflect-job.d.ts +3 -1
  79. package/dist/memory/reflect-job.js +2 -1
  80. package/dist/memory/reflect.d.ts +12 -1
  81. package/dist/memory/reflect.js +104 -20
  82. package/dist/memory/render.d.ts +4 -1
  83. package/dist/memory/render.js +6 -4
  84. package/dist/memory/review-log.d.ts +2 -2
  85. package/dist/memory/scheduler.d.ts +9 -1
  86. package/dist/memory/scheduler.js +71 -4
  87. package/dist/memory/search-index-db.d.ts +15 -0
  88. package/dist/memory/search-index-db.js +247 -0
  89. package/dist/memory/search-index-files.d.ts +11 -0
  90. package/dist/memory/search-index-files.js +26 -0
  91. package/dist/memory/search-index-notes.d.ts +11 -0
  92. package/dist/memory/search-index-notes.js +155 -0
  93. package/dist/memory/search-index-sync.d.ts +19 -0
  94. package/dist/memory/search-index-sync.js +267 -0
  95. package/dist/memory/search-terms.d.ts +12 -0
  96. package/dist/memory/search-terms.js +185 -0
  97. package/dist/memory/search.d.ts +8 -28
  98. package/dist/memory/search.js +18 -278
  99. package/dist/memory/session-corpus.d.ts +15 -26
  100. package/dist/memory/session-corpus.js +120 -321
  101. package/dist/memory/session-search.d.ts +7 -4
  102. package/dist/memory/session-search.js +120 -172
  103. package/dist/memory/sidecar-worker.d.ts +4 -1
  104. package/dist/memory/sidecar-worker.js +27 -5
  105. package/dist/memory/store.d.ts +4 -0
  106. package/dist/memory/store.js +22 -1
  107. package/dist/memory/task-archive-digest.d.ts +61 -0
  108. package/dist/memory/task-archive-digest.js +366 -0
  109. package/dist/models/credential-work.d.ts +7 -0
  110. package/dist/models/credential-work.js +36 -0
  111. package/dist/models/login-ui.js +4 -4
  112. package/dist/models/provider-login.d.ts +1 -1
  113. package/dist/models/provider-login.js +8 -7
  114. package/dist/models/requests.d.ts +8 -0
  115. package/dist/models/requests.js +69 -0
  116. package/dist/models/runtime.d.ts +3 -1
  117. package/dist/models/runtime.js +9 -2
  118. package/dist/playbooks/agent-delegation.md +19 -45
  119. package/dist/playbooks/background-jobs.md +1 -1
  120. package/dist/playbooks/catalog.js +1 -1
  121. package/dist/playbooks/delegation-inline.md +25 -0
  122. package/dist/playbooks/delegation-recovery.md +28 -0
  123. package/dist/playbooks/event-scheduling.md +18 -37
  124. package/dist/playbooks/event-sensors.md +26 -0
  125. package/dist/playbooks/event-task-template.md +22 -0
  126. package/dist/playbooks/learning-and-skills.md +26 -0
  127. package/dist/playbooks/memory-operations.md +36 -0
  128. package/dist/playbooks/outbound-media.md +2 -2
  129. package/dist/playbooks/runtime-files.md +29 -0
  130. package/dist/playbooks/runtime-operations.md +25 -0
  131. package/dist/playbooks/runtime-orientation.md +18 -53
  132. package/dist/playbooks/task-lead.md +22 -68
  133. package/dist/playbooks/task-manage.md +38 -0
  134. package/dist/playbooks/task-recovery.md +24 -0
  135. package/dist/playbooks/task-verify.md +22 -0
  136. package/dist/runtime/bootstrap.d.ts +4 -0
  137. package/dist/runtime/bootstrap.js +82 -22
  138. package/dist/runtime/daemon-lock.js +3 -3
  139. package/dist/runtime/desk-runtime.d.ts +33 -6
  140. package/dist/runtime/desk-runtime.js +302 -47
  141. package/dist/runtime/ingress-commands.js +24 -4
  142. package/dist/runtime/shutdown.d.ts +3 -1
  143. package/dist/runtime/shutdown.js +1 -0
  144. package/dist/runtime/task-close.d.ts +1 -1
  145. package/dist/runtime/task-close.js +6 -3
  146. package/dist/runtime/task-control.d.ts +1 -3
  147. package/dist/runtime/task-control.js +15 -11
  148. package/dist/runtime/task-input.js +1 -1
  149. package/dist/runtime/task-lane-types.d.ts +12 -2
  150. package/dist/runtime/task-lane-types.js +9 -0
  151. package/dist/runtime/task-lane.d.ts +1 -0
  152. package/dist/runtime/task-lane.js +17 -14
  153. package/dist/runtime/task-step.d.ts +3 -3
  154. package/dist/runtime/task-step.js +23 -14
  155. package/dist/runtime/transports.js +6 -5
  156. package/dist/security/command-guard.js +23 -1
  157. package/dist/shared/text-utils.d.ts +0 -1
  158. package/dist/shared/text-utils.js +0 -1
  159. package/dist/subagents/commands.js +14 -5
  160. package/dist/subagents/completion-wake.js +6 -0
  161. package/dist/subagents/dispatch.js +20 -18
  162. package/dist/subagents/external/dispatch.js +20 -14
  163. package/dist/subagents/external/run.js +10 -20
  164. package/dist/subagents/external/settlement.js +5 -1
  165. package/dist/subagents/internal/outcome.js +19 -12
  166. package/dist/subagents/internal/provider-retry.js +1 -3
  167. package/dist/subagents/internal/run.d.ts +1 -1
  168. package/dist/subagents/internal/run.js +27 -4
  169. package/dist/subagents/internal/state.d.ts +1 -3
  170. package/dist/subagents/internal/state.js +1 -2
  171. package/dist/subagents/internal/worker.js +17 -9
  172. package/dist/subagents/result.d.ts +5 -2
  173. package/dist/subagents/result.js +35 -6
  174. package/dist/subagents/run-record.d.ts +21 -0
  175. package/dist/subagents/run-record.js +5 -0
  176. package/dist/subagents/runs.d.ts +5 -8
  177. package/dist/subagents/runs.js +24 -35
  178. package/dist/subagents/task-envelope.js +11 -8
  179. package/dist/subagents/task-settlement.js +1 -0
  180. package/dist/subagents/types.d.ts +14 -4
  181. package/dist/subagents/workspace-lease.d.ts +37 -10
  182. package/dist/subagents/workspace-lease.js +121 -13
  183. package/dist/subagents/worktree.d.ts +47 -5
  184. package/dist/subagents/worktree.js +316 -30
  185. package/dist/tasks/brief.d.ts +5 -1
  186. package/dist/tasks/brief.js +19 -5
  187. package/dist/tasks/commands.d.ts +3 -1
  188. package/dist/tasks/commands.js +17 -6
  189. package/dist/tasks/control.d.ts +9 -0
  190. package/dist/tasks/loop-log.d.ts +10 -0
  191. package/dist/tasks/loop-log.js +1 -1
  192. package/dist/tasks/receipts.d.ts +7 -3
  193. package/dist/tasks/receipts.js +34 -5
  194. package/dist/tools/bash.d.ts +3 -0
  195. package/dist/tools/bash.js +27 -15
  196. package/dist/tools/contract/presentation.js +4 -1
  197. package/dist/tools/edit-diff.d.ts +11 -0
  198. package/dist/tools/edit-diff.js +148 -0
  199. package/dist/tools/edit-match.d.ts +18 -0
  200. package/dist/tools/edit-match.js +242 -0
  201. package/dist/tools/edit.d.ts +10 -2
  202. package/dist/tools/edit.js +91 -361
  203. package/dist/tools/event-manage.d.ts +1 -2
  204. package/dist/tools/event-manage.js +27 -38
  205. package/dist/tools/file-observations.d.ts +9 -0
  206. package/dist/tools/file-observations.js +50 -0
  207. package/dist/tools/glob-match.d.ts +3 -1
  208. package/dist/tools/glob-match.js +40 -17
  209. package/dist/tools/glob.d.ts +1 -0
  210. package/dist/tools/glob.js +39 -19
  211. package/dist/tools/grep-command.d.ts +13 -0
  212. package/dist/tools/grep-command.js +77 -0
  213. package/dist/tools/grep.js +96 -201
  214. package/dist/tools/index.d.ts +4 -1
  215. package/dist/tools/index.js +7 -4
  216. package/dist/tools/job.js +12 -11
  217. package/dist/tools/memory-manage.d.ts +1 -0
  218. package/dist/tools/memory-manage.js +9 -23
  219. package/dist/tools/read.d.ts +2 -0
  220. package/dist/tools/read.js +10 -2
  221. package/dist/tools/registry.d.ts +16 -11
  222. package/dist/tools/registry.js +31 -11
  223. package/dist/tools/session-search.d.ts +3 -1
  224. package/dist/tools/session-search.js +24 -8
  225. package/dist/tools/skill.js +13 -12
  226. package/dist/tools/subagent-manage.js +10 -3
  227. package/dist/tools/subagent.d.ts +22 -2
  228. package/dist/tools/subagent.js +19 -18
  229. package/dist/tools/task-manage/control-tools.js +1 -1
  230. package/dist/tools/task-manage/factory.d.ts +2 -2
  231. package/dist/tools/task-manage/factory.js +39 -3
  232. package/dist/tools/task-manage/lifecycle.d.ts +2 -2
  233. package/dist/tools/task-manage/lifecycle.js +7 -4
  234. package/dist/tools/task-manage/shared.d.ts +1 -1
  235. package/dist/tools/task-manage/types.d.ts +1 -0
  236. package/dist/tools/web-search.d.ts +13 -7
  237. package/dist/tools/web-search.js +62 -19
  238. package/dist/tools/write-content.d.ts +7 -1
  239. package/dist/tools/write-content.js +18 -6
  240. package/dist/tools/write.d.ts +3 -0
  241. package/dist/tools/write.js +6 -2
  242. package/dist/tui/cli.d.ts +5 -0
  243. package/dist/tui/cli.js +97 -31
  244. package/dist/tui/client.d.ts +5 -0
  245. package/dist/tui/client.js +63 -21
  246. package/dist/tui/frontend.d.ts +2 -0
  247. package/dist/tui/pitui-frontend.d.ts +4 -0
  248. package/dist/tui/pitui-frontend.js +27 -0
  249. package/dist/tui/render.d.ts +1 -0
  250. package/dist/tui/render.js +5 -0
  251. package/dist/tui/session.js +6 -0
  252. package/dist/web/client.d.ts +3 -0
  253. package/dist/web/client.js +18 -3
  254. package/dist/web/config.d.ts +17 -4
  255. package/dist/web/config.js +42 -4
  256. package/dist/web/fetch.js +6 -3
  257. package/dist/web/format.d.ts +2 -1
  258. package/dist/web/format.js +7 -3
  259. package/dist/web/search-providers.d.ts +15 -8
  260. package/dist/web/search-providers.js +208 -139
  261. package/dist/web/search.d.ts +13 -3
  262. package/dist/web/search.js +86 -40
  263. package/dist/webapi/auth.d.ts +0 -3
  264. package/dist/webapi/auth.js +3 -7
  265. package/dist/webapi/config.js +17 -14
  266. package/dist/webapi/key-command.js +41 -41
  267. package/dist/webapi/response-state.d.ts +7 -1
  268. package/dist/webapi/response-state.js +166 -3
  269. package/dist/webapi/routes/websocket.js +24 -1
  270. package/dist/webapi/server.d.ts +3 -1
  271. package/dist/webapi/server.js +32 -1
  272. package/dist/webapi/service.js +8 -0
  273. package/dist/webapi/transport.d.ts +2 -0
  274. package/dist/webapi/transport.js +11 -1
  275. package/examples/sub-agents/README.md +9 -7
  276. package/examples/sub-agents/agy-main.md +21 -0
  277. package/examples/sub-agents/claude-high.md +21 -0
  278. package/examples/sub-agents/claude-main.md +21 -0
  279. package/examples/sub-agents/codex-flash.md +21 -0
  280. package/examples/sub-agents/codex-high.md +21 -0
  281. package/examples/sub-agents/codex-main.md +21 -0
  282. package/examples/sub-agents/codex-review.md +20 -0
  283. package/examples/sub-agents/cursor-high.md +20 -0
  284. package/examples/sub-agents/cursor-main.md +20 -0
  285. package/examples/sub-agents/glm-flash.md +21 -0
  286. package/examples/sub-agents/glm-high.md +21 -0
  287. package/examples/sub-agents/pi-scout.md +20 -0
  288. package/package.json +8 -9
  289. package/dist/agent/session/request-tools.d.ts +0 -3
  290. package/dist/agent/session/request-tools.js +0 -20
  291. package/dist/memory/chinese-words.d.ts +0 -1
  292. package/dist/memory/chinese-words.js +0 -273
  293. package/dist/models/api-keys.d.ts +0 -11
  294. package/dist/models/api-keys.js +0 -22
  295. package/dist/playbooks/memory-and-learning.md +0 -55
  296. package/examples/sub-agents/agents/agy-main.md +0 -23
  297. package/examples/sub-agents/agents/claude-high.md +0 -23
  298. package/examples/sub-agents/agents/claude-main.md +0 -23
  299. package/examples/sub-agents/agents/codex-flash.md +0 -23
  300. package/examples/sub-agents/agents/codex-high.md +0 -23
  301. package/examples/sub-agents/agents/codex-main.md +0 -23
  302. package/examples/sub-agents/agents/codex-review.md +0 -23
  303. package/examples/sub-agents/agents/cursor-high.md +0 -22
  304. package/examples/sub-agents/agents/cursor-main.md +0 -22
  305. package/examples/sub-agents/agents/glm-flash.md +0 -23
  306. package/examples/sub-agents/agents/glm-high.md +0 -23
package/README.en.md CHANGED
@@ -1,345 +1,409 @@
1
+ <div align="center">
2
+
1
3
  # Pipiclaw
2
4
 
3
- <p align="left">
4
- <a href="./README.md">简体中文</a> | <strong>English</strong>
5
- </p>
5
+ **Your Always-On Personal AI Engineering Assistant in DingTalk & the Terminal**
6
6
 
7
- <p align="left">
8
- <a href="https://www.npmjs.com/package/@oyasmi/pipiclaw"><img src="https://img.shields.io/npm/v/@oyasmi/pipiclaw?color=blue&label=npm" alt="npm version"></a>
9
- <img src="https://img.shields.io/badge/node-%3E%3D22.19.0-brightgreen" alt="Node.js >= 22.19.0">
10
- <img src="https://img.shields.io/badge/platform-Linux%20%7C%20macOS%20%7C%20WSL2-lightgrey" alt="Platform">
11
- <a href="./LICENSE"><img src="https://img.shields.io/badge/license-AGPL--3.0-orange" alt="License: AGPL v3"></a>
7
+ Hand off a goal from your phone — Pipiclaw remembers your project conventions, orchestrates your models and coding agents in the background, and comes back with verified deliverables.
8
+
9
+ <p>
10
+ <a href="./README.md">简体中文</a> · <strong>English</strong> · <a href="https://github.com/oyasmi/pipiclaw/blob/master/docs/README.md">Documentation</a>
12
11
  </p>
13
12
 
14
- > **Turn DingTalk and your terminal into an always-on AI engineering workbench — assign a goal, close your laptop, and let it progress in the background across your models and coding agents, returning verified deliverables.**
13
+ <p>
14
+ <a href="https://www.npmjs.com/package/@oyasmi/pipiclaw"><img src="https://img.shields.io/npm/v/@oyasmi/pipiclaw?color=2563eb&label=npm" alt="npm version"></a>
15
+ <a href="https://github.com/oyasmi/pipiclaw/actions/workflows/ci.yml"><img src="https://github.com/oyasmi/pipiclaw/actions/workflows/ci.yml/badge.svg?branch=master" alt="CI status"></a>
16
+ <img src="https://img.shields.io/badge/node-%3E%3D22.19.0-16a34a" alt="Node.js >= 22.19.0">
17
+ <img src="https://img.shields.io/badge/platform-Linux%20%7C%20macOS%20%7C%20WSL2-64748b" alt="Platform">
18
+ <a href="./LICENSE"><img src="https://img.shields.io/badge/license-AGPL--3.0-ea580c" alt="License: AGPL v3"></a>
19
+ </p>
15
20
 
16
- **Pipiclaw** is a DingTalk-first AI coding assistant runtime for individual developers. Assign a goal from DingTalk, the terminal, or your own scripts, keep its working context intact, and let it advance long-running work in the background while delegating to your existing models, **Claude Code**, **Codex CLI**, **Cursor CLI**, **Antigravity CLI**, or custom executors. Follow progress, steer mid-turn, pause or take over at any moment, and receive deliverables backed by verification evidence.
21
+ **[Why Pipiclaw](#why-pipiclaw) · [In Action](#see-it-in-action) · [Quick Start](#quick-start) · [Core Capabilities](#core-capabilities) · [Slash Commands](#common-commands) · [FAQ](#faq) · [Docs](#documentation)**
17
22
 
18
- **[Key Highlights](#key-highlights) · [How It Works](#how-it-works) · [Use Cases](#use-cases) · [Quick Start](#quick-start) · [Common Commands](#common-commands) · [Documentation](#documentation)**
23
+ </div>
19
24
 
20
25
  ---
21
26
 
22
- ## Key Highlights
23
-
24
- ### 🚀 1. Work Keeps Moving When You Walk Away: Task Lane & Scheduled Events
25
-
26
- Traditional CLI coding agents stop the moment you close the terminal or end a chat. Pipiclaw decouples long-horizon engineering work from ephemeral conversations:
27
-
28
- - **Background Task Lane**: Multi-step, multi-hour projects advance in a dedicated background task lane **without blocking your chat**. Each task is backed by a human-readable Markdown **task spec** (goal, Definition of Done checklist, **work items**) and an append-only JSONL **task log** (steps, delegations, settlements). Task states are derived deterministically by the runtime from observed facts — never stuck in a hallucinated "waiting" state.
29
- - **Scheduled Events & Zero-Token Sensors**: Trigger `one-shot` reminders or `periodic` (Cron) workflows. Run local `preAction` gate scripts as **zero-token conditional sensors**, or spawn fresh, isolated task instances from event templates (e.g., daily repo inspections or weekly release digests) with automatic overlap protection.
30
- - **Deterministic Budgets & Circuit Breakers**: Built-in step and USD budgets, idle-loop detection, per-step timeouts, and consecutive-error guards pause runaway work automatically and notify you.
27
+ ## Why Pipiclaw
31
28
 
32
- ### 🤝 2. One Workflow Orchestrating All Your Top Coding Agents
29
+ Even if you already pay for **Claude Code**, **Codex CLI**, **Cursor**, and top LLM APIs, three everyday friction points slow down real engineering work:
33
30
 
34
- Stop copy-pasting context across multiple terminal tabs. Pipiclaw lets your main assistant act as the lead, dispatching work to the right executor based on capability, cost, and execution boundaries:
31
+ 1. **Work stops when you step away**: Terminal coding agents are tied to an open window — step out for a meeting or commute, and you lose visibility and momentum.
32
+ 2. **Copy-pasting across isolated tools**: You triage logs in one tab, implement in Claude Code, and run a review in Codex — acting as the human glue copying context back and forth.
33
+ 3. **Repeating project context every session**: Every fresh chat forgets your repo layout, deployment rules, and personal conventions unless you repeat them.
35
34
 
36
- - **Built-in Sub-Agents (`internal`)**: Spin up isolated in-process agents in milliseconds under Pipiclaw's security guards for fast retrieval, log triage, and focused analysis.
37
- - **Heavyweight External Harnesses (`external`)**: Launch real **Claude Code**, **Codex CLI**, **Cursor CLI**, **Antigravity CLI (`agy`)**, GLM wrapper scripts, or custom shell commands to tackle multi-file implementations, write and run tests, and iterate autonomously.
38
- - **Async Wakeup, Session Continuation & Independent Verification**: External runs execute in the background (with records and managed artifacts retained for 30 days) and automatically wake the originating channel upon completion. You can ask follow-up questions on finished external sessions, or dispatch CLI-enforced read-only agents (such as `codex-review`) for independent verification (`purpose: verify`).
35
+ **Pipiclaw turns your existing models and coding CLIs into one cohesive, always-reachable assistant.** Running on your dev machine or server, it connects directly to **DingTalk** (with zero public IP setup), an interactive **Terminal UI**, and an **OpenAI-compatible Web API** — remembering your conventions, advancing long tasks in the background, and delivering verified results wherever you are.
39
36
 
40
- ### 💬 3. Native in DingTalk + Terminal TUI + OpenAI-Compatible Web API
41
-
42
- - **Zero Public IP DingTalk Setup**: Built on **DingTalk Stream Mode** — connect directly from your laptop or private server without hosting webhook relays or exposing public ports.
43
- - **Live AI Card Streaming**: Watch thinking steps, tool calls, and stage updates stream live in DingTalk AI Cards. Send a message mid-turn to adjust direction on the fly (`/steer`), queue the next request (`/followup`), or abort immediately (`/stop`). Deliver generated reports, screenshots, and exports as **native DingTalk attachments**.
44
- - **One Assistant, Every Surface**: A single daemon serves multiple DMs and group chats concurrently (parallel across channels, serialized within each channel). The terminal UI (`pipiclaw tui`) and your own scripts connect to the exact same assistant over a local Unix socket or TCP **Web API** compatible with the official **OpenAI SDK (implemented Responses API subset)**.
45
-
46
- ### 🧠 4. Remembers Conventions, Respects Boundaries: Layered Memory & Desks
47
-
48
- - **Shared by Default, Isolated on Demand**: Your terminal, DingTalk DMs, and group chats bind to the `default` desk out of the box — sharing long-term memory, daily journals, tasks, and working files with zero setup. When you want to separate projects or contexts, create an isolated desk with `/desk new <name>`.
49
- - **Three-Layer Transparent Memory (No Keyword Guessing)**:
50
- - **Desk Memory (`memory/*.md`)**: One durable fact per file with an auto-generated `MEMORY.md` index injected in full at session start — the model sees all your conventions up front without fragile RAG keyword matching.
51
- - **Daily Journal (`journal/YYYY-MM-DD.md`)**: Day-by-day working notes written by the background reflect pass, keeping temporary progress out of permanent rules.
52
- - **Automatic Reflection & Probation**: Automatically consolidates memory before context compaction, on `/new`, on shutdown, or during idle windows. Newly inferred facts enter a 30-day **probation period** before promotion; `/memory forget` leaves a hash tombstone so background reflection never resurrects forgotten items. Idle checks pass through a local deterministic gate first — **burning zero tokens when idle**.
53
-
54
- ### 🛡️ 5. Autonomous Yet Instantly Interruptible: Deterministic Control Plane & Local Ownership
55
-
56
- - **LLM-Free Control Plane**: `/help`, `/stop`, `/steer`, `/followup`, `/tasks`, `/subagents`, `/events`, `/desk`, `/status`, `/usage`, and `/context` are handled directly by the runtime. **Even if a model provider is down or a turn is stuck**, you can still inspect state, pause tasks, or kill external processes (`/subagents cancel`) immediately.
57
- - **Your Config, Your Plain-Text Data**: Works with built-in providers, OpenAI-compatible gateways, API keys, and subscription logins (`pipiclaw auth login`). Every memory, task, role, event, and audit log lives as human-readable Markdown, JSON, or JSONL under `~/.pipiclaw/`, protected by command, path, and network guards.
37
+ | What You Care About | Typical Chatbots | Standalone Coding CLIs | **Pipiclaw** |
38
+ |---|---|---|---|
39
+ | **Reachable Anywhere** | Mobile-friendly, but blind to your local repo & tools | Full local power, but chained to your laptop screen | **DingTalk DM/Group + Terminal + OpenAI SDK on one brain** |
40
+ | **Multi-Hour Work** | Times out after one reply | Blocks your terminal; dies if disconnected | **Dedicated background tasks that run without blocking chat** |
41
+ | **Multi-Agent Synergy** | Locked to a single model | Separate tabs & manual context handoffs | **Orchestrates built-in models + Claude / Codex / Cursor / Antigravity** |
42
+ | **Persistent Memory** | Ephemeral chats or brittle keyword search | Static rule files only | **Auto-curated long-term memory + daily journals you can inspect or delete** |
43
+ | **Instant Human Control** | Wait until generation finishes | `Ctrl-C` at your keyboard | **Instant `/stop`, mid-turn `/steer`, task pause, or process kill from phone/CLI** |
58
44
 
59
45
  ---
60
46
 
61
- ## How It Works
47
+ ## See It in Action
62
48
 
63
- ```mermaid
64
- flowchart LR
65
- subgraph Entries["Entry Surfaces (Channels)"]
66
- DT["📱 DingTalk DM / Group<br/>(Stream Mode + AI Card)"]
67
- TUI["💻 Terminal UI<br/>(pipiclaw tui)"]
68
- API["🔌 Scripts & Clients<br/>(OpenAI SDK / Web API)"]
69
- end
70
-
71
- subgraph Runtime["Pipiclaw Runtime (Daemon)"]
72
- CP["⚡ Deterministic Control Plane<br/>(/stop /steer /tasks /subagents ...)"]
73
- CR["🧭 Channel Runner & Session Host<br/>(Serial per channel · Parallel across channels)"]
74
- TL["🛤️ Background Task Lane<br/>(Independent execution · Budget & timeout guards)"]
75
- EV["⏰ Scheduled Events & Sensors<br/>(Cron / One-shot / preAction)"]
76
- end
77
-
78
- subgraph Desk["Desk Context (default / custom)"]
79
- MEM["🧠 Layered Memory & Journal<br/>(memory/*.md · journal/)"]
80
- TSK["📋 Task Specs & Logs<br/>(tasks/<id>.md · <id>.jsonl)"]
81
- end
82
-
83
- subgraph Executors["Executors & Guards"]
84
- INT["🔍 Built-in Tools & Internal Sub-Agents<br/>(Command / Path / Network Guards)"]
85
- EXT["🛠️ External Coding Agents<br/>Claude Code · Codex · Cursor · Antigravity"]
86
- end
49
+ Here is what a typical workflow looks like once Pipiclaw is running on your workstation:
87
50
 
88
- DT & TUI & API --> CP & CR
89
- EV -->|Wake / Spawn task instance| CR & TL
90
- CR <--> Desk
91
- TL <--> Desk
92
- CR & TL --> INT & EXT
51
+ ```text
52
+ 09:15 [On your commute · DingTalk DM]
53
+ You ──▶ "Switch the user export endpoint to streaming, add large-file unit tests, and have
54
+ codex-review independently check the diff before sending me the result."
55
+
56
+ 09:16 [Background task starts · Chat stays free]
57
+ Bot ──▶ Creates a background task, breaks down work items, and launches local claude-main
58
+ to implement and run tests.
59
+ (Meanwhile, you can keep chatting in the exact same window about other issues.)
60
+
61
+ 09:32 [Steer anytime]
62
+ You ──▶ Check progress with "/tasks", then send:
63
+ "/tasks msg export-stream Make sure CSV exports preserve UTF-8 BOM compatibility"
64
+
65
+ 09:48 [Independent verification & mobile delivery]
66
+ Bot ──▶ claude-main passes tests → dispatches read-only codex-review to audit the diff →
67
+ pushes a clean summary, test proof, and benchmark CSV straight to your DingTalk app.
93
68
  ```
94
69
 
95
- ### Core Concepts at a Glance
96
-
97
- | Concept | What It Is | Problem It Solves |
98
- |---|---|---|
99
- | **Channel** | A DingTalk DM, DingTalk group, or Web API / TUI conversation | Keeps each conversation history separate while acting as your remote control to assign, inspect, and steer work |
100
- | **Desk** | A named work context (`default` built-in, custom desks on demand) | Owns the long-term memory, daily journal, tasks, scheduled events, and working directory for a body of work |
101
- | **Task** | A one-off project running in the background task lane (`.md` spec + `.jsonl` log) | Advances multi-step, multi-hour deliverables independently of chat and survives restarts |
102
- | **Event** | A `one-shot` or `periodic` (Cron) trigger with optional `preAction` or task template | Answers *"when to wake up"* — driving reminders, zero-token checks, and recurring task instances |
103
- | **Sub-Agent** | An in-process lightweight role (`internal`) or external CLI process (`external`) | Answers *"who executes this step"* — uniting your subscriptions and external coding CLIs under one workflow |
104
-
105
- ---
106
-
107
- ## Use Cases
108
-
109
- - **📱 Mobile Engineering Workbench**: Assign *"migrate this module to the new interface and add unit tests"* from DingTalk on your commute; the background task breaks down work items, dispatches Claude Code / Codex to implement and run tests, runs an independent `codex-review` check on the diff, and delivers the summary with test evidence to your phone.
110
- - **⏰ Low-Noise Scheduled Inspections & Reports**: Set up daily or weekly event templates that run a local `preAction` script first, spawning a background task to investigate and deliver a DingTalk report only when new commits or anomalies appear.
111
- - **🔀 Multi-Model & Multi-Agent Compute Routing**: Use fast or cost-effective models for everyday chat, route tough architectural trade-offs and root-cause debugging to `claude-high` / `codex-high` / `cursor-high`, batch mechanical edits with `codex-flash` / `glm-flash`, and leverage `agy-main` for long-context collaboration.
112
- - **🤝 Multi-Surface Personal & Small-Team Collaboration**: Keep separate conversations across DMs and group chats while sharing one body of project memory by default — or split contexts cleanly with desks when needed.
113
- - **🔌 Scriptable Personal Assistant via Official OpenAI SDK**: Enable the Web API and connect CI hooks, local scripts, or custom frontends to your assistant in a few lines of Python or JS.
70
+ What else users build into their daily routine:
114
71
 
115
- > [!NOTE]
116
- > **Scope & Security Boundaries**: Pipiclaw is designed for individual developers (and small-scale shared use of a single assistant) in self-hosted, single-instance deployments. It is not a hard multi-tenant SaaS platform and does not provide an OS-level sandbox. **External agents bypass Pipiclaw's built-in command and path guards** — their real permissions are governed by the target CLI's sandbox flags, the host user account, and the operating environment.
72
+ - **⏰ Zero-Noise Scheduled Inspections**: Run Cron events with a local gate script first — **burning zero tokens when nothing changed**, and spinning up an investigation task only when new commits or error spikes appear.
73
+ - **🔀 Smart Compute Routing Across Subscriptions**: Use fast, affordable models for quick Q&A; route thorny architecture or root-cause debugging to `claude-high` / `codex-high` / `cursor-high`; batch mechanical edits with `codex-flash` / `glm-flash`; hand long-context collaboration to `agy-main`.
74
+ - **🗂️ Clean Context Separation When Needed**: Share one memory across DMs, groups, and terminal by default — or spin up isolated **Desks** (`/desk new side-project`) for separate repos and initiatives.
75
+ - **🔌 Drop-In Automation with Official OpenAI SDKs**: Flip on the built-in Web API and call your assistant from Python, Node.js, or CI scripts in five lines of code.
117
76
 
118
77
  ---
119
78
 
120
79
  ## Quick Start
121
80
 
122
- Follow the steps below to go from **installation → 30-second terminal verification → DingTalk connection → external coding agent delegation**. Jump straight to any section if you already know what you need.
81
+ Go from zero to an always-on setup in minutes: **60-second terminal run → 5-minute DingTalk connection → external coding agents → 24/7 background service**. *(For a detailed step-by-step onboarding walkthrough including OpenAI-compatible gateway snippets, `curl` checks, and DingTalk setup troubleshooting, see **[docs/quickstart.md](https://github.com/oyasmi/pipiclaw/blob/master/docs/quickstart.md)**.)*
123
82
 
124
83
  <details>
125
- <summary>💡 <b>Shortcut: Let your favorite local AI Agent (Claude Code / Codex / Cursor) install and configure Pipiclaw for you</b></summary>
126
-
127
- Copy and paste the prompt below into your local AI coding agent:
84
+ <summary>💡 <b>Shortcut: Paste this prompt into Claude Code / Codex / Cursor and let it set up Pipiclaw for you</b></summary>
128
85
 
129
86
  ```text
130
87
  Please install and initialize Pipiclaw for me:
131
88
 
132
89
  1. Check Node.js >= 22.19.0; stop and explain if it is not met.
133
90
  2. Run npm install -g @oyasmi/pipiclaw; on a permission failure do not sudo on your own.
134
- 3. Run pipiclaw once to initialize ~/.pipiclaw/; it prompting you to complete channel.json and exiting because it is still a template is normal.
135
- 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.
136
- 5. If I want to connect DingTalk, collect clientId, clientSecret, optional cardTemplateId, and allowFrom item by item, write them into the `dingtalk` section of channel.json, and remove all your-* placeholder values.
137
- 6. When configuration is done, ask first whether to start. Terminal mode uses pipiclaw tui; DingTalk mode uses pipiclaw, and after it starts message the bot directly or @ it in a group — no desk needs to be created or bound.
91
+ 3. Run `pipiclaw auth status` once to initialize ~/.pipiclaw/, and share the generated initial Web API key (`pk_...`) printed on stdout with me.
92
+ 4. Ask me whether I want to use an environment API key, a custom provider in ~/.pipiclaw/models.json, or run `pipiclaw auth login` myself; do not invent missing values.
93
+ 5. If I want to connect DingTalk, collect clientId, clientSecret, optional cardTemplateId, and allowFrom item by item, write them into the dingtalk section of channel.json, and set dingtalk.enabled to true.
94
+ 6. When configuration is done, ask first whether to start. Terminal mode uses `pipiclaw tui` (or `pipiclaw tui --cwd .` inside a repo); background daemon mode uses `pipiclaw` (local Web API socket + http://127.0.0.1:8787/v1 are enabled out of the box).
138
95
  7. Honestly list the operations performed, files changed, verification results, and information still missing; do not pretend it succeeded.
139
96
  ```
140
97
 
141
98
  </details>
142
99
 
143
- ### 1. Prerequisites & Installation
100
+ ### Step 1: Install & Run Out of the Box (No DingTalk Setup Needed)
144
101
 
145
- - **Node.js**: `>= 22.19.0`
146
- - **OS**: Linux / macOS (on Windows, use WSL2)
102
+ Prerequisites: **Node.js `>= 22.19.0`** on **Linux / macOS** (on Windows, use **WSL2**).
147
103
 
148
104
  ```bash
149
105
  npm install -g @oyasmi/pipiclaw
150
- pipiclaw tui --help
151
106
  ```
152
107
 
153
- The first real launch of `pipiclaw` or `pipiclaw tui` scaffolds `~/.pipiclaw/` (set `PIPICLAW_HOME=/your/path` to relocate the entire directory):
108
+ On first run, Pipiclaw automatically initializes `~/.pipiclaw/`, **enables the local Web API (`socket` + `http://127.0.0.1:8787/v1`) with a generated default key (`pk_...`)**, and prompts you to log in if no model credential is configured yet.
154
109
 
155
- ```text
156
- ~/.pipiclaw/
157
- ├── channel.json # Channel switches & config: DingTalk app (dingtalk), Web API (webapi)
158
- ├── auth.json # Model credentials & login state
159
- ├── models.json # Custom model providers & gateways
160
- ├── settings.json # Default model & runtime settings
161
- ├── tools.json # Capability switches for web search/fetch, tasks, etc.
162
- ├── security.json # Command, path, and network guard policies
163
- └── workspace/ # Shared rules (AGENTS.md / SOUL.md), skills/, sub-agents/, and desk-default/
164
- ```
165
-
166
- ### 2. Fastest Taste: Run in the Terminal in 30 Seconds
167
-
168
- Terminal mode requires no DingTalk credentials — just a working model. Configure credentials using either option:
110
+ You can also configure a model beforehand (pick either):
169
111
 
170
112
  ```bash
171
- # Option A: Provide an API key via environment variable
172
- export ANTHROPIC_API_KEY=sk-ant-...
173
-
174
- # Option B: Log in to a subscription provider supported by the SDK
113
+ # Option A: Interactive login for supported subscription / API-key providers
175
114
  pipiclaw auth login
115
+
116
+ # Option B: Export an API key (Anthropic shown as example)
117
+ export ANTHROPIC_API_KEY=sk-ant-...
176
118
  ```
177
119
 
178
- Launch the interactive terminal UI (initializes the `default` desk automatically on first run):
120
+ Launch the interactive terminal UI (pass `--cwd .` inside a repository to bind the desk's working directory):
179
121
 
180
122
  ```bash
181
123
  pipiclaw tui
182
124
  ```
183
125
 
184
- Or run a one-shot non-interactive verification:
126
+ Or start the background daemon directly (both `pipiclaw tui` and OpenAI SDK clients connect right away):
185
127
 
186
128
  ```bash
187
- pipiclaw tui --print "Reply with only: Pipiclaw model call succeeded"
129
+ pipiclaw
188
130
  ```
189
131
 
190
- > Receiving an actual model reply confirms the full request pipeline is working (`--help` and `/model` only verify CLI or catalog visibility). To configure an enterprise gateway, local model, or default model, see the [Configuration Reference](https://github.com/oyasmi/pipiclaw/blob/main/docs/configuration.md).
132
+ Or run a quick one-liner to verify the end-to-end model connection:
133
+
134
+ ```bash
135
+ pipiclaw tui --print "Reply with only: Pipiclaw is ready"
136
+ ```
191
137
 
192
- ### 3. Connect DingTalk (No Public IP Required)
138
+ > Using an OpenAI-compatible proxy/gateway, DeepSeek, GLM, or local Ollama? Copy the built-in `_examples` block in `~/.pipiclaw/models.json`, or check the [Configuration Quickstart](https://github.com/oyasmi/pipiclaw/blob/master/docs/configuration.md).
193
139
 
194
- Create an enterprise internal application on the [DingTalk Open Platform](https://open-dev.dingtalk.com/):
140
+ ### Step 2: Connect DingTalk When Needed (No Public IP Required)
195
141
 
196
- 1. Copy the **`Client ID`** and **`Client Secret`**
197
- 2. Enable the **Bot** capability
198
- 3. Select **Stream Mode** for message receiving
199
- 4. *(Recommended)* Create an AI Card template and copy its **`Card Template ID`** for live streaming updates
142
+ Pipiclaw uses **DingTalk Stream Mode**, so any laptop or private server with outbound internet access connects directly — no public IP, domain name, or webhook relay required:
200
143
 
201
- Edit `~/.pipiclaw/channel.json` (make sure no `your-*` placeholder values remain):
144
+ 1. Create an **Enterprise Internal App** on the [DingTalk Open Platform](https://open-dev.dingtalk.com/) and copy its **`Client ID`** and **`Client Secret`**.
145
+ 2. Add the **Bot** capability, choose **Stream Mode** for message receiving, and publish the app.
146
+ 3. *(Recommended)* Create an AI Card template and copy its **`Card Template ID`** for live streaming progress cards.
147
+
148
+ Edit `~/.pipiclaw/channel.json` — set `dingtalk.enabled` to `true` and fill in your credentials:
202
149
 
203
150
  ```json
204
151
  {
205
152
  "dingtalk": {
206
153
  "enabled": true,
207
- "clientId": "your-dingtalk-client-id",
208
- "clientSecret": "your-dingtalk-client-secret",
154
+ "clientId": "your-actual-client-id",
155
+ "clientSecret": "your-actual-client-secret",
209
156
  "robotCode": "",
210
- "cardTemplateId": "",
157
+ "cardTemplateId": "optional-card-template-id",
211
158
  "cardTemplateKey": "content",
212
159
  "allowFrom": []
213
160
  },
214
- "webapi": { "enabled": false, "socket": true }
161
+ "webapi": {
162
+ "enabled": true,
163
+ "socket": true,
164
+ "tcp": "127.0.0.1:8787",
165
+ "tls": null,
166
+ "keys": [{ "name": "default", "sha256": "...", "desks": ["default"] }]
167
+ }
215
168
  }
216
169
  ```
217
170
 
218
- - **Required fields**: Only `clientId` and `clientSecret` are strictly required. `robotCode` falls back to `clientId` when empty; `cardTemplateId` can be left blank initially (AI Card is strongly recommended for daily use).
219
- - **Access control**: `allowFrom: []` allows all senders; populate tester staff IDs during a staged rollout.
220
- - **Web API**: Set `webapi.enabled` to `true` if you also want scripts or other clients to connect via the official OpenAI SDK (see [Web API](https://github.com/oyasmi/pipiclaw/blob/main/docs/webapi.md)).
171
+ - Only `clientId` and `clientSecret` are strictly required (`robotCode` falls back to `clientId` when empty).
172
+ - `allowFrom: []` allows anyone with access to the DingTalk app; add your DingTalk `staffId` if you want to restrict access.
221
173
 
222
- Start the background daemon:
174
+ Start the service:
223
175
 
224
176
  ```bash
225
177
  pipiclaw
226
178
  ```
227
179
 
228
- Open DingTalk and **DM the bot** or **@mention it in a group** — no manual desk creation or binding is needed. Send `/model` to check the active model, then send a message to verify a live turn:
229
-
230
- ```text
231
- Please introduce yourself and explain what you can do right now
232
- ```
233
-
234
- *(If your first message does not go through, check [Deployment and Operations](https://github.com/oyasmi/pipiclaw/blob/main/docs/deployment-and-operations.md).)*
235
-
236
- ### 4. Enable External Agent Delegation (Claude / Codex / Cursor / Antigravity)
180
+ Open DingTalk on your phone or desktop, **DM the bot** or **@mention it in a group**, send `/status` to check health, and start chatting!
237
181
 
238
- Install and log in to your target CLIs (`claude`, `codex`, Cursor's `agent`, or Antigravity's `agy`) under the same OS user account that runs Pipiclaw.
182
+ ### Step 3: Plug In Claude Code / Codex / Cursor / Antigravity (Optional)
239
183
 
240
- The package ships curated capability entries organized by executor, capability tier (`flash` / `main` / `high`), and read-only review (`codex-review`). Copy the entries you actually have accounts for into your workspace:
184
+ If you already have `claude`, `codex`, Cursor's `agent`, or Antigravity's `agy` installed and logged in under the same OS user, enable them in two commands:
241
185
 
242
186
  ```bash
243
187
  mkdir -p ~/.pipiclaw/workspace/sub-agents
244
188
  PIPICLAW_PACKAGE_DIR="$(npm root -g)/@oyasmi/pipiclaw"
245
189
 
246
- # Example: enable Claude Code and Codex main entries plus read-only independent review
247
- cp "$PIPICLAW_PACKAGE_DIR"/examples/sub-agents/agents/{claude-main,codex-main,codex-review}.md \
190
+ # Copy the entries matching the subscriptions you own (Claude, Codex & read-only review shown)
191
+ cp "$PIPICLAW_PACKAGE_DIR"/examples/sub-agents/{claude-main,codex-main,codex-review}.md \
248
192
  ~/.pipiclaw/workspace/sub-agents/
249
193
  ```
250
194
 
251
- *(Entries for `cursor-main`, `cursor-high`, `agy-main`, `glm-high`, `glm-flash`, etc. are also included; see [Sub-Agent Examples](./examples/sub-agents/README.md).)*
195
+ *(Curated profiles for `claude-high`, `codex-high`, `codex-flash`, `cursor-main`, `cursor-high`, `agy-main`, `glm-high`, and `glm-flash` are also included — see [Sub-Agent Examples](https://github.com/oyasmi/pipiclaw/blob/master/examples/sub-agents/README.md).)*
252
196
 
253
- Role changes are discovered dynamically without restarting the daemon. Send:
197
+ **No restart needed.** Send `/subagents roles` in chat to confirm availability, then delegate naturally:
254
198
 
255
199
  ```text
256
- /subagents roles
200
+ Hand this cross-module refactor to a suitable external coding agent, run the test suite, and perform an independent read-only review before reporting back.
257
201
  ```
258
202
 
259
- Once the entries appear as available, describe your goal and acceptance criteria in plain language — the main agent will select the appropriate executor:
203
+ > [!IMPORTANT]
204
+ > **Permission Notice**: External coding agents run as standalone OS processes and bypass Pipiclaw's built-in command/path guards (and write-capable templates pass permissive CLI flags by default). Review the [Agent Delegation Guide](https://github.com/oyasmi/pipiclaw/blob/master/docs/sub-agents.md) before enabling them.
260
205
 
261
- ```text
262
- Please hand this cross-module implementation to a suitable executor, then independently verify the final diff and send me the conclusion with evidence.
206
+ ### Step 4: Keep It Running 24/7 in the Background (Recommended)
207
+
208
+ To keep your assistant online when you close your terminal, run `pipiclaw` under `pm2` or `systemd` on an always-on workstation, Mac mini, or server:
209
+
210
+ ```bash
211
+ # Quick background setup with pm2
212
+ pm2 start pipiclaw --name pipiclaw && pm2 save
263
213
  ```
264
214
 
265
- > [!IMPORTANT]
266
- > External agents do not pass through Pipiclaw's built-in command and path guards, and the recommended write entries use permissive CLI flags. Read the authorization and sandbox guidance in the [Agent Delegation Guide](https://github.com/oyasmi/pipiclaw/blob/main/docs/sub-agents.md) before enabling them, and run long external delegations under the persistent `pipiclaw` daemon.
215
+ For production `systemd` unit files, environment isolation, backups, and troubleshooting, see [Deployment & Operations](https://github.com/oyasmi/pipiclaw/blob/master/docs/deployment-and-operations.md).
267
216
 
268
- ### 5. Optional: Enable Web Search & Fetch Tools
217
+ ---
218
+
219
+ ## Core Capabilities
220
+
221
+ ### 💬 1. Live Streaming Across DingTalk, Terminal & SDK
222
+
223
+ - **Real-Time AI Cards**: Watch reasoning steps and tool calls unfold live in DingTalk. Need to adjust course while it's working? Just send a message to steer mid-turn (`/steer`), or queue your next request with `/followup`.
224
+ - **Native File Delivery**: Generated reports, CSV exports, screenshots, and archives arrive directly in DingTalk as native file attachments.
225
+ - **Official OpenAI SDK Compatibility**: Both `pipiclaw tui` and your own Python/JS scripts talk to the same assistant via the built-in OpenAI Responses-compatible [Web API](https://github.com/oyasmi/pipiclaw/blob/master/docs/webapi.md).
226
+
227
+ ### 🛤️ 2. Non-Blocking Background Tasks & Scheduled Events
228
+
229
+ - **Dedicated Task Lane**: Multi-step projects progress in the background without tying up your conversation, persisting every checklist item and step on disk so work resumes cleanly across restarts.
230
+ - **Built-In Cost & Safety Guardrails**: Step limits, USD budgets, per-step timeouts, and error circuit breakers automatically pause runaway tasks and notify you when human input is needed.
231
+ - **Timers & Zero-Token Sensors**: Schedule one-off reminders or recurring Cron jobs, optionally gated by local check scripts so idle inspections cost zero tokens.
232
+
233
+ ### 🤝 3. Unified Multi-Agent Orchestration
269
234
 
270
- `web_search` and `web_fetch` are disabled by default. Edit `~/.pipiclaw/tools.json` and set `tools.web.enable: true` (supports DuckDuckGo, Tavily, Jina, and SearXNG; DuckDuckGo works out of the box without an API key). See [Configuration Reference](https://github.com/oyasmi/pipiclaw/blob/main/docs/configuration.md) for all fields.
235
+ - **Lead Assistant + Specialized Workers**: Your main assistant owns context, planning, and acceptance — spinning up fast **built-in sub-agents** for quick searches/log triage, and **Claude Code / Codex / Cursor / Antigravity** for heavy multi-file coding and test loops.
236
+ - **Async Wakeups & Follow-Ups**: Long external runs execute in the background, wake your chat automatically when done, support session continuation for follow-up questions, and can be killed anytime via `/subagents cancel`.
237
+
238
+ ### 🧠 4. Transparent, Controllable Memory
239
+
240
+ - **Long-Term Conventions + Daily Journals**: Durable project rules live in `memory/*.md` and load automatically at session start (no brittle keyword guessing), while day-to-day progress stays neatly separated in daily `journal/` files.
241
+ - **Probation & Permanent Forgetting**: Newly inferred habits enter a 30-day probation window first, and `/memory forget <name>` deletes unwanted entries permanently so background maintenance never brings them back.
242
+
243
+ ### 🛡️ 5. Instant Takeover & 100% Local Plain-Text Data
244
+
245
+ - **LLM-Independent Controls**: Commands like `/stop`, `/tasks`, `/subagents`, `/status`, and `/usage` execute directly in the local runtime — **responding instantly even if an upstream model API is slow or unreachable**.
246
+ - **Plain-Text Data Ownership**: Every config, memory, journal, task spec, and usage ledger lives as readable Markdown or JSON under `~/.pipiclaw/`, protected by built-in command, path, and network guards.
247
+
248
+ ### Mental Model at a Glance
249
+
250
+ ```mermaid
251
+ flowchart LR
252
+ subgraph You["Where You Talk (Channels)"]
253
+ DT["📱 DingTalk DM / Group"]
254
+ TUI["💻 Terminal (pipiclaw tui)"]
255
+ SDK["🔌 Your Scripts (OpenAI SDK)"]
256
+ end
257
+
258
+ subgraph Assistant["Your Pipiclaw Assistant"]
259
+ CMD["⚡ Instant Slash Controls<br/>(/stop · /tasks · /subagents ...)"]
260
+ CHAT["💬 Interactive Chat & Routing"]
261
+ TASK["🛤️ Background Tasks & Cron Events"]
262
+ end
263
+
264
+ subgraph Desk["Desk (default / custom workspaces)"]
265
+ MEM["🧠 Long-Term Memory · Daily Journal · Repo CWD"]
266
+ end
267
+
268
+ subgraph Workers["Tools & Coding Agents"]
269
+ LOCAL["🔍 Built-In Tools & Fast Internal Sub-Agents"]
270
+ CLI["🛠️ Claude Code · Codex · Cursor · Antigravity"]
271
+ end
272
+
273
+ DT & TUI & SDK --> CMD & CHAT
274
+ CHAT & TASK <--> Desk
275
+ CHAT & TASK --> LOCAL & CLI
276
+ ```
277
+
278
+ | Everyday Term | What It Means for You |
279
+ |---|---|
280
+ | **Channel** | A conversation window (a DingTalk DM, a DingTalk group, or a terminal/API session), each keeping its own chat history. |
281
+ | **Desk** | A named workspace owning memory, journals, tasks, events, and a working directory. Everything shares `default` out of the box; create more only when you want separation. |
282
+ | **Task** | A multi-step project advancing in the background without blocking chat — inspectable, steerable, and resumable anytime. |
283
+ | **Event** | A one-time alarm or Cron schedule that wakes the assistant or spawns recurring tasks (optionally gated by a local check script). |
284
+ | **Sub-Agent** | A helper dispatched for a specific job — either a fast built-in reader or an external CLI like Claude Code or Codex. |
271
285
 
272
286
  ---
273
287
 
274
288
  ## Common Commands
275
289
 
276
- Slash commands are split into **runtime-handled commands (work mid-turn and bypass the LLM)** and **session commands**:
290
+ Type `/` in DingTalk or the terminal to control your assistant (send `/help` for the full list, or `/help <command>` for examples):
277
291
 
278
- ### Available Anytime (Handled directly by the runtime — works even when busy or stuck)
292
+ ### ⚡ Available Anytime (Responds instantly — even mid-reply or if a model hangs)
279
293
 
280
- | Command | Purpose |
294
+ | Command | When to Use It |
281
295
  |---|---|
282
- | `/help [command]` | Show the top-level command list, or detailed subcommands and examples for a command (e.g. `/help tasks`) |
283
- | `/status` | Inspect runtime status, active model, context usage, uptime, version, and desk task summary |
284
- | `/stop` | Abort the current chat turn and clear queued messages (use `/tasks pause` for tasks, `/subagents cancel` for delegations) |
285
- | `/steer <message>` | Steer the running turn after the current tool call finishes (default behavior for plain messages sent while busy) |
286
- | `/followup <message>` | Queue a request to run after the current turn finishes |
287
- | `/tasks [show\|log\|msg\|pause\|resume\|cancel\|archive\|doctor]` | Inspect, message (`msg`), pause, resume, or cancel background long-horizon tasks |
288
- | `/subagents [list\|show\|output\|cancel\|roles]` | Inspect running/recent delegations, view outputs, browse roles, or terminate directly (`cancel`) |
289
- | `/events <list\|show\|delete\|history>` | List, inspect, or delete scheduled events and view trigger history |
290
- | `/desk [list\|new <name>\|bind <name>]` | View desk bindings, create a new desk, or bind the current channel to another desk |
291
- | `/usage [7d\|month]` | View token usage and cost breakdown for the current desk and globally |
292
- | `/context [detail]` | Inspect what is actually sent to the model: system prompt sections, tool definitions, and last-turn context |
293
- | `/skills [list\|show <name>]` | List workspace and user-shared skills or view a specific skill |
294
- | `/new` | Start a fresh conversation session |
295
-
296
- ### Available When Idle (Requires the current turn to finish)
297
-
298
- | Command | Purpose |
296
+ | `/help [command]` | Browse all commands, or view subcommands and examples for one (e.g. `/help tasks`) |
297
+ | `/status` | Check health, active model, context usage, uptime, and background task summary |
298
+ | `/stop` | Immediately abort the current chat reply and clear queued messages |
299
+ | `/steer <message>` | Nudge or redirect a running reply on the fly (plain messages sent while busy do this by default) |
300
+ | `/followup <message>` | Queue your next request to run right after the current reply finishes |
301
+ | `/tasks [show\|msg\|pause\|resume\|cancel...]` | Check background task progress, send instructions (`msg`), pause, resume with extra budget, or cancel |
302
+ | `/subagents [list\|show\|output\|cancel\|roles]` | Inspect active/recent Claude/Codex delegations, read live output, or `cancel` a process immediately |
303
+ | `/events <list\|show\|delete\|history>` | List or delete scheduled reminders/Cron jobs and inspect trigger history |
304
+ | `/desk [list\|new\|cwd\|bind]` | View desks, create a new desk, or set its repo directory (note: `bind` waits until the active turn ends) |
305
+ | `/usage [7d\|month]` | View token consumption and cost breakdown for your desk and globally |
306
+ | `/context [detail]` | See exactly how much system prompt, tool schema, and history is sent to the model |
307
+ | `/skills [list\|show <name>]` | List loaded workspace and shared user skills |
308
+ | `/new` | Start a fresh chat session while keeping your long-term desk memory intact |
309
+
310
+ ### 🛋️ Available When Idle (Run after the current reply finishes)
311
+
312
+ | Command | When to Use It |
299
313
  |---|---|
300
- | `/memory [status\|list\|show\|forget\|journal]` | Inspect desk memories, probation items, daily journals, or delete and block a memory (`forget`) |
301
- | `/model [provider/modelId\|modelId]` | View or switch the active model by exact ID or unique substring |
302
- | `/thinking [off\|minimal\|low\|medium\|high\|xhigh\|max\|cycle]` | View or change the active model's reasoning effort level |
303
- | `/compact [instructions]` | Manually compact the current session context with optional retention instructions |
304
- | `/session` | Display message stats, token usage, and model info for the active session |
305
- | `/reload` | Reload skills, tools, and resources while preserving conversation history |
314
+ | `/memory [status\|list\|show\|forget\|journal]` | Browse saved memories, read daily journals, or permanently delete/block an item (`forget`) |
315
+ | `/model [name-or-substring]` | Check the active model or switch models by exact ID or unique substring |
316
+ | `/thinking [low\|medium\|high\|cycle...]` | Tune reasoning depth (lower for snappy chat, higher for hard debugging) |
317
+ | `/compact [instructions]` | Compress a long chat history manually, optionally telling it what details to preserve |
318
+ | `/session` | Check message counts and token stats for the current conversation |
319
+ | `/reload` | Hot-reload updated skills and workspace resources without restarting |
320
+
321
+ ---
322
+
323
+ ## Where Your Data & Config Live
324
+
325
+ Everything lives in `~/.pipiclaw/` (override anytime via `PIPICLAW_HOME=/your/path`) — backing up or moving machines is as simple as copying one folder:
326
+
327
+ ```text
328
+ ~/.pipiclaw/
329
+ ├── channel.json # DingTalk bot credentials, AI Card template & Web API switches
330
+ ├── auth.json # Model credentials (managed via pipiclaw auth login)
331
+ ├── models.json # Custom model providers, OpenAI-compatible gateways & local endpoints
332
+ ├── settings.json # Default model, fallback model & runtime preferences
333
+ ├── tools.json # Feature toggles such as web search/fetch (off by default; keyless DuckDuckGo supported)
334
+ ├── security.json # Command, path & network guard policies
335
+ └── workspace/ # Your personal assets:
336
+ ├── SOUL.md # Customize assistant persona, tone & language preferences
337
+ ├── AGENTS.md # Shared engineering rules & workflow conventions
338
+ ├── skills/ # Reusable workflow skills (also loads shared skills from ~/.agents/skills/)
339
+ ├── sub-agents/ # Enabled external coding agent profiles
340
+ └── desk-default/ # Default desk's memory/, daily journal/, and background tasks/
341
+ ```
306
342
 
307
- See [Interaction and Commands](https://github.com/oyasmi/pipiclaw/blob/main/docs/interaction-and-commands.md) for full details.
343
+ See the **[Configuration Quickstart](https://github.com/oyasmi/pipiclaw/blob/master/docs/configuration.md)** for common recipes (custom gateways, proxies via `PIPICLAW_PROXY`, web tools, and more).
344
+
345
+ ---
346
+
347
+ ## FAQ
348
+
349
+ <details>
350
+ <summary><b>1. Do I need a cloud server, domain name, or public IP for DingTalk?</b></summary>
351
+
352
+ **No.** Pipiclaw connects outbound via DingTalk's official Stream Mode. Any laptop, desktop, or private server with regular internet access works out of the box.
353
+ </details>
354
+
355
+ <details>
356
+ <summary><b>2. Will tasks keep running if I close my laptop lid?</b></summary>
357
+
358
+ Pipiclaw runs locally on the host where you installed it. If your laptop goes to sleep, the process pauses until wake-up (and then automatically reconnects and resumes). For **true 24/7 mobile access**, run Pipiclaw on an always-on desktop, Mac mini, home server, or cloud VM.
359
+ </details>
360
+
361
+ <details>
362
+ <summary><b>3. Does delegating to Claude Code / Codex cost extra? What is the security model?</b></summary>
363
+
364
+ Pipiclaw adds zero middleman fees — it invokes the official CLIs already installed and authenticated on your machine using your existing subscriptions or API keys.
365
+ **Security scope**: Pipiclaw is built for individual developers (and small trusted setups sharing one assistant), not hard multi-tenant SaaS isolation. External coding CLIs run under your OS user account and **bypass Pipiclaw's built-in command/path guards**. Run them in dedicated project directories or under a dedicated OS user. Read the [Security Guide](https://github.com/oyasmi/pipiclaw/blob/master/docs/security.md) for details.
366
+ </details>
367
+
368
+ <details>
369
+ <summary><b>4. How do I enable web search or upgrade Pipiclaw?</b></summary>
370
+
371
+ - **Enable web search**: Set `tools.web.enable: true` in `~/.pipiclaw/tools.json` (DuckDuckGo works immediately with no API key; Tavily, Jina, and SearXNG are also supported).
372
+ - **Upgrade**: Run `npm install -g @oyasmi/pipiclaw@latest` and restart the `pipiclaw` process. Your `~/.pipiclaw/` data and memories stay untouched.
373
+ </details>
308
374
 
309
375
  ---
310
376
 
311
377
  ## Documentation
312
378
 
313
- The complete documentation index is at **[docs/README.md](https://github.com/oyasmi/pipiclaw/blob/main/docs/README.md)**. Jump straight to what you need:
379
+ Explore the full user guides in **[docs/README.md](https://github.com/oyasmi/pipiclaw/blob/master/docs/README.md)** *(currently primarily in Chinese)*:
314
380
 
315
- | I want to... | Guide |
381
+ | Goal | Guide |
316
382
  |---|---|
317
- | 💬 Understand DMs, groups, AI Cards, busy-time messages, and slash commands | [Interaction and Commands](https://github.com/oyasmi/pipiclaw/blob/main/docs/interaction-and-commands.md) |
318
- | 🤝 Delegate to Claude Code / Codex / Cursor / Antigravity and author roles | [Agent Delegation](https://github.com/oyasmi/pipiclaw/blob/main/docs/sub-agents.md) · [Role Examples](./examples/sub-agents/README.md) |
319
- | 📋 Use the background task lane, scheduled events, Cron templates, and budgets | [Events and Tasks](https://github.com/oyasmi/pipiclaw/blob/main/docs/events-and-tasks.md) |
320
- | 🧠 Understand layered memory, daily journals, probation, and forgetting | [Memory](https://github.com/oyasmi/pipiclaw/blob/main/docs/memory.md) |
321
- | ⚙️ Configure models, gateways, proxies, web tools, and workspace files | [Configuration Guide](https://github.com/oyasmi/pipiclaw/blob/main/docs/configuration.md) · [Field Reference](https://github.com/oyasmi/pipiclaw/blob/main/docs/configuration-reference.md) |
322
- | 🔌 Connect scripts or custom clients via the official OpenAI SDK | [Web API](https://github.com/oyasmi/pipiclaw/blob/main/docs/webapi.md) |
323
- | 🧩 Package reusable personal or project workflows as Skills | [Skills Guide](https://github.com/oyasmi/pipiclaw/blob/main/docs/skills.md) |
324
- | 💡 Get higher leverage and end-to-end delivery from your setup | [Leverage Notes](https://github.com/oyasmi/pipiclaw/blob/main/docs/leverage/README.md) · [Design Philosophy](https://github.com/oyasmi/pipiclaw/blob/main/docs/design-philosophy.md) |
325
- | 🛡️ Review default security guards, path/command rules, and external CLI boundaries | [Security Guide](https://github.com/oyasmi/pipiclaw/blob/main/docs/security.md) |
326
- | 🚀 Deploy the daemon, upgrade, back up, and understand concurrency limits | [Deployment and Operations](https://github.com/oyasmi/pipiclaw/blob/main/docs/deployment-and-operations.md) · [Scaling and Concurrency](https://github.com/oyasmi/pipiclaw/blob/main/docs/scaling-and-concurrency.md) |
327
- | 🏗️ Explore the module layering, runtime topology, and internals | [Architecture](https://github.com/oyasmi/pipiclaw/blob/main/docs/architecture.md) · [Runtime Mechanisms](https://github.com/oyasmi/pipiclaw/blob/main/docs/runtime-mechanisms.md) |
383
+ | ⚡ Step-by-step first-run onboarding, gateway snippets & FAQ | [Quick Start Guide](https://github.com/oyasmi/pipiclaw/blob/master/docs/quickstart.md) |
384
+ | 💬 Master DMs, groups, AI Card modes & slash commands | [Interaction & Commands](https://github.com/oyasmi/pipiclaw/blob/master/docs/interaction-and-commands.md) |
385
+ | ⚙️ Configure custom models, gateways, proxies & web search | [Configuration Quickstart](https://github.com/oyasmi/pipiclaw/blob/master/docs/configuration.md) · [Field Reference](https://github.com/oyasmi/pipiclaw/blob/master/docs/configuration-reference.md) |
386
+ | 🤝 Set up & customize Claude Code / Codex / Cursor / Antigravity | [Agent Delegation](https://github.com/oyasmi/pipiclaw/blob/master/docs/sub-agents.md) · [Profile Examples](https://github.com/oyasmi/pipiclaw/blob/master/examples/sub-agents/README.md) |
387
+ | 📋 Run background tasks, Cron inspections & budgets | [Events & Tasks](https://github.com/oyasmi/pipiclaw/blob/master/docs/events-and-tasks.md) |
388
+ | 🧠 Manage long-term memory, journals, probation & forgetting | [Memory Guide](https://github.com/oyasmi/pipiclaw/blob/master/docs/memory.md) |
389
+ | 🧩 Package reusable personal or project workflows as Skills | [Skills Guide](https://github.com/oyasmi/pipiclaw/blob/master/docs/skills.md) · [Built-In Tools](https://github.com/oyasmi/pipiclaw/blob/master/docs/tools.md) |
390
+ | 🔌 Connect Python/JS scripts or custom UIs via OpenAI SDK | [Web API Guide](https://github.com/oyasmi/pipiclaw/blob/master/docs/webapi.md) |
391
+ | 💡 Best practices for high-leverage autonomous delivery | [Leverage Notes](https://github.com/oyasmi/pipiclaw/blob/master/docs/leverage/README.md) |
392
+ | 🚀 Host 24/7 with systemd/pm2, review guards & troubleshoot | [Deployment & Operations](https://github.com/oyasmi/pipiclaw/blob/master/docs/deployment-and-operations.md) · [Security Guide](https://github.com/oyasmi/pipiclaw/blob/master/docs/security.md) · [Scaling & Concurrency](https://github.com/oyasmi/pipiclaw/blob/master/docs/scaling-and-concurrency.md) |
328
393
 
329
394
  ---
330
395
 
331
- ## Development
396
+ ## Building from Source & Contributing
397
+
398
+ Want to build from source, customize locally, or contribute?
332
399
 
333
400
  ```bash
334
- npm install
335
- npm run build
336
- npm run check # lint + typecheck + arch + deadcode + unit test
401
+ git clone https://github.com/oyasmi/pipiclaw.git
402
+ cd pipiclaw
403
+ npm install && npm run build && npm run check
337
404
  ```
338
405
 
339
- - **Minimum verification**: `npm run typecheck` and `npm run test`
340
- - **Architecture & dependency boundaries**: `npm run arch`
341
- - **Deterministic full-stack E2E (offline, zero API cost)**: `npm run test:e2e`
342
- - **Live model smoke suite**: `npm run test:e2e:live`
406
+ Find the architecture, engineering conventions, behavior evaluation guide, and design records in the [project development docs](https://github.com/oyasmi/pipiclaw/blob/master/dev-docs/README.md). Issues and Pull Requests are welcome!
343
407
 
344
408
  ---
345
409