skills/tier-5-automation/long-running-agent/SKILL.md
Convert a planning doc or spec into a phase-based task structure for autonomous multi-session execution. Asks whether the agent should run in orchestrator mode (self-verifies and continues across phase boundaries) or phase-checkpoint mode (stops at each phase for human verification), then generates the right claude-prompt.md and claude-task.json. Built on the patterns from Anthropic's effective-harnesses-for-long-running-agents engineering blog.
npx skillsauth add pbc-os/agent-skills-public long-running-agentInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Turn a spec into a working long-running agent — phases, tasks, verification, and the operating prompt — in one shot.
This skill converts planning documents and specs into the file structure a long-running Claude agent uses to execute multi-session work: a claude-task.json task tracker, a claude-prompt.md operating manual, and a preserved SPEC.md. Before generating files it asks how autonomous the agent should be, so the prompt and task structure match.
Before doing anything, fetch and read this blog post for the core patterns:
https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents
The blog defines the effective patterns for long-running coding agents. Apply them directly. Key takeaways: phase-based work with verification checkpoints, granular task enumeration, JSON task tracking, git checkpointing per task, never weaken/remove tests to make a phase pass.
Request from the user:
SPEC.md.project field.If the user has the spec inline in chat or pointed at a file path, read it. If multiple files together form the spec (e.g., a SPEC.md + a data_model.md + a workflows.md), read all of them.
Fetch the Anthropic blog post above. The patterns to apply:
task-XXX: brief descriptionBreak the spec into:
Phases (3–10 typically):
verification block with description + stepsTasks (per phase):
description, a steps array, and passes: false initiallyExample structure:
Phase 1: Project Foundation (3 tasks)
- setup-001: Initialize project structure
- setup-002: Create environment config
- types-001: Define core interfaces
Verification: "npx tsc --noEmit returns exit 0; no errors"
Phase 2: Storage & Skills (5 tasks)
- storage-001: Create storage interface
- skill-001..004: Create skill files
Verification: "Confirm skills load via test harness; storage round-trip test passes"
Before generating files, ask the user how autonomous the agent should be using AskUserQuestion. This decision shapes both claude-prompt.md and claude-task.json.
Use this exact question structure:
question: "How autonomous should this long-running agent be?"
header: "Autonomy"
multiSelect: false
options:
- label: "Orchestrator mode"
description: "Claude self-verifies at phase boundaries and continues to the next phase automatically. Stops only on auth/credentials, scope decisions not in the spec, destructive/visible-to-others actions, or persistent blockers. Best when you don't want to babysit and the spec is detailed."
- label: "Phase-checkpoint mode"
description: "Claude stops at every phase boundary, prints the verification steps, and waits for you to confirm before continuing. Best for high-risk projects, when verification needs human judgment, or when you want frequent visibility into what's been built."
The answer determines:
claude-prompt.md template to use (Step 6)claude-task.json (Step 5)If the user picks Other and writes a freeform answer, interpret it: words like "autonomous / orchestrator / no babysit / keep going" → orchestrator. Words like "checkpoint / stop / verify / supervise / approval" → checkpoint. Genuinely ambiguous → re-ask with a sharper question.
Save the chosen mode as MODE (orchestrator or checkpoint) for use in the next steps.
Create the task file using templates/task-template.json as the base structure:
phases array with verification stepstasks array with passes: false initiallyphase fieldIf MODE = orchestrator, also include:
mode: "orchestrator" fieldorchestrator_notes summarizing the operating modelauto_advance: true | false — true when the phase's verification is fully programmatic (commands + thresholds with no human judgment); false for phases that need human review (e.g., a final hardening phase with a "comprehensive docs" check)dispatch_hint field — one of self, sub_agent_general, sub_agent_explore, or out_of_scope. Heuristics:
sub_agent_general for: PDF/document extraction, per-vendor / per-shop / per-region / per-customer parallel work, DB exploration involving 5+ queries, code-review/critic passes, anything taking 15+ tool callssub_agent_explore for: cross-repo search, "where is X used" huntsself for: small DDL/config edits, single-file scripts, orchestration decisions, anything < 5 tool callsdispatch_reason — one short line explaining the choiceIf MODE = checkpoint, no extra fields are needed beyond the base template.
Output: {project-root}/claude-task.json
Use the template that matches MODE:
MODE = orchestrator → templates/claude-prompt-template-orchestrator.mdMODE = checkpoint → templates/claude-prompt-template.mdKey sections to customize in either template:
SPEC.md, claude-task.json, any reference docs)Output: {project-root}/claude-prompt.md
The original spec should remain as SPEC.md for the agent to reference when it needs detailed requirements during execution.
If the input was a single file: copy it to SPEC.md. If the input was multiple files: either bundle them into one SPEC.md with a clear table of contents, OR keep them separate and have the generated claude-prompt.md list them under "Key Files."
{project-root}/
├── claude-prompt.md # Agent operating manual (orchestrator OR checkpoint variant)
├── claude-task.json # Phases and tasks (extra fields if orchestrator mode)
└── SPEC.md # Original planning doc (preserved for reference)
Instruct the user to point a fresh agent session at the prompt:
@claude-prompt.md
The agent will read claude-task.json, find the current phase, and:
task-XXX: descriptionThe two modes differ only in who runs the verification at phase boundaries:
templates/claude-prompt-template.md — Phase-checkpoint mode template (default for high-risk or visibility-sensitive projects)templates/claude-prompt-template-orchestrator.md — Orchestrator-mode template (autonomous; stops only on escalation)templates/task-template.json — Base claude-task.json structure (mode-specific fields are described in Step 5)tools
Generate and iteratively refine USPTO-style patent figure drawings from provisional patent application markdown files, using nano-banana for v1 generation and targeted single-fix edits for v2+ iteration.
data-ai
Weekly revenue / sales forecasting for small businesses with multiple locations or product lines. Blends recent trend + seasonal baseline + YoY growth with per-entity holiday multipliers and week-of-month adjustments. Ships autoresearch-compatible eval and parameters so you can tune it on your own historical data.
data-ai
Analyze email, calendar, and file patterns to discover repeatable workflows that AI agents can automate.
testing
Automated daily digest for small business owners. Combines email triage, calendar agenda, open tasks, and business KPIs into a single morning briefing. Composable — works with whatever data sources are available. Urgent emails require body inspection and explicit escalation signals — never classified from sender/timing metadata alone.