Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cron/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ def create_job(
workdir: Optional[str] = None,
profile: Optional[str] = None,
no_agent: bool = False,
memory_enabled: bool = False,
) -> Dict[str, Any]:
"""
Create a new cron job.
Expand Down Expand Up @@ -595,6 +596,11 @@ def create_job(
and deliver its stdout directly. Empty stdout = silent (no
delivery). Requires ``script`` to be set. Ideal for classic
watchdogs and periodic alerts that don't need LLM reasoning.
memory_enabled: When True, the cron job agent can access the memory
system (holographic memory, fact_store, memory tool). Default
False β€” cron system prompts could previously corrupt user
memory representations. Opt in per job when the job needs
to read/write memory (e.g. nightly fact-mining jobs).

Returns:
The created job dict
Expand Down Expand Up @@ -684,6 +690,7 @@ def create_job(
"enabled_toolsets": normalized_toolsets,
"workdir": normalized_workdir,
"profile": normalized_profile,
"memory_enabled": bool(memory_enabled),
}

jobs = load_jobs()
Expand Down
2 changes: 1 addition & 1 deletion cron/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,7 @@ def _run_job_impl(job: dict) -> tuple[bool, str, str, Optional[str]]:
# Without a workdir, keep cwd context discovery disabled.
skip_context_files=not bool(_job_workdir),
load_soul_identity=True,
skip_memory=True, # Cron system prompts would corrupt user representations
skip_memory=not job.get("memory_enabled", False), # Opt-in per job; cron prompts could corrupt memory
platform="cron",
session_id=_cron_session_id,
session_db=_session_db,
Expand Down
4 changes: 4 additions & 0 deletions tools/cronjob_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ def cronjob(
workdir: Optional[str] = None,
profile: Optional[str] = None,
no_agent: Optional[bool] = None,
memory_enabled: Optional[bool] = None,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this Python parameter alone does not expose it to the model: CRONJOB_SCHEMA currently has no memory_enabled property and the registered handler does not forward it to cronjob (tools/cronjob_tools.py:989-1144). Please add both wiring points and a regression test.

task_id: str = None,
) -> str:
"""Unified cron job management tool."""
Expand Down Expand Up @@ -506,6 +507,7 @@ def cronjob(
workdir=_normalize_optional_job_value(workdir),
profile=_normalize_optional_job_value(profile),
no_agent=_no_agent,
memory_enabled=bool(memory_enabled) if memory_enabled is not None else False,
)
return json.dumps(
{
Expand Down Expand Up @@ -615,6 +617,8 @@ def cronjob(
if script_error:
return tool_error(script_error, success=False)
updates["script"] = _normalize_optional_job_value(script) if script else None
if memory_enabled is not None:
updates["memory_enabled"] = bool(memory_enabled)
if context_from is not None:
# Empty string / empty list clears the field; otherwise validate
# each referenced job exists before storing. Normalized to a list
Expand Down
Loading