derive-budget-count-is-linear
IN premise
Agent belief counting in `_build_beliefs_section` accumulates as N (number of beliefs shown per agent), not N² — the corrected behavior after the issue #23 fix where `count += len(belief_ids)` was moved outside the per-belief loop
Summary
The code that counts how many beliefs each agent has displayed works in straightforward linear time, adding up the count once per batch rather than once per individual item inside a nested loop. This matters because the old quadratic behavior before the fix could have caused incorrect budget tracking, potentially showing too many or too few beliefs per agent in the output.
Dependents
These beliefs depend on this one:
- derive-budget-is-efficient-and-floor-bounded — The derive pipeline's per-agent budget allocation is both computationally efficient (O(N) linear accumulation, not quadratic) and representation-safe (each agent and local group guaranteed at least 5 belief slots), ensuring proportional allocation never starves minority agents.
Details
| Source | entries/2026/04/29/tests-test_derive_budget.md |