الأكاديمية ← ميزات Hermesتوثيق رسمي · إرشاد عربي

الحلقات المتكررة

Recurring Loops

متوسط6 دقائق قراءةالدرس 443 أسئلة2026-08-18
قبل أن تقرأ

ما هذه الصفحة، وماذا تحتوي.

تشرح هذه الصفحة الرسمية: «Re-run a prompt on a recurring interval inside your session — Hermes' take on Claude Code's /loop.». تضم 10 أقسام و6 أمثلة برمجيًا و3 جداول، وتحتاج نحو 6 دقائق للقراءة المتأنية.

9أقسام
6أمثلة برمجية
3جداول
0أوامر
1,046كلمة من المصدر
الوصف الرسمي في سطر

Re-run a prompt on a recurring interval inside your session — Hermes' take on Claude Code's /loop.

ماذا ستستطيع بعدها

نتائج مأخوذة من هذه الصفحة، لا من قالب.

  • تقرأ جداول الصفحة وتختار الصف الذي يطابق نظامك أو حالتك بدل تطبيق كل شيء.
  • تعدّل مفاتيح الإعداد الصحيحة مثل loops من دون كسر بقية الإعداد.
  • تتنقّل بين أقسام الصفحة (When to use it، Quick start) وتعرف أين تجد ما تحتاجه لاحقًا.
خريطة الصفحة

انتقل مباشرة إلى ما تحتاجه.

  1. 01When to use it
  2. 02Quick start
  3. 03The two cadence modes
  4. 04Stop conditions
  5. 05Commands
  6. 06Mixing with `/goal`
  7. 07Behavior details
  8. 08Configuration
  9. 09`/loop` vs `/goal` vs cron
الصفحة الرسمية كاملة

بلا اختصار أو حذف.

النص أدناه منقول من المصدر الرسمي بالإنجليزية حتى تبقى الأوامر والأسماء دقيقة كما هي. قبل كل قسم شرح عربي يوضّح ما بداخله.

/loop re-runs a prompt (or a slash command) on a recurring cadence inside your current session. Each wakeup is a real agent turn: Hermes reads the current state fresh — the latest CI result, the newest queue depth, the file as it is now — does the work, reports back, and goes quiet until the next tick.

It's Hermes' take on Claude Code's /loop (and its /proactive alias, which works here too). Where /goal is judge-driven — "keep working until this objective is achieved" — /loop is timer-driven: "do this again every N minutes (or whenever it makes sense) until something says stop."

When to use it

  • Polling external state. "Watch the deploy / the CI run / the queue and tell me when it changes." The canonical use case.
  • Iterate-until-green. "Run the tests, fix what fails, repeat until they pass."
  • Monitoring during a work session. Keep an eye on error rates or a long job's progress while you do something else in the same conversation.
  • Periodic housekeeping. Re-run a lint pass or a status summary every N minutes during a long session.

When the work should run unattended — overnight, on a real schedule, surviving restarts of your terminal — use a cron job instead. /loop lives inside a session; cron lives outside all of them. And when the task is a single objective with a definition of done, /goal is usually the better fit.

Quick start

شرح نصي بلا أوامر أو جداول. الفكرة الأساسية كما وردت في المصدر: «/loop 5m check the deploy status and tell me if it's live yet What you'll see: Loop accepted — ↻ Loop set (every 5m): check the deploy status… First wakeup in 5m — while the session is idle…»

Textسطر واحد
/loop 5m check the deploy status and tell me if it's live yet

What you'll see:

  1. Loop accepted↻ Loop set (every 5m): check the deploy status…
  2. First wakeup in 5m — while the session is idle, Hermes injects the wakeup and runs a normal turn against current state.
  3. Repeat — every 5 minutes, until a stop condition fires or you stop it.

Loop a slash command just as easily:

Textسطر واحد
/loop 10m /recap

The two cadence modes

شرح نصي بلا أوامر أو جداول. الفكرة الأساسية كما وردت في المصدر: «Fixed interval — you set the clock.»

Fixed interval — you set the clock. Give an interval (30s, 5m, 2h, 1h30m) and the loop fires on that schedule. Use it when the thing you're watching changes on its own timeline:

Textسطر واحد
/loop 2m poll the build at ci.example.com/job/42 and ping me the moment it finishes

Self-paced — Hermes sets the clock. Omit the interval and the loop paces itself: it starts at the floor (1 minute by default), and while the agent's replies stop changing it backs off exponentially — 2m, 4m, 8m, up to the ceiling (15 minutes by default). The moment a reply differs from the last one, cadence snaps back to the floor. Change detection is a local digest comparison (timestamps are ignored), so idle waits cost nothing extra:

Textسطر واحد
/loop keep an eye on the migration and summarize progress

The rule of thumb: fixed interval when an external clock drives the work; self-paced when the work drives the rhythm.

Stop conditions

يحتوي على جدول واحد يبدأ بعمود «Condition» ويضم 5 صفوف؛ اقرأ الصف الذي يطابق حالتك فقط.

A loop ends when any of these fires:

ConditionHow
The agent decides it's doneThe wakeup prompt teaches the agent to end its reply with LOOP_COMPLETE on its own line when the task is finished or moot.
A run cap--times N — stop after N wakeups.
An evidence-based condition--until <condition> — after each wakeup, the same auxiliary judge that powers /goal checks the reply against your condition (fail-open: a broken judge never wedges the loop).
You/loop stop (or /loop pause to keep it around).
The backstop budgetloops.max_ticks (default 100) pauses the loop so an unattended session can't burn tokens forever. 0 = unlimited.

Examples:

Textسطران
/loop 2m poll CI --times 30
/loop 5m watch the queue --until queue depth reaches zero

Commands

يحتوي على جدول واحد يبدأ بعمود «Command» ويضم 6 صفوف؛ اقرأ الصف الذي يطابق حالتك فقط.

CommandWhat it does
/loop [interval] <prompt> [--times N] [--until <cond>]Start (or replace) the loop for this session.
/loop or /loop statusShow cadence, ticks fired, and time to the next wakeup.
/loop pauseStop firing without losing the loop.
/loop resumePick it back up.
/loop stopEnd the loop.
/proactive …Alias for /loop (Claude Code parity).

Works on the CLI, the TUI (hermes --tui), the web dashboard chat, the desktop app, and every gateway platform (Telegram, Discord, Slack, WhatsApp, …). On messaging platforms the gateway fires wakeups even between your messages — the loop belongs to the chat's session, and its results arrive as ordinary replies.

Mixing with `/goal`

شرح نصي بلا أوامر أو جداول. الفكرة الأساسية كما وردت في المصدر: «Both features inject synthetic turns at idle boundaries, so they follow one rule: an active goal owns the session.»

Both features inject synthetic turns at idle boundaries, so they follow one rule: an active goal owns the session. While a /goal is actively driving (judge saying "continue"), loop wakeups defer. The loop resumes using idle time as soon as the goal finishes, pauses, or parks itself on a wait barrier (/goal wait, or the judge's automatic WAIT verdict). A parked goal plus a /loop is a natural combo: the goal waits on the big async thing while the loop keeps a heartbeat on something else.

A real user message always wins over both — wakeups only fire while the session is idle and nothing of yours is queued.

Behavior details

شرح نصي بلا أوامر أو جداول. الفكرة الأساسية كما وردت في المصدر: «A wakeup is a normal user-role turn.»

  • A wakeup is a normal user-role turn. No system-prompt mutation, no toolset swap — prompt caching stays intact.
  • Survives /resume and compression. Loop state persists per session and migrates across context-compression boundaries, same as /goal.
  • One loop per session. Setting a new /loop replaces the old one. Run several loops by running several sessions (or use cron for a fleet of schedules).
  • Interrupting a wakeup turn (Ctrl+C) pauses the loop — recoverable with /loop resume, so cancel actually means cancel.
  • Token cost scales with cadence. Every tick is a full agent turn. Match the interval to how often the state actually changes; prefer self-pacing for idle waits.

Configuration

يشرح مفاتيح إعداد مثل loops. يشير إلى مسارات على جهازك مثل ~/.hermes/config.yaml.

YAML6 أسطر
# ~/.hermes/config.yaml
loops:
  min_interval_seconds: 30       # floor for fixed intervals
  max_ticks: 100                 # backstop budget (0 = unlimited)
  self_paced_floor_seconds: 60   # self-paced starting cadence
  self_paced_ceiling_seconds: 900  # self-paced max backoff

The --until judge routes through the goal_judge auxiliary task, so auxiliary.goal_judge.* overrides (provider, model, max_tokens) apply to loop conditions too.

`/loop` vs `/goal` vs cron

يحتوي على جدول واحد يبدأ بعمود «/loop» ويضم 4 صفوف؛ اقرأ الصف الذي يطابق حالتك فقط.

/loop/goalcron
TriggerTimer (or self-paced)Judge verdict after each turnSchedule, outside any session
Lives inYour current sessionYour current sessionIts own session per run
Ends whenStop condition / caps / youGoal achieved / budget / youYou remove the job
Best forPolling, monitoring, periodic re-runsOne objective, iterate until doneUnattended, long-horizon schedules
اختبار الفهم

3 أسئلة إجاباتها كلها في هذه الصفحة.

كل خيار اسم حقيقي من توثيق Hermes. حتى الخيارات الخاطئة حقيقية، لكنها من صفحات أخرى.

1. في جدول هذا الدرس، ما «How» المقابل لـ«You»؟
2. أي عنوان من التالي لا يظهر في هذا الدرس؟
3. أي مفتاح إعداد يظهر في أمثلة هذا الدرس؟