Recurse docs / 05
Design the task and checks
Define the objective (i.e. specify what a desirable outcome is), domain requirements, and allowance before running a Recurse agent. Your coding agent translates these into a task description, action tools, verifiers, and a completion gate. The Recurse agent needs to know what it can change, how to compare candidates, and what evidence it must return.
The Recurse skill instructs coding agents to prepare a concrete proposal before starting a concrete agent design. Review that proposal for domain assumptions, missing constraints, and the time or spending allowance.
Define the task before running it
Use the following questions to review your coding agent’s proposal and identify requirements or assumptions that require clarification.
| Element | Question to answer |
|---|---|
| Inputs | What does the caller supply, and which units, formats, and ranges are acceptable? |
| Outputs | What result and/or artifact files must the caller receive upon task completion? |
| Objective | What makes one acceptable candidate better than another? |
| Hard constraints | Which requirements must every acceptable candidate satisfy? |
| Search choices | What can the Recurse agent vary, and what it cannot change? |
| Verifiers | Which verifiers will the coding agent provide for the Recurse agent to check each requirement and measure quality? |
| Feedback | What information will help the Recurse agent correct an infeasible candidate or choose another approach? |
| Completion | When should the search stop, and what must be part of the final deliverable? |
| Allowance | How much time or spending is available for development runs and final execution? |
If a missing detail would change what counts as useful or acceptable, resolve it before execution. Make sure to review any routine assumptions the coding agent may have made for your behalf. Scrutinize any arbitrary score weights or thresholds the proposal may contain; when a threshold is necessary, make sure to clarify its basis and any trade-off the choice introduces.
Separate feasibility from quality
As your coding agent iterates on the Recurse agent, it will prioritize constraints before output quality. An improvement in the objective cannot compensate for an unmet requirement unless the task explicitly permits that trade-off. If you observe the coding agent not following this methdology, reminding the Recurse skill will likely help it start following instructions again. Remember, your coding agent supplies and revises the domain tools for your project; you provide the actual limits and the mandatory conditions/constraints.
Define the search choices
State the variables your Recurse agent can change and the information it must treat as given. You may discuss these with your coding agent during the initial proposal stage. The coding agent designs action tools to apply those choices. Action tools may reject illegal inputs and preserve basic invariants, but do not conflate action tools with verification tools. Leave room for the Recurse agent to evaluate results and select alternatives accordingly, rather than micromanaging computational steps and tools, or excessively enumerating sample solutions.
Tools also define the limits of what a Recurse agent can do. If the current set of tools cannot represent a given constraint or measure a necessary property, changing the prompt alone will likely not supply that capability. In such cases, coding agents will often revise or update the set of tools without requiring manual intervention or steering.
Specify what each verifier establishes
A verifier should measure a candidate result independently of the tool that produces it. Depending on the domain, it can use tests, a simulator, a solver, an executable query, or some other technique.
When investigating or debugging an issue with a Recurse agent, we advise to check the following for every verifier:
- The property it checks and the inputs or conditions it uses.
- The measurement, units, and applicable acceptance rule(s).
- The diagnostics it returns for a failing or uncertain check.
- The claims the check does not establish.
A validator must never tautologically agree with the candidate-producing (action) tool.
Feedback drives iterative refinement
The Recurse skill instructs your coding agent to write verifiers that not only return values, but also the applicable requirement(s) along with enough context to locate any problem(s) when possible. A CAD verifier returning a message such as "displacement of X exceeds the allowable value under Y lbs" gives the Recurse agent more useful information that can guide its next step than an opaque failure flag.
Likewise, separating actual constraint violations from unavailable measurements is important. A simulator failure does not establish that the candidate result passes or fails a physical requirement. Preserving that distinction in the tool result and in the Recurse agent's final report helps performance.
Finally, tool errors should identify correctable inputs or prerequisites. Docstrings must explain how the Recurse agent should interpret measurements and error conditions; see Write prompts and Python tools.
Defining completion is crucial
Define a quality target when the task has one. It is also good practice to specify what should happen if the agent exceeds it allowance before reaching the target, or if a tool or measurement becomes unavailable.
The Recurse skill specifies that a Recurse agent must preserve the best feasible candidate while exploring alternatives. Later failures or worse candidates should not overwrite it. If there is no feasible candidate, it should report that outcome and the failing requirements rather than selecting an infeasible candidate as successful. If you see a behavior inconsistent with this, ask your coding agent to investigate.
The coding agent must provide an explicit completion tool for the Recurse agent to check completion conditions and save its result. Its receipt should identify the chosen candidate, any measurements, constraint outcomes, output files, and stop reason. The Recurse agent's final JSON should agree with that receipt and match the manifest's output schema.
The appropriate stop reason may be a resource limit, diminishing returns, a blocker, or success (i.e. achieving the given goal). A timeout is not evidence that further improvement is impossible. When the Recurse agent uses diminishing returns as the main stopping rule, it will base the judgment on the history of gains, remaining approaches, and the cost of further attempts.
Set the allowance
Specify an allowance across the work you intend to authorize. A trial count, a run count, a time budget, and a dollar amount constrain different things. A limit of three trials does not fix the cost.
Your coding agent should track total use across development runs and concurrent approaches against the allowance you set. Independent approaches may run concurrently when they fit the allowance and have the necessary isolation. Work that depends on earlier results will wait for them.
The Recurse agent’s prompt instructions do not create an additional platform spending control. Track usage through the available account and run information, and use the platform's actual resource and execution limits in Costs and limits.