simplification and further memory decoupling

This commit is contained in:
Alessandro 2026-02-15 02:51:11 +01:00
parent e548bf257b
commit e18efbb115
40 changed files with 273 additions and 923 deletions

View file

@ -1,27 +0,0 @@
from datetime import datetime
from python.helpers.extension import Extension
from agent import Agent, LoopData
from python.helpers import files
from python.helpers.plugins import import_plugin_module
memory = import_plugin_module("memory", "helpers/memory.py")
class BehaviourPrompt(Extension):
async def execute(self, system_prompt: list[str]=[], loop_data: LoopData = LoopData(), **kwargs):
prompt = read_rules(self.agent)
system_prompt.insert(0, prompt) #.append(prompt)
def get_custom_rules_file(agent: Agent):
return files.get_abs_path(memory.get_memory_subdir_abs(agent), "behaviour.md")
def read_rules(agent: Agent):
rules_file = get_custom_rules_file(agent)
if files.exists(rules_file):
rules = files.read_file(rules_file) # no includes and vars here, that could crash
return agent.read_prompt("agent.system.behaviour.md", rules=rules)
else:
rules = agent.read_prompt("agent.system.behaviour_default.md")
return agent.read_prompt("agent.system.behaviour.md", rules=rules)