Problem Statement
Cognee already supports temporal ingestion and SearchType.TEMPORAL, which is useful for asking what happened before/after/between dates. In agent-memory use cases, there is a related but distinct problem: older memories can remain highly retrievable even after a newer memory supersedes them.
For example, a customer, user, project, or workflow preference may change over time:
- "Customer 55442 prefers delivery address A" was true in March.
- "Customer 55442 prefers delivery address B" is approved in June.
- A future agent asks for the current preference and receives both, or the older one wins by semantic similarity.
The memory graph preserves useful history, but applications also need a deterministic way to identify current vs stale facts and avoid feeding outdated facts to agents as if they were still authoritative.
Proposed Solution
Add an optional temporal freshness / supersession layer for memories. This would complement the existing temporal graph rather than replace it.
At a high level:
- Allow callers to attach structured validity metadata to remembered facts, such as entity, predicate, object type/id,
valid_from, valid_to, transaction time, confidence, source, and status.
- Support a supersession policy for facts that share the same memory key, for example
newer_conflicting_fact or latest_per_key.
- Preserve historical facts in the graph, but mark older superseded facts as stale/inactive or exclude them from current-memory retrieval.
- Add retrieval options that can prefer or require current facts while still allowing timeline queries.
- Expose enough metadata in results for applications to explain why a fact is current, stale, superseded, or historical.
A possible API shape:
await cognee.remember(
"Customer 55442 prefers delivery address B for standard orders.",
dataset_name="customer_memory",
temporal_cognify=True,
memory_key={
"entity": "customer:55442",
"predicate": "prefers_delivery_address",
"object_type": "delivery_address",
},
valid_from="2026-06-07T00:00:00Z",
supersedes_policy="newer_conflicting_fact",
)
result = await cognee.recall(
query_type=SearchType.TEMPORAL,
query_text="Current delivery preference for customer 55442",
datasets=["customer_memory"],
freshness_policy="current",
)
Alternatives Considered
- Only use
SearchType.TEMPORAL: this helps with time-window retrieval, but does not by itself adjudicate which remembered fact is currently valid.
- Let each application maintain its own lifecycle ledger: this works, but many Cognee agent-memory users will hit the same stale-memory problem.
- Delete old memories: this loses historical context, auditability, and the ability to answer timeline questions.
- Use recency weighting only: useful, but insufficient when an older fact remains semantically closer or when a newer fact is merely related rather than truly superseding.
Use Case
We are using Cognee as operational memory for order-processing agents. Human-approved customer/article mappings and customer preferences are remembered so future orders can benefit from prior decisions.
Customer preferences can change. We want to preserve history while ensuring that future agents are not confidently given stale operational facts. The same pattern applies to user preferences, project rules, API behavior, contact details, addresses, pricing terms, and workflow decisions.
Implementation Ideas
This could be implemented incrementally:
- Add a lightweight memory validity metadata model for remembered facts.
- Store validity metadata in graph/vector metadata without requiring every user to opt in.
- Add a resolver that groups candidate facts by a stable memory key and determines current/stale/superseded state.
- Add retrieval-time filtering/ranking options such as
freshness_policy="all" | "current" | "prefer_current" | "historical".
- Wire the policy through
retriever_specific_config first, especially for TemporalRetriever, before deciding whether it belongs in the public top-level API.
- Add tests that prove: newer conflicting memories supersede older ones, stale memories remain queryable for historical/timeline queries, current-only recall excludes stale facts, and results expose freshness metadata.
I created a proposal branch in a fork with a more detailed design sketch and can turn it into a PR if this direction is useful.
Additional Context
The current Cognee temporal guide already covers event/time extraction and temporal recall. This feature request is specifically about temporal validity and stale-memory governance on top of that foundation.
Pre-submission checklist:
Problem Statement
Cognee already supports temporal ingestion and
SearchType.TEMPORAL, which is useful for asking what happened before/after/between dates. In agent-memory use cases, there is a related but distinct problem: older memories can remain highly retrievable even after a newer memory supersedes them.For example, a customer, user, project, or workflow preference may change over time:
The memory graph preserves useful history, but applications also need a deterministic way to identify current vs stale facts and avoid feeding outdated facts to agents as if they were still authoritative.
Proposed Solution
Add an optional temporal freshness / supersession layer for memories. This would complement the existing temporal graph rather than replace it.
At a high level:
valid_from,valid_to, transaction time, confidence, source, and status.newer_conflicting_factorlatest_per_key.A possible API shape:
Alternatives Considered
SearchType.TEMPORAL: this helps with time-window retrieval, but does not by itself adjudicate which remembered fact is currently valid.Use Case
We are using Cognee as operational memory for order-processing agents. Human-approved customer/article mappings and customer preferences are remembered so future orders can benefit from prior decisions.
Customer preferences can change. We want to preserve history while ensuring that future agents are not confidently given stale operational facts. The same pattern applies to user preferences, project rules, API behavior, contact details, addresses, pricing terms, and workflow decisions.
Implementation Ideas
This could be implemented incrementally:
freshness_policy="all" | "current" | "prefer_current" | "historical".retriever_specific_configfirst, especially forTemporalRetriever, before deciding whether it belongs in the public top-level API.I created a proposal branch in a fork with a more detailed design sketch and can turn it into a PR if this direction is useful.
Additional Context
The current Cognee temporal guide already covers event/time extraction and temporal recall. This feature request is specifically about temporal validity and stale-memory governance on top of that foundation.
Pre-submission checklist: