C.W.K.
Stream
Lesson 10 of 10 · published

Citations and Traceability in Output

~12 min · outputs, citations, traceability

Level 0Apprentice
0 XP0/100 lessons0/14 achievements
0/120 XP to next level120 XP to go0% complete

Make the output auditable

For high-stakes outputs (compliance, finance, support, decisions affecting users), it should be possible after the fact to trace every claim in the response back to a source: a chunk, a tool result, a step in the reasoning trace. Without that trace, you cannot debug a wrong answer or defend a right one.

Three levels of traceability

  • Provenance fields — every output object includes sources (chunk ids, tool call ids).
  • Native citations — Anthropic's Citations feature returns spans-of-output → spans-of-input.
  • Trace logs — full request, prompt version, model version, retrieved chunks, tool calls, response. Persisted with the response id.

Why this is a prompt design concern

You can't bolt traceability on. The prompt has to require sources in the output schema, the chunks have to have stable ids, the tools have to log structured arguments and results. Build it in early; it's expensive to retrofit.

Code

Schema with provenance·json
{
  "answer": "...",
  "sources": [
    {"type": "chunk", "id": "manual:section-3.4", "score": 0.91},
    {"type": "tool", "id": "call_xyz", "name": "search_orders"}
  ],
  "prompt_version": "support@7",
  "model": "claude-opus-4-7",
  "created_at": "2026-05-04T12:34:56Z"
}

External links

Exercise

On one prompt, add a sources field to the output schema. For RAG sources, populate from chunk ids. For tool outputs, populate from tool call ids. Verify a wrong answer is now traceable.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.