69607b3a65
Implementa una base de conocimiento persistente por agente siguiendo el patrón pure core / impure shell: - pkg/knowledge/: tipos puros (Document, Store interface) - shell/knowledge/: FileStore con SQLite para indexación y archivos .md - tools/knowledge.go: 4 tools LLM (search, read, write, list) - tools/knowledge_test.go: tests unitarios de las tools - internal/config/schema.go: nuevo KnowledgeToolCfg en ToolsCfg - agents/runtime.go: inicialización del store y registro de tools - agents/*/knowledge/about-me.md: documentos semilla para cada agente Cada agente puede buscar, leer, crear y actualizar documentos de conocimiento. Los archivos .md viven en agents/<id>/knowledge/ y se indexan en SQLite (agents/<id>/data/knowledge.db). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
26 lines
726 B
Go
26 lines
726 B
Go
package knowledge
|
|
|
|
import "context"
|
|
|
|
// Store is the pure interface for knowledge operations.
|
|
// Implemented by shell/knowledge.
|
|
type Store interface {
|
|
// Search performs full-text search across all documents.
|
|
Search(ctx context.Context, query string, limit int) ([]SearchResult, error)
|
|
|
|
// Get retrieves a document by slug.
|
|
Get(ctx context.Context, slug string) (*Document, error)
|
|
|
|
// Put creates or updates a document (file + index).
|
|
Put(ctx context.Context, doc Document) error
|
|
|
|
// List returns all document slugs with titles.
|
|
List(ctx context.Context) ([]Document, error)
|
|
|
|
// Sync re-indexes all files from disk. Called on startup.
|
|
Sync(ctx context.Context) error
|
|
|
|
// Close releases resources.
|
|
Close() error
|
|
}
|