Skip to content

refactor: standardize Redis key and index naming to dash convention#168

Draft
bsbodden wants to merge 3 commits intomainfrom
fix/standardize-redis-key-naming-to-dash-convention
Draft

refactor: standardize Redis key and index naming to dash convention#168
bsbodden wants to merge 3 commits intomainfrom
fix/standardize-redis-key-naming-to-dash-convention

Conversation

@bsbodden
Copy link
Collaborator

@bsbodden bsbodden commented Feb 25, 2026

Summary

  • Rename all Redis key prefixes and index names from underscores to dashes (memory_idxmemory-idx, working_memoryworking-memory, auth_tokenauth-token, etc.) to align with RedisVL conventions
  • Add migrate_redis_key_naming_4() migration function that uses SCAN+RENAME in batched pipelines and drops old indexes without data loss
  • Add agent-memory migrate-redis-naming CLI command with --dry-run and --batch-size flags, plus automatic index rebuild after migration
  • Update all tests, documentation, and notebook references to use the new naming

Closes #39

Status 🔔

‼️‼️ Pending upstream decision on API

Test plan

  • uv run ruff check — all clean
  • uv run ruff format — all clean
  • uv run pre-commit run --all-files — all hooks pass
  • uv run pytest — 703 tests pass, 0 failures
  • agent-memory migrate-redis-naming --help — CLI command works
  • Run agent-memory migrate-redis-naming --dry-run against a Redis instance with old-format keys
  • Run agent-memory migrate-redis-naming against a Redis instance with old-format keys and verify keys are renamed
  • Start server and verify index names are memory-records and working-memory-idx

Copilot AI review requested due to automatic review settings February 25, 2026 22:38
)

Rename all Redis key prefixes and index names from underscores to dashes
to align with RedisVL conventions. Add migration CLI command for existing
installations to rename keys in-place without data loss.
@bsbodden bsbodden force-pushed the fix/standardize-redis-key-naming-to-dash-convention branch from c425fde to fab34ea Compare February 25, 2026 22:39
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. Found one critical issue with the migration logic that could cause data loss.

@jit-ci
Copy link

jit-ci bot commented Feb 25, 2026

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ 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.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@bsbodden bsbodden marked this pull request as draft February 26, 2026 14:08
@bsbodden bsbodden self-assigned this Feb 26, 2026
- 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)
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.

Standardize Redis Key and Index Naming to Use Consistent Dash (-) Convention

2 participants