SharpClawCode
CLAUDE.md97 starsChanged 3 months agoMITView on GitHub
SharpClaw Code is a C#-native coding-agent runtime (.NET 10 / C# 13) inspired by the Rust claw-code surface. It provides durable sessions, permission-aware tool execution, provider abstraction (Anthropic & OpenAI-compatible), MCP integration, and plugin/skill extensibility. Entry point: src/SharpClaw.Code.Cli/Program.cs builds a host via CliHostBuilder, resolves CliCommandFactory, and invokes System.CommandLine. Core execution flow: 1. ConversationRuntime.RunPromptAsync resolves/creates a session 2. DefaultTurnRunner builds prompt context via IPromptContextAssembler 3. PrimaryCodingAgent delegates to AgentFrameworkBridge -> ProviderBackedAgentKernel -> IModelProvider 4. Tools execute through IToolRegistry -> PermissionPolicyEngine ->…
In this repository2 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/agents.mdAGENTS.md
The file
We split this CLAUDE.md into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 59
Prefer incremental vertical slices over broad placeholder scaffolding.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project
SharpClaw Code is a C#-native coding-agent runtime (.NET 10 / C# 13) inspired by the Rust claw-code surface. It provides durable sessions, permission-aware tool execution, provider abstraction (Anthropic & OpenAI-compatible), MCP integration, and plugin/skill extensibility.
Build & Test Commands
# Build
dotnet build SharpClawCode.sln
# Run all tests
dotnet test SharpClawCode.sln
# 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"
# Run the CLI
dotnet run --project src/SharpClaw.Code.Cli -- [arguments]Architecture
Entry point: src/SharpClaw.Code.Cli/Program.cs builds a host via CliHostBuilder, resolves CliCommandFactory, and invokes System.CommandLine.
Core execution flow:
ConversationRuntime.RunPromptAsyncresolves/creates a sessionDefaultTurnRunnerbuilds prompt context viaIPromptContextAssemblerPrimaryCodingAgentdelegates toAgentFrameworkBridge->ProviderBackedAgentKernel->IModelProvider- Tools execute through
IToolRegistry->PermissionPolicyEngine->ISharpClawTool.ExecuteAsync - Events published via
IRuntimeEventPublisher, sessions persisted as snapshots + NDJSON append logs
DI composition roots: RuntimeServiceCollectionExtensions.AddSharpClawRuntime() and CliServiceCollectionExtensions.AddSharpClawCli().
Key project boundaries:
Protocolis the dependency-light center: DTOs, enums, events,ProtocolJsonContext(source-gen JSON)Runtimeowns orchestration and lifecycle, not the CLICliandCommandsare thin; business logic lives in Runtime/Agents/ToolsToolsmust route throughPermissions-- never bypass permission checksSessionssupports both durable snapshots and append-only event logsAgentswraps the Microsoft Agent Framework without leaking provider/transport details
Engineering Rules (from AGENTS.md)
- System.Text.Json only -- never Newtonsoft.Json. Use
ProtocolJsonContextfor source-generated serialization. - Async/await end-to-end for all I/O. Pass
CancellationTokenthrough async call paths. - Constructor injection over service location.
- File-scoped namespaces, records for immutable contracts, interfaces for infrastructure seams.
- Cross-platform with Windows-safe path/process handling. No hardcoded secrets or machine-specific paths.
- XML docs for all public APIs and major internal services.
- Permission policy enforcement for shell execution and file mutation.
- Typed contracts over ad hoc dictionaries. Keep JSON outputs stable unless explicitly breaking.
- Prefer incremental vertical slices over broad placeholder scaffolding.
Test Projects
| Project | Role |
SharpClaw.Code.UnitTests | Fast unit tests (tools, permissions, serialization, MCP) |
SharpClaw.Code.IntegrationTests | Runtime + provider flows with real composition |
SharpClaw.Code.MockProvider | DeterministicMockModelProvider with named scenarios |
SharpClaw.Code.ParityHarness | End-to-end scenarios via ParityTestHost with mock LLM |
SharpClaw.Code.Mcp.FixtureServer | MCP fixture server for testing |
Mock provider scenarios: streaming_text, stream_failure, stream_slow, read_file_roundtrip, write_file_allowed, write_file_denied, grep_chunk_assembly, bash_stdout_roundtrip, permission_prompt_approved, permission_prompt_denied, plugin_tool_roundtrip, mcp_partial_startup, recovery_after_timeout.
CLI Modes
build-- normal coding-agent execution (default)plan-- analysis-first, blocks mutating toolsspec-- generates Kiro-style spec artifacts underdocs/superpowers/specs/
Known Backlog (ARCHITECTURE-NOTES.md)
- Commands project directly references Mcp/Plugins (should go through abstractions)
McpDoctorServiceuses anonymous objects instead of typed DTOs for JSON- Plugin manifest parsing uses
JsonSerializerDefaults.Webinstead ofProtocolJsonContext - Telemetry sinks not yet wired for production (OpenTelemetry, file traces)
- Runtime directly references Agents (acceptable for now, seam needed if multiple backends appear)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

