refactor: standardize Redis key and index naming to dash convention#168
Draft
refactor: standardize Redis key and index naming to dash convention#168
Conversation
c425fde to
fab34ea
Compare
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
Switch from RENAME to RENAMENX so the migration is safe to run multiple times without overwriting already-renamed keys.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR standardizes Redis key prefixes and RediSearch/RedisVL index names from underscore (_) to dash (-) conventions across the server, migrations, CLI tooling, tests, and documentation—adding a dedicated migration path to rename existing keys and rebuild indexes.
Changes:
- Update Redis key/index naming conventions to dash-based forms (e.g.,
memory-idx:*,working-memory:*,memory-records,working-memory-idx). - Add migration 4 to SCAN+RENAME existing keys and drop legacy index names, plus a CLI command to run it (with dry-run).
- Update tests and docs/notebook references to match the new naming.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
agent_memory_server/config.py |
Updates default RedisVL and working-memory index naming to dash convention. |
agent_memory_server/utils/keys.py |
Updates key construction helpers to emit dash-based key prefixes. |
agent_memory_server/working_memory.py |
Updates migration status key names and scan pattern to new working-memory:* prefix. |
agent_memory_server/working_memory_index.py |
Updates working memory index docstring to reflect new prefix. |
agent_memory_server/migrations.py |
Adds migrate_redis_key_naming_4() to rename keys and drop legacy index names. |
agent_memory_server/cli.py |
Adds migrate-redis-naming CLI command to run migration 4 and rebuild indexes. |
agent_memory_server/memory_vector_db.py |
Updates comment to reflect new RedisVL index key prefix example. |
docs/configuration.md |
Updates documented env var defaults for new index name/prefix. |
examples/agent_memory_server_interactive_guide.ipynb |
Updates Redis key naming examples to dash convention (but includes one incorrect tool name). |
tests/test_working_memory.py |
Updates test cleanup scan patterns to working-memory:*. |
tests/test_token_auth.py |
Updates auth token key expectations to dash convention. |
tests/test_long_term_memory.py |
Updates memory index prefix expectation in assertions. |
tests/benchmarks/test_migration_benchmark.py |
Updates benchmark cleanup scan patterns to working-memory:*. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Validate batch_size >= 1 in migrate_redis_key_naming_4() and constrain CLI --batch-size with IntRange(min=1) - Fix misleading comment on migration_status_keys (they are skipped, not renamed) - Detect old working_memory:* keys in check_and_set_migration_status() and log a warning to run migrate-redis-naming - Fix incorrect tool name in notebook output (get_or_create_working-memory → get_or_create_working_memory)
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.
Summary
memory_idx→memory-idx,working_memory→working-memory,auth_token→auth-token, etc.) to align with RedisVL conventionsmigrate_redis_key_naming_4()migration function that uses SCAN+RENAME in batched pipelines and drops old indexes without data lossagent-memory migrate-redis-namingCLI command with--dry-runand--batch-sizeflags, plus automatic index rebuild after migrationCloses #39
Status 🔔
Test plan
uv run ruff check— all cleanuv run ruff format— all cleanuv run pre-commit run --all-files— all hooks passuv run pytest— 703 tests pass, 0 failuresagent-memory migrate-redis-naming --help— CLI command worksagent-memory migrate-redis-naming --dry-runagainst a Redis instance with old-format keysagent-memory migrate-redis-namingagainst a Redis instance with old-format keys and verify keys are renamedmemory-recordsandworking-memory-idx