# MailSubsystem Core Quick Start

Get the Core binary built, point it at a sandbox mailbox, and run a dry-run filing pass.

## Requirements

- Rust 1.70+
- PostgreSQL 12+
- pgvector for semantic search and embedding-backed RAG
- An IMAP account
- At least one model provider configuration

## Build

```bash
git clone https://github.com/iamcobolt/MailSubsystem.git
cd MailSubsystem
cargo build --release
```

## Database

```bash
createdb mailsubsystem
psql -U mailsubsystem -d mailsubsystem -f schema.sql
```

## Environment

```bash
cp .env.example .env
# Edit .env: ICLOUD_IMAP_*, DATABASE_URL, and at least one AI API key
```

Despite the `ICLOUD_*` variable names, the IMAP layer targets any IMAP-accessible mailbox.

## Verify

```bash
./target/release/mailsubsystem check
./target/release/mailsubsystem test-llm --frontier
./target/release/mailsubsystem test-llm --local
```

## First Run

```bash
./target/release/mailsubsystem sync
./target/release/mailsubsystem analyze
./target/release/mailsubsystem locate
./target/release/mailsubsystem file --dry-run
./target/release/mailsubsystem file
```

Always run `file --dry-run` before applying moves against a real mailbox.

## Daemon

```bash
./target/release/mailsubsystem daemon
```

The daemon currently handles ongoing sync. Run analyze, locate, and file manually until pipeline automation lands.

