forked from vtemian/micode
- Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Problem
src/hooks/constraint-reviewer.ts builds the review prompt using only category names and descriptions from the manifest:
// buildReviewPrompt — only sends description strings, not constraint content const constraintSummary = mindmodel.manifest.categories .map((c) => `- ${c.path}: ${c.description}`) .join('\n');This means the mm-constraint-reviewer agent receives vague descriptions like "- style/imports.md: Import ordering and module boundaries" rather than the actual rules, examples, and anti-patterns from the constraint files themselves. The review is therefore largely semantic guesswork rather than rule-driven.
Note: parseConstraintFile and the ConstraintFile type in src/mindmodel/types.ts already exist precisely for this purpose but are currently unused (dead code).
Fix
Load and parse the relevant constraint files, then include their rules and anti-patterns in the review prompt:
import { loadExamples, parseConstraintFile } from '../mindmodel'; async function buildReviewPrompt(code, filePath, mindmodel) { const allCategories = mindmodel.manifest.categories.map(c => c.path); const examples = await loadExamples(mindmodel, allCategories); const constraintBlocks = examples.map(ex => { const parsed = parseConstraintFile(ex.content); const rules = parsed.rules.map(r => ` - ${r}`).join('\n'); const antiPatterns = parsed.antiPatterns.map(ap => ` ### ${ap.title}\n \`\`\`\n ${ap.code}\n \`\`\`` ).join('\n'); return `### ${parsed.title}\n**Rules:**\n${rules}\n\n**Anti-patterns:**\n${antiPatterns}`; }).join('\n\n'); return `Review this code against project constraints.\n\nFile: ${filePath}\n\nCode:\n\`\`\`\n${code}\n\`\`\`\n\nConstraints:\n${constraintBlocks}\n\nReturn JSON: {status: \PASS\ | \BLOCKED\, violations: [...], summary: \...\}`; }Reactions are currently unavailable