Repository navigation
fix(config): keep runtime state in HERMES_HOME/plugin-data/cronalytics - #11
Closed
HearthCore wants to merge 1 commit into
Closed
HearthCore wants to merge 1 commit into
HearthCore wants to merge 1 commit into
Conversation
Hermes hashes every file of a Python plugin member into its dependency stamp. facts.db, watermark.json and pending.jsonl written into the plugin directory changed that stamp on every write, so each hermes start rebuilt a full dependency environment (and snapshotted a live SQLite file). State now lives in the per-profile plugin-data directory (override with CRONALYTICS_DATA_DIR). Existing state is migrated once on load via the SQLite backup API and the legacy files are moved to legacy-<ts>/. Fixes #10
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.
Description
Moves the plugin's runtime state (
facts.db,watermark.json,pending.jsonl) out of the plugin code directory into Hermes' per-profile plugin data directory,~/.hermes/plugin-data/cronalytics/(the same location Hermes' ownPluginState.data_diruses). The base directory can be overridden withCRONALYTICS_DATA_DIR.Why: Hermes hashes every file of a Python plugin member into its dependency stamp (
pm/workspace.py::members_stamp). State written next to the code changed that stamp on every write, so eachhermesstart rebuilt a full dependency environment and snapshotted the live SQLite file into it (Hermes side: NousResearch/hermes-agent#122349).cronalytics/config.py: newDATA_DIR;FACT_DB,WATERMARK_FILE,PENDING_FILEderive from it. All consumers already read these throughconfig, so no other module changes.flock: the existing DB is copied with the SQLite backup API (consistent even with a live-wal), the JSON files are copied, then every legacy file is moved toDATA_DIR/legacy-<timestamp>/so the plugin directory holds code only. An existingDATA_DIRDB is never overwritten. Migration errors are logged and never block plugin load. Facts are derived fromstate.db, so anything a not-yet-restarted process writes meanwhile is recovered by the scanner.docs/,dev/, bundled skill reference), uninstall instructions now remove the data directory too, CHANGELOG entry under Unreleased.Running in production on a Linux install with 8 profiles: after the change,
pm.install.drift()stays{}across further cronalytics writes andhermesstarts no longer rebuild;cronalytics health --jsonreports the full migrated history.Fixes #10
Type of change
Checklist
python -m pytest tests/ -v --tb=short(155 passed, including 6 new intests/test_config_migration.py: paths, env override, migration + move-aside, existing data wins / idempotent reload, partial legacy state)ruff check .mypy cronalytics/ dashboard/plugin_api.py(1 error, pre-existing and unchanged onmaster:dashboard/plugin_api.py:100no-any-return)cd dashboard && node build.js(not run: no dashboard changes in this PR)docs/ordev/files reflect the changeCHECKPOINT.mdupdated with decisions and verification notes (rebase will drop it) (noCHECKPOINT.mdin the repo)master(orrelease/X.Yfor hotfixes)