areev 0.0.0

Rust SDK for the Areev knowledge database — gRPC and HTTP transports
Documentation
# Areev Rust SDK

Rust client library for the [Areev](https://areev.ai) knowledge database.

## Installation

```toml
[dependencies]
areev = "0.1"
```

For gRPC transport:
```toml
[dependencies]
areev = { version = "0.1", features = ["grpc"] }
```

## Quick Start

```rust
use areev::Areev;

#[tokio::main]
async fn main() -> areev::Result<()> {
    let areev = Areev::from_env(); // reads AREEV_API_KEY, AREEV_URL from env

    areev.remember("John likes coffee").await?;

    let results = areev.recall("what does John like?").await?;
    for hit in &results.results {
        println!("{}: {:?}", hit.grain_type, hit.fields);
    }

    Ok(())
}
```

### Configuration

The client reads from environment variables by default:

| Variable | Default | Description |
|----------|---------|-------------|
| `AREEV_API_KEY` | — | API key (`X-API-Key` header) |
| `AREEV_URL` | `https://app.areev.ai` | Server endpoint |
| `AREEV_MEMORY_ID` | `default` | Memory database ID |

Or pass them explicitly:

```rust
let areev = Areev::new(
    Some("ar_..."),                // api_key
    Some("https://dub.areev.ai"), // url
    Some("my-memory"),            // memory_id
);
```

## API

| Method | Description |
|--------|-------------|
| `remember(text)` | Store natural-language memory (LLM extracts structure) |
| `recall(query)` | Search memories |
| `forget(hash)` | Delete a memory by hash |
| `add(req)` | Add a typed grain (low-level) |
| `get(hash)` | Get a grain by hash |
| `supersede(req)` | Update a grain |
| `health()` | Health check |
| `stats()` | Database statistics |
| `flush()` | Flush write buffer |

### Low-Level Client

For advanced use cases (custom request objects, gRPC transport):

```rust
use areev::{HttpClient, AddRequest, GrainType};

let client = HttpClient::new("http://localhost:4009", "default", Some("api-key"));
let resp = client.add(&AddRequest {
    grain_type: GrainType::Belief,
    fields: serde_json::json!({"subject": "john", "relation": "likes", "object": "coffee"}),
    options: None,
}).await?;
```

## Transports

| Transport | Feature | Default |
|-----------|---------|---------|
| HTTP/REST | `http` | Yes |
| gRPC | `grpc` | No |

## License

BUSL-1.1