feat(renderer): chunk oversized topic rule files into index + per-section files#94
Merged
Conversation
…tion files Topic files over 8 KB now render as a small routing index at the existing .claude/rules/<topic>.md path (section, file, ~tokens, contents table) with per-H2-section chunk files under .claude/rules/<topic>/. Bodies wrapped in a single H2 fall back to H3-category splitting (dev-rules, infrastructure). Real-world effect (Gasztroterkepek.iOS blueprint): default-loaded rule surface drops from ~225 KB of monoliths to ~15 KB of indexes; full content stays available on demand. Also adds cleanup_stale_rule_files(): removes the retired enforcement.md monolith, stale chunks after section renames, and chunk dirs for topics that de-chunk — wired into renderer.main() and finalize.py. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…files # Conflicts: # .gitignore
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Topic rule files over 8 KB no longer render as monoliths. They split into an index + per-section chunk files, so agents route with ~1 KB instead of swallowing 20–50 KB.
How rules look now
The index is a routing table the agent reads first:
patterns/communication-patterns.mdpatterns/key-decisions.mdpaths:globs) is preserved on every chunkcleanup_stale_rule_files()removes the retiredenforcement.mdmonolith, orphaned chunks after section renames, and chunk dirs for topics that de-chunk — wired intorenderer.main()andfinalize.py.archie-bench/gitignored (local benchmark artifacts)Real-world validation (fresh deep scan on Gasztroterkepek.iOS)
.claude/rules/*.mdpatterns.mdarchitecture.mdAGENTS.mdenforcement.md(70 KB pre-2.5 leftover)0 validation failures; full content remains available on demand.
Tests
tests/test_renderer_chunking.py: threshold behavior, fence-aware H2 split, H3 fallback, slug collisions, index summaries, stale cleanup (incl. foreign-file safety)verify_sync.pygreen; npm assets synced🤖 Generated with Claude Code