Reduce Plugin

Dimensionality reduction for embedding visualization on the canvas. Projects 384-dim embeddings to 2D via UMAP. See vision/clusters.md for the end-state UX.

Setup

Requires Nix (provides Python 3.13 + umap-learn + numpy + scikit-learn).

make rust-reduce            # build binary to bin/
make rust-reduce-install    # copy to ~/.qntx/plugins/

Enable in am.toml:

[plugin]
enabled = ["reduce"]

Architecture

EmbeddingObserver.OnAttestationCreated
  +-- generates embedding (Rust ONNX)
  +-- predicts cluster (cosine similarity)
  +-- gRPC → reduce plugin /transform  (if fitted)
  +-- writes projection_x, projection_y

POST /api/embeddings/project fits UMAP on all embeddings (batch). New attestations are auto-projected inline via /transform if the model is fitted.

The UMAP model lives in Python process memory. The DimensionReducer trait in ats/embeddings/src/reduce.rs is the contract for a future native Rust backend.

Endpoints

MethodPathDescription
POST/api/embeddings/projectFit UMAP on all embeddings, store 2D projections
GET/api/embeddings/projections[{id, source_id, x, y, cluster_id}] for frontend
GET/api/reduce/status{fitted: bool, n_points: int}

What's Next