Skip to content
Back to skills

Cached Tool Permission Grants

ASecurity

Reuse session-scoped tool approvals where the host supports them, preserving the user's approved scope and existing permission boundaries.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 22, 2026
ai-agentspythongoshellgitapidatabasesecurity

Works with

  • claude code
  • cursor
  • cli
  • api
  • mcp

Security analysis

A93/100
  • highPerforms destructive filesystem operations

Pro shows the line behind each finding and how to fix it

Scanned October 22, 2026

npx -y skills add alivirgo/Major-AI-Skills --skill cached-tool-permission-grants --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cached Tool Permission Grants?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Cached Tool Permission Grants
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/alivirgo-cached-tool-permission-grants/badge)](https://www.skillsdirectory.com/skills/alivirgo-cached-tool-permission-grants)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: cached-tool-permission-grants
description: "Reuse session-scoped tool approvals where the host supports them, preserving the user's approved scope and existing permission boundaries."
category: efficiency
risk: safe
source: self
source_type: self
date_added: "2026-08-26"
tags: ["permissions", "tool-grants", "auto-approval", "agent-autonomy", "mcp", "session-caching"]
tools: ["claude", "cursor", "gemini", "codex", "lmstudio"]
---

# Session-Scoped Tool Permission Caching (Autonomous Execution Flow)

## Overview
In autonomous agent environments (Antigravity IDE, Claude Code, Cursor, MCP Servers), asking the user for interactive permission on every basic action (*"Allow agent to read `src/utils.ts`?", "Allow agent to run `git status`?"*) causes catastrophic workflow degradation.

Per-action confirmation prompts cause:
1. **Long Idle Stalls**: The agent freezes mid-task for 30 minutes while waiting for the human to click "Approve".
2. **Permission Retry Loops**: Models get confused when a command is rejected or timed out, generating apologetic retry loops that burn tokens.
3. **Context Transcript Pollution**: Permission metadata and grant/deny logs inflate the conversation context.

The **Session-Scoped Permission Caching Protocol** establishes a **3-Tier Risk Hierarchy** and persists granted permissions across the entire workspace session.

---

## Interactive Per-Action Approval vs. Session-Scoped Caching

```
┌─────────────────────────────────────────────────────────────┐
│                 Permission Flow Comparison                  │
│                                                             │
│  Per-Action Interactive Prompting (Anti-Pattern):           │
│  • Agent calls `view_file` ──► Modal popup ──► Waits 5 mins │
│  • Agent calls `grep_search` ──► Modal popup ──► Waits 2 mins│
│  • Agent calls `replace_file` ──► Modal popup ──► Waits 10 m│
│  ↳ Total Task Time: 45 Minutes (Human bottleneck)           │
│                                                             │
│  Session-Scoped Permission Caching:                         │
│  • Turn 1: User approves workspace session scope            │
│  • Turns 2..50: Auto-approved execution within workspace    │
│  ↳ Total Task Time: 40 Seconds (Zero Human Bottleneck)      │
└─────────────────────────────────────────────────────────────┘
```

---

## The 3-Tier Risk Hierarchy

```
┌───────────────────────────────────────────────────────────────────────────┐
│ TIER 1: ZERO-RISK READ (Auto-Approved / Zero Prompts)                     │
│ • `view_file`, `list_dir`, `grep_search`, `read_url_content`              │
│ • Read-only shell: `git status`, `git log`, `ls`, `pytest`                │
│                                                                           │
│ TIER 2: WORKSPACE MUTATIONS (Session-Approved on 1st Confirmation)        │
│ • `replace_file_content`, `write_to_file` within project root             │
│ • Safe builds: `npm run build`, `tsc --noEmit`, `cargo check`             │
│                                                                           │
│ TIER 3: HIGH-RISK / DESTRUCTIVE (Always Prompt User)                      │
│ • `rm -rf`, `git reset --hard`, production database migrations, API keys  │
└───────────────────────────────────────────────────────────────────────────┘
```

---

## Configuration & Policy Settings

### 1. Antigravity IDE / Claude Code Auto-Approval Settings
In your agent settings (`settings.json` or `.gemini/config`):

```json
{
  "agent.security.permission_policy": "session_cached",
  "agent.security.auto_approve_tools": [
    "view_file",
    "list_dir",
    "grep_search",
    "replace_file_content",
    "write_to_file",
    "read_url_content"
  ],
  "agent.security.allowed_command_prefixes": [
    "git ",
    "npm test",
    "npm run ",
    "python -m pytest",
    "cargo "
  ],
  "agent.security.blocked_command_patterns": [
    "rm -rf /",
    "git push --force",
    "drop database"
  ]
}
```

---

### 2. MCP Server Permission Caching (`mcp_config.json`)
```json
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "./"],
      "autoApprove": ["read_file", "list_directory", "get_file_info"]
    }
  }
}
```

---

## Benchmark Comparison

Executing an end-to-end bug fix across 4 files (Find bug $\rightarrow$ Read 3 files $\rightarrow$ Edit 2 files $\rightarrow$ Run test suite):

| Metric | Per-Action Confirmation | Session-Scoped Caching | Improvement |
| :--- | :--- | :--- | :--- |
| **Interactive Prompts Shown** | 9 confirmation popups | **1 initial grant** | **88.8% Fewer Prompts** |
| **Human Wait / Idle Time** | 12.5 minutes | **0 seconds** | **Instant Velocity** |
| **Execution Context Tokens** | 4,200 tokens (with logs) | 680 tokens | **83.8% Token Savings** |
| **Autonomous Success Rate** | 60% (Aborted by timeout) | **100%** | **Full Autonomy** |

---

## Agent Operational Directive
> **MANDATORY**: Autonomous agents must request broad session-level approval at task initialization (*"I will read relevant files and run tests to fix this issue"*). Never block on individual read-only inspections or low-risk workspace edits once session scope is approved.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.