hindsight icon indicating copy to clipboard operation
hindsight copied to clipboard

Add opt-in evidence scope validation for knowledge pages

Open prmartinow opened this issue 1 week ago • 2 comments

Use Case

We maintain repository- and topic-specific knowledge pages in a bank that also contains unrelated evidence. In our tested Linux environment, weaker models sometimes produced off-topic content when they could retrieve unrelated material.

Problem Statement

The native tag filters already express the right boundary, but a page can lose its explicit scope through configuration. Its topic prompt guides synthesis while retrieval eligibility comes from the stored filters.

How This Feature Would Help

An administrator can require deliberate evidence boundaries for selected pages while keeping intentional bank-wide summaries available.

Proposed Solution

Add require_scoped_evidence as a per-page opt-in. Require positive, bounded evidence filters on save, enqueue, and refresh, including background runs. Reuse page_default_trigger for newly created pages and exclude_mental_models for sibling access. When a valid scope has no readable evidence, preserve the existing body using upstream's empty-scope behavior.

Priority

Important - affects my workflow

Additional Context

30 targeted tests passed, including seven trigger integration tests on a temporary local database. The generated OpenAPI schema includes the opt-in setting.

Focused patch

prmartinow avatar Nov 21 '26 10:11 prmartinow

Thanks for the detailed write-up and the patch.

We're going to pass on this one. Tag filters already set the boundary: when a page has tags, its refresh only reads memories that carry all of them (all_strict is the default when tags are present). A page with no tags reads the whole bank, and that's on purpose, for bank-wide summaries.

The new switch would only catch a page that was saved without tags. The fix for that is to set the tags, and we'd rather not add a per-page setting plus checks on save, enqueue and refresh to guard against that one mistake.

If pages losing their tags by accident keeps biting you, a warning in the control plane for pages with no tags would be a lighter fix. Happy to look at that.

nicoloboschi avatar Nov 23 '26 17:11 nicoloboschi

Thanks for the feedback, that solves the problem.

prmartinow avatar Nov 24 '26 15:11 prmartinow