using System;
using System.Collections.Generic;
using RimWorld;
using Verse;
namespace WulaFallenEmpire.EventSystem.AI.Tools
{
public class Tool_RememberFact : AITool
{
public override string Name => "remember_fact";
public override string Description => "Stores a specific fact or piece of information into the AI's long-term memory for future retrieval.";
public override string UsageSchema => "Text content to rememberoptional_category";
public override string Execute(string args)
{
var argsDict = ParseXmlArgs(args);
if (!argsDict.TryGetValue("fact", out string fact) || string.IsNullOrWhiteSpace(fact))
{
return "Error: content is required.";
}
string category = argsDict.TryGetValue("category", out string cat) ? cat : "misc";
var memoryManager = Find.World?.GetComponent();
if (memoryManager == null)
{
return "Error: AIMemoryManager world component not found.";
}
var entry = memoryManager.AddMemory(fact, category);
if (entry != null)
{
return $"Success: Memory stored. ID: {entry.Id}";
}
else
{
return "Error: Failed to store memory.";
}
}
}
}