You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Roo Code (open-source, Apache 2.0, ~13k stars) implements a Custom Modes system that lets users switch the AI agent between named profiles, each combining a persona/role definition, tool access restrictions, file access restrictions, and custom instructions. This is one of their most differentiated features and directly applicable to Hermes Agent.
Currently, Hermes has personality switching (/personality), per-project SOUL.md, and platform-based toolsets — but these are disconnected. A mode system would unify them: one switch changes the agent's persona, what tools it can use, what files it can touch, and what instructions it follows.
Debug — full access. Diagnoses failures, adds logging, proposes fixes.
Orchestrator — NO tool groups (only always-available tools like new_task, attempt_completion). Decomposes complex tasks and delegates to specialized modes.
Key Design Decisions:
File regex restrictions: The edit group can include a fileRegex that restricts what files the mode can modify (e.g., architect can only edit .md files). Violations are caught by a validation layer before tool execution.
Always-available tools: Some tools bypass mode restrictions entirely (e.g., attempt_completion, switch_mode, todo list).
Per-project modes: A .roomodes file in the workspace root defines project-specific modes that override global ones.
Mode rules files: Each mode can have detailed instruction files in .roo/rules-{slug}/ directories, loaded recursively.
Sticky models: Each mode remembers its last-used LLM model, enabling automatic model switching per task type.
Tool validation: A validateToolUse() function checks mode permissions before every tool call, throwing FileRestrictionError for violations.
How Mode Switching Works
Roo Code offers two switching mechanisms:
switch_mode — Changes mode in-place within the same conversation. The task continues with new tool restrictions and persona.
The switch_mode tool calls handleModeSwitch() which updates the system prompt, tool filtering, and task metadata. There's a 500ms delay after switch for changes to take effect.
Tool filtering happens via filterNativeToolsForMode() which:
Gets all tools for the mode's groups
Applies model-specific customization (some models don't support certain tools)
Removes disabled tools from settings
Only sends the filtered tool definitions to the LLM API
Current State in Hermes Agent
Hermes has several related but disconnected mechanisms:
Feature
Current State
Roo Code Equivalent
Personalities (/personality)
12 predefined system prompts (pirate, shakespeare, etc.)
roleDefinition in mode config
Custom prompts (/prompt)
Arbitrary system prompt override
customInstructions in mode config
SOUL.md
Per-project persona file loaded into system prompt
.roomodes per-project config
Toolsets (toolsets.py)
Platform-based tool groups (hermes-cli, hermes-telegram, safe)
groups in mode config
AGENTS.md / .cursorrules
Per-project instruction files
.roo/rules-{slug}/ directories
The gap: These exist as independent systems. There is no way to say "switch to Architect mode" and have the agent simultaneously adopt a planning-focused persona, lose access to file editing (except .md), and gain architecture-specific instructions — all as one atomic switch.
Relevant files:
cli.py lines 176-191, 1545-1575 — personality system
prompt_builder.py lines 309-333 — SOUL.md loading
toolsets.py — tool group definitions and resolution
run_agent.py — ephemeral system prompts
Implementation Plan
Skill vs. Tool Classification
This should be a core codebase change, not a skill or a tool. It requires:
Modifying the prompt construction pipeline (prompt_builder.py) to inject mode-specific personas and instructions
Modifying the tool registration system (toolsets.py, tools/registry.py) to filter tools based on active mode
Adding tool validation to enforce restrictions before tool execution
Extending the config system for mode definitions
Adding CLI commands (/mode) for switching
Per-project mode config file support
What We'd Need
Mode definition schema — YAML config format for defining modes (persona, tool groups, file restrictions, instructions)
Mode registry — Load modes from global config + per-project .hermes-modes.yaml
Tool filtering layer — Filter available tools based on active mode before API calls
Tool validation layer — Validate tool calls against mode restrictions before execution
Mode persistence per session (remember active mode across restarts)
Per-mode model preferences (e.g., Architect uses a reasoning model, Code uses a fast model)
Phase 3: Mode Ecosystem
switch_mode tool so the agent can switch its own mode mid-conversation
Mode export/import for sharing
Community modes in the Skills Hub
Gateway platform support (mode switching via Telegram/Discord commands)
Mode-aware sub-agent delegation (delegate_task inherits or overrides mode)
Pros & Cons
Pros
Safety — Read-only or restricted modes prevent accidental destructive changes during planning/review
Focus — Restricting tools reduces hallucination and off-task behavior (Roo Code's primary motivation for modes)
Token efficiency — Fewer tool definitions in the system prompt = more context for actual work
Workflow flexibility — Users can define project-specific modes (e.g., "frontend-only" mode that can't touch backend code)
Composability — Unifies existing disconnected systems (personality + toolsets + SOUL.md) into one coherent concept
Already proven — Roo Code's implementation is battle-tested with a large community
Cons / Risks
Complexity — Adds a new abstraction layer that all tool calls must pass through
Discovery — Users need to know modes exist and when to use them; poor defaults could frustrate
Override friction — If the agent needs a tool its mode doesn't allow, the user must manually switch modes (unlike just approving a tool call)
Maintenance — Every new tool added to Hermes must also be categorized into mode groups
Scope creep — Risk of the mode system becoming too complex if we try to match Roo Code's full feature set immediately
Open Questions
Should built-in modes be hardcoded or configurable? (Roo Code makes even built-in modes overridable via same-slug custom modes)
How should modes interact with existing personalities? Replace them, or be orthogonal? (Suggested: modes supersede personalities — a mode includes a persona)
Should the agent be able to switch its own mode, or only the user? (Roo Code allows both via switch_mode tool)
File regex restrictions: essential for Phase 1 or can we defer to Phase 2?
How do modes interact with delegate_task? Should child agents inherit the parent's mode?
Should mode definitions support referencing skills (e.g., "in Architect mode, auto-load the excalidraw skill")?
Overview
Roo Code (open-source, Apache 2.0, ~13k stars) implements a Custom Modes system that lets users switch the AI agent between named profiles, each combining a persona/role definition, tool access restrictions, file access restrictions, and custom instructions. This is one of their most differentiated features and directly applicable to Hermes Agent.
Currently, Hermes has personality switching (
/personality), per-projectSOUL.md, and platform-based toolsets — but these are disconnected. A mode system would unify them: one switch changes the agent's persona, what tools it can use, what files it can touch, and what instructions it follows.Source: Roo Code Custom Modes docs · GitHub repo · Mode marketplace
Research Findings
How Roo Code Modes Work
Each mode in Roo Code is defined by a
ModeConfigstructure:Tool Groups restrict which tools the agent can access:
read: read_file, search_files, list_files, codebase_searchedit: apply_diff, write_to_filecommand: execute_commandmcp: MCP server toolsmodes: switch_mode, new_task5 Built-in Modes:
.mdfiles, no terminal commands. Plans without modifying code.new_task,attempt_completion). Decomposes complex tasks and delegates to specialized modes.Key Design Decisions:
editgroup can include afileRegexthat restricts what files the mode can modify (e.g., architect can only edit.mdfiles). Violations are caught by a validation layer before tool execution.attempt_completion,switch_mode, todo list)..roomodesfile in the workspace root defines project-specific modes that override global ones..roo/rules-{slug}/directories, loaded recursively.validateToolUse()function checks mode permissions before every tool call, throwingFileRestrictionErrorfor violations.How Mode Switching Works
Roo Code offers two switching mechanisms:
switch_mode— Changes mode in-place within the same conversation. The task continues with new tool restrictions and persona.new_task— Creates a child task in a different mode with context isolation (the "Boomerang" pattern — covered in Feature: Multi-Agent Architecture — Orchestration, Cooperation, Specialized Roles & Resilient Workflows #344).The
switch_modetool callshandleModeSwitch()which updates the system prompt, tool filtering, and task metadata. There's a 500ms delay after switch for changes to take effect.Tool filtering happens via
filterNativeToolsForMode()which:Current State in Hermes Agent
Hermes has several related but disconnected mechanisms:
/personality)roleDefinitionin mode config/prompt)customInstructionsin mode config.roomodesper-project configtoolsets.py)groupsin mode config.roo/rules-{slug}/directoriesThe gap: These exist as independent systems. There is no way to say "switch to Architect mode" and have the agent simultaneously adopt a planning-focused persona, lose access to file editing (except
.md), and gain architecture-specific instructions — all as one atomic switch.Relevant files:
cli.pylines 176-191, 1545-1575 — personality systemprompt_builder.pylines 309-333 — SOUL.md loadingtoolsets.py— tool group definitions and resolutionrun_agent.py— ephemeral system promptsImplementation Plan
Skill vs. Tool Classification
This should be a core codebase change, not a skill or a tool. It requires:
prompt_builder.py) to inject mode-specific personas and instructionstoolsets.py,tools/registry.py) to filter tools based on active mode/mode) for switchingWhat We'd Need
.hermes-modes.yaml/mode <name>CLI command +switch_modetool for agent self-switchingPhased Rollout
Phase 1: Core Mode System
~/.hermes/config.yamlunderagent.modes/modeCLI command to list and switch modesmodel_tools.py/run_agent.pybased on active modePhase 2: Advanced Restrictions & Per-Project
*.mdfiles).hermes-modes.yamlfile support (overrides global).hermes/rules-{mode}/)Phase 3: Mode Ecosystem
switch_modetool so the agent can switch its own mode mid-conversationPros & Cons
Pros
Cons / Risks
Open Questions
switch_modetool)delegate_task? Should child agents inherit the parent's mode?References
packages/types/src/mode.ts,src/core/tools/validateToolUse.ts,src/core/prompts/tools/filter-tools-for-mode.ts,src/core/tools/SwitchModeTool.ts