feat: add pluggable config layers and strategy registries#12
Merged
Sunnylincc merged 4 commits intomainfrom Mar 5, 2026
Merged
feat: add pluggable config layers and strategy registries#12Sunnylincc merged 4 commits intomainfrom
Sunnylincc merged 4 commits intomainfrom
Conversation
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.
Motivation
Evolve the existing flat configuration into a composable configuration layer to support separation and extensibility across runtime, storage, model, and router components.
Eliminate hard-coded strategy branches in the codebase (router/distill/storage/consolidation) and replace them with a plugin-style registry system to enable easier extension and implementation replacement.
Support configuration merging between environment variables and programmatic configuration, with clear precedence rules, and print the final effective configuration at startup for easier debugging.
Introduce configuration validation to detect invalid combinations early (e.g., mismatched embedder dimensions or SQLite limitations with very small embedding dimensions).
Description
Split HippoConfig into four layered dataclasses:
RuntimeConfig, StorageConfig, ModelConfig, and RouterConfig, while preserving compatibility accessors for legacy flat fields (e.g., db_path, embedding_dim, working_memory_turns).
(hippocortex/config.py)
Added merged() to combine environment-derived configuration (HippoConfig.from_env()) with code-provided configuration, where code configuration overrides environment values.
Added validate() to detect invalid configuration combinations.
(hippocortex/config.py)
Introduced a strategy registry module hippocortex/registry.py, providing registration and lookup interfaces for router/distill/storage/consolidation strategies.
Default implementations are registered (memory_v1, auto/heuristic/llm, memory/sqlite, replay_v1).
(hippocortex/registry.py)
Updated ReplayConsolidator to support configurable distill_strategy and strategy_name.
The distillation function is now resolved via the registry at runtime instead of being hard-coded.
(hippocortex/consolidation/replay.py)
Refactored HippoCortex initialization to construct semantic_store, router, and consolidator via the registry.
Added validation to ensure the embedder dimension matches the configured dimension, and print the final effective configuration during startup.
The default() method now uses HippoConfig.from_env().merged(config) to implement environment + code override logic.
(hippocortex/init.py)
Added and updated tests to cover the new features and validation logic, including a new test module tests/test_config_registry.py.
Existing tests were adjusted to work with the layered configuration API.
(tests/*)
Testing
Ran pytest -q; all tests passed: 14 passed.
Added unit tests in tests/test_config_registry.py covering:
Environment + code configuration merging
Invalid configuration combinations
Errors for unknown strategies
Existing tests related to semantic storage and working memory were also updated and passed, confirming that the registry and configuration migration remain backward-compatible with existing behavior.
Codex Task