fix(process-adapter): args pass through verbatim — $PAPERCLIP_TASK_PROMPT reaches the child as a literal string
Thinking Path
- Paperclip is the open source app everyone uses to manage agents at work.
- Agents receive their assignment via adapter-specific prompt delivery: built-in local adapters (claude-local, hermes-local, codex-local…) render a prompt template server-side and hand the rendered prompt to the agent CLI.
- The generic
processadapter is documented as "command + args, verbatim", but its args look like a shell command line, so it is natural to write--prompt "$PAPERCLIP_TASK_PROMPT"expecting env-style substitution.- That substitution never happens:
execute()passesconfig.argsthroughasStringArray()untouched, the child is spawned without a shell, andPAPERCLIP_TASK_PROMPTis not a Paperclip env var at all — it never appears anywhere in the codebase (grep -r PAPERCLIP_TASK_PROMPT→ 0 hits in@paperclipai/*).- Result: agents silently start with the literal string
$PAPERCLIP_TASK_PROMPTas their entire prompt. Ours self-recovered via the API, but any non-agentic child just no-ops.- Either document that args are literal and point at the supported mechanism, or (better) reuse the existing
renderTemplate()helper so process args can opt into{{context.paperclipTaskMarkdown}}like other templates.
Linked Issues or Issue Description
What happened: a company agent configured on the built-in process adapter
with command: hermes, args: ["chat", "-q", "$PAPERCLIP_TASK_PROMPT"] received
the literal string $PAPERCLIP_TASK_PROMPT as its prompt on every wake.
Evidence (production run): heartbeat_run_events row,
event_type = adapter.invoke, run bdde0800…:
{
"command": "/Users/domsylvester/.local/bin/hermes",
"commandArgs": ["chat", "-q", "$PAPERCLIP_TASK_PROMPT"],
"env": { "PAPERCLIP_RUN_ID": "…", "PAPERCLIP_API_URL": "…",
"PAPERCLIP_AGENT_ID": "…", "PAPERCLIP_COMPANY_ID": "…",
"PAPERCLIP_TASK_SCRATCH_DIR": "…", "PAPERCLIP_WAKE_PAYLOAD_JSON": "…" }
}Note the child env carries the full runtime set (run id, API url, wake payload,
scratch dirs) but no PAPERCLIP_TASK_PROMPT — the var the args reference
does not exist, and nothing expands the arg.
Source (v2026.916.1, commit d554c4789 — unchanged in 2026.927.0-nightly.0):
server/src/adapters/process/execute.ts
const args = asStringArray(config.args); // verbatim, no substitution
…
const proc = await runChildProcess(runId, command, args, { … }); // no shellbuildPaperclipEnv() sets only PAPERCLIP_AGENT_ID, PAPERCLIP_COMPANY_ID,
PAPERCLIP_API_URL. grep -rn PAPERCLIP_TASK_PROMPT across @paperclipai/*
returns zero hits, and the adapter's own agentConfigurationDoc documents no
substitution — so this is a user-facing trap, not a regression.
Expected: one of
- Docs (minimal):
agentConfigurationDocexplicitly says args are literal and points at the supported prompt path (wake payload / template vars). - Fix (preferred): render opt-in
{{variable}}placeholders incommand/argsvia the existingrenderTemplate()helper (already exported from@paperclipai/adapter-utils/server-utils), with template vars like{{context.paperclipTaskMarkdown}}/{{taskBody}}/{{taskId}}— mirroring whathermes-local'spromptTemplatealready exposes. Literal$…strings keep passing through untouched (no surprise env expansion, no shell).
Reproduction: configure any agent on the process adapter with
args: ["--prompt", "$PAPERCLIP_TASK_PROMPT"], wake it, inspect
adapter.invoke / child stdout: the literal token arrives as argv.
Search-first: no existing issue mentions PAPERCLIP_TASK_PROMPT (search: 0
results). Related but distinct: #9940 forwards wake-context env vars
(PAPERCLIP_TASK_ID, PAPERCLIP_WAKE_PAYLOAD_JSON, …) to the process child —
complementary, still leaves argv literal; #7924 covered per-run env injection;
#13151 covers exit-code handling. A wake-context env var would let children
self-serve the prompt, but shell-less argv still cannot expand it, so the
template-render option (or docs) is the piece that actually fixes the
args-as-command-line misuse.
What Changed
Nothing yet — this is the bug report. Fix proposal above (option 2 preferred).
Verification
- Reproduced from production telemetry: run
bdde0800(adapter.invokeargs above) and runc0f435b7on Paperclip2026.916.1(commitd554c4789). - Verified the literal token against the current nightly:
@paperclipai/[email protected],dist/adapters/process/execute.js—asStringArray(config.args)unchanged, noPAPERCLIP_TASK_PROMPTanywhere. - Workaround in use on our instance (a
hermes-task-runshim that fetches/api/heartbeat-runs/{id}and readscontextSnapshot.paperclipTaskMarkdown, then invokes the real CLI with a prompt file), so the defect is confirmed non-blocking for us but is a silent trap for any new process-adapter user.
Risks
Low. Opt-in template rendering changes nothing for configs without {{…}};
docs-only change has no runtime risk.
Checklist
- I have searched GitHub for duplicate or related issues and linked them above
- I have included reproduction steps and runtime evidence
- I have included a thinking path that traces from project context to this change
Source: paperclipai/paperclip