Skip to content
Merged
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- Fix rollback when there are subagents messages in chat.
- Add Task tool #246

## 0.109.6

Expand Down
18 changes: 18 additions & 0 deletions resources/prompts/code_agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,21 @@ You have tools at your disposal to solve the coding task. Follow these rules reg
2. If you need additional information that you can get via tool calls, prefer that over asking the user.
3. If you are not sure about file content or codebase structure pertaining to the user's request, use your tools to read files and gather the relevant information: do NOT guess or make up an answer.
4. You have the capability to call multiple tools in a single response, batch your tool calls together for optimal performance.

{% if toolEnabled_eca__task %}
## Task Tool

You have access to a `eca__task` tool for tracking multi-step work within this chat.

### Workflow:
1. Use `plan` to create task list with initial tasks
2. Use `start` before working on a task (marks it as in_progress and requires an `active_summary`)
3. Use `complete` only for tasks that are actually finished; for each targeted task, verify its acceptance criteria first.
4. Use `add` if you discover additional work
5. When a plan is fully completed and no further work is needed, always use the `clear` operation to clean up the workspace.
6. When helpful, delegate focused work to subagents. You MAY start multiple independent tasks in parallel (keep the number of in_progress tasks small), then update/complete the task list based on subagent outputs. Prefer that only the main agent updates the task list; subagents should focus on producing outputs.

### Task tracking guidance:
- Make sure to add acceptance criteria inside your task `description`.
- Objective verification of acceptance criteria is required for completion.
{% endif %}
1 change: 1 addition & 0 deletions resources/prompts/compact.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ For technical or coding sessions, cover the following points:
- Key decisions and architectural changes
- Unfinished tasks and next steps
- Technical details that need to be preserved
- Always save task lists if any.

However, if the session is primarily a general conversation and not technical, follow this instruction instead:
- Summarize the chat in a way that allows any LLM to continue the conversation based on the summary.
Expand Down
40 changes: 40 additions & 0 deletions resources/prompts/tools/task.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Task management for planning and tracking work.

When to Use:
- Tasks requiring 3 or more distinct steps
- User provides multiple tasks (numbered lists, comma-separated items)
- Non-trivial work that benefits from planning and tracking
- User explicitly requests task tracking or a todo list

When NOT to Use:
- Single, trivial task completable in very few steps
- Purely informational or conversational queries
- Quick fixes where tracking adds no organizational value

Operations:
- read: View current task list state
- plan: Create/replace task list with initial tasks (required: tasks)
- add: Append task(s) to existing task list
- update: Modify a single task metadata by `id` (subject, description, priority, blocked_by) — cannot change status
- start: Begin work on tasks by `ids` (sets to in_progress; rejects blocked or done tasks). Requires `active_summary` to summarize what you are about to do.
- complete: Mark tasks by `ids` as done (verify acceptance criteria in description first)
- delete: Remove tasks by `ids`
- clear: Reset entire task list (removes all tasks)

Workflow:
1. Use 'plan' to create task list with initial tasks
2. Use 'start' before working on a task — marks it as in_progress and requires an `active_summary`
3. Work sequentially by default. Batch 'start' or 'complete' operations (using multiple 'ids') ONLY for independent tasks being executed simultaneously (e.g., via subagents).
4. Use 'complete' only for tasks that are actually finished; verify acceptance criteria first — the response tells you which tasks got unblocked
5. Use 'add' if you discover additional work during execution
6. When a plan is fully completed and no further work is needed, always use the 'clear' operation to clean up the workspace.

Task Schema:
- `subject`: A brief, actionable title in imperative form (e.g. "Fix login bug")
- `description`: Detailed description of what needs to be done, including context and acceptance criteria

Task Completion Integrity:
- Mark tasks complete as soon as they are finished.
- ONLY mark it as completed when ALL acceptance criteria from the `description` are actually met (for each task in a batch).
- Do NOT complete if: tests failing, implementation partial, or errors unresolved.
- When completing reveals follow-up work, use 'add' to append new tasks.
5 changes: 4 additions & 1 deletion src/eca/config.clj
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
"eca__grep" {}
"eca__editor_diagnostics" {}
"eca__skill" {}
"eca__task" {}
"eca__spawn_agent" {}}
:deny {"eca__shell_command"
{:argsMatchers {"command" dangerous-commands-regexes}}}}}}
Expand All @@ -132,7 +133,8 @@
"eca__directory_tree" {}
"eca__grep" {}
"eca__editor_diagnostics" {}
"eca__skill" {}}
"eca__skill" {}
"eca__task" {}}
:deny {"eca__shell_command"
{:argsMatchers {"command" dangerous-commands-regexes}}}}}}
"general" {:mode "subagent"
Expand Down Expand Up @@ -160,6 +162,7 @@
"eca__grep" {}
"eca__editor_diagnostics" {}
"eca__skill" {}
"eca__task" {}
"eca__spawn_agent" {}}
:ask {}
:deny {}}
Expand Down
8 changes: 8 additions & 0 deletions src/eca/db.clj
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@
:messages [{:role (or "user" "assistant" "tool_call" "tool_call_output" "reason")
:content (or :string [::any-map]) ;; string for simple text, map/vector for structured content
:content-id :string}]
:task {:next-id :number
:active-summary (or :string nil)
:tasks [{:id :number
:subject :string
:description :string
:status (or :pending :in-progress :done)
:priority (or :high :medium :low)
:blocked-by #{:number}}]}
:tool-calls {"<tool-call-id>"
{:status (or :initial :preparing :check-approval :waiting-approval
:execution-approved :executing :rejected :cleanup
Expand Down
2 changes: 1 addition & 1 deletion src/eca/features/chat.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1824,7 +1824,7 @@
(fn [chat]
(cond-> chat
messages (-> (assoc :messages [])
(dissoc :tool-calls :last-api :usage)))))
(dissoc :tool-calls :last-api :usage :task)))))
(db/update-workspaces-cache! @db* metrics)))

(defn rollback-chat
Expand Down
8 changes: 6 additions & 2 deletions src/eca/features/tools.clj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
[eca.features.tools.mcp.clojure-mcp]
[eca.features.tools.shell :as f.tools.shell]
[eca.features.tools.skill :as f.tools.skill]
[eca.features.tools.task :as f.tools.task]
[eca.features.tools.util :as tools.util]
[eca.logger :as logger]
[eca.messenger :as messenger]
Expand Down Expand Up @@ -148,6 +149,7 @@
f.tools.editor/definitions
f.tools.chat/definitions
f.tools.skill/definitions
f.tools.task/definitions
(f.tools.agent/definitions config)
(f.tools.custom/definitions config))))

Expand All @@ -156,9 +158,11 @@

(defn ^:private filter-subagent-tools
"Filter tools for subagent execution.
Excludes spawn_agent to prevent nesting."

- Excludes spawn_agent to prevent nesting.
- Excludes task because task list state is currently chat-local; it should be managed by the parent agent."
[tools]
(filterv #(not= "spawn_agent" (:name %)) tools))
(filterv #(not (contains? #{"spawn_agent" "task"} (:name %))) tools))

(defn all-tools
"Returns all available tools, including both native ECA tools
Expand Down
Loading
Loading