using System.Text;using Agent.Core.ToolCalling;using Lilith.Agent.SelfImprovement;namespace Lilith.Agent;public partial class Lilith{ /// <summary>Runs the self-improvement smoke pipeline without Ollama (backup → sandbox → generate → build → verify).</summary> public string RunSelfImprovementSmokePipeline() { if (Workspace is null) throw new InvalidOperationException("Workspace is required."); var spec = ToolSpecStore.Load(Workspace); if (!spec.IsComplete) { spec = new ToolSpecStore { ToolName = "ping_self", Description = "Ping-pong smoke test tool that returns pong", Category = "self", InvokeBody = "return \"pong\";", }; spec.Save(Workspace); } var registry = BuildToolRegistry(); var log = new StringBuilder(); log.AppendLine($"Using tool spec: {spec.ToolName} ({spec.Category})"); void Run(string toolName, string args = "{}") { if (!registry.TryInvoke(toolName, args, out string result)) result = $"Unknown tool: {toolName}"; log.AppendLine(); log.AppendLine($"[{toolName}]"); log.AppendLine(result); } Run("self_improve_backup_live"); Run("self_improve_create_sandbox"); Run("self_improve_generate_tool"); Run("self_improve_build_sandbox"); Run("self_improve_invoke_sandbox_tool"); Run("self_improve_verify_sandbox_tool"); string all = log.ToString(); log.AppendLine(); log.AppendLine(all.Contains("VERIFICATION PASSED", StringComparison.OrdinalIgnoreCase) && all.Contains("TOOL TEST PASSED", StringComparison.Ordinal) ? "SMOKE RESULT: PASS" : "SMOKE RESULT: FAIL"); return log.ToString(); }}
Documentation
Lilith self-improvement (Version 7+)
Lilith can extend herself only by creating tools in three categories:
| Category | Location | Examples | |----------|----------|----------| | Core | Agent-Core | Memory, time (rare; system-level) | | Addon | Agent-Addons | Weather, C# projects, apps | | Self | Lilith | Workspace files, self-improvement |
Layout
ShippedSource/— copy ofsrc/Version7next to the built app (MSBuildCopyShippedSource){workspace}/output/self-improvement/live— current editable source{workspace}/output/self-improvement/sandbox— clone for edits and builds{workspace}/output/self-improvement/backups/{timestamp}— backups before promote
Tools
1. self_improve_get_source_layout 2. self_improve_generate_tool 3. self_improve_backup_live 4. self_improve_create_sandbox 5. self_improve_build_sandbox 6. self_improve_verify_sandbox_tool 7. self_improve_promote_sandbox — copies sandbox → live, builds, restarts
Set GENESIS_REPO_ROOT to the repo root when developing from source instead of ShippedSource.