Claude Code hook
Post Compact Reminder
Claude Code hook that detects context compaction and injects a reminder to re-read AGENTS.md, preventing post-compaction rule amnesia in long sessions
Install
brew install jq pythonFound in the project README. Check it for setup steps after installing.
git clone https://github.com/Dicklesworthstone/post_compact_reminder.gitFrom the README
Post-Compact Reminder for Claude Code Stop Claude from forgetting your project rules after context compaction. Quick Install TL;DR The Problem: During long coding sessions, Claude Code compacts the conversation to stay within context limits. After compaction, Claude loses all memory of your project's AGENTS.md, the file that defines your coding conventions, forbidden commands, architectural decisions, multi-agent coordination rules, and everything else that keeps Claude on the rails. The result: Claude starts freelancing, ignoring your rules, deleting files you told it never to delete, and generally going on a post-compaction rampage. The Solution: A hook system that detects compaction events and injects a short plain-text reminder telling Claude to re-read AGENTS.md before doing anything else. One install, zero maintenance, works globally across all your projects. Why Use Post-Compact Reminder? Quick Example After installation, when compaction happens: 1. Claude Code triggers the SessionStart hook with source: "compact" 2. The matcher: "compact" filter ensures the hook only fires after compaction 3. Claude receives the reminder directly in its context 4. Claude re-reads AGENTS.md before proceeding Design Philosophy 1. Simplicity. A single SessionStart hook with matcher: "compact" detects compaction and injects the reminder directly. No marker files, no multi-hook coordination -- just one hook that fires at the right time. 2. Atomic file operations. Every modification to settings.json is written to a temp file first, then moved into place with shutil.move(). If the process crashes mid-write, your settings file stays intact. Backups are created automatically before every modification. 3. One installer, complete functionality. The entire project is a single…
How hooks work
- Hooks are shell commands Claude Code runs at fixed points: before or after a tool call, when you submit a prompt, when Claude stops, on notifications and at session start.
- They are set in the hooks section of ~/.claude/settings.json (or .claude/settings.json for a project), or come bundled in a plugin.
- A hook can block a tool call, add context, or run a formatter or test. Read the scripts before you install them: they run on your machine with your permissions.
Details
- Repository
- Dicklesworthstone/post_compact_reminder
- Type
- Hooks
- Language
- Shell
- Last updated
- 14 October 2026
- Topics
- ai-agentsbashclaudedeveloper-toolshooks
- Listed in
- awesome-claude-code-hooks
FAQ
What is Post Compact Reminder?
Claude Code hook that detects context compaction and injects a reminder to re-read AGENTS.md, preventing post-compaction rule amnesia in long sessions It is a hook for Claude Code, from Dicklesworthstone/post_compact_reminder on GitHub.
How do I install Post Compact Reminder?
Run brew install jq python, then follow the setup in the README.
Is Post Compact Reminder popular?
Dicklesworthstone/post_compact_reminder has 55 GitHub stars and 7 forks, and is included in 1 curated Claude Code list. It was last updated on 14 October 2026.
More hooks
Create Viral Content
78aaaronmiller/create-viral-content
Claude Code skill that optimizes content for social media engagement. Auto-generates hooks, headlines, and formatted posts for Reddit, Twitter/X, LinkedIn, and TikTok.
Claude Code Blueprint
73faizkhairi/claude-code-blueprint
A battle-tested, framework-agnostic reference architecture for Claude Code. Beginner-friendly with graduated adoption (minimal / standard / core / full presets). 12 agents, 19 skills, 15 hooks, 6 rules, with reasoning behind every decision.
Claude Code Tutorial
76hiliyongke/claude-code-tutorial
Claude Code CLI 中文教程 - 从入门到精通,涵盖配置、Hooks、Skills、MCP集成及企业级最佳实践。
Deepsafe Scan
77XiaoYiWeio/deepsafe-scan
Universal preflight security scanner for AI coding agents — Detects hooks injection, credential exfiltration & backdoors in .cursorrules, CLAUDE.md, AGENTS.md and more.
Facebook Skills
80sergebulaev/facebook-skills
Facebook Pages marketing skills for Claude Code and Codex: high-share posts, hooks, engagement replies, and a weekly plan. Publish via Publora. Open source, MIT. Content engineering by Creative Content Crafts.
Claude Code Message Timestamps
77zoharbabin/claude-code-message-timestamps
Show local time on every Claude Code message, and let Claude know when each prompt was sent. Zero-config plugin, cross-OS, graceful degradation.
Browse the most popular Claude Code mods, all hooks, or the skills and MCP server directories.