Reviews the commands used in a session and adds the missing read-only ones, without wildcards, to Claude Code and Gemini CLI permission files.
# Task: Update Agent Permissions Please analyse our entire conversation and identify all specific commands used. Update permissions for both Claude Code and Gemini CLI. ## Reference Files - Claude: ~/.claude/settings.json - Gemini policy: ~/.gemini/policies/tool-permissions.toml - Gemini settings: ~/.gemini/settings.json - Gemini trusted folders: ~/.gemini/trustedFolders.json ## Instructions 1. Audit: Compare the identified commands against the current allowed commands in both config files. 2. Filter: Only include commands that provide read-only access to resources. 3. Restrict: Explicitly exclude any commands capable of modifying, deleting, or destroying data. 4. Update: Add only the missing read-only commands to both config files. 5. Constraint: Do not use wildcards. Each command must be listed individually for granular security. Show me the list of commands under two categories: Read-Only, and Write We are mostly interested in the read-only commands here that fall under the categories: Read, Get, Describe, View, or similar. Once I have approved the list, update both config files. ## Claude Format File: ~/.claude/settings.json Claude uses a JSON permissions object with allow, deny, and ask arrays. Allow format: `Bash(command subcommand:*)` Insert new commands in alphabetical order within the allow array. ## Gemini Format File: ~/.gemini/policies/tool-permissions.toml Gemini uses a TOML policy engine with rules at different priority levels. Rule types and priorities: - `decision = "deny"` at `priority = 200` for destructive operations - `decision = "ask_user"` at `priority = 150` for write operations needing confirmation - `decision = "allow"` at `priority = 100` for read-only operations For allow rules, use `commandPrefix` (provides word-boundary matching). For deny and ask rules, use `commandRegex` (catches flag variants). New read-only commands should be added to the appropriate existing `[[rule]]` block by category, or a new block if no category fits. Example allow rule: ```toml [[rule]] toolName = "run_shell_command" commandPrefix = ["command subcommand1", "command subcommand2"] decision = "allow" priority = 100 ``` ## Gemini Directories If any new directories outside the workspace were accessed, add them to: - `context.includeDirectories` in ~/.gemini/settings.json - ~/.gemini/trustedFolders.json with value `"TRUST_FOLDER"` ## Exceptions Do not suggest adding the following commands: - git branch: The -D flag will delete branches - git pull: Incase a merge is actioned - git checkout: Changing branches can interrupt work - ajira issue create: To prevent excessive creation of new issues - find: The -delete and -exec flags are destructive (use fd instead)
# 任务:更新代理权限 请分析我们整个对话内容,并识别出使用过的所有具体命令。 更新 Claude Code 和 Gemini CLI 的权限。 ## 参考文件 - Claude:~/.claude/settings.json - Gemini 策略:~/.gemini/policies/tool-permissions.toml - Gemini 设置:~/.gemini/settings.json - Gemini 受信任文件夹:~/.gemini/trustedFolders.json ## 指令 1. 审计:将识别出的命令与两个配置文件中当前允许的命令进行比对。 2. 过滤:仅包含提供资源只读访问权限的命令。 3. 限制:明确排除任何能够修改、删除或破坏数据的命令。 4. 更新:仅将缺失的只读命令添加到两个配置文件中。 5. 约束:不得使用通配符。每个命令必须单独列出,以实现细粒度安全控制。 向我展示两类命令列表:只读(Read-Only)和写入(Write) 我们主要关注属于以下类别的只读命令:读取(Read)、获取(Get)、描述(Describe)、查看(View)或类似操作。 在我批准该列表后,请更新两个配置文件。 ## Claude 格式 文件:~/.claude/settings.json Claude 使用包含 allow、deny 和 ask 数组的 JSON 权限对象。 允许格式:`Bash(command subcommand:*)` 将新命令按字母顺序插入 allow 数组中。 ## Gemini 格式 文件:~/.gemini/policies/tool-permissions.toml Gemini 使用 TOML 策略引擎,在不同优先级级别上设置规则。 规则类型与优先级: - `decision = "deny"` 在 `priority = 200` 用于破坏性操作 - `decision = "ask_user"` 在 `priority = 150` 用于需要确认的写入操作 - `decision = "allow"` 在 `priority = 100` 用于只读操作 对于允许规则,使用 `commandPrefix`(提供词边界匹配)。 对于拒绝和询问规则,使用 `commandRegex`(可捕获标志变体)。 新的只读命令应添加到相应已有的 `[[rule]]` 块中(按类别),若无合适类别则创建新块。 示例允许规则: ```toml [[rule]] toolName = "run_shell_command" commandPrefix = ["command subcommand1", "command subcommand2"] decision = "allow" priority = 100 ``` ## Gemini 目录 如果访问了工作区之外的任何新目录,请将其添加至: - ~/.gemini/settings.json 中的 `context.includeDirectories` - ~/.gemini/trustedFolders.json,值为 `"TRUST_FOLDER"` ## 例外 请勿建议添加以下命令: - git branch:-D 标志会删除分支 - git pull:以防执行合并操作 - git checkout:切换分支可能会中断工作 - ajira issue create:防止过度创建新问题 - find:-delete 和 -exec 标志具有破坏性(请改用 fd)