rubric-grader
Owns all suggestion quality gates and preference alignment checks.
Mode 1: Grade (Self-Grading Pipeline)
When grading a suggestion generated during ingestion:
Read References:
- Read references/rubric.md
- Read rubric_blocklist.md
Hard-Veto Check:
- Compare the suggestion title and content against patterns in the
## Topic Blockssection of rubric_blocklist.md. - If matched → VETO. Append entry to suggestions_filtered.md with reason
Hard-veto: {Topic}. Exit.
- Compare the suggestion title and content against patterns in the
Ambiguity Check:
- Check if
建議下一步contains any phrase listed in the## Ambiguity Blocklistof rubric_blocklist.md. - If matched → VETO. Append entry to suggestions_filtered.md with reason
Ambiguity blocklist: {Phrase}. Exit.
- Check if
Rubric Scoring:
- Score the suggestion on the 3 active dimensions (Actionability, Preference Alignment, Goal Relevance) defined in references/rubric.md (0, 1, or 2).
- Calculate composite score $total = A + P + G$.
Pass/Fail Routing:
- Pass ($\ge 4$): Form entry replacing legacy fields with
🏷️ {分類} | 📊 {total}/6 (A:{a} P:{p} G:{g})and append to suggestions_pending.md. - Fail ($< 4$): Form entry replacing legacy fields with
🏷️ {分類} | 📊 {total}/6 (A:{a} P:{p} G:{g})and append to suggestions_filtered.md with reasonBelow threshold ({total} < 4).
- Pass ($\ge 4$): Form entry replacing legacy fields with
Mode 2: Backtest
When requested to "backtest the rubric":
Read History:
- Read suggestions_reviewed.md.
Sample Data:
- Extract reviewed entries. Stratified sample up to $N$ (default 20) accepted entries (
Feedback: ✅ Accept) and $N$ (default 20) rejected entries (Feedback: ❌ Reject).
- Extract reviewed entries. Stratified sample up to $N$ (default 20) accepted entries (
Evaluate Sample:
- Use the rubric grading criteria (from Mode 1) to evaluate each sample entry's text (original suggestion content). Score A, P, G, and check hard-vetos.
- Classify rubric decision:
- Rubric Pass: Score $\ge 4$ and no veto.
- Rubric Fail: Score $< 4$ or vetoed.
Compute Metrics:
- Calculate:
- True Positive (TP): Actual Accept $\cap$ Rubric Pass
- False Positive (FP): Actual Reject $\cap$ Rubric Pass
- True Negative (TN): Actual Reject $\cap$ Rubric Fail
- False Negative (FN): Actual Accept $\cap$ Rubric Fail
- Accuracy = $(TP + TN) / (TP + TN + FP + FN)$
- Precision = $TP / (TP + FP)$
- Recall = $TP / (TP + FN)$
- Calculate:
Generate Report:
- Write the report to
.tmp/rubric_backtest_report.md. - Output the metrics, sample details, and recommendations in the chat.
- Write the report to
Mode 3: Maintain
When invoked by review-suggestions at the end of Step 6:
Interactive Blocklist Proposal:
- Scan suggestions_reviewed.md for suggestions with
Feedback: ❌ Reject. - Identify repeating keywords, phrases, or topics in the comments/suggestions (appearing $\ge 3$ times).
- If a repeating topic is found that is not currently in rubric_blocklist.md:
- Stop and prompt the user in the chat:
💡 **Blocklist Suggestion**: Detected 3+ rejections regarding the topic: "[Topic Name]". - Examples of rejected comments: - "..." - "..." Would you like to add "[Topic Name]" to the hard-veto blocklist? - Do NOT write to rubric_blocklist.md automatically. Only write to it when the user replies affirmatively in the chat.
- Stop and prompt the user in the chat:
- Scan suggestions_reviewed.md for suggestions with
Rubric Score Calibration:
- Count all entries in suggestions_reviewed.md that contain a
📊 {total}/6rubric score. - If total count is $\ge 30$:
- Calculate the accept rate for each score bucket (4, 5, 6).
- Recommend adjusting the threshold if necessary (e.g. if bucket 4 acceptance is $< 60%$, suggest raising threshold to 5).
- Output calibration report to the chat.
- If total count is $< 30$:
- Output:
📊 Rubric calibration: {N}/30 — collecting more data.
- Output:
- Count all entries in suggestions_reviewed.md that contain a