Skip to content

IMvision12/txtcode

Repository files navigation

txtcode

npm version   downloads   license   node version



Code from anywhere. Control your coding CLI from any messaging app.

Send a WhatsApp message. Watch your coding agent write code.

txtcode bridges messaging apps to AI coding assistants, giving you full remote control over your development environment from your phone, tablet, or any device with a chat app.


txtcode terminal interface

Why txtcode?

Code without a keyboard. Send a message from your phone, and txtcode dispatches it to an AI coding agent running back at your desk. Describe a bug fix in WhatsApp, telegram, discord or signal and watch Claude Code patch it or Ask for tests, get them written by Codex. No laptop required.:

  1. Text your AI from WhatsApp, Telegram, Discord, Slack, Teams, or Signal
  2. It writes code using Claude Code, Cursor, Codex, Gemini CLI, or other adapters
  3. You stay in control with mode switching and session logs

No port forwarding. No VPN. Just message and code.


✨ Features

Messaging-First

Connect via 6 platforms : WhatsApp, Telegram, Discord, Slack, Microsoft Teams, and Signal.

10 AI Providers

Anthropic, OpenAI, Google Gemini, Mistral, Moonshot, MiniMax, xAI Grok, Z.ai (Zhipu), HuggingFace, and OpenRouter. Instantly switch providers with /switch directly from your messaging app.

Hot-Switching

Use /switch to change AI providers or coding adapters on the fly without restarting the agent perfect when you hit rate limits or want to try a different model.

7 Coding Adapters

Claude Code, Cursor CLI, OpenAI Codex, Gemini CLI, Kiro CLI, OpenCode, and Ollama (local/free). Full coding CLI control in /code mode.

Session Logging

Per-session logs accessible from the TUI. Follow live, view by index, auto-pruned after 7 days.


🚀 Quick Start

Requires Node.js 20+ and npm 10+.

# Install globally
npm install -g txtcode-ai

# Launch the interactive TUI
txtcode

Or run without installing:

npx txtcode-ai

That's it. The interactive menu guides you through everything authentication, configuration, starting the agent, viewing logs, and more. No subcommands to memorize.


🐳 Docker

Run txtcode in a container without installing Node.js or npm locally.

Build the image:

docker build -t txtcode .

Run the container:

docker run -it \
  -v $(pwd):/workspace \
  -v ~/.txtcode:/root/.txtcode \
  txtcode
Flag Purpose
-v $(pwd):/workspace Mounts your project directory into the container
-v ~/.txtcode:/root/.txtcode Persists config, session data, and logs across runs

Note: API keys are stored securely via your OS keychain when running natively. Inside Docker, txtcode uses an encrypted file-based fallback (TXTCODE_DOCKER=1 is set automatically). You can also pass keys as environment variables with -e, e.g. -e ANTHROPIC_API_KEY=sk-....


📝 Supported Platforms

Platform Transport Setup
WhatsApp QR code pairing Scan QR in terminal on first run
Telegram Bot API Create bot via @BotFather, paste token
Discord Bot gateway Create app at discord.com/developers, paste bot token
Slack Socket Mode Create app at api.slack.com, enable Socket Mode
Teams Bot Framework Register bot at dev.teams.microsoft.com
Signal signal-cli REST Run signal-cli-rest-api via Docker

🤖 AI Providers

txtcode supports 10 LLM providers for chat mode. Configure one or more during setup and hot-switch with /switch.

Provider Example Models Notes
Anthropic claude-sonnet-4-6, claude-opus-4-6 Claude family
OpenAI gpt-5.2, o4-mini, gpt-4o GPT and o-series
Google Gemini gemini-2.5-pro, gemini-2.5-flash Gemini family
Mistral mistral-large-latest, codestral-latest Mistral + Codestral
Moonshot (Kimi) kimi-k2.5, moonshot-v1-128k Long-context models
MiniMax MiniMax-M2.5, MiniMax-M2.1 MiniMax family
xAI (Grok) grok-4, grok-3-fast Grok family
Z.ai (Zhipu) glm-5, glm-4.7, glm-4.6 GLM family
HuggingFace Discovered at runtime Inference Providers API
OpenRouter Discovered at runtime Unified API for 100+ models

All providers are used in chat mode for general conversation and coding questions.


💻 Coding Adapters

Use /code mode to route messages directly to a coding adapter with full coding CLI control.

Adapter Backend CLI Required Notes
Claude Code Anthropic API claude Official Claude CLI
Cursor CLI Cursor cursor Headless Cursor
OpenAI Codex OpenAI API codex OpenAI's coding agent
Gemini CLI Google AI API gemini Google's CLI
Kiro CLI AWS kiro-cli AWS Kiro subscription
OpenCode Multi-provider opencode Open-source, multi-provider
Ollama Claude Code Local (Ollama) ollama Free, no API key needed

💬 Chat Commands

Send these commands in any messaging app while connected:

Command Description
/chat Switch to Chat mode to send messages to primary LLM (default)
/code Switch to Code mode to send messages to coding adapter (full CLI control)
/switch Switch primary LLM provider or coding adapter on the fly
/cli-model Change the model used by the current coding adapter
/cancel Cancel the currently running command
/status Show adapter connection and current configuration
/help Show available commands

⚙️ Configuration

Config is stored at ~/.txtcode/config.json. API keys and tokens are stored in your OS keychain (via keytar), never in the config file.

To modify settings, select Configuration from the main menu. Options include:

  • Change Messaging Platform
  • Change Coding CLI Type
  • Change AI Provider
  • Change Project Path
  • View Current Config

🏷️ Logs

  • Location: ~/.txtcode/logs/
  • Format: session-YYYY-MM-DD-HHmmss.log (one per agent session)
  • Cleanup: Files older than 7 days are pruned automatically

Verbose and debug output goes to the log file; the terminal shows only key status lines.


Troubleshooting

Command not found: txtcode
  • Restart your terminal after npm install -g txtcode
  • Ensure the global bin directory is in your PATH: npm config get prefix
WhatsApp QR / connection issues
  • Use a stable internet connection
  • Select Logout from the main menu, then Start Agent again to get a fresh QR
  • Session is stored under ~/.txtcode; don't delete it to keep the same linked device
Telegram / Discord / Slack not responding
  • Confirm bot token via ConfigurationView Current Config
  • Telegram: ensure the bot is not blocked and you've started a chat with it
  • Discord: ensure MESSAGE CONTENT INTENT is enabled in the developer portal
  • Slack: ensure Socket Mode is enabled and event subscriptions are configured
AI or adapter errors
  • Check API keys and credits for your provider
  • Code mode: ensure the CLI for your adapter is installed and in PATH (claude, codex, gemini, kiro-cli, ollama, cursor, opencode)
  • Check adapter and connection state via the main menu
  • Select View Logs or check ~/.txtcode/logs/ for detailed errors

About

</> Code from your phone control any coding CLI via WhatsApp, Telegram, Discord, Slack, Teams, or Signal

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages