agentleFS
clawdotnetclawdotnet/SharpClawCode/CLAUDE.md

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 ->…

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
  1. Distinctive:

    Prefer incremental vertical slices over broad placeholder scaffolding.

    line 59

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

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:

  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 -> ISharpClawTool.ExecuteAsync
  5. Events published via IRuntimeEventPublisher, sessions persisted as snapshots + NDJSON append logs

DI composition roots: RuntimeServiceCollectionExtensions.AddSharpClawRuntime() and CliServiceCollectionExtensions.AddSharpClawCli().

Key project boundaries:

  • Protocol is the dependency-light center: DTOs, enums, events, ProtocolJsonContext (source-gen JSON)
  • Runtime owns orchestration and lifecycle, not the CLI
  • Cli and Commands are thin; business logic lives in Runtime/Agents/Tools
  • Tools must route through Permissions -- never bypass permission checks
  • Sessions supports both durable snapshots and append-only event logs
  • Agents wraps the Microsoft Agent Framework without leaking provider/transport details

Engineering Rules (from AGENTS.md)

  • System.Text.Json only -- never Newtonsoft.Json. Use ProtocolJsonContext for source-generated serialization.
  • Async/await end-to-end for all I/O. Pass CancellationToken through 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

ProjectRole
SharpClaw.Code.UnitTestsFast unit tests (tools, permissions, serialization, MCP)
SharpClaw.Code.IntegrationTestsRuntime + provider flows with real composition
SharpClaw.Code.MockProviderDeterministicMockModelProvider with named scenarios
SharpClaw.Code.ParityHarnessEnd-to-end scenarios via ParityTestHost with mock LLM
SharpClaw.Code.Mcp.FixtureServerMCP 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 tools
  • spec -- generates Kiro-style spec artifacts under docs/superpowers/specs/

Known Backlog (ARCHITECTURE-NOTES.md)

  • Commands project directly references Mcp/Plugins (should go through abstractions)
  • McpDoctorService uses anonymous objects instead of typed DTOs for JSON
  • Plugin manifest parsing uses JsonSerializerDefaults.Web instead of ProtocolJsonContext
  • Telemetry sinks not yet wired for production (OpenTelemetry, file traces)
  • Runtime directly references Agents (acceptable for now, seam needed if multiple backends appear)

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.