fix: prevent accidental answer leaks during exercises - #15
Open
ShengLin1001 wants to merge 2 commits into
Open
Conversation
在出题前提醒并在停止时检查泄露内容,同时收紧 reading/review 提示格式。
There was a problem hiding this comment.
Pull request overview
This PR adds a hook-based “answer leak” guard to prevent compromised exercise items (where the learner can see an answer key) from being graded and persisted into the spaced-repetition/mastery databases, and updates skill instructions to reduce common leak patterns.
Changes:
- Added a Stop/UserPromptSubmit hook script to detect answer-key leaks and block continuation with remediation instructions.
- Wired the new guard into both
.claude/settings.json(clone mode) and.claude/hooks/hooks.json(plugin mode). - Tightened exercise prompt formatting guidance in review/reading skills and added a global “end at prompt line” rule.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
CLAUDE.md |
Adds an explicit rule to end exercise messages exactly at the learner prompt line to avoid trailing leaks. |
.claude/skills/fluent-review/SKILL.md |
Clarifies that item_type must not include the tested item (to avoid leaking via metadata). |
.claude/skills/fluent-reading/SKILL.md |
Ensures MCQ-style prompts terminate with an explicit learner-input line. |
.claude/settings.json |
Registers the new guard for Stop + UserPromptSubmit in clone-mode settings. |
.claude/hooks/hooks.json |
Registers the new guard for Stop + UserPromptSubmit in plugin-mode hooks config. |
.claude/hooks/answer-leak-guard.py |
Implements leak detection and Stop-hook blocking behavior, plus a selftest mode. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Stopand void compromised itemsWhy
Fixes #14. A leaked answer must not be graded or written as genuine mastery.
Validation
python3 .claude/hooks/answer-leak-guard.py --selftest.claude/hooks/hooks.jsonand.claude/settings.jsonas JSONgit diff --checkThe
Stophook cannot retract content already rendered to the learner. It blocks continuation, prevents grading/persistence of the compromised item, and requires a different replacement item.