@microvac/adapter-claude-local 0.0.0-stage → 0.1.0-rc.14

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 (242) hide show
  1. package/dist/cli/format-event.d.ts +2 -0
  2. package/dist/cli/format-event.d.ts.map +1 -0
  3. package/dist/cli/format-event.js +141 -0
  4. package/dist/cli/format-event.js.map +1 -0
  5. package/dist/cli/index.d.ts +2 -0
  6. package/dist/cli/index.d.ts.map +1 -0
  7. package/dist/cli/index.js +2 -0
  8. package/dist/cli/index.js.map +1 -0
  9. package/dist/cli/quota-probe.d.ts +3 -0
  10. package/dist/cli/quota-probe.d.ts.map +1 -0
  11. package/dist/cli/quota-probe.js +106 -0
  12. package/dist/cli/quota-probe.js.map +1 -0
  13. package/dist/index.d.ts +13 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +99 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/index.test.d.ts +2 -0
  18. package/dist/index.test.d.ts.map +1 -0
  19. package/dist/index.test.js +72 -0
  20. package/dist/index.test.js.map +1 -0
  21. package/dist/server/acp-billing.d.ts +13 -0
  22. package/dist/server/acp-billing.d.ts.map +1 -0
  23. package/dist/server/acp-billing.js +28 -0
  24. package/dist/server/acp-billing.js.map +1 -0
  25. package/dist/server/acp.auth.test.d.ts +2 -0
  26. package/dist/server/acp.auth.test.d.ts.map +1 -0
  27. package/dist/server/acp.auth.test.js +588 -0
  28. package/dist/server/acp.auth.test.js.map +1 -0
  29. package/dist/server/acp.d.ts +69 -0
  30. package/dist/server/acp.d.ts.map +1 -0
  31. package/dist/server/acp.js +882 -0
  32. package/dist/server/acp.js.map +1 -0
  33. package/dist/server/acp.quota.test.d.ts +2 -0
  34. package/dist/server/acp.quota.test.d.ts.map +1 -0
  35. package/dist/server/acp.quota.test.js +168 -0
  36. package/dist/server/acp.quota.test.js.map +1 -0
  37. package/dist/server/acp.test.d.ts +2 -0
  38. package/dist/server/acp.test.d.ts.map +1 -0
  39. package/dist/server/acp.test.js +1645 -0
  40. package/dist/server/acp.test.js.map +1 -0
  41. package/dist/server/auth-check.d.ts +8 -0
  42. package/dist/server/auth-check.d.ts.map +1 -0
  43. package/dist/server/auth-check.js +8 -0
  44. package/dist/server/auth-check.js.map +1 -0
  45. package/dist/server/claude-config.d.ts +73 -0
  46. package/dist/server/claude-config.d.ts.map +1 -0
  47. package/dist/server/claude-config.js +408 -0
  48. package/dist/server/claude-config.js.map +1 -0
  49. package/dist/server/claude-config.test.d.ts +2 -0
  50. package/dist/server/claude-config.test.d.ts.map +1 -0
  51. package/dist/server/claude-config.test.js +376 -0
  52. package/dist/server/claude-config.test.js.map +1 -0
  53. package/dist/server/cli-capabilities.d.ts +39 -0
  54. package/dist/server/cli-capabilities.d.ts.map +1 -0
  55. package/dist/server/cli-capabilities.js +149 -0
  56. package/dist/server/cli-capabilities.js.map +1 -0
  57. package/dist/server/cli-capabilities.test.d.ts +2 -0
  58. package/dist/server/cli-capabilities.test.d.ts.map +1 -0
  59. package/dist/server/cli-capabilities.test.js +35 -0
  60. package/dist/server/cli-capabilities.test.js.map +1 -0
  61. package/dist/server/config-schema.d.ts +3 -0
  62. package/dist/server/config-schema.d.ts.map +1 -0
  63. package/dist/server/config-schema.js +67 -0
  64. package/dist/server/config-schema.js.map +1 -0
  65. package/dist/server/engine-availability.test.d.ts +2 -0
  66. package/dist/server/engine-availability.test.d.ts.map +1 -0
  67. package/dist/server/engine-availability.test.js +70 -0
  68. package/dist/server/engine-availability.test.js.map +1 -0
  69. package/dist/server/execute.acp-fallback.test.d.ts +2 -0
  70. package/dist/server/execute.acp-fallback.test.d.ts.map +1 -0
  71. package/dist/server/execute.acp-fallback.test.js +104 -0
  72. package/dist/server/execute.acp-fallback.test.js.map +1 -0
  73. package/dist/server/execute.d.ts +23 -0
  74. package/dist/server/execute.d.ts.map +1 -0
  75. package/dist/server/execute.js +1212 -0
  76. package/dist/server/execute.js.map +1 -0
  77. package/dist/server/execute.max-turns-classification.test.d.ts +2 -0
  78. package/dist/server/execute.max-turns-classification.test.d.ts.map +1 -0
  79. package/dist/server/execute.max-turns-classification.test.js +82 -0
  80. package/dist/server/execute.max-turns-classification.test.js.map +1 -0
  81. package/dist/server/execute.remote.test.d.ts +2 -0
  82. package/dist/server/execute.remote.test.d.ts.map +1 -0
  83. package/dist/server/execute.remote.test.js +830 -0
  84. package/dist/server/execute.remote.test.js.map +1 -0
  85. package/dist/server/index.d.ts +16 -0
  86. package/dist/server/index.d.ts.map +1 -0
  87. package/dist/server/index.js +97 -0
  88. package/dist/server/index.js.map +1 -0
  89. package/dist/server/model-order.d.ts +14 -0
  90. package/dist/server/model-order.d.ts.map +1 -0
  91. package/dist/server/model-order.js +87 -0
  92. package/dist/server/model-order.js.map +1 -0
  93. package/dist/server/model-order.test.d.ts +2 -0
  94. package/dist/server/model-order.test.d.ts.map +1 -0
  95. package/dist/server/model-order.test.js +82 -0
  96. package/dist/server/model-order.test.js.map +1 -0
  97. package/dist/server/models.d.ts +13 -0
  98. package/dist/server/models.d.ts.map +1 -0
  99. package/dist/server/models.js +163 -0
  100. package/dist/server/models.js.map +1 -0
  101. package/dist/server/parse.d.ts +101 -0
  102. package/dist/server/parse.d.ts.map +1 -0
  103. package/dist/server/parse.js +504 -0
  104. package/dist/server/parse.js.map +1 -0
  105. package/dist/server/parse.test.d.ts +2 -0
  106. package/dist/server/parse.test.d.ts.map +1 -0
  107. package/dist/server/parse.test.js +432 -0
  108. package/dist/server/parse.test.js.map +1 -0
  109. package/dist/server/permissions.d.ts +14 -0
  110. package/dist/server/permissions.d.ts.map +1 -0
  111. package/dist/server/permissions.js +13 -0
  112. package/dist/server/permissions.js.map +1 -0
  113. package/dist/server/permissions.test.d.ts +2 -0
  114. package/dist/server/permissions.test.d.ts.map +1 -0
  115. package/dist/server/permissions.test.js +22 -0
  116. package/dist/server/permissions.test.js.map +1 -0
  117. package/dist/server/probe-diagnostics.d.ts +102 -0
  118. package/dist/server/probe-diagnostics.d.ts.map +1 -0
  119. package/dist/server/probe-diagnostics.js +140 -0
  120. package/dist/server/probe-diagnostics.js.map +1 -0
  121. package/dist/server/probe-diagnostics.test.d.ts +2 -0
  122. package/dist/server/probe-diagnostics.test.d.ts.map +1 -0
  123. package/dist/server/probe-diagnostics.test.js +114 -0
  124. package/dist/server/probe-diagnostics.test.js.map +1 -0
  125. package/dist/server/probe-env.d.ts +42 -0
  126. package/dist/server/probe-env.d.ts.map +1 -0
  127. package/dist/server/probe-env.js +149 -0
  128. package/dist/server/probe-env.js.map +1 -0
  129. package/dist/server/probe-env.test.d.ts +2 -0
  130. package/dist/server/probe-env.test.d.ts.map +1 -0
  131. package/dist/server/probe-env.test.js +135 -0
  132. package/dist/server/probe-env.test.js.map +1 -0
  133. package/dist/server/probe-redaction.test.d.ts +2 -0
  134. package/dist/server/probe-redaction.test.d.ts.map +1 -0
  135. package/dist/server/probe-redaction.test.js +86 -0
  136. package/dist/server/probe-redaction.test.js.map +1 -0
  137. package/dist/server/prompt-cache.d.ts +17 -0
  138. package/dist/server/prompt-cache.d.ts.map +1 -0
  139. package/dist/server/prompt-cache.js +126 -0
  140. package/dist/server/prompt-cache.js.map +1 -0
  141. package/dist/server/quota-keychain.test.d.ts +2 -0
  142. package/dist/server/quota-keychain.test.d.ts.map +1 -0
  143. package/dist/server/quota-keychain.test.js +83 -0
  144. package/dist/server/quota-keychain.test.js.map +1 -0
  145. package/dist/server/quota.d.ts +30 -0
  146. package/dist/server/quota.d.ts.map +1 -0
  147. package/dist/server/quota.js +544 -0
  148. package/dist/server/quota.js.map +1 -0
  149. package/dist/server/sandbox-cli-version.d.ts +10 -0
  150. package/dist/server/sandbox-cli-version.d.ts.map +1 -0
  151. package/dist/server/sandbox-cli-version.js +62 -0
  152. package/dist/server/sandbox-cli-version.js.map +1 -0
  153. package/dist/server/sandbox-cli-version.test.d.ts +2 -0
  154. package/dist/server/sandbox-cli-version.test.d.ts.map +1 -0
  155. package/dist/server/sandbox-cli-version.test.js +107 -0
  156. package/dist/server/sandbox-cli-version.test.js.map +1 -0
  157. package/dist/server/setup-token-characterization.test.d.ts +2 -0
  158. package/dist/server/setup-token-characterization.test.d.ts.map +1 -0
  159. package/dist/server/setup-token-characterization.test.js +123 -0
  160. package/dist/server/setup-token-characterization.test.js.map +1 -0
  161. package/dist/server/setup-token-parse.d.ts +50 -0
  162. package/dist/server/setup-token-parse.d.ts.map +1 -0
  163. package/dist/server/setup-token-parse.js +553 -0
  164. package/dist/server/setup-token-parse.js.map +1 -0
  165. package/dist/server/setup-token-parse.test.d.ts +2 -0
  166. package/dist/server/setup-token-parse.test.d.ts.map +1 -0
  167. package/dist/server/setup-token-parse.test.js +684 -0
  168. package/dist/server/setup-token-parse.test.js.map +1 -0
  169. package/dist/server/setup-token-runner.d.ts +117 -0
  170. package/dist/server/setup-token-runner.d.ts.map +1 -0
  171. package/dist/server/setup-token-runner.js +346 -0
  172. package/dist/server/setup-token-runner.js.map +1 -0
  173. package/dist/server/setup-token-runner.test.d.ts +2 -0
  174. package/dist/server/setup-token-runner.test.d.ts.map +1 -0
  175. package/dist/server/setup-token-runner.test.js +424 -0
  176. package/dist/server/setup-token-runner.test.js.map +1 -0
  177. package/dist/server/skills.d.ts +8 -0
  178. package/dist/server/skills.d.ts.map +1 -0
  179. package/dist/server/skills.js +42 -0
  180. package/dist/server/skills.js.map +1 -0
  181. package/dist/server/test.d.ts +3 -0
  182. package/dist/server/test.d.ts.map +1 -0
  183. package/dist/server/test.js +454 -0
  184. package/dist/server/test.js.map +1 -0
  185. package/dist/server/test.probe.test.d.ts +2 -0
  186. package/dist/server/test.probe.test.d.ts.map +1 -0
  187. package/dist/server/test.probe.test.js +609 -0
  188. package/dist/server/test.probe.test.js.map +1 -0
  189. package/dist/server/test.remote.test.d.ts +2 -0
  190. package/dist/server/test.remote.test.d.ts.map +1 -0
  191. package/dist/server/test.remote.test.js +189 -0
  192. package/dist/server/test.remote.test.js.map +1 -0
  193. package/dist/ui/build-config.d.ts +3 -0
  194. package/dist/ui/build-config.d.ts.map +1 -0
  195. package/dist/ui/build-config.js +82 -0
  196. package/dist/ui/build-config.js.map +1 -0
  197. package/dist/ui/build-config.test.d.ts +2 -0
  198. package/dist/ui/build-config.test.d.ts.map +1 -0
  199. package/dist/ui/build-config.test.js +82 -0
  200. package/dist/ui/build-config.test.js.map +1 -0
  201. package/dist/ui/index.d.ts +3 -0
  202. package/dist/ui/index.d.ts.map +1 -0
  203. package/dist/ui/index.js +3 -0
  204. package/dist/ui/index.js.map +1 -0
  205. package/dist/ui/parse-stdout.d.ts +3 -0
  206. package/dist/ui/parse-stdout.d.ts.map +1 -0
  207. package/dist/ui/parse-stdout.js +153 -0
  208. package/dist/ui/parse-stdout.js.map +1 -0
  209. package/package.json +57 -4
  210. package/skills/agentmail/SKILL.md +70 -0
  211. package/skills/complain/LICENSE +27 -0
  212. package/skills/complain/SKILL.md +68 -0
  213. package/skills/paperclip/SKILL.md +864 -0
  214. package/skills/paperclip/references/api-reference.md +1814 -0
  215. package/skills/paperclip/references/artifacts.md +163 -0
  216. package/skills/paperclip/references/cases.md +570 -0
  217. package/skills/paperclip/references/company-skills.md +266 -0
  218. package/skills/paperclip/references/issue-documents.md +58 -0
  219. package/skills/paperclip/references/issue-workspaces.md +94 -0
  220. package/skills/paperclip/references/routines.md +249 -0
  221. package/skills/paperclip/references/run-diagnostics.md +28 -0
  222. package/skills/paperclip/references/workflows.md +141 -0
  223. package/skills/paperclip/scripts/paperclip-issue-update.sh +166 -0
  224. package/skills/paperclip/scripts/paperclip-upload-artifact.sh +603 -0
  225. package/skills/paperclip/scripts/submit-agent-commentary.mjs +52 -0
  226. package/skills/paperclip-board/SKILL.md +633 -0
  227. package/skills/paperclip-converting-plans-to-tasks/SKILL.md +28 -0
  228. package/skills/paperclip-create-agent/SKILL.md +213 -0
  229. package/skills/paperclip-create-agent/references/agent-instruction-templates.md +24 -0
  230. package/skills/paperclip-create-agent/references/agents/coder.md +18 -0
  231. package/skills/paperclip-create-agent/references/agents/qa.md +18 -0
  232. package/skills/paperclip-create-agent/references/agents/securityengineer.md +26 -0
  233. package/skills/paperclip-create-agent/references/agents/uxdesigner.md +18 -0
  234. package/skills/paperclip-create-agent/references/api-reference.md +110 -0
  235. package/skills/paperclip-create-agent/references/baseline-role-guide.md +22 -0
  236. package/skills/paperclip-create-agent/references/draft-review-checklist.md +29 -0
  237. package/skills/para-memory-files/SKILL.md +100 -0
  238. package/skills/para-memory-files/references/schemas.md +35 -0
  239. package/skills/slack/SKILL.md +92 -0
  240. package/skills/suggestion-box/LICENSE +27 -0
  241. package/skills/suggestion-box/SKILL.md +77 -0
  242. package/README.md +0 -3
@@ -0,0 +1,266 @@
1
+ # Company Skills Workflow
2
+
3
+ Use this reference when a board user, CEO, or manager asks you to find a skill, install it into the company library, or assign it to an agent.
4
+
5
+ ## What Exists
6
+
7
+ - App-shipped catalog: a curated set of company skills in `@paperclipai/skills-catalog`, browseable and installable without leaving Paperclip.
8
+ - Company skill library: install, inspect, update, audit, reset, and read company skills for the whole company.
9
+ - Agent skill assignment: add or remove company skills on an existing agent.
10
+ - Hire/create composition: pass `desiredSkills` when creating or hiring an agent so the same assignment model applies immediately.
11
+
12
+ The canonical model is:
13
+
14
+ 1. add the skill to the company library — either from the app catalog (`skills install`), an external source (`skills import`), or a managed local skill (`skills create`/`skills scan-projects`)
15
+ 2. attach the company skill to the agent (`skills agent sync`)
16
+ 3. optionally do step 2 during hire/create with `desiredSkills`
17
+
18
+ Catalog install ≠ agent attach. Installing a catalog skill only adds the row to
19
+ `company_skills`. The agent will not use it until you sync the agent's desired
20
+ set.
21
+
22
+ ## Permission Model
23
+
24
+ - Company skill reads: any same-company actor
25
+ - Company skill mutations: open to same-company actors by default. Missing `skills:create` grants and `canCreateSkills` settings do not deny ordinary skill work; only an explicit company skill policy restriction does. Core safety and company-boundary checks always remain enforced.
26
+ - Agent skill assignment: same permission model as updating that agent
27
+ - Team installs continue to require `agents:create` because they import or create agents in addition to attaching skills.
28
+
29
+ ## Core Endpoints
30
+
31
+ App-shipped catalog (read-only browse + company install):
32
+
33
+ - `GET /api/skills/catalog`
34
+ - `GET /api/skills/catalog/:catalogId`
35
+ - `GET /api/skills/catalog/ref?ref=<id|key|slug>`
36
+ - `GET /api/skills/catalog/:catalogId/files?path=SKILL.md`
37
+ - `POST /api/companies/:companyId/skills/install-catalog`
38
+
39
+ Company library:
40
+
41
+ - `GET /api/companies/:companyId/skills`
42
+ - `GET /api/companies/:companyId/skills/:skillId`
43
+ - `GET /api/companies/:companyId/skills/:skillId/files?path=SKILL.md`
44
+ - `POST /api/companies/:companyId/skills` (managed local create)
45
+ - `POST /api/companies/:companyId/skills/import`
46
+ - `POST /api/companies/:companyId/skills/scan-projects`
47
+ - `GET /api/companies/:companyId/skills/:skillId/update-status`
48
+ - `POST /api/companies/:companyId/skills/:skillId/install-update`
49
+ - `POST /api/companies/:companyId/skills/:skillId/audit`
50
+ - `POST /api/companies/:companyId/skills/:skillId/reset`
51
+ - `DELETE /api/companies/:companyId/skills/:skillId`
52
+
53
+ Agent attach and hire/create composition:
54
+
55
+ - `GET /api/agents/:agentId/skills`
56
+ - `POST /api/agents/:agentId/skills/sync`
57
+ - `POST /api/companies/:companyId/agent-hires`
58
+ - `POST /api/companies/:companyId/agents`
59
+
60
+ If a board user, CEO, or manager is driving locally, prefer the
61
+ `paperclipai skills` CLI documented in `doc/CLI.md` — it wraps every endpoint
62
+ above, accepts company skill or catalog refs by `id`/`key`/`slug`, and prints
63
+ the same JSON these endpoints return when called with `--json`.
64
+
65
+ ## Install A Skill Into The Company
66
+
67
+ Two paths cover the common cases:
68
+
69
+ 1. **App-shipped catalog** (preferred when the right skill exists in the
70
+ bundled/optional catalog) — browse it first, then install with the catalog
71
+ install endpoint. No external network fetch happens.
72
+ 2. **External source** (skills.sh, GitHub, local path, or URL) — use the
73
+ import endpoint below.
74
+
75
+ ### App-shipped catalog
76
+
77
+ Browse, inspect, and install catalog skills before reaching for an external
78
+ source. Bundled skills are the curated defaults for any company; optional
79
+ skills are role- or domain-specific.
80
+
81
+ ```sh
82
+ curl -sS "$PAPERCLIP_API_URL/api/skills/catalog?kind=bundled" \
83
+ -H "Authorization: Bearer $PAPERCLIP_API_KEY"
84
+
85
+ curl -sS "$PAPERCLIP_API_URL/api/skills/catalog/ref?ref=github-pr-workflow" \
86
+ -H "Authorization: Bearer $PAPERCLIP_API_KEY"
87
+
88
+ curl -sS -X POST "$PAPERCLIP_API_URL/api/companies/$PAPERCLIP_COMPANY_ID/skills/install-catalog" \
89
+ -H "Authorization: Bearer $PAPERCLIP_API_KEY" \
90
+ -H "Content-Type: application/json" \
91
+ -d '{
92
+ "catalogSkillId": "paperclipai:bundled:software-development:github-pr-workflow"
93
+ }'
94
+ ```
95
+
96
+ The install response records provenance (`catalogId`, `catalogKey`,
97
+ `packageVersion`, `originHash`) on the company skill so update/audit/reset
98
+ flows know the pinned origin. `force: true` may replace a same-key
99
+ catalog-managed skill but never bypasses hard-stop audit findings.
100
+
101
+ ### External source import
102
+
103
+ Import using a **skills.sh URL**, a key-style source string, a GitHub URL, or a local path.
104
+
105
+ ### Source types (in order of preference)
106
+
107
+ | Source format | Example | When to use |
108
+ |---|---|---|
109
+ | **skills.sh URL** | `https://skills.sh/google-labs-code/stitch-skills/design-md` | When a user gives you a `skills.sh` link. This is the managed skill registry — **always prefer it when available**. |
110
+ | **Key-style string** | `google-labs-code/stitch-skills/design-md` | Shorthand for the same skill — `org/repo/skill-name` format. Equivalent to the skills.sh URL. |
111
+ | **GitHub URL** | `https://github.com/vercel-labs/agent-browser` | When the skill is in a GitHub repo but not on skills.sh. |
112
+ | **Local path** | `/abs/path/to/skill-dir` | When the skill is on disk (dev/testing only). |
113
+
114
+ **Critical:** If a user gives you a `https://skills.sh/...` URL, use that URL or its key-style equivalent (`org/repo/skill-name`) as the `source`. Do **not** convert it to a GitHub URL — skills.sh is the managed registry and the source of truth for versioning, discovery, and updates.
115
+
116
+ ### Example: skills.sh import (preferred)
117
+
118
+ ```sh
119
+ curl -sS -X POST "$PAPERCLIP_API_URL/api/companies/$PAPERCLIP_COMPANY_ID/skills/import" \
120
+ -H "Authorization: Bearer $PAPERCLIP_API_KEY" \
121
+ -H "Content-Type: application/json" \
122
+ -d '{
123
+ "source": "https://skills.sh/google-labs-code/stitch-skills/design-md"
124
+ }'
125
+ ```
126
+
127
+ Or equivalently using the key-style string:
128
+
129
+ ```sh
130
+ curl -sS -X POST "$PAPERCLIP_API_URL/api/companies/$PAPERCLIP_COMPANY_ID/skills/import" \
131
+ -H "Authorization: Bearer $PAPERCLIP_API_KEY" \
132
+ -H "Content-Type: application/json" \
133
+ -d '{
134
+ "source": "google-labs-code/stitch-skills/design-md"
135
+ }'
136
+ ```
137
+
138
+ ### Example: GitHub import
139
+
140
+ ```sh
141
+ curl -sS -X POST "$PAPERCLIP_API_URL/api/companies/$PAPERCLIP_COMPANY_ID/skills/import" \
142
+ -H "Authorization: Bearer $PAPERCLIP_API_KEY" \
143
+ -H "Content-Type: application/json" \
144
+ -d '{
145
+ "source": "https://github.com/vercel-labs/agent-browser"
146
+ }'
147
+ ```
148
+
149
+ You can also use source strings such as:
150
+
151
+ - `google-labs-code/stitch-skills/design-md`
152
+ - `vercel-labs/agent-browser/agent-browser`
153
+ - `npx skills add https://github.com/vercel-labs/agent-browser --skill agent-browser`
154
+
155
+ If the task is to discover skills from the company project workspaces first:
156
+
157
+ ```sh
158
+ curl -sS -X POST "$PAPERCLIP_API_URL/api/companies/$PAPERCLIP_COMPANY_ID/skills/scan-projects" \
159
+ -H "Authorization: Bearer $PAPERCLIP_API_KEY" \
160
+ -H "Content-Type: application/json" \
161
+ -d '{}'
162
+ ```
163
+
164
+ ## Inspect What Was Installed
165
+
166
+ ```sh
167
+ curl -sS "$PAPERCLIP_API_URL/api/companies/$PAPERCLIP_COMPANY_ID/skills" \
168
+ -H "Authorization: Bearer $PAPERCLIP_API_KEY"
169
+ ```
170
+
171
+ Read the skill entry and its `SKILL.md`:
172
+
173
+ ```sh
174
+ curl -sS "$PAPERCLIP_API_URL/api/companies/$PAPERCLIP_COMPANY_ID/skills/<skill-id>" \
175
+ -H "Authorization: Bearer $PAPERCLIP_API_KEY"
176
+
177
+ curl -sS "$PAPERCLIP_API_URL/api/companies/$PAPERCLIP_COMPANY_ID/skills/<skill-id>/files?path=SKILL.md" \
178
+ -H "Authorization: Bearer $PAPERCLIP_API_KEY"
179
+ ```
180
+
181
+ ## Assign Skills To An Existing Agent
182
+
183
+ `desiredSkills` accepts:
184
+
185
+ - exact company skill key
186
+ - exact company skill id
187
+ - exact slug when it is unique in the company
188
+
189
+ The server persists canonical company skill keys.
190
+
191
+ The request must include a merge mode:
192
+
193
+ - `add` adds the named skills and keeps every other assignment.
194
+ - `remove` removes only the named skills.
195
+ - `replace` overwrites the complete desired skill set. Use it only after explicit confirmation.
196
+
197
+ ```sh
198
+ curl -sS -X POST "$PAPERCLIP_API_URL/api/agents/<agent-id>/skills/sync" \
199
+ -H "Authorization: Bearer $PAPERCLIP_API_KEY" \
200
+ -H "Content-Type: application/json" \
201
+ -d '{
202
+ "mode": "add",
203
+ "desiredSkills": [
204
+ "vercel-labs/agent-browser/agent-browser"
205
+ ]
206
+ }'
207
+ ```
208
+
209
+ If you need the current state first:
210
+
211
+ ```sh
212
+ curl -sS "$PAPERCLIP_API_URL/api/agents/<agent-id>/skills" \
213
+ -H "Authorization: Bearer $PAPERCLIP_API_KEY"
214
+ ```
215
+
216
+ ## Include Skills During Hire Or Create
217
+
218
+ Use the same company skill keys or references in `desiredSkills` when hiring or creating an agent:
219
+
220
+ ```sh
221
+ curl -sS -X POST "$PAPERCLIP_API_URL/api/companies/$PAPERCLIP_COMPANY_ID/agent-hires" \
222
+ -H "Authorization: Bearer $PAPERCLIP_API_KEY" \
223
+ -H "Content-Type: application/json" \
224
+ -d '{
225
+ "name": "QA Browser Agent",
226
+ "role": "qa",
227
+ "adapterType": "codex_local",
228
+ "adapterConfig": {
229
+ "cwd": "/abs/path/to/repo"
230
+ },
231
+ "desiredSkills": [
232
+ "agent-browser"
233
+ ]
234
+ }'
235
+ ```
236
+
237
+ For direct create without approval:
238
+
239
+ ```sh
240
+ curl -sS -X POST "$PAPERCLIP_API_URL/api/companies/$PAPERCLIP_COMPANY_ID/agents" \
241
+ -H "Authorization: Bearer $PAPERCLIP_API_KEY" \
242
+ -H "Content-Type: application/json" \
243
+ -d '{
244
+ "name": "QA Browser Agent",
245
+ "role": "qa",
246
+ "adapterType": "codex_local",
247
+ "adapterConfig": {
248
+ "cwd": "/abs/path/to/repo"
249
+ },
250
+ "desiredSkills": [
251
+ "agent-browser"
252
+ ]
253
+ }'
254
+ ```
255
+
256
+ ## Notes
257
+
258
+ - Built-in Paperclip runtime skills are still added automatically when required by the adapter.
259
+ - If a reference is missing or ambiguous, the API returns `422`.
260
+ - Prefer linking back to the relevant issue, approval, and agent when you comment about skill changes.
261
+ - Use company portability routes when you need whole-package import/export, not just a skill:
262
+ - `POST /api/companies/:companyId/imports/preview`
263
+ - `POST /api/companies/:companyId/imports/apply`
264
+ - `POST /api/companies/:companyId/exports/preview`
265
+ - `POST /api/companies/:companyId/exports`
266
+ - Use skill-only import when the task is specifically to add a skill to the company library without importing the surrounding company/team/package structure.
@@ -0,0 +1,58 @@
1
+ # Issue documents through the API
2
+
3
+ Use this procedure for requested Paperclip task documents in API-based runtimes.
4
+ Honor a destination explicitly chosen by the requester. Native Runner runtimes
5
+ use their document tool and its contract. Downloadable files follow
6
+ [artifacts.md](artifacts.md).
7
+
8
+ ## Create a document
9
+
10
+ Use the injected `PAPERCLIP_API_URL` and bearer `PAPERCLIP_API_KEY`. Include
11
+ `X-Paperclip-Run-Id: $PAPERCLIP_RUN_ID` on the write and send JSON with
12
+ `Content-Type: application/json`.
13
+
14
+ Choose a descriptive document key such as `report`; keys use lowercase letters,
15
+ numbers, underscores, or hyphens and are at most 64 characters. Plans use `plan`.
16
+
17
+ ```text
18
+ PUT /api/issues/{issueId}/documents/{key}
19
+ ```
20
+
21
+ ```json
22
+ {
23
+ "title": "Task report",
24
+ "format": "markdown",
25
+ "body": "# Task report\n\nThe requested findings.",
26
+ "baseRevisionId": null
27
+ }
28
+ ```
29
+
30
+ A successful write returns HTTP `201` for creation or `200` for an update,
31
+ with the saved document JSON. Check its `key`, `body`, and `latestRevisionId`
32
+ before claiming delivery. This receipt is sufficient; another GET is unnecessary
33
+ when it confirms the intended content and a saved revision.
34
+
35
+ Construct a clickable Markdown link from the current issue and successful write
36
+ receipt, then add it to the completion comment or response:
37
+
38
+ ```javascript
39
+ const issuePath = issue.identifier
40
+ ? `/${issue.identifier.split("-")[0]}/issues/${issue.identifier}`
41
+ : `/issues/${issue.id}`;
42
+ const documentUrl = `${issuePath}#document-${saved.key}`;
43
+ const comment = `Saved [Task report](${documentUrl}).`;
44
+ ```
45
+
46
+ Use the returned key: a locked document can redirect an agent's write to a new
47
+ document. Unnumbered issues use their ID; the board resolves their company.
48
+
49
+ ## Update or resolve an unclear write
50
+
51
+ For an existing document, first `GET /api/issues/{issueId}/documents/{key}`
52
+ and read its body and `latestRevisionId`. Send the updated body with
53
+ `baseRevisionId` set to that revision. On `409`, fetch the latest document and
54
+ reconcile changes before retrying; preserve the skill's bounded-write retry rule.
55
+
56
+ If a write's status or receipt is unclear, GET the document to check the saved
57
+ content and revision before retrying. If delivery cannot be confirmed, report
58
+ that limitation instead of claiming the requested document was saved.
@@ -0,0 +1,94 @@
1
+ # Issue Workspace Runtime Controls
2
+
3
+ Use this reference to choose task file placement or inspect and run workspace services. A workspace may be a plain task directory without a project or Git repository.
4
+
5
+ ## Discover the Workspace
6
+
7
+ Start from the issue, not from memory:
8
+
9
+ ```sh
10
+ curl -sS -H "Authorization: Bearer $PAPERCLIP_API_KEY" \
11
+ "$PAPERCLIP_API_URL/api/issues/$PAPERCLIP_TASK_ID/heartbeat-context"
12
+ ```
13
+
14
+ Read `currentExecutionWorkspace`:
15
+
16
+ - `id` — execution workspace id for control endpoints
17
+ - `cwd` / `branchName` — local checkout context
18
+ - `status` / `closedAt` — whether the workspace is usable
19
+ - `runtimeServices[]` — current services, including `serviceName`, `status`, `healthStatus`, `url`, `port`, and `runtimeServiceId`
20
+
21
+ If `currentExecutionWorkspace` is `null`, the issue does not currently have a realized execution workspace. Child and follow-up tasks always get their own workspace from the project base on their first run; they never reuse the parent's or source task's workspace, and the server refuses to bind a task to an ancestor's workspace.
22
+
23
+ ## Choose Files and Repositories
24
+
25
+ `GET /api/issues/:issueId/workspace` returns the current binding, revision, pending selection, repository inventory, and available preparation capabilities. The Runner equivalents are `get_workspace` and `list_workspaces`.
26
+
27
+ `PUT /api/issues/:issueId/workspace` accepts a stable `requestKey`, the inspected `expectedBindingRevision`, and one typed `selection`:
28
+
29
+ - `{ "kind": "task_directory" }`: the task's separate directory.
30
+ - `{ "kind": "existing", "workspaceId": "<authorized-id>" }`: intentionally reuse a workspace.
31
+ - `{ "kind": "configured_source", "projectWorkspaceId": "<authorized-source-id>", "mode": "shared" }`: use its configured folder; `managed_isolated` requests an isolated checkout.
32
+
33
+ `POST /api/issues/:issueId/workspace/repositories` accepts a stable `requestKey`, optional `ref`, and `repository: { kind: "catalog", id: "<authorized-repository-id>" }`. Discover IDs with `list_project_repositories`. Existing public HTTPS GitHub URLs can use `{ kind: "url", url: "https://github.com/owner/repo" }`; URLs do not grant private credentials or create a remote repository.
34
+
35
+ Root selections and repository preparation return `next_normal_admission`. The active process retains its root. Do not claim a queued checkout is ready or repeatedly request it. A different ref cannot silently reset an existing checkout. New noncoding work can proceed immediately in task files without any repository. Explicitly shared folders remain shared; do not remove them when finishing one task.
36
+
37
+ ## Control Services
38
+
39
+ Prefer Paperclip-managed runtime service controls over manual `pnpm dev &` or ad-hoc background processes. These endpoints keep service state, URLs, logs, and ownership visible to other agents and the board.
40
+
41
+ ```sh
42
+ # Start all configured services; waits for configured readiness checks.
43
+ curl -sS -X POST \
44
+ -H "Authorization: Bearer $PAPERCLIP_API_KEY" \
45
+ -H "X-Paperclip-Run-Id: $PAPERCLIP_RUN_ID" \
46
+ -H "Content-Type: application/json" \
47
+ "$PAPERCLIP_API_URL/api/execution-workspaces/<workspace-id>/runtime-services/start" \
48
+ -d '{}'
49
+
50
+ # Restart all configured services.
51
+ curl -sS -X POST \
52
+ -H "Authorization: Bearer $PAPERCLIP_API_KEY" \
53
+ -H "X-Paperclip-Run-Id: $PAPERCLIP_RUN_ID" \
54
+ -H "Content-Type: application/json" \
55
+ "$PAPERCLIP_API_URL/api/execution-workspaces/<workspace-id>/runtime-services/restart" \
56
+ -d '{}'
57
+
58
+ # Stop all running services.
59
+ curl -sS -X POST \
60
+ -H "Authorization: Bearer $PAPERCLIP_API_KEY" \
61
+ -H "X-Paperclip-Run-Id: $PAPERCLIP_RUN_ID" \
62
+ -H "Content-Type: application/json" \
63
+ "$PAPERCLIP_API_URL/api/execution-workspaces/<workspace-id>/runtime-services/stop" \
64
+ -d '{}'
65
+ ```
66
+
67
+ To target a configured service, pass one of:
68
+
69
+ ```json
70
+ { "workspaceCommandId": "web" }
71
+ { "runtimeServiceId": "<runtime-service-id>" }
72
+ { "serviceIndex": 0 }
73
+ ```
74
+
75
+ The response includes an updated `workspace.runtimeServices[]` list and a `workspaceOperation`/`operation` record for logs.
76
+
77
+ ## Read the URL
78
+
79
+ After `start` or `restart`, read the service URL from:
80
+
81
+ - response `workspace.runtimeServices[].url`
82
+ - or a fresh `GET /api/issues/:issueId/heartbeat-context` response at `currentExecutionWorkspace.runtimeServices[].url`
83
+
84
+ For QA/browser checks, use the service whose `status` is `running` and whose `healthStatus` is not `unhealthy`. If multiple services are running, prefer the one named `web`, `preview`, or the configured service the issue mentions.
85
+
86
+ ## MCP Tools
87
+
88
+ When the Paperclip MCP tools are available, prefer these issue-scoped tools:
89
+
90
+ - `paperclipGetIssueWorkspaceRuntime` — reads `currentExecutionWorkspace` and service URLs for an issue.
91
+ - `paperclipControlIssueWorkspaceServices` — starts, stops, or restarts the current issue workspace services.
92
+ - `paperclipWaitForIssueWorkspaceService` — waits until a selected service is running and returns its URL when exposed.
93
+
94
+ These tools resolve the issue's workspace id for you, so QA agents do not need to know the lower-level execution workspace endpoint first.
@@ -0,0 +1,249 @@
1
+ # Paperclip Routines
2
+
3
+ Routines are recurring tasks. Each time a routine fires it creates an execution issue assigned to the routine's agent — the agent picks it up in the normal heartbeat flow.
4
+
5
+ A routine has:
6
+ - One assigned agent and one project
7
+ - One or more triggers (`schedule`, `webhook`, or `api`)
8
+ - A concurrency policy (what to do when a previous run is still active)
9
+ - A catch-up policy (what to do with missed scheduled runs)
10
+ - An activity gate policy (whether quiet scheduled ticks should be skipped)
11
+
12
+ **Authorization:** Agents can read all routines in their company. They can create routines assigned to themselves, and manage routines assigned to themselves or routines the person their run works for is responsible for. Handing a routine to another agent needs that person to be allowed to assign work. Board operators have full access, including reassignment.
13
+
14
+ **Dedicated tools:** prefer `list_routines` (filter by words, status, agent, project, responsible person, a responsibility, or `unfiled`) and `update_routine` (title, instructions, agent, project, status, priority, a plain `schedule` such as `{ frequency: "weekly", dayOfWeek: "monday", time: "09:00", timezone }` or `null` to turn it off, and `fileUnder` a responsibility). The routine and its schedule change together as one routine revision the person can restore from the routine's history; filing is saved separately in their Dashboard history (`filedUnder.undo`). Say which when you report it. Without a `timezone`, a schedule keeps the routine's current zone, else uses the person's own. On a routine you do not run, changing its agent, turning it on or changing its schedule needs the person you act for to be allowed to assign work. The routes below remain for everything else; `PATCH /api/routines/{id}` also takes `schedule: { cronExpression, timezone? }` or `null`.
15
+
16
+ ---
17
+
18
+ ## Lifecycle
19
+
20
+ ```
21
+ active <-> paused
22
+ active -> archived (terminal — cannot be reactivated)
23
+ ```
24
+
25
+ Paused routines do not fire. Archived routines do not fire and cannot be unarchived.
26
+
27
+ ---
28
+
29
+ ## Creating a Routine
30
+
31
+ ```
32
+ POST /api/companies/{companyId}/routines
33
+ {
34
+ "title": "Weekly CEO briefing",
35
+ "description": "Compile status report and post to Slack",
36
+ "assigneeAgentId": "{agentId}",
37
+ "projectId": "{projectId}",
38
+ "goalId": "{goalId}", // optional
39
+ "parentIssueId": "{issueId}", // optional — parent for run issues
40
+ "priority": "medium",
41
+ "status": "active",
42
+ "concurrencyPolicy": "coalesce_if_active",
43
+ "catchUpPolicy": "skip_missed",
44
+ "activityGatePolicy": "always",
45
+ "activityGateScope": "company"
46
+ }
47
+ ```
48
+
49
+ | Field | Required | Notes |
50
+ |-------|----------|-------|
51
+ | `title` | yes | Max 200 chars |
52
+ | `description` | no | Human-readable description of the routine |
53
+ | `assigneeAgentId` | yes | Agents: must be themselves |
54
+ | `projectId` | yes | |
55
+ | `goalId` | no | Inherited by run issues |
56
+ | `parentIssueId` | no | Run issues become children of this issue |
57
+ | `priority` | no | `critical` `high` `medium` (default) `low` |
58
+ | `status` | no | `active` (default) `paused` `archived` |
59
+ | `concurrencyPolicy` | no | See below |
60
+ | `catchUpPolicy` | no | See below |
61
+ | `activityGatePolicy` | no | `always` (default) or `require_external_activity`; see below |
62
+ | `activityGateScope` | no | `company` (default) or `project`; see below |
63
+
64
+ ---
65
+
66
+ ## Concurrency Policies
67
+
68
+ Controls what happens when a trigger fires while the previous run issue is still open or active.
69
+
70
+ | Policy | Behaviour |
71
+ |--------|-----------|
72
+ | `coalesce_if_active` **(default)** | New run is marked `coalesced` and linked to the existing active run — no new issue created |
73
+ | `skip_if_active` | New run is marked `skipped` and linked to the existing active run — no new issue created |
74
+ | `always_enqueue` | Always create a new issue regardless of active runs |
75
+
76
+ ---
77
+
78
+ ## Catch-Up Policies
79
+
80
+ Controls what happens with scheduled runs that were missed, for example during server downtime.
81
+
82
+ | Policy | Behaviour |
83
+ |--------|-----------|
84
+ | `skip_missed` **(default)** | Missed runs are dropped |
85
+ | `enqueue_missed_with_cap` | Missed runs are enqueued, capped at 25 |
86
+
87
+ ---
88
+
89
+ ## Activity-Gated Scheduled Runs
90
+
91
+ `activityGatePolicy` controls whether a **schedule trigger** runs when the system has been quiet. It does not gate manual, API, or webhook runs.
92
+
93
+ | Policy | Behaviour |
94
+ |--------|-----------|
95
+ | `always` **(default)** | Run on every scheduled tick |
96
+ | `require_external_activity` | Run only when qualifying activity occurred after this routine's last dispatched, non-skipped run |
97
+
98
+ `activityGateScope` selects where qualifying activity is checked:
99
+
100
+ | Scope | Behaviour |
101
+ |-------|-----------|
102
+ | `company` **(default)** | Activity anywhere in the routine's company can wake it |
103
+ | `project` | Only activity attributed to the routine's project can wake it |
104
+
105
+ The activity window starts at the `triggeredAt` time of the last dispatched run. A routine that has never dispatched always runs once. Runs skipped for quiet activity do not advance the window, so one later qualifying event still wakes the next scheduled tick.
106
+
107
+ The gate excludes activity generated by the routine's own dispatched run issues, scheduler bookkeeping for that routine, and pure-read actions such as issue read/unread changes and inbox archive/unarchive actions. Work performed by other agents on tasks the routine delegated is external activity and wakes the routine on its next tick.
108
+
109
+ ### Example: skip quiet nights
110
+
111
+ This hourly watcher runs after company activity, follows up while delegated work continues, and stops consuming runs once the company settles overnight:
112
+
113
+ ```json
114
+ {
115
+ "title": "Hourly work watcher",
116
+ "description": "Review recent work and follow up on delegated tasks",
117
+ "assigneeAgentId": "{agentId}",
118
+ "projectId": "{projectId}",
119
+ "activityGatePolicy": "require_external_activity",
120
+ "activityGateScope": "company"
121
+ }
122
+ ```
123
+
124
+ Add a schedule trigger with `cronExpression: "0 * * * *"`. The first tick runs. Later ticks run only after qualifying company activity since the last dispatched run; quiet skipped ticks keep the original activity window open.
125
+
126
+ ---
127
+
128
+ ## Adding Triggers
129
+
130
+ A routine can have multiple triggers of different kinds.
131
+
132
+ All trigger kinds accept an optional `label` field (max 120 chars), which is useful for distinguishing multiple triggers of the same kind on one routine.
133
+
134
+ ```
135
+ POST /api/routines/{routineId}/triggers
136
+ ```
137
+
138
+ ### Schedule (cron)
139
+
140
+ ```json
141
+ {
142
+ "kind": "schedule",
143
+ "cronExpression": "0 9 * * 1",
144
+ "timezone": "Europe/Amsterdam"
145
+ }
146
+ ```
147
+
148
+ - `cronExpression`: standard 5-field cron syntax
149
+ - `timezone`: IANA timezone string (for example `UTC` or `America/New_York`)
150
+ - The server computes `nextRunAt` automatically
151
+
152
+ ### Webhook
153
+
154
+ ```json
155
+ {
156
+ "kind": "webhook",
157
+ "signingMode": "hmac_sha256",
158
+ "replayWindowSec": 300
159
+ }
160
+ ```
161
+
162
+ - `signingMode`: `bearer` (default) or `hmac_sha256`. Agents can only create authenticated webhook triggers; if a sender cannot authenticate, ask a person to set that trigger up on the board.
163
+ - `replayWindowSec`: 30-86400 (default 300)
164
+ - Response includes the webhook URL (`publicId`-based) and the signing secret
165
+ - Fire externally: `POST /api/routine-triggers/public/{publicId}/fire`
166
+ - Bearer: `Authorization: Bearer <secret>`
167
+ - HMAC: `X-Paperclip-Signature` + `X-Paperclip-Timestamp` headers
168
+
169
+ ### API (manual only)
170
+
171
+ ```json
172
+ {
173
+ "kind": "api"
174
+ }
175
+ ```
176
+
177
+ No configuration. Fire via the manual run endpoint.
178
+
179
+ ---
180
+
181
+ ## Updating and Deleting Triggers
182
+
183
+ ```
184
+ PATCH /api/routine-triggers/{triggerId}
185
+ { "enabled": false, "cronExpression": "0 10 * * 1" }
186
+
187
+ DELETE /api/routine-triggers/{triggerId}
188
+ ```
189
+
190
+ To rotate a webhook secret (the old secret is immediately invalidated):
191
+
192
+ ```
193
+ POST /api/routine-triggers/{triggerId}/rotate-secret
194
+ ```
195
+
196
+ ---
197
+
198
+ ## Manual Run
199
+
200
+ Fires a run immediately, bypassing the schedule. Concurrency policy still applies.
201
+
202
+ ```
203
+ POST /api/routines/{routineId}/run
204
+ {
205
+ "source": "manual",
206
+ "triggerId": "{triggerId}", // optional — attributes run to a specific trigger
207
+ "payload": { "context": "..." }, // optional — passed to the run issue
208
+ "idempotencyKey": "unique-key" // optional — prevents duplicate runs
209
+ }
210
+ ```
211
+
212
+ ---
213
+
214
+ ## Updating a Routine
215
+
216
+ All create fields are updatable. Agents cannot reassign a routine to another agent.
217
+
218
+ ```
219
+ PATCH /api/routines/{routineId}
220
+ { "status": "paused", "title": "New title" }
221
+ ```
222
+
223
+ ---
224
+
225
+ ## Reading Routines and Runs
226
+
227
+ ```
228
+ GET /api/companies/{companyId}/routines
229
+ GET /api/routines/{routineId}
230
+ GET /api/routines/{routineId}/runs?limit=50
231
+ ```
232
+
233
+ Use the generic API endpoint tables in `skills/paperclip/references/api-reference.md` when you need a full cross-domain reference. Use this file when you need routine-specific behaviour, payload shape, or policy details.
234
+
235
+ **Delivering results to the human's chat**
236
+
237
+ A routine execution task can call `send_chat_message({ body, idempotencyKey })`
238
+ or `POST /api/agents/me/chat/messages` using its run credentials. The server sends
239
+ to that agent's chat with the run's responsible human, including before the human
240
+ has opened the chat. No recipient lookup or destination ID is needed. Retain a
241
+ stable key across retries of the source task; changed content with that key conflicts.
242
+
243
+ For a morning PR review, gather the PRs, send a concise Markdown digest with
244
+ links, then finish the task separately. Delivery commits immediately, marks the
245
+ chat unread and includes a source-task link. It neither wakes the chat agent nor
246
+ suppresses ordinary handoff completion notifications. Agent Chat must be enabled,
247
+ the run must be active in standard mode, and the source task must be suitable
248
+ for the company-visible chat. Missing or revoked recipients and restricted tasks
249
+ fail explicitly; never select a replacement recipient.