Routines Overview
Routines are automated workflows (ADWs — AI Developer Workflows) that run on a schedule. There are two types:- AI routines — invoke Claude Code CLI with an agent to perform reasoning tasks (reports, analysis, decisions). Cost tokens per run.
- Systematic routines — pure Python scripts that perform deterministic operations (API calls, file ops, data transforms). No AI, no tokens, no cost, runs in seconds.
Core vs Custom
scheduler.py — they do NOT come from config/routines.yaml. See Core Routines for a detailed explanation of each one and why they matter.
Dynamic Discovery: Routines are discovered dynamically by scanning script files. The agent is extracted from each script’s docstring (via AgentNamepattern). No hardcoded mappings needed — add a new script and it’s automatically available in the dashboard, API, andmake run.
Note: Memory maintenance follows the LLM Wiki pattern. TheExample routines live inmemory_syncroutine (daily) handles ingest with cross-reference propagation (updating related memory files when one changes). Thememory_lintroutine (weekly) performs health checks: detecting contradictions, stale data, orphan files, and coverage gaps. Both routines updatememory/index.md(catalog) andmemory/log.md(operation log).
ADWs/routines/examples/ and are tracked with the repo. These are reference implementations for common integrations (Discord, Stripe, YouTube, etc).
Custom routines live in ADWs/routines/custom/ and are gitignored. Copy from examples or create your own. Only custom routines go in config/routines.yaml. The create-routine skill helps generate them.
ADW Runner
All routines useADWs/runner.py, which provides:
run_skill(skill, log_name, timeout, agent)— executes a skill via Claude Code CLI (AI routine)run_claude(prompt, log_name, timeout, agent)— executes a raw prompt (AI routine)run_script(func, log_name, timeout)— executes a pure Python function (systematic routine, no AI)banner(title, subtitle)— prints a styled headersummary(results, title)— prints execution summary with cost/token stats
- Invoking
claude --print --dangerously-skip-permissions --output-format json(AI routines) - Executing Python functions directly with timeout protection (systematic routines)
- Logging to JSONL files (
ADWs/logs/YYYY-MM-DD.jsonl) - Saving detailed logs (
ADWs/logs/detail/) - Accumulating metrics per routine (
ADWs/logs/metrics.json) - Rich terminal output with progress indicators
How a Routine Script Works
Every routine follows the same pattern:- Import the runner from
ADWs/runner.py - Print a banner with the routine name
- Call
run_skill()with the skill name, log name, timeout, and agent - Print a summary
config/routines.yaml
This file defines the schedule for custom routines only. Core routines (good_morning, end_of_day, memory_sync, weekly_review) are hardcoded inscheduler.py and do not need entries here.
name: Display namescript: Python file inADWs/routines/custom/(orADWs/routines/examples/)time: Execution time (24h format, local timezone)interval: Run every N minutes (instead of fixed time)day: Day of week (weekly) or day of month (monthly)days: Array for multi-day weekly schedulesenabled: Toggle on/off without deleting
Scheduler
Start the scheduler with:scheduler.py, which has core routines hardcoded and also reads config/routines.yaml for custom routines. The scheduler runs in the foreground and shows real-time progress.
The dashboard also starts/stops the scheduler from the Services page.
Creating Custom Routines
Using the skill
create-routine skill walks you through:
- What the routine does
- Which agent runs it
- Which skill it invokes
- The schedule (daily/weekly/monthly)
config/routines.yaml. No Makefile changes needed — routines are discovered dynamically.
Manually
- Create
ADWs/routines/custom/my_routine.pyfollowing the pattern above - Add an entry to
config/routines.yaml
Manual Execution
Core routines have dedicated make targets. All routines (core and custom) can be run with the dynamic runner:Scheduled Tasks (One-Off)
For actions that should run once at a specific time (not recurring), use Scheduled Tasks instead of routines. See Scheduled Tasks for details.Agent Teams (Experimental, Opt-in)
Parallel multi-agent versions of consolidation routines. Instead of one agent collecting data sequentially, Agent Teams spawn domain-specific teammates that work in parallel — each in their own context window. Trade-off: ~3-5x higher token cost, but faster execution and each agent uses its own domain expertise.
Scripts live in
ADWs/routines/teams/. These are never scheduled — run manually when you want speed or richer cross-domain analysis.
Requires the experimental flag (already enabled in .claude/settings.json):
- The lead agent (e.g., @sage) creates an agent team
- Each teammate is spawned using the corresponding agent type (e.g.,
atlas-project) - Teammates collect domain data in parallel
- The lead waits for all teammates, then synthesizes findings into the final output
team-strategy-digest, team-dashboard, etc. in metrics.json, separate from normal runs — making it easy to compare cost and speed.
Logs and Metrics
Log files
Viewing logs
Metrics format
metrics.json tracks per routine:
- Total runs, successes, failures, success rate
- Average duration
- Total and average cost (USD)
- Total input/output tokens
- Last run timestamp