compact
26 beliefs (21 IN, 5 OUT)
-
OUT
compact-budget-controls-output-size
The compact module's token budget reliably constrains total output size -
OUT
compact-budget-guarantee
`compact()` output estimated token count never exceeds the `budget` parameter; every line is gated by `_over_budget` before appending. -
IN
compact-budget-is-soft-cap
The compact token budget is approximate; structural overhead (section headers, truncation messages) can cause up to ~25% overshoot beyond the specified budget. -
OUT
compact-budget-only-limits-in-nodes
The token budget only constrains the IN nodes section; nogoods and OUT nodes are always emitted regardless of budget, so compact output can exceed the specified budget value. -
IN
compact-budget-soft-ceiling
The `compact` function treats the token budget as approximate; structural overhead (headers, truncation messages) can cause output to exceed the budget by up to ~25%. -
IN
compact-budget-tracking-is-efficient-and-approximate
The compact module tracks token budgets efficiently through an approximate but computationally fast strategy: O(1) per-line budget checks via a running character count, with token estimation based on chars/4 — a lightweight approximation avoiding external tokenizer dependencies while maintaining accuracy sufficient for budget enforcement. -
IN
compact-char-tracking-o1
Budget tracking uses a running `_char_count` integer, making per-line budget checks O(1) instead of O(n). -
IN
compact-estimate-tokens-chars-div-4
`estimate_tokens` uses `len(text) // 4` with a floor of 1, not word count or any external tokenizer. -
IN
compact-footer-pre-reserved
The footer line's token cost is pre-computed and reserved before any section starts filling, guaranteeing it always fits within the budget. -
IN
compact-in-nodes-ordered-by-dependents
IN nodes are sorted by descending dependent count so structurally important nodes (those depended on by many others) are emitted first and survive budget truncation. -
IN
compact-is-infallible
`compact()` handles empty networks, zero-budget, and missing metadata without raising exceptions — designed to always produce a valid string. -
OUT
compact-is-predictable-bounded-distillation
The compact module is a fully predictable information distillation: a pure function with deterministic priority ordering that reliably constrains output within token budgets, self-reports resource usage, and structurally important nodes are prioritized through dependent-count sorting -
IN
compact-is-pure-function
`compact()` performs no I/O, no database access, no mutations, and no side effects; it is a pure transformation from `Network` to `str`. -
IN
compact-never-exceeds-budget
`compact()` guarantees the returned string's estimated token count (chars/4) does not exceed the `budget` parameter, enforced by pre-checking every line addition against remaining space. -
IN
compact-priority-order
Sections are emitted in fixed order: nogoods, OUT nodes, IN nodes; a later section never displaces content from an earlier one. -
IN
compact-priority-order-is-nogoods-out-in
Sections are emitted in strict priority order: nogoods first, then OUT nodes, then IN nodes; if the budget is exhausted early, lower-priority sections are entirely omitted. -
IN
compact-pure-function
`compact()` has no side effects, performs no I/O, and does not mutate the `Network` instance. -
IN
compact-sorts-by-dependents
Duplicate of existing `compact-in-nodes-ordered-by-dependents`. -
IN
compact-sorts-in-nodes-by-dependents-descending
Duplicates existing belief `compact-in-nodes-ordered-by-dependents`. -
IN
compact-structure-is-priority-ordered-and-infallible
The compact module produces output with deterministic priority-ordered sections (nogoods, OUT, IN) and handles all edge cases (empty networks, zero budget, missing metadata) without raising exceptions, with footer space pre-reserved before section filling begins. -
IN
compact-summary-hiding-requires-in
A summary node only hides its covered nodes when the summary itself is IN; if the summary goes OUT, covered nodes reappear in the compact output. -
IN
compact-summary-nodes-hide-covered
IN nodes whose IDs appear in another node's `summarizes` metadata list are excluded from compact output to avoid redundancy; the hidden count is reported. -
IN
compact-surfaces-stale-reason-metadata
OUT nodes with `stale_reason` in their metadata include the reason string in the compact output. -
IN
compact-three-sections
The `compact` output is organized into three markdown sections: `## IN (active)`, `## OUT (retracted)`, and `## Nogoods`, each present only when the network contains nodes of that type. -
OUT
compact-token-estimate-is-word-count
`estimate_tokens` counts whitespace-separated words, not BPE tokens; the budget parameter throughout the compact module is measured in this unit. -
IN
pg-compact-generates-budget-constrained-markdown
`PgApi.compact()` produces a markdown summary of the belief network constrained by a token budget, filtered by `visible_to` access tags, sorted by dependent count, with summary-node elision and nogood inclusion