The alarm template demonstrates the most advanced pattern: a Skill (
main.py) and Daemon (watcher.py) working together through shared file storage.What is it?
The Alarm template shows how to coordinate a Skill and Daemon using shared JSON files. It demonstrates:- Skill — Parse natural language alarm requests, write to
alarms.json - Daemon — Poll
alarms.jsonevery 5 seconds, fire alarms when target time is reached - Coordination — Delete-then-write pattern for JSON files to avoid corruption
- State management — Mark alarms as “triggered” to prevent repeat firing
- Time handling — Parse ISO8601 timestamps with timezone awareness
When to use it
Use the alarm template pattern when you’re building:- Timers and alarms — Set reminders, schedule events, countdown timers
- Task schedulers — Queue work items for later execution
- State machines — Skills set state, daemons react to state changes
- Async workflows — Skills collect input, daemons process in background
Architecture
Complete code
Key patterns
Coordination through shared files
The Skill and Daemon never call each other directly. They communicate throughalarms.json:
Delete-then-write pattern for JSON
LLM-powered time parsing
The Skill uses a conversational LLM loop to parse natural language time expressions:- Relative times: “in 30 minutes”, “tomorrow at noon”
- Absolute times: “3pm”, “March 4th at 2:30pm”
- Natural language: “when I get home”, “next Friday morning”
- Ambiguous input: Ask follow-up questions to clarify
Timezone-aware datetime handling
State management with status field
Prevent duplicate alarm firing by tracking status:SDK methods used
| Method | Purpose |
|---|---|
wait_for_complete_transcription() | Capture full user utterance without speaking first |
text_to_text_response() | Send prompts to LLM for time parsing |
run_io_loop() | Speak clarification question and wait for answer |
speak() | Confirm alarm was set |
resume_normal_flow() | Exit Skill after setting alarm |
get_timezone() | Get user’s timezone for datetime calculations |
check_if_file_exists() | Check if alarms.json exists before reading |
read_file() | Load alarms.json contents |
write_file() | Save updated alarms.json |
delete_file() | Delete alarms.json before writing (prevents append corruption) |
play_from_audio_file() | Play alarm sound when time is reached |
session_tasks.sleep() | Sleep between polling intervals (Daemon) |
Real-world examples
Build on this template to create:- Reminder system — Set voice reminders with natural language
- Pomodoro timer — 25-minute work intervals with break notifications
- Medication tracker — Remind user to take pills at scheduled times
- Workout timer — Set intervals for HIIT workouts
- Baby monitor — Set feeding/diaper change reminders
- Meeting alerts — Parse calendar events and fire pre-meeting reminders
- Smart home scheduler — Queue device commands for later execution
- Task queue — Skills add tasks, daemons process them asynchronously
Next steps
File Storage API
Complete reference for file operations
Watcher Template
Learn more about background daemons
Audio Playback
Play custom sounds and music
Ability Types
Understand Skills vs Daemons vs Local abilities
