An AI coding assistant collects a surprising amount of paperwork. Ask it to investigate a problem and it may read files, run checks, search for related code, and inspect long reports. Each step produces more information. Some of it is essential. Some was useful five minutes ago but has little bearing on what happens next.
That is the problem I built Context Diet to address. It is a plugin for Codex, OpenAI's coding assistant, that helps reduce the bulky results carried forward during a task. The idea is to give the assistant less clutter to work through while preserving the evidence it still needs.

The problem I wanted to solve
Think of context as the material laid out on a desk before someone starts working: the request, relevant documents, earlier decisions, and results from recent checks. An AI model has a limited amount of this material available for each response. That is its context window. The desk is an analogy for working space, not a claim that AI remembers things the way we do.
In Codex, much of that material comes from tools. A tool might open a file or run a test. Its output is simply what comes back. A successful test can still produce pages of text, and those pages can remain part of the conversation after their useful moment has passed.
Codex already manages long conversations through compaction, which reduces the accumulated context. Context Diet works earlier, when eligible tool results arrive. It asks whether the bulky contents are still needed before they become more material to carry through subsequent requests.
Fast judgments and deliberate reasoning
Recognising a familiar face feels different from working out a complicated household budget. One happens quickly. The other requires deliberate attention, intermediate steps, and checking your assumptions.
The terms System 1 and System 2, popularised by Daniel Kahneman, describe that distinction in human thinking. They also provide a useful analogy for AI: a focused judgment on one side, extended reasoning on the other. Models do not have human minds, and these labels are not a universal classification of every AI system.
A reasoning model can work through a difficult software problem, consider alternatives, and write an explanation. A decision model can answer a narrower question, such as whether a document is relevant or which category a message belongs to. General-purpose models can make those judgments too. The point is that a specialised model may suit a repeated, bounded decision without having to generate a written answer.
Meet Jev and Laya
Jev is TypeSafe's hosted System One model. You give it information and focused questions. It returns a choice, a score, or a probability that a statement is true. Software can use those answers directly. It does not need a paragraph explaining its conclusion.
For example, a customer-support system might ask whether a message concerns a refund, delivery, or account access. The answer helps route the message. A confidence estimate can help decide whether to involve a person, although confidence never guarantees that an individual answer is correct.
Laya is a separate open decision-model project from ConvAI Innovations, released under Apache 2.0. It also supports choices, scores, and yes-or-no probabilities, and can run on your own computer. For Context Diet, this provides a local alternative to sending decision requests to Jev. Both assist with focused judgments; Codex remains responsible for the larger task and its response.
What happens to a long test report
Imagine Codex runs a test suite and receives thousands of lines describing individual checks. The tests finish successfully. The next step is to inspect one small change. Keeping every line of the report may no longer help.
Context Diet assesses eligible output using questions about whether the contents remain necessary and whether the information could be retrieved again. Ordinary code applies the replacement rules around those judgments. When a result qualifies, the plugin substitutes a compact record containing selected evidence and a note explaining what was omitted. It changes what the model sees, not the project's source files.
A failed test deserves more care. The replacement mechanism gives priority to error lines, stack traces, and summaries within its size limits. Uncertain judgments retain the output, as do provider failures. These precautions reduce risk, but they cannot make a probabilistic decision infallible.
The note also identifies the command, so Codex can run it again if necessary. That is useful recovery, not a promise to recreate the past. A file, database, or external service may have changed. The plugin therefore considers whether information is replaceable, rather than treating every result as disposable. It also only sees results routed through the supported hooks, not everything Codex encounters.
Why I included a local option
Jev remains the default. The Laya integration includes a small additional decision component trained using Jev's judgments as examples. It learns a narrower version of this particular task, rather than replacing Laya's general capabilities. The approach is conservative and keeps more output; some configurations kept everything in the published evaluation. Learning from Jev also means it can inherit Jev's mistakes. The provider notes explain the measured differences.
The privacy distinction matters. Hosted Jev receives selected, redacted context for its decisions. Local Laya performs that decision step on your machine. This does not make the entire Codex session local. Running Laya avoids hosted inference fees for those decisions, but still requires setup, model downloads, memory, and computation. Neither route promises a particular saving or improvement in every session.
What I am sharing
Context Diet is available on GitHub under the MIT license. You can use, modify, and redistribute it under that license's terms. The idea was inspired by tamaratran's fast-jev-compaction.
It has also appeared in community directories, including Made with Jev and Jev Finder. Those listings are a way to discover the project; the repository remains the place to check how it works and what has been measured.
Try it in Codex
You will need the Codex command-line tool and Node.js 18 or newer installed. These steps use Jev, the default provider. Its API usage is billed separately from Codex.
-
Add the plugin. Open your terminal and run these two commands, one after the other:
codex plugin marketplace add konstantinosbotonakis/codex-context-diet codex plugin add codex-context-diet@context-dietThe first adds the plugin catalogue. The second installs Context Diet.
-
Connect Jev. Get an API key through TypeSafe, then start a new Codex conversation and ask:
Help me configure Context Diet with Jev. Walk me through saving my TypeSafe API key privately on this computer, without pasting it into this chat or putting it in a project file.
The plugin supports a local
~/.typesafe_keyfile. The key belongs there or in a supported environment variable, not in the conversation. -
Review and enable the hooks. In Codex, open
/hooksand review Context Diet's hooks before trusting them. Hooks let the plugin run when tool results arrive. Installing the plugin alone does not enable them. -
Check the setup. Send this in Codex:
Use $codex-context-diet:doctor to check my installation, then run one live provider test. Tell me whether Jev is connected and whether anything still needs attention.
Once the checks pass and the hooks are trusted, continue working normally. Small results and the first result of a session stay untouched, so you should not expect every command to be shortened.
Prefer to keep the decision step local? Ask Codex to set up Context Diet with the local Laya provider instead of Jev. That requires Python and a model download, but no TypeSafe API key. The local setup guide explains the requirements and differences.
You can pause the plugin by untrusting its hooks in /hooks. For updates and configuration, see the README. Reports of useful behaviour, mistaken decisions, and possible improvements are welcome. Knowing what should stay on the desk is the part worth getting right.