glama is a zero-dependency, OOM-safe local Ollama micro-agent and standalone Telegram daemon built for Apple Silicon Macs (Unified RAM) and Windows/Linux GPUs (8GB+ VRAM).
Full agent frameworks inject 10,000–16,000 tokens of system prompt and 50+ tool schemas on every turn. On an 8GB GPU—or a MacBook running Chrome, Slack, and Teams—that overflows memory into swap, causing 10x slowdowns or OOM crashes.
glama keeps local models fast and OOM-free across macOS, Windows, and Linux:
- Dynamic Model Discovery & Pre-Flight Memory Ladder (
src/glama/config.py):- Queries local Ollama (
/api/tags) to auto-discover your installed models and their exact memory footprint + KV-cache overhead. - Checks usable memory before every call via
vm_stat(macOS Unified RAM),nvidia-smi(Windows/Linux GPU VRAM), or/proc/meminfo(Linux) minus your safety reserve (GLAMA_RESERVE_MEM_MB). - Automatically steps down model tiers (e.g.
26b/32b -> 8b -> 7b -> 3b) when games or browser tabs eat memory instead of swapping/OOMing.
- Queries local Ollama (
- Single-Flight Mutex Lock: Serializes concurrent subagent calls so two models never stack in RAM/VRAM simultaneously.
- Micro-Prompt (
<350 tokens) + Bounded Context (GLAMA_NUM_CTX=4096): Sub-second to 2s warm replies onqwen3:8b(with/no_thinkauto-applied). - Zero External Dependencies: Pure Python standard library (
>=3.10)—minimizing supply-chain and dependency attack surface.
web_search_text(query): Headless web & news search (Google News RSS + Wikipedia OpenSearch, VPN-safe,$0, no API keys).web_fetch_text(url): Headlessw3m -dumpstyle plain-text webpage reader (usesw3mif installed on macOS/Linux, or pure-stdlibhtml.parsertext dumper on Windows) with strict SSRF protection (blockslocalhost, private LAN,100.64.0.0/10Meshnet/Tailscale, and cloud metadata IPs).get_weather_forecast(location): Live 24-hour hourly + 7-day daily forecast via Open-Meteo ($0, no API key).use_skill(skill_name): Loads step-by-step markdown playbooks fromskills/<name>.mdon demand (<20 tokensprompt overhead until called).get_system_headroom(): Live GPU VRAM / Unified RAM and disk free space readout.list_workspace_files/read_workspace_file/search_workspace_text: Confined strictly toOLLAMA_SANDBOX_ROOTwith secret/config file blocking.
Drop any .md procedure into skills/ (included examples: skills/sql-spear.md and skills/web-brief.md). glama advertises only the skill names in the system prompt and loads the full markdown instructions via use_skill only when needed.
Permission levels are controlled exclusively by the host OS environment/.env (and config/script files are hard-blocked inside safe_resolve, so the model or a prompt injection can never escalate its own permissions):
GLAMA_PERMISSION_MODE=readonly(Default): Write tools are not registered in the tool schema and raisePermissionErrorat the Python handler layer.GLAMA_PERMISSION_MODE=workspace-write(Opt-in): Registerswrite_workspace_fileconfined strictly insideOLLAMA_SANDBOX_ROOTand restricted to non-executable data/note extensions (.md,.txt,.json,.csv)—executable/script extensions (.py,.sh,.ps1,.vbs,.env) remain hard-blocked.
macOS / Linux:
curl -fsSL https://raw.githubusercontent.com/echoar/glama/main/install.sh | sh
glama --setupWindows (PowerShell):
irm https://raw.githubusercontent.com/echoar/glama/main/install.ps1 | iex
glama --setup# Run instantly without installing via uvx:
uvx --from git+https://github.com/echoar/glama.git glama "Check free VRAM/RAM headroom"
# Or install globally as CLI tools (glama, glama-query, glama-bot, glama-setup):
uv tool install git+https://github.com/echoar/glama.git
# (or: pipx install git+https://github.com/echoar/glama.git)git clone https://github.com/echoar/glama.git
cd glama
pip install -e .
glama --setup/new(or/clear): Reset rolling session history and start a fresh session/models: List all locally installed Ollama models and disk sizes/model <8b|coder|3b|name>: Switch active local model on the fly/skills(or/tools): List active sandboxed tools andskills/*.mdplaybooks/vram: Instant GPU VRAM / Unified RAM & disk headroom check- Native Telegram Swipe-to-Reply context supported automatically
| Variable | Default | Description |
|---|---|---|
OLLAMA_HOST |
http://127.0.0.1:11434 |
Local or LAN Ollama server URL |
OLLAMA_DEFAULT_MODEL |
qwen3:8b |
Default model for tool calling & chat |
OLLAMA_CODER_MODEL |
qwen2.5-coder:7b |
Model alias for /model coder |
OLLAMA_FAST_MODEL |
qwen2.5:3b |
Model alias for /model 3b |
GLAMA_FALLBACK_LADDER |
qwen3:8b,qwen2.5-coder:7b,qwen2.5:3b |
Priority order when stepping down under RAM/VRAM pressure |
GLAMA_RESERVE_MEM_MB |
500 |
Untouchable VRAM/RAM safety buffer in MiB (e.g. 1500 for gaming rigs) |
GLAMA_NUM_CTX |
4096 |
Context window cap (auto-scales KV-cache OOM math) |
OLLAMA_KEEP_ALIVE |
30s |
Unload delay after query completion to free VRAM |
GLAMA_PERMISSION_MODE |
readonly |
readonly (default) or workspace-write |
GLAMA_ENABLE_WEB |
1 |
Set to 0 for air-gapped offline mode |
MIT