Skip to content

The /loop Tool — Recurring Prompts from Chat

The /loop tool lets the AI schedule a prompt to re-run on a recurring interval from within a chat session (bnerd pa, :chat, or a team-lead session). Loops persist across process restarts and fire back into the active session at each interval.

Availability

The /loop tool is available in bnerd pa and :chat mode. It is also accessible from a team-lead session. It is not available inside a teammate session.

Creating a loop

Ask the AI to schedule a recurring check, or use the tool directly:

> schedule a check every 30m: summarise open OpenProject tickets assigned to me

The AI calls loop_create internally:

loop_create(
  interval = "30m",
  prompt   = "Summarise open OpenProject tickets assigned to bernd"
)
→ { id: "loop-1748905200000-3f2a", next_fire: "2026-06-03T10:30:00Z" }

The loop fires every 30 minutes. Each time it fires, the prompt is injected into the session as a new user turn — the AI responds as if you typed it yourself.

Interval format

Intervals are Go duration strings: 30s, 5m, 1h, 2h30m. Constraints:

  • Minimum: 10 seconds (prevents runaway re-entry)
  • Maximum: 24 hours (longer intervals are almost certainly a typo)

Listing active loops

> what loops are running?

The AI calls loop_list, which returns all active (non-stopped) loops with their IDs, prompts, intervals, and next scheduled fire time.

You can also ask for a specific loop:

> show me loop loop-1748905200000-3f2a

Stopping a loop

> stop the ticket summary loop

The AI calls loop_stop(id: "loop-1748905200000-3f2a"). The loop is marked stopped and will not fire again. Stopped loops are retained in the store for audit purposes but are not restarted on process restart.

Persistence

Loops are stored in ~/.bnerd/loops.json. When bnerd restarts, NewLoopScheduler reads this file and re-launches any non-stopped loops at their correct next-fire time. A loop whose next_fire is in the past fires immediately on restart, then resumes its normal interval.

Safety

Creating a loop is a SafetyRead operation — the scheduler itself only fires a prompt. The actions the AI takes in response to a fired loop are governed by the session's existing safety floor. A loop cannot elevate the safety mode; the session's --ai-mode applies to every loop-triggered turn exactly as it does to your own input.

Tool reference

Tool Safety Description
loop_create(interval, prompt, label?) Read Schedule a recurring prompt
loop_list() Read List all non-stopped loops
loop_get(id) Read Get details of one loop
loop_stop(id) Read Stop a loop (irreversible; create a new one to restart)