fix(cron): allow cron jobs to use the memory() tool - #43368
fix(cron): allow cron jobs to use the memory() tool#43368ValentinSergief wants to merge 1 commit into
Conversation
Remove hardcoded skip_memory=True. The existing drift detector in tools/memory_tool.py already protects against format corruption. Cron needs memory access for health checks, memory pruning, and automated maintenance. Fixes NousResearch#43367.
|
Competing with #34098 (per-job |
Semantic corruption vs. file-level integrityThe PR argues that `_detect_external_drift()$ is "the real safety net" that replaces the need for `skip_memory=True`. This conflates two different classes of corruption: What `_detect_external_drift()$ protects against (file-level):
What it does NOT protect against (semantic):
All of these pass `_detect_external_drift()$ cleanly — the file format is correct, the entry size is within limits. But they pollute the user's `user` memory (which feeds the system prompt in every subsequent session). The original comment `# Cron system prompts would corrupt user representations$ was about this semantic class, not file-level corruption. Suggestion: Instead of flipping the global flag, consider a more targeted approach:
This lets memory-maintenance cron jobs work while protecting user representations from automated pollution. |
|
Thank you both for the thoughtful review — @liuhao1024's semantic-corruption point is exactly right, and @alt-glitch's cluster identification was spot-on. I'm closing this PR. A new implementation is being prepared that:
This addresses liuhao1024's concern about semantic pollution (writes blocked by default) while enabling the memory-awareness that #43367/#9763/#34094/#38647 all request. The new PR will link here. |
Problem
Cron jobs are hardcoded with
skip_memory=Trueat agent creation time, preventing thememory()tool from working in any cron job. The comment incron/scheduler.py:1801states: "Cron system prompts would corrupt user representations."This makes cron unable to perform its most natural automation tasks — memory health checks, periodic pruning, duplicate consolidation, or any scheduled maintenance that touches memory.
Analysis
The upstream concern ("corrupt user representations") is already addressed by existing safety mechanisms that work regardless of call context:
_detect_external_drift()tools/memory_tool.py:522.bak.<timestamp>before refusing the mutation.tools/memory_tool.py:578Cron is Hermes' automation surface — scheduled health checks, memory pruning, data maintenance, and cleanup tasks all need memory access. A cron job cannot write to memory spontaneously any more than a normal chat can: it requires an explicit tool call through
run_conversation(), governed by the same tool validation and drift detection.Fix
1 file, +1/−1. Replaces the hardcoded ban with
skip_memory=False, relying on the existing drift detector as the real safety net. Cron jobs that misuse memory will be caught and backed up like any other session.Cross-Platform
No platform-specific code. Pure configuration change at agent creation time.
Testing
memory()read works and write succeeds where intended_detect_external_drift()still catches and backs up malformed writesFixes #43367