Topic 6 of 9 · Level 3: Connected knowledge

Context Engineering

“Context” can mean both a model’s context window and the information supplied to it. Managing the relationship between those two meanings is one of the largest available cost-efficiency opportunities. context-mode is the toolset I use daily to externalise runtime context efficiently.

Two meanings of context

A model has an operating context window: the amount of information it can work with in one session. It is measured in tokens—256k is common, while 1m is becoming more common.

Context in the ordinary sense is the information supplied while conversing with the model. Context engineering begins when you decide what information belongs inside the operating window at a given moment.

Fitting is not the same as working well

Consider a React project with 20k lines of code and 50 pages of documentation. A rough estimate puts that at 120k tokens. It fits in a 256k-token context window, but two issues remain:

  1. It uses roughly half of the window. Model effectiveness often drops past about 40%; this is not an exact threshold, but it is a useful warning that the model has left its “smart zone”.
  2. The cost of each turn rises as the active context window becomes larger.

Externalise information, retrieve the minimum

The common solution is to externalise context as information, let the model search the external store, and pull only the minimum relevant material into the active context window.

context-mode takes this approach to an extreme. It provides tools that externalise runtime context into a SQLite database beside the session, return the equivalent of a contents page to the model, and provide search tooling to retrieve only the right chunks when they are needed.