Skip to content

Auto-clear completed task lists on new prompt#512

Merged
zikajk merged 1 commit into
masterfrom
clear-completed-task-list-with-next-user-prompt
Jun 23, 2026
Merged

Auto-clear completed task lists on new prompt#512
zikajk merged 1 commit into
masterfrom
clear-completed-task-list-with-next-user-prompt

Conversation

@zikajk

@zikajk zikajk commented Jun 22, 2026

Copy link
Copy Markdown
Member

When a new prompt is sent and all tasks in the task list are done, automatically clear the list so the model starts fresh. The cleared state is sent to the client as a synthetic toolCalled event, reusing the existing task-details rendering path. No protocol or client changes.

  • I added a entry in changelog under unreleased section.
  • This is not an AI slop.

When a new prompt is sent and all tasks in the task list are done,
automatically clear the list so the model starts fresh. The cleared
state is sent to the client as a synthetic toolCalled event, reusing
the existing task-details rendering path. No protocol or client changes.
@zikajk zikajk force-pushed the clear-completed-task-list-with-next-user-prompt branch from d119c43 to f98c228 Compare June 22, 2026 19:05
@zikajk zikajk requested a review from Copilot June 23, 2026 06:06
@zikajk zikajk merged commit e90f733 into master Jun 23, 2026
10 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements automatic task-list cleanup at the start of a new chat prompt: if the current task list exists and all tasks are :done, the server clears the task state and emits a synthetic toolCalled event so clients re-render via the existing task-details UI path (no client changes intended).

Changes:

  • Add task/auto-clear-completed! plus tests for when auto-clear should/shouldn’t trigger.
  • Invoke auto-clear during chat/prompt and emit a synthetic :toolCalled event to clients.
  • Update the task tool prompt guidance and add an Unreleased changelog entry.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/eca/features/tools/task.clj Adds auto-clear detection + mutation for fully-completed task lists.
src/eca/features/chat.clj Calls auto-clear before prompt* and sends a synthetic toolCalled event with task details.
test/eca/features/tools/task_test.clj Adds unit tests covering auto-clear behavior across done/pending/in-progress/empty/no-task-list cases.
resources/prompts/tools/task.md Removes instruction telling the model to manually clear when all tasks are done.
CHANGELOG.md Documents the new auto-clear behavior under Unreleased.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +268 to +274
(defn auto-clear-completed!
"Clear the task list when all tasks are done.
Returns task-details of the cleared state if clearing occurred, nil otherwise."
[db* chat-id]
(when (all-tasks-done? (get-task @db* chat-id))
(mutate-task! db* chat-id (fn [_] {:state empty-task}))
(task-details empty-task)))
Comment thread src/eca/features/chat.clj
Comment on lines +1657 to +1663
(when-let [cleared-details (f.tools.task/auto-clear-completed! db* chat-id)]
(logger/info logger-tag "Auto-cleared completed task list" {:chat-id chat-id})
(lifecycle/send-content! base-chat-ctx :assistant
{:type :toolCalled
:server "eca"
:name "task"
:details cleared-details}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants