Skip to content

Commit 1c14b55

Browse files
committed
add 2 subagents
1 parent 011750d commit 1c14b55

File tree

4 files changed

+52
-14
lines changed

4 files changed

+52
-14
lines changed

docs/config/agents.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ There are 2 types of agents defined via `mode` field (when absent, defaults to p
99

1010
## Built-in agents
1111

12-
- `code`: default primary agent, generic, used to do most tasks.
13-
- `plan`: specialized primary agent to build a plan before switching to code agent and executing the complex task.
12+
| name | mode | description |
13+
|--------------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
14+
| __code__ | primary | Default, generic, used to do most tasks, has access to all tools by default |
15+
| __plan__ | primary | Specialized in building a plan before user switches to code agent and executes the complex task. Has no edit tools available, only preview changes. |
16+
| __explorer__ | subagent | Fast agent specialized for exploring codebases. Finds files by patterns, searches code for keywords, or answers questions about the codebase. Read-only, no edit tools. |
17+
| __general__ | subagent | General-purpose agent for researching complex questions and executing multi-step tasks. Can be used to execute multiple units of work in parallel. |
1418

1519
## Custom agents and prompts
1620

@@ -46,7 +50,7 @@ You can create an agent and define its prompt, tool call approval and default mo
4650

4751
ECA can spawn foreground subagents in a chat, they are agents which `mode` is `subagent`.
4852

49-
Subagents can be configured in config or markdown and require `description` and `prompt` (or markdown content):
53+
Subagents can be configured in config or markdown and require `description` and `systemPrompt` (or markdown content):
5054

5155
=== "Markdown"
5256

resources/META-INF/native-image/eca/eca/native-image.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Args=-J-Dborkdude.dynaload.aot=true \
1717
-H:IncludeResources=ECA_VERSION \
1818
-H:IncludeResources=prompts/plan_agent.md \
1919
-H:IncludeResources=prompts/code_agent.md \
20+
-H:IncludeResources=prompts/explorer_agent.md \
2021
-H:IncludeResources=prompts/additional_system_info.md \
2122
-H:IncludeResources=prompts/init.md \
2223
-H:IncludeResources=prompts/skill_create.md \

resources/prompts/explorer.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
You are a file search specialist. You excel at thoroughly navigating and exploring codebases.
2+
3+
Your strengths:
4+
- Rapidly finding files using glob patterns
5+
- Searching code and text with powerful regex patterns
6+
- Reading and analyzing file contents
7+
8+
Guidelines:
9+
- Return file paths as absolute paths in your final response
10+
- For clear communication, avoid using emojis
11+
- Adapt your search approach based on the thoroughness level specified by the caller
12+
- Do not create any files, or run bash commands that modify the user's system state in any way
13+
14+
Complete the user's search request efficiently and report your findings clearly.
15+

src/eca/config.clj

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@
4040
(defn get-env [env] (System/getenv env))
4141
(defn get-property [property] (System/getProperty property))
4242

43+
(def ^:private dangerous-commands-regexes
44+
["[12&]?>>?\\s*(?!/dev/null($|\\s))\\S+"
45+
".*>.*",
46+
".*\\|\\s*(tee|dd|xargs).*",
47+
".*\\b(sed|awk|perl)\\s+.*-i.*",
48+
".*\\b(rm|mv|cp|touch|mkdir)\\b.*",
49+
".*git\\s+(add|commit|push).*",
50+
".*npm\\s+install.*",
51+
".*-c\\s+[\"'].*open.*[\"']w[\"'].*",
52+
".*bash.*-c.*>.*"])
53+
4354
(def ^:private initial-config*
4455
{:providers {"openai" {:api "openai-responses"
4556
:url "${env:OPENAI_API_URL:https://api.openai.com}"
@@ -66,10 +77,10 @@
6677
:models {"gemini-2.5-pro" {}}}
6778
"ollama" {:url "${env:OLLAMA_API_URL:http://localhost:11434}"}}
6879
:defaultAgent "code"
69-
:agent {"code" {:mode :primary
80+
:agent {"code" {:mode "primary"
7081
:prompts {:chat "${classpath:prompts/code_agent.md}"}
7182
:disabledTools ["preview_file_change"]}
72-
"plan" {:mode :primary
83+
"plan" {:mode "primary"
7384
:prompts {:chat "${classpath:prompts/plan_agent.md}"}
7485
:disabledTools ["edit_file" "write_file" "move_file"]
7586
:toolCall {:approval {:allow {"eca__shell_command"
@@ -79,15 +90,22 @@
7990
"eca__read_file" {}
8091
"eca__directory_tree" {}}
8192
:deny {"eca__shell_command"
82-
{:argsMatchers {"command" ["[12&]?>>?\\s*(?!/dev/null($|\\s))\\S+"
83-
".*>.*",
84-
".*\\|\\s*(tee|dd|xargs).*",
85-
".*\\b(sed|awk|perl)\\s+.*-i.*",
86-
".*\\b(rm|mv|cp|touch|mkdir)\\b.*",
87-
".*git\\s+(add|commit|push).*",
88-
".*npm\\s+install.*",
89-
".*-c\\s+[\"'].*open.*[\"']w[\"'].*",
90-
".*bash.*-c.*>.*"]}}}}}}}
93+
{:argsMatchers {"command" dangerous-commands-regexes}}}}}}
94+
"explorer" {:mode "subagent"
95+
:description "Fast agent specialized for exploring codebases. Use this when you need to quickly find files by patterns, search code for keywords, or answer questions about the codebase."
96+
:systemPrompt "${classpath:prompts/explorer_agent.md}"
97+
:disabledTools ["edit_file" "write_file" "move_file" "preview_file_change"]
98+
:toolCall {:approval {:allow {"eca__shell_command"
99+
{:argsMatchers {"command" ["pwd"]}}
100+
"eca__grep" {}
101+
"eca__read_file" {}
102+
"eca__directory_tree" {}}
103+
:deny {"eca__shell_command"
104+
{:argsMatchers {"command" dangerous-commands-regexes}}}}}}
105+
"general" {:mode "subagent"
106+
:description "General-purpose agent for researching complex questions and executing multi-step tasks. Use this agent to execute multiple units of work in parallel."
107+
:systemPrompt "${classpath:prompts/code_agent.md}"
108+
:disabledTools ["preview_file_change"]}}
91109
:defaultModel nil
92110
:prompts {:chat "${classpath:prompts/code_agent.md}" ;; default to code agent
93111
:chatTitle "${classpath:prompts/title.md}"

0 commit comments

Comments
 (0)