Repository navigation
Closed
Labels
afkImplement + merge unattendedImplement + merge unattended
Description
Important
Decision Surface
Problem: No runtime logic exists to resolve a model's effective permissions from its trust tier assignment.
Approach: Implement resolveProviderPermission(modelId, action, resource) — looks up model → tier → directory rules → effect. Most-specific glob wins. O(1) tier lookup via pre-built map.
Scope: Resolution engine only. Does not wire into the permission system (that is slice #4).
Acceptance Criteria
-
resolveProviderPermission(modelId, action, resource)returns the correctEffectfor any model/action/resource combination - Unassigned models (not in
assignments) resolve against thedefaultTier - Most-specific glob wins:
~/secrets/**takes priority over**for paths under~/secrets/ - Action mapping is correct:
readaction resolves against thereadgroup,glob/grepalso resolve againstread;write/editagainstwrite;bashagainstexecute;webfetch/websearchagainstnetwork - Tier lookup is O(1) — uses a pre-built
Map<tierId, TrustTier>not a list scan - Returns
undefinedwhen no rule matches (signals fallthrough to existing permission system)
Key Decisions
| # | Decision | Rationale |
|---|---|---|
| 1 | Pre-build a Map<tierId, TrustTier> at config parse time |
O(1) lookup per tool call |
| 2 | Return undefined for no-match (not "ask") |
Lets the enforcement hook distinguish "no opinion" from "explicitly ask" |
| 3 | Glob specificity by pattern length (longest match wins) | Simple, predictable, matches user mental model |
Testing Decisions
- Test model in "trusted" tier gets "allow" for all actions
- Test model in "limited" tier gets "allow" for read, "deny" for write/execute/network
- Test unassigned model falls through to default tier
- Test most-specific-glob precedence (specific dir rule overrides wildcard)
- Test action-to-group mapping (grep → read, edit → write, bash → execute, webfetch → network)
- Test returns undefined when tier has no matching directory rule
Constraints & Invariants
- Pure function with no side effects — stateless resolution from config
- Must handle the case where a model's assigned tier ID no longer exists in config (treat as unassigned)
Source
Metadata
Metadata
Assignees
Labels
afkImplement + merge unattendedImplement + merge unattended
Activity