derive-agent-count-bug
OUT premise
`_build_beliefs_section` has a bug: `count += len(belief_ids)` is inside the per-belief loop instead of outside it, inflating the count and shrinking the non-agent budget below intended size
Summary
The function that builds the beliefs section for wiki pages has a counting error where it increments a running total inside a loop over individual beliefs rather than once per batch. This means the system thinks more agent-generated beliefs exist than actually do, which causes it to allocate less space than intended for non-agent content on each page.
Dependents
These beliefs depend on this one:
- all-external-inputs-produce-correct-state — Both external input pathways (LLM derivation and multi-agent import) produce a fully correct persisted network state — bounded validation prevents invalid beliefs, namespace isolation prevents cross-contamination, and layered reconciliation handles all truth states — provided the agent count bug is fixed and missing source files are detected.
- all-external-inputs-safely-integrated — Both LLM-derived beliefs and agent-imported beliefs are safely integrated into the network: defensive validation with retraction guards bounds LLM output, while complete reconciliation with dual modes and heterogeneous truth handling manages agent imports.
- belief-currency-is-actively-managed — The system actively manages belief currency bidirectionally: the production-ready derive pipeline safely introduces new beliefs through defensive validation, while the staleness CI gate detects drift in existing beliefs against source material — together preventing both unsafe additions and undetected obsolescence.
- complete-operational-uniformity-across-all-sources — All mutation sources produce fully correct persisted network state — operationally safe, semantically uniform, and consistent across all graph configurations — only when propagation handles dangling dependents without crashing and the derive pipeline's agent-count bug does not skew budget allocation.
- complete-system-is-self-correcting — The system actively maintains its own consistency along two independent dimensions: the TMS core handles exceptional conditions (contradictions trigger deterministic resolution, propagation respects lifecycle state), while belief currency management detects and surfaces drift in source material — no inconsistency persists undetected or unresolved.
- complete-unified-system-is-production-ready — The fully unified minimal-dialectical-scalable system with end-to-end integrity is production-ready — all mutations produce correct state, all revision is reliable, all extensions compose safely — but only when every known fragility and bug is resolved.
- derive-budget-allocation-is-accurate — The derive pipeline's proportional belief-budget allocation produces correct per-agent token counts
- derive-pipeline-is-production-ready — The derive pipeline correctly allocates budgets, validates proposals defensively, and produces well-formed beliefs through a round-trippable prompt contract.
- external-beliefs-are-safe-and-current — External beliefs are managed end-to-end across their complete lifecycle with no gap between ingestion safety and ongoing maintenance: defensively contained at ingestion through layered validation, correctly lifecycle-managed through import reconciliation and staleness checking, and actively tracked for currency — no external belief enters unvalidated, drifts undetected, or persists without lifecycle oversight.
- external-integration-is-architecturally-safe — External beliefs are end-to-end safe within the system's architecture: defensively contained at ingestion and lifecycle-managed thereafter (external belief thread) within the same three-layer boundaries and atomic mutation guarantees that protect internal operations (architecture thread).
- external-integration-preserves-all-invariants — External beliefs are architecturally safe at ingestion and participate in the same invariant-preserving revision system as all other belief origins — architectural containment and revision parity together ensure external integration cannot corrupt system invariants.
- self-correction-is-resource-sustainable — The system's self-correction capability — contradiction resolution at derivation time and staleness detection at maintenance time — is resource-sustainable: accurate bidirectional token budgets support continuous belief derivation and maintenance, ensuring the correction loop can operate indefinitely without resource exhaustion.
- system-achieves-full-correctness — The system achieves correctness at every level: deterministic conservative truth maintenance, a single reversible primitive for all non-monotonic features, and data integrity spanning all architectural layers — the system is sound end-to-end.
- unified-system-is-a-closed-self-maintaining-architecture — The system forms a closed self-maintaining belief architecture: end-to-end integrity ensures no operation corrupts consistency, while revision completeness ensures any valid belief configuration is reachable — together guaranteeing the system can evolve to any target state while preserving all invariants — only when all known defects and fragilities are resolved.
- verified-mutation-correctness-across-boundaries — Every mutation source produces fully correct persisted state that preserves boundary-agnostic integrity — not just safe operation, but verified output correctness across internal/external boundaries and all source types — only when implementation-level defects in propagation and budget allocation are resolved.
Details
| Source | entries/2026/04/23/reasons_lib-derive.md |