{"id":41996033,"url":"https://github.com/ducks/llm-tui","last_synced_at":"2026-01-26T01:01:27.466Z","repository":{"id":326980282,"uuid":"1105628022","full_name":"ducks/llm-tui","owner":"ducks","description":"TUI for LLM interaction with vim bindings, multi-provider support (Ollama, Claude, Bedrock), tool execution, and project-based session management","archived":false,"fork":false,"pushed_at":"2025-12-02T23:17:01.000Z","size":514,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-03T11:36:36.454Z","etag":null,"topics":["ai","llm","rust","tui"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ducks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-27T23:10:30.000Z","updated_at":"2025-12-02T02:13:20.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ducks/llm-tui","commit_stats":null,"previous_names":["ducks/llm-tui"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ducks/llm-tui","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ducks%2Fllm-tui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ducks%2Fllm-tui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ducks%2Fllm-tui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ducks%2Fllm-tui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ducks","download_url":"https://codeload.github.com/ducks/llm-tui/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ducks%2Fllm-tui/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28763082,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T00:37:26.264Z","status":"ssl_error","status_checked_at":"2026-01-26T00:37:25.959Z","response_time":113,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","llm","rust","tui"],"created_at":"2026-01-26T01:00:34.604Z","updated_at":"2026-01-26T01:01:27.405Z","avatar_url":"https://github.com/ducks.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LLM TUI\n\nA terminal user interface for LLM chat sessions supporting Ollama, Claude (Anthropic), and AWS Bedrock. Features vim-style keybindings, session management, tool execution with confirmation, and persistent file context.\n\n## Features\n\n- **Multi-Provider Support**: Ollama (local models), Claude API (Anthropic), and AWS Bedrock\n- **Tool System**: 6 built-in tools (Read, Write, Edit, Glob, Grep, Bash) with user confirmation\n- **File Context Persistence**: Files read during sessions are cached and restored across restarts\n- **Session Management**: Create, browse, rename, and delete chat sessions\n- **Project Support**: Organize sessions by project\n- **Vim Keybindings**: Modal editing (Normal/Insert/Command modes)\n- **Ollama Integration**: Streaming responses from local models with automatic memory management\n- **Unified Model Management**: Browse all providers (Ollama, Claude, Bedrock) in one screen, download Ollama models with one keypress\n- **Token Tracking**: Real-time token usage display with automatic context compaction\n- **Claude Code-Style UI**: Clean message formatting with colored bullets for different message types\n- **Context Loading**: Import context from files or other sessions\n- **SQLite Storage**: Efficient persistent storage with full conversation history\n- **Autosave**: Configurable save modes (disabled, on-send, timer)\n\n![Screenshot showing llm-tui session and project manage](screenshots/session-project-management.png)\n\n![Screenshot showing llm-tui mistral chat](screenshots/chat.png)\n\n\n## Installation\n\n### Prerequisites\n- [Ollama](https://ollama.ai) installed and running (for local models)\n- Anthropic API key (optional, for Claude API)\n- AWS credentials with Bedrock access (optional, for AWS Bedrock)\n- Rust toolchain (or use Nix)\n\n### With Nix\n```bash\ngit clone https://github.com/yourusername/llm-tui\ncd llm-tui\nnix-shell\ncargo build --release\n./target/release/llm-tui\n```\n\n### Without Nix\n```bash\ngit clone https://github.com/yourusername/llm-tui\ncd llm-tui\ncargo build --release\n./target/release/llm-tui\n```\n\nThe app will auto-start Ollama if configured (see Configuration section).\n\n## Usage\n\n### Keybindings\n\n**Global:**\n- `1`: Sessions screen\n- `2`: Chat screen (if session open)\n- `3`: Models screen\n- `?`: Help screen\n- `q`: Quit\n\n**Session List Screen:**\n- `j/k` or `↓/↑`: Navigate sessions\n- `g/G`: Jump to top/bottom\n- `Enter`: Open selected session\n- `Space`: Toggle project expand/collapse\n- `n`: New session in current project\n- `d`: Delete selected session\n\n**Chat Screen:**\n- `i`: Enter insert mode to type message\n- `Esc`: Return to normal mode\n- `Enter` (normal mode): Send message\n- `Enter` (insert mode): Add newline\n- `Ctrl+Space` (insert mode): Send message\n- `j/k`: Scroll up/down (normal mode)\n- `G`: Jump to bottom and resume auto-scroll\n\n**Models Screen:**\n- `j/k` or `↓/↑`: Navigate models (across all providers)\n- `Enter`: Select installed model or download non-installed Ollama model\n- Shows all providers: Ollama (local), Claude (API), Bedrock (AWS)\n- Installed Ollama models marked with `[installed]`\n- Current active model marked with `[current]`\n\n### Commands\n\n**Session Management:**\n- `:new` - Create new session with datetime ID\n- `:new my-session-name` - Create new session with custom name\n- `:new project my-project` - Create/switch to project (no session created)\n- `:rename my-new-name` - Rename current session\n- `:delete-session` or `:ds` - Delete current session\n- `:project discourse-yaks` - Set current project\n- `:w` or `:save` - Save current session manually\n- `:q` or `:quit` - Quit application\n\n**Provider Management:**\n- `:provider ollama` - Switch to Ollama (local models)\n- `:provider claude` - Switch to Claude API (requires ANTHROPIC_API_KEY)\n- `:provider bedrock` - Switch to AWS Bedrock (requires AWS credentials)\n\n**Context Loading:**\n- `:load filename.md` - Load context from a local file\n- `:load session-name` - Load context from another session\n  - Matches by exact ID, exact name, or partial name\n  - Cannot load from current session\n\n**Model Management:**\n- `:models` - Open model management screen\n- `:pull modelname` - Download a model from Ollama library\n- `:delete modelname` - Remove an installed model\n\n**Context Management:**\n- `:compact` - Manually compact conversation (summarize old messages)\n\n## Tool System\n\nWhen using Claude or Bedrock providers, the AI can use these tools to interact with your system:\n\n- **Read**: Read file contents (sandboxed to home directory)\n- **Write**: Create or overwrite files\n- **Edit**: Make targeted edits to existing files\n- **Glob**: Find files by pattern (e.g., `*.rs`, `src/**/*.toml`)\n- **Grep**: Search file contents with regex\n- **Bash**: Execute shell commands (sandboxed to home directory, 2min timeout)\n\nAll tool executions require user confirmation (y/n/q). Tool results are cached per session, and files read during a session are automatically restored when reopening the session.\n\n## Configuration\n\nConfig file location: `~/.config/llm-tui/config.toml`\n\nDefault configuration:\n```toml\nautosave_mode = \"onsend\"\nautosave_interval_seconds = 30\nollama_url = \"http://localhost:11434\"\nollama_auto_start = true\nollama_model = \"llama2\"\nollama_context_window = 4096\ndefault_llm_provider = \"ollama\"\nclaude_api_key = \"\"  # Set via ANTHROPIC_API_KEY env var\nclaude_model = \"claude-3-5-sonnet-20241022\"\nclaude_context_window = 200000\nbedrock_model = \"us.anthropic.claude-sonnet-4-20250514-v1:0\"\nbedrock_context_window = 200000\nautocompact_threshold = 0.75\nautocompact_keep_recent = 10\n```\n\nSettings:\n- `autosave_mode`: How to save sessions (default: \"onsend\")\n  - `\"disabled\"`: Manual save only (use `:w`)\n  - `\"onsend\"`: Save immediately when sending messages\n  - `\"timer\"`: Save every N seconds (see `autosave_interval_seconds`)\n- `autosave_interval_seconds`: Timer interval in seconds (default: 30)\n- `ollama_url`: Ollama server URL (default: \"http://localhost:11434\")\n- `ollama_auto_start`: Auto-start Ollama server if not running (default: true)\n- `ollama_model`: Default Ollama model (default: \"llama2\")\n- `ollama_context_window`: Context window for Ollama models (default: 4096)\n- `default_llm_provider`: Default provider on startup (default: \"ollama\")\n- `claude_model`: Default Claude model (default: \"claude-3-5-sonnet-20241022\")\n- `claude_context_window`: Context window for Claude models (default: 200000)\n- `bedrock_model`: Default Bedrock model (default: \"us.anthropic.claude-sonnet-4-20250514-v1:0\")\n- `bedrock_context_window`: Context window for Bedrock models (default: 200000)\n- `autocompact_threshold`: Trigger compaction at this % of context window (default: 0.75)\n- `autocompact_keep_recent`: Always keep this many recent messages uncompacted (default: 10)\n\nThe config file is automatically created with defaults on first run.\n\nExamples:\n```toml\n# Save every 5 minutes\nautosave_mode = \"timer\"\nautosave_interval_seconds = 300\n\n# Disable autosave entirely\nautosave_mode = \"disabled\"\n```\n\n## Automatic Context Compaction\n\nWhen conversations grow long, the TUI automatically summarizes old messages to stay within the model's context window. This happens at 75% capacity by default (configurable via `autocompact_threshold`).\n\nHow it works:\n- Monitors token usage shown in chat header: `Tokens: 1250/200000 (0%)`\n- At threshold (e.g., 75%), sends old messages to LLM for summarization\n- Replaces compacted messages with concise summary (\u003c500 tokens)\n- Always keeps recent N messages uncompacted (default: 10)\n- Summaries are always included in context, compacted messages filtered out\n\nYou can trigger compaction manually with `:compact` anytime. Use this to reduce token usage before hitting the limit.\n\n## Session Storage\n\nSessions and messages are stored in a SQLite database at:\n`~/.local/share/llm-tui/sessions.db`\n\nBenefits:\n- Efficient storage for long conversations\n- Fast queries and filtering\n- No system SQLite required (bundled with the binary)\n- Single file to backup or sync\n\n## Model Recommendations\n\n### For Chat\n- **mistral** - Fast, efficient, great for conversation\n- **llama3.2** - Latest generation, excellent instruction following\n- **phi3** - Microsoft's model, good balance of size and quality\n- **qwen2.5** - Strong at reasoning and chat\n\n### For Code\n- **codellama** - Meta's code-specialized model\n- **deepseek-coder** - Excellent at code generation and understanding\n- **starcoder2** - Multi-language code model\n\n### Note on Base Models\nModels without `:chat` suffix (like `llama2`) are base models trained for text\ncompletion, not conversation. They will try to continue your text rather than\nrespond as an assistant. Always use the `:chat` variant or dedicated chat\nmodels for interactive use.\n\nExamples:\n- `llama2` - Base model (text completion)\n- `llama2:chat` - Chat-tuned variant (conversation)\n\n## Roadmap\n\n- [x] Ollama integration with streaming responses\n- [x] SQLite-based session storage\n- [x] Configurable autosave modes\n- [x] Unified model management (browse, download, select across all providers)\n- [x] Model management commands (:models, :pull, :delete)\n- [x] Context loading from files and sessions (:load)\n- [x] Session rename and delete\n- [x] Claude API integration\n- [x] AWS Bedrock integration\n- [x] Tool system (Read, Write, Edit, Glob, Grep, Bash) with ripgrep\n- [x] Tool confirmation workflow\n- [x] File context persistence across sessions\n- [x] Token tracking and display\n- [x] Automatic context compaction (conversation summarization)\n- [x] Claude Code-style message formatting\n- [x] Help screen (press ?)\n- [x] GitHub Actions release workflow\n- [ ] OpenAI API integration\n- [ ] Setup wizard for API keys\n- [ ] Daily notes integration\n- [ ] Search functionality\n- [ ] Session export\n- [ ] Custom keybindings configuration\n- [ ] Code block syntax highlighting\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fducks%2Fllm-tui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fducks%2Fllm-tui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fducks%2Fllm-tui/lists"}