#!/bin/bash # So Many Crows: local server. # Double-click to start. Close this window (or Ctrl-C) to stop. # # Which crows fly is set in .env in this folder (never committed): # OPENROUTER_API_KEY=... OpenRouter (default model: openrouter/free) # ANTHROPIC_API_KEY=... Claude direct from Anthropic (default: claude-sonnet-5-5) # CROWS_PROVIDER=openrouter optional: pick one when both keys are present # CROWS_MODEL=... optional: a specific model # TYPESAFE_API_KEY=... Jev classifier for the Sentry's triage (LLM is the fallback) # CROWS_JEV_THRESHOLD=0.7 optional: below this confidence, triage escalates to the LLM # `./start.command --mock` forces offline mock crows. # # Listens on this Mac only (127.0.0.1:8080). State lives in .crows/ (delete it to start fresh). # Guardrails: 20,000 tokens per item, 100,000 per list; you approve everything until crows earn trust. cd "$(dirname "$0")" || exit 1 xattr -d com.apple.quarantine ./crows 2>/dev/null chmod +x ./crows # Read only these lines from .env; the file is never executed. envval() { sed -n "s/^$1=//p" .env 2>/dev/null | head -n 1 | tr -d '[:space:]"'; } VARS="ANTHROPIC_API_KEY OPENROUTER_API_KEY CROWS_PROVIDER CROWS_MODEL TYPESAFE_API_KEY CROWS_JEV_MODEL CROWS_JEV_THRESHOLD" unset $VARS if [ "$1" != "--mock" ]; then for v in $VARS; do val="$(envval "$v")" [ -n "$val" ] && export "$v=$val" done fi if lsof -iTCP:8080 -sTCP:LISTEN >/dev/null 2>&1; then echo "Something is already using port 8080. Stop it first." exit 1 fi (sleep 1; open "http://127.0.0.1:8080") & exec ./crows serve -addr 127.0.0.1:8080 # prints which brain is flying