> For the complete documentation index, see [llms.txt](https://docs.cyne.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cyne.ai/guides/development-environment.md).

# Development Environment

This guide provides detailed instructions for setting up and working with Cyne AI in a local development environment.

### **Prerequisites**

Ensure the following are installed:

#### **Required**

* Node.js 23+
* pnpm
* Git

#### **Optional (Recommended)**

* VS Code for development
* Docker for database management
* CUDA Toolkit for GPU acceleration

***

### **Initial Setup**

#### **1. Repository Setup**

Clone the **Cyne AI** repository and install dependencies:

```bash
# Clone the repository
git clone https://github.com/cyne-ai/cyne
cd cyne

# Install dependencies
pnpm install
```

***

#### **2. Environment Configuration**

Set up your development environment:

```bash
cp .env.example .env
```

Update essential variables in `.env`:

```env
OPENAI_API_KEY=sk-your-openai-key       # Optional for OpenAI integration
SOLANA_RPC_URL=https://api.mainnet-beta.solana.com  # Solana RPC endpoint
SOLANA_NETWORK=mainnet-beta             # Solana network
```

***

#### **3. Local Model Setup**

For local inference without external APIs:

```bash
# Install CUDA support for NVIDIA GPUs
npx --no node-llama-cpp source download --gpu cuda

# Models will download automatically from Hugging Face on the first run
```

***

### **Development Workflow**

#### **Running the Development Server**

Start the development server with specific characters or configurations:

```bash
# Start with the default character
pnpm run dev

# Start with a specific character
pnpm run dev --characters="characters/my-character.json"

# Start with multiple characters
pnpm run dev --characters="characters/char1.json,characters/char2.json"
```

***

#### **Useful Development Commands**

* `pnpm run build`: Build the project.
* `pnpm run clean`: Clean build artifacts.
* `pnpm run dev`: Start the development server.
* `pnpm run test`: Run all tests.
* `pnpm run lint`: Lint the codebase.

***

### **Database Development**

#### **SQLite (Recommended for Development)**

For development, use SQLite:

```typescript
import { SqliteDatabaseAdapter } from "@cyneai/core/adapters";
import Database from "better-sqlite3";

const db = new SqliteDatabaseAdapter(new Database("./dev.db"));
```

***

#### **In-Memory Database (For Testing)**

Use an in-memory database for testing:

```typescript
import { SqlJsDatabaseAdapter } from "@cyneai/core/adapters";

const db = new SqlJsDatabaseAdapter(new Database(":memory:"));
```

***

### **Testing**

#### **Running Tests**

```bash
# Run all tests
pnpm run test

# Run tests with coverage
pnpm run test:coverage
```

***

#### **Writing Tests**

Use the provided utilities for testing:

```typescript
import { runAiTest } from "@cyneai/core/test_resources";

describe("Feature Test", () => {
    it("should respond correctly", async () => {
        const result = await runAiTest({
            messages: [{ user: "user1", content: { text: "test input" } }],
            expected: "expected output",
        });
        expect(result.success).toBe(true);
    });
});
```

***

### **Plugin Development**

#### **Creating a New Plugin**

Plugins can extend **Cyne AI**’s capabilities:

```typescript
// plugins/my-plugin/src/index.ts
import { Plugin } from "@cyneai/core/types";

export const myPlugin: Plugin = {
    name: "my-plugin",
    description: "Custom plugin for Cyne AI",
    actions: [],
    providers: [],
};
```

***

### **Debugging**

#### **VS Code Configuration**

Set up a debug configuration for **Cyne AI**:

```json
{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Debug Cyne AI",
            "skipFiles": ["<node_internals>/**"],
            "program": "${workspaceFolder}/src/index.ts",
            "runtimeArgs": ["-r", "ts-node/register"],
            "env": {
                "DEBUG": "cyne:*"
            }
        }
    ]
}
```

***

This guide ensures that your **Cyne AI** development environment is set up efficiently and provides the tools needed for productive local development. Let me know if you need additional sections or customization!
