Skip to content

CLI Commands Reference

The 30 things actually typed often. Grouped by what you're trying to do.

Inspect / query the warehouse

# Threshold sessions in last year:
uv run python ~/garmin-warehouse/query.py threshold-sessions --since 2025-05-01

# Long runs ≥18mi:
uv run python ~/garmin-warehouse/query.py long-runs --since 2024-01-01 --min-miles 18

# MPW:
uv run python ~/garmin-warehouse/query.py mpw --since 2025-01-01

# Race comparison across all races:
uv run python ~/garmin-warehouse/query.py race-compare

# Single race report:
uv run python ~/garmin-warehouse/query.py race-report 2024-10-13

# Inspect a specific activity:
uv run python ~/garmin-warehouse/query.py inspect <activity-id>

# Doubles (multiple threshold sessions same day):
uv run python ~/garmin-warehouse/query.py double-thresholds

Query the kb

# Semantic search:
uv run python ~/garmin-warehouse/kb/query.py semantic "post-threshold strides"

# Contradictions in the corpus:
uv run python ~/garmin-warehouse/kb/query.py contradictions

# Topic deep-dive:
uv run python ~/garmin-warehouse/kb/query.py topic iron

# DuckDB shell on the kb:
uv tool run harlequin --adapter duckdb ~/garmin-warehouse/kb/kb.duckdb

Rebuild / verify the kb

# Full rebuild (loads from raw.json + embeds):
~/garmin-warehouse/scripts/rebuild_kb.sh

# Verify post-rebuild:
~/garmin-warehouse/scripts/verify_kb.sh

# Manual sync (incremental):
uv run python ~/garmin-warehouse/kb/sync.py

# Migration status:
uv run python ~/garmin-warehouse/kb/migrate.py status

# Run a new migration:
uv run python ~/garmin-warehouse/kb/migrate.py up

# Find claims with stale prompt versions:
uv run python ~/garmin-warehouse/kb/stale_prompts.py

# Snapshot corpus state:
uv run python ~/garmin-warehouse/kb/corpus_diff.py snapshot v3

# Diff two snapshots:
uv run python ~/garmin-warehouse/kb/corpus_diff.py diff v2 v3

UI

# Start the UI (uvicorn + tunnel + Cloudflare Access):
kbui

# Or directly:
~/garmin-warehouse/scripts/run_ui.sh

# Just uvicorn (no tunnel):
uv run uvicorn ui.app:app --reload --port 8765 --host 127.0.0.1

Open https://warehouse.caseymanos.com in browser. Email PIN.

Daily sync (manual)

# Run the full daily sync (normally fires at 7am via launchd):
~/garmin-warehouse/scripts/daily_sync.sh

# Force-run outside the 5am-11pm guard:
FORCE_RUN=1 ~/garmin-warehouse/scripts/daily_sync.sh

# Just the Worker cache portion:
uv run python ~/garmin-warehouse/scripts/cache_for_worker.py

# Just the GarminDB sync:
cd ~/garmin-warehouse && uv run garmindb_cli.py --all --download --import --analyze --latest

# Just the intervals.icu cache refresh:
uv run python ~/garmin-warehouse/warehouse.py refresh-icu 2017-01-01

Podcast pipeline

# Full Sunday sync (normally fires at 6am Sun via launchd):
~/data-ingestion/scripts/podcast-sync.sh

# Just batch one show:
cd ~/data-ingestion && uv run python batch.py --show running-effect

# Find episodes that failed mid-pipeline:
uv run python ~/data-ingestion/find_misses.py

# Retry them:
uv run python ~/data-ingestion/retry_misses.py

# Hot briefing (cross-show synthesis for the week):
uv run python ~/data-ingestion/hot_briefing.py

Worker (Cloudflare)

# Deploy:
cd ~/garmin-warehouse/cloudflare/otq-checkin && npx wrangler deploy

# Live logs:
cd ~/garmin-warehouse/cloudflare/otq-checkin && npx wrangler tail

# Set a secret:
npx wrangler secret put ANTHROPIC_API_KEY

# Manual trigger (the SECRET env var is last 12 chars of TG_TOKEN):
SECRET=$(echo -n "$TELEGRAM_BOT_TOKEN" | tail -c 12)
curl -X POST "https://otq-checkin.manoscasey.workers.dev/run-morning-summary?secret=$SECRET"

# Stats:
curl "https://otq-checkin.manoscasey.workers.dev/stats"

R2

# List a prefix:
rclone ls r2:garmin-warehouse-data/state/

# Read:
rclone cat r2:garmin-warehouse-data/state/cache/yesterday.json

# Upload:
rclone copy local-file.txt r2:garmin-warehouse-data/path/

# Upload via stdin:
echo "data" | rclone rcat r2:garmin-warehouse-data/path/key.txt

Tunnel

# Manual tunnel run (started by run_ui.sh):
cloudflared tunnel --config ~/.cloudflared/config.yml run warehouse

# Re-auth tunnel (rare):
cloudflared tunnel login

Triage TUI (kb application queue)

# Walk the application queue:
uv run python ~/garmin-warehouse/kb/triage.py

Notes / scratch

# Active workstreams (read by coach subagent):
$EDITOR ~/garmin-warehouse/findings/_active.md

# Casey's todo (surfaced in UI):
$EDITOR ~/garmin-warehouse/findings/_todo.md