Skip to main content

Scheduler

WASP's scheduler runs 23 background jobs that keep the agent active, learning, and aware — even when no user is interacting.

Job Registry

Job NameIntervalPurpose
health_check5 minMonitor Redis, Postgres, Ollama, disk, RAM, CPU
reflection6 hoursLLM-driven memory reflection and synthesis
memory_cleanup24 hoursRemove old episodic memories, orphaned data
snapshot24 hoursFull memory snapshot to /data/memory/
reminder_checker30 secFire due reminders, trigger agent goals for recurring reminders
monitor_checker5 minCheck price/RSS monitors for threshold violations
proactive1 hourSend proactive suggestions based on user context
promotion12 hoursPromote frequent episodic memories to semantic
checkin1 hourPeriodic user check-in messages
custom_task_runner1 minExecute user-defined scheduled tasks
subscription_checker5 minCheck price/RSS subscriptions for alerts
goal_tick15 secAdvance active goal execution (up to 3 steps per tick)
goal_meta_reflection5 minAnalyze goal health, detect storms, log meta-state
agent_tick15 secAdvance active sub-agent goals
dream1 hour (gated)Consolidate memories, reflect, prefetch data
autonomous30 minEvaluate system state and generate proactive goals
digest24 hoursGenerate daily digest for user
cpi_monitor5 minCompute Cognitive Pressure Index
self_integrity6 hoursCross-check self-model vs actual performance
perception15 minMonitor crypto prices for significant moves
behavioral_learner2 minProcess user corrections into behavioral rules
world_model15 minUpdate entity states from world_timeline
skill_evolution6 hoursSynthesize new skills from recurring patterns

Job Architecture

Jobs implement a simple interface:

class BaseJob:
async def run(self) -> None:
"""Execute the job's logic."""
...

The Scheduler manages all jobs:

  • Tracks last run time per job in Redis (scheduler:last_run:{job})
  • Logs scheduler.job_complete with job name and duration in ms
  • Handles exceptions without crashing other jobs

Key Jobs Explained

health_check (5 min)

Uses HealthMonitor to check:

  • Redis: PING
  • PostgreSQL: simple SELECT
  • Ollama: /api/tags endpoint
  • Disk: usage percentage
  • RAM: percent used
  • CPU: percent used

When thresholds exceeded, SelfHealer triggers remediation (disk cleanup, Ollama restart, etc.).

reminder_checker (30 sec)

Checks Redis for due reminders. For recurring reminders with an agent_id, calls agent_orchestrator.create_agent_goal() to restart the cycle. Regular reminders fire a Telegram message.

dream (1 hour, gated)

The Dream Mode job activates only when:

  • User has been inactive for more than 2 hours
  • Time is between 1 AM and 7 AM local, OR inactive for 4+ hours
  • Has not run in the last 6 hours

When activated, Dream Mode:

  1. Runs the PromotionEngine (episodic → semantic promotion)
  2. Extracts KG entities from recent memories
  3. Generates an LLM reflection on recent events
  4. Pre-fetches crypto prices for monitored assets
  5. Logs to the dream_log table

autonomous (30 min)

The AutonomousGoalGeneratorJob evaluates system state:

  1. Checks critical thresholds (disk >95%, RAM >95%) — no LLM needed
  2. For non-critical situations, asks the LLM for proactive recommendations
  3. If action is warranted: calls goal_orchestrator.create_goal() with priority=3
  4. Rate-limited: max 1 autonomous goal per hour, 5 per day

perception (15 min)

BackgroundPerceptionJob monitors crypto assets in the Knowledge Graph:

  • Fetches current prices
  • Compares vs last known price in the temporal model
  • If change >4%, asks LLM whether to notify
  • Sends Telegram alert if notable (max 3/day, respects quiet hours)

behavioral_learner (2 min)

Checks Redis behavioral:pending queue for user corrections:

  • Correction detection patterns: "estás alucinando", "eso está mal", etc.
  • LLM analyzes the correction and extracts a rule
  • Rule saved to behavioral_rules table
  • Rule injected into every future system prompt

skill_evolution (6 hours)

Analyzes skill_patterns table for recurring multi-skill sequences:

  • Minimum 5 occurrences required (configurable)
  • LLM synthesizes a new composite skill from the pattern
  • AST validation ensures generated code is safe
  • New skill registered and available immediately

Scheduler State

View job status in the dashboard at /scheduler.

Query last run times:

docker exec agent-redis redis-cli KEYS "scheduler:last_run:*" | sort

Quiet Hours

Jobs that send Telegram notifications respect quiet hours:

  • Default: no notifications between 11 PM and 8 AM
  • Configurable via PROACTIVE_QUIET_START and PROACTIVE_QUIET_END

Disabling Jobs

Individual jobs cannot be disabled without code changes, but the entire scheduler can be disabled:

# In .env
SCHEDULER_ENABLED=false

Or disable specific features to skip registration of their jobs:

SKILL_EVOLUTION_ENABLED=false  # Skips skill_evolution job
WORLD_MODEL_ENABLED=false # Skips world_model job
VECTOR_MEMORY_ENABLED=false # Skips vector_index job