# `.ixd.toml` Configuration Reference

**Introduced:** v0.9.0
**Purpose:** Scope what the daemon watches and what both the daemon and CLI index.

## Discovery

Both the CLI (`ix --build`) and the daemon (`ixd`) load `.ixd.toml` at startup.

The daemon looks for `.ixd.toml` files at startup:

1. At the watch root (e.g., `/home/ubuntu/.ixd.toml`)
2. One level deep in subdirectories (e.g., `/home/ubuntu/project-a/.ixd.toml`)

Multiple files are merged: root-level config applies globally; subdirectory
configs add `watch_roots` and `exclude_patterns`.

## Schema

```toml
# .ixd.toml

# Directories within the watch root to index (optional).
# When empty, the daemon indexes the entire root recursively.
watch_roots = [
    "src",
    "tests",
]

# Directory names to exclude from indexing.
# Defaults shown below — add or override as needed.
exclude_patterns = [
    ".git",
    "node_modules",
    "target",
]
```

## Fields

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `watch_roots` | `[String]` | `[]` | Subdirectories to scope indexing to. Empty = entire root. |
| `exclude_patterns` | `[String]` | `.git`, `node_modules`, `target` | Directory names skipped during file walk. |

## Examples

**Scope to specific directories:**
```toml
watch_roots = ["src", "lib", "include"]
```

Only `src/`, `lib/`, and `include/` will be indexed. All other directories
under the watch root are ignored.

**Add custom exclusions:**
```toml
exclude_patterns = [".git", "node_modules", "target", "vendor", "build"]
```

The `vendor/` and `build/` directories are skipped in addition to the
built-in excludes (`.ix/`, `.git/`, `lost+found/`, binary file extensions).

**Per-project scoping with multi-root daemon:**
```bash
# /home/ubuntu/.ixd.toml — global excludes only
# /home/ubuntu/project-a/.ixd.toml — watch src/ and lib/
# /home/ubuntu/project-b/.ixd.toml — watch app/ only

ixd /home/ubuntu
```

The daemon discovers all three config files. Project A indexes only its
`src/` and `lib/`. Project B indexes only its `app/`. Global excludes
apply everywhere.

## CLI Usage

The CLI reads `.ixd.toml` for `exclude_patterns` when building an index (`--build`):

```bash
# Build respects .ixd.toml exclude_patterns
ix --build /path/to/repo
```

## Verification

```bash
# Start daemon with verbose output to see config loading
ixd /path/to/root 2>&1 | grep "loaded config"

# Expected:
# ixd [project-name]: loaded config — 1 exclude patterns, 2 watch roots
```

## See Also

- [docs/DAEMON-RUNBOOK.md](DAEMON-RUNBOOK.md) — Operating the daemon
- [docs/QUICKSTART.md](QUICKSTART.md) — Getting started
