| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [View Raw Code] [Original HTTPS Page] |
| parent | Configuration |
|---|---|
| nav_order | 5 |
| description | Agent Mode enables autonomous codebase exploration and modification using local tools. |
Agent Mode is an operational mode in cecli that enables autonomous codebase exploration and modification using local tools. Instead of relying on traditional edit formats, Agent Mode uses a tool-based approach where the LLM can discover, analyze, and modify files through a series of tool calls.
Agent Mode can be activated in the following ways
In the interface:
/agent
In the command line:
cecli ... --agent
In the configuration files:
agent: true
Agent Mode operates through a continuous loop where the LLM:
This loop continues automatically until the Yield tool is called, or the maximum number of iterations is reached.
Agent Mode uses a centralized local tool registry. The standard tools include:
Agent Mode includes some useful context management features:
The LLM uses discovery tools to gather information:
Tool Call: ExploreCode
Arguments: {"queries": [{"symbol": "Config", "action": "search"}]}
Tool Call: ReadFile
Arguments: {"read": [{"file_path": "main.py", "range_start": "@000", "range_end": "000@"}]}
Tool Call: Grep
Arguments: {"searches": [{"pattern": "function_name", "directory": "."}]}
ExploreCode uses a codebase index when available. ReadFile returns content with virtual identifiers for precise follow-up edits. Files discovered through agent tools can be added as read-only context by using ResourceManager to change context membership.
The LLM uses the UpdateTodoList tool to track progress and plan complex changes:
Tool Call: UpdateTodoList
Arguments: {"content": "## Task: Add new feature\n- [ ] Analyze existing code\n- [ ] Implement new function\n- [ ] Add tests\n- [ ] Update documentation"}
Files are added to context and made editable with ResourceManager, then modifications are applied with EditFile:
Tool Call: ResourceManager
Arguments: {"add": ["main.py"]}
Tool Call: EditFile
Arguments: {"edits": [{"file_path": "main.py", "operation": "replace", "start_line": "——def old_function():", "end_line": "—— return old_value", "text": "def new_function():\n return new_value"}]}
EditFile accepts an edits array containing replace or delete operations. Its line targets come from the latest ReadFile result. ResourceManager can add files as editable or read-only and remove them from context.
Changes are verified with the available tools:
Tool Call: GitDiff
Arguments: {}
Tool Call: ReadFile
Arguments: {"read": [{"file_path": "main.py", "range_start": "@000", "range_end": "000@"}]}
Tool Call: UndoChange
Arguments: {"change_id": "..."}
GitDiff is available when enabled in the configuration; it is excluded by default.
The agent continues until the task is complete and then calls Yield:
Tool Call: Yield
Arguments: {}
Yield is the registry's essential tool. When sub-agents are active, it waits for their outstanding tasks; completed summaries and errors are injected into the parent conversation before completion.
Agent Mode can be configured using the --agent-config command line argument, which accepts a JSON string for fine-grained control over tool availability and behavior.
Agent Mode can also be configured directly in your configuration file. See the Complete Configuration Example below for a full reference.
large_file_token_threshold: Maximum token threshold for large file warnings (default: 8192)
skip_cli_confirmations: YOLO mode; yolo is accepted as an alias (default: false)
allowed_commands: Array of glob patterns for commands that can be executed without prompting. Example: ["wc -l*"] (default: [])
tools_includelist: Array of tool names to allow. When non-empty, only these tools are available; yield is automatically retained.
tools_excludelist: Array of tool names to exclude
tools_paths: Array of directories or Python files containing custom tools. tool_paths is accepted as an alias.
servers_includelist: Array of MCP server names to allow. servers_whitelist is accepted as an alias.
servers_excludelist: Array of MCP server names to exclude. servers_blacklist is accepted as an alias.
show_lint_errors: When enabled, linting errors found during editing are displayed in tool output (default: false)
subagent_paths: Array of directories to search for sub-agent definition .md files. ~/.cecli/subagents and the built-in defaults directory are also scanned.
max_sub_agents: Maximum number of active sub-agents (default: 30; -1 means effectively unlimited)
allow_nested_delegation: Allow sub-agents to delegate tasks to further sub-agents (default: false)
include_context_blocks: Array of context block names to include, replacing the default set
exclude_context_blocks: Array of context block names to exclude from the selected set
hot_reload: When enabled, skills configuration is hot-reloaded automatically (default: false)
command_timeout: Seconds used when waiting for background command completion (default: 30)
diff_colors: When enabled, edit diffs use color-coded removed, added, and context lines (default: true)
allow_orchestration: Enables the Orchestrate tool and its context block (default: true)
orchestration: A nested configuration object for the Orchestrate tool's Python sandbox. When absent or empty, the sandbox runs with default restrictions. See Orchestration Configuration below for details.
The Orchestrate tool runs user code in a secure Python sandbox with the following restrictions:
These restrictions can be selectively relaxed via the orchestration config block:
allowed_imports: Array of module names to allow importing. Example: ["os", "typing"]. Only standard library modules should be allowed; third-party modules may execute arbitrary code at import time.
allowed_builtins: Array of builtin function names to add to the sandbox. Example: ["setattr", "property"]. Dangerous builtins (eval, exec, open, etc.) cannot be added.
allow_classes: Boolean (default: false). When true, class definitions are permitted and dunder methods (__init__, __str__, __repr__, __iter__, etc.) are allowed inside class bodies.
disable_security: Boolean (default: false). When true, the AST-level security filter is skipped entirely. ⚠ Use with extreme caution — this disables all import blocking, dunder blocking, and dangerous builtin blocking.
disable_loop_protection: Boolean (default: false). When true, the cooperative yield injection is skipped. Use only if you are certain the orchestration code has no unbounded loops.
Example:
agent-config:
orchestration:
allowed_imports:
- os
- typing
allow_classes: trueOnly Yield is protected as an essential registry tool. Other tools, including ResourceManager and ReadFile, can be restricted by includelist/excludelist settings.
The registry also supports Custom Tools that can be loaded from specified directories or files using the tools_paths configuration option. Custom tools must be Python files containing a Tool class that inherits from BaseTool and defines a NORM_NAME attribute.
Custom tools can be created by writing Python files that follow this structure:
from cecli.tools.utils.base_tool import BaseTool
class Tool(BaseTool):
NORM_NAME = "mycustomtool"
SCHEMA = {
"type": "function",
"function": {
"name": "MyCustomTool",
"description": "Description of what the tool does",
"parameters": {
"type": "object",
"properties": {
"parameter_name": {
"type": "string",
"description": "Description of the parameter"
}
},
"required": ["parameter_name"],
},
},
}
@classmethod
def execute(cls, coder, parameter_name):
"""
Execute the custom tool.
Args:
coder: The coder instance
parameter_name: The parameter value
Returns:
A string result message
"""
# Tool implementation here
return f"Tool executed with parameter: {parameter_name}"To load custom tools, specify the tools_paths configuration option in your agent config:
agent-config:
tools_paths: ["./custom-tools", "~/my-tools"]The tools_paths can include:
Tools are loaded automatically when the registry is built and will be available alongside the built-in tools.
Delegate accepts one or more delegation objects. Each delegation includes a registered sub-agent name, a prompt, and optional async and persist flags. Asynchronous delegations run in the background; synchronous delegations wait for the sub-agent result. The system uses Yield to wait for outstanding child tasks when finishing the parent task.
Sub-agent results are reported back to the parent conversation as summaries or errors. Sub-agents use auto_reap: true by default, so completed agents can be removed automatically after their work and descendants finish. Independent agents may be cleaned up shortly after completion, while the service also reaps completed agents when the configured limit requires space. Set max_sub_agents to -1 to remove the limit on simultaneous sub agents.
Sub-agent definition files may specify a model using one of these runtime-resolved values: <weak_model>, <agent_model>, <main_model>, or <current>. Nested delegation is disabled by default; enable allow_nested_delegation to expose Delegate to sub-agents and allow nested child-agent context.
The following context blocks are available and can be customized using include_context_blocks and exclude_context_blocks:
Included by default:
Available when explicitly included:
When include_context_blocks is specified, it replaces the default set. exclude_context_blocks then removes named blocks from that set.
use-enhanced-map: trueComplete configuration example in YAML configuration file (.cecli.conf.yml or ~/.cecli.conf.yml):
# Enable Agent Mode
agent: true
# Agent Mode configuration
agent-config:
# Tool configuration
tools_includelist: ["resourcemanager", "readfile", "yield"]
tools_excludelist: ["command"]
tools_paths: ["./custom-tools", "~/my-tools"]
# Server configuration
servers_includelist: ["local"]
servers_excludelist: []
# Sub-agent configuration
subagent_paths: [".cecli/subagents"]
max_sub_agents: 30 # -1 means effectively unlimited
allow_nested_delegation: false
# Context blocks configuration
include_context_blocks: ["todo_list", "git_status"]
exclude_context_blocks: ["symbol_outline", "directory_structure"]
# Performance and behavior settings
large_file_token_threshold: 8192
command_timeout: 30
skip_cli_confirmations: false
allowed_commands: ["wc -l*"]
show_lint_errors: false
hot_reload: false
diff_colors: true
allow_orchestration: true
# Orchestration sandbox configuration
orchestration:
allowed_imports: []
allowed_builtins: []
allow_classes: false
disable_security: false
disable_loop_protection: false
# Skills configuration
skills_paths: ["~/my-skills", "./project-skills"]
skills_includelist: ["python-refactoring", "react-components"]
skills_excludelist: ["legacy-tools"]
skills_init: ["python-refactoring"]
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.
Agent Mode includes a powerful skills system that allows you to extend the AI's capabilities with custom instructions, reference materials, scripts, and assets. Skills are configured through the agent-config parameter in the YAML configuration file.
Skills can be configured to load automatically on startup using the skills_init option, which accepts a list of skill names that will be both loaded (included in context) and whitelisted (made discoverable) when the agent starts:
agent-config:
skills_init: ["python-refactoring"]For complete documentation on creating and using skills, including skill directory structure, SKILL.md format, and best practices, see the Skills documentation.
Agent Mode represents a significant evolution in cecli's capabilities, enabling more sophisticated and autonomous codebase manipulation while maintaining safety and control through the tool-based architecture.
| Back | FazBrowse Home | New Git URL |