DEV Community

SATHWIK ADDENKI
SATHWIK ADDENKI

Posted on

Designing an AI Memory Interface Users Can Actually Understand

A renewal quote rarely contains the whole story of a vendor relationship.

It might list a price, a seat count, and a contract period while leaving out a concession negotiated in a meeting months earlier.

An AI system can summarize that quote perfectly and still miss the important question:

Does this document respect what the vendor previously promised?

That question led me to build PactTrace, a vendor intelligence application centered on persistent memory.

PactTrace connects past vendor commitments with present decisions. Groq extracts and compares information, Hindsight retains and recalls relationship history, and PactTrace validates the resulting evidence before it reaches the user.

The example in this article uses synthetic vendor data. I am not claiming measured savings or production customer usage.

The difference a memory makes

Consider a vendor called CloudNova.

During an earlier interaction, CloudNova agreed to:
f

waive the onboarding fee

provide a 15% renewal discount

apply that discount if the account exceeds 100 seats

Months later, a renewal quote arrives for 130 seats.

The quote says:

CloudNova renewal quote for 130 seats is ₹460000 annually. The quote does not include any renewal discount.

If I analyze only this new quote, there is no way for the system to know that CloudNova previously promised a 15% discount.

The latest quote is simply another document.

The missing information cannot be recovered by writing a better prompt. The system needs access to the earlier relationship history.

That is where persistent memory changes the problem.

With Hindsight, PactTrace can recall the earlier CloudNova commitment when the new quote arrives.

The comparison now has two independent sources.

Historical memory:

CloudNova promised a 15% renewal discount if the account exceeds 100 seats.

Current evidence:

The quote does not include any renewal discount.

The new quote is for 130 seats, so the historical condition is satisfied.

Now the system has enough evidence to surface a potential conflict.

The useful improvement is not more fluent language.

It is access to relevant history.

For a deeper explanation of why this matters for agents, Vectorize has a useful overview of agent memory.

![

From a vendor conversation to persistent memory

The PactTrace capture flow starts with three pieces of information:

vendor

interaction text

source, such as a meeting

A Next.js API route validates those fields before sending the interaction to Groq.

Groq converts the unstructured conversation into structured commitments containing fields such as:

type

description

value

condition

deadline

status

The extraction is intentionally conservative.

If a value, deadline, or condition is not present, the application does not ask the model to invent one.

After extraction, PactTrace creates memories for both the original vendor interaction and the individual commitments.

Those memories are then stored in Hindsight.

This is part of the real retention path used by PactTrace:

const result = await getHindsightClient().retainBatch(
bankId,
items,
{
async: false,
signal: AbortSignal.timeout(60_000),
},
);

if (
!result.success ||
result.async ||
result.items_count !== items.length
) {
throw new Error("Hindsight did not confirm the complete batch");
}

I deliberately keep the original interaction in addition to the structured commitments.

The structured representation makes later comparisons easier, while retaining the source interaction preserves context that might matter for future questions.

Each retained item also includes metadata such as:

vendor

source

interaction ID

memory type

commitment type

Hindsight therefore acts as the persistent relationship-memory layer rather than browser state or temporary prompt context.

The Hindsight documentation explains the retain and recall model in more detail.

Recall happens before analysis

When a user submits a new quote, PactTrace does not immediately ask the LLM to analyze it.

The application first asks Hindsight for relevant historical vendor information.

The recall request looks for things such as:

previous commitments

discounts

pricing promises

fee waivers

conditions

negotiation history

That distinction matters.

The model is not being asked:

“What might this vendor have promised?”

Historical information must come from stored memory.

PactTrace then filters the recalled results before they are used.

A vendor name appearing in a semantic query is not enough to guarantee isolation. The application checks the vendor metadata written during retention.

The relevant logic is straightforward:

const owner = memory.metadata?.vendor;

if (
!owner ||
normalizeVendor(owner) !== normalizedVendor ||
!memory.text.trim()
) {
return [];
}

This prevents an unrelated or unlabelled recalled fact from silently entering another vendor's comparison.

Repeated memories are also deduplicated conservatively.

PactTrace keeps Hindsight's relevance order and selects at most five memories for the actual quote comparison.

That gives the model enough relationship context without blindly sending every retrieved object into the prompt.

Evidence has to survive validation

Using memory solves one problem, but it creates another:

How do I know the model is not inventing the evidence it claims to be using?

I decided not to trust the comparison result automatically.

Groq returns a structured response containing information such as:

historical commitment

current quote evidence

memory ID

condition

condition status

result status

severity

explanation

recommendation

PactTrace validates those fields on the server.

A historical quotation must actually exist in the recalled memory.

A current quotation must actually exist in the quote supplied by the user.

A returned memory ID must refer to a memory that was really included in the analysis.

If a condition is returned, that condition must also come from the associated historical memory.

This allows PactTrace to reject invented evidence, unknown references, and paraphrases presented as quotations.

The system uses three main result states.

Potential conflict

Explicit evidence suggests that an applicable historical promise is contradicted by the current quote.

Honored

Current evidence explicitly shows that the promise was fulfilled.

Insufficient evidence

There is not enough information to support either conclusion.

That final state turned out to be especially important.

Silence is not proof

Suppose CloudNova previously promised to waive the onboarding fee.

The later renewal quote only discusses annual pricing.

It does not say:

The onboarding fee will be charged.

But it also does not confirm:

The onboarding fee remains waived.

It would be tempting for an AI system to classify that promise as violated simply because the quote does not mention the waiver.

PactTrace does not do that.

Instead, it returns insufficient evidence.

The same principle applies to conditions.

A historical condition can be:

met

not_met

unknown

not_applicable

Unknown or unmet conditions cannot support a potential conflict in PactTrace.

For the CloudNova discount, however, the evidence is stronger.

The historical commitment says the discount applies when the account exceeds 100 seats.

The quote explicitly says 130 seats.

130 is greater than 100.

The quote also explicitly says that no renewal discount is included.

That is enough evidence for PactTrace to surface a high-severity potential conflict.

I intentionally use the term potential conflict rather than violation or legal breach.

The application is providing negotiation evidence, not making a legal determination.

Making memory visible in the interface

I did not want Hindsight to become an invisible backend feature.

The PactTrace dashboard exposes the memory workflow directly:

Capture → Remember → Recall → Verify → Act

After an analysis, the interface displays:

number of memories recalled

historical evidence

current evidence

condition status

severity

commitment ledger

recommendation

memory timeline

negotiation brief

The timeline records application events such as quote submission, Hindsight recall, and completed comparison.

It is not hidden model reasoning.

That distinction matters because I wanted users to understand what the system did, without pretending to expose internal model reasoning.

The final negotiation brief converts the comparison into something more useful than a generic AI response.

For CloudNova, the recommendation is essentially:

Ask the vendor to confirm the onboarding-fee waiver and provide a revised quote applying the promised 15% renewal discount to the 130-seat account.

That is the final step of the workflow:

memory becomes action.

Handling provider failures without faking success

External AI services fail.

Rate limits happen. Network requests time out. Structured model responses can fail validation.

PactTrace includes bounded retry behavior for selected Groq failures.

Rate limits and transient server failures can be retried at most twice.

Short Retry-After instructions are respected.

If the provider asks the application to wait longer than the request budget allows, PactTrace fails safely instead of retrying too early.

There is also one bounded correction attempt if the structured comparison fails schema or evidence validation.

What I did not want was a system that weakens its validator simply to produce a successful-looking response.

Retention has another subtle failure mode.

If a memory-storage request times out, the data might already have reached the provider.

For that reason, PactTrace does not blindly retry Hindsight retention or claim that the operation rolled back.

It reports uncertainty instead.

That is less convenient than saying everything succeeded, but it is more accurate.

What I learned

Building PactTrace changed how I think about AI application architecture.

Memory is not the same thing as a larger prompt
A larger context window can process information you provide now.

Persistent memory allows a future request to recover information that was captured earlier.

That changes what the application can know at decision time.

Retrieval still needs boundaries
Semantic recall is powerful, but retrieval alone is not enough.

I still need metadata checks, conservative deduplication, vendor filtering, and careful selection before recalled information reaches the model.

Structured output still needs validation
A JSON schema controls shape.

It does not automatically prove that the values inside the JSON are supported by the source material.

Grounding checks still matter.

Uncertainty should be part of the product
“Insufficient evidence” is sometimes a much better result than an impressive but unsupported conclusion.

Not every missing term is a conflict.

Not every unclear condition should be guessed.

Memory should be visible
Showing the historical promise, new evidence, condition state, and recommendation makes the system easier to review.

The user can understand why the application surfaced an issue instead of receiving a mysterious final answer.

Where PactTrace can go next

The current architecture focuses on the core memory and evidence workflow.

A larger enterprise version would need additional infrastructure including:

organization identity

authentication and authorization

tenant-specific memory-bank isolation

durable write idempotency

access-controlled audit trails

persistent multi-vendor workspaces

verified financial exposure calculations

stronger operational monitoring

I intentionally leave financial impact unset today because the application does not yet have a verified baseline, currency, contract-period, and pricing calculator.

It is better to return no financial number than manufacture one.

The core idea remains the same:

A later decision becomes more useful when the agent can recover relevant evidence from an earlier interaction.

Hindsight provides that persistent memory layer.

Groq provides structured extraction and comparison.

PactTrace connects the two with validation and a workflow designed around real vendor decisions.

Remembering the relationship is what turns an isolated quote into a meaningful negotiation question.

Project links

PactTrace source code:
https://github.com/v9vek26/pacttrace

Live PactTrace application:
https://pacttrace.vercel.app

Hindsight GitHub:
https://github.com/vectorize-io/hindsight

Hindsight documentation:
https://hindsight.vectorize.io/

Vectorize guide to agent memory:
https://vectorize.io/articles/agent-memory-vs-rag

Top comments (0)