Introduction

Most developers treat AI coding assistants like black boxes. When the output is wrong, the instinct is to blame the model. Viktor Tr, an ML and Python engineer, took a different view: if a language model is a function, the input is the only variable the user controls. To test this idea, he ran Claude Sonnet through the same small programming task under four different prompt setups. The gap between failure and success came down to a single, twelve-line file.

What Happened

The task was straightforward: add a function that converts a raw order dictionary into an Order object inside a tiny Python package called shoplite. Tr wrote eight hidden tests that checked identifiers, exact monetary totals, normalized SKUs, and proper validation errors for bad input.

In the first condition, the model received only a one-line instruction. Not surprisingly, it passed zero tests. In the second, it saw the real data model and input format but no team rules. It passed one test out of eight. Across five runs, the model made the same guesses every time: it used Decimal for money, raised ValueError for invalid input, invented status and created_at fields, and named attributes id and quantity instead of the project's order_id and qty.

The turning point came when Tr added a twelve-line conventions file along with the helper files it referenced. That file specified that money must be stored as an integer number of cents, that bad input must raise a specific ValidationError, and that SKUs must pass through a normalization helper. With those rules in the prompt, Claude passed all eight tests in every one of five runs.

Tr also buried the relevant files in roughly 62,000 tokens of unrelated standard-library code to simulate a noisy repository. Quality did not drop, but the cost rose sharply—about six times higher per run, even with prompt caching.

Why This Matters

The result reframes how teams should think about AI-assisted coding. A language model does not know your repository, your meeting history, or your unwritten style guide. When information is absent, it fills the gap with the statistically most likely pattern from its training data. That is why generic tutorials often produce code that looks reasonable but violates project-specific constraints.

Tr's experiment shows that missing context is a far more expensive error than extra context. Unrelated noise cost money and tokens, but it did not break the task when the important files were clearly labeled. In real-world sessions, however, noise is rarely so tidy: outdated files, abandoned approaches, and stale documentation look relevant and can mislead an agent.

Key Takeaways

  • You control the input, not the model's weights. Treat the prompt as a dataset where missing values get imputed with averages.
  • A data model alone is not enough. Without explicit conventions, the model invents its own error types, field names, and money handling.
  • A short conventions file can move results from one passing test out of eight to eight out of eight, consistently across repeated runs.
  • Clearly labeled noise did not reduce quality in this test, but it increased cost significantly. Real-world noise is usually harder to ignore.
  • Context engineering—supplying exactly what the task needs and little else—matters more than prompt engineering tricks.

Conclusion

Before declaring that an AI agent is incapable, check what it actually saw. Did it receive the goal, or only the task? Did it have the project's conventions, or was it left to guess? Was the full error included, or just a vague complaint? Fixing the input in a file the agent reads every time does not repair a single answer; it improves every future answer.

Models are improving, but they can only reason about what is in front of them. Whatever is missing gets filled with the typical guess. The practical lesson is simple: give the agent all the signal it needs, avoid paying for noise it does not, and treat context as a feature you design rather than an afterthought.