Agent outputs now trace sentence by sentence: LMLineage tags each source out of band and compacts only documents that drift out of use
Synopsis
LMLineage maps every output sentence of an LLM agent session to the input spans that support it, with calibrated confidence, without white-box access to the model or extra inference passes. It runs as an out-of-band service, matches by window-level embedding similarity, and uses that lineage to detect which input documents are no longer referenced, compacting only those while keeping user instructions verbatim. On 71 Chinese gold-annotated sentences, the greedy-window path reaches 0.725 mean fine-grained accuracy versus 0.497 for exhaustive line-matching; a separate 90 turns of multi-turn sessions across three generator models serve only latency and feasibility checks.
Interpretation
An agent session can now answer, sentence by sentence, which input span produced which output, without opening the model internals or running an extra inference pass for attribution. Earlier routes either ask the model to cite its sources, where the citation is itself a model generation that can be unfaithful, or rely on model internals with many extra inference passes, while lexical matching breaks down under model paraphrase. On 71 Chinese gold-annotated sentences, window-level embedding similarity beats whole-document similarity on 84.5% of sentences, mean 0.21 versus 0.02; normalized Levenshtein and BM25 fall below common decision thresholds on 69/71 and 67/71 sentences respectively.
The lineage is then used to govern context: when an input document stops being referenced by any output for several consecutive turns, the system replaces only that document with a one- or two-sentence digest and leaves the rest of the transcript verbatim. Conventional context compaction summarizes the whole context near the token limit, which can wash away constraints such as a do-not-delete instruction. Across 10 synthetic 6-turn sessions, drift detection produced a 0.00 false-compaction rate with 0.30 recall; recall is bounded because the topic-A document loses the top match to the user-question document during the first three turns.
Perspective
The demonstrated scope is 71 gold-annotated Chinese web-QA sentences, 90 turns of independently collected multi-turn sessions across three generator models, and 10 synthetic 6-turn drift sessions; the system runs out of band as an OpenClaw plugin plus attribution service. The authors plan larger and multilingual gold sets with independent third-party annotation.
The gold set is Chinese-only at 71 sentences and was produced with LLM-assisted annotation; the greedy window search uses random perturbation in candidate expansion, and all reported numbers use a fixed seed. On the CPU-only production setup, the 8 s readiness wait is frequently missed for medium-to-large contexts, so micro-compaction falls back to a no-op; a quantitative A/B of micro-compaction is still ongoing.
