hermes - 💡(How to fix) Fix weekly_maintenance.py hardcodes ~/.hermes path, breaking profiles [1 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Fix Action

Fixed

Code Example

HERMES_HOME = os.path.expanduser("~")
STATE_DB = os.path.join(HERMES_HOME, ".hermes", "state.db")

---

import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent / "hermes-agent"))
from hermes_constants import get_hermes_home

_HERMES_HOME = get_hermes_home()
STATE_DB = str(_HERMES_HOME / "state.db")
LCM_DB = str(_HERMES_HOME / "lcm.db")
SNAPSHOTS_DIR = str(_HERMES_HOME / "state-snapshots")
LOGS_DIR = str(_HERMES_HOME / "logs")
RAW_BUFFERClick to expand / collapse

Problem

~/.hermes/scripts/weekly_maintenance.py (line 15) constructs all database paths using a hardcoded home-directory approach:

HERMES_HOME = os.path.expanduser("~")
STATE_DB = os.path.join(HERMES_HOME, ".hermes", "state.db")

This violates the documented critical rule: "Every path to Hermes state MUST use get_hermes_home() from hermes_constants, never Path.home() / ".hermes"."

When a non-default profile is active (e.g. hermes -p work), get_hermes_home() returns a different directory. The maintenance script ignores the active profile and always operates on ~/.hermes/state.db — silently vacuuming the wrong database and leaving the active profile's database unmaintained.

Suggested Fix

Replace lines 15–19 with a get_hermes_home()-based approach (same pattern as ~/.hermes/wal_fix.py):

import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent / "hermes-agent"))
from hermes_constants import get_hermes_home

_HERMES_HOME = get_hermes_home()
STATE_DB = str(_HERMES_HOME / "state.db")
LCM_DB = str(_HERMES_HOME / "lcm.db")
SNAPSHOTS_DIR = str(_HERMES_HOME / "state-snapshots")
LOGS_DIR = str(_HERMES_HOME / "logs")

This is a 5-line change and matches the existing pattern in wal_fix.py in the same directory.

Impact

Any user running Hermes with a non-default profile who relies on weekly_maintenance.py for database maintenance (VACUUM, WAL truncation, log cleanup) gets silently no-op'd on their active profile.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix weekly_maintenance.py hardcodes ~/.hermes path, breaking profiles [1 pull requests]