Copilot Hooks (real-time corrections while writing) are defined in auto-paper/SKILL.md.
Pre-Commit Hooks (this file, final gatekeeping before git commit) only report and do not auto-modify.
Triggers: "commit", "push", "done", "wrapping up", "quick commit"
Step 0: Detect change scope
get_changed_files() or git diff --cached --name-only.
Paper file pattern:projects/*/drafts/*, projects/*/concept.md, projects/*/references/*, projects/*/.memory/*
→ Triggers Paper Hooks when matched.
General Hooks (triggered every time)
| Hook | Condition | Action | MCP Tools |
|---|---|---|---|
| G1 memory-sync | Required | Update Memory Bank + workspace state | memory_bank_update_progress, sync_workspace_state |
| G2 readme-update | New feature/API change | Update README | read_file, replace_string_in_file |
| G3 changelog-update | Version/important change | Update CHANGELOG | Same as above |
| G4 roadmap-update | Milestone completed | Update ROADMAP | Same as above |
| G5 arch-check | Structural change | Check architecture docs | grep_search, list_dir |
| G6 project-integrity | SKILL/AGENTS/src change | Project consistency audit | See below |
| G7 vsx-integrity | skills/prompts/vsx change | VSX Extension sync | See below |
| G8 doc-update-reminder | Any code/config change | Remind about docs that need updating | scripts/check-doc-updates.py (pre-commit hook) |
| G9 git-status-check | Required | Detect uncommitted/unpushed (Code-Enforced) | run_writing_hooks G9 |
G6 Project Consistency Audit
| # | Check | Method | Failure |
|---|---|---|---|
| G6.1 | Tool count | grep -c "mcp.tool" vs README/ARCHITECTURE |
⚠️ WARN |
| G6.2 | Skill count | ls -d .claude/skills/*/ vs AGENTS.md |
⚠️ WARN |
| G6.3 | Prompt count | ls .github/prompts/*.prompt.md vs docs |
⚠️ WARN |
| G6.4 | Hook tool exists | In SKILL.md mcp_mdpaper_* → registered |
❌ FAIL |
| G6.5 | Cross-file number consistency | README vs ARCHITECTURE vs AGENTS | ⚠️ WARN |
G7 VSX Extension Sync
| # | Check | Method | Failure |
|---|---|---|---|
| G7.1 | Skills sync | diff source vs bundled |
⚠️ WARN |
| G7.2 | Prompts sync | diff source vs bundled |
⚠️ WARN |
| G7.3 | Chat commands | package.json chatParticipants | ❌ FAIL |
| G7.4 | Version semver | Format validation | ❌ FAIL |
| G7.5 | TypeScript compilation | tsc --noEmit |
⚠️ WARN |
Quick fix:cd vscode-extension && ./scripts/build.sh
Paper Hooks (when paper changes are detected)
| Hook | Check | MCP Tools | Verdict |
|---|---|---|---|
| P1 citation-integrity | [[wikilinks]] parseable |
scan_draft_citations, validate_wikilinks |
0 unresolved = ✅, unknown = ❌ |
| P2 anti-ai-scan | AI-trace wording | read_draft + Agent scan |
0 = ✅, 1-2 = ⚠️, ≥3 = ❌ |
| P3 concept-alignment | NOVELTY/SELLING POINTS reflected | read_draft("concept.md") + drafts |
Complete = ✅, Partial = ⚠️, NOVELTY missing = ❌ |
| P4 word-count | Each section ±20% | count_words |
Over 50% = ❌ |
| P5 protected-content | 🔒 Block exists and is non-empty | read_draft("concept.md") |
Missing = ❌ |
| P6 memory-sync | .memory/ updated |
sync_workspace_state |
Not updated = AUTO-FIX |
| P7 reference-integrity | Reference metadata complete | list_saved_references, get_reference_details |
Not VERIFIED = ⚠️ |
| P8 methodology | Methods reproducible | read_draft + Agent checklist |
Items <3 = ❌ |
P2 Anti-AI prohibited words:In recent years, It is worth noting, plays a crucial role, has garnered significant attention, a comprehensive understanding, This groundbreaking, delve into, shed light on, pave the way, a myriad of
P8 complements Copilot Hook B5: B5 corrects in real time while writing, P8 gives final confirmation at commit time (safety net).
Hook performance tracking (§23 Self-Improving)
Record after each execution: projects/{slug}/.audit/precommit-stats.md: trigger rate/pass rate/warning rate/block rate.
- Pass rate >95% (5+ times) → possibly too loose
- Block rate >50% (5+ times) → possibly too strict
- Records for auto-paper Hook D analysis
Execution mode
| Mode | Trigger | Execution |
|---|---|---|
| Standard | "Prepare commit" | Step 0 → G1-G7 → P1-P8 (if applicable) → Final |
| Quick | "Quick commit" | G1 + P1 + P5 (if applicable) → Final |
| Development | 「commit code」 | G1-G7 (skip Paper Hooks) → Final |
Git operations
Commit Message format:type(scope): description
- Types: feat, fix, docs, refactor, style, test, chore
- Scope: paper, concept, refs, export, core
Skill dependencies
| Hook | Orchestration Skill | Tools |
|---|---|---|
| G1 | memory-updater | memory_bank_update_progress |
| G2-G4 | readme/changelog/roadmap-updater | read_file, replace_string_in_file |
| G5 | ddd-architect | grep_search, list_dir |
| P1-P4 | draft-writing | read_draft, count_words, validate_wikilinks |
| P3,P5,P8 | concept-development | read_draft("concept.md") |
| P7 | reference-management | list_saved_references, get_reference_details |