Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions aider/coders/agent_coder.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def __init__(self, *args, **kwargs):
def _build_tool_registry(self):
"""
Build a registry of available tools with their normalized names and process_response functions.
Handles agent configuration with whitelist/blacklist functionality.
Handles agent configuration with includelist/excludelist functionality.

Returns:
dict: Mapping of normalized tool names to tool modules
Expand Down Expand Up @@ -182,10 +182,10 @@ def _build_tool_registry(self):

# Process agent configuration if provided
agent_config = self._get_agent_config()
tools_whitelist = agent_config.get("tools_whitelist", [])
tools_blacklist = agent_config.get("tools_blacklist", [])
tools_includelist = agent_config.get("tools_includelist", [])
tools_excludelist = agent_config.get("tools_excludelist", [])

# Always include essential tools regardless of whitelist/blacklist
# Always include essential tools regardless of includelist/excludelist
essential_tools = {"makeeditable", "replacetext", "view", "finished"}
for module in tool_modules:
if hasattr(module, "NORM_NAME") and hasattr(module, "process_response"):
Expand All @@ -194,16 +194,16 @@ def _build_tool_registry(self):
# Check if tool should be included based on configuration
should_include = True

# If whitelist is specified, only include tools in whitelist
if tools_whitelist:
should_include = tool_name in tools_whitelist
# If includelist is specified, only include tools in includelist
if tools_includelist:
should_include = tool_name in tools_includelist

# Always include essential tools
if tool_name in essential_tools:
should_include = True

# Exclude tools in blacklist (unless they're essential)
if tool_name in tools_blacklist and tool_name not in essential_tools:
# Exclude tools in excludelist (unless they're essential)
if tool_name in tools_excludelist and tool_name not in essential_tools:
should_include = False

if should_include:
Expand Down Expand Up @@ -236,10 +236,10 @@ def _get_agent_config(self):
# Set defaults for missing values
if "large_file_token_threshold" not in config:
config["large_file_token_threshold"] = 25000
if "tools_whitelist" not in config:
config["tools_whitelist"] = []
if "tools_blacklist" not in config:
config["tools_blacklist"] = []
if "tools_includelist" not in config:
config["tools_includelist"] = []
if "tools_excludelist" not in config:
config["tools_excludelist"] = []

# Apply configuration to instance
self.large_file_token_threshold = config["large_file_token_threshold"]
Expand Down
6 changes: 3 additions & 3 deletions aider/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def expand_glob_patterns(patterns, root="."):

PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
log_file = None
file_blacklist = ["get_bottom_toolbar", "<genexpr>"]
file_excludelist = ["get_bottom_toolbar", "<genexpr>"]


def custom_tracer(frame, event, arg):
Expand All @@ -493,7 +493,7 @@ def custom_tracer(frame, event, arg):
func_name = frame.f_code.co_name
line_no = frame.f_lineno

if func_name not in file_blacklist:
if func_name not in file_excludelist:
log_file.write(
f"-> CALL: {func_name}() in {os.path.basename(filename)}:{line_no} -"
f" {time.time()}\n"
Expand All @@ -503,7 +503,7 @@ def custom_tracer(frame, event, arg):
func_name = frame.f_code.co_name
line_no = frame.f_lineno

if func_name not in file_blacklist:
if func_name not in file_excludelist:
log_file.write(
f"<- RETURN: {func_name}() in {os.path.basename(filename)}:{line_no} -"
f" {time.time()}\n"
Expand Down
21 changes: 11 additions & 10 deletions aider/website/docs/config/agent-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ Agent Mode prioritizes granular tools over SEARCH/REPLACE:
- **Line number verification**: Two-step process for line-based edits to prevents errors
- **Tool usage monitoring**: Prevents infinite loops by tracking repetitive patterns


### Workflow Process

#### 1. Exploration Phase
Expand Down Expand Up @@ -151,13 +150,14 @@ Agent Mode can be configured using the `--agent-config` command line argument, w

#### Configuration Options

- **`tools_whitelist`**: Array of tool names to allow (only these tools will be available)
- **`tools_blacklist`**: Array of tool names to exclude (these tools will be disabled)
- **`tools_includelist`**: Array of tool names to allow (only these tools will be available)
- **`tools_excludelist`**: Array of tool names to exclude (these tools will be disabled)
- **`large_file_token_threshold`**: Maximum token threshold for large file warnings (default: 25000)

#### Essential Tools

Certain tools are always available regardless of whitelist/blacklist settings:
Certain tools are always available regardless of includelist/excludelist settings:

- `makeeditable` - Make files editable
- `replacetext` - Basic text replacement
- `view` - View files
Expand All @@ -167,16 +167,16 @@ Certain tools are always available regardless of whitelist/blacklist settings:

```bash
# Only allow specific tools
aider --agent --agent-config '{"tools_whitelist": ["view", "makeeditable", "replacetext", "finished"]}'
aider-ce --agent --agent-config '{"tools_includelist": ["view", "makeeditable", "replacetext", "finished"]}'

# Exclude specific tools
aider --agent --agent-config '{"tools_blacklist": ["command", "commandinteractive"]}'
# Exclude specific tools
aider-ce --agent --agent-config '{"tools_excludelist": ["command", "commandinteractive"]}'

# Custom large file threshold
aider --agent --agent-config '{"large_file_token_threshold": 10000}'
aider-ce --agent --agent-config '{"large_file_token_threshold": 10000}'

# Combined configuration
aider --agent --agent-config '{"large_file_token_threshold": 10000, "tools_whitelist": ["view", "makeeditable", "replacetext", "finished", "gitdiff"]}'
aider-ce --agent --agent-config '{"large_file_token_threshold": 10000, "tools_includelist": ["view", "makeeditable", "replacetext", "finished", "gitdiff"]}'
```

This configuration system allows for fine-grained control over which tools are available in Agent Mode, enabling security-conscious deployments and specialized workflows while maintaining essential functionality.
Expand All @@ -189,4 +189,5 @@ This configuration system allows for fine-grained control over which tools are a
- **Scalable exploration**: Can handle large codebases through strategic context management
- **Recovery mechanisms**: Built-in undo and safety features

Agent Mode represents a significant evolution in aider's capabilities, enabling more sophisticated and autonomous codebase manipulation while maintaining safety and control through the tool-based architecture.
Agent Mode represents a significant evolution in aider's capabilities, enabling more sophisticated and autonomous codebase manipulation while maintaining safety and control through the tool-based architecture.