prompt

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTemplate = `` /* 1950-byte string literal not displayed */

DefaultTemplate is the built-in journal entry prompt

Variables

This section is empty.

Functions

func Render

func Render(tmpl string, ctx *Context) (string, error)

Render executes a template string with the given context

func RenderDefault

func RenderDefault(ctx *Context) (string, error)

RenderDefault renders the default template with the given context

func RenderMessagePrompt added in v0.0.5

func RenderMessagePrompt(ctx *Context) (string, error)

RenderMessagePrompt loads the message prompt template from config and renders it

Types

type Context

type Context struct {
	Persona       string
	Timestamp     time.Time
	Uptime        string
	CPUPercent    float64
	MemoryPercent float64
	MemoryUsedGB  float64
	MemoryTotalGB float64
	DiskPercent   float64
	DiskUsedGB    float64
	DiskTotalGB   float64

	// Machine identity
	MachineType string // laptop, desktop, server, virtual_machine, container, unknown
	TimeOfDay   string // night, morning, afternoon, evening
	Platform    string // e.g., "macOS 14.0 (arm64)" or "Linux 5.15 (amd64)"

	// Optional metrics (check with HasX methods in templates)
	LoadAverage1  *float64
	LoadAverage5  *float64
	LoadAverage15 *float64
	SwapPercent   *float64
	SwapUsedGB    *float64
	SwapTotalGB   *float64
	ProcessCount  *int
	NetworkSentGB *float64
	NetworkRecvGB *float64
	BatteryPct    *float64
	BatteryChg    *bool
	CPUTemp       *float64
	GPUTemp       *float64
	GPUUsage      *float64
	FanSpeed      *float64 // Average fan speed in RPM

	// Previous entries for context continuity
	PreviousEntries []PreviousEntry
}

Context holds all the data available to a prompt template

func NewContext

func NewContext(personaDescription string, snapshot *metrics.Snapshot, previousEntries []PreviousEntry) *Context

NewContext creates a prompt context from a persona description, metrics snapshot, and optional previous entries

func (*Context) HasBattery added in v0.0.3

func (c *Context) HasBattery() bool

HasBattery returns true if battery data is available

func (*Context) HasCPUTemp added in v0.0.5

func (c *Context) HasCPUTemp() bool

HasCPUTemp returns true if CPU temperature data is available

func (*Context) HasFanSpeed added in v0.0.5

func (c *Context) HasFanSpeed() bool

HasFanSpeed returns true if fan speed data is available

func (*Context) HasGPUTemp added in v0.0.5

func (c *Context) HasGPUTemp() bool

HasGPUTemp returns true if GPU temperature data is available

func (*Context) HasGPUUsage added in v0.0.5

func (c *Context) HasGPUUsage() bool

HasGPUUsage returns true if GPU usage data is available

func (*Context) HasLoadAverage added in v0.0.3

func (c *Context) HasLoadAverage() bool

HasLoadAverage returns true if load average data is available

func (*Context) HasNetwork added in v0.0.3

func (c *Context) HasNetwork() bool

HasNetwork returns true if network I/O data is available

func (*Context) HasPreviousEntries added in v0.0.5

func (c *Context) HasPreviousEntries() bool

HasPreviousEntries returns true if previous entries are available for context

func (*Context) HasProcessCount added in v0.0.3

func (c *Context) HasProcessCount() bool

HasProcessCount returns true if process count is available

func (*Context) HasSwap added in v0.0.3

func (c *Context) HasSwap() bool

HasSwap returns true if swap data is available

type PreviousEntry added in v0.0.5

type PreviousEntry struct {
	Date    string
	Content string
}

PreviousEntry represents a previous journal entry for context

Jump to

Keyboard shortcuts

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