Skip to content

feat(renderer+rules): recursive section chunking + adoption gate for rerun-discovered rules#96

Merged
gbrbks merged 1 commit into
feature/chunked-rule-filesfrom
feature/chunk-oversize-v2
Jun 10, 2026
Merged

feat(renderer+rules): recursive section chunking + adoption gate for rerun-discovered rules#96
gbrbks merged 1 commit into
feature/chunked-rule-filesfrom
feature/chunk-oversize-v2

Conversation

@csacsi

@csacsi csacsi commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Builds on #94. Two changes validated on OpenMeter (the largest test repo so far, see openmeterio/openmeter#4486 for the pre-chunking state).

Recursive section chunking

A section chunk still over 8 KB with ≥2 subsections splits one level deeper (topic → section → entry), the section file becoming a sub-index with the same routing-table format.

OpenMeter blueprint results:

File Before recursion After
data-models/models.md 85 KB (84 models inline) 9.8 KB sub-index + 84 per-model files
architecture/components.md 26 KB entry-level chunks
patterns/key-decisions.md 24 KB entry-level chunks
largest non-index chunk 85 KB ~6 KB

Depth is capped (topic → section → entry); stale-cleanup now prunes nested empty dirs bottom-up.

Adoption gate for rerun-discovered rules

On a deep-scan rerun (rules.json already populated), extract_output.py cmd_rules routes brand-new rule ids to proposed_rules.json instead of activating them — the user adopts/rejects them in the viewer's Rules card (existing flow) before hooks enforce. Updates to already-active ids still apply directly; ignored/pending ids are never re-proposed. The first scan keeps auto-adopting the baseline. Step 6 workflow doc tells the agent to report pending proposals in its final summary.

Tests

13 new/updated tests (recursion, depth cap, hierarchical index reachability, nested-dir cleanup; adoption gate: first-scan auto-adopt, rerun proposal, in-place update, ignored/pending dedup). Full suite: 851 passed; verify_sync.py green.

🤖 Generated with Claude Code

…rerun-discovered rules

Recursive chunking: a section chunk still over 8 KB with >=2 subsections
splits one level deeper (topic -> section -> entry), the section file
becoming a sub-index. OpenMeter validation: data-models/models.md went
from 85 KB to a 9.8 KB routing sub-index + 84 per-model files; largest
non-index chunk is now ~6 KB. Stale-cleanup prunes nested empty dirs.

Adoption gate: on a deep-scan rerun (rules.json already populated),
extract_output cmd_rules routes brand-new rule ids to proposed_rules.json
instead of activating them — the user adopts/rejects in the viewer's
Rules card (existing flow) before hooks enforce. Updates to active ids
still apply directly; ignored/pending ids are not re-proposed. First
scan keeps auto-adopting the baseline.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@gbrbks gbrbks merged commit aca5564 into feature/chunked-rule-files Jun 10, 2026
3 checks passed
@gbrbks gbrbks deleted the feature/chunk-oversize-v2 branch June 10, 2026 19:02
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.

2 participants