dreaming

package
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatStatus

func FormatStatus(st *State, cfg Config) string

FormatStatus renders dreaming state for /learn dream status.

func IngestSessions

func IngestSessions(sessionsDir string, store *Store, limit int, now time.Time) (int, int, error)

IngestSessions scans recent session JSONL files for grounded signals.

Types

type Config

type Config struct {
	Enabled             *bool   `json:"enabled"`
	Frequency           string  `json:"frequency"` // cron, default "0 3 * * *"
	MinScore            float64 `json:"minScore"`
	MinRecallCount      int     `json:"minRecallCount"`
	MinUniqueSessions   int     `json:"minUniqueSessions"`
	RecencyHalfLifeDays int     `json:"recencyHalfLifeDays"`
	MaxPromotedChars    int     `json:"maxPromotedChars"`
	SessionScanLimit    int     `json:"sessionScanLimit"`
}

Config controls grounded dreaming sweeps.

func Defaults

func Defaults() Config

Defaults returns OpenClaw-aligned dreaming defaults.

func (Config) IsEnabled

func (c Config) IsEnabled() bool

IsEnabled reports whether dreaming sweeps are allowed by config.

func (Config) Normalized

func (c Config) Normalized() Config

type Diary

type Diary struct {
	Path string
}

Diary appends human-readable phase blocks to DREAMS.md.

func (*Diary) AppendPhase

func (d *Diary) AppendPhase(phase string, now time.Time, lines []string) error

type PromoteFunc

type PromoteFunc func(text, meta string) error

PromoteFunc writes one promoted memory entry.

type Signal

type Signal struct {
	ID               string    `json:"id"`
	Text             string    `json:"text"`
	Source           string    `json:"source"`
	SessionID        string    `json:"sessionId,omitempty"`
	RecallCount      int       `json:"recallCount"`
	SessionSources   []string  `json:"sessionSources,omitempty"`
	FirstSeen        time.Time `json:"firstSeen"`
	LastSeen         time.Time `json:"lastSeen"`
	LightHits        int       `json:"lightHits,omitempty"`
	REMHits          int       `json:"remHits,omitempty"`
	GroundedBackfill bool      `json:"groundedBackfill,omitempty"`
}

Signal is one grounded short-term memory candidate.

type State

type State struct {
	Enabled         bool                 `json:"enabled"`
	LastSweep       time.Time            `json:"lastSweep,omitempty"`
	Signals         []Signal             `json:"signals"`
	ProcessedEvents map[string]time.Time `json:"processedEvents,omitempty"`
	PromotedToday   int                  `json:"promotedToday,omitempty"`
	PromotedDate    string               `json:"promotedDate,omitempty"`
}

State persists dreaming machine state on disk.

func (*State) UpsertSignal

func (st *State) UpsertSignal(sig Signal, now time.Time)

UpsertSignal merges one grounded signal into state.

type Store

type Store struct {
	Path string
}

Store reads and writes dreaming state.json.

func (*Store) Load

func (s *Store) Load() (*State, error)

func (*Store) Save

func (s *Store) Save(st *State) error

type SweepResult

type SweepResult struct {
	SessionsIngested int
	SignalsIngested  int
	Staged           int
	Themes           []string
	Promoted         []string
	Skipped          int
}

SweepResult summarizes one dreaming run.

func Run

func Run(cfg Config, stateStore *Store, diary *Diary, deepReportDir string, promote PromoteFunc, sessionsDir string, now time.Time) (*SweepResult, error)

Run executes Light → REM → Deep and appends Dream Diary blocks.

Jump to

Keyboard shortcuts

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