xiong4huo/dsh-recursive-best-of-n: Recursive Best-of-N Tree Agent Preset Plugin Introduction

This is a DSH bundle plugin maintained by xiong4huo and published in the community directory SkillHub (Category: Workflow). It introduces a new agent preset, "recursive-best-of-n". The number of agents, parallel width, and recursive depth are all derived from two settings in "Settings → Plugins → Subagent" (Maximum Recursion Depth, Maximum Parallel Quantity), and the plugin does not hardcode any numbers. The plugin automatically calculates the deepest feasible depth and the widest parallel width at that depth based on the inequality $f + f^2 + \dots + f^d \leq \text{limit}$, and writes the depth/fanout conversion and capacity calculation into the runtime context. For each request, the main agent and internal nodes parallelly dispatch $N$ sub-agents within the same assistant message; it waits for submissions one by one and, once all are ready, selects the best ones to submit, with the leaf layer actually executing the tasks. To install, use `dsh plugin --profile desktop add dsh-recursive-best-of-n@1.4.0` or `git+https://github.com/xiong4huo/dsh-recursive-best-of-n.git#v1.4.0` (the Git installation uses `git ls-remote` to check connectivity). Using the Desktop's 40 concurrency limit as an example: Depth 1 yields 40 per layer, Depth 2 yields 5 per layer, Depth 3 yields 3 per layer, and Depth 10 is reduced to 2 per layer for a total of 4 layers due to capacity constraints. The empirical results recorded in the README (Depth 2 / Limit 14) show a fanout of 3, 12 sub-agents, and results in 9–11 seconds. Please note: This preset relies on the Host service of the Web/Desktop profile and is not applicable to the headless/SDK profile; sub-agents cannot see the parent session context, and permissions are fixed at startup; the plugin runs with the current DSH process permissions, so you should check the source code and license before installing.

Read More