feat: add consolidation script (Phase 2) — sleep replay via Hermes cron - #21
Merged
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.
Summary
Phase 2: the consolidation scheduler — the brain's "sleep replay" cycle. The
Hippocampuscoordinator already hadrun_consolidation()andextract_schemas()from Phase 1, but nothing called them. Now there's an entry point.What Changed
New:
scripts/consolidate.pyA standalone script that connects to FalkorDB directly and runs the offline hippocampus batch:
--schemasflag) — neocortical slow learning--pruneflag) — entities below forgetting curve threshold (report only, does not delete)Prints a JSON summary to stdout. Exit 0 on success, 1 on error.
Design decision: standalone script, not a daemon
No internal scheduler thread, no second event loop, no daemon. Hermes cron's no-agent mode runs the script on a schedule — that's the "what triggers background work" mechanism. The
consolidation_interval_hoursconfig value (default: 6.0) is a recommendation for the cron cadence.Skipped: plugin CLI registration (
hermes synapse consolidate). Requires plugin directory setup — standalone script works now without it. Add when the plugin directory structure is formalized.Updated:
docs/hippocampus.mdReplaced the "future feature" placeholder with actual usage instructions (cron setup + manual commands + what-it-does table).
Updated:
README.mdscripts/consolidate.py(was "Phase 2")scripts/consolidate.pyTest Results
ruff check src/ tests/ scripts/— all checks passedNew tests (
test_consolidate.py)_age_dayswith valid timestamp, empty string, invalid timestamp--helpexits 0