Skip to content

docs(ai-sessions): document tool permissions and profile configuration#193

Merged
maximelb merged 5 commits intomasterfrom
docs/ai-sessions-tool-permissions
Apr 22, 2026
Merged

docs(ai-sessions): document tool permissions and profile configuration#193
maximelb merged 5 commits intomasterfrom
docs/ai-sessions-tool-permissions

Conversation

@maximelb
Copy link
Copy Markdown
Contributor

Summary

  • Add a dedicated 9-ai-sessions/tool-permissions.md reference page explaining how allowed_tools, denied_tools, and permission_mode work in both user Profiles and ai_agent Hive records — the two surfaces that configure the Claude Agent SDK inside AI Sessions.
  • Cover the full Claude Code tool-name grammar (built-in tool names, Bash(prefix:*) pipeline-stage semantics and fail-closed rules, mcp__server__tool patterns, and the lc_call_tool meta-tool scoping), the allow/deny precedence, permission_mode values (acceptEdits / plan / bypassPermissions) and when to pick which, session-scoped approvals, and the two default Profiles the session manager provisions for new users.
  • Cross-link from index.md, user-sessions.md, dr-sessions.md, and cli.md; add the new page to the AI Sessions nav in mkdocs.yml.
  • Sourced from refractionPOINT/ai-sessions (scripts/sdk_bridge.py, internal/sessionmanager/profiles.go, internal/runner/config.go) and refractionPOINT/legion_config_hive/hives/def_ai_agent.go, so every pattern/precedence claim is grounded in the code that evaluates it at tool-call time.

Test plan

  • mkdocs build --strict — builds cleanly; no new warnings introduced by this change.
  • Preview the rendered page and cross-links in the Material theme once the preview build is available.

🤖 Generated with Claude Code

maximelb and others added 5 commits April 21, 2026 15:04
Add a dedicated reference page covering how allowed_tools,
denied_tools, and permission_mode work in both user Profiles and
ai_agent Hive records. Explains the Claude Code tool-name grammar
(built-ins, Bash(prefix:*) pipeline-stage semantics, MCP
mcp__server__tool names, the lc_call_tool meta-tool scoping),
allow/deny precedence, permission modes, session-scoped approvals,
and the defaults shipped to new users. Cross-link from the index,
user-sessions, dr-sessions, and CLI pages, and add it to the AI
Sessions nav section.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Use a popular security MCP server (VirusTotal) in the MCP pattern
examples instead of the LimaCharlie MCP server, since the recommended
path for agents talking to LimaCharlie is now the CLI rather than the
MCP server. Also drop the lc_call_tool meta-tool scoping section for
the same reason, and trim the unattended-D&R example to not wire in
an LC MCP server.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Drop the "Task / Agent" dual-naming — the Claude Agent SDK surfaces
  the subagent tool as Task.
- Fix the AskUserQuestion row: the tool routes questions to the
  attached chat client (browser UI or `ai session attach`), not to
  the ext-feedback extension's UI as I'd erroneously implied.
- Add MultiEdit to the list of tools acceptEdits auto-approves.
- Replace the invented `ai_agent.capture-profile` name with the real
  `POST /v1/sessions/{sessionId}/capture-profile` API, and link it.
- Remove the "suffix matching for server name drift" paragraph. That
  behaviour only lives in the bridge's session-scoped pattern matcher
  and does not extend to Profile-level allowed_tools/denied_tools, so
  stating it as a general Profile rule was wrong. Replace with a
  simple pointer that the server_name in the pattern must match the
  key in the mcp_servers map.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…e routing

Tracks ai-sessions PR route-allowed-tools-through-matcher: profile
`allowed_tools` now seed into the bridge's session-approved pattern
set and are evaluated by the hardened matcher (pipeline-stage
coverage, wrapper stripping, fail-close on $() / backticks /
subshell grouping / newlines). `denied_tools` still goes to the
Claude Agent SDK as `disallowed_tools` and uses the SDK's simpler
literal-prefix matcher.

- Label the "Matching semantics" section as allow-list behaviour and
  add an explicit denied_tools section documenting the SDK-level
  literal-prefix matcher (no stage coverage, no fail-close).
- Rewrite the allowed_tools vs denied_tools section around the two
  enforcement layers (SDK deny → bridge allow → permission_mode fall-
  through).
- Unify session-scoped approvals with profile allowed_tools — same
  pattern store, same matcher.
- Fix the destructive-Bash-verbs example: a denied `Bash(rm:*)` does
  NOT block `ls && rm -rf /`; the correct containment comes from the
  allow-list matcher refusing to cover the `rm -rf /` stage.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Tracks ai-sessions commit 81b9969 "route denied_tools through the
matcher; fix bare Bash allow regression":

- denied_tools is now seeded into session_denied_patterns and
  evaluated by the bridge, not handed to the SDK's
  opts.disallowed_tools anymore. Both lists share the same pipeline
  splitting, wrapper stripping, env-assignment skip, and newline
  handling so an allow+deny pair can no longer be played against
  each other.
- Restructure the Bash-pattern section into Common pre-processing +
  Allow semantics (all stages covered) + Deny semantics (any stage
  matching) + fail-closed-into-prompt on dangerous constructs.
- Call out the bare-tool-name short-circuit (e.g. bare `Bash` means
  "every Bash invocation"; applies on both sides of the split).
- Rewrite the allowed_tools vs denied_tools section around the
  deny-first / allow-second / permission_mode-fallback order, since
  both lists now live at the bridge layer.
- Update the destructive-Bash-verbs example: a denied `Bash(rm:*)`
  now DOES block `ls && rm -rf /`, and `timeout 30 rm ...` is caught
  via the same wrapper-stripping as allow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@maximelb maximelb requested a review from steveatlc April 22, 2026 00:02
@maximelb maximelb added the to-code-review Used to tag PRs that are force-pushed and will need to be reviewed after the fact. label Apr 22, 2026
@maximelb maximelb marked this pull request as ready for review April 22, 2026 00:03
@maximelb maximelb merged commit 1971fdc into master Apr 22, 2026
2 checks passed
@maximelb maximelb deleted the docs/ai-sessions-tool-permissions branch April 22, 2026 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

to-code-review Used to tag PRs that are force-pushed and will need to be reviewed after the fact.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant