edit-audit-log — Claude Code hook: edit log and installation
This hook records the path and timestamp for files changed with Edit. Use it to review file changes across Claude Code sessions.
npx claude-code-templates@latest --hook development-tools/edit-audit-logWhat edit-audit-log does
When the Edit tool runs, the hook appends a timestamp and the edited file path to .claude/edit-log.txt. It listens for PostToolUse events matched to Edit, so calls to other tools do not create entries.
The command uses jq to read the file path, and the log stays inside the project. Without jq, the hook cannot extract the path. Install it with npx claude-code-templates@latest --hook development-tools/edit-audit-log, then configure it in .claude/settings.json.
What it helps with
- record the file path after each
Editcall - add timestamps to file changes in a project log
- review edits made across Claude Code sessions
Example prompts for the agent
- Edit
src/app.jsand log the changed path with its timestamp. - Update
README.mdand record that file edit in the project log. - Use
Editto changeconfig.jsonand add the change to.claude/edit-log.txt.
How to install edit-audit-log
1claude-code-templates
npx claude-code-templates@latest --hook development-tools/edit-audit-log2Manually: put the files in place
.claude/settings.jsonThe hooks block: event (PreToolUse, PostToolUse, Stop…) → command. Personal ones go to ~/.claude/settings.json
Step by step, with commands for each platform: Claude Code hooks: what they are, where to configure them, how to block a risky command
Questions about edit-audit-log
How do I install edit-audit-log in Claude Code?
Run npx claude-code-templates@latest --hook development-tools/edit-audit-log, then configure the hook in .claude/settings.json.
What does edit-audit-log do?
After Edit runs, the hook appends the file path and a timestamp to .claude/edit-log.txt.
What does edit-audit-log need to run?
It requires jq to read the file path from an Edit call.
Source text
edit-audit-log.json · MIT
{
"description": "Log all file edits to a project-local audit file with timestamps. Records every Edit tool usage to .claude/edit-log.txt for tracking changes across sessions. Requires jq.",
"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\"'"
}
]
}
]
}
}
© davila7 · MIT · davila7/claude-code-templates