Skip to content

dashgy/CHAD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

CHAD โ€” Coding, Hardware, and Automation Designer

A desktop-native, fully local AI system built as a cluster of specialized AIs working together through a shared tool framework.

CHAD Architecture

๐Ÿง  What is CHAD?

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.

๐ŸŽฏ Design Philosophy

Clustered, Not Monolithic

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

Tool-Driven, Not Unrestricted

All actions go through explicit tools:

  • โœ… Permission-based
  • โœ… Auditable
  • โœ… Extensible
  • โœ… Safe by default

Local, Not Cloud

  • 100% local execution (Ollama)
  • No cloud model inference
  • Your code stays on your machine
  • Works offline

๐Ÿš€ Quick Start

Prerequisites

  1. Node.js 18+ and npm
  2. Ollama running locally with models:
    ollama pull mistral-small
    ollama pull qwen2.5-coder:14b
    ollama pull qwen2.5-coder:32b
    ollama pull llava

Optional: OpenAI-compatible local gateway + AI SDK (recommended for strict planner JSON)

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-compatible
    • CHAD_OPENAI_BASE_URL: defaults to http://localhost:1234/v1 when CHAD_LLM_PROVIDER is OpenAI-compatible
    • CHAD_OPENAI_NO_AUTH: set true for local gateways that donโ€™t require an API key
    • CHAD_USE_AI_SDK: set false to disable AI SDK and fall back to raw /chat/completions

Installation

# 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 start

CHAD will:

  1. Show the splash screen with loading progress
  2. Start Open WebUI dev server
  3. Initialize the AI cluster and tools
  4. Launch the main window

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚           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)   โ”‚
       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿค– AI Cluster Roles

Planner (mistral-small)

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

Coder (qwen2.5-coder:14b)

Role: Fast implementation for everyday development

Best for:

  • React, TypeScript, Node.js
  • UI components
  • Scripts and utilities
  • Day-to-day coding tasks

Architect (qwen2.5-coder:32b)

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)

Vision (llava)

Role: Visual understanding

Best for:

  • Analyzing screenshots
  • Describing UI layouts
  • Converting mockups to code

๐Ÿ› ๏ธ Tool Framework

CHAD provides explicit, permission-based tools that AIs can request.

Filesystem Tools

// 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'
});

Terminal Tools

// 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'
});

Web Tools

// 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'
});

Creating Custom Tools

See docs/TOOL_DEVELOPMENT.md for a guide on creating custom tools.

๐Ÿ’ฌ Using CHAD

From Open WebUI

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();

Tool Approval Flow

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
  });
});

๐Ÿ“š Documentation

๐Ÿ”ง Development

# Build TypeScript
npm run build

# Watch mode
npm run watch

# Start CHAD
npm start

# Package for distribution
npm run package

๐ŸŽจ Customization

Adding New Models

Edit src/ai/cluster.ts:

this.models.set("newModel", {
  name: "newModel",
  role: "Description",
  model: "ollama-model-name",
  responsibilities: [...]
});

Adding New Tools

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.

๐Ÿ›ก๏ธ Security

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

๐Ÿ”ฎ Future Plans

  • Hardware automation tools
  • Additional API integrations
  • Custom subagent creation
  • Model swapping UI
  • Enhanced task monitoring
  • Tool analytics and history

๐Ÿค Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

๐Ÿ“„ License

MIT License - see LICENSE for details.

๐Ÿ™ Acknowledgments

  • 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.

About

Coding editor and LLM

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors