Documentation
¶
Overview ¶
Package knowledge is the agent's persistent memory: a JSON-backed store of Pitfalls (lessons) it has learned. It is the mechanism that lets the agent actually remember experience across restarts — the store is read on startup and written after each task's reflection pass.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KB ¶
type KB struct {
// contains filtered or unexported fields
}
KB is an in-memory view of the pitfall store plus its backing file path.
func (*KB) Add ¶
Add inserts a pitfall, de-duplicating on (domain, normalized error pattern). A duplicate bumps Hits and back-fills any empty fields; returns true only when a genuinely new lesson was stored.
func (*KB) Purge ¶ added in v0.9.3
Purge drops lessons last seen more than maxAgeDays ago (by LastSeen), returning how many were removed. maxAgeDays <= 0 is a no-op. Undated entries are kept (Open back-fills them, so they age from first load).
type KnowledgeError ¶
KnowledgeError wraps a host-level failure of the knowledge store (read, parse, or write). Model-recoverable conditions never surface as this type.
func (*KnowledgeError) Error ¶
func (e *KnowledgeError) Error() string
func (*KnowledgeError) Unwrap ¶
func (e *KnowledgeError) Unwrap() error
type Pitfall ¶
type Pitfall struct {
Domain string `json:"domain"`
ErrorPattern string `json:"error_pattern"`
Context string `json:"context"`
ProvenFix string `json:"proven_fix"`
Hits int `json:"hits"`
Added string `json:"added,omitempty"`
LastSeen string `json:"last_seen,omitempty"`
}
Pitfall is one durable lesson: when ErrorPattern is seen in Domain while doing Context, ProvenFix is what worked. Hits counts reuse, for ranking and pruning. Added/LastSeen (YYYY-MM-DD) drive age-based pruning — LastSeen bumps each time the lesson recurs, so a still-relevant lesson stays fresh.