generate-permission-allowlist-from-transcripts
Skill9 starsChanged 5 days agoMITView on GitHub
Analyzes session transcripts to extract frequently used read-only tool-call patterns and adds them to the project's .claude/settings.json permission allowlist to reduce permission prompts
- Commits and pushes
In this repository106 other files it gives its agents.
- artifact-design-direction-cardsSkill
- artifact-design-page-contractSkill
- artifact-diagrammingSkill
- claude-api-authentication-status-checkSkill
- claude-api-cli-installation-guidanceSkill
- claude-api-deprecated-or-retired-models-noticeSkill
- claude-api-managed-agents-onboarding-from-url-unavailableSkill
- claude-api-managed-agents-onboarding-source-tierSkill
- claude-api-sign-in-errors-guidanceSkill
- claude-api-sign-in-guidanceSkill
- claude-code-configuration-guideSkill
- claude-guide-unavailable-reference-fallbackSkill
- code-review-angle-b-removed-behavior-auditorSkill
- code-review-angle-c-cross-file-tracerSkill
- code-review-angle-d-language-pitfall-specialistSkill
- code-review-angle-e-wrapper-proxy-correctnessSkill
- code-review-conventions-dimensionSkill
- code-review-correctness-finder-anglesSkill
- code-review-efficiency-dimensionSkill
- code-review-extra-high-bugs-and-conventions-modeSkill
- code-review-finding-severity-and-summariesSkill
- code-review-high-bugs-and-conventions-modeSkill
- code-review-inline-medium-high-templateSkill
- code-review-inline-xhigh-modeSkill
- code-review-language-and-wrapper-correctness-anglesSkill
- code-review-low-effort-expanded-findings-modeSkill
- code-review-named-target-diff-instructionsSkill
- code-review-output-findings-json-arraySkill
- code-review-phase-0-gather-the-diffSkill
- code-review-phase-2-verify-3-stateSkill
- code-review-phase-2-verify-recall-biasedSkill
- code-review-phase-3-sweep-for-gapsSkill
- code-review-unavailable-target-diff-fallbackSkill
- computer-use-mcpSkill
- data-visualization-descriptionSkill
- debuggingSkill
- design-sync-artifacts-mcp-call-instructionsSkill
- design-sync-artifact-support-unavailableSkill
- design-sync-artifact-tool-call-instructionsSkill
- design-sync-design-system-move-to-claudeSkill
- doctor-prompt-audit-configuration-scopeSkill
- doctor-slash-command-descriptionSkill
- doctor-slash-commandSkill
- doctor-usage-flagged-checkSkill
- dynamic-pacing-loop-execution-re-arm-decisionSkill
- dynamic-pacing-loop-executionSkill
- explain-usage-measured-usage-slash-commandSkill
- explain-usage-slash-commandSkill
- import-to-claude-codeSkill
- init-claude-md-and-skill-setup-new-versionSkill
- insights-report-outputSkill
- loop-cloud-first-scheduling-offerSkill
- loop-external-wakeup-handoverSkill
- loop-local-runtime-noteSkill
- loop-self-pacing-mode-re-arm-decisionSkill
- loop-self-pacing-modeSkill
- loop-slash-command-dynamic-modeSkill
- mod-github-sharing-consentSkill
- mod-plugin-packaging-any-planSkill
- mod-plugin-packaging-consentSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Look through my transcripts' MCP and bash tool calls, and based on those, make a prioritized list of patterns that I should add to my …
- Distinctive: line 58
Pick the pattern form: Use the narrowest pattern that still covers the observed usage:
- Very specific: line 59
If the user runs many variants (brew list, brew list --versions): use Bash(brew list *) — note the space before *, which is required for …
- Very specific: line 60
If a single exact invocation is common: use Bash(foo) with no wildcard.
- Distinctive: line 62
Never widen a pattern to the point that it conflicts with the rules above (no arbitrary code execution, no mutation/side effects).
- Very specific: line 78
Do not add anything to permissions.deny or permissions.ask.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Fewer Permission Prompts
Look through my transcripts' MCP and bash tool calls, and based on those, make a prioritized list of patterns that I should add to my permission allowlist to reduce permission prompts. Focus on read-only commands.
The format for permissions is: Bash(foo *), Bash(foo), Bash(foo bar *), mcp__slack__slack_read_thread, etc.
Then, add these to the project .claude/settings.json under permissions.allow.
Steps
Locate transcripts. Session transcripts live at
~/.claude/projects/<sanitized-cwd>/*.jsonl. Each line is a JSON object. Tool calls appear asassistantmessages withmessage.content[]entries oftype: "tool_use". Thenamefield identifies the tool (e.g."Bash","mcp__slack__slack_read_thread"); for Bash,input.commandis the shell string.Scan the recent transcripts across the user's projects dir — not just the current project — so the allowlist reflects their actual usage. Cap the scan at a reasonable number of recent sessions (e.g. 50 most-recently-modified JSONL files) so this stays fast.
- Extract tool-call frequencies.
- For
Bashcalls: parseinput.command, take the leading command token (handlingsudo,timeout, pipes,&&, env-var prefixes). Record the command + first subcommand pair (e.g.git status,gh pr view,ls,cat). - For MCP calls: record the full tool name (e.g.
mcp__slack__slack_read_thread). - Count occurrences across the scanned transcripts.
- For
Filter to read-only. Keep only commands that don't mutate state. Examples of read-only:
ls,cat,pwd,git status,git log,git diff,git show,git branch,rg,grep,find,head,tail,wc,file,which,echo,date,gh pr view,gh pr list,gh pr diff,gh issue view,gh issue list,gh run list,gh run view,gh api(GET),bun run typecheck,bun run lint,bun run test(for tests that don't mutate),docker ps,docker logs,kubectl get,kubectl describe,ps,top,df,du,env,printenv, any MCP tool withread/get/list/search/viewin its name.Drop anything that writes, deletes, renames, pushes, merges, installs, or runs a build/test that has side effects. When in doubt, leave it out.
Never allowlist a pattern that grants arbitrary code execution. A wildcard rule for any of these (e.g.
Bash(python3:*)) is equivalent to allowing arbitrary code execution. This list is not exhaustive — apply the same rule to anything in the same category:- Interpreters:
python/python3,node,bun,deno,ruby,perl,php,lua, etc. - Shells:
bash,sh,zsh,fish,eval,exec,ssh, etc. - Package runners:
npx,bunx,uvx,uv run, etc. - Task-runner wildcards:
npm run *,yarn run *,pnpm run *,bun run *,make *,just *,cargo run *,go run *, etc. — an exactBash(bun run typecheck)is fine,Bash(bun run *)is not - Tools that start an interpreter in the working directory:
pyrightin any form (it runspython3there, which imports from that directory first), and similar gh api *,docker run/exec,kubectl exec,sudo, and similar
- Interpreters:
Drop commands Claude Code already auto-allows. These don't need an allowlist entry — they never prompt, except the git ones (see their line). If you see any of these in the transcripts, skip them; don't suggest them to the user.
- Always auto-allowed (any args):
cal,uptime,cat,head,tail,wc,stat,strings,hexdump,od,nl,id,uname,free,df,du,locale,groups,nproc,basename,dirname,realpath,cut,paste,tr,column,tac,rev,fold,expand,unexpand,fmt,comm,cmp,numfmt,readlink,diff,true,false,sleep,type,expr,seq,tsort,pr,echo,ls,cd. - Auto-allowed with zero args only:
pwd,whoami,alias. - Auto-allowed exact forms:
claude -h,claude --help,node -v,node --version,python --version,python3 --version,ip addr. - Auto-allowed with safe flags only (validated):
xargs,file,sed(read-only expressions),sort,man,help,netstat,ps,base64,grep,egrep,fgrep,sha256sum,sha1sum,md5sum,tree,date,hostname,which,lsof,pgrep,tput,ss,fd,fdfind,aki,rg,jq,uniq,history,arch,ifconfig,find(blocks-delete/-exec/-execdir/-ok/-okdir/-fprint*/-fls/-files0-from),printf(blocks any-flag),test(blocks-v/-R/-a/-o). - All git read-only subcommands (they ask in some repositories, such as one the user has not trusted; a rule would allow them in every repository, so add none):
git status,git log,git diff,git show,git blame,git branch,git tag,git remote,git ls-files,git ls-remote,git config --get,git rev-parse,git describe,git stash list,git reflog,git shortlog,git cat-file,git for-each-ref,git worktree list, etc. - All gh read-only subcommands:
gh pr view,gh pr list,gh pr diff,gh pr checks,gh pr status,gh issue view,gh issue list,gh issue status,gh run view,gh run list,gh workflow list,gh workflow view,gh repo view,gh release view,gh release list,gh api(GET),gh auth status, etc. - Docker read-only subcommands:
docker ps,docker images,docker logs,docker inspect.
Source of truth:
src/tools/BashTool/readOnlyValidation.ts(READONLY_COMMANDS,READONLY_NOARGS,READONLY_EXACT,COMMAND_ALLOWLIST) andsrc/utils/shell/readOnlyCommandValidation.ts(GIT_READ_ONLY_COMMANDS,GH_READ_ONLY_COMMANDS,DOCKER_READ_ONLY_COMMANDS,RIPGREP_READ_ONLY_COMMANDS). If the user is in this repo and you're unsure whether a command is covered, grep these files rather than guessing.- Always auto-allowed (any args):
- Pick the pattern form. Use the narrowest pattern that still covers the observed usage:
- If the user runs many variants (
brew list,brew list --versions): useBash(brew list *)— note the space before*, which is required for prefix matching to work correctly. - If a single exact invocation is common: use
Bash(foo)with no wildcard. - For MCP: use the full tool name verbatim (no wildcard needed; they're already specific).
- Never widen a pattern to the point that it conflicts with the rules above (no arbitrary code execution, no mutation/side effects).
- If the user runs many variants (
- Prioritize. Rank by count descending. Drop anything that appeared fewer than ~3 times — not worth the allowlist entry. Cap the list at the top ~20 so the user can skim it.
Present the prioritized list to the user as a markdown table with columns: rank, pattern, count, one-line description. Example:
# Pattern Count Notes 1 Bash(brew list *)142 installed packages 2 Bash(gh pr list)87 open PRs 3 mcp__slack__slack_read_thread54 Slack thread reads - Merge into
.claude/settings.jsonin the current project (not~/.claude/settings.json, not.claude/settings.local.json). Create the file if it doesn't exist. Preserve existing keys and existing entries inpermissions.allow; de-duplicate against what's already there; don't remove anything; don't reorder unrelated fields. - Report back. Tell the user what you added (count + a few examples), what was already in the allowlist, and what you skipped and why (e.g. "dropped
rmandgit push— not read-only; droppedcat/ls— already auto-allowed, no rule needed").
Do not add anything to permissions.deny or permissions.ask. Do not touch any other settings field.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

