An offline-first CLI tool for interactive coding sessions with AI assistance, designed for Android/Termux.
- Interactive REPL: Continuous chat sessions with context persistence
- File Operations: Read, create, copy, move, and delete files
- Directory Management: Create, list, and delete directories
- Code Search: Search patterns across multiple files
- Git Integration: Status, diff, log, add, and commit operations
- Shell Commands: Execute system commands safely
- Session Memory: Automatically saves and resumes conversations
- Tool Calling: Structured JSON-based tool invocation
- Loading Indicator: Animated spinner while waiting for AI responses
- Offline-First: Works without internet except for API calls
- Minimal Dependencies: Only requires
requestslibrary
Comux provides 20+ AI-powered tools for coding assistance:
read_file- Read file contentswrite_file- Write or overwrite filespatch_file- Apply unified diff patcheslist_files- List directory contentscreate_directory- Create new directoriesdelete_file- Delete filesdelete_directory- Delete directories (with recursive option)copy_file- Copy filesmove_file- Move/rename filesfile_exists- Check if file/directory existsget_file_info- Get detailed file information
search_in_files- Search patterns across multiple files with regex support
run_command- Execute shell commands safely
git_status- View git repository statusgit_diff- View file changesgit_log- View commit historygit_add- Stage files for commitgit_commit- Create commits
For complete documentation, see TOOLS.md.
When typing file references with @filename, you can use Tab completion:
# Type @ followed by partial filename, then Tab
>>> @RE[TAB] # Autocompletes to: @README.md
>>> @comu[TAB] # Autocompletes to: @comux.py
>>> @src/[TAB] # Shows all files in src/ directory
>>> read @[TAB] # Shows all available filesFeatures:
- Case-sensitive matching (primary)
- Case-insensitive fallback
- Works with subdirectories
- Skips hidden files and cache folders
Requirements:
- Linux/Mac: Built-in readline support
- Windows:
pip install pyreadline3 - Termux: Usually built-in, or
pip install gnureadlineif needed
If you experience issues with long lines not wrapping properly (text overwriting at line start), you can set custom readline settings:
# For Windows Command Prompt
export COMUX_READLINE_SETTINGS="set preferred-editing-mode vi"
# For older terminals
export COMUX_READLINE_SETTINGS="set horizontal-scroll-mode On"
# For custom terminal behavior
export COMUX_READLINE_SETTINGS="set bell-style none,set editing-mode vi"Comux now supports streaming responses for real-time output:
# Enable streaming (default)
comux
# Disable streaming if needed
export COMUX_STREAM=false
comuxWith streaming enabled, you'll see responses appear word by word, just like ChatGPT:
>>> Explain quantum computing
Quantum computing is a revolutionary approach to computation that leverages the principles of quantum mechanics...# Method 1: Full automated setup (recommended)
git clone https://github.com/lutfiidham/comux.git
cd comux
chmod +x setup_termux.sh
./setup_termux.sh
# Method 2: Quick installation (no dependencies)
git clone https://github.com/lutfiidham/comux.git
cd comux
chmod +x install_comux.sh
./install_comux.sh
# Then manually install dependencies:
pip install -r requirements.txt
# Method 3: Manual setup
# Install packages
pkg update && pkg install python clang make libffi
# Install dependencies with --user flag
pip install --user -r requirements.txt
# If autocomplete doesn't work: pip install --user gnureadline
# Install Comux
pip install --user -e .
# Create command
ln -sf "$(pwd)/comux.py" ~/../usr/bin/comux
chmod +x ~/../usr/bin/comuxAutocomplete in Termux:
- Most Termux environments have readline built-in
- If autocomplete doesn't work:
pip install --user gnureadline - Use Tab after
@for file completion:@filename[TAB]
Installation Scripts:
setup_termux.sh- Complete setup with all dependenciesinstall_comux.sh- Quick installation without dependencies
pip install comux- Get your API key from Z.ai
- Set the environment variable:
export ZAI_API_KEY=your_api_key_hereAdd this to your .bashrc or .zshrc to make it permanent:
echo 'export ZAI_API_KEY=your_api_key_here' >> ~/.bashrc
source ~/.bashrcStart an interactive session:
comux๐ Comux - Interactive Coding Assistant
Type 'help' for commands or 'exit' to quit
>>> Create a Python script that prints "Hello, World!"
{
"tool": "write_file",
"args": {
"path": "hello.py",
"content": "#!/usr/bin/env python3\n\nprint(\"Hello, World!\")\n"
}
}
File written: /data/data/com.termux/files/home/hello.py
>>> Now run the script
{
"tool": "read_file",
"args": {
"path": "hello.py"
}
}
File content:
#!/usr/bin/env python3
print("Hello, World!")
The script has been created. You can run it with:
python hello.py
exitorquit- Exit the sessionhelp- Show help informationclear- Clear the screen
When the assistant needs to interact with files, it responds with JSON:
{
"tool": "read_file|write_file|patch_file|list_files",
"args": {
...
}
}Available tools:
read_file: Read file contentswrite_file: Create or overwrite a filepatch_file: Apply a unified diff patchlist_files: List directory contents
# Create a global update command
echo 'alias comux-update="python ~/comux/quick_update.py"' >> ~/.bashrc
source ~/.bashrc
# Now update anytime with
comux-updatecd ~/comux
./update.shcd ~/comux
git stash # Save local changes
git pull # Pull updates
git stash pop # Restore changes
pip install -e . # ReinstallComux automatically saves your session to .comux_session.json in the current directory. This allows you to:
- Resume conversations after closing the app
- Maintain context across multiple sessions
- Reference previous discussions
- Never accesses files outside the current project directory
- Asks for confirmation before applying patches
- Shows diffs before modifying files
- API key is stored only in environment variables
# Check if API key is set
echo $ZAI_API_KEY
# Set API key temporarily
export ZAI_API_KEY=your_key_here
# Set API key permanently
echo 'export ZAI_API_KEY=your_key_here' >> ~/.bashrc# Make comux executable
chmod +x comux.py
# On Termux, install without sudo
pip install -e .
# Or create symlink manually
ln -sf "$(pwd)/comux.py" ~/../usr/bin/comuxComux requires internet connection only for API calls. All file operations work offline.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
MIT License - see LICENSE file for details.