Skip to main content
Session reset policies automatically clear bot conversation history after inactivity or at a scheduled time, preventing unbounded context growth.

Quick Start

1

Idle reset after 30 minutes

channels:
  telegram:
    token: ${TELEGRAM_BOT_TOKEN}
    session:
      reset:
        mode: idle
        idle_minutes: 30
2

Daily reset at 04:00

channels:
  discord:
    token: ${DISCORD_BOT_TOKEN}
    session:
      reset:
        mode: daily
        at_hour: 4
3

Combined idle + daily

channels:
  slack:
    token: ${SLACK_BOT_TOKEN}
    app_token: ${SLACK_APP_TOKEN}
    session:
      max_history: 100
      reset:
        mode: both
        idle_minutes: 60
        at_hour: 4

How It Works

Reset checks run in BotSessionManager._load_history() before reusing existing history: Idle timestamps are tracked per user. Idle timeout uses monotonic time; daily reset uses wall-clock hour.

Reset Modes

ModeBehaviour
noneNo automatic reset (default — backward compatible)
idleReset after N minutes of inactivity
dailyReset at a specific hour each day (0–23)
bothCombine idle and daily reset

Configuration Options

OptionTypeDefaultDescription
modestr"none"One of none, idle, daily, both
idle_minutesint60Minutes of inactivity before reset (≥1). Used when mode includes idle.
at_hourintNoneDaily reset hour (0–23). Required when mode is daily or both.
max_historyint100Maximum history entries (parent session block).
Configure under each channel’s session.reset block in gateway.yaml or bot.yaml.

Common Patterns

Customer support — drop stale conversations when the customer leaves:
session:
  reset:
    mode: idle
    idle_minutes: 30
Daily briefing bot — fresh start each midnight:
session:
  reset:
    mode: daily
    at_hour: 0
Compliance bot — idle timeout plus nightly sweep:
session:
  reset:
    mode: both
    idle_minutes: 15
    at_hour: 2

Best Practices

Session Reset Policy (this feature) clears a user’s conversation history based on idle or scheduled time — configured per channel in YAML.Session Reaper (session_ttl on BotConfig) prunes the in-memory session record of stale users. They solve different problems; use both for long-running bots.
Combine session.max_history with reset policies to cap context size and cost. Reset clears history entirely; max_history trims retained turns during an active session.
Users can always send /new for an immediate reset. Manual reset works alongside automatic policies — see Bot Commands.

Messaging Bots

Multi-platform bot setup and YAML config

Bot Commands

Built-in /new, /help, and /status commands

Sessions

Agent-level session management

Session Persistence

Persisting session state to disk