Documentation
¶
Overview ¶
Package agentmemory owns bounded, explicit agent notes.
Index ¶
- Constants
- Variables
- func FormatEntry(now time.Time, scope, text, until string) (string, error)
- func FormatRule(text string) (string, error)
- func IsRule(line string) bool
- func Overflow(content string) (string, string, error)
- func Snapshot(content string) string
- func Split(content string) ([]string, string)
- type AgentWriter
- func (w AgentWriter) Add(key Key, now time.Time, scope, text, until string) (Document, error)
- func (w AgentWriter) Remove(key Key, match string) (Document, int, error)
- func (w AgentWriter) Replace(key Key, match, text string) (Document, error)
- func (w AgentWriter) Rollback(key Key, revision string) (Document, error)
- func (w AgentWriter) Write(key Key, content, expectedDigest string) (Document, error)
- type Budget
- type Document
- type Key
- type Revision
- type SearchResult
- type Store
- func (s *Store) Add(key Key, now time.Time, scope, text, until string) (Document, error)
- func (s *Store) AddRule(key Key, text string) (Document, error)
- func (s *Store) AsAgent() AgentWriter
- func (s *Store) History(key Key) ([]Revision, error)
- func (s *Store) Load(key Key) (string, error)
- func (s *Store) Read(key Key) (Document, error)
- func (s *Store) Remove(key Key, match string) (Document, int, error)
- func (s *Store) Replace(key Key, match, text string) (Document, error)
- func (s *Store) Retire(key Key, now time.Time) error
- func (s *Store) Rollback(key Key, revision string) (Document, error)
- func (s *Store) Rules(key Key) ([]string, error)
- func (s *Store) Search(key Key, query string) ([]SearchResult, error)
- func (s *Store) Write(key Key, content, expectedDigest string) (Document, error)
Constants ¶
View Source
const ( MaxLines = 200 MaxBytes = 24 * 1024 MaxEntryCharacters = 1000 TruncationMarker = "[Memory truncated: undated notes exceed the load budget.]" // RulePrefix marks an operator rule. Lines without it are notes, so files // written before rules existed load unchanged. RulePrefix = "- [rule] " KindNote = "note" KindRule = "rule" )
Variables ¶
View Source
var ( ErrBudgetExceeded = errors.New("agent_memory_budget_exceeded") ErrEntryTooLarge = errors.New("agent_memory_entry_too_large") ErrConflict = errors.New("agent_memory_conflict") // ErrRuleProtected refuses an agent write that would create, change or delete an operator rule. ErrRuleProtected = errors.New("agent_memory_rule_protected") )
Functions ¶
func FormatRule ¶
FormatRule builds an operator rule line. Rules carry no date: they stay in force until the operator removes them and are never archived by overflow.
func Overflow ¶
Overflow returns an archive plan; callers persist the archive before replacing memory.
Types ¶
type AgentWriter ¶
type AgentWriter struct {
// contains filtered or unexported fields
}
AgentWriter is the store as an agent may write it. Every method keeps the operator rules exactly as they are and fails with ErrRuleProtected otherwise.
func (AgentWriter) Replace ¶
func (w AgentWriter) Replace(key Key, match, text string) (Document, error)
type Budget ¶
type SearchResult ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is owned by the daemon; all transports share this instance.
func (*Store) AsAgent ¶
func (s *Store) AsAgent() AgentWriter
AsAgent returns the write surface for a caller that acts as the agent itself.
Click to show internal directories.
Click to hide internal directories.