Skip to content

naidu199/SimhaCLI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

51 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🦁 SimhaCLI

AI-Powered Coding Agent for Your Terminal

PyPI version Python 3.10+ License: MIT

Built by Narasimha Naidu Korrapati

Features β€’ Installation β€’ Configuration β€’ Commands β€’ Tools


πŸ“– Overview

SimhaCLI is a powerful terminal-based AI coding agent that brings the intelligence of Large Language Models directly into your development workflow. It reads your code, executes tools, manages sessions, and streams its thinking β€” all inside your terminal.

SimhaCLI🦁  starting  refactor my auth module
⠦ 🦁 Simha is working... (2.1s)
πŸ’­ SimhaCLI thinking (1.3s) The user wants to refactor the auth module...  β–Œ
πŸ’­ thought for 1.3s

I'll read the existing auth module first and then suggest improvements.
SimhaCLI🦁  complete in 14.2s  8821 tokens (8120 prompt + 701 completion)

✨ Features

πŸ€– Intelligent Agentic Loop

  • Multi-turn reasoning β€” autonomously calls tools, reads results, and continues until the task is done
  • Parallel tool execution β€” runs multiple tool calls simultaneously with asyncio.gather
  • Context compression β€” auto-summarises history when the context window fills up
  • Loop detection β€” detects and breaks repetitive behaviour automatically
  • Truncation recovery β€” handles finish_reason: length gracefully, continues or retries

πŸ’­ Thinking Display

  • Live reasoning β€” streaming πŸ’­ display shows what the model is thinking in grey italic text
  • Running timer β€” see how long the model has been reasoning
  • Collapsed summary β€” freezes as πŸ’­ thought for X.Xs when reasoning completes (models with extended thinking)

⏱️ Performance Visibility

  • Live working spinner β€” β ¦ 🦁 Simha is working... (10.1s) shows elapsed time
  • Total request timer β€” complete time shown on every response
  • Token tracking β€” complete in 12.4s 8375 tokens (8119 prompt + 256 completion)

πŸ› οΈ 16 Built-in Tools

Category Tools
πŸ“– Read read_file, list_dir, glob, grep
✏️ Write write_file, edit_file
πŸ–₯️ Shell shell (40+ blocked dangerous commands)
🌐 Web web_search, web_fetch
πŸ’Ύ Memory todos (task management), memory (persistent key-value)
πŸ€– Sub-agents codebase_investigator, code_reviewer, test_generator, bug_fixer, refactorer

πŸ”Œ MCP (Model Context Protocol)

  • Connect to any MCP server via stdio or HTTP/SSE transport
  • Tools discovered automatically at startup
  • Manage connections live with /mcp

πŸ’Ύ Session Management

  • Save sessions to disk (/save) and resume them later (/resume <id>)
  • Create mid-task checkpoints (/checkpoint / /restore <id>)
  • Undo the last file edit (/undo)

πŸ”’ Safety & Approval

  • Configurable approval policy β€” from on_request to fully autonomous yolo
  • Shell command allowlist/blocklist
  • Environment variable masking (API keys, tokens, secrets never leaked to the model)

πŸš€ Installation

Prerequisites

  • Python 3.10+
  • An API key (OpenRouter, OpenAI, Gemini, or any OpenAI-compatible endpoint)

Install from PyPI (Recommended)

pip install simhacli
simhacli                          # interactive mode
simhacli "fix the bug in app.py"  # single prompt
simhacli --help                   # show all options

Install from Source

git clone https://github.com/naidu199/SimhaCLI.git
cd SimhaCLI
pip install -e .
simhacli

βš™οΈ Configuration

SimhaCLI looks for configuration in two places (project overrides global):

Location Purpose
~/.simhacli/config.toml Global defaults
<project>/.simhacli/config.toml Per-project overrides

Minimal config.toml

[model]
name = "mistralai/devstral-2512:free"
temperature = 1.0

api_key = "your_api_key_here"
api_base_url = "https://openrouter.ai/api/v1"

Environment Variables

# Windows (PowerShell)
$env:API_KEY = "your_api_key_here"
$env:API_BASE_URL = "https://openrouter.ai/api/v1"

# Linux / macOS
export API_KEY="your_api_key_here"
export API_BASE_URL="https://openrouter.ai/api/v1"

Set credentials interactively

simhacli
> /credentials

Full config.toml Reference

[model]
name = "mistralai/devstral-2512:free"   # any OpenAI-compatible model
temperature = 1.0

api_key = "sk-..."
api_base_url = "https://openrouter.ai/api/v1"

max_turns = 72                  # max agentic loop turns per request
max_tool_output_tokens = 50000  # truncate large tool outputs
approval = "on_request"         # see Approval Policies below
hooks_enabled = true
developer_instructions = "Always prefer TypeScript over JavaScript."
user_instructions = "Be concise."

# Restrict which tools the agent can use
# allowed_tools = ["read_file", "write_file", "shell"]

[shell_environment]
ignore_default_excludes = false
exclude_patterns = ["*KEY*", "*TOKEN*", "*SECRET*"]

# Add MCP servers
[mcp_servers.filesystem]
command = "npx"
args = ["-y", "@modelcontextprotocol/server-filesystem", "/home/user/projects"]

# HTTP/SSE transport
[mcp_servers.my_remote]
url = "http://localhost:8000/sse"

# Add lifecycle hooks
[[hooks]]
name = "format_on_write"
trigger = "after_tool"
command = "black {file}"
enabled = true

Approval Policies

Policy Behaviour
on_request Ask before shell commands and file writes (default)
always Ask before every tool call
auto_approve Auto-approve everything
auto_edit Auto-approve file edits, ask for shell
on_failure Only ask if the tool fails
yolo Never ask β€” fully autonomous
never Block all tool calls

πŸ’¬ Commands

Type any of these during an interactive session:

Command Description
/help Show all commands
/exit / /quit Exit SimhaCLI
/clear Clear conversation history
/model <name> Switch model (saves to project config)
/approval <policy> Change approval policy
/config Show current configuration
/credentials View or update API key / base URL
/tools List all available tools
/mcp Show MCP server connection status
/stats Show session statistics and token usage
/save Save current session to disk
/sessions List all saved sessions
/resume <id> Resume a previously saved session
/checkpoint Create a checkpoint of the current session
/restore <id> Restore a checkpoint
/undo Undo the last file edit

πŸ”§ Custom Tools

Drop a Python file into <project>/.simhacli/tool/ and SimhaCLI picks it up automatically:

from tools.base import Tool, ToolResult
from pydantic import Field

class MyTool(Tool):
    name = "my_tool"
    description = "Does something useful"

    class Arguments(Tool.Arguments):
        message: str = Field(description="Input message")

    async def execute(self, args: Arguments) -> ToolResult:
        return ToolResult.success_result(f"Got: {args.message}")

πŸ–₯️ CLI Options

simhacli [OPTIONS] [PROMPT]

Options:
  --cwd PATH        Set working directory
  --model TEXT      Override model name
  --approval TEXT   Override approval policy
  --help            Show this message and exit

πŸ”— Links


Made with ❀️ by Narasimha Naidu Korrapati

About

AI-Powered Coding Agent for Your Terminal

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages