fix: make sample/template MCP scanning opt-in so it stops reading as drift#50
Merged
Conversation
…drift
A `.mcp.json.template` / `.sample` / `.disabled` / example config never loads
into an agent runtime — only the live `.mcp.json` (and the editor configs) do.
A change to one therefore cannot alter what an agent is allowed to do, so
surfacing it in a *drift* report is noise, not drift.
Gate the sample/template detector behind an explicit opt-in rather than
removing it, so teams who want copy-paste hygiene on shipped examples can still
ask for it:
- detectMcpDrift takes { includeSamples } (default false); the sample-scan loop
is extracted into detectMcpSampleDrift and only runs when opted in.
- git-snapshot skips the full `git ls-tree -r` sample-discovery walk unless
includeSamples is set — the detector would ignore the files anyway.
- CLI: new `--include-samples` flag, off by default, documented in --help.
- Action: new `include-samples` input (default 'false').
- Benchmark passes --include-samples so the labeled mcp-sample fixtures stay
exercised; RESULTS.md is unchanged.
- Docs (README / TRUST / PILOT) reframed: sample review is opt-in, and why.
- Tests: default run yields no sample findings (CLI + detector level); the
existing sample tests now opt in explicitly.
Follow-up to #49.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Why
Post-merge feedback on #49 (the permission-drift blind-spot work):
ScopeTrail is a drift detector — it reports changes to what an agent can actually do. A
.mcp.json.template/.sample/.disabled/ example config never loads into any agent runtime, so a change to one cannot alter an agent's capabilities. Reporting it as drift is noise — even at the low severity these already carried.What
Rather than delete the sample/template scanner (it's a useful copy-paste-hygiene check for teams that ship example configs), gate it behind an explicit opt-in. Default reports no longer surface sample/template configs at all.
detectMcpDrift(old, new, { includeSamples })— defaultfalse. The sample loop is extracted intodetectMcpSampleDriftand only runs when opted in.materializeGitSnapshot(..., { includeSamples })— skips the fullgit ls-tree -rsample-discovery walk unless opted in (the detector would ignore the files anyway; also saves a tree walk on every PR).--include-samplesflag (off by default), shown in--help.include-samplesinput (default: 'false').--include-samplesso the labeledmcp-samplefixtures stay exercised —RESULTS.mdis byte-identical (100% detection / 85.2% at thehighgate, unchanged).Tests
--include-samplesre-enables them.RESULTS.mdunchanged.Follow-up to #49.
🤖 Generated with Claude Code