Context From First Principles: Engineering What an AI Gets to Know

· Ernan Hughes
Ebook
304
Pages
Tools
Eligible

About this ebook

A context window tells an AI how much it can receive. Context engineering decides what it should receive.

Modern AI systems can access enormous amounts of information: conversations, files, project rules, memories, retrieved documents, tool results, plans, execution traces, summaries, and state accumulated over hours of work.

But access is not context.

The real problem is deciding what information should influence a particular computation, in what form, under what constraints—and how we know whether those decisions actually helped.

Context From First Principles develops context engineering as a systems discipline rather than a collection of prompting tricks.

Starting with a simple distinction between the context window and the information actually made available to a model, the book works progressively through the problems that appear when context becomes an engineered resource:

• What information deserves admission?

• What must remain exact, and what can be compressed?

• When should information leave the live context and later return?

• How should memory, retrieval, tools, and agent-generated state interact?

• How do authority, freshness, and scope determine whether information is eligible?

• When are two representations substitutes—and when are they complementary?

• How can context be assembled deterministically under dependencies, conflicts, requirements, and a finite budget?

• How do we prove that the context we constructed actually reached the runtime?

• And most importantly: did changing the context improve what the model did?

The investigation culminates in a Context Compiler: a deterministic system that turns candidate information, policy, constraints, and a task request into an ordered context bundle—or refuses when its rules cannot construct one.

But building the compiler exposes a deeper problem.

A structurally valid context is not necessarily the right context.

Available is not eligible.

Eligible is not selected.

Selected is not correctly represented.

Compiled is not delivered.

Delivered is not used.

Used is not helpful.

The book therefore follows context beyond compilation into instrumentation, transport, observation, and behavioural evaluation.

The experiments include successes, counterexamples, an instrumentation failure that invalidated an entire behavioural wave, and a later experiment in which context delivery was successfully verified on every run—yet produced no improvement on the measured outcomes.

That distinction matters. A failed experiment is not the same thing as a valid negative result.

Throughout the book, claims are kept deliberately bounded. Synthetic evidence is not presented as evidence of real-world prevalence. Determinism is not confused with correctness. A compiler refusal is not treated as proof that no legal context exists. And successful delivery is not evidence that a model actually used the information it received.

The result is not a recipe for the perfect prompt or a claim to have discovered the universally optimal context.

It is a framework for making context explicit, inspectable, measurable, and falsifiable.

For engineers building AI agents, coding assistants, retrieval systems, memory systems, or other long-running LLM applications, Context From First Principles provides a way to reason about a question that becomes more important as models gain access to more information:

What should this model be allowed to know right now, in what form, and what evidence would show that the choice helped?

Context engineering begins when a larger window stops being an answer.

A context window tells an AI how much it can receive. Context engineering decides what it should receive. Modern AI systems can access enormous amounts of information: conversations, files, project rules, memories, retrieved documents, tool results, plans, execution traces, summaries, and state a...

Discover more

Rate this ebook

Tell us what you think.

Reading information

Smartphones and tablets
Install the Google Play Books app for Android and iPad/iPhone. It syncs automatically with your account and allows you to read online or offline wherever you are.
Laptops and computers
You can listen to audiobooks purchased on Google Play using your computer's web browser.
eReaders and other devices
To read on e-ink devices like Kobo eReaders, you'll need to download a file and transfer it to your device. Follow the detailed Help Center instructions to transfer the files to supported eReaders.