Skip to content

feat(grokcli): map the all-tools * permission category onto Grok's bare * rule - #3473

Merged
dyoshikawa merged 7 commits into
mainfrom
resolve-issue-2498-grokcli-toolset-domains
Oct 15, 2026
Merged

dyoshikawa merged 7 commits into
mainfrom
resolve-issue-2498-grokcli-toolset-domains

Conversation

@dyoshikawa

@dyoshikawa dyoshikawa commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Handles the "bare * tool rule" item of the issue below.

Grok documents a bare * rule that matches every tool ("A bare * rule matches every tool. Globs are not supported in the tool-name position." — 22-permissions-and-safety.md). In the source, parse_rule finds no tool name in * and lands it on ToolFilter::Any, and tool_filter_matches returns true for Any on every access kind (rules.rs, policy.rs).

The issue recorded this as needing a canonical all-tools category. That category now exists (*), and CodeBuddy / Qoder already map it onto their own standalone * rule. The grokcli adapter only folded it onto Bash through honorAllToolsOnBash, so a * deny never reached Read, Edit, WebFetch or MCP for Grok, and an imported * entry was kept as unmanaged.

Changes

  • Generate: "*": { "*": action } writes the bare * entry into the matching [permission] array, at both scopes. Grok has no *(...) spelling, so a narrower pattern under * is skipped with a warning, following CodeBuddy and Qoder. Its shell restrictions still reach Bash when a bash category exists.
  • Warnings:
    • Generate now owns the bare * entry, so a hand-written deny = ["*"] / ask = ["*"] with no matching canonical * rule is removed. It warns whenever that lifts a restriction.
    • A bare * ask/deny overrides every less strict entry in Grok (deny > ask > allow), so generate warns and names the specific entries that will never take effect.
    • Both behaviours are documented in docs/reference/file-formats.md.
  • Import: a compact bare * entry, and a tool-wide verbose [[permission.rules]] rule with tool = "any" (no pattern, or *), both come back as the all-tools * category. A pattern-scoped any rule is still skipped.
  • Updated the stale "(e.g. any)" examples in comments, the adapter's class doc, and docs/reference/file-formats.md, including the migration note: a hand-written bare * entry is now Rulesync-owned.
  • Tests cover generate, the narrower-pattern warning, managed replacement of an existing *, compact and verbose import, and the round trip. The two existing verbose-any tests now use a pattern-scoped rule so they still check the skip path.

Still open on #2498 (not in this PR)

  • .grok/personas/*.toml: needs a new subagent surface or adapter.
  • [toolset.web_search] / [toolset.web_fetch] domain lists: needs design decisions. The allowlist and blocklist are mutually exclusive, the allowlist is capped at 5 entries, it is global only, and the user-authored [toolset.*] table needs gateway ownedKeys.

Refs #2498

🤖 Generated with Claude Code

https://claude.ai/code/session_012y9fNo2AAJdGocxvsHtDhv

dyoshikawa and others added 7 commits October 16, 2026 00:07
…re * rule

Grok documents a bare `*` rule that matches every tool: upstream
`parse_rule` lands it on `ToolFilter::Any`, which `tool_filter_matches`
treats as matching every access kind. rulesync already has a canonical
all-tools `*` category, but the grokcli adapter only folded it onto
`Bash`, so a `*` deny never reached Read/Edit/WebFetch/MCP for Grok, and
an imported `*` entry was kept as unmanaged.

- Generate: `"*": { "*": action }` becomes the bare `*` entry; a narrower
  pattern under `*` has no Grok spelling and is skipped with a warning.
- Import: a compact bare `*` entry and a tool-wide verbose `any` rule
  both come back as the all-tools `*` category.

Refs #2498

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012y9fNo2AAJdGocxvsHtDhv
… rules

Generate now owns Grok's bare `*` entry, so a hand-written
`deny = ["*"]` or `ask = ["*"]` with no matching canonical `*` rule
was silently removed, which lifted a lockdown over every tool. Warn
whenever that happens.

Also warn when a bare `*` ask/deny makes specific less strict entries
ineffective, since Grok evaluates deny > ask > allow across all tools.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012y9fNo2AAJdGocxvsHtDhv
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012y9fNo2AAJdGocxvsHtDhv
…okcli-toolset-domains

# Conflicts:
#	src/generated/docs-content.ts
…okcli-toolset-domains

# Conflicts:
#	src/generated/docs-content.ts
…okcli-toolset-domains

# Conflicts:
#	src/generated/docs-content.ts
@dyoshikawa
dyoshikawa merged commit 6c06690 into main Oct 15, 2026
9 checks passed
@dyoshikawa
dyoshikawa deleted the resolve-issue-2498-grokcli-toolset-domains branch October 15, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant