topic_pruner

package
v0.32.3 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package topic_pruner detects topic shifts in the conversation and emits MemoryTopicShiftDetected when the user appears to have changed subjects.

Two signals are combined:

  • Explicit phrase matching ("different question", "new topic", "let's move on", "moving on", etc.) — cheap, deterministic.
  • Embedding similarity drop — runs only when the embeddings.provider capability is active. Compares the latest user input against a rolling centroid of the current topic's user inputs; a similarity below the configured threshold flags a shift.

Both signals are journalled via the bus event so replay is deterministic even though the classifier itself is heuristic. The pruner does not itself rewrite history — it surfaces the shift so other plugins (summary buffer, compaction) can react. This separation keeps the pruner cheap and avoids stepping on the existing summary_buffer machinery.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() engine.Plugin

New creates a new topic_pruner plugin.

Types

type Plugin

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

Plugin implements the topic-aware pruner.

func (*Plugin) Capabilities

func (p *Plugin) Capabilities() []engine.Capability

func (*Plugin) ConfigSchema

func (p *Plugin) ConfigSchema() []byte

ConfigSchema implements engine.ConfigSchemaProvider.

func (*Plugin) Dependencies

func (p *Plugin) Dependencies() []string

func (*Plugin) Emissions

func (p *Plugin) Emissions() []string

func (*Plugin) ID

func (p *Plugin) ID() string

func (*Plugin) Init

func (p *Plugin) Init(ctx engine.PluginContext) error

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) Ready

func (p *Plugin) Ready() error

func (*Plugin) Requires

func (p *Plugin) Requires() []engine.Requirement

func (*Plugin) Shutdown

func (p *Plugin) Shutdown(_ context.Context) error

func (*Plugin) Subscriptions

func (p *Plugin) Subscriptions() []engine.EventSubscription

func (*Plugin) Version

func (p *Plugin) Version() string

Jump to

Keyboard shortcuts

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