Skip to content

Add config-driven path exclusion (ignoreGlobs) to keep data-only changes from arming the Stop hook #35

Description

@motesaku

Summary

Add an optional ignoreGlobs key to .claude/auto-memory/config.json so users can exclude data/content paths from being tracked in dirty-files. Files matching any glob are treated like the existing .claude/ and memory-file exclusions in should_track() — they never arm the blocking Stop/PreToolUse hook.

Motivation

On research/data repositories, a large share of changes are value changes to data files (JSON datasets, status files, references, logs) rather than structural changes to code or docs. Today should_track() only excludes .claude/ and the configured memory files, so:

  • In gitmode, every git commit touching such data files appends them to dirty-files, and the Stop hook blocks until memory-updater runs.
  • memory-updater is the only thing that clears dirty-files. Skipping it ("this change does not affect CLAUDE.md") leaves the entries, so the block re-fires every turn and the file list accumulates across commits.

The result is a repeated, heavyweight agent prompt for changes that can never affect the memory file. There is currently no config-level way to scope this out.

Proposal

.claude/auto-memory/config.json:

{
  "triggerMode": "gitmode",
  "ignoreGlobs": ["data/**", "**/status.json", "logs/**"]
}
  • Patterns match the project-relative POSIX path via fnmatch.
  • A string is accepted and treated as a single-element list (mirrors memoryFiles).
  • Absent/empty → no change in behavior (fully backward compatible).
  • Applied in both code paths that feed should_track() (Edit/Write and git-commit).

Scope

  • scripts/post-tool-use.py: add get_ignore_globs(), extend should_track() with an ignore_globs parameter, wire it in main().
  • tests/test_hooks.py: unit + integration coverage.
  • README.md: document the key under Configuration.

I have a working implementation and tests and am happy to open a PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions