curation

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: MIT Imports: 9 Imported by: ? 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 curation implements the memory maintenance system for colony data. It provides 8 curation ants (sentinel, nurse, critic, herald, janitor, archivist, librarian, scribe) and an orchestrator that runs them in a fixed sequential order matching the shell orchestrator.sh behavior. Sentinel abort prevents remaining steps when data corruption is detected.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Archivist

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

Archivist archives low-trust instincts. Instincts with confidence < 0.30 are marked as "archived" to indicate they should not influence colony behavior. The instinct data is preserved but flagged for future pruning.

func NewArchivist

func NewArchivist(store *storage.Store) *Archivist

NewArchivist creates a new Archivist ant backed by the given store.

func (*Archivist) Caste

func (a *Archivist) Caste() agent.Caste

Caste returns the agent's role category.

func (*Archivist) Execute

func (a *Archivist) Execute(ctx context.Context, event events.Event) error

Execute runs the archivist. It delegates to Run.

func (*Archivist) Name

func (a *Archivist) Name() string

Name returns the unique identifier for this agent.

func (*Archivist) Run

func (a *Archivist) Run(ctx context.Context, dryRun bool) (StepResult, error)

Run reads instincts and marks those with confidence < 0.30 as archived. Returns the count of archived instincts.

func (*Archivist) Triggers

func (a *Archivist) Triggers() []agent.Trigger

Triggers returns nil because the orchestrator handles triggering.

type Critic

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

Critic detects contradictions in the instinct store. Two instincts are considered contradictory if they share the same topic but express opposing conclusions (e.g., one says "prefer X" and another says "avoid X").

func NewCritic

func NewCritic(store *storage.Store) *Critic

NewCritic creates a new Critic ant backed by the given store.

func (*Critic) Caste

func (c *Critic) Caste() agent.Caste

Caste returns the agent's role category.

func (*Critic) Execute

func (c *Critic) Execute(ctx context.Context, event events.Event) error

Execute runs the critic. It delegates to Run.

func (*Critic) Name

func (c *Critic) Name() string

Name returns the unique identifier for this agent.

func (*Critic) Run

func (c *Critic) Run(ctx context.Context, dryRun bool) (StepResult, error)

Run scans instincts for contradictions. Two instincts sharing the same topic with different conclusion fields are flagged.

func (*Critic) Triggers

func (c *Critic) Triggers() []agent.Trigger

Triggers returns nil because the orchestrator handles triggering.

type CurationAnt

type CurationAnt interface {
	agent.Agent
	Run(ctx context.Context, dryRun bool) (StepResult, error)
}

CurationAnt is the internal interface extended from agent.Agent that adds the Run method used by the orchestrator for sequential step execution.

type CurationResult

type CurationResult struct {
	Steps      []StepResult `json:"steps"`
	Succeeded  int          `json:"succeeded"`
	Failed     int          `json:"failed"`
	Skipped    int          `json:"skipped"`
	DryRun     bool         `json:"dry_run"`
	DurationMs int64        `json:"duration_ms"`
}

CurationResult holds the aggregate outcome of a full curation run.

type Herald

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

Herald promotes high-confidence instincts to QUEEN.md. It reads instincts with confidence >= 0.80 and writes their trigger patterns to the Patterns section of QUEEN.md, following the queen.PromoteInstinct pattern.

func NewHerald

func NewHerald(store *storage.Store) *Herald

NewHerald creates a new Herald ant backed by the given store.

func (*Herald) Caste

func (h *Herald) Caste() agent.Caste

Caste returns the agent's role category.

func (*Herald) Execute

func (h *Herald) Execute(ctx context.Context, event events.Event) error

Execute runs the herald. It delegates to Run.

func (*Herald) Name

func (h *Herald) Name() string

Name returns the unique identifier for this agent.

func (*Herald) Run

func (h *Herald) Run(ctx context.Context, dryRun bool) (StepResult, error)

Run promotes instincts with confidence >= 0.80 to QUEEN.md.

func (*Herald) Triggers

func (h *Herald) Triggers() []agent.Trigger

Triggers returns nil because the orchestrator handles triggering.

type Janitor

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

Janitor cleans expired events from the event bus JSONL store. It delegates to bus.Cleanup which removes events past their TTL.

func NewJanitor

func NewJanitor(store *storage.Store, bus *events.Bus) *Janitor

NewJanitor creates a new Janitor ant with access to the store and bus.

func (*Janitor) Caste

func (j *Janitor) Caste() agent.Caste

Caste returns the agent's role category.

func (*Janitor) Execute

func (j *Janitor) Execute(ctx context.Context, event events.Event) error

Execute runs the janitor. It delegates to Run.

func (*Janitor) Name

func (j *Janitor) Name() string

Name returns the unique identifier for this agent.

func (*Janitor) Run

func (j *Janitor) Run(ctx context.Context, dryRun bool) (StepResult, error)

Run calls bus.Cleanup to remove expired events. In dry-run mode it only reports what would be removed without modifying the JSONL file.

func (*Janitor) Triggers

func (j *Janitor) Triggers() []agent.Trigger

Triggers returns nil because the orchestrator handles triggering.

type Librarian

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

Librarian produces inventory statistics across colony data stores. It counts entries in observations, instincts, events, and pheromones to give an overview of colony memory health.

func NewLibrarian

func NewLibrarian(store *storage.Store, bus *events.Bus) *Librarian

NewLibrarian creates a new Librarian ant with access to the store and bus.

func (*Librarian) Caste

func (l *Librarian) Caste() agent.Caste

Caste returns the agent's role category.

func (*Librarian) Execute

func (l *Librarian) Execute(ctx context.Context, event events.Event) error

Execute runs the librarian. It delegates to Run.

func (*Librarian) Name

func (l *Librarian) Name() string

Name returns the unique identifier for this agent.

func (*Librarian) Run

func (l *Librarian) Run(ctx context.Context, dryRun bool) (StepResult, error)

Run counts entries across data stores and returns inventory statistics.

func (*Librarian) Triggers

func (l *Librarian) Triggers() []agent.Trigger

Triggers returns nil because the orchestrator handles triggering.

type Nurse

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

Nurse recalculates trust scores for instincts with out-of-date scores. It reads the instincts store and updates entries whose computed score differs from the stored value.

func NewNurse

func NewNurse(store *storage.Store) *Nurse

NewNurse creates a new Nurse ant backed by the given store.

func (*Nurse) Caste

func (n *Nurse) Caste() agent.Caste

Caste returns the agent's role category.

func (*Nurse) Execute

func (n *Nurse) Execute(ctx context.Context, event events.Event) error

Execute runs the nurse. It delegates to Run.

func (*Nurse) Name

func (n *Nurse) Name() string

Name returns the unique identifier for this agent.

func (*Nurse) Run

func (n *Nurse) Run(ctx context.Context, dryRun bool) (StepResult, error)

Run reads instincts and recalculates trust scores for entries that need updating. Returns a summary of how many were recalculated.

func (*Nurse) Triggers

func (n *Nurse) Triggers() []agent.Trigger

Triggers returns nil because the orchestrator handles triggering.

type Orchestrator

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

Orchestrator runs all 8 curation ants in sequence. If the sentinel step detects corrupt stores, remaining steps are skipped. The orchestrator implements the Agent interface so it can be registered in the agent registry and triggered by the event bus.

func NewOrchestrator

func NewOrchestrator(store *storage.Store, bus *events.Bus) *Orchestrator

NewOrchestrator creates a curation orchestrator with all 8 ants in the correct sequential order matching the shell orchestrator.sh behavior: sentinel, nurse, critic, herald, janitor, archivist, librarian, scribe.

func (*Orchestrator) Caste

func (o *Orchestrator) Caste() agent.Caste

Caste returns the agent's role category.

func (*Orchestrator) Execute

func (o *Orchestrator) Execute(ctx context.Context, event events.Event) error

Execute runs a curation cycle triggered by an event.

func (*Orchestrator) Name

func (o *Orchestrator) Name() string

Name returns the unique identifier for this agent.

func (*Orchestrator) Run

func (o *Orchestrator) Run(ctx context.Context, dryRun bool) (*CurationResult, error)

Run executes all 8 curation ants sequentially. If the sentinel step fails (corrupt stores detected), the remaining steps are marked as skipped and the loop breaks early.

func (*Orchestrator) Subscribe

func (o *Orchestrator) Subscribe(bus *events.Bus) error

Subscribe registers the orchestrator for consolidation events.

func (*Orchestrator) Triggers

func (o *Orchestrator) Triggers() []agent.Trigger

Triggers returns the event patterns that activate the orchestrator.

type Scribe

type Scribe struct{}

Scribe generates a text report summarizing the curation run results. It collects StepResults from the orchestrator and formats them into a human-readable report that can be persisted or displayed.

func NewScribe

func NewScribe() *Scribe

NewScribe creates a new Scribe ant.

func (*Scribe) Caste

func (s *Scribe) Caste() agent.Caste

Caste returns the agent's role category.

func (*Scribe) Execute

func (s *Scribe) Execute(ctx context.Context, event events.Event) error

Execute runs the scribe. It delegates to Run.

func (*Scribe) Name

func (s *Scribe) Name() string

Name returns the unique identifier for this agent.

func (*Scribe) Run

func (s *Scribe) Run(ctx context.Context, dryRun bool) (StepResult, error)

Run generates a text report from curation results. In a full integration it would receive prior step results, but as a lightweight stub it reports success with a summary indicating report generation completed.

func (*Scribe) Triggers

func (s *Scribe) Triggers() []agent.Trigger

Triggers returns nil because the orchestrator handles triggering.

type Sentinel

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

Sentinel is the health-check curation ant. It verifies that colony data stores are not corrupt before allowing remaining curation steps to run. If any checked store contains invalid JSON, Sentinel returns an error and the orchestrator skips remaining steps.

func NewSentinel

func NewSentinel(store *storage.Store) *Sentinel

NewSentinel creates a new Sentinel ant backed by the given store.

func (*Sentinel) Caste

func (s *Sentinel) Caste() agent.Caste

Caste returns the agent's role category.

func (*Sentinel) Execute

func (s *Sentinel) Execute(ctx context.Context, event events.Event) error

Execute runs the sentinel check. It delegates to Run.

func (*Sentinel) Name

func (s *Sentinel) Name() string

Name returns the unique identifier for this agent.

func (*Sentinel) Run

func (s *Sentinel) Run(ctx context.Context, dryRun bool) (StepResult, error)

Run checks each of the 6 colony data stores for corruption. A missing file is acceptable; a file with invalid JSON is corrupt. Returns a StepResult listing which stores (if any) are corrupt.

func (*Sentinel) Triggers

func (s *Sentinel) Triggers() []agent.Trigger

Triggers returns nil because the orchestrator handles triggering.

type StepResult

type StepResult struct {
	Name    string         `json:"name"`
	Success bool           `json:"success"`
	Error   error          `json:"-"`
	Summary map[string]any `json:"summary"`
}

StepResult holds the outcome of a single curation step.

Jump to

Keyboard shortcuts

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