Logo Agent Self Scheduling

Agent Self Scheduling

Cộng đồng
matyasstoch
agent-self-scheduling

How to make an AI coding agent run on a schedule, loop, or interval — cron jobs, heartbeats, self-starting/self-terminating loops, recurring autonomous checks. Use when the user asks to "run every N minutes/hours", "check something on a regular interval", "schedule a task", "run on a loop", "self-start", "heartbeat", "cron job for an agent", or wants an agent to fire periodically without manual launching. Covers two camps — one-shot agents you wrap in an external clock (Claude Code, Codex, Pi) vs agents with a built-in scheduler daemon (Hermes).

Tổng quan

Nhà phát hànhmatyasstoch
Kho mãdavid-skills
Tên kỹ năngagent-self-scheduling
Sao
61
Bản fork
11
Tệp đi kèm
Chỉ có hướng dẫn
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Hướng dẫn có đủ mọi thứ cần thiết

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được matyasstoch công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Agent Self Scheduling trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/matyasstoch/david-skills/tree/main/skills/autonomous-ai-agents/agent-self-scheduling
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/matyasstoch/david-skills.git /tmp/david-skills
mkdir -p .claude/skills
cp -r /tmp/david-skills/skills/autonomous-ai-agents/agent-self-scheduling .claude/skills/agent-self-scheduling
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Agent Self Scheduling trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Agent Self Scheduling ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Agent Self Scheduling với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Agent Self-Scheduling

Make an agent run periodically. First question: does the agent have a built-in scheduler, or do you own the clock?

Decision: pick the camp first

  • Need it NOW, agent has no scheduler, or sub-minute polling → Camp A (external clock).
  • Want managed recurring jobs, isolated sessions, chaining, loop safety → Camp B (Hermes built-in).

Universal floor: ALL cron is 1 minute (5-field expr, no seconds) — every camp. For sub-minute / sub-second you MUST use a dumb while ...; sleep N; done loop, a TS extension, or a webhook/event hook. Never put an LLM on a tight timer.


Camp A — One-shot agents, you own the clock

These run once and exit (amnesiac unless resumed). You schedule them externally.

One-shot invocations:

bash
claude -p "PROMPT" --output-format json --allowedTools "Read,Edit,Bash"  # Claude Code
codex exec --json "PROMPT"                                                # Codex
pi run "PROMPT"                                                           # Pi.dev (Mario Zechner; MIT; read/write/edit/bash + TS SDK)

Wrap in a clock — three options:

bash
# 1. cron (>= 1 min). Floor is 1 minute, 5 fields, NO seconds.
*/10 * * * * cd /path/to/project && pi run "check X and report" >> ~/agent.log 2>&1

# 2. systemd timer (Linux, survives reboot, better logging) — OnUnitActiveSec=10min

# 3. dumb loop (sub-minute, or when cron unavailable)
while true; do pi run "check X"; sleep 30; done

Camp A gotchas (all three break unattended runs if ignored):

  • Permissions block unattended runs. Pass --allowedTools (Claude) or a sandbox/auto-approve flag (Codex) or the run hangs on a prompt forever.
  • Use structured JSON output, not prose (--output-format json / --json) so the wrapper can parse the result deterministically.
  • Each run is amnesiac. No memory across runs unless you resume: codex exec resume --last. Otherwise persist state to a file the next run reads.

Pi specifics: Pi has NO built-in loop/scheduler/heartbeat by design — only the agent reasoning loop (not time-based). OpenClaw's runtime is built ON Pi but is a separate project. To schedule Pi: external cron/systemd, a while-sleep loop, or a TS extension for agent-side timers.

cmux (orchestration layer — NO scheduler)

cmux has NO scheduler/timer/watch/cron. It is visibility + orchestration only. Primitives: list-workspaces, read-screen (non-interruptive — safe to poll), send. An MCP wrapper cmux-agent-mcp exists.

Three ways to make cmux loop:

  • Orchestrator-driven — the orchestrator runs send → sleep → read-screen on its own clock.
  • Dumb wrapper — external while true; ...; sleep N; done.
  • Event-driven (preferred over polling) — use cmux notify + OSC 9/99/777 terminal hooks so work fires on a real signal instead of a timer. Cheaper and more responsive than read-screen polling.

Camp B — Hermes (built-in scheduler daemon)

Hermes ships a gateway that ticks every 60s and runs due jobs in fresh, isolated sessions. No external cron needed.

State-check first — is the gateway running?

bash
hermes gateway install            # user-level
hermes gateway install --system   # survives reboot (boot-time)

Create jobs (CLI or /cron add in TUI):

bash
hermes cron create "every 1h" "summarize new emails and report" --skill himalaya
hermes cron create "0 9 * * *" "post daily standup"      # cron expr
hermes cron create "30m" "one-shot reminder in 30 min"   # one-shot delay

Schedule formats: one-shot delays (30m, 2h), recurring (every 30m, every 1d), cron (0 9 * * *), ISO timestamps.

Hermes-unique capabilities:

  • Zero-token / no-agent mode — run a script on schedule, deliver its stdout verbatim. No LLM cost. Use for watchdogs/heartbeats where the script produces the exact message.
  • Chaining — context_from injects an upstream job's last output into a downstream job; combine with a working dir to pipeline jobs.
  • Self-terminating loops — a recurring job can stop itself when a condition is met.
  • Fresh self-contained sessions — each run starts clean; the prompt must carry all needed context (no chat history).
  • Loop safety — cron-run sessions CANNOT create more cron jobs (prevents runaway recursion). Don't try to schedule from inside a scheduled job.
  • Persistent /goal loop — long-running autonomous loop with pause/resume, separate from cron.

Heartbeat pattern (proactive self-check)

A heartbeat = a fast recurring tick that gates slower per-task checks, so one loop handles many intervals at different cadences.

  • In Camp B: a recurring Hermes job (e.g. every 5m) whose prompt/script checks a task list and only acts on tasks whose own interval is due. Use no-agent mode + a script for zero token cost when nothing's due.
  • In Camp A: same idea via a while-sleep loop that reads a tasks file and per-task last_run timestamps.
  • Save tokens: define active-hours and skip ticks outside them; skip the tick entirely when there's nothing due (stay silent — don't emit empty noise).

Verify it actually fires (do this before reporting success)

  1. Camp A: check the log file grows after one interval, or run the wrapped command once by hand and confirm clean JSON exit (0).
  2. Camp B: hermes cron list shows the job; check next_run; trigger once with a run-now to confirm it executes and delivers.
  3. Confirm permissions/sandbox flags are present (Camp A) — the #1 silent failure is a hung permission prompt.
  4. For heartbeats, confirm a tick with nothing-due stays silent (no spam).

Pitfalls

  • Cron CANNOT do sub-minute. Don't promise every 30s via crontab — use a loop.
  • Camp A unattended hangs without explicit tool allowlists / sandbox.
  • Don't schedule a job from inside a scheduled Hermes job (loop safety blocks it).
  • Each scheduled run is a fresh/amnesiac session — pass all context in the prompt or persist to a file.

Câu hỏi thường gặp

Kỹ năng AI Agent Self Scheduling làm được gì?

How to make an AI coding agent run on a schedule, loop, or interval — cron jobs, heartbeats, self-starting/self-terminating loops, recurring autonomous checks. Use when the user asks to "run every N minutes/hours", "check something on a regular interval", "schedule a task", "run on a loop", "self-start", "heartbeat", "cron job for an agent", or wants an agent to fire periodically without manual launching. Covers two camps — one-shot agents you wrap in an external clock (Claude Code, Codex, Pi) vs agents with a built-in scheduler daemon (Hermes).

Vì sao nên dùng Agent Self Scheduling trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Agent Self Scheduling là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Agent Self Scheduling trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/matyasstoch/david-skills/tree/main/skills/autonomous-ai-agents/agent-self-scheduling. TypingMind đọc tệp SKILL.md rồi cài đặt kỹ năng để bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Agent Self Scheduling?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Agent Self Scheduling với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Agent Self Scheduling với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Agent Self Scheduling có miễn phí không?

Kỹ năng này được matyasstoch phát hành trên GitHub. Hãy xem điều khoản giấy phép trong kho mã. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇