groupingest

package
v0.49.3 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package groupingest consumes the group event log and extracts memories into group-shared and per-user drawers. It is the async counterpart of the synchronous single-chat memory path: messages are batched, sent to an Extractor (typically LLM-backed), and results are written via the existing memorywrite helpers.

Index

Constants

View Source
const (
	PipelineMemoryIngest = "memory_ingest"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatMessage

type ChatMessage struct {
	Seq       int64
	ActorID   string
	Content   string
	Timestamp string
}

ChatMessage is a single human message ready for extraction.

type Config

type Config struct {
	DB         *sql.DB
	Q          *sqlc.Queries
	Extractor  Extractor
	UserWriter UserWriter
	BatchSize  int
	Pipeline   string
}

Config configures an Ingester.

type ExtractRequest

type ExtractRequest struct {
	GroupID            string
	Messages           []ChatMessage
	CurrentGroupMemory string
}

ExtractRequest is the input to an Extractor.

type ExtractResult

type ExtractResult struct {
	GroupMemory string              // updated group memory (empty = no change)
	UserFacts   map[string][]string // actor_id → extracted per-user facts
}

ExtractResult is the output from an Extractor.

type Extractor

type Extractor interface {
	Extract(ctx context.Context, req ExtractRequest) (ExtractResult, error)
}

Extractor extracts knowledge from a batch of group messages.

type Ingester

type Ingester struct {
	// contains filtered or unexported fields
}

Ingester consumes group event logs and extracts memories.

func New

func New(cfg Config) *Ingester

New creates an Ingester from the given config.

func (*Ingester) ProcessGroup

func (ing *Ingester) ProcessGroup(ctx context.Context, groupID string) error

ProcessGroup processes a single group's pending messages. Exported for targeted invocations (e.g. after a burst of messages in one group).

func (*Ingester) RunOnce

func (ing *Ingester) RunOnce(ctx context.Context) error

RunOnce scans all groups with unprocessed messages and extracts memories. Per-group failures are logged and do not abort the scan; the first error is returned so the caller knows the run was not fully clean.

type UserWriter

type UserWriter func(ctx context.Context, actorID string, fact string) error

UserWriter writes an extracted fact to a user's private memory. actorID is the platform sender ID from the event log; the implementation is responsible for resolving it to auth user + agent IDs.

Jump to

Keyboard shortcuts

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