An open-source AI agent CLI tool that provides GitHub Copilot CLI-like functionality with configurable LLM backends. Built with .NET 10 and C#.
This project is in early stages of development and is a work in progress.
- 🤖 Interactive Chat Mode — Conversational AI assistant with full tool access
- 💡 Explain Command — Get explanations for commands, errors, or concepts
- 🔧 Suggest Command — Get shell command suggestions for any task
- 📄 AGENTS.md Support — Define global AI instructions for your project using
AGENTS.mdfile (same format as GitHub Copilot) - 🧩 Custom Agents — Create specialized agents with
*.agent.mdfiles - 🔍 Scoped Agents — Agents that only apply within specific directories
- 🛠️ Built-in Tools — File operations, shell execution, git, grep, web fetch, and more
- ☁️ Azure OpenAI / AI Foundry — API key and Azure Entra ID authentication
- 🦙 Ollama — Full local LLM support
- 📊 Multiple LLM Profiles — Configure and switch between different LLM providers
- 🔒 Tool Safety — Configurable approval for write/execute operations
# Build from source
git clone https://github.com/powergentic/cli.git
dotnet publish src/Pga.Cli -c Release -o ./publish
# Add to PATH
export PATH="$PATH:$(pwd)/publish"# Initialize configuration
pga config init
# Add an Azure OpenAI profile
pga config add-profile myazure
# Or add an Ollama profile
pga config add-profile local
# View configuration
pga config show# Start interactive chat
pga chat
# Or with a specific project path
pga chat --path /path/to/project
# Single-shot commands
pga explain "git rebase -i HEAD~5"
pga suggest "find all TODO comments in the project"
# Initialize a project with AGENTS.md
pga init --path /path/to/projectPGA stores its configuration at ~/.powergentic/config.json. This keeps your LLM credentials separate from your project files.
{
"version": "1.0",
"defaultProfile": "azure-gpt4o",
"profiles": {
"azure-gpt4o": {
"provider": "azure-openai",
"displayName": "Azure GPT-4o",
"endpoint": "https://your-resource.openai.azure.com",
"deploymentName": "gpt-4o",
"apiKey": "your-api-key-here",
"authMode": "key"
},
"azure-entra": {
"provider": "azure-openai",
"displayName": "Azure with Entra ID",
"endpoint": "https://your-resource.openai.azure.com",
"deploymentName": "gpt-4o",
"authMode": "entra",
"tenantId": "your-tenant-id"
},
"local-ollama": {
"provider": "ollama",
"displayName": "Local Ollama",
"ollamaHost": "http://localhost:11434",
"ollamaModel": "llama3"
}
},
"autoSelect": {
"enabled": true,
"rules": [
{
"pattern": "quick-*",
"profile": "local-ollama",
"description": "Use local Ollama for quick tasks"
}
]
},
"toolSafety": {
"mode": "prompt-writes",
"trustedPaths": []
},
"ui": {
"showToolCalls": true,
"streamResponses": true
}
}| Mode | Description |
|---|---|
key |
API key authentication (stored in .powergentic/config.json) |
entra |
Azure Entra ID / Azure AD authentication (uses DefaultAzureCredential) |
Place an AGENTS.md file at the root of your project to provide global instructions to the AI agent:
# Project Instructions
You are working on a .NET microservices project.
## Rules
- Follow clean architecture patterns
- Use MediatR for CQRS
- All endpoints must have OpenAPI documentationCreate specialized agents in the .powergentic/agents/ directory (or .github/agents/):
---
name: api-designer
description: Designs REST APIs following company standards
profile: azure-gpt4o
tools:
- file_read
- file_write
- grep_search
---
# API Designer Agent
You are an expert REST API designer. When designing APIs:
1. Follow RESTful conventions
2. Use consistent naming
3. Include proper error responses
4. Generate OpenAPI specs| Tool | Safety Level | Description |
|---|---|---|
shell_execute |
Execute | Run shell commands |
file_read |
Read-only | Read file contents with optional line ranges |
file_write |
Write | Create or overwrite files |
file_edit |
Write | Search-and-replace within files |
file_search |
Read-only | Find files by glob pattern |
grep_search |
Read-only | Search file contents with text/regex |
directory_list |
Read-only | List directory contents |
git_operations |
Read-only | Git status, log, diff, blame, etc. |
web_fetch |
Read-only | Fetch content from URLs |
| Mode | Description |
|---|---|
auto-approve |
All tools run without confirmation |
prompt-writes |
Read-only tools auto-approve; write/execute tools require confirmation |
prompt-always |
All tools require user confirmation |
| Command | Description |
|---|---|
/help |
Show available commands |
/exit, /quit |
Exit interactive mode |
/clear |
Clear conversation history |
/agents |
List available agents |
/agent <name> |
Switch to a specific agent |
/profile <name> |
Switch LLM profile |
/status |
Show current session info |
/multiline |
Enter multi-line input mode |
- .NET 10 SDK (or .NET 8+)
dotnet builddotnet test# macOS (Apple Silicon)
dotnet publish src/Pga.Cli -c Release -r osx-arm64
# macOS (Intel)
dotnet publish src/Pga.Cli -c Release -r osx-x64
# Linux
dotnet publish src/Pga.Cli -c Release -r linux-x64
# Windows
dotnet publish src/Pga.Cli -c Release -r win-x64PowergenticAgent/
├── src/
│ ├── Pga.Cli/ # CLI application (System.CommandLine + Spectre.Console)
│ │ ├── Commands/ # Chat, Explain, Suggest, Config, Init commands
│ │ └── Rendering/ # Console output rendering
│ └── Pga.Core/ # Core library
│ ├── Agents/ # Agent loading, parsing, scoping
│ ├── Chat/ # Chat orchestration and message history
│ ├── Configuration/ # Config management and LLM profiles
│ ├── Providers/ # LLM provider factory (Azure OpenAI, Ollama)
│ └── Tools/ # Built-in tool implementations
├── tests/
│ └── Pga.Tests/ # Unit tests
├── PowergenticAgent.sln
└── Directory.Build.props
- Microsoft.Extensions.AI — Unified AI abstractions (
IChatClient) - Azure.AI.OpenAI — Azure OpenAI integration
- Azure.Identity — Azure Entra ID authentication
- OllamaSharp — Ollama local LLM integration
- System.CommandLine — CLI command parsing
- Spectre.Console — Rich terminal output
- YamlDotNet — YAML frontmatter parsing
- Markdig — Markdown processing
Contributions are welcome! Please open an issue or submit a pull request.
Full documentation is available in the docs/ directory:
- Getting Started — First-time setup and your first chat
- Installation — Building from source and publishing binaries
- Commands Reference — All CLI commands and options
- Configuration — Full config file reference
- Agents — Agent system, AGENTS.md, scoping
- Tools — All 9 built-in tools
- LLM Providers — Azure OpenAI, AI Foundry, and Ollama setup
- Architecture — Project structure and internals
MIT License — see LICENSE for details.
The Powergentic CLI** project is maintained by Chris Pietschmann, founder of Build5Nines, Microsoft MVP, HashiCorp Ambassador, IBM Champion, and Microsoft Certified Trainer (MCT).
Powergentic CLI is experimental prerelease software and is provided "as is", without warranties of any kind.
LLM output can be incorrect, incomplete, insecure, or destructive. Always review prompts, generated content, and tool actions before approval or execution.
You are solely responsible for commands run, files modified, and data accessed while using this tool.
Do not use Powergentic CLI in production or against sensitive systems/data unless you have appropriate safeguards, backups, and approval controls in place.
