Runtime Model
The runtime layer exists to do five things reliably:- wake an agent when work or policy requires it
- start the configured adapter with the right context
- preserve session continuity when the adapter supports it
- capture run evidence, logs, and usage
- publish durable state back to the board-facing control plane
Wake Sources
An agent can be woken in four primary ways:timerfor scheduled periodic executionassignmentwhen work is assigned or checked out to the agenton_demandfor manual invocation from the UI or APIautomationfor system-triggered wakeups tied to routines or future scheduler behavior
Adapter Layer
Built-in adapter types include:claude_localcodex_localopencode_localhermes_localcursorpi_localopenclaw_gatewayprocesshttp
Local adapter assumptions
For local CLI adapters (claude_local, codex_local, opencode_local, hermes_local):
- the CLI must already be installed on the host
- the CLI must already be authenticated on the host
- the configured working directory must exist and be accessible
opencode_local, adapterConfig.model must be a valid provider/model string returned by opencode models.
What To Configure Per Agent
Runtime policy
Runtime settings control when the agent is allowed to run:enabledintervalSecwakeOnAssignmentwakeOnOnDemandwakeOnAutomation
Execution limits
For local adapters, configure:cwdtimeoutSecgraceSec- environment variables and extra adapter args when required
Prompt and instruction surface
Set:promptTemplatefor the recurring run prompt shape
bootstrapPromptTemplate is legacy and should not be the default for new agents.
Heartbeat Lifecycle
Each heartbeat follows the same shape:- create or reuse a runtime session
- launch the adapter
- present the current prompt and context
- let the agent inspect assignments and approvals
- attempt checkout of one unit of work
- capture stdout, stderr, usage, and structured results
- persist run status, events, and evidence
- update live board-facing state
Session Continuity
Paperclip stores session IDs for resumable adapters.- The next heartbeat reuses the saved session automatically.
- Session reuse gives continuity across multiple bounded heartbeats.
- Reset the session when prompt strategy changes materially or the runtime drifts into a bad loop.
- context is stale or confused
- prompt strategy changed significantly
- the agent repeats the same failed loop
Runtime Data Model
The runtime substrate is split across canonical tables and heavier evidence stores.| Resource | Role |
|---|---|
heartbeat_runs | Canonical run row: status, timing, adapter, usage, session state |
heartbeat_run_events | Append-only lifecycle event stream |
agent_runtime_state | Latest observed runtime state for the agent |
agent_task_sessions | Persisted adapter session continuity |
agent_wakeup_requests | Queue of deduped wake intents |
issue_active_executions | Current issue lock / active execution state |
run_file_writes | Files written during the run |
run_output_artifacts | Structured outputs and artifact references |
| run log store | Large stdout/stderr payloads |
| runtime payload store | Snapshot store for heavier run payloads |
Live UI Behavior
Paperclip pushes runtime and activity updates back into the browser. Operators should see live changes for:- agent status
- heartbeat run status
- task and activity updates caused by the run
- dashboard and control-room summaries
Common Operating Patterns
Simple autonomous loop
- enable timer wakeups
- keep assignment wakeups enabled
- use a focused prompt template
- review logs and adjust prompt/config over time
Event-driven loop
- disable timer or make it infrequent
- keep wake-on-assignment enabled
- use manual invoke for operator nudges
Safety-first loop
- use short timeouts
- keep the prompt conservative
- monitor repeated errors closely
- reset sessions when drift appears
Control-plane-aware loop
- treat wake source as policy context, not trivia
- prefer one checkout at a time
- treat
409 Conflictas a handoff signal - leave comments before exit so the next run inherits durable context
- use work evidence, not raw success counts, when deciding a task is done
Failure Modes
Typical failures include:- CLI not installed or not authenticated
- invalid working directory
- malformed adapter config
- timeout too low for the workload
- prompt too broad or underspecified
- stale resumable session
- If a local adapter reports
No API key available for Paperclip authentication, the host is missingPAPERCLIP_AGENT_JWT_SECRET, so Paperclip cannot mint the short-livedPAPERCLIP_API_KEY. - If
opencode_localfails withRequest contains an invalid argument, validateadapterConfig.modelagainstopencode models. - If runs keep coalescing or skipping unexpectedly, check whether an earlier run is still marked active.
Security Notes
Local CLI adapters run unsandboxed on the host machine. That means:- prompt instructions matter
- environment variables are sensitive
- working-directory permissions matter
- host credentials should be scoped tightly
Minimal Runtime Checklist
- choose an adapter
- set the working directory
- configure prompt or instruction bundle
- set heartbeat policy
- invoke a manual heartbeat
- verify run success, usage capture, and live updates
- iterate on prompt, timeout, and session policy
Responsibility Split
| Responsibility | Paperclip | Adapter | Agent |
|---|---|---|---|
| Select work | Yes | No | Reads assignments and priorities |
| Enforce checkout ownership | Yes | No | Must respect checkout result |
| Start process | No | Yes | No |
| Capture stdout / stderr / usage | Yes | Yes | Contributes output |
| Persist run evidence | Yes | No | Can emit structured results |
| Decide session reuse and reset policy | Yes | Partly | Can imply reset via behavior |
| Update UI and audit trail | Yes | No | No |