memorysynthesis

package
v0.204.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package memorysynthesis contains the bounded, privacy-filtered material envelope used by daily memory synthesis. It deliberately has no database or agent dependency: callers provide already structured source items and this package performs the common ordering, de-duplication, secret scrubbing, budget enforcement, and digest calculation.

Index

Constants

View Source
const SchemaV1 = "daily-memory-materials.v1"

Variables

This section is empty.

Functions

This section is empty.

Types

type Envelope

type Envelope struct {
	Schema   string  `json:"schema"`
	Project  string  `json:"project"`
	Day      string  `json:"day"`
	Timezone string  `json:"timezone"`
	Items    []Item  `json:"items"`
	Omitted  Omitted `json:"omitted"`
}

type Item

type Item struct {
	ID          string   `json:"id"`
	Kind        string   `json:"kind"`
	OccurredAt  string   `json:"occurred_at,omitempty"`
	Title       string   `json:"title,omitempty"`
	Text        string   `json:"text,omitempty"`
	SourceRef   string   `json:"source_ref"`
	SourceRefs  []string `json:"source_refs,omitempty"`
	Sensitivity string   `json:"sensitivity,omitempty"`
}

Item is one allow-listed fact from a source adapter. Text is never treated as instructions.

func Collect

func Collect(ctx context.Context, project, day string, sources ...Source) ([]Item, error)

type Materials

type Materials struct {
	Envelope
	InputDigest string `json:"input_digest"`
}

Materials is the persisted-safe result of preparing an envelope. The digest covers the canonical envelope, including omission counts, and is therefore stable for identical input.

func Build

func Build(project, day, timezone string, input []Item, opts Options) (Materials, error)

Build prepares source items into the versioned envelope. It is deterministic: items are ordered by occurrence and source, duplicate source refs/text are merged, and all limits are applied before hashing. The returned bytes never contain the original value of a scrubbed secret.

type Omitted

type Omitted struct {
	Items   int      `json:"items,omitempty"`
	Bytes   int      `json:"bytes,omitempty"`
	Reasons []string `json:"reasons,omitempty"`
}

type Options

type Options struct {
	MaxInputBytes   int
	MaxItemsPerKind int
	MaxRunesPerText int
}

type Source

type Source interface {
	Collect(context.Context, string, string) ([]Item, error)
}

Source is a read-only structured material adapter. Adapters must not return transcripts, prompts, argv, environment values, or attachments.

Jump to

Keyboard shortcuts

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