Skip to content

Add auto-detect and adaptive noise exclusions (tier 2 + 3)#30

Merged
CalebisGross merged 2 commits intomainfrom
feat/auto-detect-exclusions
Mar 1, 2026
Merged

Add auto-detect and adaptive noise exclusions (tier 2 + 3)#30
CalebisGross merged 2 commits intomainfrom
feat/auto-detect-exclusions

Conversation

@CalebisGross
Copy link
Copy Markdown
Collaborator

Summary

  • Tier 2: Auto-detect noisy apps at startup — Scans ~/.config/ and ~/.local/share/ (Linux) or ~/Library/ (macOS) for ~30 known noisy app directories (Chrome, VS Code, Slack, Discord, etc). Detected patterns are merged with config exclusions before watcher creation. Closes Auto-detect noisy app directories at first startup #27.
  • Tier 3: Adaptive learning from rejections — Tracks filesystem events rejected by the heuristic filter per path prefix. When a prefix hits 50 rejections within 1 hour, it's automatically promoted to a live watcher exclusion. Learned exclusions persist to ~/.mnemonic/learned-exclusions.txt and reload on restart. Closes Adaptive watcher exclusions: learn from repeated heuristic rejections #28.

Together with the static config defaults (tier 1, PR #26), this gives the system a 3-tier intelligent noise suppression pipeline that works out of the box for new users and adapts to each machine over time.

New files

  • internal/watcher/filesystem/autodetect.go — App registry + detection logic
  • internal/watcher/filesystem/autodetect_test.go — 3 tests
  • internal/agent/perception/rejection_tracker.go — Adaptive learning core
  • internal/agent/perception/rejection_tracker_test.go — 4 tests (prefix extraction, promotion threshold, cap, persistence)

Key changes

  • internal/watcher/watcher.go — Added ExcludableWatcher interface
  • internal/watcher/filesystem/watcher_other.goAddExclusion() + RLock on exclude pattern reads
  • internal/watcher/filesystem/watcher_darwin.go — Same as above for macOS
  • internal/agent/perception/agent.gopromoteExclusion method, rejection tracking on heuristic failures, load persisted exclusions at startup
  • internal/config/config.goLearnedExclusionsPath field with default ~/.mnemonic/learned-exclusions.txt
  • cmd/mnemonic/main.go — Wire auto-detect + learned exclusions path

Test plan

  • make test passes (all existing + 7 new tests)
  • make check passes (go fmt + go vet)
  • make build succeeds
  • Manual: Run daemon, verify auto-detected exclusions in startup logs
  • Manual: Verify learned exclusions file created after sustained noise from a new source

🤖 Generated with Claude Code

CalebisGross and others added 2 commits March 1, 2026 08:30
…sion)

Track filesystem events rejected by the heuristic filter per path prefix.
When a prefix (e.g. .config/Code/) hits 50 rejections within 1 hour, it
is automatically promoted to a watcher exclusion pattern. Learned exclusions
are persisted to ~/.mnemonic/learned-exclusions.txt and reloaded on restart.

- Add ExcludableWatcher interface for runtime exclusion additions
- Add AddExclusion() to both platform watchers with proper RWMutex locking
- Add rejection_tracker.go with prefix extraction, threshold promotion, persistence
- Wire promoteExclusion callback from perception agent to watchers
- Add LearnedExclusionsPath config field with path expansion
- Add 4 tests covering prefix extraction, promotion, cap, and persistence

Closes #28

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fixes golangci-lint unused function error in CI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@CalebisGross CalebisGross merged commit 998067c into main Mar 1, 2026
3 checks passed
@CalebisGross CalebisGross deleted the feat/auto-detect-exclusions branch March 1, 2026 13:36
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.

Adaptive watcher exclusions: learn from repeated heuristic rejections Auto-detect noisy app directories at first startup

1 participant