Skip to content

fix: prevent accidental answer leaks during exercises - #15

Open
ShengLin1001 wants to merge 2 commits into
m98:mainfrom
ShengLin1001:fix/answer-leak-guard
Open

fix: prevent accidental answer leaks during exercises#15
ShengLin1001 wants to merge 2 commits into
m98:mainfrom
ShengLin1001:fix/answer-leak-guard

Conversation

@ShengLin1001

Copy link
Copy Markdown

Summary

  • remind Claude before drafting an exercise response
  • detect trailing answer keys at Stop and void compromised items
  • make reading and review prompts terminate cleanly

Why

Fixes #14. A leaked answer must not be graded or written as genuine mastery.

Validation

  • python3 .claude/hooks/answer-leak-guard.py --selftest
  • parsed .claude/hooks/hooks.json and .claude/settings.json as JSON
  • git diff --check

The Stop hook cannot retract content already rendered to the learner. It blocks continuation, prevents grading/persistence of the compromised item, and requires a different replacement item.

在出题前提醒并在停止时检查泄露内容,同时收紧 reading/review 提示格式。
Copilot AI review requested due to automatic review settings July 26, 2026 12:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread .claude/hooks/answer-leak-guard.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Answers leaking on accident

2 participants