Documentation
¶
Overview ¶
Package reminders provides conditional mid-conversation prompt injection.
Reminders are user-authored prompts with trigger conditions. When a trigger evaluates to true, the reminder content is injected into the model context (either as a system message or a user message with [SYSTEM REMINDER] prefix, depending on model capabilities).
Each reminder fires at most once per trigger event: it fires when the condition transitions from false → true, then re-arms when the condition becomes false again.
All evaluation is deterministic — no LLM calls.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EvalContext ¶
type EvalContext struct {
ContextUsage float64 // 0.0–1.0
LastResponseTokens int64
LastToolFailed bool
TurnCount int
LastToolName string
}
EvalContext carries runtime metrics for trigger evaluation.
type State ¶
type State struct {
// contains filtered or unexported fields
}
State tracks per-reminder armed/fired status for fire-once semantics.
func StateFromContext ¶
StateFromContext retrieves reminder state from ctx. Returns nil when absent.
func (*State) Evaluate ¶
func (s *State) Evaluate(ec EvalContext) []Reminder
Evaluate checks all reminders against the current eval context and returns those that should fire (false→true transition). Manual reminders never fire from Evaluate — use FireManual instead.
func (*State) FireManual ¶
FireManual returns the reminder with the given name (for /remind command), regardless of trigger state. Returns (Reminder{}, false) if not found.
func (*State) ReminderNames ¶
ReminderNames returns the names of all tracked reminders.
type Trigger ¶
type Trigger struct {
Kind string // "context_usage", "turn_count", "last_response_tokens", "last_tool_call_failed", "tool_used", "manual"
Operator string // ">", ">=", "==", "<", "<=" (unused for bool/string triggers)
Value string // numeric threshold, tool name, or "true"/"false"
}
Trigger describes a condition that causes a reminder to fire.
func ParseTrigger ¶
ParseTrigger parses a trigger expression string.
Supported formats:
"context_usage > 0.75" "turn_count >= 10" "last_response_tokens > 4000" "last_tool_call_failed" → implied "== true" "tool_used == bash" "manual" → only fires via explicit /remind