OAuth CLI Coder

A Python CLI tool that drives AI coding assistants (Claude Code, Gemini CLI, Codex) via tmux sessions using existing OAuth tokens. Multi-provider, persistent sessions, stealth mode, and output formatting — no API keys needed.

PythonClicktmuxClaude CodeGemini CLICodex CLIhatchlinguv

Overview

oauth-cli-coder automates AI CLI tools by driving them through tmux sessions. Instead of managing API keys, it reuses your existing browser-based OAuth authentication — launch a tool once, authenticate normally, then programmatically send prompts and capture responses.

oauth-coder ask claude "explain this repo"
oauth-coder ask claude "refactor the auth module" -s my-project -m opus
oauth-coder ask gemini "what does main.go do?" --cwd ~/Projects/app

Key Features

  • Multi-provider: Claude Code, Gemini CLI, Codex CLI — each with provider-specific idle detection and response extraction
  • Persistent sessions: Named sessions maintain conversation context across calls, stored in ~/.config/oauth-cli-coder/sessions.json
  • Stealth mode: Strips TMUX environment variables and allocates a fresh PTY so child processes don't know they're inside tmux
  • Output formatting: Strips markdown, normalizes unicode to ASCII, wraps to terminal width. --raw for unformatted, --ascii for pure ASCII output
  • Battle-tested: Claude Code provider built from real-world use driving a 9600 baud serial terminal

Provider System

Each provider is a simple Python class that defines idle markers, busy indicators, and response extraction logic:

class ClaudeProvider(Provider):
    name = "claude"
    command = "claude"
    idle_marker = "❯"
    busy_markers = ["⠋", "⠍", "Thinking", "Running"]

Adding a new provider is one file + registration.

What It Demonstrates

  • Clean CLI design with Click (subcommands, options, help text)
  • Python packaging with uv + hatchling (src/ layout, console scripts)
  • Practical tmux automation (buffer management, pane capture, session lifecycle)
  • Provider pattern for extensible multi-tool support
  • Output processing pipeline (markdown → unicode → ASCII → word wrap)

Share this project

Share: