cluster
Detect communities of related documents via Louvain modularity on typed-edge graphs. Use a query or seed document IDs to obtain clusters with members and summary statistics.
Instructions
Community detection over the typed-edge graph via Louvain modularity (Blondel et al. 2008) using graphology + graphology-communities-louvain. Deterministic: same input produces byte-identical cluster_id assignment via DocId-sorted node insertion + seeded RNG (vault-memory-cluster-v1). cluster_id = smallest member DocId per community. Hard-capped at 5000 nodes; pass force: true to override. Either query (composes search_hybrid + expand 1-hop) OR seed_doc_ids (uses provided seeds + induced 1-hop neighborhood); not both — passing both returns {ok:false, reason:'both_seeds_and_query'}. On the query path with multiple vaults configured, the vault field is required so search scope is deterministic; single-vault setups may omit it (returns {ok:false, reason:'vault_required'} otherwise). Returns per-cluster {cluster_id, size, members[], summary: {top_types, top_titles, edge_density}}. No LLM enrichment — summary fields are pure-deterministic computations (LLM enrichment is Phase 5 brief layer's job). _memory opacity inherited from expand() (Plan 04-03).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | No | ||
| seed_doc_ids | No | ||
| vault | No | ||
| method | Yes | ||
| query_top_k | No | ||
| force | No |