SharpCoreAgent
A terminal-first coding agent for C# 15 / .NET 11, built around DeepSeek and Grok.
SharpCoreAgent reads a repository, edits it, runs the build and the tests, and reports what it changed.
The model is swappable by design: DeepSeek and Grok ship as dedicated, tested adapters, and any other
OpenAI-compatible endpoint is reachable through configuration — no rebuild, no new project.
What it does
- One request becomes a verified change. The agent explores the workspace, edits files, runs the
build and reports the outcome instead of claiming success.
- The model is a port, not a dependency.
SharpCoreAgent.Domain names no vendor, no HTTP type and
no wire format; every provider lives behind IChatModel in the infrastructure layer.
- Tools are the only door to the machine. Reading, writing, deleting and shell access all go
through a registered tool with a JSON Schema, a safety class and a recorded result.
- Every loop has a budget. Iterations, output tokens, total tokens and tool-result size are capped
and enforced, so a confused model cannot spend the night on your account.
- Streaming is the default. Text, reasoning deltas and tool calls arrive as they happen, in
human-readable form or as one JSON event per line (
--json).
- Colour when it helps, never when it hurts. Glyphs, tools, paths, timings and diffs are coloured on
a terminal;
NO_COLOR, --color never and any redirected stream keep the output plain UTF-8, and
--json never carries an escape.
- Edits are fragments, not rewrites.
replace_in_file changes only the text the model matched, and
the approval prompt shows a unified diff of the change before the answer is read.
- Plan before act.
--mode plan (or /mode plan) hides every destructive tool and asks for a plan,
so a risky change can be reviewed in the same transcript that then carries it out.
- A sub-agent keeps the investigation out of your transcript.
task runs one instruction in a child
agent with its own context and hands back only the answer, while the child's edits and commands are
still reported as this turn's effects and still wait on dotnet_verify.
Requirements
- .NET SDK 11.0.100 or later preview (
global.json pins the RC build; install that one or a
roll-forward-compatible SDK)
- Windows, Linux or macOS (the shell tool picks
cmd.exe or the Unix shell at construction time)
- API keys for the providers you intend to use; the
demo provider needs none
Supported runtime: net11.0 and newer — 11 is a floor, not a ceiling. .NET 10 and older, .NET
Framework and .NET Standard are refused by the build itself (Directory.Build.targets, error
SCA0001), because the code and the SharpCoreDB packages it depends on are written against .NET 11
APIs. Later frameworks are not blocked, but they do not exist yet: .NET 12 ships a year after 11, and
until an SDK that supports it is installed, targeting net12.0 fails on its own with NETSDK1045.
The language level is C# 15 (LangVersion=preview) and the only place that is configured is
src/Directory.Build.props.
Install
sharpcoreagent is a .NET tool: one framework-dependent package and no per-platform binaries, so the
same install command works on Windows, Linux and macOS. It needs the .NET 11 SDK or runtime named in
Requirements and nothing else.
dotnet tool install --global sharpcoreagent
That puts sharpcoreagent on your PATH; open a new terminal so the shell picks it up. Run it from a
repository root and that directory is the workspace — the agent reads and edits the repository it was
called from, with no project file to point at:
cd C:\path\to\your\repository
sharpcoreagent # an interactive session in this directory
sharpcoreagent run "summarise what changed in src" --provider deepseek
--workspace <path> names a different root for one invocation, and --add-root attaches a second
repository: readable always, writable only when the session is --approval allow.
Install from a GitHub release
Every release carries the same .nupkg
and a framework-dependent binary per platform (win-x64, linux-x64, osx-arm64), for a machine that
would rather not use nuget.org. Download the .nupkg and install from the folder that holds it:
dotnet tool install --global sharpcoreagent --add-source C:\path\to\downloads
Update and remove
dotnet tool update --global sharpcoreagent
dotnet tool uninstall --global sharpcoreagent
Quickstart from source
git clone https://github.com/MPCoreDeveloper/SharpCoreAgent.git
cd SharpCoreAgent
dotnet build .\SharpCoreAgent.slnx -c Release
dotnet test .\SharpCoreAgent.slnx -c Release
Prove the loop without credentials (deterministic, offline, no key):
dotnet run --project src\SharpCoreAgent.Cli -- models
dotnet run --project src\SharpCoreAgent.Cli -- run "list the files in this repository" --provider demo --approval readonly
Build the index once per clone. Nothing does it for you: search_code, find_symbol, find_references,
code_context, find_docs and find_cues answer from the index, and without one they say so instead of guessing:
dotnet run --project src\SharpCoreAgent.Cli -- index
Start a session the way every other agent in a terminal starts one — type the name. With a terminal on
both ends it opens the interactive loop and says what it is using; with either stream redirected it
prints the usage block instead, so a script never hangs on a prompt:
dotnet run --project src\SharpCoreAgent.Cli -- --provider demo --workspace .
A live DeepSeek turn, and the same prompt on Grok. Neither names a model, so each runs on the default
the provider publishes today — deepseek-flash and grok-4.7:
$env:DEEPSEEK_API_KEY = "<your key>"
dotnet run --project src\SharpCoreAgent.Cli -- run "fix the failing test in src" --provider deepseek
$env:XAI_API_KEY = "<your key>"
dotnet run --project src\SharpCoreAgent.Cli -- chat --provider grok --model grok-4.7
# DeepSeek now, Grok if DeepSeek returns 401 or 5xx: both keys must be set.
dotnet run --project src\SharpCoreAgent.Cli -- chat --provider deepseek --fallback grok:grok-4.7
A key in the environment is inherited only by processes started after it was set, so a new editor
window or a restarted terminal may not see one. A credential file has neither problem, and its keys
win over the environment when both are present:
# .\.secrets.env, which .gitignore already covers: one NAME=value per line.
# DEEPSEEK_API_KEY=<your key>
dotnet run --project src\SharpCoreAgent.Cli -- run "fix the failing test in src" --credential-file .\.secrets.env
# Or name the file once for every future shell and every editor.
setx SHARPCOREAGENT_CREDENTIAL_FILE "D:\keys\.secrets.env"
With no key at all and a terminal on both ends, the first run asks instead of failing: it names the
variable it needs, reads a pasted key with the echo off, writes it to credentials.env beside the settings
file — outside every workspace, readable by its owner only on Unix — and records that path as the
credential-file setting so the next run finds it. The key is never printed, logged or put in a transcript.
On a pipe, in a script or after an n, nothing is asked and the three documented routes are printed
instead. --credential-file and SHARPCOREAGENT_CREDENTIAL_FILE still win: a file the developer named is
where the paste goes.
Providers
| Provider key |
Models |
Credential |
deepseek |
deepseek-flash (default), deepseek-v4-pro, deepseek-chat, deepseek-reasoner (no tools) |
DEEPSEEK_API_KEY |
grok |
grok-4.7 (default), grok-4.6, grok-4.5, grok-4.3, grok-4.20-*, grok-build-0.1, grok-4, grok-3, grok-3-mini |
XAI_API_KEY or GROK_API_KEY |
openai-compatible |
any model the endpoint serves (--base-url required) |
OPENAI_API_KEY, SHARPCOREAGENT_OPENAI_COMPATIBLE_API_KEY or SHARPCOREAGENT_API_KEY |
demo |
demo-scripted (deterministic, for tests and demos) |
none |
deepseek is the default provider. models prints the catalogue of the build you have, including
whether each model accepts tool calls and whether it reads images — deepseek-flash, the Grok text/chat
models and every openai-compatible model declare images=yes, which is what view_image checks before it opens a
file. credentials --check answers the narrower question of where the key came from: file:<path>:<line>,
environment or missing, never the value.
Commands and options
sharpcoreagent [options] a session in the current directory
sharpcoreagent run "<prompt>" [options] one turn, then exit
sharpcoreagent chat [options] interactive loop
sharpcoreagent models [--provider <name>] list the models this build knows
sharpcoreagent credentials --check which provider keys are configured, and where
sharpcoreagent index [options] build, inspect or repair the code index
sharpcoreagent config [show|get|set|unset|path] settings, and where each value comes from
sharpcoreagent setup the preferences, asked for one at a time
sharpcoreagent mcp serve [options] this workspace's index as an MCP server on stdio
sharpcoreagent mcp config --client <name> the block that adds it to claude, vscode, visualstudio or codex
sharpcoreagent ui --serve [options] this workspace's index as a page on 127.0.0.1
sharpcoreagent serve [options] this conversation as a chat page on 127.0.0.1
sharpcoreagent ide agent [--write] the profile that puts this agent in an editor's picker
sharpcoreagent ide tasks [--write] the task that rebuilds the index, for .vscode/tasks.json
sharpcoreagent --help | --version
Settings you keep
Flags describe one invocation; config describes this developer. It writes one JSON document —
%APPDATA%\sharpcoreagent\config.json on Windows, $XDG_CONFIG_HOME/sharpcoreagent/config.json or
~/.config/sharpcoreagent/config.json elsewhere, or whatever SHARPCOREAGENT_CONFIG names:
sharpcoreagent config # every setting, its value and its source
sharpcoreagent config set provider grok
sharpcoreagent config set approval readonly
sharpcoreagent config set model grok-4.7
sharpcoreagent config set providers.grok.model grok-4.7
sharpcoreagent config set providers.deepseek.model deepseek-flash
sharpcoreagent config set planner grok:grok-4.7 # plan turns on Grok, act turns on the rest
sharpcoreagent config get provider # one value, alone, for a script
sharpcoreagent config get providers.grok.model # works even while another provider is selected
sharpcoreagent config unset approval # the built-in default applies again
The command line beats the environment, which beats the file, which beats the built-in default, and
config show prints which layer each value came from. A providers.<name>.model or .base-url section
applies only when that provider is selected; switching --provider changes which section is read without
rewriting the file, and a command-line --model still wins for one run. The file never holds a key: config set api-key
is refused, because a preferences file is copied and committed — --credential-file is where a key
goes. config show reports only whether the provider's credential is present, never its value, and a
file the build cannot apply exits 7 with the key named, so config set/config unset/config path
keep working on the file that needs repairing.
| Option |
Commands |
Default |
--provider <name> |
run, chat |
deepseek |
--model <id> |
run, chat |
provider default |
--planner <model> |
run, chat |
session model — what a plan turn runs on, e.g. grok:grok-4.7 |