Skip to main content

Privacy-first AI coding assistant for Termux

Project description

๐Ÿง  Sheikh-CLI

A privacy-first AI coding assistant that runs entirely on your Android device through Termux

Privacy Android License

Overview

The Termux Local Coding Agent is a powerful, privacy-focused development tool that transforms your Android device into a local AI coding assistant. Built specifically for Termux, it provides natural language interaction with your code while maintaining complete privacy through local operation.

โœจ Features

๐Ÿ”’ Privacy-First

  • 100% Local Operation - No cloud dependencies, no data transmission
  • Secure Sandbox - Whitelisted commands with timeout protection
  • Privacy Configuration - Full control over what data is processed

๐Ÿ› ๏ธ Development Tools

  • File Operations - Read, write, search, and manage files safely
  • Code Analysis - Search patterns, find functions, analyze code structure
  • Git Integration - Status, diff, commit, and branch management
  • Shell Commands - Safe execution of development tools

๐Ÿค– AI-Powered

  • Natural Language Interface - Describe tasks in plain English
  • Intent Detection - Automatically maps requests to appropriate tools
  • Local LLM Support - Integration with llama.cpp for offline inference
  • No-Code CLI - Predefined actions for common development tasks

๐Ÿ“ฑ Mobile-Optimized

  • Termux Integration - Built specifically for Android Termux environment
  • Resource Efficient - Optimized for mobile hardware constraints
  • Battery Conscious - Intelligent resource management
  • Portable Development - Full development environment in your pocket

๐Ÿš€ Quick Start

Prerequisites

  • Android device with Termux installed
  • 4GB+ RAM (8GB recommended)
  • 2GB+ free storage
  • Internet connection for setup

Installation

  1. Install Termux

    # Download from F-Droid or GitHub
    # Launch Termux and grant storage permissions
    termux-setup-storage
    
  2. Run Setup Script

    # Copy setup_termux.sh to Termux
    bash setup_termux.sh
    
  3. Start Using

    # Activate environment
    source ~/coding-agent/.venv/bin/activate
    
    # Interactive mode
    python ~/coding-agent/src/run_agent.py interactive
    
    # Single command
    python ~/coding-agent/src/run_agent.py prompt "list files in workspace"
    

๐Ÿ’ก Usage Examples

File Operations

# Read a file
python src/run_agent.py prompt "read config.json"

# Create a new Python script
python src/run_agent.py prompt "create hello.py with print('Hello World')"

# List project files
python src/run_agent.py prompt "show all Python files in the project"

Code Analysis

# Search for patterns
python src/run_agent.py prompt "find all function definitions in Python files"

# Search imports
python src/run_agent.py prompt "show all import statements"

# Code statistics
python src/run_agent.py prompt "count lines of code in the project"

Git Operations

# Check repository status
python src/run_agent.py prompt "git status"

# View changes
python src/run_agent.py prompt "git diff"

# Show commit history
python src/run_agent.py prompt "git log --oneline -5"

Interactive Mode

# Start interactive session
python src/run_agent.py interactive

Example conversation:

You: help
Agent: [Shows available commands]

You: read the main script
Agent: [Reads and displays file content]

You: find all functions
Agent: [Searches and lists functions]

You: git status
Agent: [Shows git repository status]

You: quit
Agent: Goodbye! ๐Ÿ‘‹

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   CLI Interface โ”‚    โ”‚  Orchestrator    โ”‚    โ”‚   Tool Plugins  โ”‚
โ”‚                 โ”‚    โ”‚                  โ”‚    โ”‚                 โ”‚
โ”‚ โ€ข Interactive   โ”‚โ”€โ”€โ”€โ–ถโ”‚ โ€ข Intent         โ”‚โ”€โ”€โ”€โ–ถโ”‚ โ€ข File Ops      โ”‚
โ”‚ โ€ข Single Prompt โ”‚    โ”‚   Detection      โ”‚    โ”‚ โ€ข Shell Cmds    โ”‚
โ”‚ โ€ข Help System   โ”‚    โ”‚ โ€ข Tool Routing   โ”‚    โ”‚ โ€ข Code Search   โ”‚
โ”‚                 โ”‚    โ”‚ โ€ข Error Handling โ”‚    โ”‚ โ€ข Git Ops       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚                       โ”‚                       โ”‚
         โ”‚              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”              โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚   Security       โ”‚โ—€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                        โ”‚   Sandbox        โ”‚
                        โ”‚                  โ”‚
                        โ”‚ โ€ข Whitelisting   โ”‚
                        โ”‚ โ€ข Timeouts       โ”‚
                        โ”‚ โ€ข Directory      โ”‚
                        โ”‚   Restrictions   โ”‚
                        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ›ก๏ธ Security

Command Safety

  • Whitelist Only - Only predefined safe commands execute
  • Timeout Protection - Prevents infinite or long-running operations
  • Directory Restrictions - Access limited to allowed directories
  • Output Filtering - Sensitive data filtered from logs

Privacy Protection

  • Local Processing - All AI inference happens on-device
  • No Telemetry - Zero data transmission to external services
  • Secure Storage - Configuration and logs encrypted when possible
  • Audit Logging - Full activity tracking without sensitive data

โš™๏ธ Configuration

Basic Configuration

{
    "model": {
        "type": "local_first",
        "llama_cpp_path": "/path/to/llama.cpp/main",
        "model_path": "/path/to/model.ggml"
    },
    "security": {
        "sandbox_enabled": true,
        "max_execution_time": 30,
        "allowed_directories": ["/home/coding-agent"]
    }
}

Advanced Options

  • Model Integration - Support for various local LLMs
  • Custom Tools - Add your own plugins
  • Performance Tuning - Optimize for your device
  • Extended Whitelist - Add trusted commands

๐Ÿ“Š Performance

Recommended Hardware

Component Minimum Recommended
RAM 4GB 8GB+
Storage 2GB 5GB+
CPU Quad-core Octa-core

Optimization Tips

  • Use smaller quantized models (4-bit)
  • Enable battery optimization
  • Monitor memory usage
  • Clear logs regularly

๐Ÿ”ง Development

Project Structure

~/coding-agent/
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ run_agent.py          # Main application
โ”œโ”€โ”€ tools/
โ”‚   โ”œโ”€โ”€ file_operations.py    # File management
โ”‚   โ”œโ”€โ”€ shell_commands.py     # Safe shell execution
โ”‚   โ”œโ”€โ”€ code_search.py        # Code analysis
โ”‚   โ””โ”€โ”€ git_operations.py     # Git integration
โ”œโ”€โ”€ config/
โ”‚   โ””โ”€โ”€ agent_config.json     # Configuration
โ”œโ”€โ”€ models/                   # Local LLM models
โ”œโ”€โ”€ logs/                     # Application logs
โ””โ”€โ”€ requirements.txt          # Python dependencies

Adding New Features

  1. Create tool plugin in tools/
  2. Register in orchestrator
  3. Add intent detection
  4. Update configuration
  5. Document usage

๐Ÿ› Troubleshooting

Common Issues

Setup Fails

# Check Termux installation
pkg list-installed

# Update packages
pkg update && pkg upgrade

Permission Errors

# Grant storage access
termux-setup-storage

# Fix directory permissions
chmod -R 755 ~/coding-agent

Model Loading Issues

# Verify llama.cpp
cd ~/coding-agent/llama.cpp && ls -la main

# Test model
./main -m model.ggml -p "test"

Getting Help

  1. Check the complete tutorial
  2. Review troubleshooting section
  3. Examine logs in ~/coding-agent/logs/
  4. Test with simple commands first

๐Ÿค Contributing

We welcome contributions! Please:

  1. Follow the modular architecture
  2. Add comprehensive error handling
  3. Include security considerations
  4. Document new features
  5. Test on multiple devices

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Termux Team - For the excellent Android terminal environment
  • llama.cpp - For enabling local LLM inference
  • Rich Library - For beautiful terminal interfaces
  • Open Source Community - For inspiration and tools

๐Ÿ“ž Support

  • Documentation: See TUTORIAL.md
  • Issues: Report bugs and feature requests
  • Community: Join the Termux community

Built with โค๏ธ for developers who value privacy and portability

Transform your Android device into a powerful, private development environment with the Termux Local Coding Agent.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sheikh_cli-1.0.0.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sheikh_cli-1.0.0-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file sheikh_cli-1.0.0.tar.gz.

File metadata

  • Download URL: sheikh_cli-1.0.0.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.5

File hashes

Hashes for sheikh_cli-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a0d9948109dc75d1ccfb5771319456a901b342e7abcc6e4e80935bef1b587f34
MD5 bd72d4b4f352223e98ae56a6f558db76
BLAKE2b-256 7669b10af41f294d8432b6825e46196b29a5e98681f973f1c2f2ac22f445e35c

See more details on using hashes here.

File details

Details for the file sheikh_cli-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: sheikh_cli-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 22.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.5

File hashes

Hashes for sheikh_cli-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 23b900fa93d0189cf11ff13a7a43117147779db49d95b045eb845633281f1e1a
MD5 a2b3e926c365b604a4e2d290811a51df
BLAKE2b-256 7663e9afa854457e8cfbe912cff6b6495162c3386f1d51b91a6cd2af3a3ccffa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page