Repository navigation
feat: external data directory, layered config, and automatic git backup - #60
Merged
fdaviddpt merged 6 commits intoMay 24, 2026
Merged
Conversation
Adds opt-in external memory storage mode where REMEMBER_DIR relocates to
~/.remember/<slug>/ (or any absolute path), enabling version-controlled
personal memory backups outside project trees.
Key changes:
- scripts/lib-memory-dir.sh (new): resolves REMEMBER_DIR from data_dir config
and deep-merges config.json across three layers (plugin-bundled, user-global
~/.remember/config.json, per-project), so user config survives plugin updates
- scripts/bootstrap-dirs.sh: sources lib-memory-dir.sh; guards .gitignore write
to legacy (project-internal) mode only; auto-migrates legacy .remember/ on
first run, leaving a MIGRATED-TO.txt marker
- scripts/log.sh: deduplicated config() definition; sources lib-memory-dir.sh so
REMEMBER_LOG_DIR follows REMEMBER_DIR; removed duplicate REMEMBER_CONFIG line
- All entry-point scripts: source order fixed to detect-tools → bootstrap → log;
all ${PROJECT_DIR}/.remember literals replaced with $REMEMBER_DIR
- session-start-hook.sh: emits === HANDOFF === block with absolute path before
=== MEMORY ===; identity.md lookup now checks $REMEMBER_DIR/identity.md first
- pipeline/extract.py: _last_save_path() accepts remember_dir parameter (falls
back to REMEMBER_DIR env var); extract_session() and get_last_save_line() pass
it through
- pipeline/shell.py: cmd_extract() forwards REMEMBER_DIR env var to Python
- skills/remember/SKILL.md: uses HANDOFF path from session context instead of
hardcoded project-relative path
- config.example.json: documents {slug} placeholder and absolute/~ rules
- config.user.example.json (new): ready-to-use template for ~/.remember/config.json
- save-session.sh: 12h time format now uppercases %p for Linux locale portability
- tests: 3 new test files (test_external_data_dir, test_migration,
test_layered_config); updated test_extract and test_path_resolution for the
new semantics; 347 tests pass
…allback in lib-memory-dir.sh
User's ~/.remember/config.json (external mode) was bleeding into tests
that assert legacy project-relative REMEMBER_DIR. Two root causes:
1. lib-memory-dir.sh called session_dir_slug when detect-tools.sh
hadn't been sourced — now has an inline fallback to prevent a
silently empty slug.
2. TestFreshProjectBootstrap and related tests inherited the real HOME,
activating external mode. Fixed by setting HOME=tmp_path in each.
Adds hooks.d/after_save/50-git-backup.sh. When ~/.remember/ (or
data_dir's parent) is a git repo and not the project directory, the hook
commits the current project's slug subtree and pushes to the configured
remote after each successful save.
Key design decisions:
- Two-stage activation guard prevents memory commits landing in a
project's own git history (legacy mode check + toplevel check).
- Global cooldown (cooldowns.git_backup_seconds, default 900s) throttles
commits across all projects; clock resets only on actual commit.
- Global noclobber lock at <repo>/.git-backup.lock prevents concurrent
git index corruption; stale-PID lock is detected and taken over.
- All git work runs in a detached background subshell — save-session.sh
is never blocked.
- Per-slug .gitignore files containing only "*" (written by bootstrap in
legacy mode) are automatically removed on first run.
- Slug paths starting with "-" are handled via "git add --" to prevent
misinterpretation as flags.
- GIT_TERMINAL_PROMPT=0 on push ensures missing credentials fail fast.
Also: fix lib-memory-dir.sh double-source guard to use
${_LIB_MEMORY_DIR_LOADED:-} so scripts with set -u can source it safely.
Adds a middle tier in the identity resolution chain: per-project → <REMEMBER_ROOT>/identity.md → plugin-bundled Only active in external mode (skipped in legacy mode where REMEMBER_ROOT == PROJECT_DIR).
fdaviddpt
approved these changes
May 24, 2026
fdaviddpt
left a comment
Contributor
There was a problem hiding this comment.
Thanks for this — really solid contribution. Clean decomposition, tests are meaningful (real bare remote, lock contention with live PID, per-slug isolation), 358/0 passing at 99% coverage, backward compatibility preserved. Approving and merging.
A few follow-ups I'll file as issues (none blocking):
=== HANDOFF ===emitted in legacy mode — adds noise to every session prompt when the path is unchanged. Worth making conditional on external mode.--no-gpg-signsilently overrides user'scommit.gpgSign— should probably be configurable.- Push uses tracking branch implicitly — fine for
origin main, brittle for multi-remote setups. Worth documenting or making explicit. _comments/_purposekeys flow through the merged config — harmless today, could confuse future validation. Convention worth establishing (strip_-prefixed keys at merge).- README first-backup instructions —
git add .gitignore config.jsondoesn't include slug dirs, so first-time users won't see memory in the backup repo until the hook runs. Worth a one-liner clarifying.
Will tag you on the follow-up issues so you can pick any up if you'd like — no pressure.
This was referenced May 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #59
Summary
~/.remember/<slug>/(or any absolute path) instead of<project>/.remember/, keeping repos clean without per-project gitignore entries.~/.remember/config.json→ per-project override), so settings no longer need to be repeated across projects.hooks.d/after_save/50-git-backup.sh) that auto-commits memory after each save, with cooldown, locking, and per-project isolation.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.
Changes
New files
scripts/lib-memory-dir.sh—REMEMBER_DIRresolution + config mergehooks.d/after_save/50-git-backup.sh— async git backupconfig.user.example.json— template for user-global configtests/test_external_data_dir.py,tests/test_migration.py,tests/test_layered_config.py,tests/test_git_backup_hook.pyModified files
scripts/bootstrap-dirs.sh— auto-migration, gitignore guardscripts/session-start-hook.sh— identity tiers, handoff path signalling,REMEMBER_DIR-aware throughoutpipeline/extract.py,pipeline/shell.py— acceptREMEMBER_DIRparamskills/remember/SKILL.md— read=== HANDOFF ===block instead of hardcoded pathREADME.md,config.example.json— document new options