Essay · 39 min read

Context Engineering for Enterprise AI: Start With the Records

How business records, retrieval, memory, and fine-tuning shape an AI answer, and the work people spend checking it.

An analyst compares related agreement documents in an archive-lined study.

Before improving the model, establish what the records can prove

When an AI assistant prepares a recommendation, the work it saves depends partly on how much checking it leaves behind. Following the citations seems like a reasonable place to start. If the documents are genuine and the numbers match, you should have some basis for trusting the answer. The harder question is whether those documents establish what applies to the decision you are about to make.

Consider a purchasing team comparing two suppliers. Ahead of a meeting, an assistant recommends Supplier A, which promises delivery in fourteen days, over Supplier B at eighteen. The buyer opens the linked contracts, confirms both figures, and brings the comparison to the discussion.

A colleague points out an accepted amendment: Supplier B agreed to twelve-day delivery. A later draft proposed ten days, but nobody accepted it. All three documents were available to the assistant, yet its recommendation relied on the original contract.

The citation was accurate. The recommendation still relied on terms that no longer applied.

Catching the mistake means finding the amendment, checking its acceptance, and separating it from the unsigned proposal. The buyer ends up reconstructing the negotiation before using a comparison that was supposed to save that work.

Before investing in a larger context window, a different search system, or additional training, the team needs to establish what happened to the evidence. The accepted amendment may never have reached the model. It may have arrived without the record confirming acceptance. Or the model may have received both and still interpreted them incorrectly. Those failures call for different repairs.

If the parties discussed twelve-day delivery but never recorded their acceptance, retrieving more correspondence cannot establish that the change took effect. Someone must resolve the uncertainty and capture the outcome. Before changing the AI architecture, establish whether the organization has the evidence needed to make the decision.

Context engineering decides what the model receives and preserves what makes it applicable: source, status, scope, effective date, and relationships. In an enterprise, that includes keeping an accepted amendment connected to the agreement it changes. As an assistant searches, summarizes, and remembers, those distinctions need to survive.

The architecture should follow the work. A current delivery commitment held in an authoritative business system may need only a structured lookup. Explaining how that commitment changed may require the agreement, amendments, and correspondence together. Investigating recurring delivery failures across hundreds of suppliers requires a broader search through years of records.

This article uses those expanding demands to examine where long context, retrieval, agent-led investigation, memory, and fine-tuning earn their place. It helps the person responsible for an enterprise AI workflow decide what to fix first and assess whether the change reduces the checking people must repeat before using an answer.

Enterprise Digital Twin: give AI the context a decision needs examines the organizational context behind such decisions. Here, we look at how to put that context to work inside a large language model (LLM) application.

Listen or watch

Audio overview · 6:47
Illustrated video overview · 5:24 · Captions included

Where to start with enterprise context engineering

Start by checking whether the business already maintains an authoritative answer. If the contract system holds the approved delivery term, use that field and retain a link to the record supporting it. Establish who updates it and how amendments become effective. An assistant should not have to reconstruct an agreement every time someone asks for a delivery date.

When the question requires explanation across documents, give the model the complete, bounded file, including the versions, amendments, and approval records needed to interpret it. Use representative requests to establish whether this approach produces reliable answers at an acceptable cost and speed.

Add retrieval when the assistant must select evidence from a larger or changing collection. Use a direct lookup for an identified record and search for questions that require finding relevant material. When one finding determines what to investigate next, allow follow-up searches within clear limits on access, time, and cost. The assistant should explain an unresolved gap when further searching cannot establish the answer.

Fine-tuning comes later, when adequate evidence, clear instructions, and representative examples still leave a recurring behavior problem. Keep changing business facts and approvals in sources that can be inspected, corrected, and checked for current applicability.

Choose the simplest approach that completes the work reliably, counting the time people spend reviewing and correcting the result. Each added component should address a failure the team has observed and improve the outcome on requests it has not used during development.

Start with the business system that owns the answer

An enterprise architect could reasonably ask why the assistant is reading contracts to find a delivery commitment in the first place. If the organization maintains that commitment in its contract lifecycle management (CLM) system, the application should query the field. Searching paragraphs to reconstruct an answer already maintained in a business system adds another opportunity for error.

Use an authoritative structured record when it contains the answer the task requires. For the supplier comparison, that means more than a field containing “12 days.” The record needs to identify the agreement, the applicable delivery conditions, and when the commitment took effect. The application must also respect the requester’s access permissions.

The team should establish how that field is maintained. Does an accepted amendment update it through the contract workflow, or does someone copy the number manually? Can the buyer follow it back to the supporting record? If the field still says eighteen days because the amendment was never processed, a precise database query will faithfully return an outdated answer.

This is where the business owner belongs in the architecture discussion. Procurement needs to identify which record governs the commitment and who is responsible for keeping it current. The AI team can connect the assistant to that source, but it cannot settle an unresolved disagreement between the contract register and the accepted amendment simply by choosing a different search method.

Documents become necessary when the question goes beyond the maintained fields. A buyer asking why the commitment changed, whether an exception covers this order, or which conditions accompanied an amendment needs the supporting history. The assistant may start with the structured record, then retrieve the documents needed to explain or qualify it.

The scale of the task also changes the design. Comparing two identified suppliers gives the application a small, known set of records. Investigating delivery problems across hundreds of suppliers and years of correspondence requires it to select evidence from a much larger collection. If the first incident report points to an amendment or approval stored elsewhere, the assistant needs a way to follow that connection.

Begin with the most direct reliable route to the answer, then add investigation where the question requires it. A structured lookup, a complete document set, and a sequence of searches can all belong in the same application. The diagnosis comes next: when an answer fails, which part of that route broke?

Context engineering choices at a glance

On a narrow screen, swipe the table to see all columns.

CapabilityWhat it contributesWhen to use itWhat to verify
Authoritative structured dataReturns a maintained business-system value with its supporting recordAn approved field directly answers the questionWho maintains it, does it reflect effective changes, and can this requester access it?
Long contextProvides room to examine related records togetherThe relevant document set is known and manageableDoes reliability hold as drafts and correspondence accumulate, at acceptable cost and speed?
Retrieval before answeringSelects evidence for the model in a planned search stepA targeted lookup or search can supply the records the answer needsAre the results current, connected to their qualifications, and accessible to this requester?
Agentic retrievalLets the model inspect results and choose follow-up searchesThe next useful search depends on what the assistant discoversDoes it follow genuine gaps and stop within limits on access, time, and cost?
Memory across requestsRetains selected findings, preferences, or task state for later useRepeated work benefits from continuityCan each retained claim be traced to a source and checked for current scope and validity?
Fine-tuningTrains recurring model behaviorAdequate evidence, clear instructions, and examples still produce repeated errorsDoes improvement carry over to unfamiliar cases without introducing regressions?

Structured lookup can answer directly; bounded documents and iterative retrieval feed the working context, which the model interprets. Memory feeds context, fine-tuning adapts the model, and application controls apply throughout.

Figure 1. Choose the route the task needs. A maintained field can answer directly; document sets and retrieved evidence enter the model’s working context. Memory and fine-tuning serve separate purposes. Access and action controls apply across every route.

Diagnose the failure with ajithp’s Evidence Trace

ajithp’s Evidence Trace is the five-check diagnostic I use in this article to locate an enterprise AI failure: source records, evidence selection, interpretation, response behavior, and authority to act. It brings these established concerns into one investigation so the team can identify what failed and who owns the repair.

To investigate the wrong supplier recommendation, start with the failed request and the evidence the assistant actually received. Include database results, document excerpts, summaries, and any follow-up searches. The documents available somewhere in the organization are not necessarily the documents the model used.

The recommendation alone cannot tell you whether the evidence was missing, incomplete, or misunderstood. Trace the answer back through the application before deciding which component to replace.

On a narrow screen, swipe the table to see all columns.

What to examineWhat could have failedWhere the repair begins
Source recordsAcceptance was never recorded, or the contract system still contains the old delivery term.The business owner resolves the status and updates the authoritative record.
Evidence selectionThe amendment exists but never reaches the model, or arrives without its acceptance record.Inspect retrieval, source connections, access filters, and context assembly.
InterpretationThe model receives adequate evidence but uses superseded terms or treats a proposal as accepted.Check how status and relationships are represented, then examine instructions, examples, and recurring behavior.
Response behaviorThe answer omits delivery time or presents unresolved terms as settled.Make the response requirements explicit and evaluate whether the model follows them.
Authority to actThe assistant contacts a supplier when the buyer requested only a comparison.Enforce authorization in the application before messages or commitments leave the system.
ajithp’s Evidence Trace: Five checks for diagnosing an enterprise AI failure. Developed by Ajith Vallath Prabhakar for ajithp.com.

The source-record check comes first because it determines what the rest of the system can establish. If acceptance was never captured, changing retrieval will not resolve the uncertainty. If acceptance is recorded but omitted from the request, retraining the model addresses the wrong part of the workflow.

This is also where my Control Tower Reasoning System (CTRS) framework informs the diagnosis. Its version-drift perspective asks whether the evidence still governs the decision, while agent orchestration addresses the boundaries within which an assistant can act. In the supplier case, the original contract remains a valid historical record, but its eighteen-day term has been superseded. Retrieving that record is not itself a failure; presenting it as the current commitment is.

Access and action need separate checks throughout the investigation. A requester may be allowed to read both suppliers’ contracts without being authorized to send either company a message. Access filtering can also explain why an acceptance record was absent from the model’s input. The assistant should identify the gap without exposing restricted material or treating the missing evidence as proof that acceptance never occurred.

Assign the repair to whoever owns the failure. Procurement owns unresolved contract status; the application team owns evidence delivery and permission enforcement; model behavior becomes the focus when adequate evidence still produces unreliable answers. That division gives the pilot a concrete purpose and keeps an expensive architecture change from substituting for a simpler repair.

Choose how the assistant gathers evidence

LangChain groups context-engineering techniques into four operations: write information outside the model’s immediate context for later use, select what to bring into the current request, compress what must fit, and isolate information in separate contexts or environments. [1] The evidence-gathering choices below address the select step. In ajithp’s Evidence Trace, the source-record check comes before choosing among these operations: establish whether the business has recorded the fact or decision the assistant needs. Once that evidence exists, the other checks help determine whether it survives selection and processing and supports the response or action.

The two-supplier comparison is a small task. Once the relevant agreements and amendments are identified, the application can supply them together. It does not need an elaborate retrieval system to choose among three documents.

Now expand the assignment. Procurement manages hundreds of suppliers, with contracts in one system, acceptance emails in another, and incident reports accumulated over several years. A buyer asks which suppliers can meet a revised delivery requirement. Another asks why delivery failures keep recurring across the portfolio. The application must decide which records to inspect, how to connect them, and when it has enough evidence to answer.

Choose the evidence-gathering approach around the question, rather than sending every request through the same pipeline.

Long context: keep related records together

When the relevant documents are known, supplying them together gives the model a chance to follow their relationships. For the original comparison, the agreement, amendment, and acceptance record form a reasonable working set. Selecting isolated paragraphs could separate the proposed term from the evidence that it took effect.

Research supports treating this as a baseline. Zhuowan Li and colleagues found that long context performed better on average when sufficient resources were available, while RAG offered a substantial cost advantage. Their Self-Route method first assessed whether retrieved passages were sufficient, then supplied the full context for questions judged unanswerable from those passages. [2]

The retrieval baseline changes that comparison. Xinze Li and colleagues excluded questions answerable without external context and evaluated several retrieval methods. Long context generally performed well, particularly on Wikipedia-based questions. Retrieval using summaries was competitive, chunk-based retrieval lagged, and RAG had advantages on dialogue-based and general question queries. A weak retrieval implementation therefore makes an unhelpful benchmark for choosing an architecture. [3]

Having room for the records does not establish that the model will use them correctly. RULER’s 2024 evaluation covered 17 models and 13 tasks; almost all the models lost substantial performance as context length increased. Lost in the Middle found that the position of relevant information also affected performance. NoLiMa subsequently examined cases where the question and supporting evidence shared little literal wording. Together, these studies identify useful tests: enlarge the file, move the amendment, and ask about the commitment in different language. [4, 5, 6]

Set the application’s working context limit where those tasks remain reliable at an acceptable response time and cost. Longer inputs also increase serving demands. For self-hosted models, memory management techniques such as PagedAttention help use the key-value cache more efficiently, but capacity under concurrent requests still needs attention. A successful comparison during a quiet demonstration is insufficient evidence for a system serving many buyers at once. [7]

RAG: retrieve the evidence needed for an answer

Across the larger supplier collection, most requests need only a fraction of the available material. Begin with the direct routes described earlier: an authoritative field, an exact agreement identifier, or a targeted search.

Keyword search is useful when the buyer knows the contract number or clause wording. Semantic search can connect a question about “delivery commitments” with an email discussing a “revised schedule.” Neither match establishes acceptance. The retrieved material still needs the supplier identity, applicable agreement, status, and any conditions that qualify the term.

Document boundaries affect that evidence. Splitting text into small chunks can separate a commitment from “subject to approval.” Retrieving a larger parent section restores surrounding context, but a separate acceptance email still requires a connection between records. A reranker can improve the order of candidate results; it cannot supply a record that the search never found.

More elaborate retrieval methods belong after this baseline. ColBERTv2, for example, uses token-level representations to retain distinctions that a single passage vector can lose. Its retrieval-quality and storage tradeoffs are relevant when simpler search misses necessary evidence. [8]

Agentic retrieval: investigate gaps through follow-up searches

Some questions cannot be resolved through a search planned entirely in advance. An email mentions an amended schedule but does not contain it. The amendment is found, but its acceptance remains unclear. Each result determines what the assistant needs to inspect next.

Agentic retrieval gives the model that choice. It can search, read the results, identify a gap, and select a follow-up tool call. The application still controls the available sources, access permissions, and limits on the investigation.

This does not require every source to sit behind a vector database. Anthropic’s context-engineering guidance describes combining initial context with file navigation and just-in-time retrieval. LangChain’s October 2026 account of its Deep Agents tools makes the sequence concrete: search filenames or matching text first, then read relevant portions; oversized results can be stored outside the working context and accessed through references. [9, 10]

What enters the context also remains a design choice after a tool returns. Anthropic’s February 2026 web-search update introduced code-based filtering before results reach the model’s context window. This is a product example of selecting evidence during an investigation, rather than treating every returned page as material the model must read in full. [11]

For the supplier assistant, keep the agreement, accepted amendment, and acceptance record available together. Remove duplicate results, retain source references in progress notes, and preserve unresolved questions. A summary that drops “pending approval” can recreate the original error even when retrieval found the right document.

Give the investigation a completion condition and a stopping rule. Establishing the applicable delivery terms completes the comparison; exhausting the search budget without finding acceptance requires an explanation of the gap. More searches should not become a substitute for acknowledging missing evidence.

GraphRAG: examine patterns across a collection

Finding Supplier B’s current commitment is different from explaining recurring delivery problems across the portfolio. A handful of matching passages may overrepresent a heavily discussed project and miss a serious incident recorded only once.

Microsoft’s GraphRAG global search addresses broader questions through generated community reports, combining information from those reports through a map-reduce process. It gives the application a way to work across themes rather than rely solely on individual passage matches. [12]

Reserve that additional machinery for questions ordinary search handles poorly. Trace reported patterns back to their incidents, retain significant exceptions, and refresh affected reports as the underlying records change. A maintained table remains a better fit for listing renewal dates.

The resulting application can use several routes: a direct lookup for a known field, a bounded document set for a contract review, follow-up searches for an unresolved amendment, and broader synthesis for a portfolio question. The evaluation should reveal whether each route retrieves enough evidence, interprets it correctly, and leaves the buyer less work to repeat.

Decide what to remember and what to train

An assistant that supports procurement over time should not have to rediscover every useful correction. It can retain where acceptance records are stored, how a particular contract register identifies amendments, or which approval resolved an earlier disruption. The difficulty is deciding what that remembered information establishes when a new request arrives.

Memory retains information the application can retrieve and revise. Fine-tuning changes the model’s parameters so that it handles tasks differently. Both can improve continuity, but they create different maintenance responsibilities. An approval with an expiration date belongs in an inspectable record; consistently misinterpreting expiration dates is a model-behavior problem.

Enterprise AI memory: retain decisions with their limits

Consider a procurement director who authorizes expedited orders from one supplier for a particular project during a supply disruption. The exception expires at the end of the quarter. Several orders are placed while it is valid.

Months later, a buyer asks the assistant to prepare an order for another project. The earlier orders are genuine, and they show that expedited purchasing was previously allowed. They do not establish permission for this purchase.

Repeated use of an exception does not turn it into a standing policy. The assistant needs the governing policy, the approval source, the authorized approver, the supplier and project covered, the effective period, and any renewal or revocation. A memory reduced to “expedited orders are allowed for this supplier” discards the information needed to apply it correctly.

Procurement example: an approval timeline and decision flow. Check supplier, project, order type, dates, renewal or revocation, and evidence. Proceed only within current approved scope; otherwise follow normal approval or request clarification. Historical records explain past purchases without authorizing new ones.
Figure 2. An example of checking whether an earlier approval covers a new request. An expired, revoked, or out-of-scope exception cannot authorize the order; incomplete evidence requires clarification. View full-size diagram.

The expired approval still explains earlier purchases and can remain available under the organization’s retention rules. For a new order, the assistant must check whether a current approval covers the request. If none is established, it should explain the normal approval route or identify the missing evidence.

This distinction also applies to inferred preferences and practices. A pattern in past activity can suggest where to investigate, but it should remain distinguishable from an explicit approval. Otherwise, the assistant’s interpretation of previous orders can gradually become the rule it follows.

Make retained information correctable

Current implementations show how memory can preserve useful corrections without putting them into model weights. OpenAI’s January 2026 account of its internal data agent describes retaining corrections, filters, and constraints that are difficult to recover from other context. Users can create and edit memories, with personal and global scopes. That is an example of memory supporting repeated analytical work, rather than requiring the same correction in every conversation. [13]

Anthropic’s memory tool provides another implementation pattern: the model requests operations on persistent memory files, while the application executes those operations in storage it controls. That separation leaves the application responsible for how retained information is stored and accessed. [14]

For the procurement assistant, give retained findings a source and an owner. Record whether a statement is an approved decision, a user correction, or a model inference. When an approval changes, update or invalidate the summaries that depend on it. Correcting the source record alone is insufficient if an older memory continues to supply the expired terms.

The connection to an Enterprise Digital Twin is the organizational context needed to apply a decision: current policy, decision rights, and the status of exceptions. This does not require every assistant to implement a digital twin. It does require the application to know where that context is maintained.

Personal Cognitive Digital Twins face a related question at the individual level. Agreeing to evening meetings for one project does not necessarily replace a general preference for mornings. The enterprise case adds formal approval responsibilities that a remembered preference cannot provide.

Fine-tuning: correct recurring behavior failures

Suppose the assistant receives the policy, approval, expiration date, and current request, yet repeatedly treats the expired exception as permission to proceed. Start with clearer instructions and examples covering valid, expired, revoked, and out-of-scope approvals. If those changes do not resolve the pattern, the failed cases provide a concrete reason to consider fine-tuning.

Train the model to interpret unfamiliar records more reliably; keep changing business facts in sources the application can inspect and update.

RAFT illustrates how training can prepare a model to use relevant documents while disregarding distracting material. Its authors reported improvements on the domain-specific tasks they evaluated. For procurement, training examples should include conflicting drafts, unrelated agreements, and cases where the correct response is to acknowledge missing evidence. [15]

Compare the adapted and original models on held-out cases using the same retrieved evidence. Check both the targeted failure and previously reliable tasks. A model that produces a cleaner comparison but becomes more willing to guess has not improved the workflow.

Once training is justified, choose the adaptation method around the task and available resources. A LoRA baseline is a reasonable starting point for adapter training. QLoRA reduces base-model memory requirements by training adapters over a frozen, four-bit model; its original study demonstrated a 65-billion-parameter model on a single 48 GB GPU. DoRA separates weight magnitude and direction and provides another approach to compare when the baseline leaves a quality gap. The accompanying diagram and table explain these choices without treating the research results as deployment guarantees. [16, 17]

Four-panel schematic comparing full fine-tuning, LoRA, QLoRA, and DoRA. Teal marks trainable components; blue-gray marks frozen weights. The table below explains what each method trains, its advantage, tradeoff, and when to consider it.
Fine-tuning options. Conceptual schematics show which components are trained; they do not depict exact implementation wiring or predict accuracy. View full-size diagram.

On a narrow screen, swipe the table to see all columns.

MethodWhat gets trainedMain advantageTradeoffWhen to consider it
Full fine-tuningAll model weightsFreedom to update the full modelHigher training memory and storage than adapter methodsWhen evaluation justifies full-model updates and resources are available
LoRALow-rank adapters; the base stays frozenFar fewer trainable parameters and smaller task-specific checkpointsRank and targeted layers limit the available updatesAn adapter baseline for a recurring task
QLoRALoRA adapters over a frozen, four-bit baseReduces base-model memory during trainingRequires a compatible quantized training and deployment workflowWhen base-model memory limits the training setup
DoRAMagnitude parameters and low-rank direction updatesA different adaptation design to test against LoRAMore overhead than basic LoRA before merging; test the serving configurationWhen a LoRA baseline leaves a measured quality gap

These methods are related rather than mutually exclusive choices: QLoRA combines a quantized base with LoRA adapters, while DoRA changes the adaptation parameterization. The “when to consider it” column is engineering guidance, not a benchmark ranking. Sources: LoRA, QLoRA, DoRA, and Hugging Face PEFT documentation.

Ovadia and colleagues found RAG more effective than unsupervised fine-tuning for incorporating knowledge in their evaluation. That result concerns knowledge acquisition, not every form of supervised adaptation. For this application, the distinction is practical: a renewed approval should become available through the records, while training addresses a recurring failure to interpret those records. [18]

The business owner remains responsible for approval status, the application team for memory maintenance and authorization, and the model team for demonstrated behavior failures. Keeping those responsibilities explicit makes it possible to correct an error without retraining the system for every business change.

Enforce access controls wherever the information travels

A buyer might have permission to compare supplier contracts without access to a confidential negotiation. The application must enforce that distinction before supplying evidence to the model, including when the restricted document would be the strongest match for the question.

Azure AI Search provides document-level controls through security filters and permission-aware mechanisms. Their effectiveness depends on configuration and current permission metadata. Test with users who have different access rights, including after permissions change, rather than assuming that indexing a document preserves its restrictions. [18]

The responsibility continues when the application creates something from those records. A portfolio summary can reveal confidential terms without quoting the negotiation that established them. A summary must not expose restricted information to a requester who is not authorized to receive it. Apply that rule to generated reports, cached answers, and retained memory. Any wider release needs an approved process for removing or reclassifying the protected information.

Deletion requires the same attention to where information has traveled. Removing a contract from the search index can leave copies in conversation history, caches, summaries, or the original repository. Trace those locations and verify what was removed, updated, or retained under the organization’s retention requirements. Keep enough source information to identify which derived material needs review when a record changes.

This is a practical reason to maintain changing confidential facts in inspectable records. The team can locate and correct an external document directly. Information incorporated into model weights is harder to isolate and remove as an individual record.

Access to information also does not authorize a business action. The assistant can correctly compare two contracts while having no permission to contact either supplier. Before a message or commitment leaves the system, the application must check the requester’s authority and the action authorized for that task.

Include review and correction in AI operating costs

The cheaper model call is not necessarily the cheaper way to complete the work. A procurement assistant can reduce its processing bill while leaving buyers to locate missing amendments, reconcile conflicting terms, and correct the comparison. Those minutes belong in the architecture decision.

Start by defining a usable result. For the supplier task, it is a comparison supported by the applicable records, with unresolved questions made explicit. A request for clarification is appropriate when acceptance was never captured. It is a retrieval failure when the record exists, the requester can access it, and the assistant overlooks it. An unauthorized disclosure or commitment fails regardless of whether the recommendation was otherwise correct.

Include review and correction in the comparison

Consider two AI workflows processing the same 100 requests. The following figures are illustrative assumptions, not provider prices or measured results. Assume a loaded staff cost of $90 per hour, including salary, benefits, and overhead.

Every request receives an initial review. Correction time is additional work spent investigating and repairing answers, including attempts that remain unsuccessful. Usable results are counted after that work, so a successfully corrected answer is included in the final total.

On a narrow screen, swipe the table to see all columns.

Cost or outcome for 100 requestsWorkflow AWorkflow B
Model, retrieval, and other metered services$30$20
Initial buyer review100 minutes100 minutes
Additional investigation and correction80 minutes200 minutes
Total human time180 minutes300 minutes
Human cost at $90/hour$270$450
Total evaluated operating cost$300$470
Usable results after review and correction9050
Cost per usable result$3.33$9.40

Workflow B saves $10 in service charges but consumes two additional hours of staff time and produces fewer usable results. At the assumed hourly rate, just four extra seconds of human work per request would erase that $10 saving across the batch.

Compare the total cost of producing a usable result, including human review and correction. Keep the failure rate beside the cost figure: ten requests remain unresolved in A and fifty in B. If the business must complete every request, include the subsequent manual handling before estimating the full production cost.

The table excludes initial development, training, and ongoing platform maintenance. A deployment comparison should allocate those costs over an explicit workload and useful life. Record elapsed response time separately from staff effort; a buyer waiting for an answer and a buyer actively correcting it create different operational constraints.

Reduce processing costs without shifting work to the buyer

Different designs create different bills. Retrieval adds ingestion, indexing, updates, search, and sometimes reranking. Long context increases the material processed per request. Agentic investigation adds tool calls and follow-up model calls. Fine-tuning adds example preparation, training, evaluation, and maintenance.

Prompt caching can reduce repeated processing when requests share the same prompt prefix. Anthropic’s documentation distinguishes cache writes and reads and specifies cache lifetimes. Repeated questions about one supplier file therefore have different reuse opportunities from requests involving a new collection each time. Use observed cache hits and actual usage in the comparison. [20]

Compression addresses another part of the bill by shortening the input. LLMLingua demonstrated substantial compression with limited performance loss on the datasets it evaluated. For the supplier application, the relevant check is whether the shorter input still preserves acceptance status, the clause being changed, and the conditions attached to it. Removing “subject to approval” can leave the ten-day figure intact while changing the decision it supports. [21]

Measure these savings against the same requests and review standard. If a smaller input saves processing charges but increases the time spent checking which terms apply, the apparent optimization has moved work back to procurement.

A pilot should therefore report service cost, review time, correction time, usable outcomes, and unresolved cases together. Keep unauthorized actions and disclosures visible as separate failures. A low average cost cannot compensate for a workflow that exceeds its authority.

Evaluate context engineering through one real workflow

A procurement leader considering these approaches can begin with a comparison that buyers already spend time checking. Bring the buyer, the person responsible for the contract records, and the application team into the same review. Ask them to reconstruct one failed recommendation, from the request through the evidence supplied to the model to the answer the buyer received.

That review should establish what the assistant could reasonably have known. If acceptance was never recorded, the business needs to resolve the uncertainty and capture the decision. If the record exists but the assistant missed it, the application team has a different problem to investigate. The first deliverable is a diagnosis with an owner and a proposed repair.

Build the evaluation from decisions people actually make

Use the supplier comparison to create a small collection of cases with outcomes the buyer and record owner have agreed on. Begin with the original contracts, then add the accepted twelve-day amendment. Introduce the newer, unaccepted ten-day draft and check whether the assistant confuses recency with acceptance. Remove the acceptance record and check whether it explains the gap.

Include the expired approval from the memory example. The assistant should be able to explain why earlier purchases were allowed without treating that history as permission for a new order.

Vary the wording, document order, and surrounding correspondence. Test with different user permissions, including a requester who cannot access a relevant record. A missing record and a restricted record require different handling; neither gives the assistant permission to invent an answer or disclose protected information.

For each case, record the expected answer or appropriate request for clarification, the evidence supporting it, and the actions the assistant is allowed to take. Classify failures using the five dimensions introduced earlier: source records, evidence selection, interpretation, response behavior, and authority.

Compare each repair with a baseline

Choose the simplest baseline that can perform the task. For an approved delivery field, that could be a structured query. For a question about how the agreement changed, it could be the complete, bounded contract file. Compare retrieval or agentic investigation against that baseline when the collection or the question requires a broader search.

Keep a separate set of cases out of prompt development, retrieval adjustments, and training. These held-out cases show whether a repair carries over to unfamiliar requests. Include ordinary comparisons alongside difficult exceptions so an improvement on one troublesome case does not conceal a regression elsewhere.

Record service charges, buyer review minutes, correction time, unresolved cases, and elapsed response time. Track unauthorized disclosures and actions separately. Their significance should remain visible even when the overall success rate improves.

Turn the findings into a decision

The review should leave the team able to choose its next change and explain why. If a maintained contract field answers routine questions reliably, use it for those requests. If supplying the complete file fixes missed relationships, establish the workload it can handle. If the assistant needs follow-up searches, examine whether those searches find the missing evidence within an acceptable time and cost.

Fine-tuning becomes a candidate when adequate evidence and clearer instructions still leave a recurring behavior problem. Even then, check whether improved routine answers come with more guessing when acceptance is uncertain.

Before expanding the pilot, the workflow owner should be able to name what improved, what still requires human judgment, and who is responsible when the process fails. Keep the failed requests and their repairs in the evaluation set, then add cases from everyday use. That gives later model and application changes a practical standard to meet.

Build around the evidence the business can stand behind

Back in the purchasing meeting, the corrected comparison favors Supplier B on delivery time: twelve days under the accepted amendment, against Supplier A’s fourteen. The ten-day proposal remains in the negotiation history, clearly distinguished from the agreement. The buyer can follow the recommendation to the records that support it and spend the meeting discussing whether the supplier can deliver.

Getting there requires the organization to know which records establish its commitments, who maintains them, and how changes become authoritative. When acceptance was never recorded, a larger context window cannot supply the missing business decision. Someone must resolve the uncertainty and capture the outcome before the assistant can rely on it.

The architecture should follow from that foundation. Use an authoritative business-system field when it answers the question. Keep a bounded document set together when the task depends on relationships across the file. Add retrieval when the collection requires selection, and agentic investigation when each finding determines what to look for next. Retained memory needs sources and limits; fine-tuning needs evidence of a recurring behavior problem that training can address.

For the person funding the work, the test is whether this design reduces the effort required to reach a usable decision. That includes the buyer’s checking and correction time, the requests that remain unresolved, and the consequences of acting beyond the authority granted.

Start with one workflow where those costs are already visible. Give the business owner and application team a shared set of cases, identify the first failure they can repair, and compare the result with the existing process. That produces an investment decision grounded in the organization’s own work, with a clear account of what improved and what still needs attention.

Key takeaways

01

Use ajithp’s Evidence Trace before choosing the repair

Check whether the source record exists and is current, whether the assistant received it, how it interpreted it, whether the response met the request, and whether any action stayed within its authority. Each finding points to a different repair.

02

Start with the authoritative business record

Use a maintained business-system field when it answers the question. When the task requires explanation across documents, establish a complete-file baseline before adding search or training.

03

Use agentic retrieval when the question requires investigation

Use a direct lookup for a straightforward question. Let the assistant choose follow-up searches when each result reveals a new gap, with limits on access, time, and cost.

04

Consider fine-tuning when adequate evidence still produces recurring errors

Start with clear instructions and representative examples. If the same behavior keeps failing, test whether training improves it on unfamiliar cases without making the model more willing to guess.

05

Keep memory tied to its source and scope

Retain the source, scope, dates, and later changes attached to a remembered finding or approval. Recheck whether it applies to the new request; permission to read remains separate from permission to act.

06

Include human checking in the cost of a usable result

Compare model and infrastructure costs alongside the time people spend finding omissions, resolving conflicts, and correcting answers. An apparently cheaper system may leave more work with the buyer.

Further reading

These related articles explore the cost, context, and operating decisions behind the architecture choices discussed here.

Frequently asked questions

What is context engineering, and how does it relate to RAG?

Context engineering determines what information a model receives as a task progresses: instructions, retrieved records, tool results, relevant history, and retained memory. RAG supplies external evidence within that process. Long context expands the available working space, while fine-tuning changes the model itself. A dependable application also preserves source relationships, removes unnecessary repetition, and checks whether retained information applies to the current request.

What is ajithp’s Evidence Trace?

ajithp’s Evidence Trace is the five-check diagnostic introduced in this article by Ajith Vallath Prabhakar. It asks whether the source record exists and is current, whether the model received the required evidence, whether it interpreted that evidence correctly, whether the response met the request, and whether any action was authorized. Use it to locate the failure and assign the repair before choosing a different model or architecture. It is a practical diagnostic synthesis, not a benchmark or certification.

Should an enterprise start with RAG or long context?

First check whether an authoritative business system already holds the answer. An approved delivery term or renewal date may need a structured query. When the question requires connected documents, start with the complete, bounded file if processing cost and response time are acceptable. Add retrieval when the assistant must select evidence from a larger collection, and follow-up searches when one finding determines what it needs to investigate next.

Can better retrieval fix missing or incomplete business records?

Retrieval can find an existing acceptance record that an earlier search missed. It cannot establish acceptance when nobody recorded the decision. In that situation, the assistant should explain the gap and route the question to the responsible business owner. Once the uncertainty is resolved, the outcome needs to be captured in the system that maintains the agreement.

When is agentic retrieval worth the added complexity?

Use it when the next search depends on what the assistant discovers, such as following an amendment to its acceptance record or resolving conflicting accounts across systems. Compare it with a simpler lookup or complete-file baseline. Give the investigation limits on access, time, and cost, and define when the assistant should stop and ask for help. Additional searches earn their place when they improve the completed result without creating excessive review work.

Can longer context make an AI answer less reliable?

Yes. A model may correctly use an accepted amendment in a focused file yet overlook it amid older correspondence and competing drafts. The advertised context window size tells you how much input the system accepts, not how reliably it will use it. Move decisive evidence to different positions, add plausible distractions, and vary the question. Use the resulting decisions to establish a working context limit; retrieval may still help select a smaller, current, permitted set.

When is fine-tuning worth the additional work?

Consider fine-tuning when recurring errors persist despite adequate evidence, clearer instructions, and representative examples. Evaluate the trained model on cases that were not used during development, including cases where the right response is to acknowledge missing information. Full fine-tuning, LoRA, QLoRA, and DoRA differ in what they train and the resources they require; choose a method only after confirming it addresses the failure.

Can fine-tuning replace an external knowledge base?

A model can learn information during training, but current contracts and approvals also need version history, access controls, and a practical way to correct or withdraw records. Keeping that evidence in an inspectable external source makes those responsibilities easier to manage. Fine-tuning may improve how the model uses the records without becoming the place where every changing business fact is maintained.

When is GraphRAG worth testing?

Consider it when the question concerns patterns across a collection, such as recurring delivery problems across many suppliers, and ordinary retrieval produces selective answers. Generated community reports can help organize broader themes, but you still need to check them against the underlying records and update them as the collection changes. For a straightforward list of renewal dates, a maintained table or structured query may be sufficient.

How should enterprise AI remember approvals and exceptions?

Retain the source, authorized approver, scope, effective period, and any renewal or revocation. A previous purchase can show how an exception was used without authorizing another order. Keep historical records available for explanation while checking whether their terms apply to the current request. When a source changes, review the summaries and retained memories that depend on it. The application must enforce permissions even when the assistant recalls an earlier approval correctly.

How should an enterprise evaluate its LLM architecture?

Choose one real workflow and involve its business owner, record owner, and application team. Build cases with agreed outcomes, including accepted amendments, unaccepted drafts, missing acceptance records, expired exceptions, and restricted documents. Use ajithp’s Evidence Trace to check source records, evidence selection, interpretation, response behavior, and authority to act. Compare repairs with a baseline using cases held out from development, and record the human effort required to obtain a usable result.

How should the costs be compared?

Add service charges to the cost of review, investigation, and correction, then divide by the number of usable results. Report unresolved requests and unauthorized disclosures or actions separately. In the article’s illustrative example, the workflow with $20 in service charges costs $9.40 per usable result after human effort, compared with $3.33 for the workflow with $30 in service charges. A production estimate also needs development, maintenance, and any subsequent manual handling required to finish unresolved work.

References and research scope

The empirical studies discussed here were published or submitted between 2021 and 2025; the engineering and product sources include updates through October 2026. They support the architectural discussion, not a ranking of models available in November 2026. The implementation and evaluation recommendations are engineering synthesis, illustrated with examples rather than reports of a deployed system.

  1. The LangChain Team (July 2, 2025), Context Engineering.
  2. Zhuowan Li et al. (2024), Retrieval-Augmented Generation or Long-Context LLMs? A Comprehensive Study and Hybrid Approach.
  3. Xinze Li et al. (submitted December 2024), Long Context vs. RAG for LLMs: An Evaluation and Revisits.
  4. Cheng-Ping Hsieh et al. (2024), RULER: What’s the Real Context Size of Your Long-Context Language Models?.
  5. Nelson F. Liu et al. (2023), Lost in the Middle: How Language Models Use Long Contexts.
  6. Ali Modarressi et al. (2025), NoLiMa: Long-Context Evaluation Beyond Literal Matching.
  7. Woosuk Kwon et al. (2023), Efficient Memory Management for Large Language Model Serving with PagedAttention.
  8. Keshav Santhanam et al. (2022), ColBERTv2: Effective and Efficient Retrieval via Lightweight Late Interaction.
  9. Anthropic (2025), Effective context engineering for AI agents.
  10. Jess Weng, LangChain (October 23, 2026), Context Engineering Starts with Retrieval.
  11. Anthropic (February 17, 2026), Increase web search accuracy and efficiency with dynamic filtering.
  12. Microsoft, GraphRAG global search documentation.
  13. Bonnie Xu, Aravind Suresh, and Emma Tang, OpenAI (January 29, 2026), Inside OpenAI’s in-house data agent.
  14. Anthropic, Memory tool documentation.
  15. Tianjun Zhang et al. (2024), RAFT: Adapting Language Model to Domain Specific RAG.
  16. Tim Dettmers et al. (2023), QLoRA: Efficient Finetuning of Quantized LLMs.
  17. Shih-Yang Liu et al. (2024), DoRA: Weight-Decomposed Low-Rank Adaptation.
  18. Oded Ovadia et al. (2024), Fine-Tuning or Retrieval? Comparing Knowledge Injection in LLMs.
  19. Microsoft, Document-level access control in Azure AI Search.
  20. Anthropic, Prompt caching documentation.
  21. Huiqiang Jiang et al. (2023), LLMLingua: Compressing Prompts for Accelerated Inference of Large Language Models.

Research scope: We consulted primary papers, selected full-text sections, official documentation, and the NoLiMa research repository. Experiments were not reproduced. The procurement and digital twin examples illustrate proposed designs; they do not describe verified deployments.


Discover more from Ajith Vallath Prabhakar

Subscribe to get the latest posts sent to your email.

Share or cite this article

LinkedInEmail

Ajith Vallath Prabhakar. “Context Engineering for Enterprise AI: Start With the Records.” ajithp.com, 10 November 2026. https://ajithp.com/2026/11/10/context-engineering-enterprise-ai/

Leave a Reply