{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/roo-coder-custom-modes/latest.json",
  "title": "Roo Coder Custom Modes",
  "description": "Schema for Roo Coder custom mode configuration files. Roo Coder is an AI-powered coding assistant that can be extended with custom modes to specialize its behavior for specific tasks. See <https://docs.roocode.com/features/custom-modes> for documentation.",
  "x-lintel": {
    "source": "https://www.schemastore.org/roomodes.json",
    "sourceSha256": "d3338f34400dfb4fdc627a9f881992e69be21d614a113f29e75f97ce66873234",
    "fileMatch": [
      ".roomodes",
      "*.roomodes",
      "custom_modes.yaml",
      "custom_modes.yml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "type": "object",
  "properties": {
    "customModes": {
      "type": "array",
      "description": "Array of custom mode definitions",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/customMode"
      }
    }
  },
  "required": [
    "customModes"
  ],
  "additionalProperties": false,
  "$defs": {
    "permission": {
      "title": "Permission",
      "description": "Tool access permission for a custom mode",
      "oneOf": [
        {
          "title": "Simple Permission",
          "type": "string",
          "enum": [
            "read",
            "edit",
            "browser",
            "command",
            "mcp"
          ],
          "enumDescriptions": [
            "read: Read access to files",
            "edit: Edit access to all files",
            "browser: Web browser access",
            "command: Command execution access",
            "mcp: Model Context Protocol access"
          ]
        },
        {
          "title": "Edit Permission with Path Restrictions",
          "description": "Edit permission with optional file path restrictions using regex patterns",
          "type": "object",
          "required": [
            "type"
          ],
          "properties": {
            "type": {
              "const": "edit",
              "description": "Must be 'edit' for path-restricted edit permissions"
            },
            "allowedPaths": {
              "type": "array",
              "description": "Regex patterns for allowed file paths. If specified, only files matching these patterns can be edited.",
              "items": {
                "type": "string",
                "format": "regex",
                "examples": [
                  "^/src/.*\\.js$",
                  "^/docs/.*\\.md$"
                ]
              }
            },
            "disallowedPaths": {
              "type": "array",
              "description": "Regex patterns for disallowed file paths. Files matching these patterns cannot be edited even if they match allowedPaths.",
              "items": {
                "type": "string",
                "format": "regex",
                "examples": [
                  ".*\\.env$",
                  ".*/secrets/.*"
                ]
              }
            }
          },
          "additionalProperties": false
        }
      ]
    },
    "customMode": {
      "title": "Custom Mode",
      "description": "Definition of a custom mode in Roo Coder",
      "type": "object",
      "required": [
        "slug",
        "name",
        "roleDefinition"
      ],
      "properties": {
        "slug": {
          "type": "string",
          "pattern": "^[a-z0-9-]+$",
          "minLength": 1,
          "maxLength": 50,
          "description": "Unique internal identifier for the mode. Must contain only lowercase letters, numbers, and hyphens.",
          "examples": [
            "code-reviewer",
            "test-writer",
            "api-designer"
          ]
        },
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100,
          "description": "Display name for the mode in the Roo Coder UI. Can include spaces, capitalization, and emojis.",
          "examples": [
            "Code Reviewer",
            "Test Writer 🧪",
            "API Design Expert"
          ]
        },
        "roleDefinition": {
          "type": "string",
          "minLength": 10,
          "description": "Core identity and expertise of the mode. The first sentence becomes the default mode summary.",
          "examples": [
            "I am a senior code reviewer focused on improving code quality, maintainability, and performance.",
            "I am a test automation expert specializing in comprehensive test coverage and best practices."
          ]
        },
        "whenToUse": {
          "type": "string",
          "description": "Guidance for when to use this mode. Used by the Orchestrator mode and for mode switching suggestions.",
          "examples": [
            "Use this mode when you need a thorough code review with focus on best practices",
            "Use this mode when creating or updating test files"
          ]
        },
        "customInstructions": {
          "type": "string",
          "description": "Additional behavioral guidelines for the mode. Supports markdown formatting for structured instructions.",
          "examples": [
            "## Review Process\n1. Analyze code structure\n2. Check for performance issues\n3. Verify security best practices"
          ]
        },
        "groups": {
          "type": "array",
          "description": "Allowed toolsets and file access permissions for this mode",
          "items": {
            "$ref": "#/$defs/permission"
          },
          "examples": [
            [
              "read",
              "edit",
              "browser"
            ],
            [
              "read",
              {
                "type": "edit",
                "allowedPaths": [
                  "^/docs/.*\\.md$"
                ]
              }
            ]
          ]
        }
      },
      "additionalProperties": false
    }
  }
}
