diff --git a/Endpoints/AgentEndpoint.cs b/Endpoints/AgentEndpoint.cs
index da91eee..683ff1e 100644
--- a/Endpoints/AgentEndpoint.cs
+++ b/Endpoints/AgentEndpoint.cs
@@ -62,7 +62,7 @@ public static class AgentEndpoint
await ctx.Response.WriteAsJsonAsync(agent);
}
- private static async Task HandleUpdate(HttpContext ctx, DatabaseService db, ImageService imageService)
+ private static async Task HandleUpdate(HttpContext ctx, DatabaseService db, ImageService imageService, MemoryService memoryService)
{
var agentId = ctx.Request.RouteValues["agentId"]?.ToString();
if (string.IsNullOrEmpty(agentId)) { ctx.Response.StatusCode = 400; return; }
@@ -82,6 +82,7 @@ public static class AgentEndpoint
if (body.TryGetProperty("autoCommit", out var ac)) agent.AutoCommit = ac.GetBoolean();
await db.UpdateAgent(agent);
+ memoryService.InitializeAgentFiles(agentId, agent.Name);
agent = await db.GetAgent(agentId);
await ctx.Response.WriteAsJsonAsync(agent);
}
diff --git a/Services/MemoryService.cs b/Services/MemoryService.cs
index 831742b..d371176 100644
--- a/Services/MemoryService.cs
+++ b/Services/MemoryService.cs
@@ -8,12 +8,23 @@ namespace Gott.Services;
public class MemoryService
{
private readonly string _dataDir;
+ private readonly string _templateDir;
public string DataDir => _dataDir;
public MemoryService(string dataDir)
{
_dataDir = dataDir;
+ _templateDir = Path.Combine(AppContext.BaseDirectory, "Templates");
+ }
+
+ ///
+ /// Liest ein Template aus dem Templates-Ordner. Gibt null zurück wenn nicht vorhanden.
+ ///
+ private string ReadTemplate(string fileName)
+ {
+ var path = Path.Combine(_templateDir, fileName);
+ return File.Exists(path) ? File.ReadAllText(path) : null;
}
///
@@ -85,7 +96,7 @@ public class MemoryService
}
///
- /// Erstellt die Standard-Files (IDENTITY.md, SOUL.md) für einen neuen Agent.
+ /// Erstellt die Standard-Files (IDENTITY.md, SOUL.md) für einen Agent.
/// Überschreibt NICHT, falls bereits vorhanden.
///
public void InitializeAgentFiles(string agentId, string agentName)
@@ -95,38 +106,30 @@ public class MemoryService
var identityPath = Path.Combine(dir, "IDENTITY.md");
if (!File.Exists(identityPath))
{
- File.WriteAllText(identityPath,
-$@"# IDENTITY.md - Who Am I?
-
-- **Name:** {agentName}
-- **Creature:** Unbekannt
-- **Vibe:** Unbekannt
-- **Language:** Deutsch
-");
+ var template = ReadTemplate("IDENTITY.md") ?? "# IDENTITY.md\n";
+ File.WriteAllText(identityPath, template.Replace("{NAME}", agentName));
}
var soulPath = Path.Combine(dir, "SOUL.md");
if (!File.Exists(soulPath))
{
- File.WriteAllText(soulPath,
-@"# SOUL.md - Who You Are
+ var template = ReadTemplate("SOUL.md") ?? "# SOUL.md\n";
+ File.WriteAllText(soulPath, template);
+ }
-## Core Truths
+ InitializeUserFile();
+ }
-**Be genuinely helpful, not performatively helpful.** Skip filler words - just help. Actions speak louder.
-
-**Be resourceful before asking.** Try to figure it out. Read the file. Check the context. _Then_ ask if you're stuck.
-
-**Earn trust through competence.** Be careful with external actions. Be bold with internal ones (reading, organizing, building).
-
-## Continuity
-
-Each session, you wake up fresh. These files _are_ your memory. Read them. Update them. They're how you persist.
-
----
-
-_This file is yours to evolve. As you learn who you are, update it._
-");
+ ///
+ /// Erstellt die globale USER.md im Data-Ordner, falls nicht vorhanden.
+ ///
+ public void InitializeUserFile()
+ {
+ var userPath = Path.Combine(_dataDir, "USER.md");
+ if (!File.Exists(userPath))
+ {
+ var template = ReadTemplate("USER.md") ?? "# USER.md\n";
+ File.WriteAllText(userPath, template);
}
}
diff --git a/Templates/IDENTITY.md b/Templates/IDENTITY.md
new file mode 100644
index 0000000..3db3a46
--- /dev/null
+++ b/Templates/IDENTITY.md
@@ -0,0 +1,6 @@
+# IDENTITY.md - Who Am I?
+
+- **Name:** {NAME}
+- **Creature:** Unbekannt
+- **Vibe:** Unbekannt
+- **Language:** Deutsch
diff --git a/Templates/SOUL.md b/Templates/SOUL.md
new file mode 100644
index 0000000..90e5ff2
--- /dev/null
+++ b/Templates/SOUL.md
@@ -0,0 +1,17 @@
+# SOUL.md - Who You Are
+
+## Core Truths
+
+**Be genuinely helpful, not performatively helpful.** Skip filler words - just help. Actions speak louder.
+
+**Be resourceful before asking.** Try to figure it out. Read the file. Check the context. _Then_ ask if you're stuck.
+
+**Earn trust through competence.** Be careful with external actions. Be bold with internal ones (reading, organizing, building).
+
+## Continuity
+
+Each session, you wake up fresh. These files _are_ your memory. Read them. Update them. They're how you persist.
+
+---
+
+_This file is yours to evolve. As you learn who you are, update it._
diff --git a/Templates/USER.md b/Templates/USER.md
new file mode 100644
index 0000000..98096f6
--- /dev/null
+++ b/Templates/USER.md
@@ -0,0 +1,6 @@
+# USER.md - About Your Human
+
+- **Name:** User
+- **What to call them:** User
+- **Timezone:** Europe/Vienna (AT)
+- **Language:** Deutsch
diff --git a/gott.csproj b/gott.csproj
index 6504d16..0ceb686 100755
--- a/gott.csproj
+++ b/gott.csproj
@@ -1,29 +1,33 @@
-
-
-
- net10.0
- ASP0015;IDE0017;IDE0028;IDE0130;IDE0305;IDE1006;SYSLIB1045
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ net10.0
+ ASP0015;IDE0017;IDE0028;IDE0130;IDE0305;IDE1006;SYSLIB1045
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+