Merge PR #644: handle non-string values in memory consolidation
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
⚡️ Delivers core agent functionality in just **~4,000** lines of code — **99% smaller** than Clawdbot's 430k+ lines.
|
||||
|
||||
📏 Real-time line count: **3,761 lines** (run `bash core_agent_lines.sh` to verify anytime)
|
||||
📏 Real-time line count: **3,781 lines** (run `bash core_agent_lines.sh` to verify anytime)
|
||||
|
||||
## 📢 News
|
||||
|
||||
|
||||
@@ -451,6 +451,14 @@ class AgentLoop:
|
||||
## Conversation to Process
|
||||
{conversation}
|
||||
|
||||
**IMPORTANT**: Both values MUST be strings, not objects or arrays.
|
||||
|
||||
Example:
|
||||
{{
|
||||
"history_entry": "[2026-02-14 22:50] User asked about...",
|
||||
"memory_update": "- Host: HARRYBOOK-T14P\n- Name: Nado"
|
||||
}}
|
||||
|
||||
Respond with ONLY valid JSON, no markdown fences."""
|
||||
|
||||
try:
|
||||
@@ -473,8 +481,14 @@ Respond with ONLY valid JSON, no markdown fences."""
|
||||
return
|
||||
|
||||
if entry := result.get("history_entry"):
|
||||
# Defensive: ensure entry is a string (LLM may return dict)
|
||||
if not isinstance(entry, str):
|
||||
entry = json.dumps(entry, ensure_ascii=False)
|
||||
memory.append_history(entry)
|
||||
if update := result.get("memory_update"):
|
||||
# Defensive: ensure update is a string
|
||||
if not isinstance(update, str):
|
||||
update = json.dumps(update, ensure_ascii=False)
|
||||
if update != current_memory:
|
||||
memory.write_long_term(update)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user