Description

Self improve generate tool

Generates tool scaffold in sandbox from saved spec (call set_tool_spec first) or from JSON args. Requires sandbox.

Included in Version 8

Dynamically extracted tool implementation.
How to register SelfImprovementToolscsharp
registry.Register(new AgentTool(            "self_improve_generate_tool",            "Generates tool scaffold in sandbox from saved spec (call set_tool_spec first) or from JSON args. Requires sandbox.",            InvokeGenerateTool,            new            {                type = "object",                properties = new                {                    tool_name = new { type = "string", description = "Optional if set_tool_spec was called." },                    description = new { type = "string", description = "Optional if set_tool_spec was called." },                    category = new { type = "string", description = "core, addon, or self." },                    invoke_body = new { type = "string", description = "Optional C# return expression." },                },            },            ToolCategory.Self));
Helper classes for SelfImprovementToolscsharp
    private string InvokeGenerateTool(string argumentsJson)    {        var paths = RequirePaths();        if (!Directory.Exists(paths.Sandbox))            return "Error: sandbox does not exist. Call self_improve_create_sandbox first.";        var spec = ResolveToolSpec(argumentsJson);        if (!spec.IsComplete)        {            return "Error: No tool spec. Call self_improve_set_tool_spec first (or pass tool_name, description, category).";        }        if (string.IsNullOrWhiteSpace(spec.InvokeBody))            spec.InvokeBody = "return \"OK\";";        string path = ToolScaffoldGenerator.Generate(            paths.Sandbox, spec.ToolName, spec.Description, spec.Category, spec.InvokeBody);        return $"Generated tool '{spec.ToolName}' ({spec.Category}) at {path}. Next: self_improve_build_sandbox, then self_improve_verify_sandbox_tool.";    }