Skip to content

zosmaai/dhara

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

210 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Dhara logo

Dhara

English | ไธญๆ–‡ | Espaรฑol | ๆ—ฅๆœฌ่ชž | Deutsch | Franรงais | Portuguรชs | ะ ัƒััะบะธะน | ํ•œ๊ตญ์–ด | เคนเคฟเค‚เคฆเฅ€

A minimal, secure, language-agnostic coding agent harness.

CI npm version npm downloads License: MIT Node GitHub Stars

๐Ÿ“– Docs ยท ๐Ÿš€ Getting Started ยท ๐Ÿ—บ๏ธ Roadmap


Thank you for the star!

If you find Dhara useful, star the repo โ€” it tells us we're building something you care about!


Dhara (เคงเคพเคฐเคพ, "flow" in Sanskrit) is the engine that powers AI coding agents. It provides the agent loop, tool management, session persistence, and extension protocol โ€” without being tied to any LLM provider, UI framework, or programming language.

# Install globally (recommended)
npm install -g @zosmaai/dhara

# Then use directly
dhara "List the files in this project"

# Or with pnpm
pnpm install -g @zosmaai/dhara
dhara "List the files in this project"

Features

  • ๐Ÿ”„ Agent Loop โ€” LLM โ†’ tool โ†’ LLM cycle with streaming, cancellation, and error recovery
  • ๐Ÿ”Œ Extension Protocol โ€” JSON-RPC 2.0 wire protocol. Write extensions in any language
  • ๐Ÿ“ฆ 20+ LLM Providers โ€” OpenAI, Anthropic, Google, Mistral, Groq, DeepSeek, Bedrock, and more via pi-ai
  • ๐Ÿ›ก๏ธ Capability Sandbox โ€” Declare what tools need. Block everything else.
  • ๐Ÿ’พ Session Persistence โ€” Append-only JSONL format. Resume conversations across restarts.
  • ๐Ÿ–ฅ๏ธ TUI + REPL โ€” Full-screen terminal UI with syntax highlighting, or line-based REPL
  • ๐Ÿ“ Context Files โ€” AGENTS.md / CLAUDE.md auto-loading per project
  • ๐Ÿ”ง Extensions โ€” Any language, any tool, any hook. Extensions are subprocesses, not function calls.

Quick Start

# Install globally (recommended)
npm install -g @zosmaai/dhara

# One-shot: pass a prompt as an argument
dhara "List the files in this project"

# Interactive mode (TUI) โ€” just run dhara
dhara

# Choose a provider and model
export GOOGLE_API_KEY="..."
dhara --provider google --model gemini-2.5-flash

# Or run directly with npx
npx @zosmaai/dhara "List the files in this project"

Configure a Provider

Dhara needs an LLM provider to function. There are two ways:

Option 1: Interactive setup (recommended)

Run /login inside the TUI to configure a provider interactively:

  1. Launch dhara to enter the TUI
  2. Type /login
  3. Choose API Key as the auth type
  4. Select your provider from the list
  5. Enter your API key (masked with bullet characters)

Your API key is stored securely in ~/.dhara/config.json.

Option 2: CLI flags / environment variables

Set the corresponding environment variable and use --provider:

export OPENAI_API_KEY="sk-..."
dhara --provider openai --model gpt-4o

export ANTHROPIC_API_KEY="sk-ant-..."
dhara --provider anthropic --model claude-sonnet-4-20250514

Providers

Dhara supports 20+ LLM providers. Built-in providers (no extra deps): openai, anthropic, opencode-go.

Additional providers through the pi-ai integration. Set the corresponding environment variable and use --provider:

Provider Env Var --provider
OpenAI OPENAI_API_KEY openai
Anthropic ANTHROPIC_API_KEY anthropic
Google Gemini GOOGLE_API_KEY google
Mistral MISTRAL_API_KEY mistral
Groq GROQ_API_KEY groq
DeepSeek DEEPSEEK_API_KEY deepseek
Amazon Bedrock AWS credentials amazon-bedrock
Azure OpenAI AZURE_OPENAI_API_KEY azure-openai-responses
Fireworks FIREWORKS_API_KEY fireworks
OpenRouter OPENROUTER_API_KEY openrouter
xAI XAI_API_KEY xai
Hugging Face HUGGINGFACE_API_KEY huggingface
Cloudflare CLOUDFLARE_API_KEY cloudflare-workers-ai
Cerebras CEREBRAS_API_KEY cerebras
Together AI TOGETHER_API_KEY together
Google Vertex GCP credentials vertex

Standard Tools

Dhara ships with 6 essential tools. Everything else is an extension.

Tool Description Capability
read Read file contents filesystem:read
write Create/overwrite files filesystem:write
edit Surgical text replacement filesystem:read, filesystem:write
ls Directory listing filesystem:read
grep Pattern search across files filesystem:read
bash Shell command execution process:spawn

Network tools (web fetch, web search), database tools, git operations โ€” all belong in extensions.

Extensions

Extensions communicate via JSON-RPC 2.0 over stdin/stdout. Any language works.

# my-extension/main.py
import sys, json

for line in sys.stdin:
    req = json.loads(line)
    if req["method"] == "initialize":
        print(json.dumps({"jsonrpc":"2.0","result":{
            "protocolVersion":"0.1.0","name":"my-ext","version":"1.0.0",
            "tools":[{"name":"hello","description":"Say hello",
                      "parameters":{"type":"object","properties":{}}}]
        },"id":req["id"]}))
    elif req["method"] == "tools/execute":
        print(json.dumps({"jsonrpc":"2.0","result":{
            "content":[{"type":"text","text":"Hello from Python!"}]
        },"id":req["id"]}))
    sys.stdout.flush()

Install: copy to ~/.dhara/extensions/my-extension/ with a manifest.json.

Configuration

Dhara uses a two-tier config system:

  • Global: ~/.dhara/config.json โ€” settings for all projects
  • Project: .dhara/config.json in your project root โ€” overrides global

Project config takes precedence over global. CLI flags override both.

// ~/.dhara/config.json (global defaults)
{
  "activeProvider": "openai",
  "providers": [
    {
      "id": "openai",
      "name": "OpenAI",
      "authType": "api_key",
      "auth": { "type": "api_key", "apiKey": "sk-..." },
      "defaultModel": "gpt-4o",
      "enabled": true
    }
  ],
  "session": {
    "autoSave": true,
    "maxIterations": 100
  }
}

Note: Legacy .dhara/settings.json files are still loaded for backward compatibility, but .dhara/config.json is the recommended project-level config file.

Documentation

Full documentation is at dhara.zosma.ai.

Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚              ECOSYSTEM LAYER            โ”‚
โ”‚  Packages ยท Themes ยท Skills ยท Prompts   โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚              EXTENSION LAYER            โ”‚
โ”‚  Tools ยท Providers ยท Renderers ยท Hooks  โ”‚
โ”‚  (any language, wire protocol)          โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚               CORE LAYER               โ”‚
โ”‚  Agent Loop ยท Tool Interface ยท Sandbox  โ”‚
โ”‚  Session Format ยท Event Bus             โ”‚
โ”‚  (< 2,000 lines, no LLM, no UI)         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Project Status

Dhara is in active development. Phases 0โ€“3 (Spec, Core, Standard Library, CLI) are complete. Current work focuses on documentation, extension ecosystem, and launch prep.

See spec/roadmap.md for details.

Contributing

See CONTRIBUTING.md for guidelines.

License

MIT โ€” see LICENSE. Spec documents are CC-BY-4.0 โ€” see LICENSE-SPEC.

Built with โค๏ธ by Zosma AI.

About

Dhara โ€” The Agent Protocol Standard. Minimal, secure, language-agnostic coding agent harness. Built from India ๐Ÿ‡ฎ๐Ÿ‡ณ for the World ๐ŸŒ

Topics

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE-SPEC.md

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors