# Running the Aurora Demo CLI

This guide explains how to run the aurora-demo CLI to test the semantic search engine on the aurora-semantic codebase itself.

## Prerequisites

1. **Rust toolchain** - Install from https://rustup.rs
2. **ONNX Model** - Place a compatible embedding model in `E:\aurora-semantic-model\MODEL-SMALL-JINA/`

## Model Setup

The demo expects a model directory at `E:\aurora-semantic-model\MODEL-SMALL-JINA/` containing:

```
E:\aurora-semantic-model\MODEL-SMALL-JINA/
├── model.onnx                    # or model-w-mean-pooling.onnx
├── tokenizer.json                # HuggingFace tokenizer
└── config.json                   # (optional) model config
```

Recommended model: **jina-embeddings-v2-base-code** (optimized for code search)

## Building

From the project root:

```bash
cargo build --release --bin aurora-demo
```

The binary will be created at:
- Windows: `target/release/aurora-demo.exe`
- Linux/Mac: `target/release/aurora-demo`

## Running the Demo

```bash
# Windows
.\target\release\aurora-demo.exe

# Linux/Mac
./target/release/aurora-demo
```

Or run directly with cargo:

```bash
cargo run --release --bin aurora-demo
```

## What the Demo Does

1. **Loads the ONNX model** from `E:\aurora-semantic-model\MODEL-SMALL-JINA/`
2. **Indexes the source code** in the current directory (the aurora-semantic codebase)
3. **Stores the index** in `E:\INSTAGRAM-KICKBOT-MIXED\QUANTUM-GRAM-APP-FINAL/`
4. **Starts interactive search mode** where you can query the codebase

## Interactive Search Commands

Once running, you'll see a `search>` prompt:

| Command | Description |
|---------|-------------|
| `<query>` | Search using hybrid mode (lexical + semantic) |
| `l:<query>` | Lexical search only (keyword matching) |
| `s:<query>` | Semantic search only (embedding similarity) |
| `h:<query>` | Hybrid search (explicit) |
| `quit` or `q` | Exit the demo |

## Example Session

```
search> embedding
Found 5 results (Hybrid) in 45.32ms

1. src/embeddings/providers.rs [0.823] Semantic
   Symbol: Function 'embed_batch'
   Lines: 193-279
   fn embed_batch(&self, texts: &[&str]) -> Result<Vec<Vec<f32>>> { ...

2. src/embeddings/mod.rs [0.756] Semantic
   Symbol: Trait 'Embedder'
   Lines: 25-45
   pub trait Embedder: Send + Sync { fn embed(&self, text: &str) -> ...

search> s:vector search
Found 3 results (Semantic) in 23.15ms
...

search> l:tantivy
Found 4 results (Lexical) in 5.21ms
...

search> quit
Goodbye!
```

## Reindexing

The demo stores its index in `E:\INSTAGRAM-KICKBOT-MIXED\QUANTUM-GRAM-APP-FINAL/`. To force reindexing:

```bash
# Windows
rmdir /s /q "E:\INSTAGRAM-KICKBOT-MIXED\QUANTUM-GRAM-APP-FINAL"

# Linux/Mac
rm -rf "E:\INSTAGRAM-KICKBOT-MIXED\QUANTUM-GRAM-APP-FINAL"
```

Then run the demo again.

## Using the Main CLI

For more options, use the full `aurora` CLI:

```bash
# Index with custom model path
cargo run --release --bin aurora -- --model "E:\aurora-semantic-model\MODEL-SMALL-JINA" index .

# Search
cargo run --release --bin aurora -- --model "E:\aurora-semantic-model\MODEL-SMALL-JINA" search "embedding"

# List indexed workspaces
cargo run --release --bin aurora -- list

# Show stats
cargo run --release --bin aurora -- stats
```

## Troubleshooting

### Model not found
Ensure `E:\aurora-semantic-model\MODEL-SMALL-JINA/` exists with `tokenizer.json` and an ONNX model file.

### Out of memory
Try reducing the embedding batch size or use a smaller model.

### Slow indexing
The first run generates embeddings for all code chunks. Subsequent runs use the cached index.
