The River Algorithm: A Sediment-Based Memory Consolidation Model for Personal AI Agents
Abstract
Current AI assistants suffer from a fundamental asymmetry: users invest years of conversation, yet the AI retains no lasting understanding of who they are. Retrieval-Augmented Generation (RAG) stores utterances but does not distill them into structured knowledge. We present the River Algorithm, a memory consolidation framework inspired by geological sedimentation. Incoming user messages flow through a real-time cognition layer that classifies intent, retrieves contextual memory, and verifies response fidelity. Personal observations then sediment through a multi-layered knowledge lifecycle—entering as suspected facts, accumulating evidence across sessions, graduating to confirmed knowledge through cross-validated promotion, and eventually reverting to a doubt state upon expiration or being superseded when contradicted. An offline purify phase, analogous to sleep consolidation in neuroscience, runs a 12-step pipeline that extracts observations, classifies them against the existing profile, resolves contradictions with full conversational context, manages time-based decay, and generates a trajectory summary of the user's life phase. We describe the architecture and implementation of JKRiver, an open-source personal AI agent. Three case studies demonstrate multi-session fact verification, contradiction resolution, and interest decay with re-mention recovery. Code: https://github.com/wangjiake/JKRiver
Fields of Study & Subjects
AI-based Problem Solving and Planning
Speech and dialogue systems
Cognitive Computing and Networks
Publication details
- Journal / source
- Zenodo (CERN European Organization for Nuclear Research)
- Publication date
- 26 February 2026
- Language
- EN