SharpCoder.Cli 0.26.0-beta.210

This is a prerelease version of SharpCoder.Cli.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet tool install --global SharpCoder.Cli --version 0.26.0-beta.210
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local SharpCoder.Cli --version 0.26.0-beta.210
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=SharpCoder.Cli&version=0.26.0-beta.210&prerelease
                    
nuke :add-package SharpCoder.Cli --version 0.26.0-beta.210
                    

SharpCoder.Cli

sharpcoder is the terminal front-end for SharpCoder, an autonomous coding-agent loop built on Microsoft.Extensions.AI. It streams responses live, renders tool calls inline, reports per-turn and cumulative token/tool usage, automatically resumes a managed session for the current workdir, and works with the providers shipped in SharpCoder.Providers (GitHub Copilot, GitHub Models, Ollama).

This is a .NET tool package. Install it with dotnet tool install, not dotnet add package — the latter is for the SharpCoder library.

Requirements

  • The .NET 11 SDK (needed to install .NET tools); the tool targets net11.0.
  • A model provider credential — for example GITHUB_TOKEN/GH_TOKEN, OLLAMA_API_KEY, or a local Ollama server. Credentials can also come from a dotenv file passed with --env <file>.

Install

dotnet tool install --global SharpCoder.Cli
sharpcoder --help

Prerelease builds from the develop branch:

dotnet tool install --global SharpCoder.Cli --prerelease
# or pin one: dotnet tool install --global SharpCoder.Cli --version 0.25.0-beta.123

Run it once without installing (requires .NET 10 SDK or later):

dnx SharpCoder.Cli -- --help

Pin it per repository as a local tool (dotnet-tools.json manifest):

dotnet new tool-manifest
dotnet tool install SharpCoder.Cli
dotnet tool run sharpcoder -- --help

Update or remove a global install:

dotnet tool update --global SharpCoder.Cli
dotnet tool uninstall --global SharpCoder.Cli

Standalone binaries

No .NET SDK or runtime installed? Every vX.Y.Z GitHub Release ships six self-contained, single-file zips named sharpcoder-<version>-<rid>.zip (win-x64, win-arm64, linux-x64, linux-arm64, osx-x64, osx-arm64). Unzip and put sharpcoder / sharpcoder.exe on your PATH; on Unix run chmod +x sharpcoder if the executable bit was lost. Verify downloads with the release's SHA256SUMS. The binaries are unsigned, so Windows SmartScreen and macOS Gatekeeper may warn on first launch (xattr -d com.apple.quarantine sharpcoder on macOS).

Quick start

# one-shot task (shorthand for `sharpcoder run "..."`)
sharpcoder "fix the build"

# interactive REPL (the default) — /help lists /fork, /session, /config, /exit, ...
sharpcoder chat

# choose a provider-prefixed model, load a dotenv file and a YAML config
sharpcoder --model ollama-local/llama3 --env .env --config work.yaml "Review this repository"

# read-only review: no write_file / edit_file / write_session_artifact / delete_session_artifact tools
sharpcoder --read-only "review the changes"

# start a fresh named session, branch the current one, or resume an existing one
sharpcoder --new=review-1 run "Fix the failing test"
sharpcoder --fork=review-2 run "Explore an alternative"
sharpcoder --open 20261130-150713 chat

sharpcoder --help lists every flag, including --workdir, --max-steps, --reasoning, --bash, --shell, --confirm-tools, --verbose, --home, --new [name] / --new=<name>, --fork [name] / --fork=<name>, --open <name>, --no-session-history, --session-retention <days>, --session-max-checkpoints <n>, --context-tokens, --retain-tokens and --markdown. Settings can be stored in <home>/config.yaml; explicit command-line flags always win, and environment variables override config defaults. The current startup folder is the working directory. The legacy --session/--save flags and /save command are removed.

When built from source the executable is named SharpCoder.Cli; the published tool's command is sharpcoder. Several CLI examples and the built-in help text use the source binary name — substitute sharpcoder after installing the tool.

Managed sessions

The latest session for the current workdir resumes automatically. The default SharpCoder home is ~/.sharpcoder; --home <dir> or SHARPCODER_HOME selects another home. <home>/workspaces.json maps canonical workdirs to <home>/sessions/<name>/. Each session folder contains latest.json (current AgentSession JSON), session.json (metadata), context/000000-initial.json, numbered context/NNNNNN-pre-compaction.json and context/NNNNNN-fork-source.json snapshots, checkpoints.jsonl, events.jsonl, artifacts/ (bounded .md/.txt/.json agent files) and a .lock owner file. latest.json is atomically replaced after each turn, after successful compaction and on exit, so an interrupted write cannot leave a truncated transcript. Each compaction writes one pre-compaction snapshot plus pending/compacted (or aborted) metadata; there is no numbered post-compaction file. A fork copies the source latest.json verbatim to a fork-source snapshot and adds fork-source/session_forked records. events.jsonl holds bounded turn, lifecycle, compaction, fork and artifact write/delete records. Missing or unreadable state is preserved and a new session is started.

--new [name] / --new=<name> starts a fresh session instead of resuming; --fork [name] / --fork=<name> branches the current session, or uses --open <name> as its source, and points the workdir registry at the fork; --open <name> alone makes an existing session current. --new and --fork are mutually exclusive. Names are single tokens, not file paths. Prefer --new run "<task>", --fork run "<task>", or the unambiguous --new=<name> "<task>" / --fork=<name> "<task>" forms for one-shot tasks, because a single-word bare task after either space-separated flag is read as the optional name. In the REPL use /new [name], /fork [name], /session open <name>, /session rename <name>, /session list [all], /session path, /session artifacts, /session checkpoints and /session prune; /session shows statistics. A fork recursively duplicates all regular source files except transient .lock/*.tmp, writes an exact numbered context/NNNNNN-fork-source.json, records lineage and bounded checkpoint/event rows, assigns a fresh AgentSession.Fork() identity with zeroed cumulative counters, and leaves the source unchanged. REPL /fork finalizes the live transcript first; startup --fork uses the persisted source state. Switches finalize the current session and transfer its .lock to the new folder. Use --no-session-history/SHARPCODER_NO_SESSION_HISTORY=1 for an in-memory run that reads and writes no session files; it disables those lifecycle flags and commands, including /fork. --home and SHARPCODER_HOME are CLI/environment settings, never YAML keys; session-specific state is excluded from YAML. System-wide retention is configured in config.yaml with session-retention-days and session-max-checkpoints, overridden by SHARPCODER_SESSION_RETENTION_DAYS / SHARPCODER_SESSION_MAX_CHECKPOINTS and the matching CLI flags (0 disables a rule). /session checkpoints shows bounded metadata and /session prune applies the policy after a single-key confirmation; startup also prunes automatically when a policy is set. Initial, fork-source and pending snapshots plus latest.json and session.json are protected, and metadata is rewritten atomically with deleted files.

The agent gets five bounded, CLI-only session tools: list_session_artifacts, read_session_artifact, write_session_artifact, delete_session_artifact and search_session_history. They are registered through AgentOptions.CustomTools, confined to <session>/artifacts/ or session-history metadata, and do not relax the workdir FileTools sandbox. Only relative .md/.txt/.json artifact paths are accepted; traversal, absolute paths, control characters and symlink/reparse-point escapes are rejected, and sizes, entries, lines, results and output characters are capped. All returned content is explicitly labeled UNTRUSTED DATA; history search returns bounded checkpoint/event metadata snippets and snapshot filenames, never full transcripts. Artifact writes use the atomic private writer; deletion removes one regular file only, never a directory, and appends a bounded artifact_deleted event. write_session_artifact and delete_session_artifact are guarded by --confirm-tools and omitted in --read-only; all five tools are disabled by --no-session-history. Custom instructions expose the active session name, artifact directory and tool names without file contents, and /session artifacts lists bounded metadata.

Full documentation, YAML schema, tool-confirmation behaviour and security notes: https://github.com/robkaandorp/SharpCoder#command-line-interface.

Security

Bash is disabled by default (--bash opts in, with no sandboxing apart from the home-directory guard below). File writes are enabled but confirmed interactively on a terminal; use --read-only/--no-writes in untrusted or scripted environments. Web tools require a credential and are guarded by --confirm-tools, as are session-artifact writes and deletes. Managed transcripts, session artifacts, duplicated fork history, and pre-compaction/fork-source snapshots are stored unencrypted and can contain secrets, tool output and retrieved web content; protect the SharpCoder home (user-only Unix modes are applied) or use --no-session-history. Artifact contents and history snippets are untrusted data, never instructions. Only run the agent in workspaces you trust.

Home-directory guard: execute_bash_command refuses a command before starting the shell if it assigns $HOME (or another home-directory variable) or combines a delete/clear/format verb with a home path such as $HOME, ~ or %USERPROFILE%. In PowerShell $HOME is read-only, so $HOME = 'C:\Temp\scratch' fails with a non-terminating error while the variable still points at the real user profile — a following Remove-Item -Recurse -Force $HOME can then delete the whole profile. The guard is always on in the CLI, even with --confirm-tools never/-y, and the startup table shows its state. It is a conservative text-level check, not a sandbox.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
0.26.0-beta.212 0 12/2/2026
0.26.0-beta.211 0 12/2/2026
0.26.0-beta.210 0 12/2/2026
0.25.0 0 12/1/2026
0.25.0-beta.208 8 12/1/2026
0.25.0-beta.207 9 12/1/2026
0.25.0-beta.206 10 12/1/2026
0.25.0-beta.205 62 11/30/2026
0.25.0-beta.204 58 11/30/2026
0.25.0-beta.203 55 11/30/2026