rust-soham/golem-claw/golem-recurring-task-ts
- community
Checking that the SKILL.md file is still in the repository.
Implementing a recurring (cron-like) task in a TypeScript Golem agent by self-scheduling future invocations. Use when the user asks about periodic tasks, recurring jobs, cron-like scheduling, polling loops, heartbeats, or self-scheduling agents.
Install
npx vskill@latest install rust-soham/golem-claw/golem-recurring-task-tsSKILL.md
Recurring Tasks via Self-Scheduling (TypeScript)
Overview
A Golem agent can act as its own scheduler by calling .schedule() on itself at the end of each invocation. This creates a durable, crash-resilient recurring task — if the agent restarts, the scheduled invocation is still pending and will fire at the designated time.
Basic Pattern
The agent schedules its own method to run again after a delay:
Exponential Backoff
Increase the delay on repeated failures, reset on success:
Cancellation with CancellationToken
Every method on the generated client has a .scheduleCancelable() variant that returns a CancellationToken. Store the token and call .cancel() to prevent the scheduled invocation from firing:
Cancellation via State Flag
For simpler cases, just use a boolean flag — the next scheduled poll checks it and exits early:
Cancellation from the CLI
Schedule with an explicit idempotency key and cancel the pending invocation:
Common Use Cases
Periodic Polling
Check an external API or queue for new work at regular intervals:
Periodic Cleanup
Remove expired data or stale resources on a schedule:
Heartbeat / Keep-Alive
Periodically notify an external service that the agent is alive:
Helper for Scheduling Self
Extract the scheduling logic into a helper to keep methods clean:
Key Points
- The agent is durable — if it crashes, the pending scheduled invocation still fires and the agent recovers
- Invocations are sequential — no concurrent executions of
pollon the same agent - Each
.schedule()call is a fire-and-forget enqueue; the current invocation completes immediately - Use a state flag or generation counter to stop the loop gracefully
- Keep the scheduled method idempotent — it may be retried on recovery
Recovery & Oplog Growth
Each scheduled tick (heartbeat, poll, cleanup) appends entries to the agent's oplog. For long-running or high-frequency recurring tasks, the oplog grows unboundedly, and recovery on crash will replay the full history — which becomes slow over time.
You cannot opt out of oplog writes for a durable agent. The fix is snapshot-based recovery: enable periodic snapshotting so recovery starts from the latest snapshot instead of replaying every prior tick. See `golem-custom-snapshot-ts` for the snapshotting: { every: N } / snapshotting: { periodic: ... } decorator option and saveSnapshot / loadSnapshot overrides.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingpackages/golem/.agents/skills/golem-recurring-task-ts/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/rust-soham/golem-claw/golem-recurring-task-ts)