QueryMT Agent - Agent Modes
QueryMT Agent supports three runtime modes that control what the agent can do and how it behaves. Modes can be switched at runtime, allowing flexible workflows.
Available Modes
| Mode | Access Level | Primary Use Case |
|---|---|---|
| Build | Full read/write | Implementing code changes |
| Plan | Read-only | Analyzing and planning |
| Review | Read-only | Code review and feedback |
Mode Details
Build Mode
Default mode - Full read and write access to the workspace.
Capabilities: - Read and modify any file - Execute shell commands (including mutating ones) - Create and delete files - Use all configured tools
System Reminder: None (full access)
When to use: - Implementing features - Fixing bugs - Making code changes - Any task requiring modifications
Example:
Plan Mode
Read-only mode - Agent can observe and analyze but cannot make changes.
Capabilities:
- Read files
- Search code
- List directories
- Run read-only shell commands (git log, grep, find, etc.)
- Create todo lists
- Ask clarifying questions
Restrictions:
- Cannot edit files
- Cannot create files
- Cannot delete files
- Cannot run mutating shell commands (sed, tee, echo >, rm, cargo build, etc.)
System Reminder:
When to use: - Before implementing complex changes - Understanding existing codebase - Creating implementation plans - Risk assessment - Architecture analysis
Example:
Review Mode
Read-only mode - Agent acts as a code reviewer providing feedback.
Capabilities:
- Read files and search code
- Analyze code quality
- Identify bugs and issues
- Check for security concerns
- Run read-only commands (tests with --dry-run, linting, etc.)
Restrictions: - Cannot edit files - Cannot create files - Cannot delete files - Cannot run mutating shell commands
System Reminder:
When to use: - Reviewing PRs - Code quality checks - Security audits - Performance reviews - Architecture validation
Example:
Switching Modes
Via Dashboard (Interactive)
In the web dashboard, press: - Ctrl+M (Linux/Windows) - Cmd+M (macOS)
The mode indicator in the header shows the current mode.
Via API
Via ACP
Via Configuration
Set default mode in configuration:
Mode Transition Flow
flowchart LR
B["Build Mode<br/>(default)"]
P[Plan Mode]
R[Review Mode]
B -->|"Ctrl+M"| P
P -->|"Ctrl+M"| R
R -->|"Ctrl+M"| B
Mode-Aware Behavior
Tool Access
| Tool | Build | Plan | Review |
|---|---|---|---|
read_tool |
✓ | ✓ | ✓ |
edit |
✓ | ||
write_file |
✓ | ||
delete_file |
✓ | ||
shell |
✓* | ✓ (read-only) | ✓ (read-only) |
glob |
✓ | ✓ | ✓ |
search_text |
✓ | ✓ | ✓ |
ls |
✓ | ✓ | ✓ |
*Shell commands are restricted in Plan/Review mode
System Prompt Injection
When in Plan or Review mode, the AgentModeMiddleware injects a system reminder that:
- Reminds the agent of its mode restrictions
- Clarifies what actions are allowed
- Provides guidance on the mode's purpose
Permission Handling
In Plan and Review modes: - Mutating tools are automatically denied - No permission prompts are shown (access is denied by design) - The agent receives clear feedback about mode restrictions
Use Cases
Development Workflow
- Plan Phase (Plan Mode)
- Analyze requirements
- Understand existing code
- Create implementation plan
-
Get user approval
-
Implementation Phase (Build Mode)
- Implement the planned changes
- Write tests
-
Verify functionality
-
Review Phase (Review Mode)
- Review own changes
- Check for issues
-
Ensure code quality
-
Repeat as needed
Code Review Workflow
- Submit Changes
-
Developer makes changes in Build mode
-
Request Review
- Switch to Review mode
-
Ask agent to review changes
-
Get Feedback
- Agent provides detailed feedback
- Lists issues by severity
-
Suggests specific fixes
-
Iterate
- Developer addresses feedback in Build mode
- Request additional review if needed
Architecture Analysis
- Initial Analysis (Plan Mode)
- Explore codebase structure
- Identify dependencies
-
Map data flow
-
Planning (Plan Mode)
- Create migration plan
- Identify risks
-
Estimate effort
-
Implementation (Build Mode)
- Execute the plan
-
Make changes incrementally
-
Validation (Review Mode)
- Verify changes meet requirements
- Check for regressions
Configuration
Custom Mode Reminders
Customize the system reminders for Plan and Review modes:
Mode-Specific Tools
Configure different tools per mode:
Best Practices
When to Use Each Mode
Use Plan Mode when: - Task complexity is high - You want to avoid accidental changes - You need to understand the codebase first - You want user approval before implementing
Use Review Mode when: - You want objective code feedback - You're checking for security issues - You need quality assurance - You're doing a pre-commit check
Use Build Mode when: - You're ready to implement - You need to make changes - You're fixing bugs - You're adding features
Mode Switching Tips
- Start in Plan Mode for complex tasks
- Switch to Build Mode when ready to implement
- Use Review Mode before finalizing changes
- Cycle through modes for thorough development
Communication
When switching modes, communicate with the user: - "Switching to Plan mode to analyze the requirements" - "Ready to implement, switching to Build mode" - "Changes complete, switching to Review mode for final check"
Troubleshooting
Agent Still Making Changes in Plan/Review Mode
- Check that
AgentModeMiddlewareis in the middleware stack - Verify the mode is actually set (check mode indicator)
- Check logs for mode-related warnings
- Ensure mutating tools are in the
mutating_toolslist
Mode Not Switching
- Verify dashboard is running with
--dashboardfeature - Check keyboard shortcut (Ctrl+M / Cmd+M)
- Try switching via API instead
- Check for middleware errors in logs
Permission Errors in Build Mode
- Verify
assume_mutatingsetting - Check
mutating_toolsconfiguration - Ensure tools are properly registered
- Check for tool-specific permission requirements
Examples
See examples/confs/single_coder.toml for a complete configuration with mode-aware middleware.
Related Documentation
- Middleware Guide - AgentModeMiddleware configuration
- Configuration Guide - Full config reference
- API Reference - Mode API types