Skip to content

[FEATURE] Flexible system reminders: multiple reminders across the agent loop #669

Description

@edenreich

Summary

System reminders today are hard-coded to exactly two: one periodic reminder fired every interval turns, and one wrap-up reminder near max_turns - both injected at a single point (before streaming). This generalizes the mechanism into a configurable list of reminders, each with its own trigger and injection point, so multiple distinct reminders can fire as the agent progresses.

Continues #79 (Dynamic system reminders) and #628 (Near-max-turns wrap-up system reminder).

Motivation

  • Only one periodic reminder text is possible; you cannot nudge about, say, memory updates and todo hygiene independently.
  • Reminders only fire pre-stream. Other moments are useful: after tool execution, at session start, near completion.
  • The companion "Persistent agent memory" feature wants a "record/update memory" reminder without hard-coding another special case.

Current state

  • Schema: PromptsAgentRemindersConfig (config/prompts.go:138) = enabled, interval, reminder_text, wrap_up_text, wrap_up_threshold.
  • Logic: shouldInjectSystemReminder / getSystemReminderMessage / injectSystemReminderIfDue (internal/agent/agent_utils.go:745-836), hard-coded periodic-vs-wrap-up.
  • Single hook: internal/agent/agent_streaming.go:48 (pre-stream). Each injection already emits a system_reminder stream event with a phase (internal/streamevent).

Proposed design

A reminders: list under agent.system_reminders, each entry named, with a trigger and a hook:

agent:
  system_reminders:
    enabled: true
    reminders:
      - name: todo-hygiene
        text: "<system-reminder>...</system-reminder>"
        trigger: interval         # interval | turns_before_max | session_start | once
        interval: 4
        hook: pre_stream          # pre_stream | post_tool | queue_drain | on_completion
      - name: wrap-up
        text: "Wrapping up soon..."
        trigger: turns_before_max
        threshold: 2
        hook: pre_stream
      - name: memory-update
        text: "Record anything durable in memory."
        trigger: session_start
        hook: pre_stream
  • Triggers: interval (every N turns), turns_before_max (wrap-up threshold), session_start (once at first turn), once (single fire when first due).
  • Hooks map to state executors: pre_stream (states/streaming_llm.go, current), post_tool (states/post_tool_execution.go), queue_drain (states/checking_queue.go), on_completion (states/completing.go).
  • The reminder name becomes the stream-event phase/id for observability.

Backward compatibility. The existing flat fields keep working: when no reminders: list is present they are internally translated into two list entries (periodic + wrap-up). Existing configs are unaffected.

Implementation notes

  • config/prompts.go: add ReminderConfig + Reminders []ReminderConfig; keep legacy fields; defaults in DefaultPromptsConfig().
  • internal/agent/agent_utils.go: replace the two-case logic with an evaluator that, given (turn, hook, ctx), returns the reminders due for that hook; iterate + inject. Consider a small domain.SystemReminderProvider so the agent depends on an interface, not the concrete config.
  • Add injection calls at the new hooks in states/post_tool_execution.go, states/checking_queue.go, states/completing.go (the pre-stream call stays in agent_streaming.go).
  • Extend internal/agent/agent_reminder_emission_test.go. Regenerate config with go run . init --overwrite.

Out of scope (future)

  • after_tool:<ToolName> conditional triggers, regex/state-conditional reminders. Land the list + hooks first.

Acceptance Criteria

  • agent.system_reminders.reminders accepts a list of named reminders, each with text, trigger, and hook.
  • Triggers supported: interval, turns_before_max, session_start, once.
  • Hooks supported: at least pre_stream and one of post_tool / on_completion, wired into the matching state executors.
  • Legacy flat fields still work (translated into list entries); existing configs need no change.
  • Each injected reminder emits a system_reminder stream event tagged with the reminder name.
  • Tests cover each trigger and hook; task lint / task test pass.

Activity

  1. added
    enhancement
    on Jun 27, 2026
  2. moved this to Todo in 2026on Jun 27, 2026
  3. edenreich commented on Jun 27, 2026

    @edenreich
    ContributorAuthor

    Companion: #670 (Persistent agent memory) consumes this - its reminder-driven memory updates become fully configurable once the reminders list lands here.

  4. inference-gateway-releaser commented on Jun 28, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.125.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

  5. moved this from Todo to Done in 2026on Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementreleased

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions