Skip to content

[MXC][RFC] Add per-tool sandbox configuration - #1

Open
ChazGo wants to merge 4 commits into
mainfrom
rfc/0026-mxc-per-tool-policy-advisor
Open

ChazGo wants to merge 4 commits into
mainfrom
rfc/0026-mxc-per-tool-policy-advisor

Conversation

@ChazGo

@ChazGo ChazGo commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Why is this change being made?

OpenClaw currently applies one shared MXC baseline to MXC-backed execution, but
different tools and argument sets can require narrower access. We need a
user-controlled per-tool layer without replacing the existing per-agent sandbox
settings or shared MXC baseline configuration.

We also need an application-owned workflow for consuming MXC denial capture.
MXC returns denial records after the process exits, so OpenClaw must validate
those records, present an approval decision, and rerun only when the requested
change remains within the existing configuration limits.

IMPORTANT NOTE: This is a significant iteration on the existing RFC, not a new
proposal. The per-tool configuration advisor, exact and wildcard matching,
SQLite storage, MXC execution boundary, CLI management, and compatibility
behavior remain recognizable. The main review areas are the
ContainerConfig-shaped sandbox configuration fragment, Learning Mode, and the
clarified Gateway and Windows Node boundary.

What changed?

  • Replaced the OpenClaw-specific sandbox envelope with an MXC
    ContainerConfig-shaped sandbox configuration fragment.
  • Clarified how per-tool configurations compose with resolved per-agent
    settings and the shared MXC baseline configuration.
  • Required per-tool configurations to restrict both existing configuration
    surfaces rather than add grants.
  • Kept the per-tool wildcard scoped to all argument sets for one named tool.
  • Added MXC app/user-configurable block mode with Deny, Allow once, and
    Always allow rerun behavior.
  • Added MXC fleet-auditing allow mode for explicitly initiated, reduced-
    containment observation and reviewed configuration proposals.
  • Required denials that exceed the agent or MXC baseline configuration to be
    handled as baseline changes instead of per-tool changes.
  • Documented how the stored fragment can add future MXC fields through explicit
    composition, schema validation, and migration rules.
  • Added the MXC Node SDK dependency requirements for typed capture
    configuration, structured output metadata, runtime support, and completeness.
  • Kept Gateway-local and Windows Node configurations separate while allowing
    Windows Node to adopt the same per-tool matching and Learning Mode workflow.

What changed since the previous review?

  • Preserved the existing per-agent and shared MXC baseline configuration
    surfaces.
  • Changed per-tool composition from additive grants to restrictive sandbox
    configuration.
  • Added both MXC captureDenials modes and post-exit approval.
  • Clarified that Windows Node can adopt the design with separate node-local
    configuration and enforcement.

How was the change tested?

  • Validated Markdown whitespace and structure.
  • Reviewed the RFC against the current OpenClaw MXC baseline implementation and
    MXC denial-capture contract.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 03153551-136c-49df-a726-242cd03f26a4
@MythiliMur

Copy link
Copy Markdown

No need to talk about “session-wide” in description


## Motivation

OpenClaw currently applies a sandbox policy at a broader session or backend

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Policies are already applied per tool, no? How does this interact with existing policy config file?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing MXC policy provides a default policy config applied to every MXC-backed call. This proposal adds stored policies for specific tools or arguments. I'm updating the RFC to explicitly state how the per tool policies will interact with the default policy.

- Allow settled policies to proceed without prompting.
- Prompt for an operator decision when a matching policy is still in
development.
- Persist mutable policy state in OpenClaw's SQLite state database.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to guarantee that openclaw itself is not able to modify these files during runtime without user intervention?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenClaw needs trusted runtime access to update policy lifecycle and usage metadata. The guarantee should be that MXC-backed tool execution cannot modify the policy store directly. Policy changes should only occur through the MXC plugin and supported operator management paths

Comment thread rfcs/0026-mxc-per-tool-policy-advisor.md Outdated

## Goals

- Evaluate tool calls against local policy before execution.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requested policy is a union of policy settings as configured by gateway admins and per tool policy from policy store. Please update the design accordingly.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The next iteration I'm sending out will more explicitly state how the default policy applied to every tool will be composed with the per tool policies.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1255dade-bf9b-4463-8c58-52c3470abff8
@ChazGo

ChazGo commented Jul 22, 2026

Copy link
Copy Markdown
Owner Author

No need to talk about “session-wide” in description

Idk how to directly reply to this but agree session is overloaded term here. Going to rephrase. The session-wide meant the chat session (i.e. the existing default policy that can be set which applies to every single tool call)

@ChazGo
ChazGo marked this pull request as ready for review July 22, 2026 20:49
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: de39d8d8-c02d-4bc5-a0ca-b15a964b2493
@ChazGo ChazGo changed the title docs: propose MXC per-tool policy advisor [MXC][RFC] Add per-tool sandbox configuration Jul 29, 2026

## Goals

- Select a sandbox configuration for each OpenClaw tool call.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open question on per agent, per tool sandbox configurations

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the RFC to clarify this. Per-tool sandbox configurations are stored globally, not per agent, but they are composed with the invoking agent’s resolved sandbox settings and cannot widen that agent’s access

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: e7b77e58-db8b-4dea-a202-b2d397478725

### Ownership

The MXC plugin registers a low-priority `before_tool_call` hook. Ordinary hooks

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registers only when MXC plugin is enabled right?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The hook is registered only when the MXC plugin is enabled. I’ll make that explicit.

- Keep configuration selection and MXC enforcement in the OpenClaw MXC plugin.
- Support exact and per-tool wildcard configuration matching.
- Allow calls with no matching configuration to preserve existing behavior.
- Persist mutable per-tool sandbox configurations in OpenClaw's SQLite state

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this openclaw sqlite corrupt free from both the tools & models / orchestration / agent loop?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sandboxed tool processes cannot access the OpenClaw state directory, and the model has no direct database access. Writes go through the trusted MXC plugin using OpenClaw’s validated plugin-state API rather than direct SQLite access.

The OpenClaw host and trusted plugin code necessarily retain access to manage the entries. Store read, parse, or corruption errors fail the governed tool call closed

operation; OpenClaw starts a new tool execution. A denial that requires
changing the shared baseline or per-agent settings is reported as a baseline
configuration change instead of a per-tool change. OpenClaw will not persist
the denial document, ETL, raw events, or a separate learning session.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

App caller is responsible for deleting the json files.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I’ll make that lifecycle explicit.

OpenClaw will read and validate the per-run denial JSON after the process exits, retain only the reviewed configuration result in memory or SQLite, and delete the raw JSON on every terminal path. ETL retention will remain disabled, and OpenClaw will clean up any reported retained artifact if one is produced.

applies to all argument sets for that tool. Configurations are shared across
agents but are composed with the invoking agent's resolved sandbox settings.

### Sandbox configuration fragment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asklar @richiemsft I'm not sure if SandboxPolicy would be better for OpenClaw to store and then call createConfigFromPolicy(). SandboxPolicy seems better for cross platform usage but it seems like it's missing platform specific fields that ContainerConfig includes.

Any recommendations for SandboxPolicy or storing a ContainerConfig fragment?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That must be a gap, @bbonaby, @theelliotm

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.

3 participants