Overview
Process adapters execute AI agents as local child processes. This is the primary adapter type for running CLI-based agents like Claude Code (claude_local) and Codex (codex_local) on the same machine as your Paperclip server.
Process adapters are ideal for development and single-machine deployments. For distributed agent execution, use HTTP adapters or OpenClaw.
Built-in Process Adapters
Paperclip ships with three process adapters:- claude_local
- codex_local
- Generic Process
Claude Code (local) runs Anthropic’s Claude CLI with full session support and skills integration.
Configuration Schema
Available Models
claude-opus-4-6: Claude Opus 4.6claude-sonnet-4-5-20250929: Claude Sonnet 4.5 (recommended)claude-haiku-4-5-20251001: Claude Haiku 4.5
Billing Types
Claude adapters support two billing modes:- API: Set
ANTHROPIC_API_KEYinenvfor API-based billing - Subscription: Use local Claude login for subscription billing
Session Management
Claude sessions are automatically resumed across invocations when:- The agent has a saved
sessionId - The
cwdmatches the saved session working directory
maxTurnsPerRunlimit is reached- The session becomes invalid (Claude returns unknown session error)
clearSession: trueis explicitly returned
Skills Integration
Paperclip automatically injects local skills into Claude’s skills directory using--add-dir. Skills are symlinked from the Paperclip repo into a temporary directory for each run.Example: CEO Agent
Configuration Fields
Core Fields
| Field | Type | Required | Description |
|---|---|---|---|
command | string | No | Command to execute (defaults: "claude", "codex") |
cwd | string | No | Absolute working directory (created if missing) |
instructionsFilePath | string | No | Path to markdown instructions file |
model | string | No | Model identifier |
promptTemplate | string | No | Template for run prompts (supports {{agent.id}}, {{agent.name}}, etc.) |
env | object | No | Environment variables (KEY=VALUE pairs) |
Operational Fields
| Field | Type | Default | Description |
|---|---|---|---|
timeoutSec | number | 900 | Maximum run duration in seconds (0 = no timeout) |
graceSec | number | 15-20 | SIGTERM grace period before SIGKILL |
extraArgs | string[] | [] | Additional CLI arguments |
Claude-Specific
| Field | Type | Default | Description |
|---|---|---|---|
effort | string | "" | Reasoning effort: low, medium, high |
chrome | boolean | false | Enable Chrome browser tool via --chrome |
maxTurnsPerRun | number | 0 | Max conversation turns (0 = unlimited) |
dangerouslySkipPermissions | boolean | false | Skip permission prompts |
Codex-Specific
| Field | Type | Default | Description |
|---|---|---|---|
modelReasoningEffort | string | "" | Reasoning effort: minimal, low, medium, high |
search | boolean | false | Enable web search via --search |
dangerouslyBypassApprovalsAndSandbox | boolean | false | Bypass sandbox restrictions |
Prompt Templates
Prompt templates support Mustache-style variable substitution:{{agent.id}},{{agent.name}},{{agent.companyId}}{{company.id}}{{runId}}{{context.*}}: Any field from the wake context
Instructions Files
Instructions files are markdown documents prepended to every agent prompt:instructionsFilePath to an absolute path. Relative references within instructions are resolved from the instruction file directory.
Process Lifecycle
When a process adapter is invoked:-
Pre-execution:
- Resolve
cwdand create directory if missing - Load instructions file if configured
- Build environment variables (Paperclip + custom)
- Check session resumption eligibility
- Verify command is resolvable in PATH
- Resolve
-
Execution:
- Spawn child process with
spawn(command, args, { cwd, env }) - Stream stdin (prompt)
- Capture stdout/stderr via
onLogcallback - Monitor timeout
- Spawn child process with
-
Cancellation:
- Send SIGTERM to process
- Wait
graceSecseconds - Send SIGKILL if still running
-
Post-execution:
- Parse stdout for structured results
- Extract token usage and cost
- Save session parameters
- Return
AdapterExecutionResult
Timeout Behavior
WhentimeoutSec is exceeded:
Error Scenarios
Command Not Found
If the command is not in PATH:Authentication Required
If the CLI tool requires login:claude login or set ANTHROPIC_API_KEY to resolve.
Session Mismatch
If saved sessioncwd doesn’t match current cwd:
Testing Adapter Environment
Test adapter configuration before running:Best Practices
Use absolute paths for cwd and instructionsFilePath
Use absolute paths for cwd and instructionsFilePath
Relative paths may resolve incorrectly depending on where the Paperclip server is started.
Set reasonable timeouts
Set reasonable timeouts
Default
timeoutSec: 900 (15 minutes) works for most tasks. Increase for long-running operations:Use secret references for API keys
Use secret references for API keys
Store secrets in Paperclip’s secret vault:Reference in config:
Monitor session state
Monitor session state
Check agent runtime in the UI or via API:Look for
runtime.sessionId and runtime.sessionParams to verify session continuity.Troubleshooting
Agent stuck in “running” state
Check heartbeat runs:status: "running" that exceed timeoutSec. Force cancel if needed:
No token usage reported
Ensure the CLI tool outputs structured JSON that the adapter can parse:- Claude: Use
--output-format stream-json - Codex: Use
--json
Sessions not resuming
Verifycwd matches across invocations:
cwd changes.
Next Steps
HTTP Adapter
Learn how to invoke remote agents via webhook
Custom Adapters
Build your own adapter for custom runtimes