---
title: CLI Reference | CodeWeaver Docs
description: Complete command-line interface reference for CodeWeaver
url: "https://docs.knitli.com/cli"
type: static
generatedAt: "2026-04-17T17:21:09.909Z"
---

# CLI Reference
       [Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fcli%2F.%20I%20want%20to%20ask%20questions%20about%20it.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fcli%2F.%20I%20want%20to%20ask%20questions%20about%20it.)[View in Markdown](/codeweaver/cli.md)       [Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fcli%2F)[Share on X](https://x.com/intent/tweet?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fcli%2F&text=CLI%20Reference)[Share on Threads](https://threads.net/intent/post?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fcli%2F&text=CLI%20Reference)[Share on Bluesky](https://bsky.app/intent/compose?text=CLI%20Reference%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fcli%2F)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fcli%2F)[Share on Reddit](https://reddit.com/submit?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fcli%2F&title=CLI%20Reference)[Share on Hacker News](https://news.ycombinator.com/submitlink?u=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fcli%2F&t=CLI%20Reference)[Share on Email](mailto:?subject=CLI%20Reference&body=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fcli%2F)[Share on WhatsApp](https://wa.me/?text=CLI%20Reference%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fcli%2F)[Share on Telegram](https://t.me/share/url?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fcli%2F&text=CLI%20Reference)
# CodeWeaver CLI Reference
[Section titled “CodeWeaver CLI Reference”](#codeweaver-cli-reference)
The `cw` command (alias for `codeweaver`) is your primary interface for managing CodeWeaver. It provides tools for initialization, indexing, searching, and diagnostics.

Note

CodeWeaver includes `cw doctor` for deep diagnostics and `cw init --profile` for rapid setup.

## Core Workflow
[Section titled “Core Workflow”](#core-workflow)

*Terminal window*

```
# 1. Initialize with a profilecw init --profile recommended
# 2. Start the background daemoncw start
# 3. Search your codebasecw search "authentication middleware"
```

---

## Main Commands
[Section titled “Main Commands”](#main-commands)
### `cw init`
[Section titled “cw init”](#cw-init)
Initialize your CodeWeaver configuration.

**Usage:**


*Terminal window*

```
cw init [OPTIONS]
```

**Options:**

 - `--profile [recommended|quickstart|testing]` - Choose a premade provider profile.
 - `--force` - Overwrite existing configuration.

**Example:**


*Terminal window*

```
cw init --profile recommended
```

---

### `cw doctor`
[Section titled “cw doctor”](#cw-doctor)
Check system configuration and diagnose issues. This is the first command you should run if something isn’t working.

**Usage:**


*Terminal window*

```
cw doctor
```

**What it checks:**

 - **Provider Connectivity:** Verifies API keys and cloud service reachability.
 - **Index Health:** Checks for corrupted or outdated search indexes.
 - **DI Container:** Validates that all required services are correctly registered.
 - **Environment:** Checks Python version, project paths, and disk space.

---

### `cw search`
[Section titled “cw search”](#cw-search)
Search indexed repositories using hybrid (Semantic + AST + Keyword) search.

**Usage:**


*Terminal window*

```
cw search QUERY [OPTIONS]
```

**Arguments:**

 - `QUERY` - Your natural language search query.

**Options:**

 - `--repo PATH` - Repository to search (default: current directory).
 - `--limit N` - Maximum number of results.
 - `--context-lines N` - Lines of context around each match.

---

### `cw start` / `cw stop`
[Section titled “cw start / cw stop”](#cw-start--cw-stop)
Manage the CodeWeaver background daemon.

**Usage:**


*Terminal window*

```
cw start [OPTIONS]cw stop
```

**Options:**

 - `--foreground` - Run in the current terminal instead of the background.
 - `--project PATH` - Start services for a specific project.

---

### `cw status`
[Section titled “cw status”](#cw-status)
Show the status of the current project, including indexing progress and active providers.

**Usage:**


*Terminal window*

```
cw status
```

---

## Configuration
[Section titled “Configuration”](#configuration)
CodeWeaver uses `codeweaver.toml` as its primary configuration format.

### File Locations (Priority Order)
[Section titled “File Locations (Priority Order)”](#file-locations-priority-order)
 1. **Project Root:** `./codeweaver.toml`
 1. **User Config:** `~/.config/codeweaver/config.toml`
 1. **Environment:** `CODEWEAVER_CONFIG_FILE`

### Environment Variables
[Section titled “Environment Variables”](#environment-variables)
 - `CODEWEAVER_PROJECT_PATH` - Override the current project path.
 - `VOYAGE_API_KEY` - API key for Voyage AI.
 - `ANTHROPIC_API_KEY` - API key for the Context Agent.

---

## Exit Codes
[Section titled “Exit Codes”](#exit-codes)
 - `0` - Success.
 - `1` - General error.
 - `2` - Configuration/Validation error.
 - `3` - Index/Storage error.
 - `4` - Provider/API error.