feat(plugin): enrich ModeEngine with .ai-rules data (#1212)#1219
Merged
Conversation
- load_mode_rules() now extracts mode-specific section from core.md instead of returning the entire file - Add _load_agent_details() to read agent JSON from .ai-rules/agents/ and extract name, description, and expertise - build_instructions() enriches output with agent expertise and mode rules when .ai-rules/ data is available - Enforce 2000 char hard limit on all output (CHAR_LIMIT constant) - Graceful fallback to static templates when .ai-rules/ is absent - Add 17 new test cases covering section extraction, agent loading, enrichment, char limit enforcement, and fallback behavior
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
JeremyDev87
commented
Apr 3, 2026
JeremyDev87
left a comment
Owner
Author
There was a problem hiding this comment.
✅ Review complete — all comments addressed
Code Review:
load_mode_rules(): now extracts mode-specific section via header parsing (not full file)- Sub-sections with mode keyword in header correctly stay under parent mode
_load_agent_details(): reads agent JSON from .ai-rules/agents/, returns expertisebuild_instructions(): enriched with agent expertise + key rule bullet points_build_rules_snippet(): clean helper composing enrichment partsCHAR_LIMIT = 2000enforced with truncation- Tests: 17+ tests covering section extraction, agent loading, enrichment, char limit, graceful fallback
- No unused imports, clean structure
- Label: feat ✅
- CI: awaiting full pass (code review verified)
LGTM
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
load_mode_rules()now extracts mode-specific sections fromcore.mdinstead of returning the entire file_load_agent_details()reads agent JSON from.ai-rules/agents/for expertise databuild_instructions()enriches output with agent expertise and mode rules when.ai-rules/is availableCHAR_LIMIT = 2000enforced on all output with truncation.ai-rules/data is absentCloses #1212
Test plan
python3 -m pytest hooks/lib/test_mode_engine.py -v— 37 tests passedrolekey.ai-rules/data absentyarn lintpassesyarn typecheckpassesyarn testpasses (71 vitest tests)