Three operations. A small data model. Nothing hidden.
How Lineleaf captures lineage, plans and executes invalidations, and what adapters, receipts and webhooks look like. Published early so design partners can shape it.
- 0.1 · draft
- Specified, not released
- Not available yet
- Design partners
Architecture
Application
Agent runtime
Stores
LINELEAF
It keeps ids, edges and sha256 fingerprints, never the content.
- derive()
- the runtime reports each edge
- why()
- the application asks for any record's lineage
- invalidate()
- Lineleaf acts on the stores, through adapters
SDK
| Operation | What it does | Side effects |
|---|---|---|
derive(output, inputs, op, ttl?) | Records an edge from each input to the output. Middleware calls it for you. | Writes lineage only |
invalidate(source, reason) | Returns a plan: plan.affected lists every descendant with a proposed action. | None until plan.execute() |
why(artifact) | Returns the path back to the sources, with operations, models, times and attribution. | None |
derive(output, inputs, op, ttl?)- Records an edge from each input to the output. Middleware calls it for you.
- Writes lineage only
invalidate(source, reason)- Returns a plan: plan.affected lists every descendant with a proposed action.
- None until plan.execute()
why(artifact)- Returns the path back to the sources, with operations, models, times and attribution.
- None
A · Zero-code capture
from langgraph.store.postgres import PostgresStorefrom lineleaf.integrations.langgraph import instrument store = PostgresStore.from_conn_string(DB_URL)agent = instrument(builder.compile(store=store)) # your graph, unchanged # Every run now records its own lineage:# tool_output → context → memory_write → pgvector, redis# No derive() calls. Edges carry ids and sha256 fingerprints, never content.agent.invoke({"messages": [message]}, config)import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";import { withLineage } from "@lineleaf/sdk/mcp"; const server = withLineage(new McpServer({ name: "crm", version: "1.0.0" })); // Tool results become sources. Whatever an agent writes from them// (memories, summaries, cache entries) is recorded as their child.server.registerTool("lookup_customer", { inputSchema: { id: z.string() } }, async ({ id }) => ({ content: [{ type: "text", text: await crm.lookup(id) }],}));from opentelemetry.sdk.trace import TracerProviderfrom lineleaf.otel import LineageSpanProcessor provider = TracerProvider()provider.add_span_processor(LineageSpanProcessor()) # gen_ai.* spans (tool calls, retrievals, memory writes) become# parent → child lineage edges. Nothing else in your app changes.B · The explicit SDK
from lineleaf import Lineleaf ll = Lineleaf(api_key=KEY) # derive(): record where an artifact came fromll.derive( output=("mem0", "mem_7f2a"), inputs=[("gmail", "msg_8812")], op="extract", ttl="180d",) # invalidate(): a dry run. Nothing is touched yet.plan = ll.invalidate(("gmail", "msg_8812"), reason="gdpr_erasure")plan.affected # purge mem0:mem_7f2a, purge pgvector:emb_3310, … receipt = plan.execute() # adapters act, webhooks firereceipt.verify() # sha256 chain + ES256 signature # why(): trace any artifact back to its sourcesll.why(("redis", "ans_88"))- aWrites lineage only: ids, operation, model, time. Never the content.
- bA dry run. Nothing in any store changes here.
- cAdapters act in dependency order; dependent agents get lineage.stale.
- dThe path back to the sources, with freshness.
import { Lineleaf } from "@lineleaf/sdk"; const ll = new Lineleaf({ apiKey: process.env.LINELEAF_KEY }); // derive(): record where an artifact came fromawait ll.derive({ output: { store: "mem0", id: "mem_7f2a" }, inputs: [{ store: "gmail", id: "msg_8812" }], op: "extract", ttl: "180d",}); // invalidate(): a dry run. Nothing is touched yet.const plan = await ll.invalidate({ store: "gmail", id: "msg_8812" }, { reason: "gdpr_erasure" });plan.affected; // purge mem0:mem_7f2a, purge pgvector:emb_3310, … const receipt = await plan.execute(); // adapters act, webhooks fireawait receipt.verify(); // sha256 chain + ES256 signature // why(): trace any artifact back to its sourcesawait ll.why({ store: "redis", id: "ans_88" });- aWrites lineage only: ids, operation, model, time. Never the content.
- bA dry run. Nothing in any store changes here.
- cAdapters act in dependency order; dependent agents get lineage.stale.
- dThe path back to the sources, with freshness.
Data model
Artifact
A stored object, identified by store and id, with a fingerprint, timestamps and an optional TTL.
- memory
- memory_72
- sha256:41be…07
- 2026-09-02T14:21:09Z
- 180d
Edge
A parent to child relationship: the operation, model and time, with optional attribution.
- profile:user_117
- memory:memory_72
- extract
- extractor-v3
- 1.0
Event
An erasure, poisoning or correction trigger, which becomes a plan over the source's descendants.
- revise
- profile:user_117
- source_changed
- svc:profile-updates
- planned · 6
Receipt
A signed, hash-linked record of every artifact and adapter action involved in a cleanup.
- rcpt_4be1c0a7
- evt_93ac
- 6 rows
- sha256 · prev → hash
- ES256
Lifecycle
Dry-run
plan = ll.invalidate(("gmail", "ext_901"), reason="poison_detected", dry_run=True) for step in plan.affected: print(step.store, step.id, step.action) # nothing has been touched plan.require_scope(max_artifacts=50) # refuse silent expansionreceipt = plan.execute() # adapters act; receipt returnedreceipt.verify() # check signature and hash chain- aReturns a plan. Nothing is touched until execute().
- bExecution stops if the plan has grown past this since it was reviewed.
- cOne receipt row per action, in the order it ran.
const plan = await ll.invalidate( { store: "gmail", id: "ext_901" }, { reason: "poison_detected", dryRun: true },); for (const step of plan.affected) { console.log(step.store, step.id, step.action); // nothing has been touched} plan.requireScope({ maxArtifacts: 50 }); // refuse silent expansionconst receipt = await plan.execute(); // adapters act; receipt returnedawait receipt.verify(); // check signature and hash chain- aReturns a plan. Nothing is touched until execute().
- bExecution stops if the plan has grown past this since it was reviewed.
- cOne receipt row per action, in the order it ran.
Adapters
| Store | Covers | Verbs | Status |
|---|---|---|---|
| Mem0 | Long-term memories | purge · mark stale · rebuild | Planned |
| Zep / Graphiti | Temporal knowledge graph | purge facts · invalidate edges | Planned |
| Letta | Memory blocks, archival memory | purge · rebuild blocks | Planned |
| LangGraph | Checkpoints, long-term store | mark stale · halt runs | Planned |
| pgvector | Embeddings in Postgres | purge · re-embed | Planned |
| Pinecone | Managed vector index | purge · re-embed | Planned |
| Redis | Caches, cached answers | evict | Planned |
| Your store | Anything you operate | implement four verbs | Adapter interface |
Mem0
- Long-term memories
purge · mark stale · rebuild- Planned
Zep / Graphiti
- Temporal knowledge graph
purge facts · invalidate edges- Planned
Letta
- Memory blocks, archival memory
purge · rebuild blocks- Planned
LangGraph
- Checkpoints, long-term store
mark stale · halt runs- Planned
pgvector
- Embeddings in Postgres
purge · re-embed- Planned
Pinecone
- Managed vector index
purge · re-embed- Planned
Redis
- Caches, cached answers
evict- Planned
Your store
- Anything you operate
implement four verbs- Adapter interface
// Every store implements four verbs and declares what it can guarantee.export interface LineleafAdapter { store: string; // "pgvector", "redis", … capabilities: { delete: "guaranteed" | "best_effort" | "none"; rebuild: boolean; }; exists(ids: string[]): Promise<Record<string, boolean>>; delete(ids: string[], ctx: ActionContext): Promise<ActionResult[]>; markStale(ids: string[], ctx: ActionContext): Promise<ActionResult[]>; rebuild?(ids: string[], ctx: ActionContext): Promise<ActionResult[]>;}- aA store that can’t guarantee deletion says so, and its rows are recorded as needs_review.
- bUsed to confirm a delete actually happened.
# Every store implements four verbs and declares what it can guarantee.class LineleafAdapter(Protocol): store: str # "pgvector", "redis", … capabilities: Capabilities # delete: guaranteed | best_effort | none def exists(self, ids: list[str]) -> dict[str, bool]: ... def delete(self, ids: list[str], ctx: ActionContext) -> list[ActionResult]: ... def mark_stale(self, ids: list[str], ctx: ActionContext) -> list[ActionResult]: ... def rebuild(self, ids: list[str], ctx: ActionContext) -> list[ActionResult]: ...Receipts

{ "receipt": "rcpt_7c1d09a2", "type": "erasure receipt", "event": { "source": "gmail:msg_8812", "reason": "gdpr_erasure", "basis": "GDPR Art. 17", "issued_at": "2026-03-04T10:00:00Z" }, "scope": { "planned": 6, "executed": 6, "needs_review": 0 }, "actions": [ { "seq": 1, "artifact": "gmail:msg_8812", "action": "invalidate", "status": "completed", "prev": "9b0e…41", "hash": "3f2a…c7" }, { "seq": 2, "artifact": "mem0:mem_7f2a", "action": "delete", "status": "completed", "prev": "3f2a…c7", "hash": "e81d…09" }, { "seq": 3, "artifact": "pgvector:emb_3310", "action": "delete", "status": "completed", "prev": "e81d…09", "hash": "5c64…b0" }, { "seq": 4, "artifact": "summary:sum_12", "action": "rebuild", "status": "completed", "prev": "5c64…b0", "hash": "a40c…5e" }, { "seq": 5, "artifact": "redis:ans_88", "action": "delete", "status": "completed", "prev": "a40c…5e", "hash": "d913…2a" }, { "seq": 6, "artifact": "langgraph:plan_31", "action": "mark_stale", "status": "completed", "prev": "d913…2a", "hash": "7c1d…f3" } ], "webhooks": [ { "type": "lineage.stale", "artifact": "langgraph:plan_31", "directive": "replan" } ], "preserved": ["mem0:mem_51d0"], "chain": { "alg": "sha256", "genesis": "9b0e…41", "digest": "7c1d…f3" }, "signature": { "alg": "ES256", "kid": "org_key_01", "value": "MEUCIQ…" }}- aPartial outcomes stay visible: needs_review is never counted as done.
- bRow 1 commits to the genesis hash; every later row to the one before.
- cUntouched records are listed, so an auditor sees what stayed.
- dAn organization key in production. The browser demo signs with a throwaway key.
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "Lineleaf receipt", "type": "object", "required": ["receipt", "event", "scope", "actions", "chain", "signature"], "properties": { "receipt": { "type": "string", "pattern": "^rcpt_[0-9a-f]{8}$" }, "event": { "type": "object", "required": ["source", "reason", "issued_at"], "properties": { "source": { "type": "string", "description": "store:id" }, "reason": { "enum": ["gdpr_erasure", "poison_detected", "source_changed"] }, "basis": { "type": "string" }, "issued_at": { "type": "string", "format": "date-time" } } }, "scope": { "type": "object", "properties": { "planned": { "type": "integer" }, "executed": { "type": "integer" }, "needs_review": { "type": "integer" } } }, "actions": { "type": "array", "items": { "type": "object", "required": ["seq", "artifact", "action", "status", "prev", "hash"], "properties": { "seq": { "type": "integer", "minimum": 1 }, "artifact": { "type": "string" }, "action": { "enum": ["invalidate", "delete", "rebuild", "mark_stale", "manual_review"] }, "status": { "enum": ["completed", "needs_review"] }, "prev": { "type": "string", "description": "sha256 of the previous row, or the genesis hash" }, "hash": { "type": "string", "description": "sha256(prev | store:id | action)" } } } }, "webhooks": { "type": "array" }, "preserved": { "type": "array", "items": { "type": "string" } }, "chain": { "type": "object", "properties": { "alg": { "const": "sha256" }, "genesis": { "type": "string", "description": "sha256(source | reason | issued_at)" }, "digest": { "type": "string", "description": "hash of the last row" } } }, "signature": { "type": "object", "properties": { "alg": { "const": "ES256" }, "kid": { "type": "string" }, "value": { "type": "string" } } } }}Webhooks
{ "type": "lineage.stale", "artifact": "langgraph:plan_404", "because": ["gmail:ext_901"], "reason": "poison_detected", "event": "evt_93ac", "directive": "halt", "hint": "stop the run; its context included a quarantined source"}- aThe changed sources this agent's context depended on.
- bhalt or replan, chosen per trigger.
Status
- Architecture and v0.1 interface
- Interactive browser simulation
- Lineage ledger (Postgres)
- Python and TypeScript SDKs
- Zero-code middleware: LangGraph, MCP, OpenTelemetry
- Dry-run planner and signed receipts
- First adapters
- Managed cloud