mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-08-31 08:13:11 +03:00
refactor(memory): require archive count in prompt
This commit is contained in:
@@ -1,10 +1,6 @@
|
|||||||
{% if archive_count is defined %}
|
|
||||||
Create a memory overview for only the final {{ archive_count }} conversation messages immediately before this instruction. Earlier messages are context for resolving references; do not summarize them again.
|
Create a memory overview for only the final {{ archive_count }} conversation messages immediately before this instruction. Earlier messages are context for resolving references; do not summarize them again.
|
||||||
|
|
||||||
Do not call tools. Return only the overview, following these memory rules:
|
Do not call tools. Return only the overview, following these memory rules:
|
||||||
{% else %}
|
|
||||||
Extract key facts from this conversation. For each fact, annotate its memory attributes.
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
Only SNIP facts deserve a non-[skip] mark:
|
Only SNIP facts deserve a non-[skip] mark:
|
||||||
- Signal: would the user need to repeat this if forgotten?
|
- Signal: would the user need to repeat this if forgotten?
|
||||||
|
|||||||
@@ -233,9 +233,10 @@ class TestConsolidatorSummarize:
|
|||||||
|
|
||||||
class TestConsolidatorPromptContract:
|
class TestConsolidatorPromptContract:
|
||||||
def test_archive_prompt_outputs_attribute_tags_without_missing_context_claims(self):
|
def test_archive_prompt_outputs_attribute_tags_without_missing_context_claims(self):
|
||||||
prompt = render_template("agent/consolidator_archive.md", strip=True)
|
prompt = render_template("agent/consolidator_archive.md", strip=True, archive_count=4)
|
||||||
|
|
||||||
assert "SNIP" in prompt
|
assert "SNIP" in prompt
|
||||||
|
assert "final 4 conversation messages" in prompt
|
||||||
for mark in ("[permanent]", "[durable]", "[ephemeral]", "[correction]", "[skip]"):
|
for mark in ("[permanent]", "[durable]", "[ephemeral]", "[correction]", "[skip]"):
|
||||||
assert mark in prompt
|
assert mark in prompt
|
||||||
assert "check context below" not in prompt.lower()
|
assert "check context below" not in prompt.lower()
|
||||||
|
|||||||
Reference in New Issue
Block a user