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

أتمِت أي مهمة عبر Cron

Automate Anything with Cron

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

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

المهام المجدولة: أن تطلب من Hermes تنفيذ شيء في وقت محدد أو كل يوم، من دون أن تكون حاضرًا. هنا يتحوّل من أداة تسألها إلى مساعد يسبقك: موجز صباحي، متابعة أسبوعية، تنبيه عند تغيّر شيء. الصفحة فيها تحذير من المصدر، و8 دقائق قراءة. انتبه: المهمة التي تعمل وأنت نائم تخطئ وأنت نائم أيضًا. اجعلها تكتب تقريرًا، وجرّبها يدويًا قبل جدولتها.

8أقسام
11أمثلة برمجية
1جداول
3أوامر
1,371كلمة من المصدر
الوصف الرسمي في سطر

Real-world automation patterns using Hermes cron — monitoring, reports, pipelines, and multi-skill workflows

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

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

  • تعرف ما المهام المجدولة ولماذا قد تحتاجه.
  • تنفّذ hermes for: وhermes send وتفهم ما يحدث بعدها.
  • تقرأ الجدول وتأخذ منه السطر الذي يخصّك فقط.
  • تضبط STATE_FILE في المكان الصحيح.
ما ستقابله من أسماء

كما تظهر تمامًا داخل Hermes.

الأوامر
  • hermes for:
  • hermes send
  • hermes cron create
متغيرات البيئة
  • STATE_FILE
  • DATA_DIR
خريطة الصفحة

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

  1. 01Pattern 1: Website Change Monitor
  2. 02Pattern 2: Weekly Report
  3. 03Pattern 3: GitHub Repository Watcher
  4. 04Pattern 4: Data Collection Pipeline
  5. 05Pattern 5: Multi-Skill Workflow
  6. 06Managing Your Jobs
  7. 07Delivery Targets
  8. 08Tips
الصفحة الرسمية كاملة

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

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

The daily briefing bot tutorial covers the basics. This guide goes further — five real-world automation patterns you can adapt for your own workflows.

For the full feature reference, see Scheduled Tasks (Cron).

---

Pattern 1: Website Change Monitor

إعدادات تضبطها مرة وتنساها. غيّر واحدًا في كل مرة حتى تعرف أثر كل تغيير. تضبط STATE_FILE خارج المحادثة، في بيئة التشغيل.

Watch a URL for changes and get notified only when something is different.

The script parameter is the secret weapon here. A Python script runs before each execution, and its stdout becomes context for the agent. The script handles the mechanical work (fetching, diffing); the agent handles the reasoning (is this change interesting?).

Create the monitoring script:

Shellسطر واحد
mkdir -p ~/.hermes/scripts
Python28 سطرًا


URL = "https://example.com/pricing"
STATE_FILE = os.path.expanduser("~/.hermes/scripts/.watch-site-state.json")

# Fetch current content
req = urllib.request.Request(URL, headers={"User-Agent": "Hermes-Monitor/1.0"})
content = urllib.request.urlopen(req, timeout=30).read().decode()
current_hash = hashlib.sha256(content.encode()).hexdigest()

# Load previous state
prev_hash = None
if os.path.exists(STATE_FILE):
    with open(STATE_FILE) as f:
        prev_hash = json.load(f).get("hash")

# Save current state
with open(STATE_FILE, "w") as f:
    json.dump({"hash": current_hash, "url": URL}, f)

# Output for the agent
if prev_hash and prev_hash != current_hash:
    print(f"CHANGE DETECTED on {URL}")
    print(f"Previous hash: {prev_hash}")
    print(f"Current hash: {current_hash}")
    print(f"\nCurrent content (first 2000 chars):\n{content[:2000]}")
else:
    print("NO_CHANGE")

Set up the cron job:

Shellسطر واحد
/cron add "every 1h" "If the script output says CHANGE DETECTED, summarize what changed on the page and why it might matter. If it says NO_CHANGE, respond with just [SILENT]." --script ~/.hermes/scripts/watch-site.py --name "Pricing monitor" --deliver telegram

---

Pattern 2: Weekly Report

أوامر تكتبها في الطرفية. افهم ما يفعله الأمر قبل نسخه. الأوامر هنا: hermes cron create.

Compile information from multiple sources into a formatted summary. This runs once a week and delivers to your home channel.

Shell8 أسطر
/cron add "0 9 * * 1" "Generate a weekly report covering:

1. Search the web for the top 5 AI news stories from the past week
2. Search GitHub for trending repositories in the 'machine-learning' topic
3. Check Hacker News for the most discussed AI/ML posts

Format as a clean summary with sections for each source. Include links.
Keep it under 500 words — highlight only what matters." --name "Weekly AI digest" --deliver telegram

From the CLI:

Shell4 أسطر
hermes cron create "0 9 * * 1" \
  "Generate a weekly report covering the top AI news, trending ML GitHub repos, and most-discussed HN posts. Format with sections, include links, keep under 500 words." \
  --name "Weekly AI digest" \
  --deliver telegram

The 0 9 * * 1 is a standard cron expression: 9:00 AM every Monday.

---

Pattern 3: GitHub Repository Watcher

فيه تحذير مهم. اقرأه قبل أن تنفّذ أي شيء من هذا القسم. الأوامر هنا: hermes for:. نصّ التحذير من المصدر مذكور أسفل هذا الشرح.

Monitor a repository for new issues, PRs, or releases.

Shell11 سطرًا
/cron add "every 6h" "Check the GitHub repository NousResearch/hermes-agent for:
- New issues opened in the last 6 hours
- New PRs opened or merged in the last 6 hours
- Any new releases

Use the terminal to run gh commands:
  gh issue list --repo NousResearch/hermes-agent --state open --json number,title,author,createdAt --limit 10
  gh pr list --repo NousResearch/hermes-agent --state all --json number,title,author,createdAt,mergedAt --limit 10

Filter to only items from the last 6 hours. If nothing new, respond with [SILENT].
Otherwise, provide a concise summary of the activity." --name "Repo watcher" --deliver discord

---

Pattern 4: Data Collection Pipeline

إعدادات تضبطها مرة وتنساها. غيّر واحدًا في كل مرة حتى تعرف أثر كل تغيير. تضبط DATA_DIR خارج المحادثة، في بيئة التشغيل.

Scrape data at regular intervals, save to files, and detect trends over time. This pattern combines a script (for collection) with the agent (for analysis).

Python26 سطرًا

from datetime import datetime

DATA_DIR = os.path.expanduser("~/.hermes/data/prices")
os.makedirs(DATA_DIR, exist_ok=True)

# Fetch current data (example: crypto prices)
url = "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin,ethereum&vs_currencies=usd"
data = json.loads(urllib.request.urlopen(url, timeout=30).read())

# Append to history file
entry = {"timestamp": datetime.now().isoformat(), "prices": data}
history_file = os.path.join(DATA_DIR, "history.jsonl")
with open(history_file, "a") as f:
    f.write(json.dumps(entry) + "\n")

# Load recent history for analysis
lines = open(history_file).readlines()
recent = [json.loads(l) for l in lines[-24:]]  # Last 24 data points

# Output for the agent
print(f"Current: BTC=${data['bitcoin']['usd']}, ETH=${data['ethereum']['usd']}")
print(f"Data points collected: {len(lines)} total, showing last {len(recent)}")
print(f"\nRecent history:")
for r in recent[-6:]:
    print(f"  {r['timestamp']}: BTC=${r['prices']['bitcoin']['usd']}, ETH=${r['prices']['ethereum']['usd']}")
Shell10 أسطر
/cron add "every 1h" "Analyze the price data from the script output. Report:
1. Current prices
2. Trend direction over the last 6 data points (up/down/flat)
3. Any notable movements (>5% change)

If prices are flat and nothing notable, respond with [SILENT].
If there's a significant move, explain what happened." \
  --script ~/.hermes/scripts/collect-prices.py \
  --name "Price tracker" \
  --deliver telegram

The script does the mechanical collection; the agent adds the reasoning layer.

---

Pattern 5: Multi-Skill Workflow

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه. تذكير: أن تطلب من Hermes تنفيذ شيء في وقت محدد أو كل يوم، من دون أن تكون حاضرًا.

Chain skills together for complex scheduled tasks. Skills are loaded in order before the prompt executes.

Shell5 أسطر
# Use the arxiv skill to find papers, then the obsidian skill to save notes
/cron add "0 8 * * *" "Search arXiv for the 3 most interesting papers on 'language model reasoning' from the past day. For each paper, create an Obsidian note with the title, authors, abstract summary, and key contribution." \
  --skill arxiv \
  --skill obsidian \
  --name "Paper digest"

From the tool directly:

Python8 أسطر
cronjob(
    action="create",
    skills=["arxiv", "obsidian"],
    prompt="Search arXiv for papers on 'language model reasoning' from the past day. Save the top 3 as Obsidian notes.",
    schedule="0 8 * * *",
    name="Paper digest",
    deliver="local"
)

Skills are loaded in order — arxiv first (teaches the agent how to search papers), then obsidian (teaches how to write notes). The prompt ties them together.

---

Managing Your Jobs

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه.

Shell19 سطرًا
# List all active jobs
/cron list

# Trigger a job immediately (for testing)
/cron run <job_id>

# Pause a job without deleting it
/cron pause <job_id>

# Edit a running job's schedule or prompt
/cron edit <job_id> --schedule "every 4h"
/cron edit <job_id> --prompt "Updated task description"

# Add or remove skills from an existing job
/cron edit <job_id> --skill arxiv --skill obsidian
/cron edit <job_id> --clear-skills

# Remove a job permanently
/cron remove <job_id>

---

Delivery Targets

جدول مرجعي. لا تقرأه كله، ابحث عن السطر الذي يخصّك فقط.

The --deliver flag controls where results go:

TargetExampleUse case
origin--deliver originSame chat that created the job (default)
local--deliver localSave to local file only
telegram--deliver telegramYour Telegram home channel
discord--deliver discordYour Discord home channel
slack--deliver slackYour Slack home channel
Specific chat--deliver telegram:-1001234567890A specific Telegram group
Threaded--deliver telegram:-1001234567890:17585A specific Telegram topic thread

---

Tips

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه.

Make prompts self-contained. The agent in a cron job has no memory of your conversations. Include URLs, repo names, format preferences, and delivery instructions directly in the prompt.

Use [SILENT] deliberately. For monitoring jobs, include instructions like "if nothing changed, respond with only [SILENT]." Do not ask the agent to explain the token in quiet cases — cron treats [SILENT] as the delivery-suppression marker.

Use scripts for data collection. The script parameter lets a Python script handle the boring parts (HTTP requests, file I/O, state tracking). The agent only sees the script's stdout and applies reasoning to it. This is cheaper and more reliable than having the agent do the fetching itself.

Test with /cron run. Before waiting for the schedule to trigger, use /cron run <job_id> to execute immediately and verify the output looks right.

Schedule expressions. Supported formats: relative delays (30m), intervals (every 2h), standard cron expressions (0 9 * * *), and ISO timestamps (2025-06-15T09:00:00). Natural language like daily at 9am is not supported — use 0 9 * * * instead.

---

For the complete cron reference — all parameters, edge cases, and internals — see Scheduled Tasks (Cron).

اختبار الفهم

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

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

1. في جدول هذا الدرس، ما «Example» المقابل لـ«Specific chat»؟
2. أي متغير بيئة من التالي يظهر فعليًا في هذا الدرس؟
3. ما التحذير الذي يذكره المصدر في هذا الدرس؟
4. أي عنوان من التالي لا يظهر في هذا الدرس؟