Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions src/content/blog/agent-memory-provenance-audit-trails.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,15 @@ When the agent answers "your pipeline timed out at 9am UTC on April 14", you can

Honest accounting. Storing `source_episode_ids` per memory adds:

- **Storage**: a small array of UUIDs per memory. For a million memories averaging three source episodes each, that's ~3M UUIDs — call it 50 MB. Trivial relative to the embeddings.
- **Compute**: zero at retrieval time — the IDs are already on the memory row, no extra lookup unless you want to fetch the source episodes themselves.
- **API surface**: one extra field on the memory shape, one optional `expand=episodes` parameter on the context endpoint for callers who want the raw events alongside the compiled facts.
<div className="section-eyebrow mt-8 mb-4 text-xs font-semibold uppercase tracking-[0.18em] text-brand-500/75">The honest cost</div>

<div className="rounded-2xl border border-brand-500/25 bg-brand-500/[0.05] p-6 sm:p-7">
<ul className="!my-0 !pl-0 space-y-3 list-none">
<li className="flex items-start gap-3"><span className="mt-3.5 h-px w-3 shrink-0 bg-brand-500" /><span><strong className="text-theme-primary">Storage</strong> — a small array of UUIDs per memory. For a million memories averaging three source episodes each, that's ~3M UUIDs — call it 50 MB. Trivial relative to the embeddings.</span></li>
<li className="flex items-start gap-3"><span className="mt-3.5 h-px w-3 shrink-0 bg-brand-500" /><span><strong className="text-theme-primary">Compute</strong> — zero at retrieval time. The IDs are already on the memory row, no extra lookup unless you want to fetch the source episodes themselves.</span></li>
<li className="flex items-start gap-3"><span className="mt-3.5 h-px w-3 shrink-0 bg-brand-500" /><span><strong className="text-theme-primary">API surface</strong> — one extra field on the memory shape, one optional `expand=episodes` parameter on the context endpoint for callers who want the raw events alongside the compiled facts.</span></li>
</ul>
</div>

That's it. No separate audit-log service. No log shipping pipeline to keep alive. No retention conflict between the operational data and the audit data — they're the same data, in the same Postgres, with the same lifecycle.

Expand All @@ -58,7 +64,9 @@ This isn't a feature you bolt on for an enterprise tier. It's the data model. Th

### 3. Trust

The thing that breaks user trust in AI agents isn't being wrong sometimes — it's being wrong *and unable to explain why*. A support agent that says "your subscription is on the Pro plan because that's what you told us on April 12" is qualitatively different from one that says "your subscription is on the Pro plan" full stop. The first is auditable. The second is confidence theater.
> The thing that breaks user trust in AI agents isn't being wrong sometimes — it's being wrong *and unable to explain why*.

A support agent that says "your subscription is on the Pro plan because that's what you told us on April 12" is qualitatively different from one that says "your subscription is on the Pro plan" full stop. The first is auditable. The second is confidence theater.

Provenance gives the agent the language to be honest about where its knowledge came from — and gives the human reviewer the language to verify it.

Expand All @@ -70,7 +78,7 @@ There's a school of thought that says provenance is an enterprise feature: ship
2. **The auditing audience is the same as the technical audience.** Engineers debugging the agent in dev want the same chain a compliance officer wants in prod. Building two paths to the same answer (a dev "trace" and a prod "audit log") doubles the surface area for bugs.
3. **It's a forcing function for honest storage.** If every memory has to carry its sources, you can't sneak a "memory" in that isn't backed by an episode. The compiler can't hallucinate. The agent's "knowledge" is bounded by what actually happened.

Provenance ends up being a constraint that makes the whole system easier to reason about, not a tax you pay for compliance theater.
> Provenance ends up being a constraint that makes the whole system easier to reason about, not a tax you pay for compliance theater.

## What this looks like in the API

Expand Down
20 changes: 15 additions & 5 deletions src/content/blog/ai-agent-memory-vs-rag.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ tags:

Most teams building on LLMs end up with two patterns in the same codebase: **RAG** for looking things up in a corpus, and some hand-rolled **memory** for remembering what the agent has done or what the user has said. The two are often confused, and the confusion costs real engineering time when one is used in place of the other.

A short, accurate version: RAG retrieves *content the agent doesn't already know*; memory retrieves *context the agent has already participated in*. They share a vector store but they answer different questions, store different shapes of data, and have different correctness requirements.
> RAG retrieves *content the agent doesn't already know*. Memory retrieves *context the agent has already participated in*.

They share a vector store but they answer different questions, store different shapes of data, and have different correctness requirements.

## The shared substrate

Expand All @@ -37,9 +39,15 @@ You can paper over each of these in your application code. Teams that do end up

A memory runtime adds three things on top of the vector store:

- **Compilation**: a pass over raw episodes that produces typed memories — profile facts, preferences, procedures, episode summaries — with confidence scores and validity windows. This is what shrinks 200 turns into one fact.
- **Deterministic ranking**: scoring that mixes similarity with kind priority (a procedure beats a casual mention), recency, temporal validity, and an explicit token budget. Same query → same bundle. No silent re-ordering.
- **Provenance**: every compiled memory carries the IDs of the episodes it was derived from. When an agent answers from memory, the answer is auditable back to the raw event that produced it.
<div className="section-eyebrow mt-8 mb-4 text-xs font-semibold uppercase tracking-[0.18em] text-brand-500/75">What memory adds</div>

<div className="rounded-2xl border border-brand-500/25 bg-brand-500/[0.05] p-6 sm:p-7">
<ul className="!my-0 !pl-0 space-y-3 list-none">
<li className="flex items-start gap-3"><span className="mt-3.5 h-px w-3 shrink-0 bg-brand-500" /><span><strong className="text-theme-primary">Compilation</strong> — a pass over raw episodes that produces typed memories — profile facts, preferences, procedures, episode summaries — with confidence scores and validity windows. This is what shrinks 200 turns into one fact.</span></li>
<li className="flex items-start gap-3"><span className="mt-3.5 h-px w-3 shrink-0 bg-brand-500" /><span><strong className="text-theme-primary">Deterministic ranking</strong> — scoring that mixes similarity with kind priority (a procedure beats a casual mention), recency, temporal validity, and an explicit token budget. Same query → same bundle. No silent re-ordering.</span></li>
<li className="flex items-start gap-3"><span className="mt-3.5 h-px w-3 shrink-0 bg-brand-500" /><span><strong className="text-theme-primary">Provenance</strong> — every compiled memory carries the IDs of the episodes it was derived from. When an agent answers from memory, the answer is auditable back to the raw event that produced it.</span></li>
</ul>
</div>

None of those are properties of "RAG" in the literature sense. They're what makes memory infrastructure rather than retrieval over chat logs.

Expand All @@ -53,7 +61,9 @@ None of those are properties of "RAG" in the literature sense. They're what make
| Mutability | Append-only chunks; reindex on doc update | Episodes append-only; memories supersede; compaction is idempotent |
| Output | Top-K chunks | Token-bounded bundle ready to drop into a prompt |

Most production agents need both. The grounding corpus (docs, knowledge base) lives in RAG. The user / account / project context lives in memory. Trying to make either pattern do the other's job is the common architecture mistake — and it's the one we built Statewave to stop people from making.
Most production agents need both. The grounding corpus (docs, knowledge base) lives in RAG. The user / account / project context lives in memory.

> Trying to make either pattern do the other's job is the common architecture mistake — and it's the one we built Statewave to stop people from making.

## What Statewave is in this picture

Expand Down
Loading