A Claude Code PostToolUse hook that logs every completed Write and Edit operation to .claude/checkpoint.md, creating a durable record that survives context compression.
When Claude Code compresses its context window, it loses memory of recent file operations and may redo work that was already completed. This hook writes a persistent log so that Claude can review what has already been done.
# Install to project settings (.claude/settings.json)
./install.sh
# Or install to user-global settings (~/.claude/settings.json)
./install.sh --globalAdd the following to your .claude/settings.json:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"command": "python3 /absolute/path/to/work_checkpoint.py"
}
]
}
}After every Write or Edit tool call, Claude Code runs the hook. The hook:
- Reads the tool-call JSON from stdin
- Ignores any tool that isn't
WriteorEdit - Appends a timestamped one-line summary to
.claude/checkpoint.md
Example log entries:
- [2026-03-22T14:30:00Z] Write: created/overwrote app.py (src/app.py)
- [2026-03-22T14:30:05Z] Edit: utils.py – replaced `def old_name(` (src/utils.py)
- Python 3.11+
- Claude Code with hooks support