Permissions Manager
Table of Contents
Quick Reference
Purpose: Auto-configure Claude Code permissions via natural language
Token Budget: T1(100) + T2(2,500) + T3(1,500-3,000 per workflow)
Architecture: Progressive Disclosure (3-tier) - Load only what's needed
Intent Classification Decision Tree
Step 1: Detect Request Type
Parse user message for patterns:
CLI Tool Request - Indicators:
- Keywords: "enable", "allow", "configure" + tool name
- Tool names: git, gcloud, aws, kubectl, docker, npm, pip, maven, gradle, cargo, helm, terraform, pulumi, ansible
- Modes: "read", "write", "read-only", "commits", "pushes"
- Route to:
guides/workflows/cli-tool-workflow.md
File Pattern Request - Indicators:
- Keywords: "make editable", "edit", "write" + file type/pattern
- Patterns: "**.md", "TypeScript files", "src/", "docs folder"
- Route to:
guides/workflows/file-pattern-workflow.md
Project Type Request - Indicators:
- Keywords: "this is a [language] project", "setup", "project"
- Languages: Rust, Java, TypeScript, Python, Go, Ruby, PHP, C#, C++, Swift
- Route to:
guides/workflows/project-setup-workflow.md
Profile Request - Indicators:
- Keywords: "apply profile", "use profile" + profile name
- Profiles: read-only, development, ci-cd, production, documentation, code-review, testing
- Route to:
guides/workflows/profile-application-workflow.md
Validation/Troubleshooting - Indicators:
- Keywords: "validate", "check", "troubleshoot", "not working"
- Route to:
guides/workflows/validation-workflow.md
Backup/Restore - Indicators:
- Keywords: "backup", "restore", "rollback", "undo"
- Route to:
guides/workflows/backup-restore-workflow.md
Step 2: Load Appropriate Workflow
CRITICAL: Load ONLY the workflow guide needed. Do NOT load multiple guides.
| Request Type |
Workflow File |
Token Cost |
| CLI Tool |
guides/workflows/cli-tool-workflow.md |
+1,500 |
| File Pattern |
guides/workflows/file-pattern-workflow.md |
+1,200 |
| Project Type |
guides/workflows/project-setup-workflow.md |
+1,800 |
| Profile |
guides/workflows/profile-application-workflow.md |
+1,000 |
| Validation |
guides/workflows/validation-workflow.md |
+1,200 |
| Backup/Restore |
guides/workflows/backup-restore-workflow.md |
+750 |
| Unknown Tool |
guides/workflows/research-workflow.md |
+2,000 |
Core Detection Logic
CLI Tool Recognition
Known Tools (check against references/cli_commands.json):
- Version Control: git
- Cloud: gcloud, aws, az
- Containers: docker, kubectl, helm
- Build: npm, pip, maven, gradle, cargo, go, yarn, bundle, composer
- Infrastructure: terraform, pulumi, ansible
Mode Detection:
- Contains "read", "list", "show", "describe" -> READ mode (safer default)
- Contains "write", "push", "commit", "deploy", "publish" -> WRITE mode
- No mode -> Default to READ
Tool Lookup:
- Check if tool in
references/cli_commands.json (use grep)
- If found -> Extract commands for detected mode
- If NOT found -> Route to research workflow
Project Type Detection
Auto-Detection (via file scanning):
Cargo.toml -> Rust
pom.xml -> Java Maven
build.gradle* -> Java Gradle
package.json + tsconfig.json -> TypeScript
package.json (alone) -> JavaScript
pyproject.toml | setup.py -> Python
go.mod -> Go
Gemfile -> Ruby
composer.json -> PHP
*.csproj | *.sln -> C#
CMakeLists.txt -> C++
Package.swift -> Swift
Detection Method: Run scripts/detect_project.py or scan for indicator files
Profile Recognition
Available Profiles (from assets/permission_profiles.json):
read-only - Code review, security audit
development - Active development (most common)
ci-cd - Continuous integration
production - Monitoring only
documentation - Docs writing
code-review - PR review
testing - TDD workflow
Resource Loading Policy - CRITICAL
NEVER load resources proactively or "just in case"
Loading Workflow Guides
DO: Load specific workflow when decision tree routes to it
Read guides/workflows/{workflow-name}.md
DON'T: Load all guides upfront or multiple guides
Loading Reference Data - Surgical Only
CLI Commands (one tool only):
grep -A 25 '"git"' references/cli_commands.json
# Token cost: ~150 tokens (vs 2,650 for full file)
Project Templates (one language only):
jq '.rust' references/project_templates.json
# Token cost: ~200 tokens (vs 1,955 for full file)
Security Patterns (one level only):
jq '.recommended_deny_set.standard' references/security_patterns.json
# Token cost: ~100 tokens (vs 805 for full file)
Permission Profiles (one profile only):
jq '.development' assets/permission_profiles.json
# Token cost: ~200 tokens (vs 1,240 for full file)
Executing Scripts
ONLY execute when workflow instructs:
- detect_project.py - When project type ambiguous or need recommendations
- apply_permissions.py - When all rules gathered, handles backup/validation/writing
- validate_config.py - When user requests validation or troubleshooting
Safety Rules - Always Apply
Every permission operation MUST:
- Load security patterns:
jq '.recommended_deny_set.standard' references/security_patterns.json
- Apply minimum deny rules: See
references/security_patterns.json#recommended_deny_set.standard for full list (14 rules)
- Create backup before any settings write (automatic via
scripts/apply_permissions.py)
- Validate syntax before applying (automatic via
scripts/apply_permissions.py)
Token Budget Management
Budget Tiers:
- Simple request (CLI tool): <5,000 tokens
- Medium request (project setup): <7,000 tokens
- Complex request (unknown tool): <10,000 tokens
- Warning threshold: >10,000 tokens
Cost Optimization:
- Use grep/jq for references (90% token savings)
- Load only needed workflow guide
- Execute scripts instead of explaining them
- Avoid loading examples unless requested
See references/token_tracking_template.md for tracking template.
Error Handling
If workflow guide not found:
- Proceed with best-effort inline logic
- Inform user of missing guide
- Suggest filing an issue
If reference file not found:
- Attempt operation without reference
- For unknown tools -> use web search
- Warn user about limited functionality
If script execution fails:
- Show error message to user
- Suggest manual permission editing
- Provide settings file location
If validation fails:
- Report specific errors
- Suggest fixes
- Offer to restore from backup
Skill Integration Points
Other Skills (invoke when appropriate):
- gemini skill: If user mentions "gemini CLI" and skill available
MCP Tools (priority order for research):
mcp__perplexity-ask__perplexity_ask (preferred)
mcp__brave-search__brave_web_search (fallback)
WebSearch (final fallback)
Success Criteria Checklist
Permission operation complete when:
- Backup created (timestamped)
- Permissions validated (syntax + conflicts)
- Safety rules applied (deny patterns)
- Settings written successfully
- User informed of changes
- Restart reminder provided
Quick Start Examples
| Request |
Route |
| Enable git (read-only) |
cli-tool-workflow.md |
| Make markdown editable |
file-pattern-workflow.md |
| Setup TypeScript project |
project-setup-workflow.md |
| Apply development profile |
profile-application-workflow.md |
See guides/workflows/ for complete workflow documentation.
Workflow Pattern
Every request follows this pattern:
- Classify intent using decision tree
- Route to workflow based on detection
- Load workflow guide from guides/workflows/
- Follow workflow step-by-step
- Load references surgically as needed
- Execute scripts when required
- Track token budget throughout
- Complete operation per success criteria
- Inform user of changes
Remember: Load only needed workflow, use grep/jq for references, execute scripts for heavy lifting, apply safety rules always.
End of Tier 2 (SKILL.md)
1---2name: permissions-manager3description: Configures Claude Code permissions via natural language for CLI tools (git, gcloud, aws, kubectl, maven, gradle, npm, docker), project types (Rust, Java, TypeScript, Python), and file patterns. Use when asked to "configure permissions", "enable git", "allow docker", "setup project permissions", "apply permission profile", or "make files editable". Auto-detects project types and researches unknown tools.4---5
6# Permissions Manager
7
8## Table of Contents
9
10- [Quick Reference](#quick-reference)
11- [Intent Classification Decision Tree](#intent-classification-decision-tree)
12- [Core Detection Logic](#core-detection-logic)
13- [Resource Loading Policy](#resource-loading-policy---critical)
14- [Safety Rules](#safety-rules---always-apply)
15- [Token Budget Management](#token-budget-management)
16- [Error Handling](#error-handling)
17- [Skill Integration Points](#skill-integration-points)
18- [Success Criteria Checklist](#success-criteria-checklist)
19- [Quick Start Examples](#quick-start-examples)
20
21---
22
23## Quick Reference
24
25**Purpose**: Auto-configure Claude Code permissions via natural language
26**Token Budget**: T1(100) + T2(2,500) + T3(1,500-3,000 per workflow)
27**Architecture**: Progressive Disclosure (3-tier) - Load only what's needed
28
29---
30
31## Intent Classification Decision Tree
32
33### Step 1: Detect Request Type
34
35Parse user message for patterns:
36
37**CLI Tool Request** - Indicators:
38- Keywords: "enable", "allow", "configure" + tool name
39- Tool names: git, gcloud, aws, kubectl, docker, npm, pip, maven, gradle, cargo, helm, terraform, pulumi, ansible
40- Modes: "read", "write", "read-only", "commits", "pushes"
41- **Route to**: `guides/workflows/cli-tool-workflow.md`
42
43**File Pattern Request** - Indicators:
44- Keywords: "make editable", "edit", "write" + file type/pattern
45- Patterns: "**.md", "TypeScript files", "src/", "docs folder"
46- **Route to**: `guides/workflows/file-pattern-workflow.md`
47
48**Project Type Request** - Indicators:
49- Keywords: "this is a [language] project", "setup", "project"
50- Languages: Rust, Java, TypeScript, Python, Go, Ruby, PHP, C#, C++, Swift
51- **Route to**: `guides/workflows/project-setup-workflow.md`
52
53**Profile Request** - Indicators:
54- Keywords: "apply profile", "use profile" + profile name
55- Profiles: read-only, development, ci-cd, production, documentation, code-review, testing
56- **Route to**: `guides/workflows/profile-application-workflow.md`
57
58**Validation/Troubleshooting** - Indicators:
59- Keywords: "validate", "check", "troubleshoot", "not working"
60- **Route to**: `guides/workflows/validation-workflow.md`
61
62**Backup/Restore** - Indicators:
63- Keywords: "backup", "restore", "rollback", "undo"
64- **Route to**: `guides/workflows/backup-restore-workflow.md`
65
66### Step 2: Load Appropriate Workflow
67
68**CRITICAL**: Load ONLY the workflow guide needed. Do NOT load multiple guides.
69
70| Request Type | Workflow File | Token Cost |
71|-------------|---------------|------------|
72| CLI Tool | `guides/workflows/cli-tool-workflow.md` | +1,500 |
73| File Pattern | `guides/workflows/file-pattern-workflow.md` | +1,200 |
74| Project Type | `guides/workflows/project-setup-workflow.md` | +1,800 |
75| Profile | `guides/workflows/profile-application-workflow.md` | +1,000 |
76| Validation | `guides/workflows/validation-workflow.md` | +1,200 |
77| Backup/Restore | `guides/workflows/backup-restore-workflow.md` | +750 |
78| Unknown Tool | `guides/workflows/research-workflow.md` | +2,000 |
79
80---
81
82## Core Detection Logic
83
84### CLI Tool Recognition
85
86**Known Tools** (check against `references/cli_commands.json`):
87- Version Control: git
88- Cloud: gcloud, aws, az
89- Containers: docker, kubectl, helm
90- Build: npm, pip, maven, gradle, cargo, go, yarn, bundle, composer
91- Infrastructure: terraform, pulumi, ansible
92
93**Mode Detection**:
94- Contains "read", "list", "show", "describe" -> READ mode (safer default)
95- Contains "write", "push", "commit", "deploy", "publish" -> WRITE mode
96- No mode -> Default to READ
97
98**Tool Lookup**:
991. Check if tool in `references/cli_commands.json` (use grep)
1002. If found -> Extract commands for detected mode
1013. If NOT found -> Route to research workflow
102
103### Project Type Detection
104
105**Auto-Detection** (via file scanning):
106```
107Cargo.toml -> Rust
108pom.xml -> Java Maven
109build.gradle* -> Java Gradle
110package.json + tsconfig.json -> TypeScript
111package.json (alone) -> JavaScript
112pyproject.toml | setup.py -> Python
113go.mod -> Go
114Gemfile -> Ruby
115composer.json -> PHP
116*.csproj | *.sln -> C#
117CMakeLists.txt -> C++
118Package.swift -> Swift
119```
120
121**Detection Method**: Run `scripts/detect_project.py` or scan for indicator files
122
123### Profile Recognition
124
125**Available Profiles** (from `assets/permission_profiles.json`):
126- `read-only` - Code review, security audit
127- `development` - Active development (most common)
128- `ci-cd` - Continuous integration
129- `production` - Monitoring only
130- `documentation` - Docs writing
131- `code-review` - PR review
132- `testing` - TDD workflow
133
134---
135
136## Resource Loading Policy - CRITICAL
137
138**NEVER load resources proactively or "just in case"**
139
140### Loading Workflow Guides
141
142**DO**: Load specific workflow when decision tree routes to it
143```bash
144Read guides/workflows/{workflow-name}.md
145```
146
147**DON'T**: Load all guides upfront or multiple guides
148
149### Loading Reference Data - Surgical Only
150
151**CLI Commands** (one tool only):
152```bash
153grep -A 25 '"git"' references/cli_commands.json
154# Token cost: ~150 tokens (vs 2,650 for full file)
155```
156
157**Project Templates** (one language only):
158```bash
159jq '.rust' references/project_templates.json
160# Token cost: ~200 tokens (vs 1,955 for full file)
161```
162
163**Security Patterns** (one level only):
164```bash
165jq '.recommended_deny_set.standard' references/security_patterns.json
166# Token cost: ~100 tokens (vs 805 for full file)
167```
168
169**Permission Profiles** (one profile only):
170```bash
171jq '.development' assets/permission_profiles.json
172# Token cost: ~200 tokens (vs 1,240 for full file)
173```
174
175### Executing Scripts
176
177**ONLY execute when workflow instructs**:
178
179- **detect_project.py** - When project type ambiguous or need recommendations
180- **apply_permissions.py** - When all rules gathered, handles backup/validation/writing
181- **validate_config.py** - When user requests validation or troubleshooting
182
183---
184
185## Safety Rules - Always Apply
186
187Every permission operation MUST:
188
1891. **Load security patterns**: `jq '.recommended_deny_set.standard' references/security_patterns.json`
1902. **Apply minimum deny rules**: See `references/security_patterns.json#recommended_deny_set.standard` for full list (14 rules)
1913. **Create backup** before any settings write (automatic via `scripts/apply_permissions.py`)
1924. **Validate syntax** before applying (automatic via `scripts/apply_permissions.py`)
193
194---
195
196## Token Budget Management
197
198**Budget Tiers**:
199- Simple request (CLI tool): <5,000 tokens
200- Medium request (project setup): <7,000 tokens
201- Complex request (unknown tool): <10,000 tokens
202- Warning threshold: >10,000 tokens
203
204**Cost Optimization**:
205- Use grep/jq for references (90% token savings)
206- Load only needed workflow guide
207- Execute scripts instead of explaining them
208- Avoid loading examples unless requested
209
210See `references/token_tracking_template.md` for tracking template.
211
212---
213
214## Error Handling
215
216**If workflow guide not found**:
217- Proceed with best-effort inline logic
218- Inform user of missing guide
219- Suggest filing an issue
220
221**If reference file not found**:
222- Attempt operation without reference
223- For unknown tools -> use web search
224- Warn user about limited functionality
225
226**If script execution fails**:
227- Show error message to user
228- Suggest manual permission editing
229- Provide settings file location
230
231**If validation fails**:
232- Report specific errors
233- Suggest fixes
234- Offer to restore from backup
235
236---
237
238## Skill Integration Points
239
240**Other Skills** (invoke when appropriate):
241- **gemini skill**: If user mentions "gemini CLI" and skill available
242
243**MCP Tools** (priority order for research):
2441. `mcp__perplexity-ask__perplexity_ask` (preferred)
2452. `mcp__brave-search__brave_web_search` (fallback)
2463. `WebSearch` (final fallback)
247
248---
249
250## Success Criteria Checklist
251
252Permission operation complete when:
253- Backup created (timestamped)
254- Permissions validated (syntax + conflicts)
255- Safety rules applied (deny patterns)
256- Settings written successfully
257- User informed of changes
258- Restart reminder provided
259
260---
261
262## Quick Start Examples
263
264| Request | Route |
265|---------|-------|
266| Enable git (read-only) | `cli-tool-workflow.md` |
267| Make markdown editable | `file-pattern-workflow.md` |
268| Setup TypeScript project | `project-setup-workflow.md` |
269| Apply development profile | `profile-application-workflow.md` |
270
271See `guides/workflows/` for complete workflow documentation.
272
273---
274
275## Workflow Pattern
276
277Every request follows this pattern:
278
2791. **Classify intent** using decision tree
2802. **Route to workflow** based on detection
2813. **Load workflow guide** from guides/workflows/
2824. **Follow workflow** step-by-step
2835. **Load references** surgically as needed
2846. **Execute scripts** when required
2857. **Track token budget** throughout
2868. **Complete operation** per success criteria
2879. **Inform user** of changes
288
289**Remember**: Load only needed workflow, use grep/jq for references, execute scripts for heavy lifting, apply safety rules always.
290
291---
292
293**End of Tier 2 (SKILL.md)**