Documentation
¶
Overview ¶
Package memory provides the agent's memory as a typed facade over the unified resource foundation. A memory item is stored as a resource.Resource of kind "Memory": it has no natural name, so each write is a create with a server-assigned name (GenerateName), and the kind/content/source live in a schema-validated Spec. The facade implements state.MemoryStore, so call sites keep the same ergonomic API while the data lives on one event-sourced store with one envelope, one schema/admission path, and one provenance/sync model shared with every other kind.
Recall is a read model over that store: the facade ranks live items by a case-insensitive content scan, most-recent first, and a backend can maintain a full-text or vector projection of the same resource events without changing this contract.
Index ¶
Constants ¶
const GroupVersion = "memory.ionagent.io/v1"
GroupVersion is the memory kind's API group/version. The `.ionagent.io` suffix marks it unmistakably as ours, never a Kubernetes built-in.
const Kind = "Memory"
Kind is the resource kind name memory items are stored under.
Variables ¶
var KindDef = resource.Kind{ APIVersion: GroupVersion, Name: Kind, Schema: specSchema, Singular: "memory", Plural: "memories", }
KindDef is the Memory kind definition, the value registered with a resource registry so the store admits memory items.
Functions ¶
func RegisterKind ¶
RegisterKind registers the Memory kind with reg so a resource store admits memory items. It is idempotent: registering again replaces the definition.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the typed memory facade over a resource.Store. It is the MemoryStore the agent uses; underneath, every write and recall is a resource operation on one event-sourced foundation.
func NewStore ¶
NewStore returns a memory facade over rs. The caller must have registered the Memory kind with the registry rs admits against (see RegisterKind).
func (*Store) Recall ¶
func (s *Store) Recall(ctx context.Context, q state.RecallQuery) ([]state.MemoryItem, error)
Recall returns live memory items whose content contains the query (case insensitive), most-recent first, capped at q.Limit (<= 0 means no cap). A zero Scope spans every scope; a set Scope narrows to it. An empty query matches every live item.
func (*Store) Write ¶
func (s *Store) Write(ctx context.Context, m state.MemoryItem) (state.MemoryItem, error)
Write persists a memory item as a new Memory resource, assigning the id and name from the foundation's single ID source. Memory is append-only: each Write is a distinct record, never an update of a prior one.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package guard defends the agent's durable memory against context poisoning (OWASP ASI06): the attack that writes a hidden instruction into memory now and triggers it days later, through an unrelated turn.
|
Package guard defends the agent's durable memory against context poisoning (OWASP ASI06): the attack that writes a hidden instruction into memory now and triggers it days later, through an unrelated turn. |
|
Package memorytest is the conformance suite for state.MemoryStore.
|
Package memorytest is the conformance suite for state.MemoryStore. |