{"id":50776231,"url":"https://github.com/sidx1-scratch/prefrontal","last_synced_at":"2026-07-03T01:01:46.768Z","repository":{"id":349390684,"uuid":"1202136651","full_name":"sidx1-scratch/prefrontal","owner":"sidx1-scratch","description":"Take back control of your AI. Fully local, fully private — no cloud, no tracking, no subscriptions. Works with Ollama, llama.cpp, and OpenRouter.","archived":false,"fork":false,"pushed_at":"2026-07-02T21:11:47.000Z","size":336,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-02T22:24:49.337Z","etag":null,"topics":["ai","free","llama-cpp","llm","local-ai","no-ads","no-telemetry","nodejs","npm","ollama","open-source","openrouter","privacy","self-hosted"],"latest_commit_sha":null,"homepage":"https://sidx1-scratch.github.io/prefrontal/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sidx1-scratch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-05T16:40:32.000Z","updated_at":"2026-07-02T21:11:52.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sidx1-scratch/prefrontal","commit_stats":null,"previous_names":["sidx1-scratch/prefrontal"],"tags_count":84,"template":false,"template_full_name":null,"purl":"pkg:github/sidx1-scratch/prefrontal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidx1-scratch%2Fprefrontal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidx1-scratch%2Fprefrontal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidx1-scratch%2Fprefrontal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidx1-scratch%2Fprefrontal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sidx1-scratch","download_url":"https://codeload.github.com/sidx1-scratch/prefrontal/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidx1-scratch%2Fprefrontal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35068135,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-02T02:00:06.368Z","response_time":173,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","free","llama-cpp","llm","local-ai","no-ads","no-telemetry","nodejs","npm","ollama","open-source","openrouter","privacy","self-hosted"],"created_at":"2026-06-12T00:00:36.550Z","updated_at":"2026-07-03T01:01:46.701Z","avatar_url":"https://github.com/sidx1-scratch.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧠 Prefrontal — Local AI Chatbot\n\n![Node.js](https://img.shields.io/badge/Node.js-v18%2B-brightgreen?logo=node.js)\n![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20macOS%20%7C%20Linux%20%7C%20Android-blue)\n![License](https://img.shields.io/badge/license-MIT-lightgrey)\n![Offline](https://img.shields.io/badge/100%25-Offline-success)\n\n### 100% Offline · No Ads · No API Keys · Your Data Stays on Your Device\n\nPrefrontal is an open-source, privacy-first chat interface for local AI models. It works with **Ollama** (desktop) and **Llama.cpp** (any platform including Android via Termux). No cloud, no telemetry, no subscriptions.\n\n---\n\n## ⚡ Quick Start\n\n### 🌐 Easiest: OpenRouter *(no local AI install needed)*\n\nOpenRouter gives you free access to powerful cloud models — no GPU, no Ollama, nothing extra to install. The fastest way to get running.\n\n**1. Get a free API key**\nSign up at [openrouter.ai](https://openrouter.ai) and copy your API key from the dashboard.\n\n**2. Install and run Prefrontal**\n```bash\ngit clone https://github.com/sidx1-scratch/prefrontal\ncd prefrontal\nnpm install \u0026\u0026 npm start\n```\n\n**3. Configure and go**\nOpen `http://localhost:3000`, go to Settings, and set:\n- Runtime → **OpenRouter**\n- API Key → paste your key\n- Model → pick any free model (e.g. `mistralai/mistral-7b-instruct:free`)\n\nDone — no GPU or model download required.\n\n---\n\n### 🖥️ Fully Offline: Ollama *(no API key, your data never leaves your machine)*\n\n**1. Install Ollama and pull a model**\n```bash\n# Download Ollama from https://ollama.com, then:\nollama serve \u0026\nollama pull gemma4:e2b\n```\n\n**2. Install and run Prefrontal**\n```bash\ngit clone https://github.com/sidx1-scratch/prefrontal\ncd prefrontal\nnpm install \u0026\u0026 npm start\n```\n\n**3. Configure and go**\nOpen `http://localhost:3000`, go to Settings, and set:\n- Runtime → **Ollama**\n- Server URL → `http://localhost:11434`\n- Model → `gemma4:e2b`\n\n\u003e For Android, LAN servers, Llama.cpp, and other options — see the full setup guide below.\n\n---\n\n## 📦 Installation Options\n\n### Option 1: Install via GitHub Packages *(Recommended)*\n\nMore setup upfront, but once installed you can run Prefrontal from anywhere on your machine without keeping the source folder around.\n\n**1. Authenticate with GitHub Packages**\n```bash\nnpm login --scope=@sidx1-scratch --auth-type=legacy --registry=https://npm.pkg.github.com\n```\nUse your GitHub username and a Personal Access Token from [github.com/settings/tokens](https://github.com/settings/tokens) as the password.\n\n**2. Install globally**\n```bash\nnpm install -g @sidx1-scratch/prefrontal\n```\n\n**3. Run from anywhere**\n```bash\nnpm explore @sidx1-scratch/prefrontal -- npm start\n```\n\n\u003e To update later: `npm install -g @sidx1-scratch/prefrontal` again.\n\n### Option 2: Clone \u0026 Run *(Quickest to get started)*\n\nNo authentication needed — just clone and go. Best if you want to poke around the source or just try it out.\n\n```bash\ngit clone https://github.com/sidx1-scratch/prefrontal\ncd prefrontal\nnpm install\nnpm start\n```\n\nA local web server starts and the app opens automatically at `http://localhost:3000`.\n\n---\n\n## 🧠 Setting Up Your AI Backend\n\nYou need **one** of the following backends. Pick whichever suits your setup.\n\n### Option A: OpenRouter *(Easiest — no local install, free models available)*\n\nOpenRouter is an API that routes to dozens of AI models, many of which are completely free. No GPU or model download required — just an API key.\n\n**1. Create a free account**\nSign up at [openrouter.ai](https://openrouter.ai) and grab your API key from [openrouter.ai/keys](https://openrouter.ai/keys).\n\n**2. Configure Prefrontal**\n- Runtime → **OpenRouter**\n- API Key → paste your key\n- Model → enter any model ID from [openrouter.ai/models](https://openrouter.ai/models)\n\n**Recommended free models to start with:**\n\n| Model | ID |\n|-------|----|\n| Mistral 7B Instruct | `mistralai/mistral-7b-instruct:free` |\n| Llama 3.1 8B | `meta-llama/llama-3.1-8b-instruct:free` |\n| Gemma 3 4B | `google/gemma-3-4b-it:free` |\n\n\u003e Free models may have rate limits. Check [openrouter.ai/models?q=free](https://openrouter.ai/models?q=free) for the current free tier.\n\n---\n\n### Option B: Ollama *(Best for fully offline use — Windows, macOS, Linux)*\n\n**1. Install Ollama**\nDownload from [ollama.com](https://ollama.com) and run the installer.\n\n**2. Start the server**\n```bash\nollama serve\n```\nThis starts Ollama on `http://localhost:11434`. Keep this terminal open.\n\n**3. Pull a model**\n```bash\n# Recommended — small, fast, great quality:\nollama pull gemma4:e2b\n\n# More capable (needs more RAM):\nollama pull gemma4\nollama pull llama3.2\nollama pull mistral\n```\n\n**4. Configure Prefrontal**\n- Open Settings (⚙️ icon or `Ctrl+,`)\n- Runtime → **Ollama**\n- Server URL → `http://localhost:11434`\n- Model → type `gemma4:e2b` or click **Refresh** to pick from installed models\n\n---\n\n### Option C: Llama.cpp *(Cross-platform: Windows, macOS, Linux, Android)*\n\nLlama.cpp exposes an OpenAI-compatible REST API.\n\n#### 🖥️ Desktop (Windows / macOS / Linux)\n\n**Download a pre-built release:**\n[https://github.com/ggml-org/llama.cpp/releases](https://github.com/ggml-org/llama.cpp/releases)\n\nOr build from source:\n```bash\ngit clone https://github.com/ggerganov/llama.cpp\ncd llama.cpp\nmkdir build \u0026\u0026 cd build\ncmake .. -DLLAMA_BLAS=ON   # optional: add GPU flags\ncmake --build . --config Release\n```\n\n**Start the server:**\n```bash\n./llama-server -m models/your_model.gguf --port 8080 --host 0.0.0.0 -c 8192\n```\n\n**Configure Prefrontal:**\n- Runtime → **Llama.cpp / OpenAI**\n- Server URL → `http://localhost:8080/v1`\n- Model → enter the exact filename of your `.gguf` model (e.g. `gemma-2-2b.gguf`)\n\n---\n\n#### 📱 Android / Mobile *(via Termux)*\n\n**1. Install Termux**\nGet it from [F-Droid](https://f-droid.org/en/packages/com.termux/) — not the Play Store version, which is outdated.\n\n**2. Install dependencies**\n```bash\npkg update \u0026\u0026 pkg upgrade\npkg install clang wget git cmake make python3\n```\n\n**3. Build Llama.cpp**\n```bash\ngit clone https://github.com/ggerganov/llama.cpp\ncd llama.cpp\nmkdir build \u0026\u0026 cd build\ncmake .. -DCMAKE_BUILD_TYPE=Release\nmake -j4\n```\n\n**4. Download a model**\nUse a small GGUF model (2–4 GB recommended for mobile):\n```bash\nmkdir -p ../models\n# Example: TinyLlama 1.1B Q4 — good balance of size and quality for mobile\nwget -P ../models https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf\n```\n\n**5. Start the server**\n```bash\n./bin/llama-server -m ../models/tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf \\\n  --port 8080 --host 0.0.0.0 -c 4096\n```\n\n**6. Open Prefrontal**\nIn a second Termux session, start the Node.js server:\n```bash\ncd prefrontal \u0026\u0026 npm start\n```\nThen open `http://127.0.0.1:3000` in your Android browser.\n\n**Configure Prefrontal:**\n- Runtime → **Llama.cpp / OpenAI**\n- Server URL → `http://127.0.0.1:8080/v1`\n- ⚠️ Use `127.0.0.1` instead of `localhost` on Android — they may not resolve the same way\n\n---\n\n**External or LAN Servers:**\nIf your AI backend runs on a different machine (home server, another PC), bind it to `0.0.0.0` and enter its LAN IP in Settings — e.g. `http://192.168.1.100:11434` for Ollama or `http://192.168.1.100:8080/v1` for Llama.cpp.\n\n---\n\n## 🎭 Personality Presets\n\nPrefrontal includes **4 built-in personality presets** that change the system prompt and temperature simultaneously. Switch between them on the welcome screen or in Settings.\n\n| Preset | Temp | Best For |\n|--------|------|----------|\n| ⚖️ **Balanced** | 0.7 | General tasks, Q\u0026A, learning |\n| 🎨 **Creative** | 1.1 | Writing, brainstorming, storytelling |\n| 🎯 **Precise** | 0.2 | Facts, summaries, concise answers |\n| 💻 **Developer** | 0.3 | Code review, debugging, technical docs |\n\nYou can also write a fully **Custom** system prompt — edit the System Prompt box in Settings and the preset selector switches to Custom automatically.\n\n---\n\n## 🌡️ Temperature Control\n\nTemperature controls how random or creative the AI's outputs are.\n\n| Value | Behaviour |\n|-------|-----------|\n| `0.0` | Fully deterministic — same input = same output |\n| `0.2–0.4` | Precise and focused |\n| `0.7` | Balanced (default) |\n| `1.0–1.2` | Creative and varied |\n| `1.5–2.0` | Wild, experimental, sometimes incoherent |\n\n\u003e **Pro Tip:** Temperature is sent with every message — just adjust the slider, save, and it applies to the next generation. No restart needed.\n\n---\n\n## 🎨 Features\n\n| Feature | Details |\n|---------|---------|\n| 💬 **Chat** | Full conversation history with any local AI model |\n| 🔄 **Streaming** | Real-time token-by-token generation |\n| 🎭 **Personality Presets** | 4 built-in modes with one click |\n| 🌡️ **Temperature Control** | Live-sent with every request |\n| 📚 **Multi-Backend** | OpenRouter (cloud), Ollama, and Llama.cpp over local or LAN |\n| 🌐 **LAN \u0026 External** | Connect to dedicated AI servers on your network |\n| 💾 **Multi-Chat** | Unlimited saved local conversations |\n| 🔍 **Search** | Instant conversation search |\n| 📱 **PWA \u0026 Mobile Ready** | Install as an app on iOS/Android; safe-area aware |\n| 🎨 **Refined UI** | 4 themes: Dark, Midnight, Emerald, Light |\n| 🧑 **Local Profile** | Device identity stored locally — no accounts |\n| 📤 **Export** | Export chats as Markdown, profile as JSON |\n| 🔒 **100% Private** | Zero network calls except to your own model server |\n\n---\n\n## ⌨️ Keyboard Shortcuts\n\n| Shortcut | Action |\n|----------|--------|\n| `Ctrl + N` | New conversation |\n| `Ctrl + ,` | Open Settings |\n| `Enter` | Send message *(configurable)* |\n| `Shift + Enter` | New line in input |\n| `Escape` | Close modal |\n\n---\n\n## 🔧 Troubleshooting\n\n### ❌ \"Cannot connect to server\"\n- Make sure your AI backend is **running** before opening Prefrontal\n- Ollama: run `ollama serve` in a terminal\n- Llama.cpp: confirm `llama-server` is running with the correct port\n- Verify Settings → **Server URL** matches your backend exactly (including `/v1` for Llama.cpp)\n- On Android, use `http://127.0.0.1` — `localhost` may not resolve correctly\n\n### ❌ \"Model not found\"\n- **Ollama**: run `ollama list` to see installed models; copy the exact name including tag\n- **Llama.cpp**: the model name is the `.gguf` filename you passed to `llama-server` with `-m`\n- Click **Refresh** in Settings to auto-populate the model list\n\n### ❌ Streaming stops or output is garbled\n- Lower the **Context Window** setting — the model may be running out of memory\n- Try a smaller model (e.g. `gemma4:e2b` instead of `gemma4`)\n- Restart the backend server and try again\n\n### ❌ Temperature changes have no effect\n- Temperature applies to the **next message** only — not retroactively\n- Make sure you click **Save Settings** after adjusting the slider\n- Some models enforce a minimum temperature internally; very low values may behave like `0.0`\n\n### ❌ App opens but is blank\n- Confirm you ran `npm start`, not `npm run build`\n- Try `npx serve .` as an alternative server\n- Open the browser console (`F12`) and check for errors\n\n---\n\n## 🤝 Contributing\n\nIssues and PRs welcome at [github.com/sidx1-scratch/prefrontal](https://github.com/sidx1-scratch/prefrontal).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsidx1-scratch%2Fprefrontal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsidx1-scratch%2Fprefrontal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsidx1-scratch%2Fprefrontal/lists"}