Minimal autonomous agent server with file-based heartbeat configuration.
This is an exploration of the core functionality behind openclaw and opencode.
Drop a .md file in heartbeats/ and it becomes a scheduled agent task.
# Install dependencies
uv sync
# Set your OpenAI key
export OPENAI_API_KEY=sk-...
# Run the server
uv run chelae serve
# Or with auto-reload for development
uv run chelae serve --reload# One-off message
uv run chelae send "What's in my current directory?"
# Pipe from stdin
echo "Summarize this" | uv run chelae send
# Use a different session
uv run chelae send -s work "Check my calendar"
# Interactive chat
uv run chelae chat<!-- heartbeats/monitor.md -->
---
cron: "*/30 * * * *"
session: main
---
Check if anything needs my attention.
If nothing, reply HEARTBEAT_OK.The server watches the folder - changes are picked up automatically.
# List heartbeats
curl http://localhost:8000/heartbeats
# Trigger manually
curl -X POST http://localhost:8000/trigger \
-H "Content-Type: application/json" \
-d '{"prompt": "What time is it?"}'
# Trigger a specific heartbeat
curl -X POST http://localhost:8000/trigger/monitor
# View session history
curl http://localhost:8000/sessions/main---
cron: "0 9 * * 1-5" # Required: 5-field cron expression
session: main # Session ID (default: main)
enabled: true # Toggle on/off (default: true)
model: gpt-4o # Model to use (default: gpt-4o)
dedup_hours: 24 # Suppress duplicate text for N hours
timezone: America/New_York # Cron timezone (default: UTC)
---- No context compaction - Sessions grow unbounded. If you hit context limits, clear the session with
DELETE /sessions/{id}or delete the.jsonlfile. Auto-compaction is on the roadmap.
See NOTES.md for full architecture details.