Short answer: Consolidation lifts repeated episode scraps into reusable principles the agent can apply on the next job.
Summarization compresses a thread; consolidation creates general knowledge from many episodes. Engram buffers hold goals, actions, and feedback until a transform writes one experience memory. Keep episodes when audits, risk, or exceptions matter. Wait until similar interactions cluster before consolidating. Pair with contradiction handling so semantic rules stay current.
Consolidation turns “what happened” into “what is generally true.” Summarization compresses a thread into one bounded narrative. Consolidation goes further. It lifts repeated episodes into reusable semantic knowledge the agent can apply on the next job, not only resume the last chat. Weaviate Engram’s continual-learning pattern is built for that lift. Episodic scraps such as task goals, actions taken, and feedback wait in a buffer. A transform then writes one experience memory and keeps noisy intermediates off the retrieval path. Search later returns a principle, not a pile of session notes.
This chapter defines episodic versus semantic memory in agent systems, shows how Engram buffers and transforms perform consolidation, explains when to keep episodes as evidence, and walks through an application-side consolidate loop you can run when pipeline config is fixed. The destination is a store that learns procedures without drowning in transcripts.
What separates an episode from a semantic memory in practice?
After summarization keeps sessions affordable, you still face a pile of dated events. An episodic memory is time-bound and situated. “On Tuesday the search agent queried comedy as near-text” is episodic. A semantic memory is a durable rule or fact. “When the user asks for a genre, filter on the genres property instead of near-text” is semantic. Agents need both. Episodes explain provenance. Semantic memories transfer across sessions.
Cognitive architectures make the same split. Fast episodic stores capture recent interaction. Slower semantic stores hold abstracted knowledge. Consolidation is the transfer between them. In Engram terms, topics can mirror that split. Use topics for raw task fragments during a job. Use an experience or similar topic for the distilled rule. Scope experience per user when privacy matters. Scope it project-wide when a trusted team should share learnings.
Not every episode deserves promotion. Prediction-error style distillers keep only what existing knowledge failed to anticipate. Your policy can be simpler. Promote when the same lesson appears twice, when a human corrects the agent, or when a task succeeds after a failure. Leave one-off chatter in summaries or prune it.
How does Engram consolidate fragments into experience?
Once you know the target shape, look at the write path. Engram can extract atomic pieces from different agents or messages into different topics. A buffer holds those pieces until a trigger fires. Triggers include having the needed topics present, hitting a count, or waiting for idle time. When the buffer flushes, a transform over the whole batch writes one combined experience memory. Intermediate fragments should not remain searchable if they only existed to build that lesson.
A second transform with context can then merge the new experience into older experience memories. Deduplicate near-identical lessons. Rewrite a broader rule when several filter tips belong together. Commit is the only step that persists creates, updates, and deletes. Until commit, drafts stay off the live index. That prevents agents from retrieving half-consolidated noise mid-pipeline.
Daily rollups are a lighter cousin of the same idea. Extract and commit during the day, buffer by scope, then transform overnight into one activity memory. That is consolidation of many episodes into a coarser semantic day-object. Choose the granularity your retrieval questions need.
When should you keep the episode after the semantic rule exists?
Consolidation is lossy by nature. The semantic rule is easier to use and easier to overgeneralize. Keep episodic evidence when audits matter, when the rule is high risk, or when rare exceptions must stay findable. A common pattern is dual write. Commit the experience memory for ordinary retrieval. Archive or tag the source episodes so a specialized search can still answer “show me the session where we learned this.”
Research on recurrence-based consolidation also warns against consolidating too early. Waiting until similar interactions cluster gives the model richer material and fewer useless LLM calls. Engram buffers already encode that wait. Application jobs can mimic it by consolidating only when hybrid search finds enough related episodes under one query.
Do not delete every episode automatically. Soft-forget or demote them in ranking after a successful consolidate. Hard-delete only when the semantic memory is verified and policy allows. That leaves room for reconsolidation later, when a new retrieval shows the rule is incomplete.
What does an application-side consolidation pass look like?
Imagine a violin workshop agent on violin-bridge-fitting-desk-9. Several episodic notes capture a failed high bridge, a customer complaint about wolf tones, and a successful lower cut. Consolidation should yield one semantic fitting rule.
import os
from engram import EngramClient, HybridRetrieval
client = EngramClient(api_key=os.environ["ENGRAM_API_KEY"])
luthier = "luthier-sam-okada"
desk = {"desk_id": "violin-bridge-fitting-desk-9"}
EPISODES = [
"Episode: fitted a tall bridge on violin-bridge-fitting-desk-9; player reported harsh response.",
"Episode: customer mentioned a wolf near C on the G string after the tall bridge job.",
"Episode: refit with a lower cut and slightly thinner feet; wolf eased and response evened out.",
]
def seed_episodes():
for text in EPISODES:
run = client.memories.add(
text,
user_id=luthier,
group="personalization",
properties=desk,
)
client.runs.wait(run.run_id)
def consolidate_bridge_lessons(query: str = "bridge height wolf tone"):
episodes = client.memories.search(
query,
user_id=luthier,
group="personalization",
properties=desk,
retrieval_config=HybridRetrieval(limit=20),
)
episodic = [m for m in episodes if m.content.lower().startswith("episode:")]
if len(episodic) < 2:
return None, episodes
# Prefer pipeline transform in production; this shows the consolidate shape.
semantic = (
"On violin-bridge-fitting-desk-9, prefer a lower bridge cut with thinner feet "
"when response is harsh or a wolf appears near C on the G string. "
"Tall bridges have caused harsh tone and wolf complaints in past fittings."
)
run = client.memories.add(
semantic,
user_id=luthier,
group="personalization",
properties={**desk, "memory_kind": "experience"},
)
client.runs.wait(run.run_id)
# Demote raw episodes from the default retrieval surface by deleting after archive.
archived = [{"id": m.id, "content": m.content} for m in episodic]
for m in episodic:
client.memories.delete(m.id, user_id=luthier, group="personalization")
kept = client.memories.search(
query,
user_id=luthier,
group="personalization",
properties=desk,
retrieval_config=HybridRetrieval(limit=10),
)
return semantic, kept, archived
seed_episodes()
rule, live, archive = consolidate_bridge_lessons()
print("semantic:", rule)
print("live_count:", len(live))
print("archived_episodes:", len(archive))
In a configurable Engram pipeline, the same work happens inside buffer flush and transform rather than in your loop. The application version is useful for repair jobs and for projects that cannot yet customize pipeline DAGs. Either way, the live search path should prefer the semantic rule.
How do you know consolidation is helping rather than erasing skill?
Test transfer. Ask the agent a new but related fitting question after episodes are gone from live search. If it applies the rule, consolidation worked. If it forgets exceptions, your semantic text is too thin. Add a short “except when” clause, or keep one exemplar episode retrievable under a dedicated topic.
Also watch stale-fact rates. Consolidated rules can outlive reality. Pair consolidation with contradiction detection and supersession so semantic memories stay current. Consolidation creates stable knowledge. Reconsolidation updates that knowledge when retrieval shows it no longer fits.
Our next chapter, What is reconsolidation when memory is retrieved?, covers how bringing a memory back into use becomes the moment to revise it safely.