Jump to the manifest
hierarchical-cluster-search.namespace.yaml: apply it with one API call, then read the walkthrough below to change it.At a glance
How the pieces connect
Buckets hold what you upload, collections turn it into searchable documents, and retrievers answer queries over the collections.Deploy it
1
Get the manifest
2
Validate it
Validate runs every check apply runs and creates nothing. Fix each entry in
errors, then run it again.3
Apply it
Apply creates every resource in one call. The response lists each resource with its outcome in
wait_for_seed=true also waits until the sample objects are processed, so the first query below has documents to return.resources. Apply refuses a resource that already exists and rolls the whole apply back, so to apply the file again over this namespace add ?mode=create_missing, which creates only what is missing.Run the first query
Look up the namespace id by name, then runcontent-search. Check status and warnings along with documents: a run that times out still answers 200, with status degraded.
Add your own data
Each object you add to a bucket is processed by every collection that reads it. This adds one object tocontent. NAMESPACE_ID is the id from the namespace lookup above.
PENDING until processing finishes, then COMPLETED or FAILED. Buckets and objects covers object states, retries and duplicates.
Retrievers
content-search
Plain vector search over content-text. Answers as soon as the seed is indexed.
Stages: feature_search
Searches: content-text
browse-content-tree
Walks the content-tree clusters top-down with Jev and returns members of the best leaf cluster. Answers after the cluster has run once.
Stages: agent_search
Searches: content-tree
Collections
Each collection runs one extractor over a bucket, or over another collection’s documents.content-text
content-text
text_extractor@v1 over bucket content. Feeds content-search and the content-tree cluster.Reads bucket
content with text_extractor v1.Inputs: text ← contentCopied onto each document: headlineAlso created
Clusterscontent-tree: Groups content-text by meaning and labels every cluster from a fixed vocabulary, so a retriever can walk the groups top-down.
The manifest
Every resource above comes from this file. Change it and apply it again with?mode=upsert to update what exists. Manifests documents each field.
hierarchical-cluster-search.namespace.yaml
Hand it to an agent
Paste this prompt into Claude Code, Cursor or another coding agent. To give the agent this whole page instead, use Copy page in the menu at the top of the page, or point it at the page’s Markdown athttps://mixpeek.com/docs/templates/hierarchical-cluster-search.md.
Prompt
How it works
Hierarchical search first picks the part of the corpus most likely to hold the answer, then returns documents from inside it. This template builds it beside plain vector search over the same data.content-textembeds each object’scontentwithtext_extractorinto themultilingual_e5_large_instruct_v1feature.content-searchsearches that feature directly.- The
content-treecluster groups those vectors with k-means. Jev then labels every cluster by picking one name fromcandidate_labels, and stores the pick’s probability aslabel_confidence. - A cluster run writes the
content-treeoutput collection: one centroid document per cluster (is_centroid,cluster_id,label,parent_cluster_id) plus a copy of every member document with its source’s vector. browse-content-treeruns anagent_searchstage with thecluster_navigationstrategy over that collection. It builds the tree fromparent_cluster_idand asks Jev at each level which child cluster most likely answers the query.
browse-content-tree returns no documents until the first run.
Run the cluster
1
Start a run
Look up the cluster id by name, then execute it. The call returns a task.
cURL
2
Wait for it to finish
Poll the task until
status is COMPLETED, COMPLETED_WITH_ERRORS, FAILED or CANCELED.cURL
3
Walk the tree
Run
browse-content-tree with the same query you gave content-search.cURL
Read the path Jev took
The stage records its walk understage_statistics.stages.browse.metadata:
Each returned document carries
cluster_path and cluster_path_score. A path’s score is the geometric mean of its decision probabilities, so a shallow leaf and a deep leaf compare fairly.
If error says no centroid documents were found, the cluster has not completed a run yet.
Why these settings
n_clusters: 3matches the seed: twelve scripts in three themes (sports, cooking, ads).hierarchical: truewithmax_hierarchy_depth: 2asks for sub-clusters under each top-level cluster. A cluster splits only when it holds at least twicemin_cluster_sizemembers. k-means takes nomin_cluster_size, so the default of 50 applies, and the twelve seed documents give a one-level tree.provider: typesafeandmodel_name: jev-latestlabel each cluster by choosing fromcandidate_labels. Jev reads text only, solabeling_inputsmaps the document’stextfield. Jev needs 2 to 255 labels; sub-clusters are labeled from the same list, so list names for every level.beam_width: 2keeps two paths per level.1is greedy descent. A wider beam lets a later level correct an ambiguous early choice.max_leaf_clusters: 1returns members of the best leaf only. Raise it when a query can span topics.timeout_seconds: 20keeps the stage under the executor’s 25-second stage ceiling.
Variations
Each change below edits the manifest. Apply it again with?mode=upsert, then run the cluster again.
Get a second level
HDBSCAN acceptsmin_cluster_size, so it controls when a cluster splits. With min_cluster_size: 5, a cluster with 10 or more members splits again. HDBSCAN picks the number of clusters itself and marks outliers as noise, so it suits a few hundred documents or more.
content-tree vector_config
Describe each label
candidate_labels also takes a map of label to a one-line description. Jev reads the description with the label, which helps when two names are close.
content-tree llm_labeling
Let a generative model name the clusters
Withoutcandidate_labels, a generative model writes a label and a summary for each cluster. The walk shows the summary to Jev as the option’s description, which helps routing.
content-tree llm_labeling
Search first, then keep hits in the chosen clusters
The member copies incontent-tree carry their source vectors, so a feature_search stage can run before the walk. agent_search then keeps the documents inside the chosen clusters, in search order, and drops centroids.
browse-content-tree stages

