| cron تقليدي | cron للوكيل | |
|---|---|---|
| المُجدوَل | process | agent turn كامل (prompt + موديل + أدوات) |
| الملف المُنفَّذ | shell script | prompt نصي الوكيل بيفسّره |
| المخرجات | stdout ثابت | رد الوكيل بلغة طبيعية |
| الوجهة | ملف / mail | قناة مراسلة (Telegram, Discord…) أو webhook |
| الحتمية | تام | احتمالي — نفس الـ prompt ممكن يطلع مختلف |
| التكلفة | صفر | tokens لكل tick |
hermes cron run بيشتغل متزامن من غير scheduler.# البوابة: cron جزء منها — لازم تكون شغالة
hermes gateway install # خدمة مستخدم
sudo hermes gateway install --system # على السيرفرات: بتتشت مع البوت
hermes gateway run # foreground — الأفضل للـ debug
# إنشاء job — ترتيب الـ positional args: schedule الأول، prompt التاني
hermes cron create "every 2h" "Check server status"
# من الشات
/cron add "every 2h" "Check server status"
/cron add "in 30m" "Remind me to check the build"
# بأعلام كاملة
hermes cron create "every 1d at 09:00" "Audit open PRs and post a summary" \
--name "daily-pr-audit" \
--deliver telegram \
--repeat 0
# الوضع الخالي من الوكيل: الـ script هو الـ job — صفر LLM
hermes cron create "every 5m" \
--no-agent \
--script memory-watchdog.sh \
--deliver telegram \
--name "memory-watchdog"
# بوابة wakeAgent: لو السكربت طبع {"wakeAgent": false} كآخر سطر
# الـ cron بيتخطى الـ agent run بالكامل للـ tick ده
hermes cron create "every 30m" "A new feed.json has landed. Summarize what changed." \
--script feed-changed.sh
# وضع الرصد — نفس الفلسفة بس من غير سكربت تكتبه بنفسك
hermes cron create "every 5m" "If the output changed, report what changed" \
--monitor-script health-check.sh \
--deliver telegram
# ~/.hermes/scripts/new-rows.py
import json, sqlite3
conn = sqlite3.connect("/home/me/data/app.db")
n = conn.execute(
"SELECT COUNT(*) FROM messages WHERE ts > strftime('%s','now','-2 hours')"
).fetchone()[0]
if n < 1:
print(json.dumps({"wakeAgent": False})) # صفر تكلفة
else:
print(json.dumps({"wakeAgent": True, "context": {"new_rows": n}}))
| الحالة | الأداة | التكلفة |
|---|---|---|
| شغل يحتاج استنتاج | job عادي + prompt | ticks × tokens |
| شغل محدد بالكامل بالسكربت | --no-agent --script |
✔ $0 |
| استطلاع كل 1–5 دقايق | script + wakeAgent |
✔ $0 في الفاضي |
| كشف حدث فوري | webhook deliver_only |
✔ $0 |
--monitor-script لازم تكون مستقرة — مفيش timestamps.--deliver، مش بمطالبة الوكيل يبعت# الوجهات الشائعة في --deliver
hermes cron create "every 1d at 7am" "Write the daily ops report as your final reply" \
--deliver "telegram,discord" \
--name daily-ops-report
# failure-deliver: وجهة إشعارات الفشل بس — local = اكتم الفشل
hermes cron create "every 1h" "Probe the API" \
--deliver local \
--failure-deliver telegram
# كل قيم التسليم Possible
origin | local | telegram | telegram:123456 | telegram:-100123:17585
discord | discord:#engineering | slack | whatsapp | signal | matrix
mattermost | email | sms | homeassistant | dingtalk | feishu | wecom
weixin | bluebubbles | qqbot | bot-chat | bot-chat:research
all | origin,all
# ~/.hermes/config.yaml
cron:
wrap_response: false # سلّم الرد الخام من غير إطار
media_send_timeout_seconds: 600 # 10 دقايق لكل مرفق
bot_chat_delivery_timeout_seconds: 900 # bot-chat = شواهد، مش ثواني
standalone_send_timeout_seconds: 120
script_timeout_seconds: 1800 # 30 دقيقة
# فترة ثابتة — إنت اللي بتحدد الساعة
/loop 2m poll the build at ci.example.com/job/42 and ping me the moment it finishes
/loop 2m poll CI --times 30
/loop 5m watch the queue --until queue depth reaches zero
# إيقاع ذاتي — Hermes بيحدد الساعة (backoff أُسّي من floor لـ ceiling)
/loop keep an eye on the migration and summarize progress
# التحكم
/loop # الحالة: الإيقاع والتكرارات والوقت للـ tick الجاي
/loop pause / loop resume / loop stop
/proactive ... # alias لـ /loop
| /loop | /goal | cron | |
|---|---|---|---|
| المُحفّز | Timer أو self-paced | حكم الـ judge بعد كل turn | جدول، بره أي جلسة |
| مين بيشغّل | جلستك الحالية | جلستك الحالية | جلسة جديدة لكل run |
| ينتهي لما | شرط التوقف / سقف التكرارات / إنت | الهدف يتحقق / الميزانية / إنت | إنت تمسح الـ job |
| الأفضل لـ | polling، مراقبة، إعادة تشغيل دورية | هدف واحد، تكرار لحد ما يخلص | غير مراقب، جداول طويلة الأمد |
LOOP_COMPLETE · --times · --until · /loop stop · loops.max_ticks.# ~/.hermes/config.yaml
loops:
min_interval_seconds: 30 # حد أدنى للفترات الثابتة
max_ticks: 100 # ميزانية backstop (0 = بلا حد)
self_paced_floor_seconds: 60 # بداية الإيقاع الذاتي
self_paced_ceiling_seconds: 900 # أقصى backoff ذاتي
{
commands: {
ownerAllowFrom: ["telegram:123456789"],
},
agents: {
defaults: {
heartbeat: {
every: "30m",
target: "owner", // افتراضي: DM المشغّل من ownerAllowFrom
},
},
entries: {
main: { default: true },
ops: {
heartbeat: { every: "1h", target: "whatsapp", to: "+155****4567" },
},
},
},
}
# monitor scratch = "checklist الـ heartbeat" — بيتلحق بالـ prompt لو موجود
openclaw cron list --all # عشان تجيب الـ jobId
openclaw cron scratch <jobId> # اقرأ الحالي
openclaw cron scratch <jobId> --set "..." # استبدل بنص محدد
openclaw cron scratch <jobId> --file notes.md # من ملف (- للـ stdin)
openclaw cron scratch <jobId> --unset # امسحه
# التحكم اليدوي
openclaw system event --text "Check for urgent follow-ups" --mode now
openclaw system heartbeat last
openclaw system heartbeat enable
openclaw system heartbeat disable
NO_REPLY / HEARTBEAT_OK ≤ 300 حرف → الرد بيتسقط.| OpenClaw | Hermes | |
|---|---|---|
| المفهوم | monitor مملوك للنظام | /loop = turn داخل جلستك |
| الافتراضي | 30m (أو 1h بـ OAuth) | /loop بيبدأ بإيقاعك إنت |
| الاعتمادية | ✘ معلّق لو cron.enabled: false | ✔ cron مستقل تماماً |
| Retry | دقيقة سماح + طابور دائم | retry_unreachable: 5/15/30 د |
# ~/.hermes/.env — التفعيل
WEBHOOK_ENABLED=true
WEBHOOK_PORT=8644 # افتراضي
WEBHOOK_SECRET=your-global-secret
# التحقق إن السيرفر شغّال
curl http://localhost:8644/health
# {"status": "ok", "platform": "webhook"}
# نقطة عنوان الـ route
http://your-server:8644/webhooks/<route-name>
# الاشتراكات الديناميكية
hermes webhook subscribe github-issues \
--events "issues" \
--prompt "New issue #{issue.number}: {issue.title}\nBy: {issue.user.login}" \
--deliver telegram --deliver-chat-id "-100123456789"
hermes webhook list
hermes webhook test github-issues --payload '{"issue": {"number": 42, "title": "Test"}}'
hermes webhook remove github-issues
# ~/.hermes/config.yaml — مثال كامل
platforms:
webhook:
enabled: true
extra:
port: 8644
secret: "global-fallback-secret"
routes:
github-pr:
events: ["pull_request"]
secret: "github-webhook-secret"
prompt: |
Review this pull request:
Repository: {repository.full_name}
PR #{number}: {pull_request.title}
URL: {pull_request.html_url}
skills: ["github-code-review"]
deliver: "github_comment"
deliver_extra:
repo: "{repository.full_name}"
pr_number: "{number}"
deploy-notify:
events: ["push"]
secret: "deploy-secret"
prompt: "New push to {repository.full_name} {ref}: {head_commit.message}"
filters:
- field: "ref"
equals: "refs/heads/main"
deliver: "telegram"
| المصدر | آلية التحقق |
|---|---|
| GitHub | X-Hub-Signature-256 — HMAC-SHA256 |
| GitLab | X-Gitlab-Token — مطابقة نصية |
| Generic V2 (موصى به) | X-Webhook-Signature-V2 ±300 ثانية |
| Standard Webhooks | webhook-id + webhook-signature |
deliver_only يدفع إشعار عادي — صفر LLM# Push إشعار فوري — صفر توكنز، تسليم أقل من ثانية
platforms:
webhook:
enabled: true
extra:
port: 8644
secret: "global-secret"
routes:
antenna-matches:
secret: "antenna-webhook-secret"
deliver: "telegram"
deliver_only: true
prompt: "🎉 New match: {match.user_name} matched with you!"
deliver_extra:
chat_id: "{match.telegram_chat_id}"
# تعليق على PR — بيحتاج gh CLI متوثّق
github-pr:
deliver: "github_comment"
deliver_extra:
repo: "{repository.full_name}"
pr_number: "{number}"
# تسليم github_comment بيستخدم gh CLI — لازم يتوثّق على الـ host
gh auth login
# أنواع التسليم المتاحة في الـ webhook
log (افتراضي ومفيد للاختبار) | github_comment
telegram | discord | slack | signal | sms | whatsapp
matrix | mattermost | homeassistant | email
dingtalk | feishu | wecom | weixin
| الكود | المعنى |
|---|---|
200 OK |
اتسلّم |
200 (duplicate) |
تكرار خلال ساعة |
202 |
اتدَمج أو اتجدول |
401 |
توقيع HMAC غلط |
404 |
اسم route مش معروف |
413 / 429 |
تجاوز الحجم / rate limit |
502 |
الهدف رفض |
deliver_only: true يتطلب deliver هدف حقيقي.| Polling | Event-driven | |
|---|---|---|
| إيه اللي بيزوّد الاستهلاك | عدد الـ ticks | عدد الأحداث الفعلية |
| زمن الاكتشاف | حتى طول الفترة | ✔ فوراً |
| حمل LLM | كل tick | بس لما حدث فعلي |
| مثال | /loop 2m poll CI |
webhook على pull_request_review |
# OpenClaw — event-driven من stdout/stderr lines لعملية طويلة
openclaw automations add \
--name "Build event stream" \
--stream-command '["node","scripts/build-events.mjs"]' \
--stream-mode match \
--stream-match '^(failed|recovered):' \
--stream-batch-ms 250 \
--session isolated \
--message "Investigate these build events."
# السلسلة عبر context_from — آخر output ناجح بيتحقن فوق الـ prompt
cronjob(action="create", name="daily-digest",
schedule="every day 7am",
context_from=["ai-news-fetch", "github-prs-fetch"],
prompt="Write the daily digest using the outputs above.")
# الاستمرارية — كل run بيشوف output الـ run السابق
cronjob(action="create", name="incremental-digest",
schedule="every 1h",
prompt="Summarize only what's new since the last digest")
# الاستمرارية من الـ CLI
hermes cron create "every 1h" "Summarize only what's new since the last digest" \
--continuity --name incremental-digest
# الـ notepad الدائم — KV ثابت عبر الـ runs للـ job
hermes cron notepad <job_id> list
hermes cron notepad <job_id> set last_page 42
hermes cron notepad <job_id> get last_page
hermes cron notepad <job_id> delete last_page
# event-triggered cron: شعل job موجود عند كل حدث webhook
hermes webhook subscribe pr-feedback \
--events "pull_request_review" \
--cron-job "pr-review-sweeper" \
--prompt "PR #{number} received feedback: {review.body}"
| الآلية | Hermes | OpenClaw |
|---|---|---|
| سلسلة الوظائف | ✔ context_from | ✘ |
| استمرارية الـ run | ✔ --continuity | ✘ |
| Event-triggered cron | ✔ cron_job | ✘ |
| KV دائم للـ job | ✔ cron notepad | scratch (heartbeat) |
| Task Flow متعدد الخطوات | ✘ | ✔ openclaw tasks flow |
| Stream source | ✘ | ✔ --stream-command |
# سجل المحاولات — claimed → running → (completed | failed | unknown)
hermes cron runs <job-id> --limit 20 # alias: history
# الحوادث: ننبّه مرة واحدة على نفس الخطأ، مش كل run
hermes cron incidents
hermes cron incidents --state alerted # detected | alerted | resolved | closed
hermes cron incidents ack <id> # اعترف — اسكت التوقيع ده للأبد
# فحص شامل read-only — بيخرج بـ 1 لو فيه ملاحظة قائمة
hermes cron doctor
# ~/.hermes/config.yaml
cron:
preflight: false # تعطيل فحص ما قبل أي تكلفة
retry_unreachable: false # default true — يعطّل re-runs الـ 5/15/30
failure_repeat_alert_hours: 6 # تذكير واحد بعد 6 ساعات، بعدين صمت (0 = كل run)
failure_nudge_threshold: 3 # default — 0 يعطّل الـ nudge
misfire_grace_minutes: 10 # استنى قد إيه قبل catch-up محلي (0 = يعطّل)
catch_up_missed: false # default: true
allow_agent_scheduling: false # جلسات الـ cron ما تقدرش تنشئ cron
require_restart_safe_scope: true # fail closed بدل degradation
blocked_config + تنبيه واحد + صفر نداء LLM.# التوقف الطارئ العام — مفيش cron fire بيبدأ من أي باب
hermes pause --reason "incident response"
hermes resume
# الـ runs اللي بدأت مش بتتقتل، والتشغيل اليدوي بيفضل شغال
# الإصلاح الدائم لسلامة إعادة التشغيل تحت systemd
sudo loginctl enable-linger <gateway-user>
# حالة المجدول: حي؟ أقرب run؟ في OVERDUE؟
hermes cron status
hermes cron list --all
# لوجات الـ gateway
journalctl -u hermes-gateway -f # Linux service
tail -f ~/.hermes/logs/gateway.log # الملف
openclaw logs --follow # OpenClaw
#!/usr/bin/env bash
# ~/.hermes/scripts/cron-health.sh — جدول المراقبة الأسبوعي
echo "=== Cron health $(date -u +%FT%TZ) ==="
hermes cron status || echo "SCHEDULER PROBLEM"
echo "--- Doctor ---"
hermes cron doctor || echo "DOCTOR FOUND ISSUES"
echo "--- Open incidents ---"
hermes cron incidents --state alerted
echo "--- Recent failures ---"
hermes cron runs --limit 20
pull_request ينشر تعليق مراجعة عبر gh.deliver_only: true يدفع التنبيه فوراً.bot-chat: المجدول بيتصرف في الخرج — المستلم هو البوت نفسه.--monitor-script — صفر تكلفة في غير المتغير.--no-agent — stdout فاضي يعني صمت.| الميزة | OpenClaw | Hermes Agent |
|---|---|---|
| جدول بلغة طبيعية | --at، --every |
✔ every monday 9am |
| تحكم في التوقيت | ✔ --tz, --stagger | ✘ |
| Heartbeat | ✔ مملوك للنظام | ✘ استخدم /loop |
| Task Flow | ✔ openclaw tasks flow | ✘ |
| Hooks داخلية | ✔ openclaw hooks | ✘ |
| Webhook HMAC | Bearer token | ✔ 5 طرق + replay protection |
| Webhook filters + coalesce | ✘ | ✔ تعريفية + دمج |
| تسليم مباشر | ✘ | ✔ deliver_only |
| Event-triggered cron | ✘ | ✔ cron_job |
| No-agent / monitor mode | --command payload |
✔ --no-agent + monitor |
| Retry ladder | error-backoff | ✔ 5/15/30 د |
| Failure incidents | ✘ | ✔ hermes cron incidents |
| Preflight validation | ✘ | ✔ blocked_config |
| Job chaining | ✘ | ✔ context_from |
| وجوه التسليم | --channel |
✔ 20+ هدف |
| قفل طارئ عام | تعطيل الـ jobs | ✔ hermes pause |
| إعادة تشغيل آمنة | ✔ | .tick.lock + scope |
| الطبقة | الهدف | المخرجات |
|---|---|---|
| 1 — collect | سكربت يجمع بيانات العمليات بدون LLM | collect-ops.py → JSON |
| 2 — daily cron | تقرير يومي 7:00 على تيليجرام | daily-ops-report |
| 3 — webhook | تنبيه فوري عند deploy فاشل | deploy-failed route |
| 4 — reliability | watchdog صامت + تقرير صحة + kill switch | cron-watchdog |
# 1. التجهيز — البوابة شغالة + السكربت في المسار الإجباري
hermes gateway status
mkdir -p ~/ops-report/scripts
cp ~/ops-report/scripts/collect.py ~/.hermes/scripts/collect-ops.py
python3 ~/.hermes/scripts/collect-ops.py /tmp/ops.json # اختبره محلياً
# 2. الـ job اليومي — LLM بيخلّص الداتا المباشرة
hermes cron create "every day at 7am" \
"Here is the ops data for today as JSON. Write a concise daily ops report
in English with sections: (1) Service health (2) Deploys (3) Errors
(4) Open PRs. End with a one-line overall health verdict
(GREEN/YELLOW/RED). Keep it under 200 words. Write the report as your
final response — do not send any message yourself." \
--script collect-ops.py \
--deliver telegram \
--name daily-ops-report \
--model gpt-5-mini \
--reasoning-effort minimal
# 3. الـ watchdog الصامت — stdout فاضي يعني مفيش مشكلة
hermes cron create "every 30m" "" \
--no-agent \
--script cron-health.sh \
--deliver telegram \
--name cron-watchdog
# 4. التحقق النهائي
hermes cron doctor # لازم يطلع 0 findings
hermes cron run daily-ops-report
hermes webhook test deploy-failed --payload '{"deployment": {"status": {}}}'
hermes pause && hermes resume
failed — الـ run فشل
delivery_failed — وبيتحفظ في last_delivery_error
ok — التسليم مش مهم
unknown — الـ attempt اتقطع
--script + بوابة wakeAgent
--no-agent — الوكيل مش هيتنادى
/loop 5m في الجلسة
deliver_only: true + deliver: telegram
--no-agent — ده flag للـ cron
deliver: log + deliver_only
coalesce بنافذة صفر