Per-Game Source Ledger

Automatically retain hard sources and raw tool artifacts with provenance

Current gap

SourceCorpus already versions game-scoped documents with SQLite FTS5, but run completion saves the assistant answer as the content for every citation. That is not the fetched source. Tool output must be captured at dispatch/event time, not reconstructed from citations.

Critical integration decision: add a Hermes-side redacted tool-result capture hook/plugin and structured capture envelope. Do not make the Nagato bridge bypass Hermes and call GTC directly. The current Runs API does not expose arguments or raw results, so this upstream seam is the first implementation prerequisite.

Capture pipeline

tool.startedarguments + call IDraw result blobsource extractioncanonical document versionchunks/indexesanswer citations

Coverage

Tool familySaveNormalize
GTC search/answerRaw result JSON, query, ranked URLs/snippetsOne discovery artifact plus source stubs
GTC scrape/extract/llmstxtComplete returned text/markdown and metadataCanonical URL document version
GTC crawl/map/agentManifest and each page payloadParent job + child documents
HTTP/curl-like toolsURL, status, safe headers, content body/hashTyped source when content is textual
Local filesPath alias, file hash, extracted textManual/PDF/install document

Data model

source_artifacts(id, game_id, run_id, tool_call_id, source_uri,
  source_kind, title, fetched_at, status, content_type, raw_blob_id,
  content_hash, parent_id, license_hint, trust, metadata_json)
document_versions(id, artifact_id, canonical_uri, normalized_text,
  extractor, extractor_version, language, created_at)
source_chunks(id, version_id, ordinal, heading_path, text, token_count)
run_source_links(run_id, artifact_id, use=cited|consulted|discovered)

Policy

Also update packages/protocol/game-command.schema.json: the bridge already implements corpus_save/corpus_search, but the shared command schema does not currently declare them.

UI

Add a Sources view under Research or as a card drill-down: source title/type/trust/date/size/version count, open original, raw artifact, extracted text, chunks, citing runs, refresh and delete. A response’s citations should link to the exact stored version used.

Acceptance