Skip to content

Clustering runs in a spawned subprocess on an encrypted payload

The default strategy (RecursiveKMeansStrategy in app/core/analyzer_strategies.py) vectorises text with TF-IDF, or ONNX sentence embeddings when a model is present, and clusters with MiniBatchKMeans, recursing until MAX_DEPTH (default 5). It runs in a multiprocessing "spawn" child that receives the documents as an encrypted payload. We chose MiniBatchKMeans over topic models such as NMF or LDA because it clusters large folders quickly with bounded memory and needs no topic count tuning beyond max_folders, and we isolate it in a spawned process so a native-library crash or memory blow-up in scikit-learn/ONNX cannot take down the TUI or the daemon, and so plaintext never crosses the process boundary.

Considered options

  • NMF topic modelling. Earlier versions of the docs described it; the code no longer uses it.
  • Running in a thread. Rejected: a crash or memory spike in native code would kill the host process.