# iknowyou-engine

`iknowyou-engine` moves personalization state into embedded `tidalDB` and keeps Synap optional for auxiliary observation memory.

## What this crate covers

- User/item state and ranking signals in `tidalDB`
- Session lifecycle and session-scoped signals (`start_session` / `session_signal` / `close_session`)
- Hard negatives (`hide`, `mute`, `block`) written as durable relationships for replay-safe filtering
- PG1 evaluator (`run_pg1_eval`) for:
  - hard-negative leak rate
  - adaptation latency p95
  - useful-item uplift vs baseline
  - repeated-unwanted-item rate

## Run the PG1 evaluator

```bash
cargo run -p iknowyou-engine --bin pg1_eval
```

Optional persistent path:

```bash
cargo run -p iknowyou-engine --bin pg1_eval /tmp/iknowyou-pg1
```

## Run the HTTP server

```bash
cargo run -p iknowyou-engine --bin server --features synap-aux
```

Server defaults:

- bind: `127.0.0.1:7777`
- data dir: `${TMPDIR}/iknowyou_engine_data`

Override with:

- `IKY_ENGINE_BIND`
- `IKY_ENGINE_DATA_DIR`

## Optional Synap auxiliary memory

Enable `synap-aux` to use `SynapAuxMemory` for observation storage while keeping core personalization in `tidalDB`.

```bash
cargo test -p iknowyou-engine --features synap-aux
```
