Skip to main content
hook

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.

Install into Claude Code · claude-code-templates All methods and platforms ↓
npx claude-code-templates@latest --hook development-tools/edit-audit-log
Open on GitHub

What 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 Edit call
  • add timestamps to file changes in a project log
  • review edits made across Claude Code sessions

Example prompts for the agent

  • Edit src/app.js and log the changed path with its timestamp.
  • Update README.md and record that file edit in the project log.
  • Use Edit to change config.json and 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-log

2Manually: put the files in place

.claude/settings.json

The 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

Similar hooks

All hooks for Agent setup: memory, context, orchestration →

From the same set740

The whole set →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor