
Write HTML. Render video. Built for agents.
SharpClaw Code gives you a .NET-native runtime for coding agents, with sessions, tools, permissions, providers, memory, and MCP integration. You can use it as a terminal agent, embed it in your own app, or build on the supplied examples and command surface.
Builders who want reusable runtime pieces for a .NET coding agent, CLI, or embedded host.
You can build agent-led tools in .NET without wiring sessions, approvals, providers, and MCP by hand.
Stores turn history, checkpoints, recovery metadata, and replayable runtime events.
Runs file, shell, and plugin-backed actions through approval and allowlist checks.
Works with Anthropic and OpenAI-compatible backends through a typed runtime surface.
Registers and supervises MCP servers with explicit lifecycle state.
Discovers trusted plugin manifests and workspace skills.
Builds a local index and saves project or user memory for later sessions.
Runs as a terminal agent or as an embeddable SDK with server endpoints.
git clone https://github.com/clawdotnet/SharpClawCode.git cd SharpClawCode dotnet build SharpClawCode.sln dotnet test SharpClawCode.sln
dotnet run --project src/SharpClaw.Code.Cli -- [arguments]
SharpClaw Code is a C# and .NET-native coding agent runtime for teams building AI developer tools, agentic CLIs, and MCP-enabled workflows.
It combines durable sessions, permission-aware tool execution, provider abstraction, structured telemetry, and an automation-friendly command-line surface in a runtime shaped for real .NET systems: explicit, testable, and operationally legible.
The repository now ships both a terminal-first agent runtime and an embeddable host SDK through SharpClaw.Code, which makes it viable for standalone CLIs, local editor backends, and tenant-aware embedded services.
SharpClaw Code is an open-source runtime for building and operating coding-agent experiences in the .NET ecosystem. think claude code meets opencode in C#
It is designed for:
.NET 10, C# 13, idiomatic DI, System.Text.Json, System.CommandLine, and Spectre.Consolegit clone https://github.com/clawdotnet/SharpClawCode.git
cd SharpClawCode
dotnet build SharpClawCode.sln
dotnet test SharpClawCode.sln
dotnet run --project src/SharpClaw.Code.Cli -- [arguments]
# Start the interactive REPL
dotnet run --project src/SharpClaw.Code.Cli
dotnet run --project src/SharpClaw.Code.Cli -- repl
# Run a one-shot prompt
dotnet run --project src/SharpClaw.Code.Cli -- prompt "Summarize this workspace"
dotnet run --project src/SharpClaw.Code.Cli -- --auto-approve shell --auto-approve-budget 2 prompt "Check git status and summarize"
# Inspect runtime health and status
dotnet run --project src/SharpClaw.Code.Cli -- doctor
dotnet run --project src/SharpClaw.Code.Cli -- status
# Refresh and query the workspace knowledge index
dotnet run --project src/SharpClaw.Code.Cli -- index refresh
dotnet run --project src/SharpClaw.Code.Cli -- index query WidgetService
# Save and inspect durable memory
dotnet run --project src/SharpClaw.Code.Cli -- memory save --scope project "Keep prompts concise"
dotnet run --project src/SharpClaw.Code.Cli -- memory list --scope project
# Inspect metering summaries and details
dotnet run --project src/SharpClaw.Code.Cli -- usage summary
dotnet run --project src/SharpClaw.Code.Cli -- usage detail --limit 25
# Manage packaged tool bundles
dotnet run --project src/SharpClaw.Code.Cli -- tool-packages list
# Emit machine-readable output
dotnet run --project src/SharpClaw.Code.Cli -- --output-format json doctor
Built-in REPL slash commands include /help, /status, /doctor, /session, /commands, /mode, /editor, /export, /undo, /redo, and /version. Use /help to see the active command set, including discovered workspace custom commands.
Parity-oriented commands now include:
index / /indexmemory / /memorymodels / /modelsusage / /usagecost / /coststats / /statsconnect / /connecthooks / /hooksskills / /skillsagents / /agentstodo / /todoshare / /shareunshare / /unsharecompact / /compactserve / /serveworktree / /worktree/sessions as a friendlier alias over /session listPrimary workflow modes:
build: normal coding-agent executionplan: structured deep planning that blocks mutating tools and syncs planning-owned session todosspec: generates Kiro-style spec artifacts under docs/superpowers/specs/<date>-<slug>/| Capability | Why it matters |
|---|---|
| Durable sessions | Persist conversation state, turn history, checkpoints, and recovery metadata for longer-running agent work |
| Permission-aware tools | Route file, shell, and plugin-backed actions through explicit policy and approval decisions |
| Provider abstraction | Run against Anthropic and OpenAI-compatible backends through a typed runtime surface |
| Local runtime catalog | Surface Ollama, llama.cpp, and other OpenAI-compatible profiles with health, model discovery, and embedding defaults |
| MCP support | Register, supervise, and integrate MCP servers with explicit lifecycle state |
| Plugins and skills | Extend the runtime with trusted plugin manifests and discoverable workspace skills |
| Workspace knowledge | Build a durable local index for lexical, symbol, and semantic workspace search |
| Cross-session memory | Persist project and user memory so later sessions can recall repo-specific guidance and user preferences |
| Structured telemetry | Emit runtime events and usage signals that support diagnostics, replay, and automation |
| Enterprise host controls | Add tenant-aware storage, authenticated approvals, admin APIs, and usage metering for embedded deployments |
| JSON-friendly CLI | Use the same runtime through human-readable terminal flows or machine-readable command output |
| Spec workflow mode | Turn prompts into structured requirements, technical design, and task documents for feature proposals |
| Embedded SDK + server | Host the runtime via SharpClaw.Code or expose prompt, session, admin, and SSE endpoints for editor or automation clients |
| Config + agent catalog | Layer user/workspace JSONC config with typed agent defaults, tool allowlists, and runtime hooks |
| Session sharing | Create self-hosted share links and durable sanitized share snapshots under .sharpclaw/ |
| Diagnostics context | Surface configured diagnostics sources into prompt context, status, and machine-readable output |
| Area | Project(s) |
|---|---|
| Embeddable SDK | SharpClaw.Code |
| CLI and command handlers | SharpClaw.Code.Cli, SharpClaw.Code.Commands |
| Core contracts | SharpClaw.Code.Protocol |
| Runtime orchestration | SharpClaw.Code.Runtime |
| Agents | SharpClaw.Code.Agents |
| Tools and permissions | SharpClaw.Code.Tools, SharpClaw.Code.Permissions |
| ACP host | SharpClaw.Code.Acp |
| Providers, MCP, plugins | SharpClaw.Code.Providers, SharpClaw.Code.Mcp, SharpClaw.Code.Plugins |
| Sessions, telemetry, infrastructure | SharpClaw.Code.Sessions, SharpClaw.Code.Telemetry, SharpClaw.Code.Infrastructure |
| Memory, git, web, skills | SharpClaw.Code.Memory, SharpClaw.Code.Git, SharpClaw.Code.Web, SharpClaw.Code.Skills |
For dependency boundaries and project responsibilities, see docs/architecture.md and AGENTS.md.
The solution includes embeddable host samples under examples/:
MinimalConsoleAgent for direct SDK prompt executionWebApiAgent for an HTTP-hosted runtime surfaceWorkerServiceHost for lifecycle-managed background hostingMcpToolAgent for MCP-aware host composition# Run all tests
dotnet test SharpClawCode.sln
# Build example hosts as part of local validation
dotnet build examples/WebApiAgent/WebApiAgent.csproj
dotnet build examples/MinimalConsoleAgent/MinimalConsoleAgent.csproj
dotnet build examples/WorkerServiceHost/WorkerServiceHost.csproj
dotnet build examples/McpToolAgent/McpToolAgent.csproj
# Run a single test by name
dotnet test SharpClawCode.sln --filter "FullyQualifiedName~YourTestName"
# Run parity harness scenarios only
dotnet test SharpClawCode.sln --filter "FullyQualifiedName~ParityScenarioTests"
| Project | Purpose |
|---|---|
SharpClaw.Code.UnitTests | Fast unit tests covering tools, permissions, sessions, providers, state machine, telemetry, and serialization |
SharpClaw.Code.IntegrationTests | Runtime and provider flows with full DI composition |
SharpClaw.Code.ParityHarness | End-to-end scenarios using a deterministic mock LLM provider |
SharpClaw.Code.MockProvider | DeterministicMockModelProvider with named scenarios for reproducible testing |
SharpClaw.Code.Mcp.FixtureServer | MCP fixture server for integration testing |
| Option | Description |
|---|---|
--cwd <path> | Working directory; defaults to the current directory |
--model <id> | Model id or alias; provider/model forms are supported where configured |
--permission-mode <mode> | readOnly, workspaceWrite, or dangerFullAccess; see docs/permissions.md |
--auto-approve <scopes> | Auto-approve specific elevated scopes such as shell, network, or promptRead |
--auto-approve-budget <n> | Cap how many elevated operations may be auto-approved in the session |
--output-format text|json | Human-readable or structured output |
--primary-mode <mode> | Workflow bias for prompts: build, plan, or spec |
--session <id> | Reuse a specific SharpClaw session id for prompt execution |
--agent <id> | Select the active agent for prompt execution |
--host-id <id> | Stable embedded-host identifier for metering, admin, and event envelopes |
--tenant-id <id> | Tenant identifier used by host-aware storage, approvals, and metering |
--storage-root <path> | External root for host-managed durable runtime state |
--session-store fileSystem|sqlite | Select the embedded session/event storage backend |
Subcommands include prompt, repl, doctor, status, session, index, memory, models, usage, cost, stats, connect, hooks, skills, agents, todo, share, unshare, compact, serve, commands, worktree, mcp, plugins, tool-packages, acp, bridge, and version.
| Doc | Topic |
|---|---|
| docs/architecture.md | Solution layout, dependencies, and execution flows |
| docs/runtime.md | Turns, ConversationRuntime, and runtime coordinators |
| docs/sessions.md | Session snapshots and append-only event logs |
| docs/providers.md | IModelProvider, configuration, and provider integration |
| docs/tools.md | Tool registry, executor behavior, and built-ins |
| docs/permissions.md | Permission modes, policies, and approvals |
| docs/agents.md | Agent Framework integration |
| docs/external-agents.md | External agent adapters and supervised CLI runs |
| docs/skills.md | Skill packs, built-in workflows, and install/run commands |
| docs/work-items.md | GitHub and generic work-item import/export |
| docs/workbench.md | Static runtime workbench/status surfaces |
| docs/mcp.md | MCP registration, lifecycle, and orchestration |
| docs/acp.md | ACP stdio host and protocol notes |
| docs/plugins.md | Plugin discovery, trust, and CLI flows |
| docs/testing.md | Unit, integration, and parity-harness coverage |
| docs/index.md | DocFX documentation entry point and generated API reference |
| ARCHITECTURE-NOTES.md | Architectural follow-ups and cleanup ideas |
SharpClaw Code uses both the standard .NET configuration stack (appsettings.json, environment variables, CLI args) and layered SharpClaw JSONC config files:
~/.config/sharpclaw/config.jsonc on Unix-like systems%AppData%\\SharpClaw\\config.jsonc<workspace>/sharpclaw.jsoncPrecedence is:
CLI args > workspace sharpclaw.jsonc > user config.jsonc > appsettings/environment defaults
Key runtime configuration sections:
| Section | Purpose |
|---|---|
SharpClaw:Providers:Catalog | Default provider, model aliases, ordered fallback providers |
SharpClaw:Providers:Anthropic | Anthropic API key, base URL, default model |
SharpClaw:Providers:OpenAiCompatible | OpenAI-compatible base settings plus local runtime profiles, auth mode, and default embedding model |
SharpClaw:Web | Web search provider name, endpoint template, user agent |
SharpClaw:Telemetry | Runtime event buffer, webhook export, and opt-in redacted prompt previews |
Key sharpclaw.jsonc capabilities:
shareMode: manual, auto, or disabledserver: host, port, and optional public base URL for share linksdefaultAgentId: default prompt agentagents: typed agent catalog entries with model defaults, tool allowlists, and instruction appendiceslspServers: configured diagnostics sourceshooks: lifecycle hooks for turn/tool/share/server eventsconnectLinks: browser entry points for provider or external auth flowsAll options are validated at startup via IValidateOptions implementations.
usage summary, usage detail, and tool-packages commands while preserving the existing workspace-local usage, cost, and stats flows.--output-format json, which makes them suitable for scripts, editors, and automation.Use .NET 10 and C# 13. Follow AGENTS.md for project boundaries, serialization conventions, logging expectations, and cross-platform rules.
Before opening a PR:
dotnet build SharpClawCode.sln
dotnet test SharpClawCode.sln
dotnet build examples/WebApiAgent/WebApiAgent.csproj
dotnet build examples/MinimalConsoleAgent/MinimalConsoleAgent.csproj
dotnet build examples/WorkerServiceHost/WorkerServiceHost.csproj
dotnet build examples/McpToolAgent/McpToolAgent.csproj
pwsh .github/scripts/Test-Packages.ps1
This project is licensed under the MIT License.
Repository: github.com/clawdotnet/SharpClawCode
Sign in to join the discussion.
No comments yet. Be the first to say what this is good for.

Write HTML. Render video. Built for agents.
Ultra-lightweight, open-source, self-hosted personal AI agent framework in Python with WebUI, tools, memory, MCP, multi-agent workflows, automation, and chat apps
SkillOpt is a text-space optimizer that trains reusable natural-language skills for frozen LLM agents through trajectory-driven edits, validation-gated updates, and deployable best_skill.md artifacts.

Omnigent is an open-source AI agent framework and meta-harness: orchestrate Claude Code, Codex, Cursor, Pi, and custom agents — swap harnesses without rewriting, enforce policies and sandboxing, and collaborate in real time from any device.
A theoretical reconstruction of the Claude Mythos architecture, built from first principles using the available research literature.
🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!