Files
goclaw/internal/bootstrap/load_store.go
T
Viet Tran f3f4c67b36 Initial commit: GoClaw AI agent gateway
Multi-agent AI gateway with WebSocket RPC, HTTP API, and messaging channel integrations.
Go port of OpenClaw with multi-tenant PostgreSQL, per-user isolation, security hardening,
and production observability.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 14:58:07 +07:00

35 lines
844 B
Go

package bootstrap
import (
"context"
"log/slog"
"github.com/google/uuid"
"github.com/nextlevelbuilder/goclaw/internal/store"
)
// LoadFromStore loads agent-level context files from the agent store (DB).
// Returns files as ContextFile slice ready for system prompt injection.
// Returns nil if no files found or on error.
func LoadFromStore(ctx context.Context, agentStore store.AgentStore, agentID uuid.UUID) []ContextFile {
files, err := agentStore.GetAgentContextFiles(ctx, agentID)
if err != nil {
slog.Warn("failed to load context files from store", "agent", agentID, "error", err)
return nil
}
var contextFiles []ContextFile
for _, f := range files {
if f.Content == "" {
continue
}
contextFiles = append(contextFiles, ContextFile{
Path: f.FileName,
Content: f.Content,
})
}
return contextFiles
}