@penclipai/server 2026.426.0 → 2026.505.0

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 (253) hide show
  1. package/dist/adapters/builtin-adapter-types.d.ts.map +1 -1
  2. package/dist/adapters/builtin-adapter-types.js +3 -0
  3. package/dist/adapters/builtin-adapter-types.js.map +1 -1
  4. package/dist/adapters/index.d.ts +2 -2
  5. package/dist/adapters/index.d.ts.map +1 -1
  6. package/dist/adapters/index.js +1 -1
  7. package/dist/adapters/index.js.map +1 -1
  8. package/dist/adapters/registry.d.ts +2 -1
  9. package/dist/adapters/registry.d.ts.map +1 -1
  10. package/dist/adapters/registry.js +76 -6
  11. package/dist/adapters/registry.js.map +1 -1
  12. package/dist/adapters/types.d.ts +1 -1
  13. package/dist/adapters/types.d.ts.map +1 -1
  14. package/dist/adapters/utils.d.ts.map +1 -1
  15. package/dist/adapters/utils.js +2 -1
  16. package/dist/adapters/utils.js.map +1 -1
  17. package/dist/attachment-types.d.ts +1 -16
  18. package/dist/attachment-types.d.ts.map +1 -1
  19. package/dist/attachment-types.js +7 -0
  20. package/dist/attachment-types.js.map +1 -1
  21. package/dist/auth/better-auth.d.ts +3 -1
  22. package/dist/auth/better-auth.d.ts.map +1 -1
  23. package/dist/auth/better-auth.js +8 -2
  24. package/dist/auth/better-auth.js.map +1 -1
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +27 -13
  27. package/dist/index.js.map +1 -1
  28. package/dist/middleware/auth.d.ts.map +1 -1
  29. package/dist/middleware/auth.js +143 -2
  30. package/dist/middleware/auth.js.map +1 -1
  31. package/dist/onboarding-assets/ceo/AGENTS.md +1 -1
  32. package/dist/onboarding-assets/ceo/HEARTBEAT.md +5 -5
  33. package/dist/redaction.d.ts.map +1 -1
  34. package/dist/redaction.js +30 -12
  35. package/dist/redaction.js.map +1 -1
  36. package/dist/routes/access.d.ts.map +1 -1
  37. package/dist/routes/access.js +10 -0
  38. package/dist/routes/access.js.map +1 -1
  39. package/dist/routes/activity.d.ts.map +1 -1
  40. package/dist/routes/activity.js +4 -2
  41. package/dist/routes/activity.js.map +1 -1
  42. package/dist/routes/adapters.d.ts.map +1 -1
  43. package/dist/routes/adapters.js +1 -0
  44. package/dist/routes/adapters.js.map +1 -1
  45. package/dist/routes/agents.d.ts.map +1 -1
  46. package/dist/routes/agents.js +317 -56
  47. package/dist/routes/agents.js.map +1 -1
  48. package/dist/routes/costs.d.ts.map +1 -1
  49. package/dist/routes/costs.js +21 -2
  50. package/dist/routes/costs.js.map +1 -1
  51. package/dist/routes/instance-settings.d.ts.map +1 -1
  52. package/dist/routes/instance-settings.js +37 -2
  53. package/dist/routes/instance-settings.js.map +1 -1
  54. package/dist/routes/issue-tree-control.d.ts.map +1 -1
  55. package/dist/routes/issue-tree-control.js +3 -1
  56. package/dist/routes/issue-tree-control.js.map +1 -1
  57. package/dist/routes/issues.d.ts.map +1 -1
  58. package/dist/routes/issues.js +257 -32
  59. package/dist/routes/issues.js.map +1 -1
  60. package/dist/routes/projects.d.ts.map +1 -1
  61. package/dist/routes/projects.js +10 -3
  62. package/dist/routes/projects.js.map +1 -1
  63. package/dist/routes/routines.d.ts.map +1 -1
  64. package/dist/routes/routines.js +6 -1
  65. package/dist/routes/routines.js.map +1 -1
  66. package/dist/routes/workspace-command-authz.d.ts +1 -1
  67. package/dist/routes/workspace-command-authz.d.ts.map +1 -1
  68. package/dist/routes/workspace-command-authz.js +2 -2
  69. package/dist/routes/workspace-command-authz.js.map +1 -1
  70. package/dist/runtime-api.d.ts +4 -0
  71. package/dist/runtime-api.d.ts.map +1 -1
  72. package/dist/runtime-api.js +38 -10
  73. package/dist/runtime-api.js.map +1 -1
  74. package/dist/services/companies.d.ts +6 -0
  75. package/dist/services/companies.d.ts.map +1 -1
  76. package/dist/services/companies.js +1 -0
  77. package/dist/services/companies.js.map +1 -1
  78. package/dist/services/company-portability.d.ts.map +1 -1
  79. package/dist/services/company-portability.js +16 -15
  80. package/dist/services/company-portability.js.map +1 -1
  81. package/dist/services/costs.d.ts +9 -0
  82. package/dist/services/costs.d.ts.map +1 -1
  83. package/dist/services/costs.js +45 -1
  84. package/dist/services/costs.js.map +1 -1
  85. package/dist/services/environment-execution-target.d.ts.map +1 -1
  86. package/dist/services/environment-execution-target.js +7 -13
  87. package/dist/services/environment-execution-target.js.map +1 -1
  88. package/dist/services/environment-run-orchestrator.d.ts.map +1 -1
  89. package/dist/services/environment-run-orchestrator.js +56 -0
  90. package/dist/services/environment-run-orchestrator.js.map +1 -1
  91. package/dist/services/environment-runtime.d.ts +2 -0
  92. package/dist/services/environment-runtime.d.ts.map +1 -1
  93. package/dist/services/environment-runtime.js +80 -39
  94. package/dist/services/environment-runtime.js.map +1 -1
  95. package/dist/services/heartbeat-stop-metadata.d.ts +2 -1
  96. package/dist/services/heartbeat-stop-metadata.d.ts.map +1 -1
  97. package/dist/services/heartbeat-stop-metadata.js +10 -1
  98. package/dist/services/heartbeat-stop-metadata.js.map +1 -1
  99. package/dist/services/heartbeat-stop-metadata.test.js +24 -0
  100. package/dist/services/heartbeat-stop-metadata.test.js.map +1 -1
  101. package/dist/services/heartbeat.d.ts +156 -5
  102. package/dist/services/heartbeat.d.ts.map +1 -1
  103. package/dist/services/heartbeat.js +1384 -112
  104. package/dist/services/heartbeat.js.map +1 -1
  105. package/dist/services/index.d.ts +1 -0
  106. package/dist/services/index.d.ts.map +1 -1
  107. package/dist/services/index.js +1 -0
  108. package/dist/services/index.js.map +1 -1
  109. package/dist/services/instance-settings.d.ts.map +1 -1
  110. package/dist/services/instance-settings.js +4 -1
  111. package/dist/services/instance-settings.js.map +1 -1
  112. package/dist/services/issue-execution-policy.d.ts +56 -1
  113. package/dist/services/issue-execution-policy.d.ts.map +1 -1
  114. package/dist/services/issue-execution-policy.js +400 -2
  115. package/dist/services/issue-execution-policy.js.map +1 -1
  116. package/dist/services/issue-thread-interactions.d.ts +5 -1
  117. package/dist/services/issue-thread-interactions.d.ts.map +1 -1
  118. package/dist/services/issue-thread-interactions.js +44 -1
  119. package/dist/services/issue-thread-interactions.js.map +1 -1
  120. package/dist/services/issue-tree-control.d.ts +1 -0
  121. package/dist/services/issue-tree-control.d.ts.map +1 -1
  122. package/dist/services/issue-tree-control.js +84 -4
  123. package/dist/services/issue-tree-control.js.map +1 -1
  124. package/dist/services/issues.d.ts +10 -1
  125. package/dist/services/issues.d.ts.map +1 -1
  126. package/dist/services/issues.js +452 -48
  127. package/dist/services/issues.js.map +1 -1
  128. package/dist/services/plugin-environment-driver.d.ts +4 -0
  129. package/dist/services/plugin-environment-driver.d.ts.map +1 -1
  130. package/dist/services/plugin-environment-driver.js +18 -1
  131. package/dist/services/plugin-environment-driver.js.map +1 -1
  132. package/dist/services/productivity-review.d.ts +83 -0
  133. package/dist/services/productivity-review.d.ts.map +1 -0
  134. package/dist/services/productivity-review.js +650 -0
  135. package/dist/services/productivity-review.js.map +1 -0
  136. package/dist/services/recovery/index.d.ts +1 -1
  137. package/dist/services/recovery/index.d.ts.map +1 -1
  138. package/dist/services/recovery/index.js +1 -1
  139. package/dist/services/recovery/index.js.map +1 -1
  140. package/dist/services/recovery/issue-graph-liveness.d.ts +13 -1
  141. package/dist/services/recovery/issue-graph-liveness.d.ts.map +1 -1
  142. package/dist/services/recovery/issue-graph-liveness.js +212 -92
  143. package/dist/services/recovery/issue-graph-liveness.js.map +1 -1
  144. package/dist/services/recovery/origins.d.ts +2 -0
  145. package/dist/services/recovery/origins.d.ts.map +1 -1
  146. package/dist/services/recovery/origins.js +4 -0
  147. package/dist/services/recovery/origins.js.map +1 -1
  148. package/dist/services/recovery/run-liveness-continuations.d.ts.map +1 -1
  149. package/dist/services/recovery/run-liveness-continuations.js.map +1 -1
  150. package/dist/services/recovery/service.d.ts +20 -2
  151. package/dist/services/recovery/service.d.ts.map +1 -1
  152. package/dist/services/recovery/service.js +405 -63
  153. package/dist/services/recovery/service.js.map +1 -1
  154. package/dist/services/routines.d.ts +5 -2
  155. package/dist/services/routines.d.ts.map +1 -1
  156. package/dist/services/routines.js +47 -3
  157. package/dist/services/routines.js.map +1 -1
  158. package/dist/worktree-config.d.ts.map +1 -1
  159. package/dist/worktree-config.js +2 -5
  160. package/dist/worktree-config.js.map +1 -1
  161. package/package.json +16 -15
  162. package/skills/diagnose-why-work-stopped/SKILL.md +161 -0
  163. package/skills/paperclip/SKILL.md +37 -26
  164. package/skills/paperclip/references/api-reference.md +6 -2
  165. package/skills/paperclip-converting-plans-to-tasks/SKILL.md +42 -0
  166. package/skills/paperclip-create-agent/SKILL.md +3 -2
  167. package/skills/paperclip-create-agent/references/agent-instruction-templates.md +1 -1
  168. package/skills/paperclip-create-agent/references/api-reference.md +7 -2
  169. package/skills/paperclip-create-agent/references/baseline-role-guide.md +1 -1
  170. package/skills/paperclip-create-agent/references/draft-review-checklist.md +2 -2
  171. package/skills/paperclip-dev/SKILL.md +267 -0
  172. package/skills/terminal-bench-loop/SKILL.md +236 -0
  173. package/ui-dist/assets/{_basePickBy-BRqa7PJ5.js → _basePickBy-BS0Fg_DB.js} +1 -1
  174. package/ui-dist/assets/{_baseUniq-DhE2yrXC.js → _baseUniq-Dtnt_4SE.js} +1 -1
  175. package/ui-dist/assets/{arc-7qnikTQ3.js → arc-BCoOPxh5.js} +1 -1
  176. package/ui-dist/assets/{architectureDiagram-VXUJARFQ-CH0wVUOM.js → architectureDiagram-VXUJARFQ-C6eX2QUo.js} +1 -1
  177. package/ui-dist/assets/{blockDiagram-VD42YOAC-CeeRyJQX.js → blockDiagram-VD42YOAC-aUueUD4B.js} +1 -1
  178. package/ui-dist/assets/browser-ponyfill-BlAfsWm_.js +2 -0
  179. package/ui-dist/assets/{c4Diagram-YG6GDRKO-C_cV0CGo.js → c4Diagram-YG6GDRKO-CfPWRlOF.js} +1 -1
  180. package/ui-dist/assets/channel-ChNSCFJf.js +1 -0
  181. package/ui-dist/assets/{chunk-4BX2VUAB-DQ6pxPVT.js → chunk-4BX2VUAB-BTD1apA4.js} +1 -1
  182. package/ui-dist/assets/{chunk-55IACEB6-L8pS0IoX.js → chunk-55IACEB6-BXXF_ClN.js} +1 -1
  183. package/ui-dist/assets/{chunk-B4BG7PRW-BZKGE88E.js → chunk-B4BG7PRW-hAZeWGP8.js} +1 -1
  184. package/ui-dist/assets/{chunk-DI55MBZ5-CefSoZ_K.js → chunk-DI55MBZ5-cOH3UoEl.js} +1 -1
  185. package/ui-dist/assets/{chunk-FMBD7UC4-Bc3qTTHB.js → chunk-FMBD7UC4-Cu2yZOcl.js} +1 -1
  186. package/ui-dist/assets/{chunk-QN33PNHL-CjWBr5bI.js → chunk-QN33PNHL-0DNN5aRU.js} +1 -1
  187. package/ui-dist/assets/{chunk-QZHKN3VN-C0JUdmmz.js → chunk-QZHKN3VN-B9_bhK2n.js} +1 -1
  188. package/ui-dist/assets/{chunk-TZMSLE5B-D4d4I82z.js → chunk-TZMSLE5B-Cr5xwxio.js} +1 -1
  189. package/ui-dist/assets/classDiagram-2ON5EDUG-4aK1QZU3.js +1 -0
  190. package/ui-dist/assets/classDiagram-v2-WZHVMYZB-4aK1QZU3.js +1 -0
  191. package/ui-dist/assets/clone-C8lk5Qbc.js +1 -0
  192. package/ui-dist/assets/{cose-bilkent-S5V4N54A-B09h9XGZ.js → cose-bilkent-S5V4N54A-6_Dw6gpQ.js} +1 -1
  193. package/ui-dist/assets/{dagre-6UL2VRFP-CA02PXuX.js → dagre-6UL2VRFP-CFBhlh5H.js} +1 -1
  194. package/ui-dist/assets/{diagram-PSM6KHXK-DaT9cnrY.js → diagram-PSM6KHXK-C88ftcah.js} +1 -1
  195. package/ui-dist/assets/{diagram-QEK2KX5R-Drwc3gBw.js → diagram-QEK2KX5R-9EUupcuH.js} +1 -1
  196. package/ui-dist/assets/{diagram-S2PKOQOG-CpsGCaT6.js → diagram-S2PKOQOG-Dsml0wWh.js} +1 -1
  197. package/ui-dist/assets/{erDiagram-Q2GNP2WA-CVkBh9TY.js → erDiagram-Q2GNP2WA-sM-XdfHS.js} +1 -1
  198. package/ui-dist/assets/{flowDiagram-NV44I4VS-De9sXvPR.js → flowDiagram-NV44I4VS-qll7oaoW.js} +1 -1
  199. package/ui-dist/assets/{ganttDiagram-JELNMOA3-CSFa0gXS.js → ganttDiagram-JELNMOA3-VWnJMcjC.js} +1 -1
  200. package/ui-dist/assets/{gitGraphDiagram-V2S2FVAM-DEJaChxa.js → gitGraphDiagram-V2S2FVAM-DFnocrfl.js} +1 -1
  201. package/ui-dist/assets/{graph-D2R4DCtu.js → graph-nq3Qye4Z.js} +1 -1
  202. package/ui-dist/assets/{index-DEG-9CFs.js → index-3Owzaheh.js} +1 -1
  203. package/ui-dist/assets/{index-DHnKx9xX.js → index-B2A-a635.js} +1 -1
  204. package/ui-dist/assets/{index-C1I0SGDm.js → index-BGFrRiqa.js} +1 -1
  205. package/ui-dist/assets/{index-B44EtLRv.js → index-BVC5UhRK.js} +1 -1
  206. package/ui-dist/assets/{index-C_dAXwxT.js → index-BrP1U_Hy.js} +1 -1
  207. package/ui-dist/assets/{index-flZjKn_n.js → index-CXXHGqM8.js} +1 -1
  208. package/ui-dist/assets/{index-ssM_UKPW.js → index-CgyPAauR.js} +1 -1
  209. package/ui-dist/assets/{index-Ct1AraKR.js → index-CksQ4Ytv.js} +1 -1
  210. package/ui-dist/assets/{index-DQ6I_vpd.js → index-CrNzj2vZ.js} +1 -1
  211. package/ui-dist/assets/{index-DzZID5RY.js → index-CxbZBH3M.js} +1 -1
  212. package/ui-dist/assets/{index-Cn6_RRY5.js → index-D-dSSrf-.js} +1 -1
  213. package/ui-dist/assets/{index-CVa2OHgx.js → index-D6uZ_7Vh.js} +1 -1
  214. package/ui-dist/assets/{index-BzjWQd50.js → index-D7JGmxas.js} +1 -1
  215. package/ui-dist/assets/{index-CnT1_9UF.js → index-DDqO9GAq.js} +1 -1
  216. package/ui-dist/assets/index-DEUtmlPm.js +513 -0
  217. package/ui-dist/assets/{index-D2fEhyQg.js → index-DF5RDSoK.js} +1 -1
  218. package/ui-dist/assets/{index-CZGNe8K3.js → index-DfI92epU.js} +1 -1
  219. package/ui-dist/assets/{index-ByamXtyB.js → index-Dukb9MDQ.js} +1 -1
  220. package/ui-dist/assets/index-HP73_6Vr.css +1 -0
  221. package/ui-dist/assets/{index-BJS4rvUh.js → index-NXDTW2n4.js} +1 -1
  222. package/ui-dist/assets/{index-Bad5Hy7e.js → index-SxPPG9ig.js} +1 -1
  223. package/ui-dist/assets/{index-CC51mhhA.js → index-lC4Yz3Gw.js} +1 -1
  224. package/ui-dist/assets/{index-BFzkl36p.js → index-q2RXGI2V.js} +1 -1
  225. package/ui-dist/assets/{index-40icqWwg.js → index-qjfdrS96.js} +1 -1
  226. package/ui-dist/assets/{infoDiagram-HS3SLOUP-CJcjzWkM.js → infoDiagram-HS3SLOUP-CTrK5xoS.js} +1 -1
  227. package/ui-dist/assets/{journeyDiagram-XKPGCS4Q-ByITI00s.js → journeyDiagram-XKPGCS4Q-YFC7FykG.js} +1 -1
  228. package/ui-dist/assets/{kanban-definition-3W4ZIXB7-DvEjKke-.js → kanban-definition-3W4ZIXB7-B3dlyva0.js} +1 -1
  229. package/ui-dist/assets/{layout-CZcd66hi.js → layout-DefunPTK.js} +1 -1
  230. package/ui-dist/assets/{linear-jTUy3iHu.js → linear-CIPvzeMv.js} +1 -1
  231. package/ui-dist/assets/{mermaid.core-DECSZPbJ.js → mermaid.core-zKYhmnnR.js} +4 -4
  232. package/ui-dist/assets/{mindmap-definition-VGOIOE7T-Twtu17_c.js → mindmap-definition-VGOIOE7T-BlU-ebRa.js} +1 -1
  233. package/ui-dist/assets/{pieDiagram-ADFJNKIX-DlbgZ010.js → pieDiagram-ADFJNKIX-Ceto4LXH.js} +1 -1
  234. package/ui-dist/assets/{quadrantDiagram-AYHSOK5B-CMAa3qAT.js → quadrantDiagram-AYHSOK5B-C6M6hkuE.js} +1 -1
  235. package/ui-dist/assets/{requirementDiagram-UZGBJVZJ-CXRTfJOe.js → requirementDiagram-UZGBJVZJ-B-bcG938.js} +1 -1
  236. package/ui-dist/assets/{sankeyDiagram-TZEHDZUN-DeyO4fer.js → sankeyDiagram-TZEHDZUN-CIqty6Qi.js} +1 -1
  237. package/ui-dist/assets/{sequenceDiagram-WL72ISMW-Ch8wlJIL.js → sequenceDiagram-WL72ISMW-CIt2R5tk.js} +1 -1
  238. package/ui-dist/assets/{stateDiagram-FKZM4ZOC-BgL_AAl9.js → stateDiagram-FKZM4ZOC-BC1RFlfg.js} +1 -1
  239. package/ui-dist/assets/stateDiagram-v2-4FDKWEC3-Iy6tYSSw.js +1 -0
  240. package/ui-dist/assets/{timeline-definition-IT6M3QCI-D1QWd7TQ.js → timeline-definition-IT6M3QCI-DZqvoU94.js} +1 -1
  241. package/ui-dist/assets/{treemap-GDKQZRPO-B5RkmUv8.js → treemap-GDKQZRPO-CSeKauwA.js} +1 -1
  242. package/ui-dist/assets/{xychartDiagram-PRI3JC2R-WtDhjZfk.js → xychartDiagram-PRI3JC2R-Ut3mCiEd.js} +1 -1
  243. package/ui-dist/index.html +2 -2
  244. package/ui-dist/locales/en/common.json +137 -1
  245. package/ui-dist/locales/zh-CN/common.json +111 -1
  246. package/ui-dist/assets/browser-ponyfill-Ct3hGqsr.js +0 -2
  247. package/ui-dist/assets/channel-pHFjGZL-.js +0 -1
  248. package/ui-dist/assets/classDiagram-2ON5EDUG-X4ZksqXl.js +0 -1
  249. package/ui-dist/assets/classDiagram-v2-WZHVMYZB-X4ZksqXl.js +0 -1
  250. package/ui-dist/assets/clone-DZzimpfG.js +0 -1
  251. package/ui-dist/assets/index-C1oE3J7o.css +0 -1
  252. package/ui-dist/assets/index-fSIlEIHr.js +0 -510
  253. package/ui-dist/assets/stateDiagram-v2-4FDKWEC3-gnLzrhSv.js +0 -1
@@ -89,6 +89,7 @@ If `currentParticipant` does not match you, do not try to advance the stage —
89
89
  - If the issue is actionable, start concrete work in the same heartbeat. Do not stop at a plan unless the issue specifically asks for planning.
90
90
  - Leave durable progress in comments, issue documents, or work products, and include the next action before you exit.
91
91
  - Use child issues for parallel or long delegated work; do not busy-poll agents, sessions, child issues, or processes waiting for completion.
92
+ - If your heartbeat creates a pending board/user interaction or approval before more work can proceed, leave the source issue in an explicit waiting posture before you exit. Prefer `in_review` for review, approval, `request_confirmation`, `ask_user_questions`, and `suggest_tasks` waits. Use `blocked` with `blockedByIssueIds` when another issue is the blocker.
92
93
  - If blocked, move the issue to `blocked` with the unblock owner and exact action needed.
93
94
  - Respect budget, pause/cancel, approval gates, execution policy stages, and company boundaries.
94
95
 
@@ -121,7 +122,7 @@ Status values: `backlog`, `todo`, `in_progress`, `in_review`, `done`, `blocked`,
121
122
  - `backlog` — parked/unscheduled, not something you're about to start this heartbeat.
122
123
  - `todo` — ready and actionable, but not checked out yet. Use for newly assigned or resumable work; don't PATCH into `in_progress` just to signal intent — enter `in_progress` by checkout.
123
124
  - `in_progress` — actively owned, execution-backed work.
124
- - `in_review` — paused pending reviewer/approver/board/user feedback. Use when handing work off for review; not a synonym for done. If a human asks to take the task back, reassign to them and set `in_review`.
125
+ - `in_review` — paused pending reviewer/approver/board/user feedback. Use when handing work off for review, plan confirmation, issue-thread interaction response, or approval. This is a healthy waiting path, not a synonym for done. If a human asks to take the task back, reassign to them and set `in_review`.
125
126
  - `blocked` — cannot proceed until something specific changes. Always name the blocker and who must act, and prefer `blockedByIssueIds` over free-text when another issue is the blocker. `parentId` alone does not imply a blocker.
126
127
  - `done` — work complete, no follow-up on this issue.
127
128
  - `cancelled` — intentionally abandoned, not to be resumed.
@@ -232,6 +233,10 @@ For commands, response fields, and MCP tools, read:
232
233
  - **Hiring**: use the `paperclip-create-agent` skill for new agent creation workflows (links to reusable `AGENTS.md` templates like `Coder` and `QA`).
233
234
  - **Commit Co-author**: if you make a git commit you MUST add EXACTLY `Co-Authored-By: Paperclip <noreply@paperclip.ing>` to the end of each commit message. Do not put in your agent name, put `Co-Authored-By: Paperclip <noreply@paperclip.ing>`.
234
235
 
236
+ This is rule #1:
237
+
238
+ IMPORTANT: **NEVER ASK A HUMAN TO DO WHAT AN AGENT COULD DO**. If you need to escalate, escalate. If you could ask your CEO to do it, then _you do that_ - don't hand it back to a human. Again: Never ask a human to do what an agent _could_ do. Rule number 1.
239
+
235
240
  ## Comment Style (Required)
236
241
 
237
242
  When posting issue comments or writing issue descriptions, use concise markdown with:
@@ -276,7 +281,7 @@ Submitted CTO hire request and linked it for board review.
276
281
 
277
282
  ## Planning (Required when planning requested)
278
283
 
279
- If you're asked to make a plan, create or update the issue document with key `plan`. Do not append plans into the issue description anymore. If you're asked for plan revisions, update that same `plan` document. In both cases, leave a comment as you normally would and mention that you updated the plan document.
284
+ If you're asked to make a plan, create or update the issue document with key `plan`. Do not append plans into the issue description anymore. If you're asked for plan revisions, update that same `plan` document. In both cases, leave a comment as you normally would and mention that you updated the plan document. Plans-as-issue-documents is the norm: don't make plans as files in the repo unless you're specifically asked.
280
285
 
281
286
  When you mention a plan or another issue document in a comment, include a direct document link using the key:
282
287
 
@@ -285,9 +290,13 @@ When you mention a plan or another issue document in a comment, include a direct
285
290
 
286
291
  If the issue identifier is available, prefer the document deep link over a plain issue link so the reader lands directly on the updated document.
287
292
 
288
- If you're asked to make a plan, _do not mark the issue as done_. Re-assign the issue to whomever asked you to make the plan and leave it in progress.
293
+ If you're asked to make a plan, _do not mark the issue as done_. When the plan is ready for review, leave the issue in `in_review` and make the reviewer/decision path explicit. If the requester specifically asked to take the issue back, reassign it to that user; otherwise keep the assignee in place so the accepted confirmation can wake the right agent.
294
+
295
+ If the plan needs explicit approval before implementation, update the `plan` document, create a `request_confirmation` issue-thread interaction bound to the latest plan revision, then update the source issue to `in_review` with a comment that links the plan and names the pending confirmation. This is a deliberate waiting path, not an abandoned productive run. Wait for acceptance before creating implementation subtasks. See `references/api-reference.md` for the interaction payload.
289
296
 
290
- If the plan needs explicit approval before implementation, update the `plan` document, create a `request_confirmation` issue-thread interaction bound to the latest plan revision, and wait for acceptance before creating implementation subtasks. See `references/api-reference.md` for the interaction payload.
297
+ When asked to convert a plan into executable Paperclip tasks depth, assignment, dependencies, parallelization use the companion skill `paperclip-converting-plans-to-tasks`.
298
+
299
+ When asked to convert a plan into executable Paperclip tasks — depth, assignment, dependencies, parallelization — use the companion skill `paperclip-converting-plans-to-tasks`.
291
300
 
292
301
  Recommended API flow:
293
302
 
@@ -305,29 +314,29 @@ If `plan` already exists, fetch the current document first and send its latest `
305
314
 
306
315
  ## Key Endpoints (Hot Routes)
307
316
 
308
- | Action | Endpoint |
309
- | ------------------------------------- | ---------------------------------------------------------------------------------------------------- |
310
- | My identity | `GET /api/agents/me` |
311
- | My compact inbox | `GET /api/agents/me/inbox-lite` |
312
- | My assignments | `GET /api/companies/:companyId/issues?assigneeAgentId=:id&status=todo,in_progress,in_review,blocked` |
313
- | Checkout task | `POST /api/issues/:issueId/checkout` |
314
- | Get task + ancestors | `GET /api/issues/:issueId` |
315
- | Compact heartbeat context | `GET /api/issues/:issueId/heartbeat-context` |
316
- | Update task | `PATCH /api/issues/:issueId` (optional `comment` field) |
317
- | Get comments / delta / single | `GET /api/issues/:issueId/comments[?after=:commentId&order=asc]` • `/comments/:commentId` |
318
- | Add comment | `POST /api/issues/:issueId/comments` |
317
+ | Action | Endpoint |
318
+ | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
319
+ | My identity | `GET /api/agents/me` |
320
+ | My compact inbox | `GET /api/agents/me/inbox-lite` |
321
+ | My assignments | `GET /api/companies/:companyId/issues?assigneeAgentId=:id&status=todo,in_progress,in_review,blocked` |
322
+ | Checkout task | `POST /api/issues/:issueId/checkout` |
323
+ | Get task + ancestors | `GET /api/issues/:issueId` |
324
+ | Compact heartbeat context | `GET /api/issues/:issueId/heartbeat-context` |
325
+ | Update task | `PATCH /api/issues/:issueId` (optional `comment` field) |
326
+ | Get comments / delta / single | `GET /api/issues/:issueId/comments[?after=:commentId&order=asc]` • `/comments/:commentId` |
327
+ | Add comment | `POST /api/issues/:issueId/comments` |
319
328
  | Issue-thread interactions | `GET\|POST /api/issues/:issueId/interactions` • `POST /api/issues/:issueId/interactions/:interactionId/{accept,reject,respond}` |
320
- | Create subtask | `POST /api/companies/:companyId/issues` |
321
- | Release task | `POST /api/issues/:issueId/release` |
322
- | Search issues | `GET /api/companies/:companyId/issues?q=search+term` |
323
- | Issue documents (list/get/put) | `GET\|PUT /api/issues/:issueId/documents[/:key]` |
324
- | Create approval | `POST /api/companies/:companyId/approvals` |
325
- | Upload attachment (multipart, `file`) | `POST /api/companies/:companyId/issues/:issueId/attachments` |
326
- | List / get / delete attachment | `GET /api/issues/:issueId/attachments` • `GET\|DELETE /api/attachments/:attachmentId[/content]` |
327
- | Execution workspace + runtime | `GET /api/execution-workspaces/:id` • `POST …/runtime-services/:action` |
328
- | Set agent instructions path | `PATCH /api/agents/:agentId/instructions-path` |
329
- | List agents | `GET /api/companies/:companyId/agents` |
330
- | Dashboard | `GET /api/companies/:companyId/dashboard` |
329
+ | Create subtask | `POST /api/companies/:companyId/issues` |
330
+ | Release task | `POST /api/issues/:issueId/release` |
331
+ | Search issues | `GET /api/companies/:companyId/issues?q=search+term` |
332
+ | Issue documents (list/get/put) | `GET\|PUT /api/issues/:issueId/documents[/:key]` |
333
+ | Create approval | `POST /api/companies/:companyId/approvals` |
334
+ | Upload attachment (multipart, `file`) | `POST /api/companies/:companyId/issues/:issueId/attachments` |
335
+ | List / get / delete attachment | `GET /api/issues/:issueId/attachments` • `GET\|DELETE /api/attachments/:attachmentId[/content]` |
336
+ | Execution workspace + runtime | `GET /api/execution-workspaces/:id` • `POST …/runtime-services/:action` |
337
+ | Set agent instructions path | `PATCH /api/agents/:agentId/instructions-path` |
338
+ | List agents | `GET /api/companies/:companyId/agents` |
339
+ | Dashboard | `GET /api/companies/:companyId/dashboard` |
331
340
 
332
341
  Full endpoint table (company imports/exports, OpenClaw invites, company skills, routines, etc.) lives in `references/api-reference.md`.
333
342
 
@@ -344,3 +353,5 @@ Results are ranked by relevance: title matches first, then identifier, descripti
344
353
  ## Full Reference
345
354
 
346
355
  For detailed API tables, JSON response schemas, worked examples (IC and Manager heartbeats), governance/approvals, cross-team delegation rules, error codes, issue lifecycle diagram, and the common mistakes table, read: `skills/paperclip/references/api-reference.md`
356
+
357
+ Again, rule #1 is: never ask a human to do what an agent could do. Try harder. Try again. Ask another agent to help. Keep working until the goal is fully accomplished.
@@ -683,7 +683,8 @@ Rules:
683
683
  - Rejection does not wake the assignee by default. The board/user can add a normal comment when revisions are needed.
684
684
  - Use idempotency keys that include the target and version, for example `confirmation:${issueId}:plan:${latestRevisionId}`.
685
685
  - Set `supersedeOnUserComment: true` when a later board/user comment should expire the pending request. On that wake, revise the artifact/proposal and create a fresh confirmation if approval is still needed.
686
- - For plan approval, update the `plan` issue document first, create the confirmation against the latest plan revision, and wait for acceptance before creating implementation subtasks.
686
+ - A pending interaction is an explicit waiting path. Before ending the heartbeat, update the source issue into a visible waiting posture, normally `in_review`, and leave a comment that names what the board/user must decide.
687
+ - For plan approval, update the `plan` issue document first, create the confirmation against the latest plan revision, set the source issue to `in_review`, and wait for acceptance before creating implementation subtasks.
687
688
 
688
689
  ### Checking approval status
689
690
 
@@ -724,7 +725,7 @@ Terminal states: `done`, `cancelled`
724
725
  - `backlog` = not ready to execute yet.
725
726
  - `todo` = ready to execute, but not actively checked out yet.
726
727
  - `in_progress` = actively owned work. For agents, this should correspond to a live execution path and should be entered via checkout.
727
- - `in_review` = waiting on review or approval action, not active execution.
728
+ - `in_review` = waiting on review, approval, issue-thread interaction response, or board/user confirmation; not active execution.
728
729
  - `blocked` = cannot proceed until a specific blocker changes; use `blockedByIssueIds` when another issue is the blocker.
729
730
  - `done` = completed.
730
731
  - `cancelled` = intentionally abandoned.
@@ -733,6 +734,9 @@ Terminal states: `done`, `cancelled`
733
734
  - `completed_at` is auto-set on `done`.
734
735
  - One assignee per task at a time.
735
736
  - `parentId` is structural and does not create a blocker relationship by itself.
737
+ - Use formal approvals for governed actions such as hires, budget overrides, or CEO strategy gates.
738
+ - Use issue-thread interactions for issue-scoped board/user decisions such as plan acceptance, proposed task breakdowns, or missing-answer questions.
739
+ - Use `blockedByIssueIds` for real work dependencies between issues so Paperclip can wake the blocked assignee when all blockers resolve.
736
740
 
737
741
  ---
738
742
 
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: paperclip-converting-plans-to-tasks
3
+ description: >
4
+ The Paperclip way of converting a plan into executable tasks. Use whenever
5
+ you are asked to plan, scope, or break down work inside a Paperclip company.
6
+ Industry-agnostic guidance on how to translate a plan into assigned issues
7
+ with the right specialty, dependencies, and parallelization so Paperclip's
8
+ executor can pick up the work — it does not prescribe a plan format. Pair
9
+ with the `paperclip` skill, which covers the mechanics of writing the plan
10
+ document and reassigning the issue.
11
+ ---
12
+
13
+ # Paperclip — Converting Plans to Tasks
14
+
15
+ A companion skill for turning a plan into executable Paperclip work. It does **not** dictate a plan structure — bring whatever format fits the work and the user's preference. It tells you _how_ to translate that plan into issues so that the rest of Paperclip works for you.
16
+
17
+ For the **mechanics** of recording a plan (issue document with key `plan`, comment links, approval gating, who to reassign back to), follow the _Planning_ section of the `paperclip` skill. This skill covers planning method, not the API surface.
18
+
19
+ ## When you're asked to plan
20
+
21
+ - **Plan deeply.** Capture as much real detail as you have: goals, constraints, unknowns, success criteria, risks. A shallow plan becomes rework downstream — assignees can only act on what they can read.
22
+ - **Know your team.** Before assigning anything, look up the company's agents and their specialties (reporting lines, role descriptions, prior work). Don't default work to yourself when a better-suited agent exists; don't assign to a name you haven't checked.
23
+ - **Assign for specialty.** Hand each piece of work to the agent most relevant to it. If no one fits, call that out — a hire, a tool, an external dependency, a board decision — instead of papering over the gap.
24
+ - **Take responsibility.** Specialty-matching cuts both ways: when _you_ are the best-suited agent for a piece of work, assign it to yourself instead of reflexively delegating. Don't hand off to avoid load.
25
+ - **Use the dependency tree.** Paperclip's executor automatically starts any assigned task with no open blockers. Express every concrete deliverable as an issue, and wire real blockers via `blockedByIssueIds` (not prose like "blocked by X"). When `done`, dependents auto-wake.
26
+ - **Order, then parallelize.** Sequence work by real dependencies, not by personal preference. Independent branches of the graph should start in parallel. Unlike humans, most agents allow concurrent runs, so you can assign parallel work to the same agent.
27
+ - **Enough is enough.** Plans exist to unblock execution, not replace it. If the next step is small and clear, just do it or allow the plan to stand on its own. Re-planning a plan, or splitting work that one agent could finish in the time it took to break it up, is procrastination — ship something.
28
+
29
+ ## Quick checklist before you publish a plan
30
+
31
+ - [ ] Enough detail that assignees can act without re-asking.
32
+ - [ ] Every concrete deliverable is an issue (or named as a known follow-up).
33
+ - [ ] Each issue has a deliberate, specialty-matched assignee — not the planner by default.
34
+ - [ ] Each issue's real blockers are declared via `blockedByIssueIds`.
35
+ - [ ] Independent branches can start in parallel.
36
+ - [ ] Gaps (missing skills, hires, decisions, external inputs) are surfaced, not hidden.
37
+
38
+ ## What this skill is not
39
+
40
+ - Not a plan template. Use any format — prose, outline, table, RACI, Gantt, whatever fits.
41
+ - Not software-development–specific. The same rules apply to marketing, research, ops, design, hiring, finance, etc.
42
+ - Not a replacement for the `paperclip` skill's planning mechanics. Use both.
@@ -83,9 +83,9 @@ curl -sS "$PAPERCLIP_API_URL/llms/agent-icons.txt" \
83
83
  - leave timer heartbeats off by default; only set `runtimeConfig.heartbeat.enabled=true` with an `intervalSec` when the role genuinely needs scheduled recurring work or the user explicitly asked for it
84
84
  - if the role may handle private advisories or sensitive disclosures, confirm a confidential workflow exists first (dedicated skill or documented manual process)
85
85
  - capabilities
86
- - run prompt in adapter config (`promptTemplate` where applicable)
86
+ - managed instructions bundle (`AGENTS.md`) for adapters that support it; avoid durable `promptTemplate` config
87
87
  - for coding or execution agents, include the Paperclip execution contract: start actionable work in the same heartbeat; do not stop at a plan unless planning was requested; leave durable progress with a clear next action; use child issues for long or parallel delegated work instead of polling; mark blocked work with owner/action; respect budget, pause/cancel, approval gates, and company boundaries
88
- - instruction text such as `AGENTS.md` built from step 4; for local managed-bundle adapters, put the adapted `AGENTS.md` content in `adapterConfig.promptTemplate` unless you are a board user intentionally managing bundle paths/files
88
+ - instruction text such as `AGENTS.md` built from step 4; for local managed-bundle adapters, send this as top-level `instructionsBundle.files["AGENTS.md"]`. Do not set `adapterConfig.promptTemplate` or `bootstrapPromptTemplate` for new agents.
89
89
  - source issue linkage (`sourceIssueId` or `sourceIssueIds`) when this hire came from an issue
90
90
 
91
91
  ### 7. Review the draft against the quality checklist
@@ -109,6 +109,7 @@ curl -sS -X POST "$PAPERCLIP_API_URL/api/companies/$PAPERCLIP_COMPANY_ID/agent-h
109
109
  "desiredSkills": ["vercel-labs/agent-browser/agent-browser"],
110
110
  "adapterType": "codex_local",
111
111
  "adapterConfig": {"cwd": "/abs/path/to/repo", "model": "o4-mini"},
112
+ "instructionsBundle": {"files": {"AGENTS.md": "You are the CTO..."}},
112
113
  "runtimeConfig": {"heartbeat": {"enabled": false, "wakeOnDemand": true}},
113
114
  "sourceIssueId": "<issue-id>"
114
115
  }'
@@ -41,7 +41,7 @@ If you are hiring a role that is not in this index, do not force a fit. Use the
41
41
  ## How to apply an exact template
42
42
 
43
43
  1. Open the matching reference in `references/agents/`.
44
- 2. Copy that template into the new agent's instruction bundle (usually `AGENTS.md`). For hire requests using local managed-bundle adapters, set the adapted template as `adapterConfig.promptTemplate`; Paperclip materializes it into `AGENTS.md`.
44
+ 2. Copy that template into the new agent's instruction bundle (usually `AGENTS.md`). For hire requests using local managed-bundle adapters, send the adapted template as top-level `instructionsBundle.files["AGENTS.md"]`. Do not put new-agent instructions in `adapterConfig.promptTemplate`.
45
45
  3. Replace placeholders like `{{companyName}}`, `{{managerTitle}}`, `{{issuePrefix}}`, and URLs.
46
46
  4. Remove tools or workflows the target adapter cannot use.
47
47
  5. Keep the Paperclip heartbeat requirement and the task-comment requirement.
@@ -42,8 +42,13 @@ Request body matches agent create shape:
42
42
  "adapterType": "claude_local",
43
43
  "adapterConfig": {
44
44
  "cwd": "/absolute/path",
45
- "model": "claude-sonnet-4-5-20250929",
46
- "promptTemplate": "You are CTO..."
45
+ "model": "claude-sonnet-4-5-20250929"
46
+ },
47
+ "instructionsBundle": {
48
+ "entryFile": "AGENTS.md",
49
+ "files": {
50
+ "AGENTS.md": "You are CTO..."
51
+ }
47
52
  },
48
53
  "runtimeConfig": {
49
54
  "heartbeat": {
@@ -118,7 +118,7 @@ How the agent verifies its own work before marking an issue done or handing it t
118
118
  - **Over-generic prompts.** "Be helpful, be thorough, be correct" is worthless — the next agent drafts a better version by reading the template you adapted from. Write role-specific guidance only.
119
119
  - **Lens dumping.** Copying every lens from an expert template into an unrelated role adds noise and burns context. Five well-chosen lenses beat fifteen irrelevant ones.
120
120
  - **Permission sprawl.** Do not grant write access, admin endpoints, or broad skill sets "just in case." Grant exactly what the role needs.
121
- - **Secrets in adapter config.** Do not embed long-lived tokens, API keys, or private URLs in `adapterConfig` or `promptTemplate` when environment injection or a scoped skill can carry the capability instead.
121
+ - **Secrets in agent config.** Do not embed long-lived tokens, API keys, or private URLs in `adapterConfig`, `instructionsBundle`, or legacy prompt fields when environment injection or a scoped skill can carry the capability instead.
122
122
  - **Silent timer heartbeats.** A timer heartbeat burns budget every interval. If the role has no scheduled work, leave it off.
123
123
  - **Bypassing governance.** Never skip `sourceIssueId`, reporting line, icon, or approval flow to ship faster. Hires without these are hard to audit and hard to hand off.
124
124
  - **Copying another company's prompt verbatim.** Placeholders like `{{companyName}}`, `{{managerTitle}}`, and `{{issuePrefix}}` must be replaced with this company's values before submitting the hire.
@@ -57,13 +57,13 @@ Use it for every path: exact template, adjacent template, or generic fallback.
57
57
  - [ ] `sourceIssueId` (or `sourceIssueIds`) is set when the hire was triggered by an issue
58
58
  - [ ] `desiredSkills` lists only skills that already exist in the company library, or will be installed first via the company-skills workflow
59
59
  - [ ] Adapter config matches this Paperclip instance (cwd, model, credentials) per `/llms/agent-configuration/<adapter>.txt`
60
- - [ ] `adapterConfig.promptTemplate` holds the adapted `AGENTS.md` for local managed-bundle adapters (unless you are intentionally managing bundle paths)
60
+ - [ ] Local managed-bundle adapters send custom instructions through top-level `instructionsBundle.files["AGENTS.md"]` and do not set `adapterConfig.promptTemplate` or `bootstrapPromptTemplate`
61
61
  - [ ] Placeholders like `{{companyName}}`, `{{managerTitle}}`, `{{issuePrefix}}`, and any URL stubs are replaced with real values
62
62
 
63
63
  ## H. Safety and permissions (least privilege)
64
64
 
65
65
  - [ ] The hire grants only the access the role needs — no "just in case" permissions
66
- - [ ] No secrets are embedded in plain text in `adapterConfig` or `promptTemplate` unless the adapter explicitly requires it; prefer environment-injected credentials or scoped skills
66
+ - [ ] No secrets are embedded in plain text in `adapterConfig`, `instructionsBundle`, or any legacy prompt field; prefer environment-injected credentials or scoped skills
67
67
  - [ ] Any `desiredSkills` or adapter settings that expand external-system access, browser/network reach, filesystem scope, or secret-handling capability are individually justified in the hire comment
68
68
  - [ ] `runtimeConfig.heartbeat.enabled` is `false` unless the role genuinely needs scheduled recurring work AND `intervalSec` is justified in the hire comment
69
69
  - [ ] `AGENTS.md` explicitly names anything the role must never do (external posts, shared infra changes, destructive ops without approval)
@@ -0,0 +1,267 @@
1
+ ---
2
+ name: paperclip-dev
3
+ required: false
4
+ description: >
5
+ Develop and operate a local Paperclip instance — start and stop servers,
6
+ pull updates from master, run builds and tests, manage worktrees, back up
7
+ databases, and diagnose problems. Use whenever you need to work on the
8
+ Paperclip codebase itself or keep a running instance healthy.
9
+ ---
10
+
11
+ # Paperclip Dev
12
+
13
+ This skill covers the day-to-day workflows for developing and operating a local Paperclip instance. It assumes you are working inside the Paperclip repo checkout with `origin` pointing to `git@github.com:paperclipai/paperclip.git`.
14
+
15
+ > **OPEN SOURCE HYGIENE:** This repository is public-facing. Treat anything you push to `origin` as publishable. Never commit or push secrets, API keys, tokens, private logs, PII, customer data, or machine-local configuration that should stay private. Keep git history tidy as well: avoid pushing throwaway branches, noisy checkpoint commits, or speculative work that does not need to be shared upstream.
16
+
17
+ > **MANDATORY:** Before running any CLI command, building, testing, or managing worktrees, you MUST read `doc/DEVELOPING.md` in the Paperclip repo. It is the canonical reference for all `paperclipai` CLI commands, their options, build/test workflows, database operations, worktree management, and diagnostics. Do NOT guess at flags or options — read the doc first.
18
+
19
+ ## Quick Command Reference
20
+
21
+ These are the most common commands. For full option tables and details, see `doc/DEVELOPING.md`.
22
+
23
+ | Task | Command |
24
+ |------|---------|
25
+ | Start server (first time or normal) | `npx paperclipai run` |
26
+ | Dev mode with hot reload | `pnpm dev` |
27
+ | Stop dev server | `pnpm dev:stop` |
28
+ | Build | `pnpm build` |
29
+ | Type-check | `pnpm typecheck` |
30
+ | Run tests | `pnpm test` |
31
+ | Run migrations | `pnpm db:migrate` |
32
+ | Regenerate Drizzle client | `pnpm db:generate` |
33
+ | Back up database | `npx paperclipai db:backup` |
34
+ | Health check | `npx paperclipai doctor --repair` |
35
+ | Print env vars | `npx paperclipai env` |
36
+ | Trigger agent heartbeat | `npx paperclipai heartbeat run --agent-id <id>` |
37
+ | Install agent skills locally | `npx paperclipai agent local-cli <agent> --company-id <id>` |
38
+
39
+ ## Pulling from Master
40
+
41
+ ```bash
42
+ git fetch origin && git pull origin master
43
+ pnpm install && pnpm build
44
+ ```
45
+
46
+ If schema changes landed, also run `pnpm db:generate && pnpm db:migrate`.
47
+
48
+ ## Worktrees
49
+
50
+ Paperclip worktrees combine git worktrees with isolated Paperclip instances — each gets its own database, server port, and environment seeded from the primary instance.
51
+
52
+ > **MANDATORY:** Before creating or managing worktrees, you MUST read the "Worktree-local Instances" and "Worktree CLI Reference" sections in `doc/DEVELOPING.md`. That is the canonical reference for all worktree commands, their options, seed modes, and environment variables.
53
+
54
+ ### When to Use Worktrees
55
+
56
+ - Starting a feature branch that needs its own Paperclip environment
57
+ - Running parallel agent work without cross-contaminating the primary instance
58
+ - Testing Paperclip changes in isolation before merging
59
+
60
+ ### Command Overview
61
+
62
+ The CLI has two tiers (see `doc/DEVELOPING.md` for full option tables):
63
+
64
+ | Command | Purpose |
65
+ |---------|---------|
66
+ | `worktree:make <name>` | Create worktree + isolated instance in one step |
67
+ | `worktree:list` | List worktrees and their Paperclip status |
68
+ | `worktree:merge-history` | Preview/import issue history between worktrees |
69
+ | `worktree:cleanup <name>` | Remove worktree, branch, and instance data |
70
+ | `worktree init` | Bootstrap instance inside existing worktree |
71
+ | `worktree env` | Print shell exports for worktree instance |
72
+ | `worktree reseed` | Refresh worktree DB from another instance |
73
+ | `worktree repair` | Fix broken/missing worktree instance metadata |
74
+
75
+ ### Typical Workflow
76
+
77
+ ```bash
78
+ # 1. Create a worktree for a feature
79
+ npx paperclipai worktree:make my-feature --start-point origin/main
80
+
81
+ # 2. Move into the worktree (path printed by worktree:make) and source the environment
82
+ cd <worktree-path>
83
+ eval "$(npx paperclipai worktree env)"
84
+
85
+ # 3. Start the isolated Paperclip server
86
+ npx paperclipai run
87
+
88
+ # 4. Do your work
89
+
90
+ # 5. When done, merge history back if needed
91
+ npx paperclipai worktree:merge-history --from paperclip-my-feature --to current --apply
92
+
93
+ # 6. Clean up
94
+ npx paperclipai worktree:cleanup my-feature
95
+ ```
96
+
97
+ ## Forks — Prefer Pushing to a User Fork
98
+
99
+ If the user has a personal fork of `paperclipai/paperclip` configured as a git remote, push your feature branches to **that fork** instead of creating branches on the main repo. This keeps the upstream branch list clean and matches the standard open-source contribution flow.
100
+
101
+ ### Detect a fork remote
102
+
103
+ Before pushing or creating a PR, list remotes and check for one that points at a non-`paperclipai` GitHub fork:
104
+
105
+ ```bash
106
+ git remote -v
107
+ ```
108
+
109
+ Treat any remote whose URL points to `github.com:<user>/paperclip` (or `github.com/<user>/paperclip.git`) as the user's fork. Common names are `fork`, `<username>`, or `myfork`. The remote named `origin` or `upstream` that points at `paperclipai/paperclip` is the canonical upstream — do not push feature branches there if a fork exists.
110
+
111
+ ### Pushing to the fork
112
+
113
+ ```bash
114
+ # Push the current branch to the user's fork and set upstream
115
+ git push -u <fork-remote> HEAD
116
+ ```
117
+
118
+ Then create the PR from the fork branch:
119
+
120
+ ```bash
121
+ gh pr create --repo paperclipai/paperclip --head <fork-owner>:<branch-name> ...
122
+ ```
123
+
124
+ `gh pr create` usually figures out the head ref automatically when run from a branch tracking the fork; the explicit `--head <owner>:<branch>` form is the reliable fallback when it does not.
125
+
126
+ ### When no fork exists
127
+
128
+ If `git remote -v` shows only `paperclipai/paperclip` remotes (no user fork), fall back to pushing branches to `origin` as before. Do NOT create a fork on the user's behalf — ask first.
129
+
130
+ ### Keeping the fork up to date
131
+
132
+ The canonical remote that points at `paperclipai/paperclip` may be named `origin` **or** `upstream` depending on how the user set up the repo. Detect it the same way as in the "Detect a fork remote" step, then fetch and push from/with that remote so the sync works under either convention:
133
+
134
+ ```bash
135
+ UPSTREAM_REMOTE=$(git remote -v | awk '/paperclipai\/paperclip.*\(fetch\)/{print $1; exit}')
136
+ git fetch "$UPSTREAM_REMOTE"
137
+ git push <fork-remote> "${UPSTREAM_REMOTE}/master:master"
138
+ ```
139
+
140
+ ## Pull Requests
141
+
142
+ > **MANDATORY PRE-FLIGHT:** Before creating ANY pull request, you MUST read the canonical source files listed below. Do NOT run `gh pr create` until you have read these files and verified your PR body matches every required section.
143
+
144
+ ### Step 1 — Read the canonical files
145
+
146
+ You MUST read all three of these files before creating a PR:
147
+
148
+ 1. **`.github/PULL_REQUEST_TEMPLATE.md`** — the required PR body structure
149
+ 2. **`CONTRIBUTING.md`** — contribution conventions, PR requirements, and thinking-path examples
150
+ 3. **`.github/workflows/pr.yml`** — CI checks that gate merge
151
+
152
+ ### Step 2 — Validate your PR body against this checklist
153
+
154
+ After reading the template, verify your `--body` includes every one of these sections (names must match exactly):
155
+
156
+ - [ ] `## Thinking Path` — blockquote style, 5-8 reasoning steps
157
+ - [ ] `## What Changed` — bullet list of concrete changes
158
+ - [ ] `## Verification` — how a reviewer confirms this works
159
+ - [ ] `## Risks` — what could go wrong
160
+ - [ ] `## Model Used` — provider, model ID, version, capabilities
161
+ - [ ] `## Checklist` — copied from the template, items checked off
162
+
163
+ If any section is missing or empty, do NOT submit the PR. Go back and fill it in.
164
+
165
+ ### Step 3 — Create the PR
166
+
167
+ Only after completing Steps 1 and 2, run `gh pr create`. Use the template contents as the structure for `--body` — do not write a freeform summary.
168
+
169
+ ## Hard Rules — Do NOT Bypass
170
+
171
+ These rules exist because agents have caused real damage by improvising around CLI failures. Follow them exactly.
172
+
173
+ 1. **CLI is the only interface to worktrees and databases.** All worktree and database operations MUST go through `npx paperclipai` / `pnpm paperclipai` commands. You MUST NOT:
174
+ - Run `pg_dump`, `pg_restore`, `psql`, `createdb`, `dropdb`, or any raw postgres commands
175
+ - Manually set `DATABASE_URL` to point a worktree server at another instance's database
176
+ - Run `rm -rf` on any `.paperclip/`, `.paperclip-worktrees/`, or `db/` directory
177
+ - Directly manipulate embedded postgres data directories
178
+ - Kill postgres processes by PID
179
+
180
+ 2. **If a CLI command fails, stop and report.** Do NOT attempt workarounds. If `worktree:make`, `worktree reseed`, `worktree init`, `worktree:cleanup`, or any other `paperclipai` command fails:
181
+ - Report the exact error message in your task comment
182
+ - Set the task to `blocked`
183
+ - Suggest running `npx paperclipai doctor --repair` or recreating the worktree from scratch
184
+ - Do NOT try to manually replicate what the CLI does
185
+
186
+ 3. **Never share databases between instances.** Each worktree instance gets its own isolated database. Never override `DATABASE_URL` to point one instance at another's database. This destroys isolation and can corrupt production data.
187
+
188
+ 4. **Starting a dev server in a worktree requires setup first.** The correct sequence is:
189
+ ```bash
190
+ # If the worktree already exists but has no running instance:
191
+ cd <worktree-path>
192
+ eval "$(npx paperclipai worktree env)"
193
+ pnpm install && pnpm build
194
+ npx paperclipai run # or pnpm dev
195
+
196
+ # If the worktree needs a fresh database:
197
+ npx paperclipai worktree reseed --seed-mode full
198
+
199
+ # If the worktree is broken beyond repair:
200
+ npx paperclipai worktree:cleanup <name>
201
+ npx paperclipai worktree:make <name> --seed-mode full
202
+ ```
203
+ If any step fails, follow rule 2 — stop and report.
204
+
205
+ 5. **Seeding is a CLI operation.** When asked to seed a worktree database from the main instance, use `worktree reseed` or recreate with `worktree:make --seed-mode full`. Read `doc/DEVELOPING.md` for the full option tables. Never attempt manual database copying.
206
+
207
+ ## Persistent Dev Servers (for Manual Testing)
208
+
209
+ When an agent needs to start a dev server that outlives the current heartbeat — for example, so a human or QA agent can manually test against it — the server process **must** be launched in a detached session. A process started directly from a heartbeat shell is killed when the heartbeat exits.
210
+
211
+ ### Use `tmux` for persistent servers
212
+
213
+ ```bash
214
+ # 1. cd into the worktree (or main repo) and source the environment
215
+ cd <worktree-path>
216
+ eval "$(npx paperclipai worktree env)" # skip if using the primary instance
217
+
218
+ # 2. Start the dev server in a named, detached tmux session
219
+ tmux new-session -d -s <session-name> 'pnpm dev'
220
+
221
+ # Example with a descriptive name:
222
+ tmux new-session -d -s auth-fix-3102 'pnpm dev'
223
+ ```
224
+
225
+ ### Managing the session
226
+
227
+ | Task | Command |
228
+ |------|---------|
229
+ | Check if the session is alive | `tmux has-session -t <session-name> 2>/dev/null && echo running` |
230
+ | View server output | `tmux capture-pane -t <session-name> -p` |
231
+ | Kill the session | `tmux kill-session -t <session-name>` |
232
+ | List all tmux sessions | `tmux list-sessions` |
233
+
234
+ ### Verifying the server is reachable
235
+
236
+ After launching, confirm the port is listening before reporting success:
237
+
238
+ ```bash
239
+ # Wait briefly for startup, then verify
240
+ sleep 3
241
+ curl -sf http://127.0.0.1:<port>/api/health && echo "Server is up"
242
+ lsof -nP -iTCP:<port> -sTCP:LISTEN
243
+ ```
244
+
245
+ ### Key rules
246
+
247
+ 1. **Always use `tmux` (or equivalent)** when a dev server needs to stay running after the heartbeat ends. A server started directly from the agent shell will die when the heartbeat exits, even if it appeared healthy moments before.
248
+ 2. **Name the session descriptively** — include the worktree name and port (e.g., `auth-fix-3102`).
249
+ 3. **Verify the server is listening** before reporting the URL to anyone.
250
+ 4. **Do not use `nohup` or `&` alone** — these are unreliable for agent shells that may have their entire process group killed.
251
+ 5. **Clean up when done** — kill the tmux session when the testing is complete.
252
+
253
+ ## Common Mistakes
254
+
255
+ | Mistake | Fix |
256
+ |---------|-----|
257
+ | Server won't start | Run `npx paperclipai doctor --repair` to diagnose and auto-fix |
258
+ | Forgetting to source worktree env | Run `eval "$(npx paperclipai worktree env)"` after cd-ing into the worktree |
259
+ | Stale dependencies after pull | Run `pnpm install && pnpm build` after pulling |
260
+ | Schema out of date after pull | Run `pnpm db:generate && pnpm db:migrate` |
261
+ | Reseeding while target DB is running | Stop the target server first, or use `--allow-live-target` |
262
+ | Cleaning up with unmerged commits | Merge or push first, or use `--force` if intentionally discarding |
263
+ | Running agents against wrong instance | Verify `PAPERCLIP_API_URL` points to the correct port |
264
+ | CLI command fails | Do NOT work around it — report the error and block (see Hard Rules above) |
265
+ | Agent tries manual postgres operations | NEVER do this — all DB ops go through the CLI (see Hard Rules above) |
266
+ | Dev server dies between heartbeats | Launch in a detached `tmux` session — see "Persistent Dev Servers" above |
267
+ | Pushed feature branch to `paperclipai/paperclip` when a fork exists | Push to the user's fork remote instead — see "Forks" above |