Logic Foundry

Build with understanding.

Designing AI Agents Around Context, Memory and Knowledge

As discussed in a November 12, 2026, article, a reliable AI agent needs more than access to information. It needs a way to decide what information is relevant to the current task, what should persist across interactions, and when a previously useful fact must be checked again.

The article separates three concepts:

  • Context is the active, temporary information available in the model’s current context window.
  • Memory retains information beyond a single interaction, such as earlier decisions or user preferences.
  • Knowledge is the curated foundation of facts, rules and reference material the system can use.

That distinction matters because retrieving a document does not make it timely, trustworthy or useful for a particular decision. The article proposes a context engine around the model to select, filter, order, structure, compress and protect information before it reaches the reasoning step. This shifts the engineering question from “What prompt should we write?” to “What is the smallest useful state the model needs right now?”

Combine history with live signals

An agent troubleshooting a server might need both an architecture runbook and the latest error logs. The runbook provides historical context; the logs describe the current condition. Relying too heavily on either can lead to a poor decision: historical assumptions may be stale, while live signals may lack the background needed to interpret them.

The article argues for combining persistent and streaming sources while accounting for the model’s limited context window, latency and cost. It also cautions against treating retrieval as the final step. Passing large, overlapping document fragments directly to a model can bury the relevant evidence. A more selective pipeline can aggregate, rank or summarize material before use, provided those summaries are checked for distortion.

Designing AI Agents Around Context, Memory and Knowledge (1)

Manage the context lifecycle

The proposed workflow has four stages:

  1. Select: Find information relevant to the task, user role, risk and time frame. The article describes combining semantic search, keyword search and knowledge-graph traversal rather than relying on vector similarity alone.
  2. Inject: Place the selected information in a structure suited to the task, alongside necessary instructions, examples or output constraints.
  3. Compress: Summarize history or long documents to stay within token and latency budgets, while validating that important meaning survives.
  4. Expire and refresh: Remove outdated assumptions and recheck changing facts instead of repeatedly reusing context that was once correct.

These stages also provide places to enforce access controls, validate inputs and handle personally identifiable information before it enters the model’s context. They are architectural safeguards, not a guarantee that a model will never produce an incorrect answer.

Designing AI Agents Around Context, Memory and Knowledge (2)

Give memory explicit boundaries

The article suggests a layered design: working memory in the current prompt window, short-term memory in a session cache such as Redis, and long-term memory in persistent stores such as vector databases or knowledge graphs. Long-term updates can run asynchronously so they do not necessarily delay an immediate response.

The practical design choice is not simply how much an agent can remember. It is which observations deserve persistence, which facts require fresh verification, and which material should be excluded from the next model call. Larger context windows do not remove that trade-off: according to the article, extra tokens add cost and latency, while irrelevant material can make useful evidence harder to find.