ccfa7e1b9ddf0488292ac0ea153e1af6a50aff18
AnchorCli
An AI-powered coding assistant built as a .NET 10.0 console application, featuring the Hashline technique for safe, precise file editing.
Features
- Batch Editing: Apply multiple replace/delete operations atomically in a single pass without line drift
- Interactive REPL: Chat with an AI model to edit files, manage directories, and execute commands
- Slash Commands:
/setup,/help,/exit,/clear,/status,/compact,/reset,/load,/save - Token Tracking: Real-time token usage and cost per response, plus session totals
- Model Pricing Display: Shows current model pricing from OpenRouter in the header
- Context Compaction: Automatic conversation history compression when approaching context limits
- Comprehensive Toolset: 15 tools for file operations, editing, directory management, and command execution
- AOT-Ready: Native AOT compilation for ~12 MB binaries with no .NET runtime dependency
- Rich CLI: Beautiful terminal output using Spectre.Console with tables, rules, and colored text
- Streaming Responses: Real-time AI response streaming in the terminal
- OpenAI-Compatible: Works with any OpenAI-compatible API (OpenAI, Ollama, Cerebras, Groq, OpenRouter, etc.)
- Ctrl+C Support: Cancel in-progress responses without exiting
Installation
Requirements
- .NET 10 SDK
clang(for native AOT publish on Linux)
Quick Start
# Run the application
dotnet run --project AnchorCli
# First time? The app will prompt you to run /setup
# Or run it explicitly:
/setup
Native AOT Build
dotnet publish AnchorCli -r linux-x64 -c Release
./AnchorCli/bin/Release/net10.0/linux-x64/publish/anchor
The resulting binary is ~12 MB, has no .NET runtime dependency, and starts instantly.
Usage
- Setup: Configure API credentials via the
/setupcommand (oranchor setupsubcommand) - REPL Loop: Interact with the AI through a conversational interface
- Tool Calling: The AI can call tools to read/edit files, manage directories, or execute commands
- Safe Execution: Commands require explicit user approval before running
Supported Models
AnchorCli works with any OpenAI-compatible API endpoint:
- OpenAI (gpt-4o, gpt-4.1, etc.)
- Ollama (local models)
- Cerebras
- Groq
- OpenRouter (qwen3.5-27b, etc.)
- Any custom OpenAI-compatible server
Configuration
Configuration is stored in ~APPDATA~/anchor/config.json on Windows or ~/.anchor/config.json on Linux/macOS.
Use the /setup command or run anchor setup from the command line to configure:
- API Key
- API Endpoint (default: OpenRouter)
- Model selection
Documentation
- Available Tools - Complete list of all tools organized by category
- Hashline Technique - Detailed explanation of Hashline editing with examples
- Slash Commands - All available slash commands with descriptions
License
MIT License - See LICENSE file for details.
Languages
C#
98.6%
PowerShell
1.1%
Shell
0.3%