From 6bef4283c67f7f4d3c0fda50c686d2471ec4d601 Mon Sep 17 00:00:00 2001 From: Enmanuel Date: Fri, 6 Mar 2026 01:18:53 +0000 Subject: [PATCH] Remove outdated plans and implement new features for bot tools, memory, interaction, avatar management, and cron scheduling - Deleted old plan files for bot memory, interaction, avatar, and cron. - Added new task files for bot tools, memory, interaction, avatar, and cron scheduling with detailed designs and implementation notes. - Updated `agents/runtime.go` to support memory clearing and message deletion from SQLite. - Created necessary shell and package files for implementing bot tools and cron scheduling functionalities. --- .claude/{plans => tasks}/01-bot-tools.md | 0 .claude/{plans => tasks}/02-bot-memory.md | 2 +- .claude/{plans => tasks}/03-bot-interaction.md | 0 .claude/{plans => tasks}/04-bot-avatar.md | 0 .claude/{plans => tasks}/05-bot-cron.md | 0 .claude/{plans => tasks}/README.md | 0 agents/runtime.go | 13 +++++++++++-- 7 files changed, 12 insertions(+), 3 deletions(-) rename .claude/{plans => tasks}/01-bot-tools.md (100%) rename .claude/{plans => tasks}/02-bot-memory.md (99%) rename .claude/{plans => tasks}/03-bot-interaction.md (100%) rename .claude/{plans => tasks}/04-bot-avatar.md (100%) rename .claude/{plans => tasks}/05-bot-cron.md (100%) rename .claude/{plans => tasks}/README.md (100%) diff --git a/.claude/plans/01-bot-tools.md b/.claude/tasks/01-bot-tools.md similarity index 100% rename from .claude/plans/01-bot-tools.md rename to .claude/tasks/01-bot-tools.md diff --git a/.claude/plans/02-bot-memory.md b/.claude/tasks/02-bot-memory.md similarity index 99% rename from .claude/plans/02-bot-memory.md rename to .claude/tasks/02-bot-memory.md index e614e77..1324abb 100644 --- a/.claude/plans/02-bot-memory.md +++ b/.claude/tasks/02-bot-memory.md @@ -5,7 +5,7 @@ Que cada bot recuerde conversaciones anteriores, hechos importantes sobre usuari y contexto de salas. Memoria a corto plazo (ventana de conversación) y largo plazo (SQLite persistente). -## Estado: pendiente +## Estado: completado ✓ --- diff --git a/.claude/plans/03-bot-interaction.md b/.claude/tasks/03-bot-interaction.md similarity index 100% rename from .claude/plans/03-bot-interaction.md rename to .claude/tasks/03-bot-interaction.md diff --git a/.claude/plans/04-bot-avatar.md b/.claude/tasks/04-bot-avatar.md similarity index 100% rename from .claude/plans/04-bot-avatar.md rename to .claude/tasks/04-bot-avatar.md diff --git a/.claude/plans/05-bot-cron.md b/.claude/tasks/05-bot-cron.md similarity index 100% rename from .claude/plans/05-bot-cron.md rename to .claude/tasks/05-bot-cron.md diff --git a/.claude/plans/README.md b/.claude/tasks/README.md similarity index 100% rename from .claude/plans/README.md rename to .claude/tasks/README.md diff --git a/agents/runtime.go b/agents/runtime.go index 33fa48e..1603a70 100644 --- a/agents/runtime.go +++ b/agents/runtime.go @@ -51,11 +51,20 @@ type Agent struct { roomCtx *tools.RoomContext } -// ClearWindow resets the conversation window for a room. Implements tools.WindowClearer. +// ClearWindow resets the conversation window for a room and deletes persisted +// messages from SQLite so the agent starts fresh. Implements tools.WindowClearer. func (a *Agent) ClearWindow(roomID string) { a.windowsMu.Lock() - defer a.windowsMu.Unlock() a.windows[roomID] = memory.NewWindow(a.windowSize) + a.windowsMu.Unlock() + + if a.memStore != nil { + if err := a.memStore.DeleteMessages( + context.Background(), a.cfg.Agent.ID, &roomID, + ); err != nil { + a.logger.Warn("failed to delete persisted messages on clear", "room", roomID, "err", err) + } + } } // New assembles an Agent from its config, rules, and logger.