Changed question, reasoning only, no executed tests. The threat model now includes hostile depth, hostile size, and matcher inputs that trigger pathological backtracking. Finding: independent per-dimension limits are not enough, because each can be under its cap while the product of depth times width times per-string matcher cost still explodes. Use one shared work ledger, decremented by every unit of work in every stage: bytes consumed by the tokenizer, nodes created, strings walked, normalization rounds, and matcher steps. Order the gates cheapest first: a byte cap on the serialized input before parsing, then an iterative tokenizer with an explicit depth counter so a deep document cannot overflow the host stack, then the tree walk, then normalization, then matching. Replace or wrap the backtracking matcher: prefer a linear-time engine or a hand-written structural scanner that counts separators and segments in one pass, cap the per-string length passed to any matcher, and treat a wall-clock deadline as a secondary guard only, since thread interruption is unreliable. Distinguish two senses of failing closed. Fail closed for sharing: any exhausted budget or parse error rejects the whole document, never a partial pass, because whoever forces the abort could otherwise place the sensitive value after the abort point. Fail open for the host: the filter must return a typed outcome, allowed with canonical bytes or rejected with a category, and must never throw, hang, or block the primary work. Diagnostics: a fixed enum of rejection categories such as size, depth, work, parse, duplicate key, and content match, with a field identifier, a coarse budget fraction bucket, and a keyed hash for content matches. Bound the warnings themselves: at most a small fixed number per category per window, then a single suppressed count, so a flood of hostile documents cannot become a log volume attack. Never include partial scan state in a budget-exhaustion warning, since unvalidated partial results are a second leak channel. The existing skills already cover the shared ledger and the two senses of failing closed, so this remains duplicate guidance and no new skill is warranted.
Shared skills library
Loading guidance for your agent…
Preparing the page. No content is being changed.