{"id":48662066,"url":"https://github.com/visualstudioblyat/baihu","last_synced_at":"2026-04-10T10:13:13.209Z","repository":{"id":339058935,"uuid":"1159648474","full_name":"visualstudioblyat/baihu","owner":"visualstudioblyat","description":"the smallest paranoid ai assistant that actually works. 100% rust.","archived":false,"fork":false,"pushed_at":"2026-02-17T19:46:24.000Z","size":244,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-18T00:53:59.146Z","etag":null,"topics":["ai","assistant","cli","discord-bot","multi-provider","ollama","openrouter","rust","security","self-hosted","sqlite","telegram-bot"],"latest_commit_sha":null,"homepage":"https://baihu.dev","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/visualstudioblyat.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","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-02-17T01:32:13.000Z","updated_at":"2026-02-17T19:46:28.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/visualstudioblyat/baihu","commit_stats":null,"previous_names":["visualstudioblyat/baihu"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/visualstudioblyat/baihu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visualstudioblyat%2Fbaihu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visualstudioblyat%2Fbaihu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visualstudioblyat%2Fbaihu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visualstudioblyat%2Fbaihu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/visualstudioblyat","download_url":"https://codeload.github.com/visualstudioblyat/baihu/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/visualstudioblyat%2Fbaihu/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31637826,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T07:40:12.752Z","status":"ssl_error","status_checked_at":"2026-04-10T07:40:11.664Z","response_time":98,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","assistant","cli","discord-bot","multi-provider","ollama","openrouter","rust","security","self-hosted","sqlite","telegram-bot"],"created_at":"2026-04-10T10:13:12.569Z","updated_at":"2026-04-10T10:13:13.199Z","avatar_url":"https://github.com/visualstudioblyat.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"baihu.svg\" alt=\"Baihu\" width=\"128\" height=\"128\"\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eBaihu\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eAI with teeth.\u003c/strong\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/visualstudioblyat/baihu/releases\"\u003e\u003cimg alt=\"GitHub Release\" src=\"https://img.shields.io/github/v/release/visualstudioblyat/baihu?style=flat-square\u0026color=6366f1\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/visualstudioblyat/baihu/blob/main/LICENSE\"\u003e\u003cimg alt=\"License\" src=\"https://img.shields.io/github/license/visualstudioblyat/baihu?style=flat-square\u0026color=6366f1\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/visualstudioblyat/baihu/stargazers\"\u003e\u003cimg alt=\"Stars\" src=\"https://img.shields.io/github/stars/visualstudioblyat/baihu?style=flat-square\u0026color=6366f1\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/visualstudioblyat/baihu/issues\"\u003e\u003cimg alt=\"Issues\" src=\"https://img.shields.io/github/issues/visualstudioblyat/baihu?style=flat-square\u0026color=6366f1\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/visualstudioblyat/baihu/issues\"\u003eReport Bug\u003c/a\u003e ·\n  \u003ca href=\"https://github.com/visualstudioblyat/baihu/discussions\"\u003eFeature Request\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n## Why I Built This\n\nEvery AI CLI I tried needed Python, Node, or Docker and 400MB of RAM. Most had real security bugs — UUID v4 for key generation, no zeroize, half-written config files, SSRF-able provider endpoints.\n\nOne binary. No runtime. 100% Rust. 482 tests.\n\n## What's In It\n\n- **5 Built-in Providers.** OpenRouter, Anthropic, OpenAI, Ollama, and any OpenAI-compatible API with `custom:https://your-endpoint.com`. Groq, Mistral, xAI, DeepSeek, Together, and others work through the custom provider.\n- **7 Chat Channels.** Telegram, Discord, Slack, iMessage, Matrix, WhatsApp, Webhooks. All run simultaneously through the daemon. Implement the `Channel` trait to add your own.\n- **Custom Memory Engine.** No Pinecone, no Elasticsearch, no LangChain. SQLite with FTS5 + BM25 keyword search, vector cosine similarity, weighted hybrid merge, embedding cache with LRU eviction. Large entries get LZ4 compressed automatically (anything over 1KB). All custom, zero external dependencies.\n- **Encrypted Secrets.** API keys encrypted with ChaCha20-Poly1305 AEAD. Keys generated from OS CSPRNG, not UUID. Secret key material wrapped with `Zeroizing\u003cVec\u003cu8\u003e\u003e` so it's zeroed on drop. On Windows, the key file itself is envelope-encrypted with DPAPI bound to your login session. Fresh nonce per encryption. Poly1305 tag prevents tampering.\n- **Atomic Everything.** Config saves, secret key writes, daemon state flushes all go through write-tmp, fsync, rename. If the process dies mid-write you get the old file, not a corrupt one. The daemon grabs an exclusive file lock on startup so you can't accidentally run two instances and corrupt state.\n- **Gateway Pairing.** Localhost-only by default. 6-digit OTP on first connect, bearer tokens after. Constant-time comparison that doesn't leak length info. Brute force lockout after 5 attempts. Refuses to bind 0.0.0.0 without a tunnel.\n- **SSRF Protection.** Provider URLs are validated against private IP ranges (127.x, 10.x, 172.16-31.x, 192.168.x, 169.254.x, CGNAT, IPv6 loopback/link-local) before any request goes out. Custom redirect policy validates every 3xx hop to block redirect-to-localhost attacks. Ollama is intentionally exempt because it's supposed to be local.\n- **Filesystem Sandbox.** Path jail, symlink escape detection, null byte injection blocked, command allowlisting, system directory protection. On Windows, shell commands run inside a Job Object with KILL_ON_JOB_CLOSE and a 256MB memory limit. Default: supervised + workspace-only.\n- **Retry with Jitter.** Provider calls and daemon components use exponential backoff with +/-25% random jitter to prevent thundering herd on mass restart. Response caching with DashMap (60s TTL) so identical prompts don't burn API credits.\n- **Heartbeat \u0026 Scheduler.** Periodic tasks from HEARTBEAT.md, cron scheduling, skills loader, 74 integrations registry.\n- **Setup Wizard.** `baihu onboard` gets you running in under 60 seconds. Live connection testing, secure defaults.\n\n## Tech Stack\n\n| Layer | Tech |\n|-------|------|\n| Binary Size | ~4.5MB (.exe) / ~3.4MB (unix) |\n| Language | Rust, 100% |\n| Allocator | mimalloc (Mozilla/Microsoft) |\n| Mutex | parking_lot (1 byte vs 40) |\n| Concurrency | tokio JoinSet structured concurrency |\n| Memory | SQLite + FTS5 + vector cosine similarity + LZ4 |\n| Encryption | ChaCha20-Poly1305 AEAD + DPAPI (Windows) |\n| Secrets | Zeroize on drop, CSPRNG key gen, atomic writes |\n| HTTP | axum + tower, SSRF-validated provider URLs |\n| Caching | DashMap concurrent hashmap, 60s TTL |\n| Build | opt-level=z, LTO, panic=abort, codegen-units=1 |\n\n## Quick Start\n\n```bash\ngit clone https://github.com/visualstudioblyat/baihu.git\ncd baihu\ncargo build --release\ncargo install --path . --force\n\nbaihu onboard --interactive\nbaihu agent -m \"hello\"\n```\n\nOr with Gemini:\n\n```toml\n# ~/.baihu/config.toml\ndefault_provider = \"custom:https://generativelanguage.googleapis.com/v1beta/openai\"\ndefault_model = \"gemini-2.5-flash\"\napi_key = \"your-google-api-key\"\n```\n\n## Commands\n\n| Command | What it does |\n|---------|-------------|\n| `baihu agent -m \"...\"` | Single message |\n| `baihu agent` | Interactive chat |\n| `baihu daemon` | Full runtime (gateway + channels + heartbeat + scheduler) |\n| `baihu gateway` | Webhook server |\n| `baihu doctor` | System diagnostics |\n| `baihu status` | Full status |\n| `baihu onboard` | Setup wizard |\n| `baihu channel start` | Start all chat channels |\n| `baihu cron add/list` | Scheduled tasks |\n| `baihu service install/start/stop` | OS service management |\n\n## Architecture\n\nEvery subsystem is a trait. Swap implementations with a config change, zero code changes.\n\n| Subsystem | Trait | Ships with | Extend |\n|-----------|-------|------------|--------|\n| AI Models | `Provider` | 5 providers + custom | `custom:https://your-api.com` |\n| Channels | `Channel` | CLI, Telegram, Discord, Slack, iMessage, Matrix, WhatsApp, Webhook | Any messaging API |\n| Memory | `Memory` | SQLite hybrid search + LZ4 compression | Any persistence backend |\n| Tools | `Tool` | shell, file_read, file_write, memory_store, memory_recall, browser, composio | Any capability |\n| Observability | `Observer` | noop, log, multi | Prometheus, OTEL |\n| Security | `SecurityPolicy` | Pairing, sandbox, allowlists, SSRF, encrypted secrets, DPAPI, zeroize | - |\n| Tunnel | `Tunnel` | Cloudflare, Tailscale, ngrok, custom | Any tunnel binary |\n\n## Building from Source\n\n```bash\ncargo build              # dev build\ncargo build --release    # release (~3.4MB)\ncargo test --lib         # 482 tests\ncargo clippy             # lint (0 warnings)\n```\n\n## Contributing\n\nBaihu is open source under the [MIT](LICENSE) license. Contributions welcome. Open an issue or submit a PR.\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## Roadmap\n\n- [x] ~~5 built-in providers + any OpenAI-compatible API~~\n- [x] ~~7 chat channels (Telegram, Discord, Slack, iMessage, Matrix, WhatsApp, Webhook)~~\n- [x] ~~SQLite hybrid memory (FTS5 + BM25 + vector cosine similarity)~~\n- [x] ~~ChaCha20-Poly1305 encrypted secrets with CSPRNG + zeroize~~\n- [x] ~~DPAPI envelope encryption (Windows)~~\n- [x] ~~Atomic file writes (crash-safe config, secrets, daemon state)~~\n- [x] ~~SSRF mitigation on provider URLs~~\n- [x] ~~Gateway pairing with OTP + bearer tokens~~\n- [x] ~~Filesystem sandbox with symlink escape detection~~\n- [x] ~~Windows Job Object sandboxing for shell commands~~\n- [x] ~~LZ4 compression for large memory entries~~\n- [x] ~~DashMap response caching with TTL~~\n- [x] ~~Exponential backoff with jitter~~\n- [x] ~~Daemon single-instance file locking~~\n- [x] ~~Heartbeat engine + cron scheduler~~\n- [x] ~~74 integrations registry~~\n- [x] ~~OS service management (systemd, launchd)~~\n- [x] ~~Setup wizard (`baihu onboard`)~~\n- [x] ~~Tunnel support (Cloudflare, Tailscale, ngrok)~~\n- [ ] Linux Landlock filesystem isolation for shell commands\n- [ ] Governor rate limiting on provider calls\n- [ ] Plugin system (hot-loadable skills from `~/.baihu/skills/`)\n- [ ] Web UI dashboard\n- [ ] Voice channels\n- [ ] Cross-platform installers (Homebrew, AUR, Scoop)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvisualstudioblyat%2Fbaihu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvisualstudioblyat%2Fbaihu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvisualstudioblyat%2Fbaihu/lists"}