Skip to content

rudra496/termmind

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

PyPI version Python License Downloads Tests Code style

TermMind β€” AI-Powered Terminal Assistant | Multi-Provider CLI Coding Tool

A modern, open-source AI terminal assistant. Free, beautiful, and lives in your terminal.

  ╔═════════════════════════════╗
  β•‘     T e r m M i n d         β•‘
  β•‘  AI Terminal Assistant      β•‘
  β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

What is TermMind?

TermMind is a CLI tool that lets you chat with AI models directly in your terminal. It can read, write, and edit files, run commands, understand your codebase, and help you code faster β€” all with a beautiful, rich terminal UI.

Think Claude Code or Aider, but free, open-source, and lightweight.

✨ Features

  • 🎨 Beautiful terminal UI β€” Syntax highlighting, markdown rendering, streaming responses
  • πŸ”Œ Multi-provider β€” OpenAI, Anthropic Claude, Google Gemini, Groq, Together.ai, OpenRouter, Ollama
  • πŸ’° Free tiers supported β€” Works with Gemini, Groq, and Ollama at zero cost
  • πŸ“ Smart context β€” Automatically includes relevant files from your project
  • ✏️ File editing β€” AI-powered file creation and editing with diff support
  • ↩️ Undo system β€” Every edit is tracked; undo any change with /undo
  • πŸ’Ύ Session management β€” Save and load conversations
  • πŸ“Š Cost tracking β€” Real-time token count and cost estimation
  • πŸ”„ Provider switching β€” Change models mid-conversation with /provider
  • 🌳 File tree β€” Visual project structure with .termmindignore support
  • πŸ” Code search β€” Find anything in your project files
  • πŸ™ Git integration β€” Status, diff, log, and AI-generated commit messages
  • ⚑ Streaming β€” See responses as they're generated, not after
  • πŸ“¦ Snippet Manager β€” Save, search, and reuse code snippets with template variables
  • πŸ—οΈ Project Templates β€” Scaffold projects from 8 built-in templates (Python, FastAPI, React, Next.js, etc.)
  • πŸ”§ Refactoring Engine β€” AI-powered refactoring with diff preview, confirmation, and undo

πŸš€ Installation

pip install termmind

Or from source:

git clone https://github.com/rudra496/termmind.git
cd termmind
pip install -e .

🏁 Quick Start

1. Set up your API

termmind init

This walks you through selecting a provider and entering your API key. You can also manually edit ~/.termmind/config.json.

2. Start chatting

termmind chat

3. Ask questions

termmind ask "Explain async/await in Python"

4. Edit files

termmind edit main.py "Add input validation to the parse_args function"

5. Review code

termmind review ./src

πŸ“‹ Commands

Command Description
termmind init Configure API provider, key, and model
termmind chat Start interactive chat session
termmind ask "q" One-shot question (no session)
termmind edit file Edit a file with AI
termmind review path Review code in directory
termmind explain file Explain a file
termmind test file Generate tests for a file
termmind history Show saved sessions
termmind config Show current configuration

Chat Commands

Inside termmind chat, use slash commands:

Command Description
/edit <file> [instruction] Edit a file with AI
/run <command> Run a shell command
/files List files in context
/add <file> Add file to context
/search <query> Search project files
/tree Show file tree
/clear Clear conversation
/save [name] Save session
/load <name> Load saved session
/model [name] Show/switch model
/provider [name] Show/switch provider
/cost Show token usage & cost
/theme dark/light Change color theme
/undo Undo last file edit
/diff Show session changes
/status Git status + context info
/git [status/log/diff] Git operations
/snippet save <name> Save code as a snippet
/snippet list List saved snippets
/snippet load <name> Load snippet into context
/snippet search <query> Search snippets
/template list List project templates
/template use <name> Scaffold a project
/refactor <op> <file> AI-powered refactoring
/refactor undo Undo last refactoring
/help Show all commands

πŸ”‘ Provider Setup

πŸ†“ Free Options (no cost)

Google Gemini

  1. Go to aistudio.google.com
  2. Create a free API key
  3. Select gemini during termmind init

Groq

  1. Go to console.groq.com
  2. Sign up and create an API key
  3. Super fast inference on open-source models

Ollama (fully offline)

  1. Install: curl -fsSL https://ollama.ai/install.sh | sh
  2. Pull a model: ollama pull llama3.2
  3. No API key needed! Just select ollama during setup

πŸ’³ Paid Options

OpenAI

  1. Go to platform.openai.com
  2. Create an API key
  3. Supports GPT-4o, GPT-4o-mini, etc.

OpenRouter

  1. Go to openrouter.ai
  2. Access 100+ models from one API key

βš™οΈ Configuration

Config is stored at ~/.termmind/config.json:

{
  "provider": "gemini",
  "api_key": "your-key-here",
  "model": "gemini-2.0-flash",
  "max_tokens": 4096,
  "temperature": 0.7,
  "theme": "dark"
}

.termmindignore

Like .gitignore but for AI context. Create in your project root:

node_modules/
__pycache__/
*.min.js
dist/
.env

πŸ†š Comparison

Feature TermMind Claude Code Aider Open Interpreter
Open Source βœ… MIT ❌ βœ… Apache βœ… MIT
Free Tier βœ… (Gemini/Groq) ❌ ❌ ❌
Local/Offline βœ… (Ollama) ❌ βœ… βœ…
Streaming βœ… βœ… βœ… βœ…
Multi-Provider βœ… 6+ ❌ βœ… βœ…
Rich Terminal UI βœ… βœ… ❌ ❌
File Editing βœ… βœ… βœ… βœ…
Undo Edits βœ… ❌ βœ… ❌
Cost Tracking βœ… ❌ ❌ ❌
Session Save/Load βœ… ❌ ❌ ❌
Dependencies 4 Heavy Moderate Heavy
Python βœ… 3.8+ Node.js Python Python

🐳 Docker Quick Start

# Build and run
docker compose up --build

# With local Ollama (fully offline)
docker compose --profile local-llm up --build

# One-shot question via Docker
docker compose run --rm termmind ask "Explain async/await in Python"

πŸ”§ Shell Completions

# Auto-install for your current shell
termmind completions install

# Or manually: generated scripts live in ~/.termmind/completions/
# Bash:
  echo 'source ~/.termmind/completions/termmind.bash' >> ~/.bashrc
# Zsh:
  echo 'fpath=(~/.termmind/completions $fpath)' >> ~/.zshrc
# Fish:
  cp ~/.termmind/completions/termmind.fish ~/.config/fish/completions/

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   CLI (cli.py)              β”‚
β”‚  click commands: chat, ask, edit, review…   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚              β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  Commands    β”‚ β”‚  Diff Engine  β”‚
    β”‚  (/edit,…)   β”‚ β”‚  (diff_       β”‚
    β”‚  commands.py β”‚ β”‚   engine.py)  β”‚
    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚         Context Engine          β”‚
    β”‚  context.py + memory.py        β”‚
    β”‚  (smart file selection,        β”‚
    β”‚   code index, caching)         β”‚
    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  File Ops    β”‚ β”‚  Git Module   β”‚
    β”‚  file_ops.py β”‚ β”‚  git.py       β”‚
    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚         API Client              β”‚
    β”‚  api.py + providers.py         β”‚
    β”‚  (streaming, multi-provider)    β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚       Plugin System              β”‚
    β”‚  plugins.py (on_start, on_msg…) β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ What Makes TermMind Unique

These features set TermMind apart from every other AI coding assistant:

🎨 Smart Diff Preview System

  • Side-by-side diff view in the terminal with rich syntax highlighting
  • Hunk-by-hunk confirmation β€” accept or reject individual changes
  • Auto-detect edit type β€” insert, delete, replace, move, rename
  • Multi-file diff statistics β€” insertions, deletions, files changed
  • Beautiful colored output (red for removals, green for additions)

🧠 Code Context Memory

  • Persists across sessions β€” remembers your project structure
  • Lightweight code index β€” function signatures, class definitions, imports
  • Incremental updates β€” only re-indexes changed files
  • 9 languages supported β€” Python, JS, TS, Go, Rust, Java, Ruby, C, C++
  • Query the index β€” find functions/classes by name pattern instantly

🐚 Shell Integration

  • Auto-detect shell β€” bash, zsh, fish
  • Generate completion scripts for all three shells
  • Terminal capability detection β€” true color, Unicode, emoji, copy/paste
  • Auto-resize handling β€” responds to terminal resize events
  • One-command install β€” termmind completions install

πŸ“¦ Snippet Manager

  • Save snippets from conversations β€” extracts code blocks automatically
  • Search by name, description, tags, or code content with relevance scoring
  • Template variables β€” {{filename}}, {{datetime}}, {{user}}, {{cwd}}, {{year}}, etc.
  • Auto-suggest relevant snippets based on conversation context
  • Import/Export β€” share snippet collections as JSON files
  • Usage tracking β€” tracks how often each snippet is used
  • Language detection β€” auto-detects programming language from content
  • Stored in ~/.termmind/snippets/ β€” portable and shareable

πŸ—οΈ Project Templates

  • 8 built-in templates β€” scaffold complete projects instantly:
    • python-package β€” Modern Python package with pyproject.toml, tests, CI
    • fastapi-api β€” FastAPI REST API with auth, DB, Docker
    • flask-api β€” Flask REST API with SQLAlchemy
    • cli-tool β€” Python CLI tool with click
    • react-app β€” React + TypeScript + Vite
    • nextjs-app β€” Next.js with App Router
    • express-api β€” Express.js REST API
    • django-app β€” Django with Django REST Framework
  • Template variables β€” {{project_name}}, {{module_name}}, {{author}}, etc.
  • Custom templates β€” add your own to ~/.termmind/templates/
  • Post-generation instructions β€” clear next steps for each template

πŸ”§ Refactoring Engine

  • 8 refactoring operations β€” extract-function, rename, inline, extract-class, simplify, dead-code, sort-imports, add-types
  • AI-powered β€” uses your configured model for intelligent refactoring
  • Diff preview β€” see exactly what will change before applying
  • Confirmation step β€” approve or reject each refactoring
  • Undo support β€” every refactoring is tracked and reversible
  • History β€” view past refactorings with /refactor history
  • Local sort-imports β€” PEP 8 import sorting without AI needed

⚑ Performance

Operation Time
Startup (cold) ~0.3s
Startup (warm) ~0.1s
Context selection (10 files) ~0.05s
Code index build (100 files) ~0.8s
Code index update (incremental) ~0.05s
Diff render (1000 lines) ~0.02s

Measured on a typical developer machine. Actual times vary.

πŸ› οΈ Development

# Clone
git clone https://github.com/rudra496/termmind.git
cd termmind

# Install in dev mode
pip install -e .

# Run directly
python -m termmind.cli chat

# Test
python -m pytest

# Docker dev environment
docker compose up --build

Project Structure

termmind/
β”œβ”€β”€ termmind/
β”‚   β”œβ”€β”€ __init__.py       # Version info
β”‚   β”œβ”€β”€ cli.py            # Main CLI entry point
β”‚   β”œβ”€β”€ api.py            # API client (streaming, multi-provider)
β”‚   β”œβ”€β”€ config.py         # Configuration management
β”‚   β”œβ”€β”€ context.py        # Smart file context builder
β”‚   β”œβ”€β”€ commands.py       # Slash command handlers
β”‚   β”œβ”€β”€ file_ops.py       # File read/write/edit/search
β”‚   β”œβ”€β”€ git.py            # Git operations
β”‚   β”œβ”€β”€ providers.py      # Provider implementations
β”‚   β”œβ”€β”€ plugins.py        # Plugin system
β”‚   β”œβ”€β”€ sessions.py       # Session save/load
β”‚   β”œβ”€β”€ themes.py         # Color themes
β”‚   β”œβ”€β”€ diff_engine.py    # Smart diff preview system
β”‚   β”œβ”€β”€ memory.py         # Code context memory/index
β”‚   β”œβ”€β”€ shell.py          # Shell integration & completions
β”‚   β”œβ”€β”€ snippets.py       # Snippet manager (save/search/reuse)
β”‚   β”œβ”€β”€ templates.py      # Project scaffolding templates
β”‚   β”œβ”€β”€ refactor.py       # AI-powered refactoring engine
β”‚   └── utils.py          # Token counting, utilities
β”œβ”€β”€ tests/
β”œβ”€β”€ Dockerfile
β”œβ”€β”€ docker-compose.yml
β”œβ”€β”€ pyproject.toml
β”œβ”€β”€ README.md
β”œβ”€β”€ CODE_OF_CONDUCT.md
β”œβ”€β”€ SECURITY.md
β”œβ”€β”€ CONTRIBUTING.md
└── LICENSE

🀝 Contributing

See CONTRIBUTING.md for detailed guidelines on:

  • Setting up the dev environment
  • Code style and conventions
  • Adding new providers and commands
  • Plugin development
  • Testing guidelines
  • PR and issue templates

πŸ“œ Code of Conduct

This project follows the Contributor Covenant Code of Conduct. By participating, you agree to uphold this standard.

πŸ”’ Security

See SECURITY.md for our security policy, supported versions, and vulnerability reporting guidelines.

Quick start:

  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/amazing
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push: git push origin feature/amazing
  5. Open a Pull Request

πŸ“„ License

MIT License β€” see LICENSE for details.


Made with ❀️ by the TermMind contributors

πŸ’‘ Why TermMind?

  • 7 providers, 1 tool β€” No need to switch between ChatGPT, Claude, Gemini apps
  • Code-aware β€” Understands your project structure, not just isolated files
  • Works offline β€” Use Ollama or local models with zero API costs
  • Extensible β€” Plugin system lets you add custom commands
  • Zero config β€” Works out of the box, configure only when you want to
  • Session history β€” Never lose context between sessions

πŸ‘€ Who Uses This?

Role How They Use It
Full-Stack Devs Quick code generation, refactoring, and debugging across languages
DevOps Engineers Generate Dockerfiles, CI configs, and Terraform files
Students Learn programming with an AI tutor that explains concepts
Open Source Contributors Understand unfamiliar codebases quickly
AI Enthusiasts Experiment with multiple LLM providers side by side

🌐 Connect

  • GitHub
  • LinkedIn
  • X/Twitter
  • Facebook
  • YouTube
  • Dev.to
  • ResearchGate

Built with ❀️ by rudra496 · LinkedIn
MIT License Β· Free & Open Source Forever

About

πŸ€– AI-powered terminal assistant β€” 7 providers, 40+ commands, code analysis, and more. Works with OpenAI, Claude, Gemini, and local models.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors