Environment Variables

All environment variables used by Golems v2. Store sensitive values in 1Password (see Secrets Management).

Core Configuration

VariableDefaultDescriptionRequired For
LLM_BACKENDollamaWhich LLM to use: haiku (cloud) or ollama (local); cloud-worker sets haiku explicitlyAgent execution
STATE_BACKENDfileState storage: supabase (cloud) or file (local)Persistent state
TELEGRAM_MODElocalNotification mode: direct (cloud) or local (launchd)Telegram notifications
TZUTCTimezone (only used in helpers-status.ts); cloud-worker hardcodes Asia/JerusalemStatus display
GOLEMS_STATE_DIR~/.golems-zikaronOverride state directory for tests or alternate environmentsTest isolation

LLM Configuration

Cloud Backend (Haiku)

VariableDefaultDescriptionRequired For
ANTHROPIC_API_KEYAnthropic API key from 1Password (any item name you choose)Cloud LLM calls
RAILWAY_URLhttps://your-service.up.railway.appCloud worker endpoint for health checksHealth monitoring

Local Backend (Ollama)

Requires Ollama running locally on http://localhost:11434.

Database Configuration

VariableDefaultDescriptionRequired For
SUPABASE_URLYour Supabase project URL (format: https://YOUR_PROJECT.supabase.co)Cloud state backend
SUPABASE_SERVICE_KEYService role key (bypasses RLS, for cloud worker only) from 1PasswordCloud database access
SUPABASE_ANON_KEYAnonymous key for job syncJob golem sync

Gmail Configuration

VariableDefaultDescriptionRequired For
GMAIL_CLIENT_IDOAuth 2.0 Client ID from Google Cloud ConsoleEmail sync
GMAIL_CLIENT_SECRETOAuth 2.0 Client Secret from Google Cloud ConsoleEmail sync
GMAIL_REFRESH_TOKENGmail refresh token (generate via oauth-cli)Email sync

Telegram Configuration

VariableDefaultDescriptionRequired For
TELEGRAM_BOT_TOKENBot token from @BotFather on TelegramTelegram bot
TELEGRAM_CHAT_IDChat/group ID for notifications (negative number for groups)Telegram messages
TELEGRAM_TOPIC_ALERTSTopic ID for 🔔 Alerts (system notifications)Alert routing
TELEGRAM_TOPIC_NIGHTSHIFTTopic ID for 🌙 Night Shift (autonomous tasks)Night Shift logs
TELEGRAM_TOPIC_EMAILTopic ID for 📧 Email (email events)Email notifications
TELEGRAM_TOPIC_JOBSTopic ID for 💼 Jobs (job scraper results)Job notifications
TELEGRAM_TOPIC_RECRUITERTopic ID for 👥 Recruiter (outreach events)Recruiter notifications
TELEGRAM_TOPIC_UPTIMETopic ID for ⏰ Uptime (health checks)Uptime monitoring

Ollama Configuration

VariableDefaultDescriptionRequired For
OLLAMA_MODELqwen2.5-coder:7b (direct), qwen3-coder-64k (sandboxed)Local Ollama model nameEmail scoring, categorization
OLLAMA_HOSThttp://localhost:11434Ollama server URLLocal LLM calls
OLLAMA_URLhttp://127.0.0.1:11434Alias for OLLAMA_HOST (sandboxed mode)Sandboxed execution
OLLAMA_SANDBOXEDSet to 1 to enable sandboxed Ollama executionSandboxed mode
VALIDATION_DIR~/.golems-zikaron/validation-queueDirectory for sandboxed validation queueSandboxed execution

Job Scraper Configuration

VariableDefaultDescriptionRequired For
SKIP_DRUSHIMSet to 1 to skip Drushim.co.il scraperJob scraper
SKIP_INDEEDSet to 1 to skip Indeed scraperJob scraper
SKIP_SECRETLVSet to 1 to skip Secret Tel Aviv scraperJob scraper

Recruiter Configuration

VariableDefaultDescriptionRequired For
HUNTER_API_KEYHunter.io API key for finding contact emailsContact finder
EXA_API_KEYExa API key for web search and contact findingContact finder

Night Shift & Bot Configuration

VariableDefaultDescriptionRequired For
REPOS_PATH~/GitsBase path for git repositoriesNight Shift
ACTIVITY_DAYS_TO_KEEP7Days of session history to retainSession archiver
TELEGRAM_ALLOWED_IDSComma-separated Telegram user IDs allowed to interactTelegram bot security
OLLAMA_CHAT_BOT_TOKENSeparate bot token for Ollama chat botOllama chat bot

Setup Examples

Development (Local)

# Use local Ollama and file-based state
export LLM_BACKEND=ollama
export STATE_BACKEND=file
export TELEGRAM_MODE=local
export TZ=Asia/Jerusalem
 
# Gmail
export GMAIL_CLIENT_ID=your_client_id
export GMAIL_CLIENT_SECRET=your_client_secret
export GMAIL_REFRESH_TOKEN=your_refresh_token
 
# Telegram (get token from @BotFather, chat ID from your group)
export TELEGRAM_BOT_TOKEN=123456:ABC-DEF...
export TELEGRAM_CHAT_ID=-1001234567890

Production (Railway)

# Use cloud LLM and Supabase
export LLM_BACKEND=haiku
export STATE_BACKEND=supabase
export TELEGRAM_MODE=direct
 
# All secrets from 1Password (handled by Railway)
# ANTHROPIC_API_KEY, SUPABASE_URL, SUPABASE_SERVICE_KEY, etc.

Loading Variables

Variables are loaded from:

  1. Environment — System variables (highest priority)
  2. .env file — Project root .env file (git-ignored)
  3. Defaults — Built-in fallbacks

For launchd jobs, use load-env.ts at the entry point:

import "../lib/load-env";  // MUST be first import

This ensures .env files are loaded before any code runs.

API Cost Logging

All LLM calls are logged to ~/.golems-zikaron/api_costs.jsonl as JSONL:

{
  "timestamp": "2026-02-06T10:30:00Z",
  "model": "claude-haiku-4-5-20251001",
  "source": "email-golem",
  "input_tokens": 1250,
  "output_tokens": 342,
  "cost_usd": 0.002352
}

Pricing (Haiku 4.5):

  • Input: $0.80/MTok
  • Output: $4.00/MTok

See Also