Want more token‑efficient agents? There might be a way.

I posted this article here at Post | LinkedIn on May 10th, 2026.

I spent this morning adjusting my LLM prompt architecture.

Most people throw data and a giant prompt at a model, pray to the God of Stochastic Parrots, and then weep when the token bill arrives.

But not every rule belongs in every prompt.
And switching entire prompts is messy, brittle, leading to duplicated code.

So I moved to a cleaner approach.

The model receives a behavioural contract, and runtime flags activate only the parts that matter.

No hallucinated behaviour.
No prompt drift.
No mystery failures.

Just deterministic, testable, maintainable AI behaviour, the way it should be.

It’s predictable, rollback‑able, and no longer requires sacrificing goats to the debugging gods.

I don’t expect this to go viral; there are cute cats on the internet. But if you’re building real AI systems, modular prompts and runtime state matter more than magic words.

Real‑world example

Imagine a user asks a question.

Your operator‑graph “Planner Agent” retrieves the relevant data and hands it to the “Answer Agent” to turn into prose.

Sometimes the user is the subject (“I am…”, “who is my…”).
Sometimes they’re not.

To support that case, I need a rule like:

“In FACTS labels, ‘you’ or ‘your’ refers to the person asking – report those facts in second‑person (‘you are 48 years old’, ‘your spouse is…’).”

Useful when needed.
A waste of 30+ tokens when not.

Multiply that across every user, every answer, every day, and it adds up.

So instead of a messy base prompt plus concatenated snippets in code, I built a simple prompt‑preprocessor:

#if HAS_HOME_PERSON
 In FACTS labels, "you" or "your" refers to the person asking - report those facts in second-person ("you are 42 years old", "your spouse is…").
#endif

If the flag isn’t set, the clause disappears.

I have 12 such conditional directives in the answer agent prompt…

My observability layer shows exactly which ones were used.

Token‑efficient.
Deterministic.
Maintainable.

Actual engineering.

— If you already do this, congratulations. —

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *