Embed Guidance in Tool Output

Instead of front-loading every project gotcha into a giant instructions file the model forgets, put the guidance in the outputs of scripts and tools — error and success messages — so the reminder appears exactly where and when it is relevant.

What it is

Every project has small recurring gotchas, and the reflex is to document them all upfront in a CLAUDE.md or system prompt — but that path bloats the instruction file, and the more you cram in, the less reliably any single line lands. A better delivery mechanism is to push the guidance into the environment itself: embed it in the outputs of the scripts and tools the agent already runs — error messages, success messages, CLI responses — so the reminder surfaces at the exact moment it is relevant and nowhere else. This is precisely what good software has always done for humans: a well-written error message guides you to the fix, and the same design works for agents. Instead of a standing line that says "Always run migrations in production before deploying", have the deploy script detect pending migrations and print "Pending migrations detected. Run ./migrate.sh production before deploying." Instead of a note that a permissions script is production-only, have the script check its environment and answer "This script should only be run on the production server". The guidance is now unmissable, self-scoping, and costs nothing until it is needed — and it serves people and agents with the same artifact, instead of a separate rulebook that both have to remember to read. It inverts the usual context economy: rather than paying for every gotcha on every run by carrying it in the prompt, you pay for a gotcha only when the situation that triggers it actually occurs.

When to reach for it

When NOT to

Exemplars

Related