fix(memory): clarify Dream prompt write permissions (#5734)

* fix(memory): clarify Dream prompt write permissions

* refactor(memory): consolidate Dream prompt rules

* fix(memory): keep agent prompts focused on executable guidance

* fix(memory): limit cleanup to skill instructions
This commit is contained in:
chengyongru authored and GitHub committed 2026-09-11 16:47:34 +08:00
1 parent 3a5b84ce0d
commit 4e865b91ee
5 files changed
+53 -129

No files matched your search

+11 -4
View File
@@ -7,6 +7,8 @@ from datetime import datetime as real_datetime
from importlib.resources import files as pkg_files
from pathlib import Path
import pytest
from nanobot.agent.context import ContextBuilder
from nanobot.runtime_context import RuntimeContextBlock
@@ -71,15 +73,20 @@ def test_selected_project_path_follows_shared_cache_prefix(tmp_path) -> None:
assert prompt_a == builder.build_system_prompt(workspace=project_a)
def test_system_prompt_reflects_current_dream_memory_contract(tmp_path) -> None:
@pytest.mark.parametrize("selected_project", [False, True])
def test_system_prompt_reflects_current_dream_memory_contract(tmp_path, selected_project) -> None:
workspace = _make_workspace(tmp_path)
builder = ContextBuilder(workspace)
project = tmp_path / "project" if selected_project else workspace
project.mkdir(exist_ok=True)
prompt = builder.build_system_prompt()
prompt = builder.build_system_prompt(workspace=project)
assert "memory/history.jsonl" in prompt
assert "automatically managed by Dream" in prompt
assert "do not edit directly" in prompt
assert (
"Only Dream memory-consolidation tasks may edit the profile and long-term memory files "
"listed above."
) in prompt
def test_provider_context_appended_after_user_content(tmp_path) -> None:
+1 -2
View File
@@ -84,7 +84,6 @@ class TestBuildDreamPrompt:
assert result is not None
prompt, _ = result
assert prompt.startswith("Custom Dream prompt.")
assert "memory consolidation engine" not in prompt
assert "## Conversation History" in prompt
assert "keep this fact" in prompt
@@ -111,7 +110,7 @@ class TestBuildDreamPrompt:
assert result is not None
prompt, _ = result
assert "memory consolidation engine" in prompt
assert prompt.startswith(store.default_dream_prompt() + "\n\n## Conversation History\n")
def test_truncates_long_entries_at_1000_chars(self, store):
long_content = "x" * 2000