From a58af1af8589eb79c6d264b108b91163239f66c2 Mon Sep 17 00:00:00 2001 From: cybermaggedon Date: Mon, 23 Mar 2026 16:20:47 +0000 Subject: [PATCH] Add chunk content ID to explain trace provenance output (#707) When --show-provenance is used with tg-show-explain-trace, display the chunk URI on a Content: line below each Source: chain. This allows the user to easily fetch the source text with tg-get-document-content. --- trustgraph-cli/trustgraph/cli/show_explain_trace.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/trustgraph-cli/trustgraph/cli/show_explain_trace.py b/trustgraph-cli/trustgraph/cli/show_explain_trace.py index ba4f9c25..a38476cb 100644 --- a/trustgraph-cli/trustgraph/cli/show_explain_trace.py +++ b/trustgraph-cli/trustgraph/cli/show_explain_trace.py @@ -214,6 +214,12 @@ def print_graphrag_text(trace, explain_client, flow, user, collection, api=None, chain_str = format_provenance_chain(chain) if chain_str: print(f" Source: {chain_str}") + # Show content ID for the chunk (second item in chain) + for item in chain: + uri = item.get("uri", "") + if uri.startswith("urn:chunk:"): + print(f" Content: {uri}") + break print() else: