# gradatum-worker

> Async queue consumer — processes curator and embedding jobs from the SQLite Apalis queue.

**Status**: Alpha (v0.3.x) — public, Apache-2.0. API not yet stable before v1.0.
Part of **[gradatum](https://crates.io/crates/gradatum)** — memory backbone for AI agents. · [github](https://github.com/gradatum/gradatum) · [gradatum.org](https://gradatum.org)

## Overview

`gradatum-worker` is the async background processor that drains the job queue populated
by `gradatum-server`. It uses Apalis as the job dispatch framework backed by SQLite.

Job types processed in v0.3.x:

| Job type | Description |
|---|---|
| `curate_note` | Runs the `CuratorPipeline` on a queued note (section routing, tags, wikilinks, dedup) |
| `embed_note` | Computes and stores embeddings for a note via the configured `Embedder` backend |
| `drift_check` | Periodic Phase A drift scan (size → prefix-4KB → full SHA-256) |
| `index_rebuild` | Full index rebuild for a vault |
| `purge_expired_revocations` | Cleans up expired JWT revocation records |

The worker uses `BEGIN IMMEDIATE` transactions for atomic job dequeue — preventing the
read-then-write deadlock that occurs under concurrency with `BEGIN DEFERRED`.

## Usage

```bash
gradatum-worker --config /etc/gradatum/server.toml
```

## Configuration (TOML, shared with gradatum-server)

```toml
[worker]
concurrency = 4
lease_timeout_ms = 300000
```

## License

Apache-2.0
