SharpCoder 0.3.0-alpha.5

This is a prerelease version of SharpCoder.
There is a newer version of this package available.
See the version list below for details.
dotnet add package SharpCoder --version 0.3.0-alpha.5
                    
NuGet\Install-Package SharpCoder -Version 0.3.0-alpha.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SharpCoder" Version="0.3.0-alpha.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SharpCoder" Version="0.3.0-alpha.5" />
                    
Directory.Packages.props
<PackageReference Include="SharpCoder" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SharpCoder --version 0.3.0-alpha.5
                    
#r "nuget: SharpCoder, 0.3.0-alpha.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SharpCoder@0.3.0-alpha.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SharpCoder&version=0.3.0-alpha.5&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=SharpCoder&version=0.3.0-alpha.5&prerelease
                    
Install as a Cake Tool

SharpCoder

NuGet License: MIT

A standalone, embeddable autonomous coding agent for .NET — built on Microsoft.Extensions.AI.

SharpCoder gives any IChatClient (OpenAI, Ollama, Azure, Anthropic, etc.) the ability to read files, write code, search codebases, and execute shell commands autonomously. Plug it into your app with a few lines of code.

Features

  • Provider-agnostic — works with any IChatClient implementation
  • Built-in tools — file read/write/edit, glob, grep, bash, and skills
  • Security by default — path traversal protection, bash disabled by default
  • Workspace-aware — auto-loads AGENTS.md and .github/copilot-instructions.md
  • Rich results — token usage, tool call count, full message history
  • Targets netstandard2.1 — runs on .NET Core 3+, .NET 5–10, and beyond

Quick Start

dotnet add package SharpCoder
using Microsoft.Extensions.AI;
using SharpCoder;

// Use any IChatClient — OpenAI, Ollama, Azure, etc.
IChatClient chatClient = new OllamaChatClient("http://localhost:11434", "qwen2.5-coder");

var agent = new CodingAgent(chatClient, new AgentOptions
{
    WorkDirectory = "/path/to/your/project",
    MaxSteps = 15
});

var result = await agent.ExecuteAsync("Add unit tests for the Calculator class");

Console.WriteLine($"Status: {result.Status}");
Console.WriteLine($"Tool calls: {result.ToolCallCount}");
Console.WriteLine($"Tokens used: {result.Usage?.TotalTokenCount}");
Console.WriteLine(result.Message);

Configuration

All behavior is controlled through AgentOptions:

var options = new AgentOptions
{
    // Where the agent operates (default: current directory)
    WorkDirectory = "/my/project",

    // Max tool call iterations before stopping (default: 25)
    MaxSteps = 25,

    // Enable shell command execution (default: false — security risk!)
    EnableBash = false,

    // File system tools (default: true)
    EnableFileOps = true,
    EnableFileWrites = true,

    // Skill loading from .github/skills/ (default: true)
    EnableSkills = true,

    // Override the default system prompt
    SystemPrompt = "You are a test-writing expert.",

    // Append custom instructions to the system prompt
    CustomInstructions = "Always use xUnit. Prefer Arrange-Act-Assert.",

    // Auto-load AGENTS.md and copilot-instructions.md (default: true)
    AutoLoadWorkspaceInstructions = true,

    // Add your own custom AITools
    CustomTools = new List<AITool>
    {
        AIFunctionFactory.Create(MyCustomTool)
    }
};

Built-in Tools

Tool Description Enabled by
read_file Read file contents with line numbers and pagination EnableFileOps
write_file Create or overwrite files EnableFileWrites
edit_file Exact string replacement (single occurrence) EnableFileWrites
glob Find files by pattern (e.g. src/**/*.cs) EnableFileOps
grep Search file contents with regex EnableFileOps
execute_bash_command Run shell commands EnableBash
list_skills / load_skill Discover and load project skills EnableSkills

Agent Result

ExecuteAsync returns an AgentResult with:

result.Status        // "Success" or "Error"
result.Message       // Final text response from the agent
result.Messages      // Full conversation history (all messages, tool calls, results)
result.ToolCallCount // Number of tool invocations made
result.ModelId       // Model that produced the response
result.FinishReason  // Why the model stopped (e.g. "stop", "length")
result.Usage         // Token counts (InputTokenCount, OutputTokenCount, TotalTokenCount)

Skills

The agent can discover and load project-specific skills from .github/skills/. Each skill is a Markdown file with YAML frontmatter:

---
name: build
description: How to build this project
---

# Build Instructions

Run `dotnet build` to compile the solution.

The agent calls list_skills to discover what's available and load_skill to read the full instructions.

Security

  • Path traversal protection — all file operations are confined to WorkDirectory
  • Bash disabled by default — opt in explicitly with EnableBash = true
  • No sandboxing for bash — when enabled, the agent has full shell access with the process's privileges. Only enable in trusted environments (containers, CI runners)

License

MIT

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.6.0 135 3/31/2026
0.6.0-beta-beta.36 35 3/30/2026
0.6.0-beta-beta.35 42 3/30/2026
0.6.0-beta.42 27 3/31/2026
0.6.0-beta.40 30 3/31/2026
0.6.0-beta.39 25 3/31/2026
0.6.0-beta.38 29 3/31/2026
0.6.0-beta.37 151 3/30/2026
0.5.1-beta.34 40 3/29/2026
0.5.0 247 3/29/2026
0.5.0-beta.32 40 3/29/2026
0.5.0-beta.31 184 3/28/2026
0.4.4 94 3/26/2026
0.4.3 43 3/26/2026
0.4.2 43 3/25/2026
0.4.1 40 3/25/2026
0.4.0 46 3/25/2026
0.4.0-alpha.3 35 3/25/2026
0.4.0-alpha.2 37 3/25/2026
0.3.0-alpha.5 52 3/24/2026
Loading failed