lauren-framework/lauren-ai/agent-permission-scoping
Claude Code and agent skill by lauren-framework/lauren-ai
- community
Checking that the SKILL.md file is still in the repository.
Scope tool execution behind permission levels (read_only, mutate, admin). Use when different users or agent roles should have different tool access rights, injecting the permission level via ToolContext metadata and declaring requirements via @set_metadata.
Install
npx vskill@latest install lauren-framework/lauren-ai/agent-permission-scopingSKILL.md
The same SKILL.md was published earlier as lauren-framework/lauren-ai/agent-permission-scoping.
Usecodemap find "ToolContext"to check the metadata injection API.
Agent Permission Scoping
Define an ordered Permission enum and check permissions inline in the tool's run() method. Declare the minimum permission level with @set_metadata for introspection and documentation. Inject the caller's permission via runner.run(metadata={"caller_permission": ...}).
Permission model
Protected tool
Apply @set_metadata first (outermost), then @tool(). The @set_metadata decorator stores the declared minimum permission on the tool class for documentation and introspection. Permission enforcement happens in run().
Injecting permission at call time
Pass the permission level as metadata when invoking the runner or TestClient:
ToolContext.get_metadata("caller_permission") checks tool-level static metadata first, then delegates to AgentContext.get_metadata, which reads from the metadata dict supplied to runner.run.
AgentRunner test pattern
Reading declared minimum permission in the tool
ctx.get_metadata checks tool-level static metadata (TOOL_METADATA attribute) first, then agent-level runtime metadata (AgentContext.metadata).
Notes
- Permission strings are passed as plain values in
metadata. @set_metadatais read-only at call time — it's for declaration and
introspection, not enforcement. Always enforce in run().
- Decorator ordering matters:
@set_metadatamust be outermost (applied last),
@tool() must be innermost (applied first) so that @tool() inspects the original run() signature with ctx: ToolContext.
- For request-level permission injection in a Lauren web app, extract the
permission from request.state in the controller and forward it as metadata={"caller_permission": user.role}.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/agent-permission-scoping/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/lauren-framework/lauren-ai/agent-permission-scoping)