OpenParable
Skip to content
← Back to skills

Routines

Agent Building
routines

Routines is an Agent Skill for agent building published in the Yesterday-AI/paperclip-plugin-company-wizard repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Set up and manage Paperclip Routines — recurring scheduled tasks that replace expensive always-on heartbeats. Use to create cron-based, webhook-triggered, or API-triggered routines for agents, reducing token spend while keeping agents responsive. Covers routine CRUD, triggers, concurrency policies, and suggested routine patterns for common agent roles.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/Yesterday-AI/paperclip-plugin-company-wizard/blob/HEAD/.claude/skills/routines/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/routines, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

Routines — Recurring Agent Tasks

Routines are Paperclip's scheduling primitive. Instead of agents burning tokens on timer heartbeats polling for work, routines fire only when needed — on a cron schedule, webhook, or explicit API call — and create a targeted heartbeat run for the assigned agent.

Why Routines > Always-On Heartbeats

ApproachToken costResponsiveness
Heartbeat every 5 min~288 runs/day, most idleHigh but wasteful
Routines (cron + webhook)Only fires when scheduled or triggeredSame responsiveness, fraction of the cost

The key insight: clean up heartbeats = token reducing = cheaper.

Quick Start

1. Find your IDs

# Company ID
curl -s "$PAPERCLIP_API_URL/api/agents/me" \
  -H "Authorization: Bearer $PAPERCLIP_API_KEY" | jq '.companyId, .id'

# Agents in company
curl -s "$PAPERCLIP_API_URL/api/companies/{companyId}/agents" \
  -H "Authorization: Bearer $PAPERCLIP_API_KEY" | jq '.[] | {id, name, role}'

# Projects
curl -s "$PAPERCLIP_API_URL/api/companies/{companyId}/projects" \
  -H "Authorization: Bearer $PAPERCLIP_API_KEY" | jq '.[] | {id, name}'

2. Create a routine

curl -s -X POST "$PAPERCLIP_API_URL/api/companies/{companyId}/routines" \
  -H "Authorization: Bearer $PAPERCLIP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Daily standup check",
    "description": "CEO reviews all in_progress issues and nudges stalled agents",
    "assigneeAgentId": "{ceo-agent-id}",
    "projectId": "{project-id}",
    "priority": "medium",
    "status": "active",
    "concurrencyPolicy": "skip_if_active",
    "catchUpPolicy": "skip_missed"
  }'

3. Add a cron trigger

curl -s -X POST "$PAPERCLIP_API_URL/api/routines/{routineId}/triggers" \
  -H "Authorization: Bearer $PAPERCLIP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "kind": "schedule",
    "cronExpression": "0 9 * * 1-5",
    "timezone": "Europe/Amsterdam"
  }'

4. Or add a webhook trigger (for external events)

curl -s -X POST "$PAPERCLIP_API_URL/api/routines/{routineId}/triggers" \
  -H "Authorization: Bearer $PAPERCLIP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "kind": "webhook",
    "signingMode": "bearer"
  }'

The response includes a publicId and signing secret. External systems POST to: POST /api/routine-triggers/public/{publicId}/fire

5. Manual run (testing)

curl -s -X POST "$PAPERCLIP_API_URL/api/routines/{routineId}/run" \
  -H "Authorization: Bearer $PAPERCLIP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"source": "manual"}'

Suggested Routine Patterns

CEO Agent

RoutineScheduleWhy
Morning standup0 9 * * 1-5Review stalled issues, nudge idle agents, check backlog health
End-of-day wrap0 17 * * 1-5Summarize progress, update roadmap, plan tomorrow
Weekly retro0 10 * * 1Run retrospective, check velocity trends
Backlog grooming0 14 * * 3Ensure 3+ unassigned issues exist, create from roadmap if needed

Engineer Agent

RoutineScheduleWhy
PR check0 */4 * * 1-5Check for review comments, merge approved PRs
CI/deploy monitorwebhookTrigger on GitHub Actions / Railway deploy events
Dependency audit0 10 * * 1Weekly check for outdated/vulnerable deps

PM Agent

RoutineScheduleWhy
Triage new issues0 9,14 * * 1-5Prioritize and assign incoming issues
Sprint review0 16 * * 5Friday sprint summary
Stakeholder update0 11 * * 3Mid-week status digest

Cross-cutting

RoutineScheduleWhy
GitHub webhook relaywebhookOn push/PR events, wake the engineer
Sentry/error alert relaywebhookOn new error, wake the engineer
Daily backup verification0 3 * * *Verify latest DB backup is fresh

Concurrency Policies

Choose based on routine behavior:

PolicyUse when
coalesce_if_active (default)Idempotent checks — if agent is already running, the new trigger adds nothing
skip_if_activeSame as coalesce but cleaner — just drop it
always_enqueueEvery trigger matters (e.g., each webhook payload is unique work)

Catch-Up Policies

PolicyUse when
skip_missed (default)Agent was down; the missed check isn't worth running late
enqueue_missed_with_capMissed runs should still execute (e.g., missed deploy checks)

Managing Routines

# List all routines
curl -s "$PAPERCLIP_API_URL/api/companies/{companyId}/routines" \
  -H "Authorization: Bearer $PAPERCLIP_API_KEY" | jq '.[] | {id, title, status, assigneeAgentId}'

# Pause a routine
curl -s -X PATCH "$PAPERCLIP_API_URL/api/routines/{routineId}" \
  -H "Authorization: Bearer $PAPERCLIP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"status": "paused"}'

# Resume
curl -s -X PATCH "$PAPERCLIP_API_URL/api/routines/{routineId}" \
  -H "Authorization: Bearer $PAPERCLIP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"status": "active"}'

# Archive (permanent)
curl -s -X PATCH "$PAPERCLIP_API_URL/api/routines/{routineId}" \
  -H "Authorization: Bearer $PAPERCLIP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"status": "archived"}'

# Check run history
curl -s "$PAPERCLIP_API_URL/api/routines/{routineId}/runs?limit=10" \
  -H "Authorization: Bearer $PAPERCLIP_API_KEY" | jq '.[] | {id, status, createdAt}'

# Update trigger schedule
curl -s -X PATCH "$PAPERCLIP_API_URL/api/routine-triggers/{triggerId}" \
  -H "Authorization: Bearer $PAPERCLIP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cronExpression": "0 10 * * 1-5"}'

# Disable a trigger without deleting
curl -s -X PATCH "$PAPERCLIP_API_URL/api/routine-triggers/{triggerId}" \
  -H "Authorization: Bearer $PAPERCLIP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"enabled": false}'

# Delete a trigger
curl -s -X DELETE "$PAPERCLIP_API_URL/api/routine-triggers/{triggerId}" \
  -H "Authorization: Bearer $PAPERCLIP_API_KEY"

Webhook Integration Examples

GitHub → Engineer wake on push

  1. Create routine with webhook trigger
  2. In GitHub repo settings → Webhooks, add:
    • URL: {PAPERCLIP_PUBLIC_URL}/api/routine-triggers/public/{publicId}/fire
    • Content type: application/json
    • Events: Push, Pull request
    • Secret: the signing secret from trigger creation

Railway → Engineer wake on deploy

Same pattern — Railway supports deploy webhooks that POST to your routine trigger URL.

Agent Access Rules

OperationAgent (own)Agent (other)Board
List / Getyesyes (read-only)yes
Createyes (self-assign only)noyes
Updateyesnoyes
Triggers CRUDyesnoyes
Manual runyesnoyes
Reassignnonoyes

Migration: Heartbeat → Routines

To convert an always-on heartbeat agent to routine-based:

  1. Identify the agent's recurring tasks from their HEARTBEAT.md
  2. Create a routine for each distinct recurring concern (standup, triage, deploy check, etc.)
  3. Add appropriate triggers — cron for time-based, webhook for event-based
  4. Reduce or stop the heartbeat interval — routines handle the scheduling now
  5. Keep one low-frequency fallback heartbeat (e.g., every 2 hours) as a safety net for anything routines don't cover
  6. Monitor run history to verify routines fire correctly before fully removing heartbeats

Full API Reference

See skills/paperclip/references/api-reference.md for the complete endpoint list and the Routines API doc at docs/api/routines.md in the Paperclip source.