Skip to content

feat: per-project disable/exclude functionality#1321

Open
StevenLi-phoenix wants to merge 5 commits intothedotmack:mainfrom
StevenLi-phoenix:feat/per-project-disable
Open

feat: per-project disable/exclude functionality#1321
StevenLi-phoenix wants to merge 5 commits intothedotmack:mainfrom
StevenLi-phoenix:feat/per-project-disable

Conversation

@StevenLi-phoenix
Copy link

Summary

Closes #1320

  • Add .claude-mem-disable touch file for instant per-repo disable (no settings needed)
  • Add CLAUDE_MEM_EXCLUDED_PROJECTS settings-based exclusion with glob pattern support
  • Add disable/enable CLI commands to manage exclusion list
  • All 4 hook handlers (context, observation, session-init, summarize) check both mechanisms
  • Symlink resolution for accurate path matching (e.g., macOS /tmp/private/tmp)
  • Subdirectory matching (excluding /foo also excludes /foo/bar)

Changed Files

  • src/utils/project-filter.tsisProjectExcluded enhanced with symlink resolution + subdirectory matching, new isProjectLocallyDisabled
  • src/utils/repo-exclude-utils.ts — new utility for addToExcluded/removeFromExcluded
  • src/cli/handlers/context.ts — early exit for excluded/disabled projects
  • src/cli/handlers/observation.ts — early exit for locally disabled projects
  • src/cli/handlers/session-init.ts — early exit for locally disabled projects
  • src/cli/handlers/summarize.ts — early exit for excluded/disabled projects
  • src/services/worker-service.tsdisable/enable CLI commands

Test plan

  • touch .claude-mem-disable in a repo → verify all hooks skip processing
  • rm .claude-mem-disable → verify hooks resume
  • Run disable /path/to/repo → verify added to settings
  • Run enable /path/to/repo → verify removed from settings
  • Test with symlinked paths (e.g., /tmp/test-repo)
  • Test subdirectory exclusion (exclude parent, child also excluded)

- Added `isProjectExcluded` and `isProjectLocallyDisabled` checks to context, observation, session initialization, and summarization handlers to skip processing for excluded or locally disabled projects.
- Introduced utility functions for managing project exclusion in `repo-exclude-utils.ts`.
- Updated tests to cover new functionality for project exclusion and local disable checks.
- Updated `project-filter.ts` to include `realpathSync` for resolving symlinks in project paths, ensuring accurate path handling on systems like macOS.
- Enhanced `isProjectExcluded` function to support exclusion patterns that match subdirectories, improving project exclusion logic.
- Added comments for clarity on new functionality and path normalization processes.
# Conflicts:
#	plugin/scripts/mcp-server.cjs
#	plugin/scripts/worker-service.cjs
#	plugin/ui/viewer-bundle.js
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ffa845a0fe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}

case 'disable': {
const repoPath = process.argv[3] || process.cwd();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Normalize repo path before persisting disable entry

The command stores process.argv[3] verbatim, so claude-mem disable . (or any relative path) writes a context-dependent pattern. Later, isProjectExcluded() resolves non-glob patterns relative to each hook process cwd, which can make the same saved entry match different projects and also makes enable unreliable unless invoked from the same directory. Persisting an absolute normalized path avoids these false exclusions.

Useful? React with 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: per-project disable/exclude functionality

1 participant