#14396·paperclip

fix(process-adapter): args pass through verbatim — $PAPERCLIP_TASK_PROMPT reaches the child as a literal string

Author: dominic-sylvesterCreated Sep 28, 2026Updated Sep 28, 2026

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 process adapter 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() passes config.args through asStringArray() untouched, the child is spawned without a shell, and PAPERCLIP_TASK_PROMPT is 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_PROMPT as 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…:

json
{
  "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

typescript
const args = asStringArray(config.args);        // verbatim, no substitution
…
const proc = await runChildProcess(runId, command, args, { … });  // no shell

buildPaperclipEnv() 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

  1. Docs (minimal): agentConfigurationDoc explicitly says args are literal and points at the supported prompt path (wake payload / template vars).
  2. Fix (preferred): render opt-in {{variable}} placeholders in command / args via the existing renderTemplate() helper (already exported from @paperclipai/adapter-utils/server-utils), with template vars like {{context.paperclipTaskMarkdown}} / {{taskBody}} / {{taskId}} — mirroring what hermes-local's promptTemplate already 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.invoke args above) and run c0f435b7 on Paperclip 2026.916.1 (commit d554c4789).
  • Verified the literal token against the current nightly: @paperclipai/[email protected], dist/adapters/process/execute.js — asStringArray(config.args) unchanged, no PAPERCLIP_TASK_PROMPT anywhere.
  • Workaround in use on our instance (a hermes-task-run shim that fetches /api/heartbeat-runs/{id} and reads contextSnapshot.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