Skip to main content
hook

change-logger — Claude Code hook: log every file change to CSV

This hook writes each file mutation to a CSV: timestamp, tool, path, action and details. Handy when you are prepping a demo and need to show what the agent touched.

Install into Claude Code · claude-code-templates All methods and platforms ↓
npx claude-code-templates@latest --hook automation/change-logger
Open on GitHub

What change-logger does

The hook listens on PostToolUse and fires after Edit, MultiEdit, Write and Bash. Every call runs python3 .claude/hooks/change-logger.py, and the script appends a row to .claude/critical_log_changes.csv. A row carries the timestamp, tool name, file path, action and operation details.

There is one executable script, change-logger.py, dropped into .claude/hooks/. No extra logic to configure: whatever the hook catches lands in the file. You need Python 3 in the environment, since the command goes through python3.

Keep in mind that Bash sits in the matcher list, so shell commands end up in the log alongside file edits. Run a lot of terminal work and the CSV grows fast — decide up front where the log lives and when you clear it.

What it helps with

  • capture every file edit from a session in one CSV
  • build an evidence trail for a demo
  • see which tools the agent called and when
  • track Bash commands next to file edits
  • reconstruct a timeline of agent activity in a project

Example prompts for the agent

  • turn on change-logger and show me what it logged after the last edit
  • check .claude/critical_log_changes.csv and tell me which files changed
  • why is there a Bash entry in the log?

How to install change-logger

1claude-code-templates

npx claude-code-templates@latest --hook automation/change-logger

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 change-logger

How do I install change-logger in Claude?

Run npx claude-code-templates@latest --hook automation/change-logger, then check .claude/settings.json — the hook should be registered there.

What does change-logger do?

It logs file mutations to CSV: timestamp, tool, path, action and details. It fires after Edit, MultiEdit, Write and Bash, writing to .claude/critical_log_changes.csv.

What does the hook need to run?

Python 3 in the environment: the hook command runs python3 .claude/hooks/change-logger.py, and the script itself sits in .claude/hooks/.

Source text

change-logger.json · MIT
{
  "description": "Log every file mutation to CSV for demo prep. Records timestamp, tool, file path, action, and details for Edit, MultiEdit, Write, and Bash operations. Output: .claude/critical_log_changes.csv",
  "supportingFiles": [
    {
      "source": "change-logger.py",
      "destination": ".claude/hooks/change-logger.py",
      "executable": true
    }
  ],
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit",
        "hooks": [
          {
            "type": "command",
            "command": "python3 .claude/hooks/change-logger.py"
          }
        ]
      },
      {
        "matcher": "Write",
        "hooks": [
          {
            "type": "command",
            "command": "python3 .claude/hooks/change-logger.py"
          }
        ]
      },
      {
        "matcher": "MultiEdit",
        "hooks": [
          {
            "type": "command",
            "command": "python3 .claude/hooks/change-logger.py"
          }
        ]
      },
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "python3 .claude/hooks/change-logger.py"
          }
        ]
      }
    ]
  }
}

© davila7 · MIT · davila7/claude-code-templates

Similar hooks

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

From the same set205

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