@@ -9,18 +9,22 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
99- ` task build ` - Build the application binary
1010- ` task test ` - Run Go tests
1111- ` task lint ` - Run golangci-lint
12+ - ` task format ` - Format code
1213- ` task link ` - Create symlink to ~ /bin for easy access
1314
1415### Docker Operations
1516
1617- ` task build-image ` - Build Docker image
18+ - ` task push-image ` - Build and push Docker image
1719- ` task build-local ` - Build binaries for local platform using Docker
1820- ` task cross ` - Build cross-platform binaries using Docker
1921
2022### Running cagent
2123
22- - ` ./bin/cagent run <config.yaml> ` - Run agent with configuration
24+ - ` ./bin/cagent run <config.yaml> ` - Run agent with configuration (uses TUI by default)
25+ - ` ./bin/cagent run <config.yaml> --tui=false ` - Run in CLI mode
2326- ` ./bin/cagent run <config.yaml> -a <agent_name> ` - Run specific agent
27+ - ` ./bin/cagent exec <config.yaml> ` - Execute agent without TUI
2428
2529### Single Test Execution
2630
@@ -47,20 +51,21 @@ cagent is a multi-agent AI system with hierarchical agent structure and pluggabl
4751- ** Tool execution** : Handles tool calls and coordinates between agents and external tools
4852- ** Session management** : Maintains conversation state and message history
4953- ** Task delegation** : Routes tasks between agents using transfer_task tool
54+ - ** Remote runtime support** : Can connect to remote runtime servers
5055
5156#### Configuration System (` pkg/config/ ` )
5257
5358- ** YAML-based configuration** : Declarative agent, model, and tool definitions
54- - ** Agent properties** : name, model, description, instruction, sub_agents, toolsets, think, todo, memory, add_date, add_environment_info
55- - ** Model providers** : openai, anthropic, dmr with configurable parameters
56- - ** Tool configuration** : MCP tools (local stdio and remote), builtin tools (filesystem, shell)
59+ - ** Agent properties** : name, model, description, instruction, sub_agents, toolsets, add_date, add_environment_info, code_mode_tools, max_iterations, num_history_items
60+ - ** Model providers** : openai, anthropic, gemini, dmr with configurable parameters
61+ - ** Tool configuration** : MCP tools (local stdio and remote), builtin tools (filesystem, shell, think, todo, memory, etc. )
5762
5863#### Command Layer (` cmd/root/ ` )
5964
60- - ** Multiple interfaces** : CLI (` run.go ` ), TUI (` tui.go ` ), API (` api.go ` )
61- - ** Interactive commands** : ` /exit ` , ` /reset ` , ` /eval ` during sessions
65+ - ** Multiple interfaces** : CLI (` run.go ` ), TUI (default for ` run ` command ), API (` api.go ` )
66+ - ** Interactive commands** : ` /exit ` , ` /reset ` , ` /eval ` , ` /usage ` , ` /compact ` during sessions
6267- ** Debug support** : ` --debug ` flag for detailed logging
63- - ** MCP server mode** : SSE-based transport for external MCP clients like Claude Code
68+ - ** Gateway mode** : SSE-based transport for external MCP clients like Claude Code
6469
6570### Tool System (` pkg/tools/ ` )
6671
@@ -72,21 +77,26 @@ cagent is a multi-agent AI system with hierarchical agent structure and pluggabl
7277- ** transfer_task** : Agent-to-agent task delegation
7378- ** filesystem** : File operations
7479- ** shell** : Command execution
80+ - ** script** : Custom shell scripts
81+ - ** fetch** : HTTP requests
7582
7683#### MCP Integration
7784
7885- ** Local MCP servers** : stdio-based tools via command execution
7986- ** Remote MCP servers** : SSE/streamable transport for remote tools
87+ - ** Docker-based MCP** : Reference MCP servers from Docker images (e.g., ` docker:github-official ` )
8088- ** Tool filtering** : Optional tool whitelisting per agent
8189
8290### Key Patterns
8391
8492#### Agent Configuration
8593
8694``` yaml
95+ version : " 2"
96+
8797agents :
8898 root :
89- model : model_ref
99+ model : model_ref # Can be inline like "openai/gpt-4o" or reference defined models
90100 description : purpose
91101 instruction : detailed_behavior
92102 sub_agents : [list]
@@ -95,8 +105,14 @@ agents:
95105 - type : think
96106 - type : todo
97107 - type : memory
98- path : { path: string }
108+ path : ./ path/to/db
99109 - ...
110+
111+ models :
112+ model_ref :
113+ provider : anthropic
114+ model : claude-sonnet-4-0
115+ max_tokens : 64000
100116` ` `
101117
102118#### Task Delegation Flow
@@ -124,7 +140,7 @@ agents:
124140# ## Configuration Validation
125141
126142- All agent references must exist in config
127- - Model references must be defined
143+ - Model references can be inline (e.g., `openai/gpt-4o`) or defined in models section
128144- Tool configurations validated at startup
129145
130146# ## Adding New Features
@@ -134,16 +150,10 @@ agents:
134150- Add configuration support if needed
135151- Consider both CLI and TUI interface impacts, along with API server impacts
136152
137- # ## Key Patterns
138-
139- # ### Agent Reference Formatting
140-
141- - **File agents**: Use relative path from agents directory (e.g., `agent.yaml`)
142- - **Store agents**: Use full Docker image reference with tag (e.g., `user/agent:latest`)
143- - **Explicit agent_ref field**: MCP responses include unambiguous agent reference for tool calls
144-
145153# # Model Provider Configuration Examples
146154
155+ Models can be referenced inline (e.g., `openai/gpt-4o`) or defined explicitly :
156+
147157# ## OpenAI
148158
149159` ` ` yaml
@@ -175,6 +185,15 @@ models:
175185 temperature: 0.5
176186` ` `
177187
188+ # ## DMR
189+
190+ ` ` ` yaml
191+ models:
192+ dmr:
193+ provider: dmr
194+ model: ai/llama3.2
195+ ` ` `
196+
178197# # Tool Configuration Examples
179198
180199# ## Local MCP Server (stdio)
@@ -186,7 +205,7 @@ toolsets:
186205 args: ["-m", "mcp_server"]
187206 tools: ["specific_tool"] # optional filtering
188207 env:
189- - "API_KEY= value"
208+ API_KEY: " value"
190209` ` `
191210
192211# ## Remote MCP Server (SSE)
@@ -201,6 +220,16 @@ toolsets:
201220 Authorization: "Bearer token"
202221` ` `
203222
223+ # ## Docker-based MCP Server
224+
225+ ` ` ` yaml
226+ toolsets:
227+ - type: mcp
228+ ref: docker:github-official
229+ instruction: |
230+ Use these tools to help with GitHub tasks.
231+ ` ` `
232+
204233# ## Memory Tool with Custom Path
205234
206235` ` ` yaml
@@ -209,40 +238,59 @@ toolsets:
209238 path: "./agent_memory.db"
210239` ` `
211240
241+ # ## Shell Tool
242+
243+ ` ` ` yaml
244+ toolsets:
245+ - type: shell
246+ ` ` `
247+
248+ # ## Filesystem Tool
249+
250+ ` ` ` yaml
251+ toolsets:
252+ - type: filesystem
253+ ` ` `
254+
212255# # Common Development Patterns
213256
214257# ## Agent Hierarchy Example
215258
216259` ` ` yaml
260+ version: "2"
261+
217262agents:
218263 root:
219- model: claude
264+ model: anthropic/ claude-sonnet-4-0
220265 description: "Main coordinator"
221266 sub_agents: ["researcher", "writer"]
222267 toolsets:
223268 - type: transfer_task
224269 - type: think
225270
226271 researcher:
227- model: gpt4
272+ model: openai/gpt-4o
228273 description: "Research specialist"
229274 toolsets:
230275 - type: mcp
231- command: "web_search_tool"
276+ ref: docker:search-tools
232277
233278 writer:
234- model: claude
279+ model: anthropic/ claude-sonnet-4-0
235280 description: "Writing specialist"
236281 toolsets:
237282 - type: filesystem
238283 - type: memory
284+ path: ./writer_memory.db
239285` ` `
240286
241287# ## Session Commands During CLI Usage
242288
243289- ` /exit` - End the session
244290- ` /reset` - Clear session history
245- - ` /eval <expression>` - Evaluate expression (debug mode)
291+ - ` /usage` - Show token usage statistics
292+ - ` /compact` - Generate summary and compact session history
293+ - ` /eval` - Save evaluation data
246294
247295# # File Locations and Patterns
248296
@@ -254,29 +302,40 @@ agents:
254302- ` pkg/model/provider/` - AI provider implementations
255303- ` pkg/session/` - Conversation state management
256304- ` pkg/config/` - YAML configuration parsing and validation
257- - ` pkg/mcpserver/` - MCP protocol server implementation
305+ - ` pkg/gateway/` - MCP gateway/server implementation
306+ - ` pkg/tui/` - Terminal User Interface components
307+ - ` pkg/api/` - API server implementation
258308
259309# ## Configuration File Locations
260310
261- - ` examples/config/ ` - Sample agent configurations
311+ - ` examples/` - Sample agent configurations
262312- Root directory - Main project configurations (`Taskfile.yml`, `go.mod`)
263313
264314# ## Environment Variables
265315
266316- ` OPENAI_API_KEY` - OpenAI authentication
267317- ` ANTHROPIC_API_KEY` - Anthropic authentication
268318- ` GOOGLE_API_KEY` - Google/Gemini authentication
269- - ` MCP_SSE_ENDPOINT` - Override MCP test endpoint
319+ - ` TELEMETRY_ENABLED` - Control telemetry (set to false to disable)
320+ - ` CAGENT_HIDE_TELEMETRY_BANNER` - Hide telemetry banner message
321+ - ` CAGENT_HIDE_FEEDBACK_LINK` - Hide feedback link
270322
271323# # Debugging and Troubleshooting
272324
273325# ## Debug Mode
274326
275327- Add `--debug` flag to any command for detailed logging
328+ - Logs written to `~/.cagent/cagent.debug.log` by default
329+ - Use `--log-file <path>` to specify custom log location
276330- Example : ` ./bin/cagent run config.yaml --debug`
277331
332+ # ## OpenTelemetry Tracing
333+
334+ - Add `--otel` flag to enable OpenTelemetry tracing
335+ - Example : ` ./bin/cagent run config.yaml --otel`
336+
278337# ## Common Issues
279338
280339- **Agent not found**: Check agent name matches config file agent definitions
281340- **Tool startup failures**: Verify MCP tool commands and dependencies are available
282- - **Multi-tenant sessions **: Remember all MCP clients currently share sessions
341+ - **Model not found **: Ensure model is defined in config or use inline format (provider/model)
0 commit comments