fix(openclaw): avoid memory retain recursion (#362)
This commit is contained in:
parent
e408b7e072
commit
4f112101ac
3 changed files with 10 additions and 2 deletions
|
|
@ -59,6 +59,8 @@ The plugin will automatically:
|
|||
|
||||
**Auto-Recall:** Before each agent response, relevant memories are automatically injected into the context (up to 1024 tokens). The agent uses past context without needing to call tools.
|
||||
|
||||
**Feedback Loop Prevention:** The plugin automatically strips injected memory tags (`<hindsight_memories>`) before storing conversations. This prevents recalled memories from being re-extracted as new facts, which would cause exponential memory growth and duplicate entries.
|
||||
|
||||
Traditional memory systems give agents a `search_memory` tool - but models don't use it consistently. Auto-recall solves this by injecting memories automatically before every turn.
|
||||
|
||||
## Configuration
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@vectorize-io/hindsight-openclaw",
|
||||
"version": "0.4.7",
|
||||
"version": "0.4.10",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@vectorize-io/hindsight-openclaw",
|
||||
"version": "0.4.7",
|
||||
"version": "0.4.10",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"node-fetch": "^3.3.2"
|
||||
|
|
|
|||
|
|
@ -702,6 +702,12 @@ User message: ${prompt}
|
|||
.join('\n');
|
||||
}
|
||||
|
||||
// Strip plugin-injected memory tags to prevent feedback loop
|
||||
// Remove <hindsight_memories> blocks injected during before_agent_start
|
||||
content = content.replace(/<hindsight_memories>[\s\S]*?<\/hindsight_memories>/g, '');
|
||||
// Remove any <relevant_memories> blocks (legacy/alternative format)
|
||||
content = content.replace(/<relevant_memories>[\s\S]*?<\/relevant_memories>/g, '');
|
||||
|
||||
return `[role: ${role}]\n${content}\n[${role}:end]`;
|
||||
})
|
||||
.join('\n\n');
|
||||
|
|
|
|||
Loading…
Reference in a new issue