@tickernelz/paperclip-pro-hermes-paperclip-adapter 2026.925.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 (139) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +342 -0
  3. package/dist/cli/format-event.d.ts +14 -0
  4. package/dist/cli/format-event.d.ts.map +1 -0
  5. package/dist/cli/format-event.js +52 -0
  6. package/dist/cli/format-event.js.map +1 -0
  7. package/dist/cli/index.d.ts +5 -0
  8. package/dist/cli/index.d.ts.map +1 -0
  9. package/dist/cli/index.js +5 -0
  10. package/dist/cli/index.js.map +1 -0
  11. package/dist/gateway/cli/format-event.d.ts +2 -0
  12. package/dist/gateway/cli/format-event.d.ts.map +1 -0
  13. package/dist/gateway/cli/format-event.js +16 -0
  14. package/dist/gateway/cli/format-event.js.map +1 -0
  15. package/dist/gateway/cli/index.d.ts +2 -0
  16. package/dist/gateway/cli/index.d.ts.map +1 -0
  17. package/dist/gateway/cli/index.js +2 -0
  18. package/dist/gateway/cli/index.js.map +1 -0
  19. package/dist/gateway/index.d.ts +10 -0
  20. package/dist/gateway/index.d.ts.map +1 -0
  21. package/dist/gateway/index.js +69 -0
  22. package/dist/gateway/index.js.map +1 -0
  23. package/dist/gateway/server/config-schema.d.ts +3 -0
  24. package/dist/gateway/server/config-schema.d.ts.map +1 -0
  25. package/dist/gateway/server/config-schema.js +75 -0
  26. package/dist/gateway/server/config-schema.js.map +1 -0
  27. package/dist/gateway/server/execute.d.ts +35 -0
  28. package/dist/gateway/server/execute.d.ts.map +1 -0
  29. package/dist/gateway/server/execute.js +830 -0
  30. package/dist/gateway/server/execute.js.map +1 -0
  31. package/dist/gateway/server/execute.test.d.ts +2 -0
  32. package/dist/gateway/server/execute.test.d.ts.map +1 -0
  33. package/dist/gateway/server/execute.test.js +635 -0
  34. package/dist/gateway/server/execute.test.js.map +1 -0
  35. package/dist/gateway/server/index.d.ts +6 -0
  36. package/dist/gateway/server/index.d.ts.map +1 -0
  37. package/dist/gateway/server/index.js +47 -0
  38. package/dist/gateway/server/index.js.map +1 -0
  39. package/dist/gateway/server/test.d.ts +3 -0
  40. package/dist/gateway/server/test.d.ts.map +1 -0
  41. package/dist/gateway/server/test.js +151 -0
  42. package/dist/gateway/server/test.js.map +1 -0
  43. package/dist/gateway/server/transport-security.d.ts +7 -0
  44. package/dist/gateway/server/transport-security.d.ts.map +1 -0
  45. package/dist/gateway/server/transport-security.js +32 -0
  46. package/dist/gateway/server/transport-security.js.map +1 -0
  47. package/dist/gateway/shared/constants.d.ts +7 -0
  48. package/dist/gateway/shared/constants.d.ts.map +1 -0
  49. package/dist/gateway/shared/constants.js +7 -0
  50. package/dist/gateway/shared/constants.js.map +1 -0
  51. package/dist/gateway/ui/index.d.ts +2 -0
  52. package/dist/gateway/ui/index.d.ts.map +1 -0
  53. package/dist/gateway/ui/index.js +2 -0
  54. package/dist/gateway/ui/index.js.map +1 -0
  55. package/dist/gateway/ui/parse-stdout.d.ts +3 -0
  56. package/dist/gateway/ui/parse-stdout.d.ts.map +1 -0
  57. package/dist/gateway/ui/parse-stdout.js +79 -0
  58. package/dist/gateway/ui/parse-stdout.js.map +1 -0
  59. package/dist/gateway/ui/parse-stdout.test.d.ts +2 -0
  60. package/dist/gateway/ui/parse-stdout.test.d.ts.map +1 -0
  61. package/dist/gateway/ui/parse-stdout.test.js +70 -0
  62. package/dist/gateway/ui/parse-stdout.test.js.map +1 -0
  63. package/dist/index.d.ts +35 -0
  64. package/dist/index.d.ts.map +1 -0
  65. package/dist/index.js +149 -0
  66. package/dist/index.js.map +1 -0
  67. package/dist/index.test.d.ts +2 -0
  68. package/dist/index.test.d.ts.map +1 -0
  69. package/dist/index.test.js +140 -0
  70. package/dist/index.test.js.map +1 -0
  71. package/dist/server/command-resolution.test.d.ts +2 -0
  72. package/dist/server/command-resolution.test.d.ts.map +1 -0
  73. package/dist/server/command-resolution.test.js +37 -0
  74. package/dist/server/command-resolution.test.js.map +1 -0
  75. package/dist/server/config-schema.d.ts +3 -0
  76. package/dist/server/config-schema.d.ts.map +1 -0
  77. package/dist/server/config-schema.js +105 -0
  78. package/dist/server/config-schema.js.map +1 -0
  79. package/dist/server/detect-model.d.ts +77 -0
  80. package/dist/server/detect-model.d.ts.map +1 -0
  81. package/dist/server/detect-model.js +158 -0
  82. package/dist/server/detect-model.js.map +1 -0
  83. package/dist/server/detect-model.test.d.ts +2 -0
  84. package/dist/server/detect-model.test.d.ts.map +1 -0
  85. package/dist/server/detect-model.test.js +166 -0
  86. package/dist/server/detect-model.test.js.map +1 -0
  87. package/dist/server/execute.d.ts +26 -0
  88. package/dist/server/execute.d.ts.map +1 -0
  89. package/dist/server/execute.js +514 -0
  90. package/dist/server/execute.js.map +1 -0
  91. package/dist/server/execute.onspawn.test.d.ts +11 -0
  92. package/dist/server/execute.onspawn.test.d.ts.map +1 -0
  93. package/dist/server/execute.onspawn.test.js +195 -0
  94. package/dist/server/execute.onspawn.test.js.map +1 -0
  95. package/dist/server/index.d.ts +17 -0
  96. package/dist/server/index.d.ts.map +1 -0
  97. package/dist/server/index.js +44 -0
  98. package/dist/server/index.js.map +1 -0
  99. package/dist/server/paperclip-task-bridge.test.d.ts +2 -0
  100. package/dist/server/paperclip-task-bridge.test.d.ts.map +1 -0
  101. package/dist/server/paperclip-task-bridge.test.js +166 -0
  102. package/dist/server/paperclip-task-bridge.test.js.map +1 -0
  103. package/dist/server/prompt-rendering.test.d.ts +2 -0
  104. package/dist/server/prompt-rendering.test.d.ts.map +1 -0
  105. package/dist/server/prompt-rendering.test.js +249 -0
  106. package/dist/server/prompt-rendering.test.js.map +1 -0
  107. package/dist/server/skills.d.ts +9 -0
  108. package/dist/server/skills.d.ts.map +1 -0
  109. package/dist/server/skills.js +212 -0
  110. package/dist/server/skills.js.map +1 -0
  111. package/dist/server/test.d.ts +9 -0
  112. package/dist/server/test.d.ts.map +1 -0
  113. package/dist/server/test.js +341 -0
  114. package/dist/server/test.js.map +1 -0
  115. package/dist/shared/constants.d.ts +47 -0
  116. package/dist/shared/constants.d.ts.map +1 -0
  117. package/dist/shared/constants.js +91 -0
  118. package/dist/shared/constants.js.map +1 -0
  119. package/dist/ui/build-config.d.ts +17 -0
  120. package/dist/ui/build-config.d.ts.map +1 -0
  121. package/dist/ui/build-config.js +69 -0
  122. package/dist/ui/build-config.js.map +1 -0
  123. package/dist/ui/index.d.ts +7 -0
  124. package/dist/ui/index.d.ts.map +1 -0
  125. package/dist/ui/index.js +7 -0
  126. package/dist/ui/index.js.map +1 -0
  127. package/dist/ui/parse-stdout.d.ts +25 -0
  128. package/dist/ui/parse-stdout.d.ts.map +1 -0
  129. package/dist/ui/parse-stdout.js +235 -0
  130. package/dist/ui/parse-stdout.js.map +1 -0
  131. package/dist/ui/parse-stdout.test.d.ts +2 -0
  132. package/dist/ui/parse-stdout.test.d.ts.map +1 -0
  133. package/dist/ui/parse-stdout.test.js +63 -0
  134. package/dist/ui/parse-stdout.test.js.map +1 -0
  135. package/gateway-ui-parser.cjs +82 -0
  136. package/package.json +99 -0
  137. package/skills/paperclip-task-bridge/SKILL.md +77 -0
  138. package/skills/paperclip-task-bridge/paperclip-task.mjs +351 -0
  139. package/ui-parser.cjs +199 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nous Research
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,342 @@
1
+ # Paperclip Adapters for Hermes Agent
2
+
3
+ A [Paperclip](https://paperclip.ing) adapter package that lets you run [Hermes Agent](https://github.com/NousResearch/hermes-agent) as a managed employee in a Paperclip company.
4
+
5
+ Hermes Agent is a full-featured AI agent by [Nous Research](https://nousresearch.com) with 30+ native tools, persistent memory, session persistence, 80+ skills, MCP support, and multi-provider model access.
6
+
7
+ This package owns both built-in Hermes adapter types:
8
+
9
+ - `hermes_local` runs the local Hermes CLI as a child process. The package root exports remain compatible with the original local adapter.
10
+ - `hermes_gateway` calls an already-running Hermes API server over HTTP/SSE. Gateway entrypoints live under the `./gateway` export namespace.
11
+
12
+ Choose `hermes_local` when Paperclip and Hermes run on the same trusted host
13
+ and Paperclip should start `hermes chat` for each heartbeat. Choose
14
+ `hermes_gateway` when Hermes is already running as an API server, often on
15
+ another host, in Docker, or behind a private-network/TLS endpoint. The adapter
16
+ type keys did not change during package consolidation.
17
+
18
+ ## Key Features
19
+
20
+ This adapter provides:
21
+
22
+ - **8 inference providers** — Anthropic, OpenRouter, OpenAI, Nous, OpenAI Codex, ZAI, Kimi Coding, MiniMax
23
+ - **Skills integration** — Scans both Paperclip-managed and Hermes-native skills (`~/.hermes/skills/`), with sync/list/resolve APIs
24
+ - **Structured transcript parsing** — Raw Hermes stdout is parsed into typed `TranscriptEntry` objects so Paperclip renders proper tool cards with status icons and expand/collapse
25
+ - **Rich post-processing** — Converts Hermes ASCII banners, setext headings, and `+--+` table borders into clean GFM markdown
26
+ - **Comment-driven wakes** — Agents wake to respond to issue comments, not just task assignments
27
+ - **Auto model detection** — Reads `~/.hermes/config.yaml` to pre-populate the UI with the user's configured model
28
+ - **Session codec** — Structured validation and migration of session state across heartbeats
29
+ - **Benign stderr reclassification** — MCP init messages and structured logs are reclassified so they don't appear as errors in the UI
30
+ - **Session source tagging** — Sessions are tagged as `tool` source so they don't clutter the user's interactive history
31
+ - **Filesystem checkpoints** — Optional `--checkpoints` for rollback safety
32
+ - **Thinking effort control** — Passes `--reasoning-effort` for thinking/reasoning models
33
+
34
+ ### Hermes Agent Capabilities
35
+
36
+ | Feature | Claude Code | Codex | Hermes Agent |
37
+ |---------|------------|-------|-------------|
38
+ | Persistent memory | ❌ | ❌ | ✅ Remembers across sessions |
39
+ | Native tools | ~5 | ~5 | 30+ (terminal, file, web, browser, vision, git, etc.) |
40
+ | Skills system | ❌ | ❌ | ✅ 80+ loadable skills |
41
+ | Session search | ❌ | ❌ | ✅ FTS5 search over past conversations |
42
+ | Sub-agent delegation | ❌ | ❌ | ✅ Parallel sub-tasks |
43
+ | Context compression | ❌ | ❌ | ✅ Auto-compresses long conversations |
44
+ | MCP client | ❌ | ❌ | ✅ Connect to any MCP server |
45
+ | Multi-provider | Anthropic only | OpenAI only | ✅ 8 providers out of the box |
46
+
47
+ ## Installation
48
+
49
+ This package ships with Paperclip core as the built-in `hermes_local` and
50
+ `hermes_gateway` adapters. No Adapter manager installation is required for
51
+ normal Paperclip use.
52
+
53
+ ### Prerequisites
54
+
55
+ - [Hermes Agent](https://github.com/NousResearch/hermes-agent) installed (`pip install hermes-agent`)
56
+ - Python 3.10+
57
+ - At least one LLM API key (Anthropic, OpenRouter, or OpenAI)
58
+
59
+ ## Quick Start
60
+
61
+ ### 1. Optional: override the built-in for adapter development
62
+
63
+ For local adapter development, install the package from a local path in Adapter
64
+ manager, or add an entry to `~/.paperclip-pro/adapter-plugins.json` and restart
65
+ Paperclip. The external package can override either built-in Hermes adapter
66
+ while it is enabled:
67
+
68
+ ```json
69
+ [
70
+ {
71
+ "packageName": "@tickernelz/paperclip-pro-hermes-paperclip-adapter",
72
+ "localPath": "/absolute/path/to/paperclip/packages/adapters/hermes",
73
+ "type": "hermes_local",
74
+ "installedAt": "2026-06-23T00:00:00.000Z"
75
+ }
76
+ ]
77
+ ```
78
+
79
+ Use `"type": "hermes_gateway"` with the same package when testing a gateway
80
+ override.
81
+
82
+ The package root exports `createServerAdapter()` for the local server adapter,
83
+ a declarative config schema for the generic agent form, and `./ui-parser` for
84
+ local run transcript parsing. Gateway entrypoints are exported from `./gateway`,
85
+ `./gateway/server`, `./gateway/ui`, `./gateway/cli`, and `./gateway/ui-parser`.
86
+ Paperclip core imports these same package entrypoints for built-in adapter
87
+ registration.
88
+
89
+ ### 2. Create a local Hermes agent in Paperclip
90
+
91
+ In the Paperclip UI or via API, create an agent with adapter type `hermes_local`:
92
+
93
+ ```json
94
+ {
95
+ "name": "Hermes Engineer",
96
+ "adapterType": "hermes_local",
97
+ "adapterConfig": {
98
+ "model": "anthropic/claude-sonnet-4",
99
+ "maxIterations": 50,
100
+ "timeoutSec": 300,
101
+ "persistSession": true,
102
+ "enabledToolsets": ["terminal", "file", "web"]
103
+ }
104
+ }
105
+ ```
106
+
107
+ This mode shells out to the local `hermes` CLI. Paperclip injects runtime
108
+ environment variables and captures stdout/stderr from the child process.
109
+
110
+ ### 3. Create a Hermes gateway agent in Paperclip
111
+
112
+ Start Hermes with its API server enabled first:
113
+
114
+ ```bash
115
+ API_SERVER_ENABLED=true \
116
+ API_SERVER_KEY=<generated-secret> \
117
+ hermes gateway run --replace --accept-hooks
118
+ ```
119
+
120
+ Then create an agent with adapter type `hermes_gateway`:
121
+
122
+ ```json
123
+ {
124
+ "name": "Hermes Gateway Engineer",
125
+ "adapterType": "hermes_gateway",
126
+ "adapterConfig": {
127
+ "apiBaseUrl": "http://127.0.0.1:8642",
128
+ "apiKey": "<same-value-as-API_SERVER_KEY>",
129
+ "paperclipApiUrl": "http://127.0.0.1:3100",
130
+ "sessionKeyStrategy": "issue",
131
+ "timeoutSec": 600
132
+ }
133
+ }
134
+ ```
135
+
136
+ If the URL you have is the default Hermes dashboard at
137
+ `http://127.0.0.1:9119` or the default chat URL at
138
+ `http://127.0.0.1:9119/chat`, Paperclip maps it to
139
+ `http://127.0.0.1:9119/api` before calling Hermes API routes. `/chat` and the
140
+ dashboard root are browser UI routes; Paperclip tests `/api/health` and starts
141
+ runs with `/api/v1/runs` after mapping them to the API base.
142
+
143
+ This mode does not start Hermes. It creates runs with `POST /v1/runs`, streams
144
+ Hermes events with SSE, polls run status as a fallback, and stops timed-out runs
145
+ with `POST /v1/runs/{run_id}/stop`.
146
+
147
+ ### Compatibility with the old gateway package
148
+
149
+ `@tickernelz/paperclip-pro-adapter-hermes-gateway` remains as a deprecated compatibility shim
150
+ for one release. It re-exports the gateway entrypoints from
151
+ `@tickernelz/paperclip-pro-hermes-paperclip-adapter/gateway` and preserves the legacy exports
152
+ for existing plugin installs. New installs and built-in Paperclip registrations
153
+ should use `@tickernelz/paperclip-pro-hermes-paperclip-adapter`; the adapter type remains
154
+ `hermes_gateway`.
155
+
156
+ ### Runtime API guidance
157
+
158
+ Hermes receives Paperclip runtime identity through environment variables:
159
+
160
+ - `PAPERCLIP_API_URL`
161
+ - `PAPERCLIP_API_KEY`
162
+ - `PAPERCLIP_RUN_ID`
163
+
164
+ Prompts should reference those variables directly. Command output may redact
165
+ secret values, so do not copy printed tokens into comments or config. Use
166
+ `Authorization: Bearer $PAPERCLIP_API_KEY` on Paperclip API requests and
167
+ `X-Paperclip-Run-Id: $PAPERCLIP_RUN_ID` on mutating issue requests. For
168
+ multiline comments or status updates, preserve newlines with a heredoc plus
169
+ `jq --arg`.
170
+
171
+ ### Hermes-originated Paperclip tasks
172
+
173
+ The package includes a Hermes skill/helper for the reverse direction: a user
174
+ starts in Hermes and asks Hermes to create or update Paperclip work. This is not
175
+ the same as Paperclip waking Hermes through `hermes_local` or `hermes_gateway`.
176
+
177
+ Configure Paperclip access in Hermes env/profile secrets, not prompt text:
178
+
179
+ ```bash
180
+ PAPERCLIP_API_URL=http://127.0.0.1:3100/api
181
+ PAPERCLIP_BRIDGE_API_KEY=<task-bridge-scoped-agent-api-key>
182
+ ```
183
+
184
+ Optional env values:
185
+
186
+ - `PAPERCLIP_COMPANY_ID`
187
+ - `PAPERCLIP_AGENT_ID`
188
+ - `PAPERCLIP_RUN_ID`
189
+
190
+ The bundled `paperclip-task-bridge` skill provides deterministic helper
191
+ commands:
192
+
193
+ ```bash
194
+ node ./paperclip-task.mjs list-assigned
195
+ node ./paperclip-task.mjs create-task --parent-id "<approved-parent-issue-id>" --title "Investigate checkout failures" --description "Capture failing request and root cause."
196
+ node ./paperclip-task.mjs comment --issue PAP-123 --body "Found the failing request path."
197
+ node ./paperclip-task.mjs update-status --issue PAP-123 --status in_review --comment "Ready for review."
198
+ ```
199
+
200
+ The helper reads credentials from environment variables and prints only JSON
201
+ summaries. It supports `create-task`, `comment`, `update-status`, and
202
+ `list-assigned`.
203
+
204
+ Create the bridge key with `scope.kind = "task_bridge"` plus a `parentIssueId`
205
+ or `projectId` boundary. Do not use a normal claimed agent API key for
206
+ internet-facing Hermes chat/webhook task-bridge operations.
207
+
208
+ ### 4. Assign work
209
+
210
+ Create issues in Paperclip and assign them to your Hermes agent. On each heartbeat, Hermes will:
211
+
212
+ 1. Receive the task instructions
213
+ 2. Use its full tool suite to complete the work
214
+ 3. Report results back to Paperclip
215
+ 4. Persist session state for continuity
216
+
217
+ ## Configuration Reference
218
+
219
+ ### Core
220
+
221
+ | Field | Type | Default | Description |
222
+ |-------|------|---------|-------------|
223
+ | `model` | string | `anthropic/claude-sonnet-4` | Model in `provider/model` format |
224
+ | `provider` | string | *(auto-detected)* | API provider: `auto`, `openrouter`, `nous`, `openai-codex`, `zai`, `kimi-coding`, `minimax`, `minimax-cn` |
225
+ | `timeoutSec` | number | `300` | Execution timeout in seconds |
226
+ | `graceSec` | number | `10` | Grace period before SIGKILL |
227
+
228
+ ### Tools
229
+
230
+ | Field | Type | Default | Description |
231
+ |-------|------|---------|-------------|
232
+ | `toolsets` | string | *(all)* | Comma-separated toolsets to enable (e.g. `"terminal,file,web"`) |
233
+
234
+ Available toolsets: `terminal`, `file`, `web`, `browser`, `code_execution`, `vision`, `mcp`, `creative`, `productivity`
235
+
236
+ ### Session & Workspace
237
+
238
+ | Field | Type | Default | Description |
239
+ |-------|------|---------|-------------|
240
+ | `persistSession` | boolean | `true` | Resume sessions across heartbeats |
241
+ | `worktreeMode` | boolean | `false` | Git worktree isolation |
242
+ | `checkpoints` | boolean | `false` | Enable filesystem checkpoints for rollback |
243
+
244
+ ### Advanced
245
+
246
+ | Field | Type | Default | Description |
247
+ |-------|------|---------|-------------|
248
+ | `hermesCommand` | string | `hermes` | Custom CLI binary path |
249
+ | `verbose` | boolean | `false` | Enable verbose output |
250
+ | `quiet` | boolean | `true` | Quiet mode (clean output, no banner/spinner) |
251
+ | `extraArgs` | string[] | `[]` | Additional CLI arguments |
252
+ | `env` | object | `{}` | Extra environment variables |
253
+ | `promptTemplate` | string | *(built-in)* | Custom prompt template |
254
+ | `paperclipApiUrl` | string | `http://127.0.0.1:3100/api` | Paperclip API base URL |
255
+
256
+ ### Prompt Template Variables
257
+
258
+ Use `{{variable}}` syntax in `promptTemplate`:
259
+
260
+ | Variable | Description |
261
+ |----------|-------------|
262
+ | `{{agentId}}` | Paperclip agent ID |
263
+ | `{{agentName}}` | Agent display name |
264
+ | `{{companyId}}` | Company ID |
265
+ | `{{companyName}}` | Company name |
266
+ | `{{runId}}` | Current heartbeat run ID |
267
+ | `{{taskId}}` | Assigned task/issue ID |
268
+ | `{{taskTitle}}` | Task title |
269
+ | `{{taskBody}}` | Task instructions |
270
+ | `{{projectName}}` | Project name |
271
+ | `{{paperclipApiUrl}}` | Paperclip API base URL |
272
+ | `{{commentId}}` | Comment ID (when woken by a comment) |
273
+ | `{{wakeReason}}` | Reason this run was triggered |
274
+
275
+ Conditional sections:
276
+
277
+ - `{{#taskId}}...{{/taskId}}` — included only when a task is assigned
278
+ - `{{#noTask}}...{{/noTask}}` — included only when no task (heartbeat check)
279
+ - `{{#commentId}}...{{/commentId}}` — included only when woken by a comment
280
+
281
+ ## Architecture
282
+
283
+ ```
284
+ Paperclip Hermes Agent
285
+ ┌──────────────────┐ ┌──────────────────┐
286
+ │ Heartbeat │ │ │
287
+ │ Scheduler │───execute()──▶│ hermes chat -q │
288
+ │ │ │ │
289
+ │ Issue System │ │ 30+ Tools │
290
+ │ Comment Wakes │◀──results─────│ Memory System │
291
+ │ │ │ Session DB │
292
+ │ Cost Tracking │ │ Skills │
293
+ │ │ │ MCP Client │
294
+ │ Skill Sync │◀──snapshot────│ ~/.hermes/skills│
295
+ │ Org Chart │ │ │
296
+ └──────────────────┘ └──────────────────┘
297
+ ```
298
+
299
+ The adapter spawns Hermes Agent's CLI in single-query mode (`-q`). Hermes
300
+ processes the task using its full tool suite, then exits. The adapter:
301
+
302
+ 1. **Captures** stdout/stderr and parses token usage, session IDs, and cost
303
+ 2. **Parses** raw output into structured `TranscriptEntry` objects (tool cards with status icons)
304
+ 3. **Post-processes** Hermes ASCII formatting (banners, setext headings, table borders) into clean GFM markdown
305
+ 4. **Reclassifies** benign stderr (MCP init, structured logs) so they don't show as errors
306
+ 5. **Tags** sessions as `tool` source to keep them separate from interactive usage
307
+ 6. **Reports** results back to Paperclip with cost, usage, and session state
308
+
309
+ Session persistence works via Hermes's `--resume` flag — each run picks
310
+ up where the last one left off, maintaining conversation context,
311
+ memories, and tool state across heartbeats. The `sessionCodec` validates
312
+ and migrates session state between runs.
313
+
314
+ ### Skills Integration
315
+
316
+ The adapter scans two skill sources and merges them:
317
+
318
+ - **Paperclip-managed skills** — bundled with the adapter, togglable from the UI
319
+ - **Hermes-native skills** — from `~/.hermes/skills/`, read-only, always loaded
320
+
321
+ The `listSkills` / `syncSkills` APIs expose a unified snapshot so the
322
+ Paperclip UI can display both managed and native skills in one view.
323
+
324
+ ## Development
325
+
326
+ ```bash
327
+ git clone https://github.com/paperclipai/paperclip
328
+ cd paperclip/packages/adapters/hermes
329
+ pnpm install
330
+ pnpm build
331
+ ```
332
+
333
+ ## License
334
+
335
+ MIT — see [LICENSE](LICENSE)
336
+
337
+ ## Links
338
+
339
+ - [Hermes Agent](https://github.com/NousResearch/hermes-agent) — The AI agent this adapter runs
340
+ - [Paperclip](https://github.com/paperclipai/paperclip) — The orchestration platform
341
+ - [Nous Research](https://nousresearch.com) — The team behind Hermes
342
+ - [Paperclip Docs](https://docs.paperclip.ing) — Paperclip documentation
@@ -0,0 +1,14 @@
1
+ /**
2
+ * CLI output formatting for Hermes Agent adapter.
3
+ *
4
+ * Pretty-prints Hermes output lines in the terminal when running
5
+ * Paperclip's CLI tools.
6
+ */
7
+ /**
8
+ * Format a Hermes Agent stdout event for terminal display.
9
+ *
10
+ * @param raw Raw stdout line from Hermes
11
+ * @param debug If true, show extra metadata with color coding
12
+ */
13
+ export declare function printHermesStreamEvent(raw: string, debug: boolean): void;
14
+ //# sourceMappingURL=format-event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-event.d.ts","sourceRoot":"","sources":["../../src/cli/format-event.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CA6CxE"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * CLI output formatting for Hermes Agent adapter.
3
+ *
4
+ * Pretty-prints Hermes output lines in the terminal when running
5
+ * Paperclip's CLI tools.
6
+ */
7
+ import pc from "picocolors";
8
+ /**
9
+ * Format a Hermes Agent stdout event for terminal display.
10
+ *
11
+ * @param raw Raw stdout line from Hermes
12
+ * @param debug If true, show extra metadata with color coding
13
+ */
14
+ export function printHermesStreamEvent(raw, debug) {
15
+ const line = raw.trim();
16
+ if (!line)
17
+ return;
18
+ if (!debug) {
19
+ console.log(line);
20
+ return;
21
+ }
22
+ // Adapter log lines
23
+ if (line.startsWith("[hermes]")) {
24
+ console.log(pc.blue(line));
25
+ return;
26
+ }
27
+ // Tool output (┊ prefix)
28
+ if (line.startsWith("┊")) {
29
+ console.log(pc.cyan(line));
30
+ return;
31
+ }
32
+ // Thinking
33
+ if (line.includes("💭") || line.startsWith("<thinking>")) {
34
+ console.log(pc.dim(line));
35
+ return;
36
+ }
37
+ // Errors
38
+ if (line.startsWith("Error:") ||
39
+ line.startsWith("ERROR:") ||
40
+ line.startsWith("Traceback")) {
41
+ console.log(pc.red(line));
42
+ return;
43
+ }
44
+ // Session info
45
+ if (/session/i.test(line) && /id|saved|resumed/i.test(line)) {
46
+ console.log(pc.green(line));
47
+ return;
48
+ }
49
+ // Default: gray in debug mode
50
+ console.log(pc.gray(line));
51
+ }
52
+ //# sourceMappingURL=format-event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-event.js","sourceRoot":"","sources":["../../src/cli/format-event.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAAW,EAAE,KAAc;IAChE,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IACxB,IAAI,CAAC,IAAI;QAAE,OAAO;IAElB,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClB,OAAO;IACT,CAAC;IAED,oBAAoB;IACpB,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAChC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3B,OAAO;IACT,CAAC;IAED,yBAAyB;IACzB,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3B,OAAO;IACT,CAAC;IAED,WAAW;IACX,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QACzD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1B,OAAO;IACT,CAAC;IAED,SAAS;IACT,IACE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAC5B,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1B,OAAO;IACT,CAAC;IAED,eAAe;IACf,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5B,OAAO;IACT,CAAC;IAED,8BAA8B;IAC9B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * CLI module exports — used by Paperclip's CLI for terminal formatting.
3
+ */
4
+ export { printHermesStreamEvent } from "./format-event.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * CLI module exports — used by Paperclip's CLI for terminal formatting.
3
+ */
4
+ export { printHermesStreamEvent } from "./format-event.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function printHermesGatewayStreamEvent(line: string, debug: boolean): void;
2
+ //# sourceMappingURL=format-event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-event.d.ts","sourceRoot":"","sources":["../../../src/gateway/cli/format-event.ts"],"names":[],"mappings":"AAAA,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAYhF"}
@@ -0,0 +1,16 @@
1
+ export function printHermesGatewayStreamEvent(line, debug) {
2
+ const trimmed = line.trim();
3
+ if (!trimmed)
4
+ return;
5
+ if (trimmed.startsWith("[hermes-gateway:event]")) {
6
+ console.log(trimmed);
7
+ return;
8
+ }
9
+ if (trimmed.startsWith("[hermes-gateway]")) {
10
+ console.log(trimmed);
11
+ return;
12
+ }
13
+ if (debug)
14
+ console.log(line);
15
+ }
16
+ //# sourceMappingURL=format-event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-event.js","sourceRoot":"","sources":["../../../src/gateway/cli/format-event.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,6BAA6B,CAAC,IAAY,EAAE,KAAc;IACxE,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,IAAI,CAAC,OAAO;QAAE,OAAO;IACrB,IAAI,OAAO,CAAC,UAAU,CAAC,wBAAwB,CAAC,EAAE,CAAC;QACjD,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACrB,OAAO;IACT,CAAC;IACD,IAAI,OAAO,CAAC,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC;QAC3C,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACrB,OAAO;IACT,CAAC;IACD,IAAI,KAAK;QAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { printHermesGatewayStreamEvent as formatStdoutEvent } from "./format-event.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/gateway/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,IAAI,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { printHermesGatewayStreamEvent as formatStdoutEvent } from "./format-event.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/gateway/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,IAAI,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { ServerAdapterModule } from "@tickernelz/paperclip-pro-adapter-utils";
2
+ export declare const type = "hermes_gateway";
3
+ export declare const label = "Hermes Gateway";
4
+ export declare const models: {
5
+ id: string;
6
+ label: string;
7
+ }[];
8
+ export declare const agentConfigurationDoc = "# hermes_gateway agent configuration\n\nAdapter: hermes_gateway\n\nUse when:\n- Hermes Agent runs on another host or process that exposes the Hermes API server.\n- Paperclip should create Hermes runs through POST /v1/runs and observe them through SSE events.\n- You need remote Hermes session continuity with X-Hermes-Session-Key.\n\nDon't use when:\n- Hermes should run as a local child process on the Paperclip host; use hermes_local instead.\n- The Hermes API server is not enabled or is only reachable over an unsafe public HTTP endpoint.\n- You need Hermes-originated Paperclip task creation only; that is a Paperclip skill/API bridge, not this wake adapter.\n\nRequired fields:\n- apiBaseUrl (string): Hermes API server base URL, for example http://127.0.0.1:8642.\n The default Hermes dashboard root or chat URL, for example http://127.0.0.1:9119 or http://127.0.0.1:9119/chat, is also accepted and maps to /api.\n- apiKey (string): Hermes API_SERVER_KEY. Sent as Authorization: Bearer <apiKey>.\n\nOptional fields:\n- headers (object or JSON string): extra noncritical headers. Authorization, Content-Type, Accept, Idempotency-Key, and X-Hermes-Session-Key are generated by the adapter.\n- paperclipApiUrl (string): Paperclip API URL reachable from the Hermes host. This is not a credential.\n- sessionKeyStrategy (issue | agent | run | none): defaults to issue.\n- timeoutSec (number): defaults to 600.\n- eventReconnectMs (number): defaults to 2000.\n- instructions (string): stable Hermes instructions sent separately from wake input.\n\nRuntime mapping:\n- Creates runs with POST /v1/runs.\n- Sends Idempotency-Key equal to the Paperclip run id for correlation only; Hermes v0.16.0 did not dedupe duplicate creates.\n- Streams GET /v1/runs/{run_id}/events and polls GET /v1/runs/{run_id} as fallback.\n- Calls POST /v1/runs/{run_id}/stop on timeout.\n\nSecurity guidance:\n- Prefer HTTPS or a private overlay network for non-loopback hosts.\n- Do not put Hermes apiKey or Paperclip bearer tokens in prompts, comments, logs, or result JSON.\n- Keep the default issue-scoped session strategy unless shared agent memory is intentional.\n";
9
+ export declare function createServerAdapter(): ServerAdapterModule;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gateway/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA4B,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAI7G,eAAO,MAAM,IAAI,mBAAe,CAAC;AACjC,eAAO,MAAM,KAAK,mBAAgB,CAAC;AACnC,eAAO,MAAM,MAAM,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAO,CAAC;AAa1D,eAAO,MAAM,qBAAqB,wmEAqCjC,CAAC;AAEF,wBAAgB,mBAAmB,IAAI,mBAAmB,CAczD"}
@@ -0,0 +1,69 @@
1
+ import { ADAPTER_LABEL, ADAPTER_TYPE } from "./shared/constants.js";
2
+ import { execute, getConfigSchema, sessionCodec, testEnvironment } from "./server/index.js";
3
+ export const type = ADAPTER_TYPE;
4
+ export const label = ADAPTER_LABEL;
5
+ export const models = [];
6
+ const sessionManagement = {
7
+ supportsSessionResume: true,
8
+ nativeContextManagement: "confirmed",
9
+ defaultSessionCompaction: {
10
+ enabled: true,
11
+ maxSessionRuns: 0,
12
+ maxRawInputTokens: 0,
13
+ maxSessionAgeHours: 0,
14
+ },
15
+ };
16
+ export const agentConfigurationDoc = `# hermes_gateway agent configuration
17
+
18
+ Adapter: hermes_gateway
19
+
20
+ Use when:
21
+ - Hermes Agent runs on another host or process that exposes the Hermes API server.
22
+ - Paperclip should create Hermes runs through POST /v1/runs and observe them through SSE events.
23
+ - You need remote Hermes session continuity with X-Hermes-Session-Key.
24
+
25
+ Don't use when:
26
+ - Hermes should run as a local child process on the Paperclip host; use hermes_local instead.
27
+ - The Hermes API server is not enabled or is only reachable over an unsafe public HTTP endpoint.
28
+ - You need Hermes-originated Paperclip task creation only; that is a Paperclip skill/API bridge, not this wake adapter.
29
+
30
+ Required fields:
31
+ - apiBaseUrl (string): Hermes API server base URL, for example http://127.0.0.1:8642.
32
+ The default Hermes dashboard root or chat URL, for example http://127.0.0.1:9119 or http://127.0.0.1:9119/chat, is also accepted and maps to /api.
33
+ - apiKey (string): Hermes API_SERVER_KEY. Sent as Authorization: Bearer <apiKey>.
34
+
35
+ Optional fields:
36
+ - headers (object or JSON string): extra noncritical headers. Authorization, Content-Type, Accept, Idempotency-Key, and X-Hermes-Session-Key are generated by the adapter.
37
+ - paperclipApiUrl (string): Paperclip API URL reachable from the Hermes host. This is not a credential.
38
+ - sessionKeyStrategy (issue | agent | run | none): defaults to issue.
39
+ - timeoutSec (number): defaults to 600.
40
+ - eventReconnectMs (number): defaults to 2000.
41
+ - instructions (string): stable Hermes instructions sent separately from wake input.
42
+
43
+ Runtime mapping:
44
+ - Creates runs with POST /v1/runs.
45
+ - Sends Idempotency-Key equal to the Paperclip run id for correlation only; Hermes v0.16.0 did not dedupe duplicate creates.
46
+ - Streams GET /v1/runs/{run_id}/events and polls GET /v1/runs/{run_id} as fallback.
47
+ - Calls POST /v1/runs/{run_id}/stop on timeout.
48
+
49
+ Security guidance:
50
+ - Prefer HTTPS or a private overlay network for non-loopback hosts.
51
+ - Do not put Hermes apiKey or Paperclip bearer tokens in prompts, comments, logs, or result JSON.
52
+ - Keep the default issue-scoped session strategy unless shared agent memory is intentional.
53
+ `;
54
+ export function createServerAdapter() {
55
+ return {
56
+ type,
57
+ execute,
58
+ testEnvironment,
59
+ sessionCodec,
60
+ sessionManagement,
61
+ models,
62
+ supportsLocalAgentJwt: false,
63
+ supportsInstructionsBundle: false,
64
+ requiresMaterializedRuntimeSkills: false,
65
+ agentConfigurationDoc,
66
+ getConfigSchema,
67
+ };
68
+ }
69
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/gateway/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE5F,MAAM,CAAC,MAAM,IAAI,GAAG,YAAY,CAAC;AACjC,MAAM,CAAC,MAAM,KAAK,GAAG,aAAa,CAAC;AACnC,MAAM,CAAC,MAAM,MAAM,GAAoC,EAAE,CAAC;AAE1D,MAAM,iBAAiB,GAA6B;IAClD,qBAAqB,EAAE,IAAI;IAC3B,uBAAuB,EAAE,WAAW;IACpC,wBAAwB,EAAE;QACxB,OAAO,EAAE,IAAI;QACb,cAAc,EAAE,CAAC;QACjB,iBAAiB,EAAE,CAAC;QACpB,kBAAkB,EAAE,CAAC;KACtB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCpC,CAAC;AAEF,MAAM,UAAU,mBAAmB;IACjC,OAAO;QACL,IAAI;QACJ,OAAO;QACP,eAAe;QACf,YAAY;QACZ,iBAAiB;QACjB,MAAM;QACN,qBAAqB,EAAE,KAAK;QAC5B,0BAA0B,EAAE,KAAK;QACjC,iCAAiC,EAAE,KAAK;QACxC,qBAAqB;QACrB,eAAe;KAChB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { AdapterConfigSchema } from "@tickernelz/paperclip-pro-adapter-utils";
2
+ export declare function getConfigSchema(): AdapterConfigSchema;
3
+ //# sourceMappingURL=config-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-schema.d.ts","sourceRoot":"","sources":["../../../src/gateway/server/config-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAInF,wBAAgB,eAAe,IAAI,mBAAmB,CAuErD"}