pipeline

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package pipeline implements the offline memory distillation pipeline (design §5): phase 1 extracts durable facts per ended session with a cheap model; phase 2 consolidates them into curated artifacts with a restricted subagent, git-diff driven with a zero-token no-op fast path.

It lives in a subpackage because internal/agent and internal/tools import internal/memory (usage middleware, note tool); the pipeline needs both.

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyRunning = errors.New("memory pipeline already running")

ErrAlreadyRunning reports that another process or goroutine owns the project memory pipeline lock. Callers may use errors.Is to surface a stable "busy" state without probing the lock first (which would introduce TOCTOU).

Functions

func MaybeStartBackground

func MaybeStartBackground(cfg *config.Config, projectDir string)

MaybeStartBackground fires a pipeline run in a goroutine if the gates pass (design §5.1): enabled, not a subagent context, cooldown handled inside Run. Errors are logged, never surfaced to the session.

func Run

func Run(ctx context.Context, cfg *config.Config, projectDir string, opts Options) error

Run executes phase 1 + phase 2 for a project. A non-blocking flock guards the whole run; lock contention is reported as ErrAlreadyRunning.

func Start added in v0.10.1

func Start(ctx context.Context, cfg *config.Config, projectDir string, opts Options) (<-chan error, error)

Start acquires the cross-process lock synchronously, then runs the pipeline asynchronously. A successful call owns the lock before returning; callers receive completion on the buffered channel and may safely report "started".

Types

type Options

type Options struct {
	// IncludeRecent skips the "session idle for 2h / ended" gate — needed by
	// `memory sync` right after a session and by the e2e suite.
	IncludeRecent bool
	// IgnoreCooldown forces a run even within the cooldown window (manual sync).
	IgnoreCooldown bool
	// Log receives progress lines; nil means silent.
	Log func(format string, args ...any)
}

Options controls one pipeline run.

Jump to

Keyboard shortcuts

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