using System;using System.IO;using Agent.Core;namespace Lilith.Agent.SelfImprovement;/// <summary>Filesystem layout for Lilith self-improvement (live / sandbox / backups).</summary>internal sealed class SelfImprovementPaths{ public const string ShippedSourceFolderName = "ShippedSource"; public const string RootFolderName = "self-improvement"; public const string LiveFolderName = "live"; public const string SandboxFolderName = "sandbox"; public const string BackupsFolderName = "backups"; public SelfImprovementPaths(Workspace workspace, string? repoVersionRoot = null) { ArgumentNullException.ThrowIfNull(workspace); string output = workspace.OutputFolder; Root = Path.Combine(output, RootFolderName); Live = Path.Combine(Root, LiveFolderName); Sandbox = Path.Combine(Root, SandboxFolderName); Backups = Path.Combine(Root, BackupsFolderName); ShippedSource = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ShippedSourceFolderName); RepoVersionRoot = repoVersionRoot ?? TryFindRepoVersion7Root() ?? ShippedSource; } public string Root { get; } public string Live { get; } public string Sandbox { get; } public string Backups { get; } public string ShippedSource { get; } public string RepoVersionRoot { get; } public string LilithConsoleProject => Path.Combine(Sandbox, "Interfaces", "ConsoleApp", "LilithConsole", "LilithConsole.csproj"); public string DesignTestsProject => Path.Combine(Sandbox, "DesignTests", "AgentCore.DesignTests.csproj"); public static string? TryFindRepoVersion7Root() { string? env = Environment.GetEnvironmentVariable("GENESIS_REPO_ROOT"); if (!string.IsNullOrWhiteSpace(env)) { string fromEnv = Path.Combine(env, "src", "Version7"); if (Directory.Exists(fromEnv)) return fromEnv; } var dir = new DirectoryInfo(Directory.GetCurrentDirectory()); while (dir is not null) { if (File.Exists(Path.Combine(dir.FullName, "GenesisAI.sln"))) return Path.Combine(dir.FullName, "src", "Version7"); dir = dir.Parent; } return null; }}
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.