Proactive ticks
Proactive ticks let the main agent wake itself while the session is idle, decide whether there is useful work left, do one bounded slice of it, and then yield until the next wake-up. They are on by default.
Turning it off
Two gates control the feature: the experimental flag and the config section. Either one turns it off.
NEXGEN_EXPERIMENTAL_PROACTIVE=0 nexgenk[proactive]
enabled = falseThe defaults below are what ships. With either gate closed, no tick service, no Sleep tool, and no timer exist for the session.
[proactive]
enabled = true
tick_seconds = 300
min_sleep_seconds = 30
max_sleep_seconds = 3600
idle_tick_limit = 3
max_ticks_per_day = 48
max_tokens_per_day = 2000000
max_window_minutes = 480
allow_yolo = falseWhen the agent wakes
A tick is only admitted when every one of these holds:
- The agent is the main agent; subagents and child sessions never tick.
- The loop is idle, unpaused, with an empty queue and no pending requests.
- No full compaction is running.
- No goal is active: a goal already keeps the session working, and two drivers would double the cost.
- The next cron fire is farther away than the tick horizon, so the tick never steals a cron turn.
- The permission mode is
auto. Withyolo, ticks stay off unlessallow_yolo = true; inmanualthe agent would block on an approval that no one is there to answer. - The daily tick and token budgets are not spent, and the armed window has not elapsed.
When a condition fails, the scheduler waits instead of spinning: it retries after tick_seconds (never past the next cron fire), or turns itself off for the permanent conditions (flag or config off, non-main agent).
The Sleep tool
Sleep({ seconds, reason? }) ends the current turn and schedules the next wake-up. The tool clamps seconds to min_sleep_seconds…max_sleep_seconds, so asking for 10 seconds cannot spin the loop.
Each wake-up costs one model call and the prompt cache expires after about five minutes, so the tick prompt tells the agent to sleep at least 300 seconds unless an external event is imminent.
Control and safety
- You always win. Typing a message while a tick owns the loop cancels the tick turn and runs yours; a tick that has not started yet is dropped.
- Ctrl-C stops it. Cancelling a tick parks the scheduler with a visible reason; only new input starts it again.
- Forking parks it. A forked session never inherits an active scheduler.
- Backoff. A tick turn that ends without
Sleepis treated as unproductive: the next wake-up moves out to 60, 300, 900, then 3600 seconds, and afteridle_tick_limitsuch turns the scheduler parks. - Budgets.
max_ticks_per_dayandmax_tokens_per_daycap a day's activity;max_window_minutescaps how long the scheduler may stay armed in one stretch.
See also
- Durable objective — the other driver that keeps a session working; a goal always takes precedence over ticks.
- Config files — how sections and environment variables are resolved.