The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(insights): open the session store read-only
B0ond680d66998c6
diff --git a/hermes_cli/cli_info_mixin.py b/hermes_cli/cli_info_mixin.pyindex 7ff260fdfe4..afd9d6a75aa 100644--- a/hermes_cli/cli_info_mixin.py+++ b/hermes_cli/cli_info_mixin.py@@ -774,7 +774,7 @@ class CLIInfoMixin:try:from hermes_state import SessionDBfrom agent.insights import InsightsEngine- db = SessionDB()+ db = SessionDB(read_only=True)try:engine = InsightsEngine(db)print(engine.format_terminal(engine.generate(days=days, source=source)))diff --git a/hermes_cli/main_agent_cmds.py b/hermes_cli/main_agent_cmds.pyindex 1b5264703b4..3239a4e570d 100644--- a/hermes_cli/main_agent_cmds.py+++ b/hermes_cli/main_agent_cmds.py@@ -107,7 +107,7 @@ def cmd_insights(args):try:from hermes_state import SessionDBfrom agent.insights import InsightsEngine- db = SessionDB()+ db = SessionDB(read_only=True)engine = InsightsEngine(db)report = engine.generate(days=args.days, source=args.source)print(engine.format_terminal(report))diff --git a/tests/hermes_cli/test_cli_insights_command.py b/tests/hermes_cli/test_cli_insights_command.pyindex dea3e094a26..dfdfa1d67ee 100644--- a/tests/hermes_cli/test_cli_insights_command.py+++ b/tests/hermes_cli/test_cli_insights_command.py@@ -45,6 +45,26 @@ def test_cli_insights_keeps_days_flag_and_source(capsys):assert "days=14 source=discord" in capsys.readouterr().out+def test_show_insights_opens_read_only():+ cli_obj = HermesCLI.__new__(HermesCLI)+ db = MagicMock()+ with patch("hermes_state.SessionDB", return_value=db) as ctor, \+ patch("agent.insights.InsightsEngine", _InsightsEngineStub):+ _InsightsEngineStub.calls = []+ cli_obj._show_insights("/insights 7")+ ctor.assert_called_once_with(read_only=True)+ db.close.assert_called_once()+++def test_subcommand_insights_opens_read_only():+ db = MagicMock()+ with patch("hermes_state.SessionDB", return_value=db) as ctor, \+ patch("agent.insights.InsightsEngine", _InsightsEngineStub):+ cmd_insights(SimpleNamespace(days=30, source=None))+ ctor.assert_called_once_with(read_only=True)+ db.close.assert_called_once()++def test_subcommand_insights_closes_database_when_generation_fails(capsys):db = MagicMock()with patch("hermes_state.SessionDB", return_value=db), \