Documentation
¶
Overview ¶
Package knowledge provides embedded platform knowledge for LLM prompt construction.
Index ¶
- func Embedded() (base, challenges, platform, apis string)
- func GeneratePrompt(preset Preset, answerTexts []string) string
- func GenerationSystemPrompt() string
- func LoadSoul(apiKey string) (string, error)
- func PresetIDs() []string
- func ResetSoul() error
- func SaveSoul(apiKey, content string) error
- func SoulExists() bool
- func SoulPath() string
- func ValidateGenerated(text string) (string, bool)
- type Knowledge
- type Option
- type Preset
- type Question
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Embedded ¶
func Embedded() (base, challenges, platform, apis string)
Embedded returns the raw embedded documents for inspection.
func GeneratePrompt ¶
GeneratePrompt builds the LLM prompt for personalizing a soul template.
func GenerationSystemPrompt ¶
func GenerationSystemPrompt() string
GenerationSystemPrompt returns a lightweight system prompt for soul generation LLM calls.
func LoadSoul ¶
LoadSoul reads and decrypts the soul file. Returns ("", nil) if the file does not exist. Returns error if the file is corrupted, tampered with, or the API key is wrong. Legacy plaintext files are automatically encrypted in place on first load.
func SoulExists ¶
func SoulExists() bool
SoulExists checks if a soul file exists (without decrypting).
func ValidateGenerated ¶
ValidateGenerated checks if LLM output is usable as a soul description. Returns cleaned text and true if valid, or empty and false if not.
Types ¶
type Knowledge ¶
type Knowledge struct {
Base string // core behavioral rules (embedded)
Challenges string // challenge verification rules (embedded)
Platform string // platform quality standards (embedded)
APIs string // platform API reference (embedded)
Soul string // agent personality (from ~/.clawwork/soul.md, may be empty)
// SpecVersion tracks the last seen server spec version for change detection.
SpecVersion string
SpecHash string
}
Knowledge holds platform knowledge for building enhanced LLM system prompts.
func (*Knowledge) CheckSpecUpdate ¶
CheckSpecUpdate detects if the server's spec version has changed. Returns true and a message if an update is detected.
func (*Knowledge) SystemPrompt ¶
SystemPrompt builds the full system prompt from all knowledge layers. Structure: base rules → personality (if set) → challenge rules → platform rules.
type Option ¶
type Option struct {
Key string // "A", "B", "C", "D"
Text string // display text
Weights map[string]int // preset_id -> score increment
}
Option is one answer choice with weighted scores toward presets.
type Preset ¶
Preset is a built-in soul personality.
func ListPresets ¶
func ListPresets() []Preset
ListPresets returns all available soul presets in order.
func ScoreAnswers ¶
ScoreAnswers maps selected option indices (0-3 for A-D) to the best preset.