docs: crear issue 0047 — system prompt no se carga para _specials
El runtime resuelve system_prompt_file como agents/<id>/prompts/... pero los agentes especiales viven en agents/_specials/<id>/. Esto causa que Father Bot opere sin su system prompt completo de 369 lineas. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
# 0047 — System prompt no se carga para agentes en _specials/
|
||||
|
||||
## Objetivo
|
||||
|
||||
El runtime resuelve la ruta del `system_prompt_file` como `agents/<agent-id>/prompts/system.md`,
|
||||
pero los agentes especiales (Father Bot, etc.) viven en `agents/_specials/<agent-id>/`. Resultado:
|
||||
el system prompt no se carga y el agente usa solo la `description` como prompt.
|
||||
|
||||
## Contexto
|
||||
|
||||
En `devagents/llm.go:33`, la ruta se construye asi:
|
||||
|
||||
```go
|
||||
spPath := filepath.Join("agents", a.cfg.Agent.ID, spFile)
|
||||
```
|
||||
|
||||
Esto produce `agents/father-bot/prompts/system.md` para Father Bot, pero el archivo real esta en
|
||||
`agents/_specials/father-bot/prompts/system.md`.
|
||||
|
||||
Los logs confirman el problema:
|
||||
```json
|
||||
{"msg":"failed to load system_prompt_file, using description","path":"agents/father-bot/prompts/system.md"}
|
||||
```
|
||||
|
||||
**Impacto**: Father Bot opera sin su system prompt completo (369 lineas de instrucciones, pipeline,
|
||||
seguridad) y solo usa la description de una linea del config.yaml. Esto degrada severamente su
|
||||
comportamiento.
|
||||
|
||||
## Arquitectura
|
||||
|
||||
- `internal/config/schema.go` — MODIFICAR: agregar campo `ConfigDir` a `AgentConfig`
|
||||
- `internal/config/loader.go` — MODIFICAR: poblar `ConfigDir` con el directorio del config
|
||||
- `devagents/llm.go` — MODIFICAR: usar `ConfigDir` en vez de hardcodear `agents/<id>`
|
||||
|
||||
No hay cambios en `pkg/` (puro). Los cambios son en el loader (impuro) y runtime (impuro).
|
||||
|
||||
## Tareas
|
||||
|
||||
### Fase 1: Fix
|
||||
|
||||
- [ ] 1.1 Agregar campo `ConfigDir string` (no YAML, solo runtime) a `AgentConfig`
|
||||
- [ ] 1.2 En `config.Load()`, poblar `ConfigDir` con `filepath.Dir(path)`
|
||||
- [ ] 1.3 En `devagents/llm.go`, usar `a.cfg.ConfigDir` para resolver `system_prompt_file`
|
||||
|
||||
### Fase 2: Tests
|
||||
|
||||
- [ ] 2.1 Test unitario que verifica que `Load()` puebla `ConfigDir`
|
||||
- [ ] 2.2 `go build -tags goolm ./...` compila sin errores
|
||||
- [ ] 2.3 `go test -tags goolm ./...` pasa sin errores
|
||||
|
||||
### Fase 3: Docs
|
||||
|
||||
- [ ] 3.1 Cerrar issue, mover a completed
|
||||
|
||||
## Ejemplo de uso
|
||||
|
||||
Antes (roto):
|
||||
```
|
||||
config en: agents/_specials/father-bot/config.yaml
|
||||
system_prompt_file: prompts/system.md
|
||||
resuelve: agents/father-bot/prompts/system.md ← NO EXISTE
|
||||
resultado: usa description como fallback
|
||||
```
|
||||
|
||||
Despues (correcto):
|
||||
```
|
||||
config en: agents/_specials/father-bot/config.yaml
|
||||
ConfigDir: agents/_specials/father-bot
|
||||
system_prompt_file: prompts/system.md
|
||||
resuelve: agents/_specials/father-bot/prompts/system.md ← CORRECTO
|
||||
```
|
||||
|
||||
## Decisiones de diseno
|
||||
|
||||
1. **`ConfigDir` como campo runtime**: no se serializa en YAML (`yaml:"-"`), se puebla
|
||||
automaticamente por el loader. Cero impacto en configs existentes.
|
||||
2. **Genérico**: el fix funciona para cualquier agente en cualquier ubicacion, no solo _specials.
|
||||
|
||||
## Riesgos
|
||||
|
||||
- Bajo riesgo: cambio minimo y auto-contenido. El campo nuevo es backward-compatible.
|
||||
@@ -57,3 +57,4 @@ afectados y notas de implementacion.
|
||||
| 44 | Formalizar pipeline de creacion de agentes | [0044-formalize-agent-creation-pipeline.md](completed/0044-formalize-agent-creation-pipeline.md) | completado |
|
||||
| 45 | DM rooms sin E2EE en notify-developer.sh | [0045-notify-encrypted-rooms.md](completed/0045-notify-encrypted-rooms.md) | completado |
|
||||
| 46 | Progreso en tiempo real para Father Bot | [0046-father-bot-progress.md](completed/0046-father-bot-progress.md) | completado |
|
||||
| 47 | System prompt no se carga para agentes en _specials/ | [0047-fix-system-prompt-path.md](0047-fix-system-prompt-path.md) | pendiente |
|
||||
|
||||
Reference in New Issue
Block a user