Why AI memory creates derived-state problems
Memory in an AI application is rarely one record. A message is extracted into a fact, the fact is summarized into a profile, the summary is embedded, retrieval results are cached, and an agent writes a plan that another agent consumes. Each step is reasonable on its own. Together they produce derived state spread across several stores with no shared notion of where it came from.
Retrieval-augmented systems make this more pronounced: every retrieved chunk can become part of a new artifact. When the original source is corrected or removed, nothing in the typical stack connects that event to the copies — so they keep being retrieved.[15][13]
The unit of correctness is not a record but a lineage: a source and everything derived from it.
Provenance and data lineage
Database research distinguishes why-provenance (which inputs justify an output) from where-provenance (where a value was copied from). Provenance semirings generalize both by annotating results with polynomials over their inputs. W3C PROV standardizes entities, activities, and agents for interchange, and OpenLineage applies similar ideas to data pipelines.
These models were built for queries and batch jobs with well-defined operators. AI pipelines add operators — extraction, summarization, generation — whose dependence on their inputs is real but not exact.[1][2][3][4]
Lineleaf borrows the entity–activity shape of PROV and records it at the moment artifacts are written.
Truth-maintenance systems
Truth-maintenance systems record why a belief is held — its justifications — so that when a premise is retracted, every belief that depended on it can be withdrawn or re-derived. Assumption-based variants track which sets of assumptions support each belief.
An AI memory with lineage is a practical descendant of this idea: artifacts are beliefs, edges are justifications, and invalidation is retraction. The difference is scale, heterogeneous storage, and justifications produced by models rather than rules.[5][6]
Machine unlearning
Machine unlearning asks how to remove the influence of specific training data from a model without retraining from scratch, often by structuring training so affected parts can be recomputed.
Lineleaf works at a different layer. It does not change model weights. It addresses the external memory around a model — stores, caches, summaries, and agent state — where a deleted source can persist even when no training is involved.[7][8]
Unlearning addresses the weights. Lineleaf addresses everything the application stored.
Cascade deletion
Relational databases solve a narrow version of this with foreign keys and ON DELETE CASCADE: when a parent row goes, dependent rows go with it. Erasure obligations such as GDPR Article 17 make the broader version a product requirement for many teams.
AI memory breaks the assumptions cascades rely on. Dependencies cross stores, are created by model calls rather than schemas, and include artifacts that should be rebuilt rather than deleted.[9]
Agent memory
Agent architectures increasingly separate working context from long-term memory that is written, summarized, and reflected upon over time. Reflection and summarization steps are exactly where one observation turns into many durable artifacts.
Multi-agent setups add another hop: one agent’s output becomes another agent’s input, and stale context can propagate while both are running.[14][13]
Context attribution
Attribution methods estimate which parts of a context a generation actually relied on — through ablation, surrogate models, or influence estimates. They are the closest thing to automatic why-provenance for model outputs.
They are also probabilistic. Lineleaf can record attribution scores as edge metadata, but treats them as evidence for planning rather than proof, and keeps explicitly declared parents as the default.[16][17]
Partial-copy rebuilding
A summary made from three sources is not invalid when one of them changes; it is partially stale. Deleting it loses good information. Rebuilding it from the remaining valid parents is usually right — and is what incremental view maintenance and build systems do for their own derived artifacts.
The hard part is knowing when a rebuild is possible, and making sure the rebuilt artifact provably no longer depends on the removed parent.[10][11]
Cross-store invalidation
Each store has its own deletion semantics. Some delete immediately; log-structured engines write tombstones and reclaim space later; caches expire; some hosted APIs offer no confirmation at all. An invalidation plan has to coordinate all of them and report honestly when it cannot be sure.
Poisoning makes this a security concern as well as a privacy one: a single injected document can steer retrieval-augmented answers until every derived copy is found.[12][18]
Open technical questions
None of these are solved. They are the problems we expect to spend the most time on, and where design partners can help most.
Q1Automatically identifying which inputs caused an output
open- Why it’s hard
- Model calls receive whole contexts. Declared inputs over-approximate; attribution scores under-specify.
- Current thinking
- Record declared inputs by default, attach attribution as evidence, and mark inferred edges visibly.
Q2Handling summaries made from many sources
open- Why it’s hard
- A summary of 200 messages has 200 parents. Treating every parent change as a full invalidation is expensive and noisy.
- Current thinking
- Weight edges, batch changes, and let policies decide when partial staleness warrants a rebuild.
Q3Rebuilding rather than deleting partially affected artifacts
open- Why it’s hard
- Rebuilding requires the remaining parents to still be reachable — and proof that the result excludes the removed one.
- Current thinking
- Make rebuild an adapter capability and record the new artifact’s parents on the receipt.
Q4Maintaining performance with millions of lineage edges
open- Why it’s hard
- Descendant walks over high fan-out graphs get expensive, and every write adds edges.
- Current thinking
- Start with Postgres and measured limits; publish numbers once there are real ones to publish.
Q5Preventing scope creep during invalidation
open- Why it’s hard
- A broad source — a shared document, a system prompt — can reach most of a graph.
- Current thinking
- Plans carry explicit scope; execution stops if the plan grows past what was approved.
Q6Handling stores that cannot guarantee deletion
open- Why it’s hard
- Some stores only tombstone, some APIs cannot confirm, some backups are out of reach.
- Current thinking
- Adapters declare capabilities; receipts record ‘needs review’ instead of pretending.
Q7Giving live agents timely stale-data warnings
open- Why it’s hard
- An agent mid-task may already hold stale context in its prompt.
- Current thinking
- Push lineage.stale events to subscribers and expose freshness on every why() call.
References
- [1]P. Buneman, S. Khanna, W.-C. Tan. “Why and Where: A Characterization of Data Provenance.” ICDT 2001.
- [2]T. J. Green, G. Karvounarakis, V. Tannen. “Provenance Semirings.” PODS 2007.
- [3]W3C. “PROV-DM: The PROV Data Model.” W3C Recommendation, 2013. link
- [4]OpenLineage — an open specification for collecting lineage metadata. link
- [5]J. Doyle. “A Truth Maintenance System.” Artificial Intelligence 12(3), 1979.
- [6]J. de Kleer. “An Assumption-based TMS.” Artificial Intelligence 28(2), 1986.
- [7]Y. Cao, J. Yang. “Towards Making Systems Forget with Machine Unlearning.” IEEE Symposium on Security and Privacy, 2015.
- [8]L. Bourtoule et al. “Machine Unlearning.” IEEE Symposium on Security and Privacy, 2021. link
- [9]Regulation (EU) 2016/679 (General Data Protection Regulation), Article 17 — Right to erasure. link
- [10]A. Gupta, I. S. Mumick. “Maintenance of Materialized Views: Problems, Techniques, and Applications.” IEEE Data Engineering Bulletin 18(2), 1995.
- [11]A. Mokhov, N. Mitchell, S. Peyton Jones. “Build Systems à la Carte.” ICFP 2018.
- [12]S. Sarkar, T. I. Papon, D. Staratzis, M. Athanassoulis. “Lethe: A Tunable Delete-Aware LSM Engine.” SIGMOD 2020.
- [13]C. Packer et al. “MemGPT: Towards LLMs as Operating Systems.” 2023. link
- [14]J. S. Park et al. “Generative Agents: Interactive Simulacra of Human Behavior.” UIST 2023. link
- [15]P. Lewis et al. “Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks.” NeurIPS 2020. link
- [16]B. Cohen-Wang, H. Shah, K. Georgiev, A. Mądry. “ContextCite: Attributing Model Generation to Context.” NeurIPS 2024. link
- [17]P. W. Koh, P. Liang. “Understanding Black-box Predictions via Influence Functions.” ICML 2017. link
- [18]W. Zou, R. Geng, B. Wang, J. Jia. “PoisonedRAG: Knowledge Corruption Attacks to Retrieval-Augmented Generation of Large Language Models.” 2024. link
Citations indicate related work, not endorsement of Lineleaf by any author or organization.