Documentation
¶
Overview ¶
Package memory implements the v0.1 Memory decision chain (ADR-009): the canonical store lives in PostgreSQL (FTS + pg_trgm + pgvector share the transaction system), embeddings are produced by a pluggable Embedder, and retrieval filters tenant/sensitivity before scoring. Deletion is a tombstone (deletion intent survives; projections can rebuild).
Index ¶
- type DevEmbedder
- type Embedder
- type Gateway
- func (g *Gateway) Get(ctx context.Context, tenantID string, id uuid.UUID) (store.MemoryRecord, error)
- func (g *Gateway) Put(ctx context.Context, in PutInput) (store.MemoryRecord, bool, error)
- func (g *Gateway) Search(ctx context.Context, in SearchInput) ([]store.MemoryRecord, error)
- func (g *Gateway) Tombstone(ctx context.Context, tenantID string, id uuid.UUID, expectedVersion int64) (store.MemoryRecord, error)
- type HTTPEmbedder
- type PutInput
- type SearchInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DevEmbedder ¶
type DevEmbedder struct{}
DevEmbedder produces a deterministic, normalized 384-dimension vector from the content hash. It exists so the full pipeline (store, FTS/vector hybrid retrieval, control API) runs without an external embedding service; it must not be used where semantic similarity matters.
type Embedder ¶
Embedder turns memory content into the canonical vector space. The dev embedder is deterministic but semantically meaningless; production deployments plug a real embedding service behind this interface.
type Gateway ¶
type Gateway struct {
// contains filtered or unexported fields
}
Gateway orchestrates memory writes and retrieval: it embeds content, validates the decision inputs and delegates persistence to the canonical store.
func NewGateway ¶
func NewGateway(embedder Embedder, memories store.MemoryStore) *Gateway
func (*Gateway) Get ¶
func (g *Gateway) Get(ctx context.Context, tenantID string, id uuid.UUID) (store.MemoryRecord, error)
Get reads one record (tombstone state included).
func (*Gateway) Put ¶
Put embeds (unless a caller-supplied embedding is given), validates, and persists. It returns the record and whether the write replayed an existing identical document.
func (*Gateway) Search ¶
func (g *Gateway) Search(ctx context.Context, in SearchInput) ([]store.MemoryRecord, error)
Search embeds the keyword query when no vector is given and delegates the hybrid scoring to the canonical store.
type HTTPEmbedder ¶
type HTTPEmbedder struct {
// contains filtered or unexported fields
}
HTTPEmbedder calls a preconfigured HTTPS embedding boundary. The endpoint is operator configuration, never Agent-controlled data.
func NewHTTPEmbedder ¶
func NewHTTPEmbedder(endpoint, bearerToken string, client *http.Client) (*HTTPEmbedder, error)
type PutInput ¶
type PutInput struct {
TenantID string
Namespace string
Key string
ContentType string
Content string
Embedding []float32
EmbeddingSource string // caller-supplied embedding; empty = embed content
Sensitivity string
SourceTaskID *uuid.UUID
SourceRunID *uuid.UUID
SourceAttemptID *uuid.UUID
Provenance map[string]any
RetentionUntil *time.Time
}
PutInput is one memory write.