{"id":46698931,"url":"https://github.com/warlockee/1cmd-ai","last_synced_at":"2026-03-15T23:01:41.853Z","repository":{"id":343138520,"uuid":"1176414823","full_name":"warlockee/1cmd-ai","owner":"warlockee","description":"AI-powered terminal manager — control your machines from Telegram. One bot per machine.","archived":false,"fork":false,"pushed_at":"2026-03-13T22:46:25.000Z","size":535,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-14T07:32:02.329Z","etag":null,"topics":["ai","ai-agent","automation","devops","homelab","remote-access","self-hosted","server-management","telegram","terminal"],"latest_commit_sha":null,"homepage":"https://1cmd.ai","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/warlockee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2026-03-09T02:02:33.000Z","updated_at":"2026-03-13T22:46:31.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/warlockee/1cmd-ai","commit_stats":null,"previous_names":["warlockee/1cmd-ai"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/warlockee/1cmd-ai","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/warlockee%2F1cmd-ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/warlockee%2F1cmd-ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/warlockee%2F1cmd-ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/warlockee%2F1cmd-ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/warlockee","download_url":"https://codeload.github.com/warlockee/1cmd-ai/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/warlockee%2F1cmd-ai/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30519070,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-14T19:51:21.629Z","status":"ssl_error","status_checked_at":"2026-03-14T19:51:12.959Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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","ai-agent","automation","devops","homelab","remote-access","self-hosted","server-management","telegram","terminal"],"created_at":"2026-03-09T06:04:24.659Z","updated_at":"2026-03-15T23:01:41.818Z","avatar_url":"https://github.com/warlockee.png","language":"Python","readme":"# OneCmd\n\nAn AI-powered terminal manager — control and automate your machines from Telegram.\n\nWorks on **macOS** and **Linux**.\n\n\u003e **One bot per machine.** Each machine needs its own Telegram bot token. Create a separate bot for each machine you want to control (e.g. `@my_macbook_bot`, `@my_server_bot`). Only one onecmd instance can use a given bot token at a time.\n\n## Quick Start\n\nUse the one-line installer (clones repo, configures everything interactively):\n\n```bash\ncurl -sL https://1cmd.ai/setup.sh | bash\n```\nThen start the bot:\n\n```bash\nonecmd --apikey YOUR_BOT_TOKEN\n```\n\nOr install from source:\n\n```bash\ngit clone https://github.com/warlockee/1cmd-ai.git\ncd 1cmd-ai\npython3 -m venv .venv\n.venv/bin/pip install \".[macos]\"   # macOS (or just \".\" for Linux)\n.venv/bin/onecmd --apikey YOUR_BOT_TOKEN\n```\n\n## AI Manager\n\nThe AI manager is what makes OneCmd powerful. It's an LLM-powered agent that monitors, controls, and automates your terminals — so you can manage servers, run deployments, and debug issues all from a Telegram chat.\n\nSend `.mgr` to enter manager mode. Your messages go to the AI agent, which can see and interact with all your terminals. Dot commands (`.list`, `.1`, etc.) still work normally. Send `.exit` to leave manager mode.\n\n### What it can do\n\n- List, read, and send commands to any terminal\n- Name terminals for easy identification (proactively suggests names based on content)\n- Execute commands asynchronously and notify you when they finish\n- Queue commands to the same terminal so they don't overlap\n- Auto-detect pending commands at prompts and submit them\n- Follow up on completed commands (results feed back to the LLM)\n- Run repeating background tasks (\"watch this terminal until X happens\")\n- Detect and recover stuck terminals (Smart Diff — probe, compare before/after)\n- Summarize long conversations to preserve context within token limits\n- Auto-fallback between Gemini and Claude on rate limits\n- Remember things across restarts (persistent memory)\n\n### Providers\n\nThe manager supports **Gemini** (Google) and **Claude** (Anthropic). The provider is selected automatically based on which API key is set. If both are set, Gemini is preferred. Override the model with `ONECMD_MGR_MODEL`.\n\n```bash\n# Using Gemini (recommended — fast and free tier available)\nGOOGLE_API_KEY=... onecmd --apikey YOUR_BOT_TOKEN\n\n# Using Claude\nANTHROPIC_API_KEY=sk-... onecmd --apikey YOUR_BOT_TOKEN\n```\n\n### Standard Operating Procedure\n\nOn first run, the manager copies the default SOP to `.onecmd/agent_sop.md`. This file guides the AI on decision-making and stuck terminal recovery.\n\nTo add your own rules, create `.onecmd/custom_rules.md`:\n\n```markdown\n- Always run tests before deploying\n- Never restart the database without asking me first\n- Prefer yarn over npm\n```\n\nCustom rules are appended to the default SOP automatically — no need to edit the base file.\n\n### Manager commands\n\n| Command | Action |\n|---------|--------|\n| `.mgr` | Enter AI manager mode |\n| `.exit` | Leave manager mode |\n| `.health` | Manager health report (uptime, memory, stats) |\n\n## Manual Mode\n\nManual mode is always available as a stable, reliable fallback. It works without any AI provider — just you and your terminals over Telegram. No API keys, no token limits, no network dependencies beyond Telegram itself. When the AI is down or you need direct control, manual mode is always there.\n\nIn manual mode, any text you send is typed directly into the connected terminal as keystrokes.\n\n| Command | Action |\n|---------|--------|\n| `.list` | List available terminal sessions |\n| `.1` `.2` ... | Connect to a session by number |\n| `.rename \u003cN\u003e \u003cname\u003e` | Name a terminal for easy identification |\n| `.help` | Show all commands |\n| Any other text | Sent as keystrokes to the connected terminal |\n\n### Keystroke Modifiers\n\nPrefix your message with an emoji to add a modifier key:\n\n| Emoji | Modifier | Example |\n|-------|----------|---------|\n| `❤️` | Ctrl | `❤️c` = Ctrl+C |\n| `💙` | Alt | `💙x` = Alt+X |\n| `💚` | Cmd | macOS only |\n| `💛` | ESC | `💛` = send Escape |\n| `🧡` | Enter | `🧡` = send Enter |\n| `💜` | Suppress auto-newline | `ls -la💜` = no Enter appended |\n\n### Escape Sequences\n\n`\\n` for Enter, `\\t` for Tab, `\\\\` for literal backslash.\n\n## How It Works\n\nOn **macOS**, onecmd reads terminal window text via the Accessibility API (`AXUIElement`), injects keystrokes via `CGEvent`, and focuses windows using `AXUIElement`. It works with any terminal app — no Screen Recording permission needed.\n\nOn **Linux**, onecmd uses tmux: `tmux list-panes` to discover sessions, `tmux capture-pane` to read content, and `tmux send-keys` to inject keystrokes. All sessions you want to control must run inside tmux.\n\nIn both cases, terminal output is sent as monospace text to Telegram with a refresh button to update on demand.\n\n### Linux: tmux requirement\n\nOn Linux, onecmd controls tmux sessions. Make sure your work is running inside tmux:\n\n```bash\n# Start a named session\ntmux new -s dev\n\n# Or start detached sessions\ntmux new -s server1 -d\ntmux new -s server2 -d\n```\n\nThen run onecmd separately (outside tmux or in its own tmux window) and use `.list` to see your sessions.\n\n## Configuration\n\n### Options\n\n| Flag | Description |\n|------|-------------|\n| `--apikey \u003ctoken\u003e` | Telegram bot API token |\n| `--enable-otp` | Enable TOTP authentication (off by default) |\n| `--use-weak-security` | Disable TOTP even if previously configured |\n| `--dbfile \u003cpath\u003e` | Custom database path (default: `./mybot.sqlite`) |\n| `--dangerously-attach-to-any-window` | Show all windows, not just terminals (macOS only) |\n| `--verbose` | Enable debug logging |\n\n### Environment Variables\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `GOOGLE_API_KEY` | (none) | Google API key for the AI manager (Gemini) |\n| `ANTHROPIC_API_KEY` | (none) | Anthropic API key for the AI manager (Claude) |\n| `ONECMD_MGR_MODEL` | (auto) | LLM model override |\n| `ONECMD_VISIBLE_LINES` | `40` | Number of terminal lines to include in output |\n| `ONECMD_SPLIT_MESSAGES` | off | Set to `1` to split long output across multiple messages |\n\nTerminal output is sent as a single message by default. Each new command or refresh **deletes the previous output messages** and sends fresh ones, creating a clean \"live terminal\" view rather than spamming the chat.\n\nIf your terminal produces very long output (e.g. build logs) and you want to see all of it, enable splitting:\n\n```bash\nONECMD_SPLIT_MESSAGES=1 onecmd --apikey YOUR_BOT_TOKEN\n```\n\n### Prerequisites\n\n- **Python 3.11+**\n- **macOS:** Accessibility permission (prompted on first use)\n- **Linux:** `tmux`\n\n### Manual Run\n\n```bash\n# Create venv and install\npython3 -m venv .venv\n.venv/bin/pip install \".[macos]\"   # macOS\n.venv/bin/pip install .            # Linux\n\n# Run with AI manager\nGOOGLE_API_KEY=... .venv/bin/onecmd --apikey YOUR_BOT_TOKEN\n\n# Run without AI manager (manual mode only)\n.venv/bin/onecmd --apikey YOUR_BOT_TOKEN\n```\n\n## Security\n\n- **Owner lock**: The first Telegram user to message the bot becomes the owner. All other users are ignored.\n- **TOTP**: OTP is **off by default** for a frictionless first-time experience. Use `--enable-otp` to set up Google Authenticator — a QR code is shown on first launch. Use `--use-weak-security` to disable OTP even if previously configured.\n- **One bot = one machine**: Don't share a bot token across machines. Each machine should have its own bot.\n- **Reset**: Delete `mybot.sqlite` to reset ownership and TOTP.\n\n## Permissions\n\n**macOS:** Requires Accessibility permission. macOS will prompt on first use, or grant it in System Settings \u003e Privacy \u0026 Security \u003e Accessibility.\n\n**Linux:** No special permissions needed. Just ensure the user running onecmd can access the tmux socket.\n\n## Supported Terminals\n\n**macOS:** Terminal.app, iTerm2, Ghostty, kitty, Alacritty, Hyper, Warp, WezTerm, Tabby.\n\n**Linux:** Any terminal running inside tmux.\n\n## Architecture\n\nSee [ARCHITECTURE.md](ARCHITECTURE.md) for detailed technical documentation.\n\n## License\n\nMIT -- see [LICENSE](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwarlockee%2F1cmd-ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwarlockee%2F1cmd-ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwarlockee%2F1cmd-ai/lists"}