Skip to main content

BATCH_WRITE_GUIDANCE

Constant BATCH_WRITE_GUIDANCE 

Source
pub const BATCH_WRITE_GUIDANCE: &str = "## Batching file writes\n\n\
- When you are scaffolding SEVERAL independent files, do not spend one turn per \
file. Either emit all their `write_file` calls in a SINGLE turn (batching, as \
above), or use the `write_files` tool, which takes an array of files and writes \
them all in one call — an N-file scaffold should cost ONE turn, not N.
- When several required artifacts remain, write them in ONE `write_files` call \
rather than one per turn.";
Expand description

The batch-write instructions, lifted OUT of BASE_PREAMBLE (#4602).

Why: these two bullets do not merely mention a tool, they INSTRUCT the model to call write_files (and to batch write_file calls). An agent whose registry holds neither — the delegating PM — obeys them and its call comes back as ToolCallExtractError::UnknownTool, the same failure class the discovery blocks caused. The e.g. mentions still inside BASE_PREAMBLE’s tool-use protocol are illustrations of BATCHING, not instructions to call a tool, so they stay. What: the verbatim bake-off-tuned wording of the two bullets (#2681, #2824), gathered under one heading and appended only when the registry carries every tool they name (crate::prompt::BATCH_WRITE_TOOLS). Test: prompt::tests::guidance_never_names_an_unregistered_tool, prompt::tests::batch_write_guidance_follows_the_registry.