feat: content provenance tagging — trust-level metadata (Closes #1799) - #1833
Merged
Conversation
…ontent #1799 — Slice 2 of Task Shield (parent #1659). Implements content provenance tagging: every piece of external content entering the conversation context carries a trust-level metadata tag. Three trust levels (highest to lowest): - USER: user's own messages - TOOL_INVOKED: results from tools the user explicitly invoked - EXTERNAL: search results, web pages, email bodies, MCP responses External content is wrapped in <untrusted-content> delimiters when rendered so the LLM and downstream safety filters can distinguish trust boundaries. Components: - ProvenanceTag: immutable metadata (trust_level, source, url, fetched_at) - resolve_trust_level(): maps source strings to trust levels - tag_content() / TaggedContent.render(): tag and render content - wrap_external(): one-shot convenience for external content - TaggingRegistry: turn-level accumulator for auditing content entry points Standalone module — integration with the Task Shield pre-execution validator (#1798) happens when Slice 1 merges. Closes #1799 Co-Authored-By: Hermes Evolution <evolution@hermes.ai>
4 tasks
Contributor
૮ >ﻌ< ა ci reviewran on 225039f all good! |
This was referenced Aug 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Slice 2 of Task Shield (#1659). Implements content provenance tagging: every piece of external content entering the conversation context carries a trust-level metadata tag.
Trust Levels (highest → lowest)
usertool-invokedexternal<untrusted-content>Components
Tests
20 tests covering: trust level resolution (user/tool/external/empty), tag rendering (external wraps, user/tool don't, URL inclusion), wrap_external, ProvenanceTag (rank ordering, frozen), TaggingRegistry (add, external_sources, has_external, min_trust_level, clear).
Line count
325 lines total (178 module + 147 tests) — exceeds 200-line self-merge cap. Needs human review.
Integration
Standalone module. Full integration with Task Shield pre-execution validator (#1798) happens when Slice 1 merges. Content entry points (web_search, web_extract, mcp_tool) can import and use
tag_content()/wrap_external()immediately.Closes #1799
Co-Authored-By: Hermes Evolution evolution@hermes.ai