What is the Edit Audit Log Hook?
The Edit Audit Log is a Claude Code hook that appends a timestamped line to .claude/edit-log.txt every time Claude uses the Edit tool. It runs as a PostToolUse hook, so it fires after each successful edit and gives you a simple, greppable history of what changed across sessions.
graph LR
A[📝 Edit Tool Call] --> B[🪝 Edit Audit Log Hook]
B --> C[⚡ Append Timestamped Line]
C --> D[✅ edit-log.txt Updated]
style B fill:#F97316,stroke:#fff,color:#000
Key Capabilities
- Automatic logging (no prompt changes needed, it runs after every Edit)
- ISO timestamps (each line starts with
YYYY-MM-DDTHH:MM:SS) - Project-local file (written to
$CLAUDE_PROJECT_DIR/.claude/edit-log.txt) - Cross-session history (the file is appended to, never overwritten)
- Tiny footprint (a single shell command built on
jqandxargs)
Installation
Install the Edit Audit Log hook using the Claude Code Templates CLI:
npx claude-code-templates@latest --hook development-tools/edit-audit-log
Where is the hook installed?
Hooks are merged into the hooks section of your .claude/settings.json file. The log is created the first time an edit happens:
your-project/
├── .claude/
│ ├── settings.json # ← Hook installed here
│ └── edit-log.txt # ← Created on the first edit
├── src/
├── package.json
└── README.md
The hook requires jq to be available on your PATH.
The Hook Configuration
This is what gets added to your settings:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit",
"hooks": [
{
"type": "command",
"command": "jq -r '.tool_input.file_path' | xargs -I FILE sh -c 'echo \"$(date +%Y-%m-%dT%H:%M:%S): Edit FILE\" >> \"$CLAUDE_PROJECT_DIR/.claude/edit-log.txt\"'"
}
]
}
]
}
}
Claude Code passes the tool call to the command as JSON on stdin. jq extracts tool_input.file_path, and the shell appends a line with the current time. The matcher is Edit, so only the Edit tool is logged: Write and MultiEdit calls are not recorded unless you widen the matcher (for example Edit|Write|MultiEdit).
Step-by-Step Workflow
Step 1: Install the hook
cd your-project
npx claude-code-templates@latest --hook development-tools/edit-audit-log
Step 2: Start Claude Code and make changes
claude
> Rename the getUser helper to fetchUser and update all call sites
Use /hooks inside Claude Code at any time to confirm the PostToolUse hook is registered.
Step 3: Read the audit log
cat .claude/edit-log.txt
2026-11-03T09:14:02: Edit /home/dev/your-project/src/users.js
2026-11-03T09:14:05: Edit /home/dev/your-project/src/api/routes.js
2026-11-03T09:14:09: Edit /home/dev/your-project/tests/users.test.js
Step 4: Query it
# Which files were edited most?
sed 's/^[^ ]* Edit //' .claude/edit-log.txt | sort | uniq -c | sort -rn | head
# What happened today?
grep "^2026-11-03" .claude/edit-log.txt
Tips
- Add
.claude/edit-log.txtto.gitignoreif you want the log to stay local. - Paths containing spaces are split by
xargs, so keep that in mind for unusual project layouts. - Pair it with a review step: compare the log against
git diff --statto see what a session touched.
Official Documentation
For more information about hooks in Claude Code, see the official hooks documentation.
Created by Daniel Ávila