Files
LocalAGI/cmd
Ettore Di Giacinto f6366af5e8 feat(scheduler): stop an agent duplicating its own tasks
An agent with a task-creating tool re-creates the same reminder on
every run. One deployment reached 6,399 tasks for a single agent, and
4,734 of them (74%) were byte-identical in both prompt and schedule.

CreateTask now returns the task that is scheduled, which is the
existing one when an equivalent task is already set. The caller sees a
success either way. An error would invite the model to retry with
different wording, and that agent already held seven phrasings of one
reminder.

Tasks match on agent, schedule type, schedule value and a normalised
prompt: lowercased, with whitespace collapsed and punctuation dropped.
Reworded prompts stay distinct. Merging prompts that differ in their
words risks dropping a task somebody meant to schedule, so a per-agent
ceiling bounds that case instead. At the ceiling, creation fails with a
message naming list_tasks and remove_task so the agent can free room
itself. A duplicate consumes no room and is never refused.

Dedupe is on by default with a ceiling of 100 tasks per agent.
LOCALAGI_SCHEDULER_DEDUPE_TASKS and
LOCALAGI_SCHEDULER_MAX_TASKS_PER_AGENT tune them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KZaoEXfGsjmkhXtVxtvPp4
2026-08-24 19:34:12 +00:00
..