fix(agent): trim redundant system prompt context

This commit is contained in:
chengyongru authored and chengyongru committed 2026-10-16 00:01:24 +08:00
1 parent 841d2b880c
commit 32f5cc76a4
6 files changed
+11 -19

No files matched your search

+2 -2
View File
@@ -270,7 +270,7 @@ def test_template_memory_md_is_skipped(tmp_path) -> None:
builder = ContextBuilder(workspace)
prompt = builder.build_system_prompt()
assert "## Long-term Memory" not in prompt
assert "# Long-term Memory" not in prompt
assert "History log: memory/history.jsonl" in prompt
assert "This file is automatically updated by nanobot" not in prompt
@@ -297,6 +297,6 @@ def test_customized_memory_md_is_injected(tmp_path, monkeypatch) -> None:
monkeypatch.setattr(builder.memory, "read_memory", tracked_read_memory)
prompt = builder.build_system_prompt()
assert "# Memory\n\n## Long-term Memory" in prompt
assert prompt.count("# Long-term Memory") == 1
assert "User prefers dark mode" in prompt
assert calls == 1
+2 -2
View File
@@ -530,7 +530,7 @@ def test_prompt_reads_skills_once_and_refreshes_on_next_build(
monkeypatch.setattr("nanobot.agent.skills.shutil.which", which)
first = build_prompt()
assert "First instructions" in first
assert "unavailable: CLI: prompt-test-cli" in first
assert "**beta**" not in first
assert discoveries == 1
assert all(reads.count(path) == 1 for path in documents)
assert len(parses) == len(documents)
@@ -546,7 +546,7 @@ def test_prompt_reads_skills_once_and_refreshes_on_next_build(
second = build_prompt()
assert "Updated instructions" in second and "First instructions" not in second
assert "Updated description" in second
assert "unavailable: CLI: prompt-test-cli" not in second
assert "**beta**" in second
assert "**gamma**" in second
assert discoveries == 2
assert all(reads.count(path) == 1 for path in documents)