heimdall

package
v1.0.41 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package heimdall provides the Heimdall SLM Management plugin.

Heimdall is the all-seeing guardian of the SLM subsystem, named after the Norse god who watches over Bifröst. Like its namesake, Heimdall monitors all activity, maintains vigilance over system health, and controls access to the cognitive capabilities of NornicDB.

Plugin Type

This is an SLM plugin (Type() returns "slm"), which means it provides subsystem management capabilities that the SLM can use.

Actions Provided

  • heimdall.heimdall.status - Get SLM status (Heimdall's vigilant watch)
  • heimdall.heimdall.health - Check SLM health (Heimdall's keen sight)
  • heimdall.heimdall.config - Get/set SLM configuration
  • heimdall.heimdall.metrics - Get SLM metrics (Heimdall's awareness)
  • heimdall.heimdall.events - Get recent events (Heimdall's memory)

Example Usage

User: "What's the status of the SLM?" SLM maps to: heimdall.heimdall.status Result: Returns current model, memory usage, request counts

Building as Plugin

To build as a standalone .so plugin:

go build -buildmode=plugin -o heimdall.so ./plugins/heimdall

Built-in Registration

This plugin is also registered as a built-in plugin, so no .so file is needed.

Index

Constants

This section is empty.

Variables

Plugin is the exported plugin variable. For .so plugins, export as: var Plugin heimdall.HeimdallPlugin = &WatcherPlugin{}

Functions

This section is empty.

Types

type WatcherPlugin

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

WatcherPlugin implements heimdall.HeimdallPlugin for SLM management. The Watcher is Heimdall's core guardian - the all-seeing eye of the system.

This plugin also demonstrates autonomous action invocation: - Implements DatabaseEventHook to monitor database events - Accumulates events and triggers analysis when thresholds are exceeded - Uses HeimdallInvoker to autonomously invoke SLM actions

func (*WatcherPlugin) Actions

func (p *WatcherPlugin) Actions() map[string]heimdall.ActionFunc

func (*WatcherPlugin) Config

func (p *WatcherPlugin) Config() map[string]interface{}

func (*WatcherPlugin) ConfigSchema

func (p *WatcherPlugin) ConfigSchema() map[string]interface{}

func (*WatcherPlugin) Configure

func (p *WatcherPlugin) Configure(settings map[string]interface{}) error

func (*WatcherPlugin) Description

func (p *WatcherPlugin) Description() string

func (*WatcherPlugin) Health

func (*WatcherPlugin) Initialize

func (p *WatcherPlugin) Initialize(ctx heimdall.SubsystemContext) error

func (*WatcherPlugin) Metrics

func (p *WatcherPlugin) Metrics() map[string]interface{}

func (*WatcherPlugin) Name

func (p *WatcherPlugin) Name() string

func (*WatcherPlugin) PostExecute

func (p *WatcherPlugin) PostExecute(ctx *heimdall.PostExecuteContext)

PostExecute is called after action execution completes. We log metrics and update state here.

This demonstrates: - Logging execution metrics - Sending completion notifications to UI - Tracking error counts - Accessing execution timing from context

func (*WatcherPlugin) PreExecute

func (p *WatcherPlugin) PreExecute(ctx *heimdall.PreExecuteContext, done func(heimdall.PreExecuteResult))

PreExecute is called after Heimdall responds, before action execution. We can fetch additional data or modify params here.

This demonstrates: - Async validation with callback - Sending notifications before action runs - Cancelling with ctx.Cancel() method - Modifying params before execution

func (*WatcherPlugin) PrePrompt

func (p *WatcherPlugin) PrePrompt(ctx *heimdall.PromptContext) error

PrePrompt is called before the prompt is sent to Heimdall. The ActionPrompt is immutable (already set). We can add context here.

=== GRAPH-RAG IMPLEMENTATION === This hook automatically enriches every user query with relevant knowledge from the graph database using semantic search with neighbor traversal.

Flow: 1. User asks "when is welcome season?" 2. PrePrompt runs semantic search on the query 3. Related nodes (neighbors) are retrieved 4. Context is injected into AdditionalInstructions 5. Heimdall now has the knowledge to answer

func (*WatcherPlugin) RecentEvents

func (p *WatcherPlugin) RecentEvents(limit int) []heimdall.SubsystemEvent

func (*WatcherPlugin) Shutdown

func (p *WatcherPlugin) Shutdown() error

func (*WatcherPlugin) Start

func (p *WatcherPlugin) Start() error

func (*WatcherPlugin) Status

func (*WatcherPlugin) Stop

func (p *WatcherPlugin) Stop() error

func (*WatcherPlugin) Summary

func (p *WatcherPlugin) Summary() string

func (*WatcherPlugin) Synthesize

func (p *WatcherPlugin) Synthesize(ctx *heimdall.SynthesisContext, done func(response string))

Synthesize implements SynthesisHook to transform action results into conversational prose. This is the reference implementation showing how plugins can provide rich, domain-specific response formatting using LLM-based synthesis.

The Watcher plugin demonstrates:

  • Using the Heimdall invoker to call the LLM for prose synthesis
  • Falling back gracefully if synthesis fails
  • Detecting pre-formatted messages to avoid double-processing

Domain-specific plugins (like Welcome Season) can override this with their own synthesis logic.

func (*WatcherPlugin) Type

func (p *WatcherPlugin) Type() string

func (*WatcherPlugin) Version

func (p *WatcherPlugin) Version() string

Jump to

Keyboard shortcuts

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