Derived state, backflow and recoverability
Why persistent AI needs lineage before it can forget, correct or recover.
- 18 Oct 2026
- Lineleaf
- Working paper
- 4
A leaf is a lineage you can see: every vein grows from the one before it, back to the stem.
10 sections7 open problemsDoyle 1979 → OWASP ASI06
Abstract
Persistent AI systems turn each input into derived state: memories, embeddings, summaries, cached answers and agent plans, spread across stores that share no record of where anything came from. When a source is corrected, erased or found to be poisoned, its descendants survive and keep influencing answers, a failure recent work calls backflow. We argue the missing primitive is lineage recorded at write time: with it, invalidation becomes a bounded graph walk, partially affected artifacts can be rebuilt from the parents that remain valid, and every action can be proven after the fact. We relate this to truth maintenance, data provenance, machine unlearning and context attribution, and list the problems we consider open.
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.1614
One source fans out into five derived artifacts across four stores. None of them records where it came from unless something writes the edge.
Truth maintenance (Doyle, 1979)
Truth-maintenance systems record why a belief is held (its justifications), so that when a premise is retracted, every belief that depended on it is withdrawn or re-derived, and nothing else is. Assumption-based variants track which sets of premises support each belief.
An AI memory with lineage is a practical descendant: artifacts are beliefs, edges are justifications, and invalidation is retraction. What is new is the setting: beliefs spread across vector stores, caches and agent state, with justifications produced by model calls rather than rules.56
Backflow and agentic 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.
Agents add a second place where deleted information lives: persistent memory. Wang et al. (2026) call the failure backflow: retrieval can reactivate what the model still holds, and memory artifacts can reintroduce the deleted content. Their memory-side remedy prunes entities that depended only on the forgotten data and invalidates the artifacts it shared with others.
That is exactly the rule Lineleaf’s planner applies on the memory side: purge what was derived only from the erased source, rebuild what still has valid parents. Lineleaf does not touch model weights; it makes the memory pathway enumerable, so a deletion can be complete.789
The source is erased. Its descendants are not: the memory, embedding and cache still exist, and a retrieval brings the erased content back into an answer.
Memory poisoning (OWASP ASI06)
The OWASP Top 10 for Agentic Applications lists Memory & Context Poisoning as ASI06: an attacker plants content that an agent stores and later trusts. Unlike a prompt injection that ends with the session, poisoned memory persists, and research on retrieval-augmented systems shows a handful of injected texts can steer answers.
Detection is only half the response. Once a source is flagged, every summary, embedding, cached answer and running plan it influenced is suspect. With lineage, cleanup becomes a graph query: find every descendant of the flagged source, purge what it alone produced, rebuild what it shared, and halt the agents acting on it.1920
Context attribution (ContextCite)
Attribution methods estimate which parts of a context a generation actually relied on, through ablation, surrogate models, or influence estimates. ContextCite (2024) made this practical for language-model outputs: which retrieved sources a specific statement depends on.
Attribution is what makes why() measurable rather than declared. It is also probabilistic, so Lineleaf records attribution scores as edge metadata and treats them as evidence for planning, while explicitly declared parents remain the default.1718
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.1234
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.10
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.1514
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 it 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.1112
One of the summary's two parents is removed. The summary is rebuilt from the parent that remains, and the new lineage no longer includes the removed one.
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.
Erasure, poisoning and correction all end here: the plan is only as good as its weakest adapter, so the receipt records which stores confirmed and which need review.13
One invalidation reaches four stores with different guarantees. Three confirm; the cache tombstones and is recorded as needing review, not as done.
Open technical questions
None of these are solved. They are where we expect to spend the most time, and where design partners can help most.
Automatically identifying which inputs caused an output
- Model calls receive whole contexts. Declared inputs over-approximate; attribution scores under-specify.
- Record declared inputs by default, attach attribution as evidence, and mark inferred edges visibly.
Handling summaries made from many sources
- A summary of 200 messages has 200 parents. Treating every parent change as a full invalidation is expensive and noisy.
- Weight edges, batch changes, and let policies decide when partial staleness warrants a rebuild.
Rebuilding rather than deleting partially affected artifacts
- Rebuilding requires the remaining parents to still be reachable, and proof that the result excludes the removed one.
- Make rebuild an adapter capability and record the new artifact’s parents on the receipt.
Maintaining performance with millions of lineage edges
- Descendant walks over high fan-out graphs get expensive, and every write adds edges.
- Start with Postgres and measured limits; publish numbers once there are real ones to publish.
Preventing scope creep during invalidation
- A broad source, such as a shared document or a system prompt, can reach most of a graph.
- Plans carry explicit scope; execution stops if the plan grows past what was approved.
Handling stores that cannot guarantee deletion
- Some stores only tombstone, some APIs cannot confirm, some backups are out of reach.
- Adapters declare capabilities; receipts record ‘needs review’ instead of pretending.
Giving live agents timely stale-data warnings
- An agent mid-task may already hold stale context in its prompt.
- 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. source
- [4]OpenLineage: an open specification for collecting lineage metadata. source
- [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. source
- [9]B. Wang, F. Wang, P. Wang, J. Cong, Y. Yu, Y. Yin, Z. Han, B. Wei. “Agentic Unlearning: When LLM Agent Meets Machine Unlearning.” 2026. source
- [10]Regulation (EU) 2016/679 (General Data Protection Regulation), Article 17, Right to erasure. source
- [11]A. Gupta, I. S. Mumick. “Maintenance of Materialized Views: Problems, Techniques, and Applications.” IEEE Data Engineering Bulletin 18(2), 1995.
- [12]A. Mokhov, N. Mitchell, S. Peyton Jones. “Build Systems à la Carte.” ICFP 2018.
- [13]S. Sarkar, T. I. Papon, D. Staratzis, M. Athanassoulis. “Lethe: A Tunable Delete-Aware LSM Engine.” SIGMOD 2020.
- [14]C. Packer et al. “MemGPT: Towards LLMs as Operating Systems.” 2023. source
- [15]J. S. Park et al. “Generative Agents: Interactive Simulacra of Human Behavior.” UIST 2023. source
- [16]P. Lewis et al. “Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks.” NeurIPS 2020. source
- [17]B. Cohen-Wang, H. Shah, K. Georgiev, A. Mądry. “ContextCite: Attributing Model Generation to Context.” NeurIPS 2024. source
- [18]P. W. Koh, P. Liang. “Understanding Black-box Predictions via Influence Functions.” ICML 2017. source
- [19]OWASP GenAI Security Project. “OWASP Top 10 for Agentic Applications for 2026.” ASI06: Memory & Context Poisoning. December 2025. source
- [20]W. Zou, R. Geng, B. Wang, J. Jia. “PoisonedRAG: Knowledge Corruption Attacks to Retrieval-Augmented Generation of Large Language Models.” 2024. source