Skip to content

feat(plugin): enrich ModeEngine with .ai-rules data (#1212)#1219

Merged
JeremyDev87 merged 1 commit into
masterfrom
taskmaestro/1775225492/pane-2
Apr 3, 2026
Merged

feat(plugin): enrich ModeEngine with .ai-rules data (#1212)#1219
JeremyDev87 merged 1 commit into
masterfrom
taskmaestro/1775225492/pane-2

Conversation

@JeremyDev87

Copy link
Copy Markdown
Owner

Summary

  • load_mode_rules() now extracts mode-specific sections from core.md instead of returning the entire file
  • New _load_agent_details() reads agent JSON from .ai-rules/agents/ for expertise data
  • build_instructions() enriches output with agent expertise and mode rules when .ai-rules/ is available
  • Hard CHAR_LIMIT = 2000 enforced on all output with truncation
  • Graceful fallback to static templates when .ai-rules/ data is absent

Closes #1212

Test plan

  • python3 -m pytest hooks/lib/test_mode_engine.py -v — 37 tests passed
  • Section extraction: PLAN/ACT/EVAL/AUTO each extract correct section, exclude other modes
  • Agent loading: reads JSON, handles missing/malformed files, missing role key
  • Char limit: output never exceeds 2000 chars even with large core.md (500 lines per section)
  • Fallback: template-only output when .ai-rules/ data absent
  • yarn lint passes
  • yarn typecheck passes
  • yarn test passes (71 vitest tests)

- 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
@vercel

vercel Bot commented Apr 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
codingbuddy-landing Ready Ready Preview, Comment Apr 3, 2026 2:24pm

@JeremyDev87 JeremyDev87 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 expertise
  • build_instructions(): enriched with agent expertise + key rule bullet points
  • _build_rules_snippet(): clean helper composing enrichment parts
  • CHAR_LIMIT = 2000 enforced 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

@JeremyDev87 JeremyDev87 self-assigned this Apr 3, 2026
@JeremyDev87 JeremyDev87 merged commit 2d5a535 into master Apr 3, 2026
28 checks passed
@JeremyDev87 JeremyDev87 deleted the taskmaestro/1775225492/pane-2 branch April 3, 2026 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(plugin): enrich ModeEngine with actual .ai-rules data

1 participant