PromoteDeploymentService.cscsharp

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 of src/Version7 next to the built app (MSBuild CopyShippedSource)
  • {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.

using System.Text;namespace Lilith.Agent.SelfImprovement;/// <summary>Deploys a verified sandbox build into the running console directory.</summary>internal static class PromoteDeploymentService{    public static string DeploySandboxBuildToRunningConsole(SelfImprovementPaths paths)    {        string targetBin = AppDomain.CurrentDomain.BaseDirectory;        var log = new StringBuilder();        string lilithBin = Path.Combine(paths.Sandbox, "Lilith", "bin", "Release", "net8.0");        int n = CopyDlls(lilithBin, targetBin);        log.AppendLine($"Copied {n} file(s) from sandbox Lilith build.");        string consoleBin = Path.Combine(            paths.Sandbox, "Interfaces", "ConsoleApp", "LilithConsole", "bin", "Release", "net8.0");        if (Directory.Exists(consoleBin))        {            int m = CopyDlls(consoleBin, targetBin);            log.AppendLine($"Copied {m} file(s) from sandbox LilithConsole build.");        }        return log.ToString().TrimEnd();    }    public static void SyncLiveSourceToShippedSource(SelfImprovementPaths paths)    {        if (!Directory.Exists(paths.Live) || !Directory.Exists(paths.ShippedSource))            return;        SourceTreeService.CopyTree(paths.Live, paths.ShippedSource, overwriteDestination: true);    }    private static int CopyDlls(string sourceBin, string targetBin)    {        if (!Directory.Exists(sourceBin))            return 0;        int count = 0;        foreach (string pattern in new[] { "*.dll", "*.exe", "*.deps.json", "*.runtimeconfig.json" })        {            foreach (string file in Directory.GetFiles(sourceBin, pattern))            {                string dest = Path.Combine(targetBin, Path.GetFileName(file));                File.Copy(file, dest, overwrite: true);                count++;            }        }        return count;    }}