archivist

package
v0.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package archivist provides the Archivist agent that extracts and manages facts and people from conversations for long-term memory.

Index

Constants

View Source
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

func (a *Archivist) Description() string

Description returns a human-readable description.

func (*Archivist) Execute

func (a *Archivist) Execute(ctx context.Context, req *agent.Request) (*agent.Response, error)

Execute runs the archivist with the given request.

func (*Archivist) SetPeopleRepository added in v0.5.1

func (a *Archivist) SetPeopleRepository(repo PeopleRepository)

SetPeopleRepository sets the people repository for the agent.

func (*Archivist) Type

func (a *Archivist) Type() agent.AgentType

Type returns the agent type.

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"` // Keep this person
	SourceName string `json:"source_name"` // Delete this person (merge into target)
	Reason     string `json:"reason"`
}

MergedPerson represents a merge operation for duplicate people.

type PeopleRepository added in v0.5.1

type PeopleRepository interface {
	GetPeople(userID int64) ([]storage.Person, error)
}

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 RemovedFact

type RemovedFact struct {
	ID     int64  `json:"id"`
	Reason string `json:"reason"`
}

RemovedFact represents a fact to be deleted.

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 UpdatedFact

type UpdatedFact struct {
	ID         int64  `json:"id"`
	Content    string `json:"content"`
	Type       string `json:"type,omitempty"`
	Importance int    `json:"importance"`
	Reason     string `json:"reason"`
}

UpdatedFact represents changes to an existing fact.

type UpdatedPerson added in v0.5.1

type UpdatedPerson struct {
	DisplayName    string   `json:"display_name"`
	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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL