From cc07ac1e12ba64b1646b4749bd46ebf5ae415bd1 Mon Sep 17 00:00:00 2001 From: chengyongru Date: Wed, 19 Aug 2026 17:11:50 +0800 Subject: [PATCH] fix(memory): avoid re-archiving recent history --- nanobot/templates/agent/consolidator_archive.md | 2 ++ tests/agent/test_consolidator.py | 1 + 2 files changed, 3 insertions(+) diff --git a/nanobot/templates/agent/consolidator_archive.md b/nanobot/templates/agent/consolidator_archive.md index 488be5c9b..48d96ef1c 100644 --- a/nanobot/templates/agent/consolidator_archive.md +++ b/nanobot/templates/agent/consolidator_archive.md @@ -20,6 +20,8 @@ Marks (choose the best match): Priority: user corrections and preferences > solutions > decisions > events > environment facts. The most valuable memory prevents the user from having to repeat themselves. +Do not output facts already present in the system prompt's Recent History. Those facts have already been archived. + Do not mark something [skip] merely because it might already exist in long-term memory; Dream handles cross-file deduplication later. Output concise bullet points only. No preamble, no commentary. diff --git a/tests/agent/test_consolidator.py b/tests/agent/test_consolidator.py index 5c08a1c5d..83558c09e 100644 --- a/tests/agent/test_consolidator.py +++ b/tests/agent/test_consolidator.py @@ -240,6 +240,7 @@ class TestConsolidatorPromptContract: for mark in ("[permanent]", "[durable]", "[ephemeral]", "[correction]", "[skip]"): assert mark in prompt assert "check context below" not in prompt.lower() + assert "Do not output facts already present in the system prompt's Recent History" in prompt assert "Do not mark something [skip] merely because it might already exist" in prompt class TestConsolidatorArchiveErrorHandling: