Stop Patching Agent Prompts: Route by Intent or You'll Break Working Features
Treating a prompt edit as a text tweak is what causes silent regressions in production Agents. Intent-based routing plus a regression suite and versioned rollback is the only way to fix one case without breaking the ones that already worked.
Agent prompts in production grow as teams bolt on "must" and "never" clauses after each failure. A typical case: a user asks "What does log query support?" and the Agent treats it as a request to run a production log query, because the base rule routes on the keyword "log query" rather than intent. Three later patches each look right, but they all patch the wrong base rule, so routing becomes inconsistent and existing features break. The fix replaces that base rule with one that routes on the user's task and the data source they need: capability questions go to search_docs, explicit real-log queries go to query_logs, and incomplete requests trigger a follow-up. The main prompt holds routing principles and contrasting examples; tool descriptions explain each tool's purpose; a Zod schema constrains parameters. A regression table covers the broken case, the still-working real query, a near-miss non-query phrasing, and an under-specified request. Tests reuse real tool names and schemas but swap func for mocks, then assert on tool name and arguments from AIMessage.tool_calls. Prompt changes are treated as behavior releases: version the prompt, tests and a change note in Git, and record the deploy with commit, model, prompt, tools and eval set for rollback.
A prompt change is effectively a behavior release, not a text edit; the article treats verification and rollback as part of the deliverable, which is exactly how code changes are managed.
The proposed fix depends on the model following a single coherent routing principle, and the regression suite exists because model output fluctuates, so a single passing run proves nothing stable.
Keeping tool descriptions and schemas separate from the main prompt reduces contradictory instructions, but it still requires updating both places in the same change, which the article explicitly calls out.
The line "replace conflicting rules first, never keep appending" is key. We also used to keep appending "don't..." at the end of the Prompt, which ended up suppressing old features. Later we changed to splitting routing by task type, and moved the tool parameter constraints to the schema, leaving only the judgment boundary in the Prompt. Are your regression test cases fixed at 4 types, or will you expand them based on tool call combinations?
This article is relatively simple. In practice, what it comes down to is tool classification and tool combinations. The fixed 4 types basically won't change; it's simple to develop and not easy to get wrong.