Skip to content

Contracts C1–C7

The ctxflow semantic conventions group their ctxflow.* attributes into seven contracts. Each contract is a promise between the code that emits spans (your app, the SDK, the collector) and the core that reads them. The attribute tables of each contract are in Semantic conventions, generated from the registry.

Contract In plain words Key attributes
C1 Source identity Which document a chunk comes from, which version of it, and the hash of the original. Travels in chunk metadata and on ingest.* spans. ctxflow.source_id, ctxflow.source_version, ctxflow.source_hash, ctxflow.chunks.ids, ctxflow.chunks.text_hashes
C2 Chunk id mode How chunk ids are made: by the library (default) or deterministic from the source coordinates (deterministic), so re-ingesting the same version keeps the ids. ctxflow.id_mode
C3 Correlation What ties spans of one conversation, turn, user and tool call together, across processes (agent, MCP server). session.id, gen_ai.conversation.id, user.id, ctxflow.turn, tool.name, ctxflow.tool.status
C4 Index validity What a retrieval returned, measured on the retrieval span: the id and the text hash of each item. ctxflow joins them with the chunks your ingestion wrote to say whether a chunk was in the index at that time. ctxflow.retrieval.item_ids, ctxflow.retrieval.item_hashes, ctxflow.retrieval.item_verifiable, ctxflow.retrieval.tool
C5 Context usage (deprecated) The ctxflow.usage span with the score of each retrieved item. No current SDK or collector produces it, and the core accepts it and ignores it. What replaces it is the count of chunks delivered, which needs no contract: it is read from the retrieval spans (C4). ctxflow.usage.* (deprecated)
C6 Source state Whether the source of a retrieved chunk was still the published version when it was retrieved: current, stale, unknown or ambiguous. ctxflow.source_hash and ctxflow.source_version on both sides
C7 Data reads SQL and API reads of an agent, one span per read, with record ids and versions, never rows. Defined in the conventions; this version of the core does not build views from it. ctxflow.data.kind, ctxflow.data.record_ids, ctxflow.data.query_hash, ctxflow.data.result_hash

Conventions ctxflow reads, not only its own

Section titled “Conventions ctxflow reads, not only its own”

ctxflow reads the standard conventions of other projects, so you do not have to rewrite your instrumentation:

  • OpenInference (Arize): openinference.span.kind, retrieval.documents.N.document.*, input.value, output.value, llm.*.
  • OTel GenAI: gen_ai.operation.name, gen_ai.usage.*, gen_ai.retrieval.documents, gen_ai.tool.*.
  • OpenLLMetry (Traceloop): model outputs and vector database reads.

For each of them, ctxflow keeps a map of the keys that carry content (prompts, answers, documents, tool arguments and results). ctxflow uses these maps to know which attributes hold text. See Content keys.