Skip to content

refactor: proverki.md and stavki.md become indexes, not the full text - #107

Merged
svedbg merged 1 commit into
mainfrom
refactor/split-proverki-stavki
Sep 6, 2026
Merged

refactor: proverki.md and stavki.md become indexes, not the full text#107
svedbg merged 1 commit into
mainfrom
refactor/split-proverki-stavki

Conversation

@svedbg

@svedbg svedbg commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Summary

Point 3 of the trz-expert evaluation: proverki.md (~27K tokens, 86 checks) and stavki.md (~30K tokens, thirteen unrelated rate topics) were read in full on every audit regardless of which checks or topics a payroll actually needed. SKILL.md's step 3a already decides which check groups stay "проверява се" before the checklist is read, and a given payroll rarely touches more than three or four of stavki.md's thirteen topics — so neither file needed to be monolithic.

  • proverki.md is now an index — every check's title, grouped A–K. Full text (basis, arithmetic, example) moves to references/proverki/<letter>.md, loaded only for open groups.
  • stavki.md is now an index — status legend, per-section verification-date table (now with a file column), currency rule, contributor guide, changelog. The thirteen rate tables move to references/stavki/<topic>.md, linked from a new "Ставки по теми" section.

Both splits were verified lossless before anything else — every group/topic file diffed byte-for-byte against the original section.

What the split broke, and the fix

  • ~30 cross-references across SKILL.md and every proverki/<letter>.md file that named a specific stavki.md section by heading (e.g. „Срокове и лимити по КТ“) now name the topic file directly. Three prose references in stavki.md itself assumed single-file adjacency ("по-горе", "в началото на този файл") and needed rewording.
  • One citation (F1_insurable_unexplained's чл. 6, ал. 2 КСО) lived only in a paragraph that moved to proverki/f.mdtest/findings.py's citation-grounding search read only 3 top-level files and would have raised ImportError on next import (confirmed by reproducing it before fixing).
  • test/rates_test.py, tools/preflight.py's regime_boundaries(), and test/skill_test.py's PAID_GUIDANCE search all assumed the rates/reference text lived in one file — all three now read the index plus every split-out file.
  • test/eval_skill.py's isolation-taint check and _skill_signature() (staleness guard against a frozen plugin-cache checkout) read a hardcoded 4-file list — now enumerate every file under both subdirectories via a shared helper.
  • Two new skill_test.py checks pin the exact file sets under references/proverki/ and references/stavki/ against what each index's own bullets promise — an orphan or missing file there was previously invisible to the generic (non-recursive) orphan check.
  • .agents/skills/trz-expert/SKILL.md (Codex pointer), CONTRIBUTING.md, CLAUDE.md, .github/PULL_REQUEST_TEMPLATE.md updated to describe the two-tier structure.

Test plan

  • Both splits verified byte-for-byte lossless before any other edit
  • rates_test, skill_test, run_tests --seeds 50, preflight_test, komplekt_test, lifecycle_test, k_checker_test --seeds 100, eval_skill --selftest — all green
  • Direct calls to eval_skill.check_isolation() and tree_skill_signature() — clean, no exceptions
  • Proved both new skill_test.py file-set checks have teeth (moved a group/topic file aside, watched it fail, restored it)
  • Full pre-commit hook (rates, packaging, five suites, K5/K6 checker) passes clean

🤖 Generated with Claude Code

https://claude.ai/code/session_01XvbzEbQwxwxxHAtXfPMrno

Both files are read on every audit regardless of which checks or rate topics a
payroll actually needs - proverki.md ~27K tokens for 86 checks, stavki.md ~30K
for thirteen unrelated rate topics. Neither the checklist nor the rates need
to be one file: SKILL.md's step 3a already decides which check groups stay
"проверява се" before the checklist is read, and a given payroll rarely
touches more than three or four of stavki.md's thirteen topics at once.

proverki.md is now an index: every check's title, grouped A-K, and nothing
else. The full text - basis, arithmetic, worked example - moves to
references/proverki/<letter>.md, one file per group, read only for the groups
step 3a leaves open. Group K's file also carries "Как се чете електронна
таблица" above its bullets and "Формули" below them, matching their prior
position.

stavki.md is now an index the same way: the status legend, the per-section
verification-date table (now with a file column), the currency-changeover
rule, the contributor guide and the changelog. The thirteen rate tables move
to references/stavki/<topic>.md - МРЗ/МОД, contributions, the чл. 446 ГПК
attachment scale, income tax, the leave-pay/severance base, sick pay, in-kind
benefits, class, overtime/night/holiday premiums, and КТ deadlines - linked
from a new "Ставки по теми" section.

Both splits were verified lossless before anything else: every group/topic
file's content was diffed byte-for-byte against the original file's matching
section before the source was touched.

What moving the content broke, and the fix:

- Cross-file prose that assumed single-file adjacency ("по-горе", "в
  началото на този файл"): three in stavki.md's own body (a запор section
  pointing back at the МРЗ table now in a different file, a bolnichni section
  pointing at the leave-pay base, a срокове table pointing at the запор
  scale), plus roughly thirty places across SKILL.md and every
  proverki/<letter>.md file that named a specific stavki.md section by
  heading ("„Срокове и лимити по КТ“", "„Състав на базата“", etc.) - each now
  names its topic file directly. One citation (F1_insurable_unexplained's
  чл. 6, ал. 2 КСО) lived only in what is now a proverki/f.md paragraph and
  nowhere else in the reference tree.

- test/findings.py's citation-grounding search read exactly three top-level
  files; a citation living only in a moved fragment silently stopped being
  "grounded" and would have raised ImportError on the next import. Now globs
  every file under references/proverki/ and references/stavki/ too.

- test/rates_test.py's TEXT was one file's content; a rate that moved out of
  the index would never be found by extract()'s regexes. Now concatenates the
  index with every topic file (the "exactly one match" rule still holds
  across all of them, and now also catches an accidental duplicate between
  index and topic).

- tools/preflight.py's regime_boundaries() scanned stavki.md alone for the
  МРЗ/МОД date-range tables; those moved into stavki/mrz-mod.md. Now reads
  the index plus every file under stavki/.

- test/skill_test.py's PAID_GUIDANCE search built its file bundle from
  os.listdir(references/), which does not recurse - a pinned phrase that
  moved into stavki/otpusk-baza.md went invisible to it. Now recurses one
  level into subdirectories.

- test/eval_skill.py's isolation-taint check and _skill_signature() (which
  guards against grading a stale plugin-cache checkout) both read a hardcoded
  four-file list; a scenario id leaking into a moved fragment, or a stale
  checkout of one, would have gone unnoticed. Both now enumerate every file
  under references/proverki/ and references/stavki/ via a shared
  _skill_files() helper.

- test/skill_test.py did not previously verify that references/proverki/ or
  references/stavki/ contained exactly the files their respective index
  promises - the generic orphan-file check does not recurse into
  subdirectories, so a missing or stale group/topic file would have gone
  unnoticed there too. Two new checks pin the exact file set against what
  each index's own bullets name.

- .agents/skills/trz-expert/SKILL.md (the Codex CLI pointer), CONTRIBUTING.md,
  CLAUDE.md and .github/PULL_REQUEST_TEMPLATE.md updated to describe the two-
  tier structure and where to actually add a check or a rate now.

Full test battery green throughout, at higher depth than the default for the
final state: rates_test, skill_test, run_tests --seeds 50, preflight_test,
komplekt_test, lifecycle_test, k_checker_test --seeds 100, eval_skill
--selftest, plus direct calls to eval_skill.check_isolation() and
tree_skill_signature().

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XvbzEbQwxwxxHAtXfPMrno
@svedbg
svedbg merged commit 86b8c19 into main Sep 6, 2026
12 checks passed
@svedbg
svedbg deleted the refactor/split-proverki-stavki branch September 6, 2026 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant