Documentation
¶
Overview ¶
Package archivist provides the Archivist agent that extracts and manages facts and people from conversations for long-term memory.
Index ¶
- Constants
- type AddedFact
- type AddedPerson
- type Archivist
- type FactView
- type FactsResult
- type LegacyResult
- type MergedPerson
- type PeopleRepository
- type PeopleResult
- type RawFact
- type RawPerson
- type RemovedFact
- type Result
- type ResultWithArrayFields
- type ResultWithRawArrays
- type UpdatedFact
- type UpdatedPerson
Constants ¶
const ( // ParamMessages is the key for messages to process ([]storage.Message). ParamMessages = "messages" // ParamFacts is the key for current facts ([]storage.Fact). ParamFacts = "facts" // ParamPeople is the key for known people names ([]storage.Person). ParamPeople = "people" // ParamReferenceDate is the key for the reference date (time.Time). ParamReferenceDate = "reference_date" // ParamUser is the key for user info (*storage.User, optional). ParamUser = "user" )
Request parameters for Archivist agent.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddedFact ¶
type AddedFact struct {
Relation string `json:"relation"`
Content string `json:"content"`
Category string `json:"category"`
Type string `json:"type"`
Importance int `json:"importance"`
Reason string `json:"reason"`
}
AddedFact represents a new fact to add.
type AddedPerson ¶ added in v0.5.1
type AddedPerson struct {
DisplayName string `json:"display_name"`
Aliases []string `json:"aliases,omitempty"`
Circle string `json:"circle"`
Bio string `json:"bio"`
Reason string `json:"reason"`
}
AddedPerson represents a new person to add.
type Archivist ¶
type Archivist struct {
// contains filtered or unexported fields
}
Archivist extracts and manages facts and people from conversations.
func New ¶
func New( executor *agent.Executor, translator *i18n.Translator, cfg *config.Config, logger *slog.Logger, agentLogger *agentlog.Logger, ) *Archivist
New creates a new Archivist agent.
func (*Archivist) Capabilities ¶
func (a *Archivist) Capabilities() agent.Capabilities
Capabilities returns the agent's capabilities.
func (*Archivist) Description ¶
Description returns a human-readable description.
func (*Archivist) SetPeopleRepository ¶ added in v0.5.1
func (a *Archivist) SetPeopleRepository(repo PeopleRepository)
SetPeopleRepository sets the people repository for the agent.
type FactView ¶
type FactView struct {
ID int64 `json:"id"`
Relation string `json:"relation"`
Content string `json:"content"`
Category string `json:"category"`
Type string `json:"type"`
Importance int `json:"importance"`
}
FactView is a simplified view of a fact for the prompt.
type FactsResult ¶ added in v0.5.1
type FactsResult struct {
Added []AddedFact `json:"added"`
Updated []UpdatedFact `json:"updated"`
Removed []RemovedFact `json:"removed"`
}
FactsResult contains fact operations.
type LegacyResult ¶ added in v0.5.1
type LegacyResult struct {
Added []AddedFact `json:"added"`
Updated []UpdatedFact `json:"updated"`
Removed []RemovedFact `json:"removed"`
}
LegacyResult for backward compatibility with old format.
type MergedPerson ¶ added in v0.5.1
type MergedPerson struct {
TargetName string `json:"target_name,omitempty"` // Fallback with warning
SourceName string `json:"source_name,omitempty"` // Fallback with warning
TargetID string `json:"target_id,omitempty"` // Preferred: "Person:10"
SourceID string `json:"source_id,omitempty"` // Preferred: "Person:5"
Reason string `json:"reason"`
}
MergedPerson represents a merge operation for duplicate people.
func (*MergedPerson) GetSourceID ¶ added in v0.5.4
func (p *MergedPerson) GetSourceID() (string, bool)
GetSourceID extracts source person ID from MergedPerson. Prefers "Person:5" (string), returns empty string if not found.
func (*MergedPerson) GetTargetID ¶ added in v0.5.4
func (p *MergedPerson) GetTargetID() (string, bool)
GetTargetID extracts target person ID from MergedPerson. Prefers "Person:10" (string), returns empty string if not found.
type PeopleRepository ¶ added in v0.5.1
PeopleRepository is the interface for loading people.
type PeopleResult ¶ added in v0.5.1
type PeopleResult struct {
Added []AddedPerson `json:"added,omitempty"`
Updated []UpdatedPerson `json:"updated,omitempty"`
Merged []MergedPerson `json:"merged,omitempty"`
}
PeopleResult contains people operations.
type RawFact ¶ added in v0.5.4
type RawFact struct {
ID int64 `json:"id"`
Content string `json:"content"`
Type string `json:"type"`
Importance int `json:"importance"`
Reason string `json:"reason"`
}
RawFact represents a fact in the wrong format (LLM returned array of facts instead of operations).
type RawPerson ¶ added in v0.5.4
type RawPerson struct {
DisplayName string `json:"display_name"`
Aliases []string `json:"aliases"`
Circle string `json:"circle"`
Bio string `json:"bio"`
Reason string `json:"reason"`
}
RawPerson represents a person in the wrong format (LLM returned array of people instead of operations).
type RemovedFact ¶
type RemovedFact struct {
ID int64 `json:"id,omitempty"` // Legacy: numeric fallback with warning
FactID string `json:"fact_id,omitempty"` // Preferred: "Fact:1234" or "1234"
Reason string `json:"reason"`
}
RemovedFact represents a fact to be deleted.
func (*RemovedFact) GetFactID ¶ added in v0.5.4
func (f *RemovedFact) GetFactID() (int64, error)
GetFactID extracts fact ID from RemovedFact. Prefers "Fact:1234" or "1234" (string), falls back to numeric id. Returns 0 if no valid ID found.
type Result ¶
type Result struct {
Facts FactsResult `json:"facts"`
People PeopleResult `json:"people"`
}
Result contains all memory update decisions.
type ResultWithArrayFields ¶ added in v0.5.1
type ResultWithArrayFields struct {
Facts []FactsResult `json:"facts"`
People []PeopleResult `json:"people"`
}
ResultWithArrayFields handles LLM quirk where "facts" or "people" is wrapped in array.
type ResultWithRawArrays ¶ added in v0.5.4
type ResultWithRawArrays struct {
Facts []RawFact `json:"facts"`
People []RawPerson `json:"people"`
}
ResultWithRawArrays handles LLM error where it returns raw fact/person arrays instead of operations.
type UpdatedFact ¶
type UpdatedFact struct {
ID int64 `json:"id,omitempty"` // Legacy: numeric fallback with warning
FactID string `json:"fact_id,omitempty"` // Preferred: "Fact:1522" or "1522"
Content string `json:"content"`
Type string `json:"type,omitempty"`
Importance int `json:"importance"`
Reason string `json:"reason"`
}
UpdatedFact represents changes to an existing fact.
func (*UpdatedFact) GetFactID ¶ added in v0.5.4
func (f *UpdatedFact) GetFactID() (int64, error)
GetFactID extracts fact ID from UpdatedFact. Prefers "Fact:1522" or "1522" (string), falls back to numeric id. Returns 0 if no valid ID found.
type UpdatedPerson ¶ added in v0.5.1
type UpdatedPerson struct {
DisplayName string `json:"display_name,omitempty"` // Fallback with warning
PersonID string `json:"person_id,omitempty"` // Preferred: "Person:5"
NewDisplayName string `json:"new_display_name,omitempty"` // Rename person, old name goes to aliases
Aliases []string `json:"aliases,omitempty"` // New aliases to add
Circle string `json:"circle,omitempty"`
Bio string `json:"bio"` // Complete rewritten bio
Reason string `json:"reason"`
}
UpdatedPerson represents changes to an existing person.
func (*UpdatedPerson) GetPersonID ¶ added in v0.5.4
func (p *UpdatedPerson) GetPersonID() (string, bool)
GetPersonID extracts person ID from UpdatedPerson. Prefers "Person:5" (string), returns empty string if not found.