Sign inSign up

jsebayhi/gemini-cli-toolbox

By jsebayhi

β€’Updated 5 months ago

Gemini CLI sandbox: Multi-Profile, Remote Access, Docker, VS Code Companion, Git Worktree.

Image
Developer tools
0

10K+

jsebayhi/gemini-cli-toolbox repository overview

β πŸ€– Gemini CLI Toolbox

CI Coverage Docker Pulls

GitHub⁠ | Docker Hub⁠

The zero-config, ultra-secure home for your Gemini AI agent. Run the Gemini CLI in a Dockerized sandbox that keeps your host system clean while staying fully integrated with your tools (VS Code, Docker, VPN, git worktree).


⁠🌟 Why Gemini Toolbox?

  • πŸš€ Zero Config: No Node.js, Python, or SDK setup required on your host. Just run the script.
  • πŸ›‘οΈ Secure Sandbox: The agent is trapped in the container. It cannot access files outside your project folder, guaranteeing no side effects on your OS.
  • πŸ’» VS Code Companion: Native integration with your host IDE for context awareness and auto-diffs.
  • 🐳 Docker-Powered: Extends the agent to any language. Build and test projects (Rust, PHP) using your host's Docker images, saving bandwidth and setup time.
  • πŸ“± Remote Access: Code from your phone via Tailscale VPN.
  • 🌳 Ephemeral Worktrees: Launch isolated worktrees of your repo for risk-free refactors or parallel tasks without touching your primary working directory.
  • πŸ”‘ Multi-Profile: Switch seamlessly between personal, work, and bot accounts using different config dirs.

β πŸ“Έ Visual Overview: The Gemini Hub

The Gemini Hub provides a centralized dashboard to discover, manage, and launch your sessions from any device (Desktop, Mobile, or Tablet) via Tailscale VPN.

⁠🏠 Dashboard

Monitor all your active sessions at a glance. Identify projects, connection types (CLI/Bash), and status in real-time. Gemini Hub Dashboard

β πŸš€ Zero-Config Launch Wizard

Start new sessions effortlessly by browsing your host's workspace roots. No need to remember complex CLI flags. Gemini Hub Launch Wizard

⁠🌳 Isolated Worktrees

Toggle "Launch in Ephemeral Worktree" to experiment in a fully isolated branch without touching your primary codebase. Isolated Worktrees in Hub


⁠⚑ Quick Start (Under 5 Minutes)

⁠1. Install the Wrapper

The gemini-toolbox script handles the complex Docker logic for you.

# Clone and enter the repo
git clone https://github.com/Jsebayhi/gemini-cli-toolbox.git
cd gemini-cli-toolbox

# Add to your PATH (Optional but recommended)
ln -s $(pwd)/bin/gemini-toolbox ~/.local/bin/gemini-toolbox
⁠2. Enable Autocompletion (Optional)
source completions/gemini-toolbox.bash
source completions/gemini-hub.bash
⁠3. Start Chatting
# Open interactive AI chat in the current folder
gemini-toolbox

β πŸ—οΈ Core Concepts

The Toolbox isn't just a wrapper; it's a bridge between your host and a secure execution environment.

β πŸ›‘οΈ 1. Security & Sandbox
  • Isolation: The agent runs inside a Debian container. It cannot see or modify files outside the project directory you mount.
  • Protected Networking: All sessions are private by default. They use bridge isolation and bind strictly to 127.0.0.1 on your host, making them invisible to your local network (LAN).
  • Ephemeral: Every session is clean. Use the container as a disposable playground.
β πŸ’» 2. Developer Integration
  • VS Code Companion: Native support for the Gemini CLI Companion⁠ extension. It reads your IDE context and applies diffs automatically.
  • Docker-out-of-Docker (DooD): The agent can run docker commands (build, run, compose) by talking to your host's daemon. It shares your local image cache for instant speed.
  • Language Agnostic: No need to install Node.js, Python, or Rust on your host. Build and test projects using the agent's internal environment or host Docker.
β πŸ“± 3. Remote & Mobile Freedom
  • Tailscale VPN: Start a session with --remote to access it from your phone, tablet, or another PC via a secure mesh network.
  • The Hub: A built-in web dashboard (http://gemini-hub:8888) to discover and manage multiple active sessions from any device connected to the VPN.
⁠🌳 4. Ephemeral Worktrees
  • Zero-Risk Refactors: Use --worktree to launch the agent in a dedicated, isolated worktree of your repository. Your main working directory remains untouched.
  • Surgical Mounts: The toolbox mounts your project Read-Only (:ro) to protect source code, while keeping the .git directory Read-Write (:rw) to allow the agent to commit and branch safely.
  • Automatic Cleanup: The Hub automatically prunes stale worktrees after 30 days (anonymous) or 90 days (named branches), keeping your cache clean.

πŸ“– Read the full Architecture & Features Deep Dive⁠ for technical details on DooD, IDE mirroring, and VPN logic.


β πŸ“š Learning Path

Want to go deeper? Follow these guides to master the Toolbox:

  1. User Guide & Use Cases⁠ (10 min): Real-world examples and step-by-step guides for DevOps, Mobile, Security, and more.
  2. Architecture & Features⁠ (20 min): Deep dive into the internal mechanics (DooD, IDE protocols, networking).
  3. Architecture Decisions (ADRs)⁠ (Reference): Historical record of design choices.

β πŸ“– Key Features & Use Cases

β πŸ› οΈ Common Commands
GoalCommand
Simple Chatgemini-toolbox
Stop Sessiongemini-toolbox stop [id|project]
One-shot Taskgemini-toolbox -- -p "Fix the linting errors in src/"
Isolated Explorationgemini-toolbox --worktree
Named Worktreegemini-toolbox --worktree --name feat/auth
Pure Localhostgemini-toolbox --no-vpn
Beta Featuresgemini-toolbox --preview
Remote Codinggemini-toolbox --remote
Disposable Shellgemini-toolbox --bash
β πŸ“‚ Multi-Account Management

Isolate your environments using configuration profiles.

# Use a specific profile (e.g., Work vs Personal)
gemini-toolbox --profile ~/.gemini-profiles/work
⁠🌳 Isolated Exploration (Worktrees)

Launch a parallel session without stashing or committing your current work.

# Create an anonymous, isolated worktree for a quick experiment
gemini-toolbox --worktree -- -p "Try migrating to ESM"

# Or create a persistent, named branch for a feature
gemini-toolbox --worktree --name feat/api -- -p "Implement the new REST endpoints"

The agent works in an isolated environment. If the experiment fails, simply exitβ€”the Hub will clean it up later.

β πŸ•’ Recent Paths

The Hub wizard automatically remembers your last 3 paths (stored in your browser's localStorage), making it effortless to jump back into a project from mobile.


β πŸ”§ Advanced Configuration

⁠Persistent Settings (extra-args)

Inside a profile directory (when using --profile), create a file named extra-args to store flags you use every time. It supports blank lines and comments using #:

# ~/.gemini-profiles/work/extra-args
--volume "/mnt/data/docs:/docs" # Mount my documentation
--no-ide # Disable VS Code integration for this profile

--preview # Always use the latest beta features
β πŸ“¦ Speeding up builds (Caching)

Since sessions are fully sandboxed by default, language caches (Maven, Gradle, etc.) are ephemeral. To reuse your host's caches for faster builds, add them to your profile's extra-args:

# ~/.gemini-profiles/work/extra-args
--volume "/home/user/.m2:/home/gemini/.m2"
--volume "/home/user/.gradle:/home/gemini/.gradle"
--volume "/home/user/.npm:/home/gemini/.npm"
β πŸ“œ Persistent Bash History

Keep your command history across container restarts:

gemini-toolbox -v ~/.gemini_bash_history:/home/gemini/.bash_history --bash
β πŸ“‚ Customizing Worktree Cache

By default, worktrees are stored in ~/.cache/gemini-toolbox/worktrees. Override this with:

export GEMINI_WORKTREE_ROOT="/mnt/fast-ssd/worktrees"
gemini-toolbox --worktree

⁠🀝 Contributing

We love contributors! If you add or modify CLI flags, please remember to update the scripts in completions/. See CONTRIBUTING.md⁠ for more details.

β πŸ› οΈ Development

If you're contributing to the Toolbox, you can run the full suite of automated tests and linters:

# Run all tests (Bash & Hub), linters, and security scans
make local-ci

# Build specific image groups
make build-toolbox # Hub, CLI, CLI-Preview
make build-clis    # CLI Stable and Preview only

# Run security vulnerability scan (Trivy)
make scan

# Run specific automated test suites
make test-bash     # Bash core scripts (Bats)
make test-hub      # Gemini Hub unit/integration (Pytest)
make test-hub-ui   # Gemini Hub UI (Playwright)

We use Bats-core⁠ for testing our core bash scripts. New tests should be added to tests/bash/.

β πŸ“„ License

MIT

Tag summary

Content type

Image

Digest

sha256:00fed8b27…

Size

259 Bytes

Last updated

5 months ago

docker pull jsebayhi/gemini-cli-toolbox:sha256-f395850b65da9ce06879427a5b69ec33200d2d34dd992509b9eee8eafd7c331b.sig