feat: add plans for bot tools, memory, interaction, avatar editing, and cron scheduling
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
# Plan: Interacción entre bots en una sala compartida
|
||||
|
||||
## Objetivo
|
||||
Que múltiples bots convivan en una sala Matrix, se "escuchen" entre sí y puedan
|
||||
colaborar en tareas — sin crear bucles infinitos.
|
||||
|
||||
## Estado: pendiente
|
||||
|
||||
---
|
||||
|
||||
## Problema central: evitar bucles
|
||||
Si bot-A responde a bot-B y bot-B responde a bot-A, se genera un bucle.
|
||||
|
||||
### Solución: reglas de anti-bucle en el motor de decisión
|
||||
1. Cada mensaje lleva metadatos `sender` y opcionalmente `m.relates_to`
|
||||
2. El `MatchFunc` de las reglas puede filtrar por `IsBot(sender)` y
|
||||
aplicar lógica de cooldown o turno
|
||||
3. El sistema de bus interno (`shell/bus/`) puede coordinar turnos
|
||||
|
||||
---
|
||||
|
||||
## Diseño
|
||||
|
||||
### Nuevo tipo de sala: `SharedRoom`
|
||||
Configurar en `config.yaml` bajo una sección `rooms`:
|
||||
```yaml
|
||||
rooms:
|
||||
- id: "!roomid:matrix.server.com"
|
||||
type: "shared" # sala compartida entre bots
|
||||
participants: # agentes que participan
|
||||
- assistant-bot
|
||||
- devops-bot
|
||||
turn_based: false # si true, los bots se turnan por ronda
|
||||
respond_to_bots: true # si false, solo responden a humanos
|
||||
```
|
||||
|
||||
### Lógica en `agents/runtime.go`
|
||||
- Al recibir un evento en una sala compartida, verificar si `sender` es un bot conocido
|
||||
- Aplicar una regla de "bot puede responder a bot" solo si:
|
||||
- La sala tiene `respond_to_bots: true`
|
||||
- No hay respuesta pendiente del mismo bot en los últimos N segundos (cooldown)
|
||||
- No es una respuesta a un mensaje propio
|
||||
|
||||
### Coordinación con el bus (`shell/bus/`)
|
||||
- Publicar en el bus interno cuando un bot habla en una sala compartida
|
||||
- Los otros bots suscritos al bus pueden reaccionar sin pasar por Matrix
|
||||
- Posible uso: bot-A pide ayuda a bot-B por el bus, bot-B responde en Matrix
|
||||
|
||||
---
|
||||
|
||||
## Reglas puras (`pkg/decision/`)
|
||||
Nuevas funciones de match:
|
||||
```go
|
||||
func SenderIsBot(knownBots []string) MatchFunc
|
||||
func NotRepliedRecently(cooldown time.Duration) MatchFunc // requiere estado externo
|
||||
func SenderIsHuman(knownBots []string) MatchFunc
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Anti-bucle: cooldown simple
|
||||
En `agents/runtime.go` mantener `map[roomID]time.Time` con el último mensaje enviado.
|
||||
Si `now - lastSent < cooldown`, no responder en esa sala.
|
||||
Cooldown configurable: `rooms[].response_cooldown_seconds`.
|
||||
|
||||
---
|
||||
|
||||
## Archivos a crear/modificar
|
||||
- `internal/config/schema.go` — añadir `RoomCfg` con campos shared room
|
||||
- `pkg/decision/matchers.go` — SenderIsBot, SenderIsHuman
|
||||
- `agents/runtime.go` — lógica de salas compartidas y cooldown
|
||||
- `shell/bus/bus.go` — publicar eventos cross-bot
|
||||
- `agents/<id>/agent.go` — reglas específicas para salas compartidas
|
||||
|
||||
## Notas
|
||||
- Fase 1: solo cooldown simple — un bot no responde más de 1 vez por minuto en
|
||||
una sala compartida
|
||||
- Fase 2: turno basado en bus interno
|
||||
- Fase 3: colaboración estructurada (bot-A delega tarea a bot-B y espera resultado)
|
||||
Reference in New Issue
Block a user