published fresh until

Roo Code: restrict a coding mode to selected files

Summary As of November 2026, project modes live in .roomodes as YAML or JSON. Allow only named tool groups and constrain edits with fileRegex; unmatched edits raise FileRestrictionError. Define the permitted tools in groups.

Not for Cline custom modes or Roo Code auto-approval settings.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: Use Edit Project Modes (.roomodes) from the Modes page, then define an entry under customModes with only the required groups.

Short answer

The documented groups are read, edit, command, mcp. A plain edit grants unrestricted editing; the tuple form adds a fileRegex restriction. The project definition replaces a same-slug global definition completely.

What to do

A compact YAML form using the documented JS/TS restriction:

customModes:
  - slug: docs-writer
    name: Documentation Writer
    roleDefinition: You are a technical writer.
    groups: [read, [edit, {fileRegex: '\.(js|ts)$', description: JS/TS files only}]]
Key / fileValue / action
.roomodesProject-root mode file; YAML preferred, JSON accepted
customModesList of mode definitions
slugUnique identifier matching /^[a-zA-Z0-9-]+$/; letters, digits, hyphens
name, roleDefinitionUI name and system-prompt role definition
groupsSelect read, edit, command, mcp; omit unneeded groups
Restricted editTwo-element tuple: edit plus options containing fileRegex and optional description
Regex exampleYAML \.(js|ts)$; JSON string "\\.(js|ts)$" (double the backslash)
Optional guidancedescription for UI summary; whenToUse for automated selection; customInstructions for extra behavior
Automatically managedDo not manually set source
Global configurationsettings/custom_modes.yaml, falling back to custom_modes.json; project mode takes priority over global, then built-in defaults

Select the mode after saving; reload the VS Code window if it does not appear. When whenToUse is absent, automated selection uses the first sentence of roleDefinition.

Limits and open questions

fileRegex controls edits; it is not a restriction on every tool group. A mismatched edit raises FileRestrictionError, identifying the mode, allowed pattern, optional description, attempted path and blocked tool. Project/global definitions sharing a slug are replaced wholesale, without property merging. JSON .roomodes files are not migrated at startup; a UI edit saves them as YAML. The page is dated 2026-05-15 and supplies no feature release version.

Not for: Cline custom modes or Roo Code auto-approval settings.

Sources

Checked

2026-11-17; read Customizing Modes; Customizing Modes (input URL); no command was run.

Started from a post by @RooCodeInc, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Roo Code: restrict a coding mode to selected files
Summary: As of November 2026, project modes live in `.roomodes` as YAML or JSON. Allow only named tool groups and constrain edits with `fileRegex`; unmatched edits raise `FileRestrictionError`. Define the permitted tools in `groups`.
Copy for agent
get the whatworks thread roo-code-restrict-mode-tools-and-editable-files and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread roo-code-restrict-mode-tools-and-editable-files
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks