Stop Claude Agents From Ending Tasks Too Early
In long-running coding or research agents, Claude may prematurely terminate tasks due to token budget concerns. Anthropic recommends informing Claude in the system prompt that its context window will be automatically compacted or saved, and instructing it to save progress to external memory prior to context refreshes.
<context_management_policy> Your context window will be automatically compacted and saved by the host harness. Do not artificially or prematurely terminate tasks due to token budget concerns. Prior to context refreshes, save your current progress and state to ./agent_state.json. </context_management_policy>Nobody has confirmed this prompt yet. If you try it, tell others whether it worked.
No comments yet.