Skip to content

hmennen90/ClaudeSharp

Repository files navigation

ClaudeSharp

A native Claude Code alternative built in C#/.NET with Terminal UI, MCP support, and plugin system.

Open source under MIT license.

Install

# Option 1: dotnet tool (recommended, requires .NET 10 SDK)
dotnet tool install -g ClaudeSharp

# Option 2: Standalone binary (no .NET required)
# Download from GitHub Releases: https://github.com/hmennen90/ClaudeSharp/releases

Features

  • Full agent loop with streaming responses and tool-call chaining
  • 11 built-in tools: ReadFile, WriteFile, EditFile, Glob, Grep, Shell, ListDirectory + 4 Memory tools
  • MCP server integration — compatible with Claude Code .mcp.json config
  • Plugin system — hooks (PreToolUse/PostToolUse) and skills (SKILL.md slash commands)
  • Terminal UI via Terminal.Gui v2 with chat view, input, status bar
  • Permission system — file writes and shell commands require user confirmation
  • Long-term memory — SQLite-based memory with FTS5 full-text search
  • 3-layer memory retrieval — token-efficient search, timeline, details pattern
  • Slash commands — /help, /model, /tools, /clear, /cost, /quit + custom skills
  • Config files — ~/.claudesharp/config.json and project-level .claudesharp.json
  • Context window management — auto-truncation when approaching limits
  • Cross-platform — PowerShell on Windows, bash/zsh on Unix

Quick Start

# Set your API key
export ANTHROPIC_API_KEY=sk-ant-...          # Unix
$env:ANTHROPIC_API_KEY = "sk-ant-..."        # PowerShell

# Run
claudesharp                                   # if installed via dotnet tool
claudesharp --model=claude-opus-4-20250514   # with specific model
claudesharp --dir=C:\Projects\MyApp           # with working directory

Usage

dotnet run --project src/ClaudeSharp.Tui [options]

Options:
  --model=<model>    Claude model to use (default: claude-sonnet-4-20250514)
  --dir=<path>       Working directory

Slash Commands

Command Description
/help Show available commands
/model Switch Claude model
/clear Clear conversation history
/cost Show session token usage
/quit Exit ClaudeSharp
Esc Cancel current request

Built-in Tools

Tool Description
ReadFile Read files with line numbers
WriteFile Create/overwrite files
EditFile Exact string replacement
Glob Find files by pattern
Grep Regex search in files
Shell Execute shell commands
ListDirectory List directory contents
MemorySearch Search long-term memory
MemoryStore Save observations to memory
MemoryTimeline Chronological context
MemoryGetDetails Full memory details

Configuration

Create ~/.claudesharp/config.json:

{
  "model": "claude-sonnet-4-20250514",
  "maxTokens": 8192,
  "shell": "pwsh",
  "shellTimeoutSeconds": 120,
  "maxContextTokens": 180000
}

Or project-level .claudesharp.json in your working directory.

Priority: CLI args > env vars > project config > global config

Architecture

ClaudeSharp/
├── src/
│   ├── ClaudeSharp.Core/      # Agent loop, tools, models (no UI deps)
│   ├── ClaudeSharp.Memory/    # SQLite + FTS5 long-term memory
│   ├── ClaudeSharp.Tui/       # Terminal.Gui v2 interface
│   └── ClaudeSharp.Cli/       # Headless mode (planned)
└── tests/
    └── ClaudeSharp.Core.Tests/

MCP Server Integration

ClaudeSharp connects to MCP servers using the same config format as Claude Code.

Create .mcp.json in your project directory:

{
  "mcpServers": {
    "my-server": {
      "command": "npx",
      "args": ["-y", "@some/mcp-server"],
      "env": {}
    }
  }
}

MCP tools are auto-discovered and registered as mcp_<server>_<tool>. Use /tools to see all registered tools.

Config locations: .mcp.json (project), ~/.claudesharp/mcp.json (global)

Plugin System

Hooks

Hooks run shell commands before/after tool execution. Configure in settings.json:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Shell",
        "hooks": [
          {
            "type": "command",
            "command": "echo 'Shell command about to run'",
            "timeout": 10
          }
        ]
      }
    ]
  }
}

Config locations: .claudesharp/settings.json, .claude/settings.json (Claude Code compatible)

Supported events: SessionStart, SessionEnd, PreToolUse, PostToolUse, UserPromptSubmit, Stop

Skills

Custom slash commands defined as SKILL.md files:

~/.claudesharp/skills/my-skill/SKILL.md
.claude/skills/my-skill/SKILL.md        # Claude Code compatible

SKILL.md format:

---
name: my-skill
description: What this skill does
argument-hint: "[query]"
user-invocable: true
---

Your prompt content here. Use $ARGUMENTS for user input.

Invoke with /my-skill some arguments.

Memory System

Built-in long-term memory using SQLite with FTS5 full-text search.

  • Per-project isolation — memories are scoped to the working directory
  • 3-layer retrieval — search (lightweight index), timeline (context), details (full content)
  • Auto-context — recent memories are injected into the system prompt at startup
  • Storage: ~/.claudesharp/memory/claudesharp.db

License

MIT

About

Native Windows Claude Code alternative built in C#/.NET with Terminal UI and long-term memory

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages