Goal: understand quickly what exists in ManagedCode.ClaudeCodeSharpSDK, where it lives, and how modules interact.
Single source of truth: this file is navigational and coarse. Detailed behavior lives in docs/Features/*. Architectural rationale lives in docs/ADR/*.
- System: .NET SDK wrapper over the Claude Code CLI print-mode protocol and non-interactive execution surface.
- Where is the code: core SDK in
ClaudeCodeSharpSDK; optional M.E.AI adapter inClaudeCodeSharpSDK.Extensions.AI; automated coverage inClaudeCodeSharpSDK.Tests. - Entry points:
ClaudeClient,ClaudeChatClient(IChatClientadapter). - Dependencies: local
claudeCLI process,System.Text.Json,Microsoft.Extensions.AI(adapter package), GitHub Actions.
- In scope: SDK API surface, CLI argument mapping, event parsing, thread lifecycle, docs, tests, CI workflows.
- Out of scope: Claude Code CLI internals (
submodules/anthropic-claude-code), non-.NET SDKs, infrastructure outside this repository. - Start by mapping the request to a module below, then follow linked feature/ADR docs.
flowchart LR
API["Public API\nClaudeClient / ClaudeThread"]
EXEC["Execution Layer\nClaudeExec + process runner"]
PARSER["Protocol Parsing\nThreadEventParser + Events/Items"]
IO["Settings IO\nClaude settings discovery"]
META["CLI Metadata\nClaudeCliMetadataReader"]
MEAI["M.E.AI Adapter\nClaudeChatClient : IChatClient"]
TESTS["TUnit Tests\nClaudeCodeSharpSDK.Tests"]
CI["GitHub Actions\nCI / Release / CLI Watch"]
API --> EXEC
EXEC --> IO
API --> META
EXEC --> PARSER
PARSER --> API
MEAI --> API
TESTS --> API
TESTS --> MEAI
TESTS --> EXEC
CI --> TESTS
flowchart LR
THREAD["ClaudeThread.RunAsync / RunAsync<T> / RunStreamedAsync"]
EXECARGS["ClaudeExecArgs"]
CLI["Claude Code CLI\n`claude -p --output-format json|stream-json`"]
JSONL["JSONL stream events"]
PARSE["ThreadEventParser.Parse"]
EVENTS["ThreadEvent / ThreadItem models"]
THREAD --"builds"--> EXECARGS
EXECARGS --"maps to flags/env"--> CLI
CLI --"emits"--> JSONL
JSONL --"parsed by"--> PARSE
PARSE --"returns"--> EVENTS
flowchart LR
CC["ClaudeClient"]
T["ClaudeThread"]
E["ClaudeExec"]
R["IClaudeProcessRunner"]
D["DefaultClaudeProcessRunner"]
P["ThreadEventParser"]
CC --> T
T --> E
E --> R
R --> D
T --> P
Public API— code: ClaudeClient.cs, ClaudeThread.cs; docs: thread-run-flow.mdExecution Layer— code: ClaudeExec.cs, ClaudeExecArgs.csProtocol Parsing— code: ThreadEventParser.cs, ClaudeProtocolConstants.cs, Events.cs, Items.csConfig IO— code: ClaudeOptions.cs, ClaudeCliMetadataReader.csCLI Metadata— code: ClaudeCliMetadataReader.cs, ClaudeCliMetadata.cs; docs: cli-metadata.mdM.E.AI Adapter— code: ClaudeChatClient.cs, ClaudeServiceCollectionExtensions.cs; docs: meai-integration.md; ADR: 003-microsoft-extensions-ai-integration.mdTesting— code: ClaudeCodeSharpSDK.Tests; docs: strategy.mdAutomation— workflows: .github/workflows (includingclaude-cli-smoke.ymlandclaude-cli-watch.yml); docs: release-and-sync-automation.md
Claude Code CLI invocation contract— source: observedclaude -p --output-format json|stream-jsonbehavior, implemented in ClaudeExec.cs; producer:ClaudeExec; consumer: localclaudebinary; rationale: 001-claude-cli-wrapper.mdJSONL thread event contract— source: observedclaude -p --output-format stream-json --verbosebehavior, parsed in ThreadEventParser.cs; producer: Claude Code CLI; consumer:ClaudeThread; rationale: 002-protocol-parsing-and-thread-serialization.md
ClaudeClient— ClaudeClient.csClaudeThread— ClaudeThread.csClaudeExec— ClaudeExec.csThreadEventParser— ThreadEventParser.csClaudeProtocolConstants— ClaudeProtocolConstants.csClaudeCliMetadataReader— ClaudeCliMetadataReader.cs
- Allowed dependencies:
ClaudeCodeSharpSDK.Tests/*->ClaudeCodeSharpSDK/*ClaudeCodeSharpSDK.Tests/*->ClaudeCodeSharpSDK.Extensions.AI/*ClaudeCodeSharpSDK.Extensions.AI/*->ClaudeCodeSharpSDK/*- Public API (
ClaudeClient,ClaudeThread) -> internal execution/parsing helpers.
- Forbidden dependencies:
- No dependency from
ClaudeCodeSharpSDK/*toClaudeCodeSharpSDK.Tests/*. - No dependency from
ClaudeCodeSharpSDK/*toClaudeCodeSharpSDK.Extensions.AI/*unless via explicit adapter boundaries. - No runtime dependency on
submodules/anthropic-claude-code; submodule is reference-only.
- No dependency from
- Integration style:
- sync configuration + async process stream consumption (
IAsyncEnumerable<string>) - JSONL event protocol parsing and mapping to strongly-typed C# models.
- sync configuration + async process stream consumption (
- 001-claude-cli-wrapper.md — wrap Claude Code CLI process as SDK transport.
- 002-protocol-parsing-and-thread-serialization.md — explicit protocol constants and serialized per-thread turn execution.
- 003-microsoft-extensions-ai-integration.md —
IChatClientadapter in a separate package.
- Features: docs/Features/
- Decisions: docs/ADR/
- Testing: docs/Testing/strategy.md
- Development setup: docs/Development/setup.md