A desktop-native, fully local AI system built as a cluster of specialized AIs working together through a shared tool framework.
CHAD is not a single monolithic model โ it's a cluster of specialized AI models, each with a clear responsibility:
- mistral-small โ Planning and orchestration
- qwen2.5-coder:14b โ Fast implementation
- qwen2.5-coder:32b โ Deep reasoning and architecture
- llava โ Vision and UI understanding
These models work together, coordinated by the planner, which decides which AI handles each task and which tools are needed.
Different tasks require different strengths. CHAD uses:
- Smaller, specialized models that are more predictable
- Independent models that can be swapped or upgraded
- Better scaling than a single large model
All actions go through explicit tools:
- โ Permission-based
- โ Auditable
- โ Extensible
- โ Safe by default
- 100% local execution (Ollama)
- No cloud model inference
- Your code stays on your machine
- Works offline
- Node.js 18+ and npm
- Ollama running locally with models:
ollama pull mistral-small ollama pull qwen2.5-coder:14b ollama pull qwen2.5-coder:32b ollama pull llava
CHAD can also talk to an OpenAI-compatible local gateway (for example at http://localhost:1234/v1) and uses Vercel AI SDK to make the planner emit schema-validated JSON.
- Environment
CHAD_LLM_PROVIDER:openai-compatibleCHAD_OPENAI_BASE_URL: defaults tohttp://localhost:1234/v1whenCHAD_LLM_PROVIDERis OpenAI-compatibleCHAD_OPENAI_NO_AUTH: settruefor local gateways that donโt require an API keyCHAD_USE_AI_SDK: setfalseto disable AI SDK and fall back to raw/chat/completions
# Clone the repository
git clone https://github.com/yourusername/chad.git
cd chad
# Install dependencies
npm install
# Install Open WebUI dependencies
cd open-webui
npm install
cd ..
# Build and start CHAD
npm startCHAD will:
- Show the splash screen with loading progress
- Start Open WebUI dev server
- Initialize the AI cluster and tools
- Launch the main window
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Open WebUI (Frontend) โ
โ Vite + Svelte + Tailwind โ
โโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ window.chad API
โ (IPC Bridge)
โโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Electron Main Process โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Orchestrator โ โ
โ โ โข Task management โ โ
โ โ โข Tool approval โ โ
โ โ โข Model coordination โ โ
โ โโโโโโโโโโโโโฌโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโ โ
โ โ โ โ
โ โโโโโโโโโโโโโดโโโโโโ โโโโโดโโโโโโโโโโโโโโโ โ
โ โ AI Cluster โ โ Tool Registry โ โ
โ โ โ โ โ โ
โ โ โข Planner โ โ โข Filesystem โ โ
โ โ โข Coder โ โ โข Terminal โ โ
โ โ โข Architect โ โ โข Web โ โ
โ โ โข Vision โ โ โข Custom... โ โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโดโโโโโโโโโ
โ Ollama API โ
โ (localhost) โ
โโโโโโโโโโโโโโโโโโ
Role: Central coordinator and reasoning engine
Responsibilities:
- Interpret user intent
- Break requests into steps
- Decide which tools are needed
- Delegate tasks to specialized AIs
- Coordinate multi-step workflows
Does NOT: Write code directly
Role: Fast implementation for everyday development
Best for:
- React, TypeScript, Node.js
- UI components
- Scripts and utilities
- Day-to-day coding tasks
Role: Complex reasoning and architectural decisions
Best for:
- Large refactors
- Cross-system reasoning
- Architecture decisions
- High-risk changes
When to use: Selectively, not continuously (it's slower)
Role: Visual understanding
Best for:
- Analyzing screenshots
- Describing UI layouts
- Converting mockups to code
CHAD provides explicit, permission-based tools that AIs can request.
// Read files
window.chad.tools.execute('fs_read', { path: 'path/to/file.ts' });
// Write files (requires approval)
window.chad.tools.execute('fs_write', {
path: 'path/to/file.ts',
content: '...'
});
// Search files
window.chad.tools.execute('fs_search', {
path: '.',
pattern: '*.tsx'
});
// Patch files (safer than full write)
window.chad.tools.execute('fs_patch', {
path: 'path/to/file.ts',
find: 'old code',
replace: 'new code'
});// PowerShell (requires approval)
window.chad.tools.execute('terminal_powershell', {
command: 'npm install',
cwd: 'path/to/project'
});
// WSL (requires approval)
window.chad.tools.execute('terminal_wsl', {
command: 'ls -la',
cwd: '/home/user'
});// Search the web
window.chad.tools.execute('web_search', {
query: 'React best practices 2024',
numResults: 5
});
// Fetch URL content
window.chad.tools.execute('web_fetch', {
url: 'https://api.example.com/data'
});See docs/TOOL_DEVELOPMENT.md for a guide on creating custom tools.
CHAD's API is available via window.chad:
// Chat with the orchestrator
const response = await window.chad.chat(
"Refactor the auth system to use JWT"
);
// Chat with a specific model
const code = await window.chad.model.chat('coder', [
{ role: 'user', content: 'Write a React hook for data fetching' }
]);
// List available models
const models = await window.chad.model.list();
// Execute tools
const fileContent = await window.chad.tools.execute('fs_read', {
path: 'src/main.ts'
});
// Check health
const health = await window.chad.health();When an AI requests a destructive tool (write files, execute commands), CHAD emits an approval request:
window.chad.tools.onApprovalRequest((request) => {
// Show UI to user
const approved = confirm(`Allow ${request.tool}?`);
// Send approval
window.chad.tools.approve({
taskId: request.taskId,
toolName: request.tool,
params: request.params,
approved
});
});- API Documentation โ Complete API reference
- Open WebUI Integration โ Integration guide
- Tool Development โ Creating custom tools
- Architecture Deep Dive โ System design details
# Build TypeScript
npm run build
# Watch mode
npm run watch
# Start CHAD
npm start
# Package for distribution
npm run packageEdit src/ai/cluster.ts:
this.models.set("newModel", {
name: "newModel",
role: "Description",
model: "ollama-model-name",
responsibilities: [...]
});Create a tool file in src/tools/:
// src/tools/mytools.ts
import { registry, Tool } from "./registry";
const myTool: Tool = {
name: "my_tool",
description: "Does something useful",
parameters: { ... },
requiresApproval: false,
execute: async (params) => {
// Implementation
}
};
export function registerMyTools() {
registry.register(myTool);
}Then register in src/tools/index.ts.
CHAD is designed with security in mind:
- No unrestricted access โ All actions go through explicit tools
- Permission-based โ Destructive operations require approval
- Auditable โ All tool calls are logged
- Local execution โ No data leaves your machine
- Hardware automation tools
- Additional API integrations
- Custom subagent creation
- Model swapping UI
- Enhanced task monitoring
- Tool analytics and history
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
MIT License - see LICENSE for details.
- Open WebUI โ Frontend framework
- Ollama โ Local model inference
- Electron โ Desktop framework
- qwen2.5-coder โ Excellent coding models
- mistral-small โ Reliable reasoning
CHAD: Because coding should be collaborative, even when it's just you and your AIs.
