Skip to content

Graywizard888/Claude_code_setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Claude_code_setup

β˜… TERMUX EDITION Β· v2.1.112 β˜…

~ crafted by Graywizard ~


Platform Python Version Privacy License

A self-contained, one-command installer for Claude Code on Android Termux.
Pinned to a stable version. Privacy-hardened out of the box. Fully personalised.


🧠 What is this?

claude_code_setup.py is a beautiful, interactive Python script that automates the complete setup of Claude Code inside Termux (Android Linux userland).

It handles everything in 4 guided phases:

Phase Task
1 Install Node.js via pkg
2 Install Claude Code v2.1.112 via npm
3 Collect your user profile, preferences & Claude plan type interactively
4 Write hardened settings.json + personalised CLAUDE.md

πŸ“Œ Why pinned to v2.1.112?

Later versions of @anthropic-ai/claude-code are known to break on Termux due to filesystem changes and claude code moved to x86 native architecture only. Also disabled Auto updates to prevent auto updates. This script deliberately pins to v2.1.112 β€” tested, confirmed stable, and production-ready on Termux.


✨ Features

  • 🎨 Beautiful TUI β€” colourful ASCII banner, braille spinner, phase headers
  • πŸ“¦ Auto-installs Node.js if not present via pkg
  • πŸ“Œ Pinned version β€” no surprise breakage from upstream updates
  • πŸ‘€ Interactive user profiling β€” name, coding level, languages, device specs
  • πŸ” Auto-detects ABIs, RAM, Android version from device
  • πŸ›‘οΈ Privacy-first β€” all telemetry and non-essential traffic disabled by default
  • πŸ”’ Hardened permissions β€” safe bash allowlist + dangerous command blocklist
  • πŸ“Š Token Status Bar β€” live context %, 5-hour & 7-day rate-limit bars inside Claude Code
  • πŸ—‘οΈ Clean uninstaller β€” double-confirm safety, removes every Claude-related file
  • βœ… Post-install verification β€” confirms everything is correctly set up

πŸ“± Requirements

Requirement Details
Device Any Android device running Termux
Android 7.0+ recommended (tested on Android 16)
Termux Latest from F-Droid (not Play Store)
Python 3.x (pre-installed in Termux) β€” do not uninstall, required by statusline
Internet Required for pkg and npm downloads
Storage ~200 MB free space

Note: Install Termux from F-Droid only. The Play Store version is Experimental and will cause issues.


πŸ“₯ Installation

1. Open Termux and update packages:

pkg update && pkg upgrade -y

2. Clone this repo or download the script:

# Clone
git clone https://github.com/Graywizard888/Claude_code_setup.git
cd Claude_code_setup
# OR download directly
curl -O https://raw.githubusercontent.com/Graywizard888/Claude_code_setup/main/claude_code_setup.py

3. Run the setup script:

python claude_code_setup.py

That's it. The interactive menu takes it from here.


πŸš€ Usage

╔═══════════════════════════════════════════════╗
β•‘                                               β•‘
β•‘   1   Install Claude Code                     β•‘
β•‘       ┃ Full install + personalised config    β•‘
β•‘       ┃ Pinned to v2.1.112 (stable)           β•‘
β•‘                                               β•‘
β•‘   2   Uninstall Claude Code                   β•‘
β•‘       ┃ Complete removal                      β•‘
β•‘       ┃ Two-step confirmation                 β•‘
β•‘                                               β•‘
β•‘   3   Add Settings Only                       β•‘
β•‘       ┃ Write recommended settings.json       β•‘
β•‘       ┃ Safe to run on existing install       β•‘
β•‘                                               β•‘
β•‘   4   Enable Token Status Bar                 β•‘
β•‘       ┃ Install statusline.py                 β•‘
β•‘       ┃ Shows ctx%, 5-hour & 7-day limits     β•‘
β•‘                                               β•‘
β•‘   5   Exit                                    β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

Option 1 β€” Install

Walks you through 4 phases:

  1. Dependencies β€” Checks for Node.js, installs if missing
  2. Claude Code β€” Installs pinned v2.1.112 globally via npm
  3. User Profile β€” Asks for your name, skill level, languages, device info, and Claude plan type
  4. Config Files β€” Writes ~/.claude/settings.json and ~/.claude/CLAUDE.md

At the end, you are offered to also enable the Token Status Bar immediately.

Option 2 β€” Uninstall

Performs a clean, complete removal with two separate confirmation prompts (YES β†’ UNINSTALL) to prevent accidents.

Option 3 β€” Add Settings Only

Writes (or overwrites) ~/.claude/settings.json with the latest recommended config without doing a full install. Safe to run on an existing Claude Code setup.

Option 4 β€” Enable Token Status Bar

Installs ~/.claude/statusline.py and wires the statusLine key into settings.json. Prompts you to select your Claude plan (Pro / Max5 / Max20) so the bars show the correct token limits.


βš™οΈ What gets installed & configured

Files written

File Purpose
~/.claude/settings.json Token limits, telemetry, permissions, statusLine hook
~/.claude/CLAUDE.md Your personalised Claude context & behaviour rules (includes token-check instructions)
~/.claude/statusline.py Token status bar script (installed by Option 1 or Option 4)
~/.claude/statusline_cache.json Live token-usage cache written by statusline on each render

settings.json highlights

{
  "env": {
    "DISABLE_TELEMETRY": "1",
    "DISABLE_ERROR_REPORTING": "1",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
    "DISABLE_NON_ESSENTIAL_MODEL_CALLS": "1",
    "MAX_THINKING_TOKENS": "10000",
    "CLAUDE_CODE_MAX_OUTPUT_TOKENS": "8000",
    "CLAUDE_CODE_AUTOCOMPACT_PCT_OVERRIDE": "50",
    "CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY": "3",
    "CLAUDE_CODE_TMPDIR": "/data/data/com.termux/files/usr/tmp",
    "ANTHROPIC_SMALL_FAST_MODEL": "claude-haiku-4-5-20251001",
    "CLAUDE_CODE_SUBAGENT_MODEL": "claude-haiku-4-5-20251001",
    "TMPDIR": "/data/data/com.termux/files/usr/tmp",
    "EDITOR": "nano",
    "USE_BUILTIN_RIPGREP": "1"
  },
  "autoUpdates": false,
  "includeCoAuthoredBy": false,
  "effortLevel": "high",
  "showThinkingSummaries": true,
  "autoMemoryEnabled": true
}

CLAUDE.md personalisation

Dynamically generated from your answers + auto-detected device info. Also includes token-check rules so Claude warns you before starting heavy tasks when limits are near:

- Name: YourName
- Coding Proficiency: Beginner / Intermediate / Advanced / Expert
- Preferred Languages: python, bash, kotlin ...
- Device: OnePlus 12R IN
- Processor: Snapdragon 8 Gen 2
- ABIs: arm64-v8a, armeabi-v7a
- RAM: 7.0G
- Android: 16 (SDK 36)

- Check token usage in .claude/statusline_cache.json ...
- Warn and ask "can we continue?" if ctx/rl5/rl7 is at 75%+ ...

Token Status Bar

When enabled, a live status bar appears at the bottom of Claude Code showing:

  πŸ€– Current Model    claude-sonnet-4-6
  🧠 Chat Context     β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘   35.0%
  ⏱  5-hour limit     β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘   10.5%
  πŸ“… 7-day limit      β–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘    4.0%

Supports three plan tiers:

Plan 5-hour token limit
pro 44,000
max5 88,000
max20 220,000

⚠️ Do NOT uninstall Python from Termux β€” statusline.py requires Python to run.


πŸ›‘οΈ Privacy Hardening

Every install applies these protections automatically:

Setting Status
Telemetry ❌ DISABLED
Error reporting ❌ DISABLED
Non-essential network traffic ❌ DISABLED
Auto-updates ❌ DISABLED
Co-authored-by git tag ❌ DISABLED
Non-essential model calls ❌ DISABLED

Permission allowlist (safe read-only commands)

grep, cat, ls, find, head, tail, wc, sort
git status, git log, git diff, git branch
node, python, python3, Read(*)

Permission ask-list (prompts before running)

Write(*), Edit(*)
rm -rf, bash, chmod, curl, wget
WebFetch(*), WebSearch(*)

Permission blocklist (always denied)

Read(.env), Read(.env.*)
Read(secrets/**), Read(**/credentials.json)
Read(**/*.pem), Read(**/*.key)

πŸ“ File Structure

~/ (Termux home)
β”œβ”€β”€ claude_code_setup.py          ← this script
└── .claude/
    β”œβ”€β”€ settings.json              ← hardened Claude Code settings
    β”œβ”€β”€ CLAUDE.md                  ← your personalised context file
    β”œβ”€β”€ statusline.py              ← token status bar (optional, Option 4)
    └── statusline_cache.json      ← live token-usage cache (auto-written)

πŸ—‘οΈ Uninstalling

The uninstaller removes everything:

● @anthropic-ai/claude-code     (global npm package)
● ~/.claude/                    (config, CLAUDE.md, statusline, history)
● ~/.claude.json                (auth / account file)
● ~/.cache/claude-cli-nodejs    (npm CLI cache)
● ~/.config/claude              (system config)

Requires typing YES followed by UNINSTALL β€” no accidental removals.


⚑ Quick Start after setup

# Launch Claude Code
claude

# Check installed version
claude --version

# One-shot prompt (no interactive session)
claude -p "Write a Python hello world"

# View your context file
cat ~/.claude/CLAUDE.md

# View settings
cat ~/.claude/settings.json

# View live token usage
cat ~/.claude/statusline_cache.json

First launch will ask for your Anthropic API key.
Get one at console.anthropic.com

Or login via your google Claude subscription account in claude


πŸ”‘ Getting an Anthropic API Key

  1. Go to console.anthropic.com
  2. Sign up / log in
  3. Navigate to API Keys β†’ Create Key
  4. Paste it when claude asks on first launch

πŸ“Š Tested On

Device Android Termux Status
OnePlus 12R IN Android 16 (SDK 36) Latest βœ… Working
Snapdragon 8 Gen 2 β€” β€” βœ… Working

🀝 Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you'd like to change.

  1. Fork the repo
  2. Create your branch: git checkout -b feature/your-feature
  3. Commit: git commit -m "Add your feature"
  4. Push: git push origin feature/your-feature
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.


✦ Created by Graywizard ✦

Running AI on Android, one Termux session at a time.

GitHub

About

A self-contained, one-command line setup for Claude Code on Android Termux

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages