SkillCurrentNew
Design and run Paperclip channel queues, inboxes, and multi-agent workflows with leases, assign, handoff, CAS labels, DAG deps, and human gates.
0
Save adds this to your Try on my work favorites. Hearts show appreciation.
Try it
See what this would do for you. No sign-up needed.
Set it up
Pick the app you use.
channels-queues-and-workflows
- 1
Open Plugins → Skills
Left sidebar → Plugins, then the Skills tab.
- 2
Add → Upload from your computer
Pick the SKILL.md (or Create with editor and paste the text), then Create.
- 3
Use it with /
In a chat, type / and pick the skill, then write your request.
Show the skill file
Codemd
# Channels, Queues, and Workflows
Use Paperclip's channel, queue, lease, handoff, label, and dependency primitives to coordinate multi-agent work without heavy setup or custom glue.
## Core Mental Model
Four primitives cover every queue and workflow pattern:
1. **Channel = lightweight folder / room of Issues.**
- Created lazily on first write (`pc post`, `pc tasks create`). Supports nested slash paths (`seo/briefs`, `factory/build`); trailing `/` queries the whole subtree (`seo/`).
- Separate from **Projects**: a Project binds execution infrastructure (Git repos, sandboxes, secrets); a Channel is just a stream/queue. They compose cleanly (`--project` is optional per task or channel default).
- Administer channel queue policy, archive state, private membership, or managed-pool auto-drain anytime with `pc channels update <path>` (alias `config`) and `pc channels members list|add|remove <path>`.
2. **Post vs. Task = the same `Issue` object.**
- `pc post <channel> "<text>"` creates an unassigned `status=backlog` issue (`scope=channel`). Default `claim --ready` ignores it.
- `pc tasks create <channel> "<text>"` creates an unassigned `status=todo` issue (`scope=channel`). Workers can claim it immediately.
- `pc tasks create <existing-id>` (or `pc tasks assign <id> @agent`) promotes a `backlog` post to `todo` in place, keeping its ID (`PAP-142`) and full thread history.
3. **Queue = pullable slice of ready issues (Pull vs. Push).**
- No separate Queue resource is required. Any channel with ready issues *is* a queue.
- **Pull (`pc tasks claim --ready <channel>`):** Pops the next matching task atomically (`FOR UPDATE SKIP LOCKED`), sets `status=in_progress`, and grants a 5-minute TTL lease + fenced `claimToken`.
- **Safe default:** `status=todo` + `unassigned`.
- **Opt-in filters:** Pass `--status backlog` (e.g., triage bot draining raw inbox posts) or `--status in_review` (review pool — automatically excludes tasks waiting on pending human interaction cards). Pass `--mine` (`--assignee me`) to claim tasks pushed to *you*, or `--assignee any` for unassigned + yours (never steals another agent's assigned task).
- **Push (`pc tasks assign <id> @agent`):** Assigns an existing post/task to a registered Paperclip agent (auto-promoting `backlog` → `todo` unless `--keep-status`) and wakes it via Paperclip's managed Runner. Use `--unassign` to return a task to the unassigned pool, or `--force` to fence an active worker lease.
- **Managed Pool Auto-Drain:** Bind a managed agent directly to a channel (`pc channels update factory/build --managed-pool @coder --max-concurrency 4`) so Paperclip's control plane automatically assigns and wakes up to `N` concurrent tasks without an external bash loop.
4. **Key-Value Labels (`kv_labels`) = routing and lock-free state.**
- Slice any queue with `--label key=value` (`--label role=reviewer`, `--label stage=draft`).
- Guard state transitions with atomic Compare-And-Swap (`--if` / `--if-unset`): `pc label PAP-50 stage=draft --if stage=new` returns `409 label_conflict` if another agent already transitioned it.
---
## Queue & Inbox Patterns
### 1. Direct Work Queue (Drop & Drain)
Use when every dropped item is immediately actionable by a pool of fungible workers.
```bash
# Producers drop work in (human, cron, webhook, or lead agent)
pc tasks create triage/bugs "Fix 500 on /api/checkout" --priority high --label role=fixer
# Pool of workers drains in parallel (auto-renews lease, releases on Ctrl-C)
pc tasks run --ready triage/bugs --label role=fixer --wait 10m --as worker-1 \
-- claude -p 'Read $PAPERCLIP_TASK_ID with pc read, fix it, verify, and reply.'
```
### 2. Two-Step Inbox (Passive Drop → Triage → Promote or Assign)
Use when raw signals are noisy (alerts, external requests, ideas) and should not burn worker tokens until triaged.
```bash
# 1. Drop raw signal as passive backlog post (zero worker wakeups)
pc post errors/web "500 spike on /api/checkout (14 occurrences in 5m)"
# 2. Optional: a lightweight triage bot pops raw backlog posts with --status backlog
pc tasks claim --ready errors/web --status backlog --as triage-bot
# 3. Promote to a worker pool OR push-assign directly to a managed agent:
pc tasks create PAP-142 --priority high --label role=fixer
# ...or push to a named Paperclip agent (auto-promotes backlog -> todo and wakes @backend-eng):
pc tasks assign PAP-142 @backend-eng --comment "Confirmed nil stripeCustomerId"
```
---
## Multi-Agent Workflow Patterns
Choose one of three patterns (or combine them) based on the shape of the work:
### Pattern A: Single-Thread Relay (Atomic `handoff` Across Stages or Channels)
**Use when:** One unit of work (a support ticket, PR, or article) moves sequentially through specialists and every specialist needs the **entire conversation history in one thread**.
Use **`pc tasks handoff`** (alias **`move`**) to atomically move channels, update labels (with optional `--if` CAS), change status/assignee, and release the active lease in **one transaction**:
```bash
# Writer finishes draft and atomically hands off PAP-50 to #seo/review with CAS guard
pc tasks handoff PAP-50 --channel seo/review \
--label stage=review --if stage=draft \
--comment "Draft ready for fact-check" --as writer-1
```
You can also keep the issue in a single channel and omit `--channel`, or push-assign the next stage directly (`--assignee @qa-reviewer`).
### Pattern B: Assembly Line (Chained Channels with 1-to-Many Fan-Out)
**Use when:** Stages produce **distinct artifacts**, have **1-to-many fan-out** (1 audit → 5 fix tasks, 1 topic → 3 briefs), or need **separate queue policies/permissions** per stage.
- Give each stage its own channel: `#seo/topics` → `#seo/briefs` → `#seo/drafts` → `#seo/publish`.
- A worker pops from Stage $N$, produces its artifact, creates one or more `todo` tasks in Stage $N+1$ (linking back to the source ID), and marks its Stage $N$ task `done`.
- `pc channels --prefix seo/` surfaces queue depth and bottlenecks at every stage.
### Pattern C: DAG Fan-Out / Fan-In (`plan.json` + Mid-Flight `--needs`)
**Use when:** The dependency graph is known up front (feature launches, multi-repo refactors) OR a worker discovers a new prerequisite mid-flight.
- **Up-front DAG:** `pc tasks create <channel> --file plan.json --idempotency-key <key>`. Tasks with `"needs": ["keyA", "keyB"]` sit in `Waiting` until every dependency reaches `done`, then flip `Ready` automatically.
- **Mid-flight prerequisite:** If a worker claims `PAP-142` and discovers it needs `PAP-150` done first, park it without losing auto-wakeup:
```bash
pc tasks block PAP-142 --needs PAP-150 "Waiting on schema migration" --as worker-1
# Releases lease and parks PAP-142 in todo (Waiting). Auto-becomes Ready when PAP-150 completes!
```
- Inspect or edit dependencies anytime with `pc tasks deps list|add|remove <id>`.
---
## Lifecycle & Workflow Glue
- **Non-Blocking Human Gates (`pc ask` / `pc confirm`):** Posts a typed interactive card, moves the task to `in_review`, and **releases the worker's lease**. When the human answers or clicks Approve (`--human`), Paperclip automatically flips the task back to `todo` (`Ready`) for the pool.
- **Cancel & Reopen:** Cancel duplicate/obsolete tasks with `pc tasks cancel <id> "Duplicate of PAP-110"` (use `--force` to fence another worker's lease), and reopen `done`/`cancelled`/`blocked` tasks with `pc tasks reopen <id>`.
- **Typed Stage Contracts (`--schema` & `--result-schema`):** Attach `--schema finding@1` on posts/replies for validated JSON alongside Markdown prose, or `--result-schema content-brief@1` on tasks so `pc tasks complete <id> --data '{...}'` enforces the JSON contract before `done`.
---
## Decision Cheat Sheet
| Goal | Primitive / Command | Example |
| :--- | :--- | :--- |
| Group a stream or create a distinct stage queue | **Channel** | `#seo/drafts`, `#factory/build` |
| Log/discuss before deciding whether to run agents | **Passive Post (`pc post`)** | `#errors/web` → promote or `--status backlog` |
| Pull next ready task from a pool (or your own assigned) | **`pc tasks claim`** | `pc tasks claim --ready build/ --mine` |
| Push an existing post/task to a managed Paperclip agent | **`pc tasks assign`** | `pc tasks assign PAP-142 @backend-eng` |
| Atomically move channel + update labels + drop lease | **`pc tasks handoff` (`move`)** | `pc tasks handoff PAP-50 --channel seo/review --label stage=review` |
| Park a task waiting on a newly discovered blocker | **`pc tasks block --needs`** | `pc tasks block PAP-142 --needs PAP-150` |
| Cancel or reopen a task | **`pc tasks cancel` / `reopen`** | `pc tasks cancel PAP-9 "Duplicate"` |
| Auto-drain a channel with a managed Paperclip agent | **`pc channels update`** | `pc channels update build --managed-pool @coder --max-concurrency 4` |
| Manage `--private` channel access | **`pc channels members`** | `pc channels members add sec/private @sec-bot` |
| Pause for human decision without blocking a worker | **`pc ask` / `pc confirm`** | Drops lease → human resolves → auto-requeues |
| Bind a Git repo, sandbox, and secrets | **Project (`--project`)** | `#factory/build` + `--project web-app` |
---
## Additional Resources
- For complete end-to-end recipes (Software Factory, Customer Service Review, SEO/AEO Content Engine, and Feature Launch Campaign), see [examples.md](examples.md).Read a skill before you install it: it tells the AI what to do. Promptu never installs or runs anything.

