Root — GEMINI.md

Module: root-gemini-md Cohesion: 0.80 Members: 0

Root — GEMINI.md

This document provides an overview of the Code Buddy project, serving as the primary entry point for understanding its architecture, core components, and development guidelines. It synthesizes the information presented in the project's root GEMINI.md file, which acts as the foundational documentation for the entire system.

1. Project Overview

Code Buddy (@phuetz/code-buddy) is an open-source, multi-provider AI coding agent designed for the terminal. It functions as a versatile development tool and personal assistant, capable of generating code, executing commands, and communicating across various channels.

1.1. Heritage and Architectural Influences

Code Buddy is a modern, TypeScript-native evolution of the Native Engine architecture. It inherits key features such as robust concurrency control (Lane Queue), security policies, multi-channel messaging, and a self-authoring SKILL.md system.

It further integrates concepts from Open Manus / Manus AI, including:

1.2. Supported AI Providers

The system supports a wide range of AI providers, including:

2. Tech Stack

Code Buddy is built on a modern TypeScript and Node.js foundation:

3. Architecture

The project employs a Facade Architecture to manage complexity and promotes a modular design for extensibility.

3.1. Core Components and Facades

The CodeBuddyAgent (src/agent/codebuddy-agent.ts) serves as the central orchestrator, managing the conversation loop, tool execution, and interactions with AI providers. It leverages several facades to delegate and encapsulate specific functionalities:

graph TD
    A[CodeBuddyAgent] --> B(AgentContextFacade)
    A --> C(SessionFacade)
    A --> D(ModelRoutingFacade)
    A --> E(InfrastructureFacade)

    subgraph Facades
        B(AgentContextFacade)
        C(SessionFacade)
        D(ModelRoutingFacade)
        E(InfrastructureFacade)
    end

3.2. Autonomy Layer

This layer provides advanced capabilities for agent self-management and complex task execution:

3.3. Context Engineering Layer

This layer implements sophisticated patterns for optimizing LLM context, managing information flow, and enhancing security:

3.4. Other Top-Level Components

4. Key Directories and Modules

The project's codebase is organized into logical directories, each encapsulating specific functionalities:

5. Setup & Development

5.1. Installation

npm install
# or
bun install

5.2. Running in Development

# Run with Bun (fastest)
npm run dev

# Run with Node (tsx)
npm run dev:node

# Run specific command
npm run dev -- --help

5.3. Building

npm run build

5.4. Testing

# Run all tests
npm test

# Run tests in watch mode
npm run test:watch

# Run tests with coverage
npm run test:coverage

5.5. Linting & Formatting

# Lint code
npm run lint

# Fix linting issues
npm run lint:fix

# Check formatting
npm run format:check

# Fix formatting
npm run format

6. Conventions

Adhering to these conventions ensures code quality, maintainability, and consistency:

7. Configuration

Key configuration files and directories:


Note on Call Graph & Execution Flows: As GEMINI.md is a documentation file, it does not contain executable code and therefore has no direct internal calls, outgoing calls, incoming calls, or execution flows. The information within this document describes the architectural patterns and execution flows of the actual Code Buddy codebase.