Definition

What is Structured Context?

Last updated

Context delivered to AI models as organized, typed records with named fields rather than raw prose or unformatted text.

Structured context improves AI accuracy by reducing token waste, exploiting model attention patterns, and enabling precise retrieval. Research shows format choice alone can swing LLM accuracy by up to 40%. Wire automatically transforms uploaded files into structured, typed records that agents can query efficiently.

  • Typed records with named fields beat prose for factual content: the model reasons over fields directly instead of parsing paragraphs to find them.
  • Format choice can swing accuracy by up to 40% on specific tasks, though a 9,649-experiment study found no significant aggregate difference between JSON, YAML, Markdown, and TOON on frontier models.
  • Smaller encoding does not mean cheaper: TOON encodes more compactly than JSON but cost 38% more total task tokens, because models are less fluent in formats absent from their training data.
  • More context is not better context: AI-generated context files reduced coding agent success rates by 3% while raising inference costs over 20%.
  • Structure at ingestion, not at query time, so every retrieval returns compact, pre-processed records instead of re-parsed raw documents.

How structured context works

Structured context replaces walls of prose with typed records: named fields, consistent shapes, and metadata like source and recency. Instead of handing the model a 50-page document, the system hands it records like {ticket_id, component, status, summary}. The transformation happens once, at ingestion, so every later query returns compact, pre-processed entries rather than re-parsing raw files.

Three mechanisms explain why this outperforms raw text. It cuts token waste by stripping boilerplate and filler. It exploits attention patterns, since clear fields and delimiters help the model allocate attention to the right places; research on prompt formatting found format choice alone can swing accuracy by up to 40% on code translation tasks. And it makes context queryable, so retrieval can return the 3 to 5 records that matter instead of 20 loosely related chunks.

Why structured context matters

Raw text dumps actively hurt. An ETH Zurich study found AI-generated context files reduced coding agent success rates by 3% while raising inference costs over 20%, because they restated information the agent could already infer. How context is structured matters more than how much is provided.

Structure is also what makes context economical. A March 2026 paper lists economy, the same facts in fewer tokens, as one of five criteria of good agent context, alongside relevance, sufficiency, isolation, and provenance. Density is the lever: fewer, richer tokens keep the model out of the input lengths where accuracy degrades.

But token efficiency is not the same as encoding size. TOON, a format designed to be smaller than JSON, cost models 38% more total task tokens across 9,649 experiments, because models lack fluency in formats their training data barely contains. Navigability for the model beats compactness on disk.

Common misconceptions about structured context

  • “Structured means JSON.” Wrapping prose in brackets is not structure. The value comes from meaningful fields, not syntax.
  • “The most compact format is the cheapest.” Total task cost includes the reasoning the model spends navigating the format. Formats the model has rarely seen carry a fluency tax that grows with scale.
  • “Everything should be structured.” Narrative content where flow carries meaning, like long-form writing and transcripts, often works better as text with clear sectioning.
  • “More metadata is always better.” Deeply nested schemas underperform simple, itemized records with light metadata. Structure serves retrieval, not complexity.

Structured context and Wire

Wire structures context at upload time. Files added to a container are processed into typed entries with extracted entities and relationships, so the work happens once instead of on every query. Agents then retrieve precise, compact records through wire_search, wire_explore, and wire_navigate over MCP, and can write new structured entries directly with wire_write.

FAQ

Frequently asked questions

Common questions about Structured Context.

When should I use structured context instead of raw text?
Use typed records whenever the content has consistent fields the model needs to reason over: tickets, customer profiles, product catalogs, logs. Keep raw text when narrative flow carries the meaning, such as long-form prose or transcripts where surrounding context is part of the signal.
Does the choice between JSON, YAML, Markdown, and TOON matter?
Less than the choice to structure at all. A 9,649-experiment study found no statistically significant accuracy difference across those formats in aggregate on frontier models. Smaller open-source models are more format-sensitive, and JSON's heavy presence in training data makes it the safest default.
Is wrapping text in JSON enough to make it structured?
No. A JSON object with a single content field holding 5,000 words of prose adds token overhead without helping the model find anything. Structure means organizing information into meaningful, self-contained fields the model can reason over, not adding brackets around paragraphs.
Can context be over-structured?
Yes. Research on the ACE framework found small, itemized units with simple metadata outperform deeply nested schemas. Structure should serve retrieval and relevance. Each record needs to be compact and self-contained enough for the model to use directly.
Why did a more compact format end up costing more tokens?
Because the model is part of the cost function. TOON encodes smaller on disk, but models have little training exposure to it, so they spend extra tokens navigating the format, retrying, and re-retrieving. Across 9,649 experiments that fluency gap made TOON cost 38% more in total task tokens than alternatives.

Put context into practice

Create your first context container and connect it to your AI tools in minutes.

Create Your First Container