Files
Timmy-time-dashboard/activate_self_tdd.sh
Claude 19af4ae540 feat: integrate AirLLM as optional high-performance backend
Adds the `bigbrain` optional dependency group (airllm>=2.9.0) and a
complete second inference path that runs 8B / 70B / 405B Llama models
locally via layer-by-layer loading — no GPU required, no cloud, fully
sovereign.

Key changes:
- src/timmy/backends.py   — TimmyAirLLMAgent (same print_response interface
                            as Agno Agent); auto-selects AirLLMMLX on Apple
                            Silicon, AutoModel (PyTorch) everywhere else
- src/timmy/agent.py      — _resolve_backend() routing with explicit override,
                            env-config, and 'auto' Apple-Silicon detection
- src/timmy/cli.py        — --backend / --model-size flags on all commands
- src/config.py           — timmy_model_backend + airllm_model_size settings
- src/timmy/prompts.py    — mentions AirLLM "even bigger brains, still fully
                            sovereign"
- pyproject.toml          — bigbrain optional dep; wheel includes updated
- .env.example            — TIMMY_MODEL_BACKEND + AIRLLM_MODEL_SIZE docs
- tests/conftest.py       — stubs 'airllm' module so tests run without GPU
- tests/test_backends.py  — 13 new tests covering helpers + TimmyAirLLMAgent
- tests/test_agent.py     — 7 new tests for backend routing
- README.md               — Big Brain section with one-line install
- activate_self_tdd.sh    — bootstrap script (venv + install + tests +
                            watchdog + dashboard); --big-brain flag

All 61 tests pass. Self-TDD watchdog unaffected.

https://claude.ai/code/session_01DMjQ5qMZ8iHeyix1j3GS7c
2026-02-21 16:53:16 +00:00

75 lines
3.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# activate_self_tdd.sh — Timmy Time dev environment bootstrapper
#
# Usage:
# bash activate_self_tdd.sh # standard (Ollama) setup
# bash activate_self_tdd.sh --big-brain # install AirLLM extra too
#
# What it does:
# 1. Creates a Python venv (or reuses an existing one)
# 2. Installs Timmy Time (+ dev deps, optionally bigbrain)
# 3. Runs the full test suite — aborts if anything fails
# 4. Launches the self-TDD watchdog in the background
# 5. Starts the dashboard
#
# Everything stays local. No cloud. Sats are sovereignty, boss.
set -euo pipefail
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
VENV_DIR="$REPO_DIR/.venv"
BIG_BRAIN=0
for arg in "$@"; do
case $arg in
--big-brain) BIG_BRAIN=1 ;;
*) echo "Unknown argument: $arg"; exit 1 ;;
esac
done
echo "==> Timmy Time — sovereign AI agent bootstrapper"
echo " Working directory: $REPO_DIR"
# ── 1. Virtual environment ────────────────────────────────────────────────────
if [[ ! -d "$VENV_DIR" ]]; then
echo "==> Creating virtual environment..."
python3 -m venv "$VENV_DIR"
fi
# shellcheck disable=SC1091
source "$VENV_DIR/bin/activate"
echo "==> Virtual environment active: $VENV_DIR"
# ── 2. Install dependencies ───────────────────────────────────────────────────
if [[ $BIG_BRAIN -eq 1 ]]; then
echo "==> Installing with bigbrain extra (AirLLM)..."
pip install --quiet -e "$REPO_DIR[dev,bigbrain]"
# On Apple Silicon, also install the MLX backend.
if [[ "$(uname -m)" == "arm64" && "$(uname -s)" == "Darwin" ]]; then
echo "==> Apple Silicon detected — installing AirLLM MLX backend..."
pip install --quiet "airllm[mlx]"
fi
else
echo "==> Installing standard dependencies..."
pip install --quiet -e "$REPO_DIR[dev]"
fi
# ── 3. Run tests ──────────────────────────────────────────────────────────────
echo "==> Running test suite..."
python -m pytest "$REPO_DIR/tests/" -q --tb=short
echo "==> All tests passed."
# ── 4. Self-TDD watchdog (background) ────────────────────────────────────────
echo "==> Starting self-TDD watchdog (60s interval) in background..."
self-tdd watch --interval 60 &
WATCHDOG_PID=$!
echo " Watchdog PID: $WATCHDOG_PID"
echo " Kill with: kill $WATCHDOG_PID"
# ── 5. Dashboard ─────────────────────────────────────────────────────────────
echo ""
echo "==> Starting Timmy Time dashboard at http://localhost:8000"
echo " Ctrl-C stops the dashboard (watchdog continues until you kill it)"
echo ""
uvicorn dashboard.app:app --reload --host 0.0.0.0 --port 8000