Home
cd ../playbooks
Developer ToolsAdvanced

Long-Horizon Agent Prompting

Design the launch prompt for an agent working autonomously for hours or days — a pseudo-formal task brief with an exact success predicate, an enumerated non-counting-outcomes list, adversarial verification, and effort floors, because persistence pressure against a loose spec produces confident non-solutions.

10 minutes
By muratcankoylanSource
#prompt-engineering#autonomous-agents#multi-agent-orchestration#verification#agent-design#claude-code

A short interactive prompt fails cheaply when it's wrong. A long-horizon brief with a loophole burns hours of compute producing a confident, answer-shaped artifact that never actually solved the problem — and the cost of a weak specification scales with exactly the autonomy that makes long runs worth running.

Who it's for: developers launching long-running autonomous agents or multi-agent orchestrations, teams building agents that work for hours or days on hard open-ended problems, anyone diagnosing a failed long run that returned a plausible-looking non-solution, prompt engineers designing verification and stop conditions for persistent agents

Example

"Write the launch prompt for an agent debugging why v4 underperforms v3 in production" → An exact success predicate (a defect that closes the gap, proven by a reproduction script and a corrected run — not a narrative), an explicit non-counting list ruling out correlational stories and partial explanations, an adversarial verification checklist for the reviewer, and a return condition gated on surviving that review instead of on the agent's own confidence

CLAUDE.md Template

New here? 3-minute setup guide → | Already set up? Copy the template below.

Or install from your terminal:
npx ccplaybooks add long-horizon-agent-prompting
# Long-Horizon Agent Prompting

Design the launch prompt for an agent expected to work autonomously for hours or days — alone, or as an orchestrator managing many parallel workers. The central technique: a **pseudo-formal task brief**, written with the rigor of formal verification but expressed in plain language, because most hard problems have no machine-checkable success condition.

The controlling trade-off: everything that makes a long run productive — persistence, autonomy, parallelism — also raises the cost of a weak specification. A short interactive prompt fails cheaply. A long-horizon brief with a loophole burns hours of compute producing an answer-shaped artifact that doesn't actually solve the problem.

## When to Use

- Writing or reviewing the launch prompt for a long-running autonomous run, before committing agent time to it
- Converting a vague hard problem ("solve X," "figure out why Y happens") into an explicit brief with a real success predicate
- Writing the root or orchestrator prompt that manages many parallel workers on an open-ended search problem
- Adding persistence instructions, stop conditions, effort floors, or return gates to an existing agent prompt

Get new playbooks like this one

One email a week with new Claude Code workflows. Free, like everything here.

No spam. Unsubscribe anytime.

README.md

What This Does

A methodology for the specific, high-stakes prompt that launches an agent expected to work autonomously for hours or days — alone, or orchestrating many parallel workers on an open-ended hard problem. The central technique is the pseudo-formal task brief: definitions covering every degenerate edge case, an exact success predicate with explicit scope quantifiers, and — the highest-leverage piece — an enumerated list of near-miss outcomes that explicitly don't count, since under persistence pressure a model reliably produces an answer-shaped partial result unless every escape hatch is named and closed in advance.

It covers the real trade-off underneath long-horizon prompting: persistence instructions counter a documented drift toward giving up, but the same pressure raises the surface for reward hacking — so the hard design rule is that every persistence instruction needs a matching verification gate, never one without the other. It also covers the verification bottleneck (parallel sampling finds good answers faster than a system can reliably select them, so budget as much design effort for the auditor as the generator), structural diversity in parallel search (role labels alone don't prevent convergence), and a concrete brief-writing workflow that ends in red-teaming the finished brief by asking a fresh model instance how it could satisfy the letter without the intent.


Quick Start

Step 1: Create a Project Folder

mkdir long-horizon-prompting && cd long-horizon-prompting

Step 2: Download the Template

Click Download above, then:

mv ~/Downloads/CLAUDE.md ./

Step 3: Write a Launch Brief

claude

Describe the hard, open-ended problem you want an agent to work on autonomously. Claude will walk through the brief-writing workflow — success predicate, non-counting outcomes, auditor checklist, effort floor — and red-team the result before you launch it.


Tips & Best Practices

  • The non-counting outcomes list is the single highest-leverage section to spend time on — every excluded near miss is one fewer way the agent can produce something that looks like success without actually being it.
  • Red-team the finished brief before launching a genuinely expensive run, even when it feels obviously airtight — the "how could an agent satisfy the letter without the intent" question routinely surfaces a loophole the author was too close to see.
  • Resist over-specifying the path. Leaner, outcome-first prompts have outperformed accumulated instruction stacks in practice — spend the budget on the predicate and the failure modes, not on prescribing exactly how to get there.

Limitations

  • Built for genuinely long-running, high-effort autonomous work — applying this level of specification rigor to a short interactive task is pure overhead.
  • Generalizes past its clearest exemplar (mathematics) but needs real translation work per domain — the auditor checklist and non-counting list have to come from someone who actually knows that domain's specific failure modes.
  • A well-written brief reduces but doesn't eliminate reward-hacking risk — pair persistence instructions with runtime-level (not just prompt-level) verification and sandboxing wherever the stakes justify it.

$Related Playbooks

Developer Tools

Loopy: Build and Reuse Agent Loops

Mine your codebase and coding history for repeated work, turn it into bounded agent loops, and audit the loops you already have

10 minutes
Intermediate
Developer Tools

LLM Icon Finder

Find and download AI/LLM model brand icons from the lobe-icons library — Claude, GPT, Gemini, and more — as ready-to-use SVG, PNG, or WEBP URLs.

5 minutes
Beginner
Developer Tools

LLM Coding Guardrails

Four behavioral guidelines that reduce the most common Claude coding mistakes: silent assumptions, overcomplication, scope creep, and vague success criteria.

2 minutes
Beginner
Developer Tools

Multi-Stage Prompt Pipeline

A methodology for building Claude-to-Claude prompt pipelines where one stage's output feeds the next — a four-purpose taxonomy (Research/Plan/Do/Refine), per-prompt provenance folders, XML-structured outputs with required metadata tags, a fixed human-scannable SUMMARY.md, dependency-aware layered execution, and per-stage validation before anything chains forward.

10 minutes
Advanced
Developer Tools

Minimalist UI Design Skill: Editorial, Monochrome Interfaces

A frontend design system that enforces warm monochrome, bento grids, and editorial typography — the Notion/Linear look, banned from gradients, heavy shadows, and Inter

5 minutes
Beginner
Developer Tools

Mermaid Tools

Extract Mermaid diagrams from markdown files and render them to high-quality PNG images using bundled scripts — turning text diagrams into shareable visuals.

5 minutes
Beginner
Developer Tools

Minimalist MVP Scoping

Scope a weekend-shippable MVP using the manual → processized → productized progression. Build as little as possible; charge from day one.

5 minutes
Beginner
Developer Tools

MCP Server Hub Manager

Access 1200+ AI Agent tools via Model Context Protocol (MCP)

10 minutes
Advanced
Developer Tools

n8n Workflow Builder

Automate document workflows with n8n - 7800+ workflow templates

10 minutes
Advanced
Developer Tools

MCP Server Builder

Guide for creating high-quality Model Context Protocol (MCP) servers that enable LLMs to interact with external services and APIs.

30 minutes
Advanced
Developer Tools

Nuxt UI Component Guidance

Build interfaces correctly with @nuxt/ui v4 — five core rules (UApp wrapper, semantic colors, reading generated theme files for real slot names, override priority, icon naming), a task-to-focus-area routing table, the Nuxt UI MCP server for live component API lookups, and full installation for both Nuxt and standalone Vue.

5 minutes
Beginner
Developer Tools

Reshape PR Commits

Turn a branch's messy WIP/fixup commit history into a clean, logically-grouped set of commits before review — proposed regrouping with explicit approval, git reset --soft plus staged re-commits instead of interactive rebase, and hard guardrails (feature branches only, force-with-lease only, never touch another author's commits).

5 minutes
Intermediate

Browse all Developer Tools playbooks →