Your agent just spat out five variations of the same mediocre idea. They all look like the glowing-globe dashboards cluttering UAE exhibitions: interchangeable, soulless, and mathematically 'correct' in all the wrong ways. Developer Mohammad Dafzal dropped a new implementation pattern on DEV.to that cuts through this noise. He argues that the root cause isn't model intelligence, but how we encode preference into the agent's context window.
Separate Hard Constraints From Soft Tastes
Dafzalβs core thesis is that blending requirements and style into a single weighted score is a trap. If you let 'excellent typography' compensate for a 'missing migration guide' via a numerical score, youβve built a system that sends everyone to support while looking pretty. His proposed taste record splits the data into three distinct layers: Context (audience and task), Constraints (binary checks like required URLs or banned phrases), and Preferences (annotated examples with reasons). This prevents the model from hallucinating that a stylistic win outweighs a functional failure.
The Mechanical Gate Must Stay Honest
The implementation relies on a minimal Python gate that checks for exact substring matches on banned phrases and required URLs. It is explicitly not a security boundary or an AI detector. It won't verify if a link works or if a claim is true, only if the structural requirements are met. Dafzal warns against over-engineering this layer; a simple normalisation function that casefolds and strips whitespace is sufficient. If the gate flags a phrase quoted for criticism, you need an explicit exception path with a recorded reason, not a fudge factor.
Generate Alternatives Before Asking for a Winner
To combat the 'Artificial Hivemind' effect where agents converge on the same safe output, Dafzal suggests generating materially different structuresβlike action-first, before-and-after, and trade-off-firstβbefore asking a critic agent to choose. The critic needs the taste record, the candidates, and the task context. Crucially, the candidate text must be separated from instructions to prevent prompt injection. Treat any stated probabilities in the model's output as raw data, not calibrated confidence. A second agent can share blind spots with the first, so human inspection remains the ultimate safety net.
Store the Decision, Not Just the Winner
The final piece of the puzzle is retention. Don't just save the output that passed the gate; save the rejected alternatives, the human rationale for the choice, and the version of the taste record used. Keep a few examples out of the prompt to test if your revised preferences generalize or if you're just overfitting to the examples you showed the model. If the output passes every mechanical check but readers still misunderstand it, the record is wrong, not the readers. Change the record.
Key Takeaways
- Constraints (must-pass checks) and Preferences (style choices) must never share a weighted score.
- A simple substring matcher for banned phrases and required URLs is sufficient for the mechanical gate.
- Generate structurally different candidates (action-first vs. trade-off-first) to break convergence.
- Record rejected alternatives and human rationale to test if taste profiles generalize beyond training examples.
The Bottom Line
Stop pretending a decimal point can capture taste. Structure your agent's context so hard requirements can't be bribed by soft preferences, or you'll just automate mediocrity.