Refactor an agent prompt into contract and state
Refactor a long agent prompt so stable contract and tools can be cached while dynamic state remains accurate.
A research agent sends full transcript, scratchpad, tool results, tool schemas, and system rules in one growing block. Cache hits are unpredictable and latency climbs across turns. Contract before state: durable agent definitions should precede changing observations and scratchpad content. The novice move is full-context caching: send everything in chronological order and hope the provider reuses enough. That maximizes convenience but mixes stable and volatile content. Step 1 Define Agent Contract v5: role, safety rules, planning rules, output format, escalation policy. This is the durable identity of the agent and should change only through release review. Step 2 Place Tool…
Sign up free — one personalized lesson every day, matched to your role and goals.
Already have an account? Sign in