Skip to main content

๐Ÿ‡ฎ๐Ÿ‡ณ BHAI-CLI

The Dual-Brain Agentic Coding CLI โ€” 22 Indian Languages. One CLI.

เคญเคพเคˆ ยท เฆญเฆพเฆ‡ ยท เชญเชพเชˆ ยท เจญเจพเจˆ ยท เฐญเฐพเฐฏเฑ ยท เฒญเฒพเฒฏเณ ยท เคญเคพเคŠ ยท เฌญเฌพเฌ‡

BHAI is a lean, zero-state resilient CLI tool that acts as your 10x Senior SDE from India. It uses a Dual-Brain Manager-Worker Architecture โ€” a VibeLLM for persona, planning, and review, and a CoderAgent for autonomous tool-calling execution โ€” all powered by litellm for universal LLM provider support and Sarvam AI for 22 Indian language understanding.

"You are BHAI, a 10x Senior SDE from India. Sab bhasha samajhte ho. You roast O(Nยฒ) loops and unoptimized Dockerfiles."


โœจ Features

  • ๐Ÿง  Dual-Brain Agentic Architecture: VibeLLM (Manager/Planner) delegates step-by-step tasks to the CoderAgent (Worker) which autonomously executes tools in a loop.
  • ๐Ÿค– MCP-Powered File Operations: Full agentic capability to read_file, write_file, edit_file, and list_directory autonomously to build features from scratch.
  • ๐Ÿ’พ Persistent Session Management: Chat histories are saved locally with LLM-auto-generated titles. Resume past context anytime from the interactive menu.
  • ๐Ÿ–ฅ๏ธ Interactive Menu-Driven CLI: Simply run bhai-code for a rich, beautifully colored terminal UI to chat, manage sessions, and configure settings.
  • ๐Ÿ”’ Secure Secrets Storage: API keys are strictly separated into a 0600 permission secrets.yaml and masked during screen display.
  • ๐Ÿ‡ฎ๐Ÿ‡ณ 22 Indian Languages: Speak in Hindi, Punjabi, Bengali, Tamil, Telugu, Gujarati, Marathi, Kannada, Malayalam, and more.
  • ๐ŸŒ Universal LLM Support: DeepSeek, xAI (Grok), Qwen, OpenAI, Anthropic, Groq, Google Gemini, Sarvam, Mistral, Cerebras, Ollama, Bedrock, and more.
  • ๐ŸŽ™๏ธ Indic Voice Interface: Sarvam Saaras v3 (STT) translates any Indian language to English, Bulbul v3 (TTS) reads responses back.
  • โšก Zero-State Resilience: Boots in <300ms, persistent YAML config, hot-swappable model overrides.

๐Ÿš€ Installation

pip install bhai-cli

With voice support (optional):

pip install "bhai-cli[audio]"
# Also needs: sudo apt install libportaudio2  (Linux)

โš™๏ธ Setup

bhai-code setup

The interactive wizard will configure:

  1. VibeLLM โ€” Your planner/persona brain (e.g., sarvam/sarvam-105b, groq/llama-3.3-70b-versatile)
  2. CoderAgent โ€” Your autonomous worker brain (e.g., openai/gpt-4o, anthropic/claude-3-5-sonnet-20241022)
  3. Sarvam AI โ€” Voice interface API key (optional)
  4. Ollama Port โ€” Local inference configuration

Model Format

Uses litellm's model naming:

Provider Format Example
Anthropic anthropic/model anthropic/claude-3-5-sonnet-20241022
OpenAI openai/model openai/gpt-4o
Google gemini/model gemini/gemini-2.5-pro
DeepSeek deepseek/model deepseek/deepseek-coder
xAI xai/model xai/grok-beta
Groq groq/model groq/llama-3.3-70b-versatile
Sarvam sarvam/model sarvam/sarvam-105b
Ollama ollama/model ollama/llama3

๐Ÿ’ฌ Usage

Interactive Menu (Recommended)

# Opens the rich terminal UI for chats, session management, and settings
bhai-code

Text Mode

# Directly start a new chat session interactively
bhai-code text

# Single prompt execution
bhai-code text "explain the pyproject.toml file"

# Resume a specific session
bhai-code text --session-id <uuid>

# Override models on the fly
bhai-code text "optimize this Dockerfile" --vibe-model groq/llama-3.3-70b-versatile --coder-model openai/gpt-4o

Voice Mode

# Live microphone
bhai-code listen

# From audio file
bhai-code listen --file recording.wav

View Config

bhai-code config

๐Ÿ—๏ธ Architecture

User Input (Any of 22 Indian Languages / English)
         โ”‚
         โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   VibeLLM (Brain A)  โ”‚  โ† Persona + Planning + Session Management
โ”‚   Sarvam-105B / any  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”‚ {"task": "step-by-step instructions"}
           โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  CoderAgent (Brain B)โ”‚  โ† Autonomous Execution Loop
โ”‚  Any litellm model   โ”‚
โ”‚                      โ”‚
โ”‚  Tools:              โ”‚
โ”‚  โ€ข read/write/edit   โ”‚  โ† File System Ops
โ”‚  โ€ข execute_bash      โ”‚  โ† [Y/n] Guardrail
โ”‚  โ€ข web_search        โ”‚  โ† DuckDuckGo
โ”‚  โ€ข codebase_context  โ”‚  โ† AST signatures
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”‚ Results
           โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   VibeLLM (Brain A)  โ”‚  โ† Review & Final Output
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”ง Tools (MCP-Powered)

Tool Description
read_file Read the exact contents of a file before editing
write_file Create a new file with provided content
edit_file Target specific line ranges to replace code blocks
list_directory Explore project structure to navigate codebase
execute_bash Run shell commands (tests, docker, git) with [Y/n] confirmation
web_search DuckDuckGo search for real-time debugging
codebase_context Smart directory scanner with AST-based signature extraction

๐Ÿ“ Project Structure

bhai-cli/
โ”œโ”€โ”€ src/bhai_cli/
โ”‚   โ”œโ”€โ”€ __init__.py          # Package metadata
โ”‚   โ”œโ”€โ”€ cli.py               # Rich interactive Typer CLI
โ”‚   โ”œโ”€โ”€ config_manager.py    # Configuration & secure secrets
โ”‚   โ”œโ”€โ”€ session_manager.py   # Chat history persistence & auto-titling
โ”‚   โ”œโ”€โ”€ orchestrator.py      # Dual-Brain Agentic Loop
โ”‚   โ”œโ”€โ”€ audio_engine.py      # Sarvam STT/TTS
โ”‚   โ””โ”€โ”€ tools/
โ”‚       โ”œโ”€โ”€ __init__.py      # Tool registry + JSON schemas
โ”‚       โ”œโ”€โ”€ file_ops.py      # Read, Write, Edit, List tools
โ”‚       โ”œโ”€โ”€ bash.py          # execute_bash with guardrails
โ”‚       โ”œโ”€โ”€ search.py        # web_search via DuckDuckGo
โ”‚       โ””โ”€โ”€ codebase.py      # codebase_context with AST
โ”œโ”€โ”€ tests/
โ”œโ”€โ”€ website/                 # Next.js Landing Page Frontend
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ bhai_cli_documentation.html # Exhaustive local docs (gitignored)
โ””โ”€โ”€ README.md

๐Ÿ”‘ Environment Variables & Secrets

API keys are securely isolated in ~/.config/bhai/secrets.yaml (0600 permissions). Supported keys include: SARVAM_API_KEY, VIBE_API_KEY, CODER_API_KEY, GROQ_API_KEY, OPENAI_API_KEY, ANTHROPIC_API_KEY, GEMINI_API_KEY, DEEPSEEK_API_KEY, XAI_API_KEY.


๐Ÿ“„ License

Apache-2.0 โ€” see LICENSE.

Built with โค๏ธ from India by Madhav Kapila.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bhai_cli-0.2.12.tar.gz (38.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bhai_cli-0.2.12-py3-none-any.whl (42.9 kB view details)

Uploaded Python 3

File details

Details for the file bhai_cli-0.2.12.tar.gz.

File metadata

  • Download URL: bhai_cli-0.2.12.tar.gz
  • Upload date:
  • Size: 38.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.14.4 Linux/7.0.0-15-generic

File hashes

Hashes for bhai_cli-0.2.12.tar.gz
Algorithm Hash digest
SHA256 dfc3927c0821afecbc20a49e2bdf77e71ef7e2028af8c87e24e77beee77a85f6
MD5 7111544ba85d93f8a11adaa3f13e3654
BLAKE2b-256 91d951632c73e5b039e21a0d45f08ddb963987cb7aa29dd8a6354a5c6af23a23

See more details on using hashes here.

File details

Details for the file bhai_cli-0.2.12-py3-none-any.whl.

File metadata

  • Download URL: bhai_cli-0.2.12-py3-none-any.whl
  • Upload date:
  • Size: 42.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.14.4 Linux/7.0.0-15-generic

File hashes

Hashes for bhai_cli-0.2.12-py3-none-any.whl
Algorithm Hash digest
SHA256 cf6990a5d4e31886a91d097f7b568599119890d0d9cd9247fa098413958bc812
MD5 8b22d544186f6c0edcb939328a5f9e91
BLAKE2b-256 c7aaea22b540610a5065152a35c6c9e41f0c9e8c4ff8e5960bad343ccc76a57e

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.12 This release

2 files

0.2.11

2 files

0.2.10

2 files

0.2.9

2 files

0.2.8

2 files

0.2.7

2 files

0.2.6

2 files

0.2.5

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page