Templates aus externen Dateien laden, globale USER.md generieren
- Templates/IDENTITY.md, SOUL.md, USER.md als externe Template-Dateien - gott.csproj: Templates werden beim Publish mitkopiert - MemoryService: ReadTemplate() liest aus Templates-Ordner - InitializeAgentFiles: nutzt Templates statt Inline-Strings - InitializeUserFile: erstellt globale USER.md in data/ - AgentEndpoint: HandleUpdate initialisiert fehlende Files beim Speichern
This commit is contained in:
1 parent
96af4a3421
commit
d067517252
6 files changed
+93
-56
No files matched your search
+29
-26
@@ -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");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Liest ein Template aus dem Templates-Ordner. Gibt null zurück wenn nicht vorhanden.
|
||||
/// </summary>
|
||||
private string ReadTemplate(string fileName)
|
||||
{
|
||||
var path = Path.Combine(_templateDir, fileName);
|
||||
return File.Exists(path) ? File.ReadAllText(path) : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -85,7 +96,7 @@ public class MemoryService
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
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._
|
||||
");
|
||||
/// <summary>
|
||||
/// Erstellt die globale USER.md im Data-Ordner, falls nicht vorhanden.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user