Repository navigation
Description
Problem
Two pain points with the current default setup:
- No user-global config — timezone, cooldowns, and feature toggles must be configured separately in every project's
config.json. There is no shared tier. - No backup — memory data is local-only. There is no built-in mechanism to preserve it.
A third, related friction point: .remember/ lives inside the project root, so every project needs a .gitignore entry to avoid committing memory files.
Proposed Solution
Three cooperating additions, all opt-in and backward-compatible.
1. External data directory
A data_dir config key controls where REMEMBER_DIR resolves:
{ "data_dir": "~/.remember/{slug}" }- Relative paths (default:
.remember) → legacy behaviour, unchanged. - Absolute or
~-prefixed paths → external, outside the project root. {slug}expands to the same project identifier Claude Code uses under~/.claude/projects/<slug>/, keeping memory project-scoped without manual naming.
When external mode is active, .gitignore is never written into the project root.
2. Layered config merge
Config is resolved from three tiers, with per-project winning:
| Tier | Path | Purpose |
|---|---|---|
| Plugin defaults | <plugin>/config.json |
Survives plugin updates |
| User-global | ~/.remember/config.json |
Set once, applies to all projects |
| Per-project | <REMEMBER_DIR>/config.json |
Override for specific projects |
3. Automatic git backup
When ~/.remember/ (or the external data dir's parent) is a git repo, each save triggers a background commit of only that project's slug subdirectory. Key properties:
- No-op in legacy mode — will not touch project files.
- No-op unless at the git toplevel.
- Configurable cooldown (
cooldowns.git_backup_seconds, default 900 s). - Global lock prevents concurrent git index corruption across multiple Claude sessions.
- Runs detached — never blocks
save-session.sh. - Push failures are logged and tolerated.
Limitations
The git backup is designed as a single-machine backup, not a sync mechanism. There is no pull or rebase before pushing — if another machine has pushed commits to the same remote, the push will fail with a non-fast-forward error and silently defer (indistinguishable from a network failure). Local commits accumulate safely, but the divergence must be resolved manually. Cross-machine sync is out of scope for this implementation.
Migration
On first run in external mode, if <project>/.remember/ exists and the external target does not, the directory is moved atomically and a MIGRATED-TO.txt breadcrumb is left in the old location. Idempotent on subsequent runs.
Implementation
A PR from codemedic:feature/external-data-dir is ready for review. It adds:
scripts/lib-memory-dir.sh— path resolution and config mergehooks.d/after_save/50-git-backup.sh— background git backup- 4 new test files (27 tests); total suite: 357 tests at 99%+ coverage
- Updated
README.mdandconfig.example.json; newconfig.user.example.jsontemplate
Activity