A common reaction to AI hallucinating infrastructure is:
“Just give it more context.”
More code.
More docs.
More Terraform.
More logs.
More everything.
It sounds reasonable.
But it quietly assumes something important:
infrastructure understanding is a “volume problem”.
It is not.
More Context Doesn’t Fix Wrong Structure
Let’s say you give an AI agent access to:
Terraform
CloudFormation
CDK
schema definitions
deployment configs
API code
docs
It can now “see more”.
But infrastructure problems are rarely about missing visibility.
They are about missing relationships.
For example:
Which service consumes this queue?
Which Lambda depends on this table?
Which schema version is actually deployed?
Which environment is stale?
Which index is required by this access pattern?
These are not text retrieval problems.
These are graph problems.
RAG Works on Similarity, Not Truth
RAG retrieves things that are:
semantically similar
textually relevant
contextually close
But infrastructure…