Executive Summary
Humans consolidate memories during sleep. The hippocampus replays the day's experiences, strengthens important connections, prunes irrelevant ones, and integrates new knowledge into long-term storage. This process is why you wake up understanding something you struggled with the night before.
Kent does the same thing -- except it takes 30 seconds instead of 8 hours, and you can audit every decision it makes.
This paper explains Kent's overnight consolidation engine: how it reviews the day's conversations, merges duplicate knowledge, prunes stale facts, rebuilds its memory index, and enforces write discipline to prevent brain pollution. The result is an AI that gets measurably smarter every day without any manual maintenance.
1. The Memory Pollution Problem
1.1 More Data Is Not Better Data
Most AI memory systems operate on a simple premise: store everything, search later. Every conversation turn, every connector query result, every file ingestion adds nodes to the knowledge graph. Over months of daily use, this produces a graph with thousands of nodes -- many of which are duplicates, contradictions, or stale facts.
Microsoft Research's 2025 study on personal knowledge management systems found that unmanaged knowledge bases degrade in retrieval quality by 3-5% per month as node count increases.
(Source: Microsoft Research, Scaling Personal Knowledge Graphs: Quality vs Quantity, 2025)
The degradation is not from the volume itself but from noise: duplicate entries for the same entity, outdated facts that contradict current reality, and derivable information that could be fetched live from connected services.
1.2 The Derivability Principle
Not all facts are worth remembering. If Kent is connected to your Gmail, it can always look up your recent emails. Storing a copy of email subjects in the knowledge graph creates a stale duplicate that will eventually contradict the live source.
The principle: never store what you can re-derive from a connected tool. This is write discipline -- the decision NOT to remember something because the authoritative source is already accessible.
Kent's write discipline gate checks every incoming node against active connectors. If the content pattern matches a connected service (email patterns when Gmail is connected, file patterns when Drive is connected), the node is logged as 'skipped' rather than stored.
The result: a knowledge graph that contains only facts that cannot be found anywhere else -- personal declarations, synthesized insights, user preferences, and non-derivable context.
2. The Three-Layer Architecture
2.1 Layer 1: The Memory Index (Always Loaded)
Every LLM call includes a compact memory index -- a maximum of 50 entries, each under 150 characters. This index acts as a table of contents for Kent's knowledge, not the knowledge itself.
Example index entries:
- employer: Ubiks LLC, tax/finance consulting [-> work]
- client: Henderson LLC, contract renewal March 31 [-> clients]
- preference: bullet points for internal, prose for clients [-> prefs]
Each entry points to a topic file that contains the full detail. The index is small enough to include in every prompt without meaningful token cost -- approximately 200-400 tokens for a full 50-entry index.
2.2 Layer 2: Topic Files (On-Demand)
Topic files are markdown documents stored locally at {userData}/memory/topics/. Each covers a specific domain: work.md, clients.md, prefs.md, identity.md.
Topic files are loaded only when the memory index suggests relevance to the current query. If the user asks about a client and the index has a pointer to 'clients', Kent loads clients.md into context. If the user asks about the weather, no topic files are loaded.
This is the key efficiency: instead of loading 964 knowledge graph nodes into every prompt (which would cost thousands of tokens), Kent loads only the 200-token index plus the one or two relevant topic files.
2.3 Layer 3: Session Transcripts (Never Loaded Wholesale)
Chat history is the largest data source but the least useful for retrieval. Loading all history into context is expensive, noisy, and produces worse results than targeted search.
Kent's rule: never load transcripts wholesale. Access them only through targeted grep with specific search terms. The memory index points to what exists; topic files contain the synthesized knowledge; transcripts are the raw source of last resort.
3. The Consolidation Engine
3.1 When It Runs
Consolidation triggers when two conditions are met:
- At least 24 hours since the last consolidation
- At least 5 new knowledge nodes added since the last run
Both conditions must be true. This prevents running on days with no new information (wasteful) and prevents running too frequently during heavy usage (disruptive).
The consolidation runs during Kent's 3am batch job -- the same scheduler that handles Ghost Mode daily resets, expired audio cleanup, and pattern detection.
3.2 What It Does
The consolidator performs four operations:
Merge: Find nodes with semantically similar content. When duplicates are found, merge them into a single node with the highest stakes score. The merged content is rewritten by the LLM to be concise and absolute -- converting 'he mentioned that the contract might expire' into 'Henderson contract expires March 31.'
Prune: Remove nodes that are low-stakes (below 0.2), older than 30 days, and have no edges connecting them to other nodes. These are isolated facts that were never referenced again -- likely noise from one-off conversations.
Index Rebuild: Sample the top 100 high-value nodes and ask the LLM to create a fresh memory index. The LLM groups related facts, writes concise pointers, and assigns topic slugs. The resulting index replaces the previous one entirely.
Topic Rewrite: For topics with 3 or more nodes, generate a fresh topic file that synthesizes all related knowledge into clean, factual markdown. This is the equivalent of rewriting your notes after a semester -- organized, concise, and free of redundancy.
3.3 What It Never Touches
User fact nodes (type: user_fact) are immune to consolidation. They are never merged, pruned, or rewritten. The user's name, employer, location, and role are permanent and absolute. Stakes score is locked at 1.0.
4. The Skeptical Retrieval Instruction
Memory is useful but fallible. Facts change. Deadlines pass. Prices update. A memory from two weeks ago that says 'Henderson contract expires March 31' may be outdated if the contract was signed on March 28.
Kent's system prompt includes a skeptical retrieval instruction that tells the LLM:
- Memory index entries are hints, not truth
- Verify facts before using them in actions
- Facts about deadlines, prices, and status change frequently
- If a fact is derivable from a connected tool, fetch live data instead of relying on memory
- When memory contradicts observable data, memory is wrong
This prevents the common failure mode where an AI confidently states an outdated fact because it was in the knowledge base. Kent uses memory as a starting point for retrieval, not as a final answer.
5. Measuring Consolidation Quality
Kent logs every consolidation run with metrics:
- Nodes before and after (how much was pruned)
- Merges performed (how many duplicates found)
- Index entries rewritten (how stale the index was)
- Duration (typically 10-30 seconds)
Over time, a healthy knowledge graph shows:
- Stable or slowly growing node count (not exponential)
- Decreasing merge count per run (fewer new duplicates)
- Consistent index size (near the 50-entry cap)
- Zero user_fact nodes pruned (they are protected)
An unhealthy graph shows exponential node growth, high merge counts, and index entries that change drastically between runs -- indicating that the write discipline gate may need tightening.
Conclusion: Intelligence Requires Forgetting
The human brain is not impressive because it remembers everything. It is impressive because it knows what to forget. Sleep-based memory consolidation is not a bug in human cognition -- it is the mechanism that transforms raw experience into structured knowledge.
Kent's consolidation engine applies the same principle to AI memory. Not everything is worth remembering. Duplicates should be merged. Stale facts should be pruned. The memory index should be rebuilt regularly to reflect what matters now, not what mattered three months ago.
The result is an AI assistant that does not just accumulate data. It learns. It gets smarter overnight. And unlike a human brain, you can audit every decision it makes.
Kent Research | April 2026