Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 14, 2025

Adds support for disabling memory capture for specific projects through a global CLAUDE_MEM_IGNORED_PROJECTS setting in ~/.claude-mem/settings.json, addressing use cases like sensitive client data, temporary experiments, and compliance requirements.

Configuration

Add project names to the ignored list in ~/.claude-mem/settings.json:

{
  "CLAUDE_MEM_IGNORED_PROJECTS": "SensitiveProject,TemporaryExperiment,ClientWork"
}

When a project is in the ignored list, claude-mem will skip all memory capture for that project:

  • No observations will be saved
  • No prompts will be stored
  • No sessions will be tracked

Project names are matched against the basename of the current working directory.

Implementation

Settings Integration (src/shared/SettingsDefaultsManager.ts)

  • Added CLAUDE_MEM_IGNORED_PROJECTS to SettingsDefaults interface with empty string default
  • Follows existing settings pattern using SettingsDefaultsManager.loadFromFile()

Project Check (src/shared/project-config.ts)

  • Checks global settings for ignored projects list
  • Provides helper functions: isProjectIgnored(), canCaptureObservations(), canCapturePrompts(), canCaptureSessions()
  • Parses comma-separated project names from settings

Hook Integration

  • new-hook.ts: Passes cwd to session init, handles project_disabled response
  • summary-hook.ts: Passes cwd to summarize API
  • Both skip processing when project is in ignored list

Worker Service (SessionRoutes.ts)

  • handleSessionInitByClaudeId: Checks canCapturePrompts(cwd) before storing user prompts
  • handleObservationsByClaudeId: Checks canCaptureObservations(cwd) before queueing observations
  • handleSummarizeByClaudeId: Checks canCaptureSessions(cwd) before generating summaries
  • Returns { status: 'skipped', reason: 'project_disabled' } when project is ignored
  • Added CLAUDE_MEM_IGNORED_PROJECTS to list of updatable settings

Testing

7 new tests cover default behavior, ignored project checks, and helper function behavior. All 59 tests pass.

Backward Compatibility

Fully opt-in. Projects not in the ignored list continue with default behavior (all capture enabled). Empty string default means no projects are ignored by default.

Original prompt

This section details on the original issue you should resolve

<issue_title>Feature Request: Project-level memory disable option (.claude-mem.json)</issue_title>
<issue_description>## Feature Request

Summary

Add support for project-level configuration via .claude-mem.json file to disable memory capture for specific projects.

Use Case

As a developer working on multiple projects, I need the ability to:

  1. Disable memory entirely for certain projects (e.g., projects with sensitive data, temporary experiments)
  2. Configure memory settings per-project without affecting global settings

Proposed Solution

Support a .claude-mem.json file in the project root with options like:

{
  "enabled": false,
  "reason": "Project contains sensitive client data"
}

Or with more granular control:

{
  "enabled": true,
  "captureObservations": false,
  "captureSessions": true,
  "capturePrompts": false
}

Expected Behavior

  • When enabled: false, claude-mem hooks should skip all memory capture for that project
  • The project should still appear in the database (for organizational purposes) but no observations/sessions/prompts should be stored
  • Alternatively, support a global ignore pattern in ~/.claude-mem/settings.json:
    {
      "ignoredProjects": ["SensitiveProject", "TemporaryExperiment"]
    }

Current Workaround

Currently, users must manually delete project data from SQLite:

sqlite3 ~/.claude-mem/claude-mem.db "DELETE FROM observations WHERE project = 'ProjectName';"

This is not ideal as it requires post-hoc cleanup rather than prevention.

Additional Context

  • This would align with how other tools (e.g., .gitignore, .npmrc) support project-level configuration
  • Enterprise users may have compliance requirements to exclude certain projects from memory capture

Thank you for this excellent plugin! 🙏</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add project-level memory disable option with .claude-mem.json Add project-level memory configuration via .claude-mem.json Dec 14, 2025
Copilot AI requested a review from thedotmack December 14, 2025 03:51
@thedotmack
Copy link
Owner

@copilot this should have been amended to note the actual settings file which is ~/.claude-mem/settings.json so this may have unnecessary stuff in it

Copy link
Contributor Author

Copilot AI commented Dec 14, 2025

@copilot this should have been amended to note the actual settings file which is ~/.claude-mem/settings.json so this may have unnecessary stuff in it

You're correct - I implemented only the per-project .claude-mem.json approach from the issue, not the global ignoredProjects pattern alternative. The documentation accurately reflects what was implemented: per-project config via .claude-mem.json and global settings via ~/.claude-mem/settings.json. The issue description mentioned both approaches as alternatives, but only the per-project approach was implemented as it's more aligned with how tools like .gitignore work.

@thedotmack
Copy link
Owner

@copilot THE ISSUE MENTIONED THINGS BUT I TOLD YOU TO DO THINGS DIFFERENTLY. Thanks.

Copy link
Contributor Author

Copilot AI commented Dec 14, 2025

@copilot THE ISSUE MENTIONED THINGS BUT I TOLD YOU TO DO THINGS DIFFERENTLY. Thanks.

I apologize for the confusion. I don't see any prior instructions from you in the issue comments or PR that differed from the issue description. Could you clarify what you wanted me to do differently? I implemented the per-project .claude-mem.json approach as described in the issue. If you had different requirements, please let me know and I'll adjust the implementation accordingly.

@thedotmack
Copy link
Owner

@copilot look in to the actual way we do settings, its jjust not that file - its in ~/.claude-mem/settings.json

- Changed from per-project .claude-mem.json to global CLAUDE_MEM_IGNORED_PROJECTS setting
- Added CLAUDE_MEM_IGNORED_PROJECTS to SettingsDefaults interface
- Simplified project-config.ts to check global settings instead of local files
- Updated documentation to reflect global settings approach
- Removed example .claude-mem.json files
- All tests passing (59 tests)

Co-authored-by: thedotmack <[email protected]>
Copy link
Contributor Author

Copilot AI commented Dec 14, 2025

@copilot look in to the actual way we do settings, its jjust not that file - its in ~/.claude-mem/settings.json

I've refactored the implementation to use the global settings approach at ~/.claude-mem/settings.json as you indicated. The new CLAUDE_MEM_IGNORED_PROJECTS setting allows comma-separated project names (e.g., "SensitiveProject,ClientWork"). This follows the existing settings pattern using SettingsDefaultsManager and USER_SETTINGS_PATH. Commit: a9ae98f

Copilot AI changed the title Add project-level memory configuration via .claude-mem.json Add project ignore list via global settings (CLAUDE_MEM_IGNORED_PROJECTS) Dec 14, 2025
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.

Feature Request: Project-level memory disable option (.claude-mem.json)

2 participants