Ask the AI to propose a partition of the current leaves, or to converge
Source:R/theme_algorithm_v2.R
ai_propose_clustering.RdOne AI call per pass. The AI sees ALL current leaves at once (full picture, no chunking). For pass 1, leaves are codes. For pass 2+, leaves are clusters from the prior pass, each rendered with its member codes visible so the AI can reason about content, not just cluster IDs.
Usage
ai_propose_clustering(
leaves,
pass_index,
prior_history,
codes,
provider,
research_focus = "",
concept_str = "",
reference_text = "",
reflexivity_block = "",
audit_log = NULL,
response_cache = NULL,
methodology_override = NULL,
walk_state = NULL
)Details
The AI returns either a partition of the leaves into new clusters or
verdict='converged'. The schema (.clustering_schema()) forbids
name/description fields during clustering – labeling is a separate pass
(per C-tenet 5).
Returns the parsed proposal record:
verdict: "continue" or "converged"cluster_assignments: list of clusters (NULL if converged)overall_rationale: AI's top-level explanation
Records the call in walk_state and the audit log.