Skip to content

planHouseRulesInjection

planHouseRulesInjection(rules, budgetChars, now?, targetPaths?): HouseRulesPlan

Defined in: src/house-rules.ts:198

Plan which house rules inject under the char budget, scoped to the session’s target files (#842). Rules split three ways: Always-rules (no globs), matched-scoped (globs hit a targetPaths entry), and scope-gated (globs, no match → scoped, never injected and never counted against budget). Budget precedence is two-pass: Always-rules are packed first (guaranteed the budget), then matched-scoped fill the remainder — so a flurry of scoped matches can never evict a universal rule. Within each pass the fill is greedy by the composite score (a later, shorter rule can still fit after a longer one is dropped), so injected is not necessarily a contiguous prefix. now (test-injectable) drives the recency decay; omitting targetPaths (e.g. the cross-repo injectable preview, which has no session) gates every scoped rule.

Learning[]

number

number = ...

string[]

HouseRulesPlan