Skip to content

docs: design record for policy depth - #45

Merged
blakebauman merged 2 commits into
mainfrom
docs/design-policy-depth
Aug 11, 2026
Merged

blakebauman merged 2 commits into
mainfrom
docs/design-policy-depth

Conversation

@blakebauman

Copy link
Copy Markdown
Member

Records the design for the roadmap's Horizon 2 policy-depth item — deny rules, argument constraints, destructive-operation gating — before any of it is built, because each part raises a question implementation would otherwise answer by accident. Same pattern as design-tenancy.md: the record is the thing to argue with, and the corrections it forces are cheaper now than in code.

No code changes.

The four decisions

1. Deny wins globally, not by document order. First-match is the smaller change and reads naturally — and it makes safety depend on where someone pasted a rule: append a broad allow at the bottom and access widens silently. That's the failure design-tenancy.md refused with "first matching tenant wins", and operators already arrive knowing deny-wins from IAM and firewalls. The cost (no stopping at the first allow) is removed for every document that exists today: the engine computes at construction whether any deny rule exists, and when none does, evaluation is the current short-circuit untouched.

2. Argument constraints weaken the invisibility pair, and the record says so. There are no arguments at list time, so they cannot filter a list — a constrained tool is visible but conditionally callable. The pair's guarantee becomes "never sees what they cannot call at all". Better written down than discovered. Denials name the constraint path but not the expected value, since that value is the operator's configuration and error messages are a poor place to leak a policy document a field at a time.

3. Destructive gating trusts the thing it gates. An upstream labelling delete_everything as readOnlyHint: true defeats it entirely. So it's documented as a hygiene control for federations you operate, not a boundary against a hostile server — where naming the tools remains the answer. A trust flag is deferred rather than rejected: shipping one would imply the untrusted case is handled.

4. Two facts from the spec and the code shaped the rest.

  • MCP defaults readOnlyHint false and destructiveHint true, so an unannotated tool is destructive and a readOnly rule denies it. That's the correct direction, and the opposite of what a "missing means harmless" implementation would do.
  • Annotations aren't available where the decision is made: at call time fold holds a name, and the list cache carrying annotations is deliberately disabled for caller-derived-credential upstreams. So unknown annotation denies, and toolKind does not compose with passthrough/token-exchange — stated plainly rather than left permissive.

Also settled

Everything stays -32042 (inventing codes per reason makes clients handle distinctions they cannot act on); parsing arguments is conditional on a rule using them, since fold forwards raw JSON today and the proxy path is allocation-gated; and four phases, each independently shippable, the way tenancy stayed reviewable.

Out of scope, explicitly: a policy expression language (that's the plugin-runtime non-goal with better marketing), regex name matching, response-shaped rules, and semantic tool selection.

🤖 Generated with Claude Code

blakebauman and others added 2 commits August 11, 2026 15:26
Records the design for the roadmap's Horizon 2 policy-depth item — deny rules,
argument constraints, destructive-operation gating — before any of it is built,
because each part raises a question that implementation would otherwise answer
by accident.

Deny wins globally rather than by document order. First-match is the smaller
change and reads naturally, and it makes safety depend on where someone pasted
a rule: append a broad allow at the bottom and access widens silently. That is
the failure design-tenancy.md refused when it declined "first matching tenant
wins", and operators already arrive knowing deny-wins from IAM and firewalls.
The cost — no stopping at the first allow — is removed for every document that
exists today: the engine computes at construction whether any deny rule exists,
and when none does, evaluation is the current short-circuit untouched.

Argument constraints cannot filter a list, because there are no arguments at
list time. A constrained tool is therefore visible but conditionally callable,
which genuinely weakens the invisibility pair's guarantee from "never sees what
they cannot call" to "never sees what they cannot call at all". Better written
down than discovered. The denial names the constraint path and not the value,
since the expected value is the operator's configuration and error messages are
a poor place to leak a policy document a field at a time. fold forwards
arguments as raw JSON today and parses nothing, so parsing is conditional on a
rule actually carrying constraints.

Destructive gating reads annotations supplied by the very upstream being gated:
a server labelling delete_everything as readOnlyHint defeats it entirely. The
record says so in those words — a hygiene control for federations you operate,
not a boundary against a hostile server, where naming the tools remains the
answer. A trust flag is deferred rather than rejected, because shipping one
would imply the untrusted case is handled.

Two facts from the code and the spec shaped the rest. MCP defaults readOnlyHint
false and destructiveHint true, so an unannotated tool is destructive and a
readOnly rule denies it — the correct direction, and the opposite of what a
"missing means harmless" implementation would do. And annotations are not
available where the decision is made: at call time fold holds a name, and the
list cache that carries annotations is deliberately disabled for upstreams with
caller-derived credentials. Unknown annotation therefore denies, and the record
states plainly that toolKind and passthrough do not compose.

No code. This is the thing to argue with first.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@blakebauman
blakebauman merged commit 11e7871 into main Aug 11, 2026
7 checks passed
@blakebauman
blakebauman deleted the docs/design-policy-depth branch August 13, 2026 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant