Skip to content

Lineage (C4, C6)

For each chunk an agent retrieved, ctxflow says two things, each at the moment of the retrieval and each with a reason:

  • C6, source state (the main mark): was the source document of the chunk still the published version?
  • C4, index validity (a second label): was the chunk in the index?

They are separate: a chunk can be in the index and still be stale against its source.

ctxflow never connects to your index or your sources. It learns about them from the processes that write and read them:

Fact Comes from
A chunk was written (with its id, text hash and C1) ingest.upsert spans of your instrumented ingestion, with C1 from its ingest.chunk spans
A chunk or a whole document was deleted ingest.delete spans (with chunk ids: those chunks; without: every chunk of that source)
A source was read, at some version and hash ingest.parse spans, on every run, changed or not
A chunk was retrieved The retrieval span: ctxflow.retrieval.item_ids and item_hashes, measured before any reranker

The instant t of a retrieval is the start of the tool call that returned the item, else the start of the turn. Pipeline events are exact: their time is the end of the span.

A retrieved item is joined to the written chunk by id. When no write has that id, by its text hash: the one chunk live at that time with that hash. If two chunks share the hash, nothing is picked.

Limits. A change that no instrumented process made (a manual edit, a backup restore, a source that changed and nobody re-ingested) is not seen. In particular, C6 detects stale context when your pipeline already read or wrote a newer version than the one served; “the source changed and nobody re-ingested” is not detected.

ambiguous and unknown items are never counted as current or stale.

State Reason When
current hash_match The hash of the item equals the source hash published at t.
current version_match No comparable hash on one side; the version of the item equals the version read at t.
stale source_deleted The source was deleted at t. Deletion always wins.
stale hash_mismatch The hash of the item differs from the source hash at t.
stale version_mismatch No comparable hash; the pipeline had read or written a newer version than the item’s.
ambiguous content_mismatch The id matches a written chunk, but both text hashes are known and differ: it is not what was written.
ambiguous hash_ambiguous No id match, and several live chunks share the item’s text hash.
ambiguous multiple_sources Two sources publish the same source_id with different hashes at t.
ambiguous multiple_indexes Two indexes give the chunk different hashes at t.
unknown not_verifiable The item has no id and no text (ctxflow.retrieval.item_verifiable=false).
unknown no_source_id The item declares no ctxflow.source_id, and no write gives one.
unknown no_item_hash No ctxflow.source_hash on the item or on the written chunk.
unknown source_not_observed No read or write of the source at or before t.
unknown no_published_hash The source event carries no hash.
unknown no_source_signal The environment has no S10 (no source reads).
unknown no_retrieval_time Neither the call nor the turn has a start time.

The constant version unversioned proves nothing: it stays unknown. Give your documents a real version (see Source identity).

Which hash is compared: first the ctxflow.source_hash the retrieval span declared (what the agent saw), else the one the written chunk declared. Confidence is verified when the C1 of the item agrees with the written chunk, observed when it does not, unresolved for unknown.

State Reasons
valid (“in the index at that time”) in_interval
not_valid deleted_before_t (removed before), not_indexed_yet
ambiguous content_mismatch, hash_ambiguous, multiple_indexes
unknown never_observed, no_index_signal (no S9), not_a_chunk, not_verifiable, no_retrieval_time

Content hashes are plain sha256 of the text or the bytes, with no key. The ingestion and the agent compute them the same way, so they are comparable without any shared secret.

A verdict says what was true at the moment of the retrieval, so a chunk that was current and changed later stays current. A write or read that arrives late can still change the verdict the next time you open it. The turn detail also shows the source now (“served → now”), as context, never as a verdict.

The C6 card (Usage page, C6 in the metrics API) is the share of stale items over the items with a known state, with its coverage next to it: known, ambiguous, and unknown by reason. It is available when every item is known, partial when some are not, and “not available” when none is (never 0 %). The stale_context omission lists each stale item, once per turn and chunk.