Skip to main content

Auto-respond to AI CLI prompts (Claude Code, Cursor, Codex, Copilot, Gemini, Aider). PTY proxy that auto-answers yes/no dialogs so your automation never blocks.

Project description

auto-yes

Auto-respond to AI CLI prompts. Never get blocked by interactive yes/no dialogs again.

Go PyPI License: MIT Tests Platforms

auto-yes wraps any CLI command in a PTY (pseudo-terminal) proxy, watches the output stream for interactive prompts, and automatically injects the correct response — so your overnight AI agent loops, CI pipelines, and automation scripts never block waiting for a human.

Works out-of-the-box with Claude Code, Cursor, Gemini CLI, OpenAI Codex, GitHub Copilot, Amazon Q, Aider, Windsurf, and 10+ more AI coding tools. Also handles generic [y/n], Continue?, SSH fingerprint, Terraform yes, multi-choice menus, and any custom regex you define.

╭─ without auto-yes ─────────────────────────────────────────╮
│  claude "refactor auth module"                              │
│  > Trust this folder?  1. Yes  2. No   ← blocks forever   │
╰─────────────────────────────────────────────────────────────╯

╭─ with auto-yes ────────────────────────────────────────────╮
│  auto-yes claude "refactor auth module"                     │
│  > Trust this folder?  1. Yes  2. No                       │
│  [auto-yes] responded 'y' (matched: ❯ 1. Yes, I trust…)   │
│  ✓ Continuing automatically…                               │
╰─────────────────────────────────────────────────────────────╯

Installation

# pip (any platform)
pip install auto-yes

# Go
go install github.com/host452b/auto-yes/cmd/auto-yes@latest

# Or download binary directly
# → https://github.com/host452b/auto-yes/releases

Shorthand alias ay is included. make build also auto-installs Go if needed.


Quick start

Wrap an AI CLI tool directly (recommended)

auto-yes claude "fix the tests"          # wraps: claude "fix the tests"
auto-yes cursor chat "add unit tests"    # wraps: agent chat "add unit tests"
auto-yes gemini "review this PR"         # wraps: gemini "review this PR"
auto-yes codex "explain this function"   # wraps: codex "explain this function"
auto-yes aider --model gpt-4o           # wraps: aider --model gpt-4o
auto-yes copilot                         # wraps: gh copilot
auto-yes amazonq chat "help me"          # wraps: q chat "help me"

The profile name maps to the real binary automatically — run auto-yes list to see all 14 profiles.

Overnight / unattended mode (--auto)

For unattended overnight runs where you want every prompt answered automatically:

# All profiles, near-zero cooldown (0.05s), verbose logging
auto-yes run --auto -- claude "work through the backlog"

# With heartbeat to keep the agent responsive
auto-yes run --auto --heartbeat 30 -- claude "big refactor"

# Loop until complete
for task in tasks/*.md; do
    auto-yes run --auto -- claude "$(cat $task)"
done

--auto automatically loads ALL AI profiles, sets cooldown to 0.05s, and enables verbose logging.

Agent conversational multi-choice (new)

When an AI agent presents multiple options (A/B/C) and asks you to choose, auto-yes responds with:

"I'll go with your recommended option"

This works for any agent that accepts natural language input in multi-choice scenarios.

Shell session mode

auto-yes --on --cli claude
# → now inside an auto-yes session; type normally, prompts are handled
exit

Human-in-loop session control

Control a running auto-yes from another terminal — pause for manual interaction, then resume:

# Terminal 1: running auto-yes
auto-yes run --auto -- claude "big refactor"

# Terminal 2: take over for a moment
auto-yes ls                   # see running sessions and PIDs
auto-yes toggle 12345         # pause ↔ resume
auto-yes pause all            # pause every session
auto-yes continue all         # resume all

How it works

Built as a Go binary with a multi-goroutine pipeline architecture:

stdin ──▶ [g2: Stdin Reader] ──▶ ┌────────────┐
                                  │            │
child ──▶ [g1: PTY Reader]  ──▶  │   Proxy    │ ──▶ PTY master write
           │                      │  (select)  │
           ▼                      │            │
        [Cleaner] ──▶ [Scanner]   └─────┬──────┘
                         │              │
                         ▼              │
                     [Injector] ────────┘
                    (5 timing guards)

Four-stage text cleaning pipeline

Stage Operation Why
1 Expand ESC[nC → spaces Claude Code 2.x word separators
2 Strip ANSI/OSC sequences Remove visual formatting
3 Remove control characters Null bytes, bells, etc.
4 Resolve \r overwrites Handle \r\r\n from Claude Code 2.x

Five-layer anti-false-positive guards

Guard Threshold What it prevents
Typing suppress 1s User's own keystrokes triggering auto-responses
Match cooldown 50ms Terminal redraws re-triggering the same prompt
Response cooldown 0.5s (configurable) Rapid-fire duplicate responses
Session pause file-based External pause control from another terminal
Approval delay configurable Queued response with cancel window

Supported tools (14 profiles)

Profile Binary Tool Key patterns
claude claude Anthropic Claude Code Trust folder, Allow once/always, Proceed?
cursor agent Cursor Agent (y), [a] Trust this workspace
gemini gemini Google Gemini CLI Allow once/session/always
codex codex OpenAI Codex Yes, Approve and run now
copilot gh copilot GitHub Copilot Yes proceed, Allow Copilot
aider aider Aider AI Coding (Y)es/(N)o, Run shell command?
openhands openhands OpenHands Agent Execute action?, Approve
windsurf windsurf Codeium Windsurf Accept changes?, Run command?
qwen qwen Alibaba Qwen Code Yes, Approve execution?
amazonq q Amazon Q Developer Approve action?, Accept suggestion?
grok grok xAI Grok Yes
auggie auggie Augment Code Enable indexing
amp amp Sourcegraph Amp Approve
generic Universal y/n [y/n], SSH, Terraform, Press Enter
auto-yes list                  # see all profiles
auto-yes patterns claude       # inspect patterns for a specific tool

Generic patterns (loaded with --cli generic or --auto)

  • Bracket/styled choices: [y/n], [Y/n], [yes/no], [Y]es / [N]o
  • Question prompts: Continue?, Proceed?, Are you sure?
  • Action prompts: Allow?, Approve?, Accept?, Download?, Enable?
  • SSH: continue connecting (yes/no)? → responds yes
  • Terraform: Only 'yes' will be accepted → responds yes
  • Press Enter: Press Enter to continue → responds with empty string
  • Excluded (safety): Overwrite?, Delete?, Remove?, Replace?, Upgrade?, Restart?

CLI reference

auto-yes <profile> [ARGS...]       wrap an AI CLI tool directly (recommended)
auto-yes --on [OPTIONS]            start an auto-yes shell session
auto-yes run [OPTIONS] -- CMD...   run a single command with auto-yes
auto-yes list                      list all available CLI profiles
auto-yes patterns [CATEGORY...]    list prompt patterns
auto-yes add-pattern REGEX         persist a custom regex pattern
auto-yes del-pattern REGEX         remove a custom pattern
auto-yes status                    check if auto-yes is active
auto-yes ls                        list running sessions
auto-yes toggle <pid|all>          pause ↔ resume
auto-yes pause/continue <pid|all>  pause or resume only
auto-yes off                       help for exiting a session

Options

Flag Description Default
--auto Overnight mode: all profiles, 0.05s cooldown, verbose off
--response TEXT Text to send when a prompt is detected y
--cooldown FLOAT Seconds between auto-responses 0.5
--delay FLOAT Approval delay; press any key to cancel 0
--heartbeat SECONDS Send Enter every N seconds of inactivity 0
--verbose, -v Print each auto-response off
--quiet, -q Suppress all output off
--pattern REGEX Extra prompt pattern (repeatable)
--cli NAME AI CLI profile to load (repeatable, or all)
--log FILE Debug log (raw bytes, cleaned text, detections)

Configuration

Config file: ~/.config/auto-yes/config.yaml (Linux/macOS) or %APPDATA%\auto-yes\config.yaml (Windows)

response: "y"
cooldown: 0.5
verbose: false
delay: 0.0
heartbeat: 0.0

Custom patterns: ~/.config/auto-yes/patterns.yaml

patterns:
  - regex: 'my-internal-tool.*confirm'
    response: "y"
  - regex: 'deploy to staging.*\?'
    exclude: true  # never auto-confirm this

Upgrading from Python version? Config is auto-migrated from config.json to config.yaml on first run.


Adding a new AI CLI profile

Create a YAML file in pattern/builtin/:

name: my-tool
description: "My AI Tool CLI"
command: ["my-tool"]
patterns:
  - regex: 'approve action\?'
  - regex: 'type yes to confirm'
    response: "yes"
  - regex: 'press enter to continue'
    type: enter
    response: ""

Run auto-yes list to verify it appears. No other code changes needed.


Comparison with yes(1)

yes | cmd auto-yes run -- cmd
Prompt detection None — floods stdin blindly Smart regex, bottom-up scan
User can still type No Yes, fully interactive
PTY (colors / progress bars) Broken Preserved
False-positive protection None 5-layer timing guards
AI-specific prompts No 14 tool profiles built-in
Multi-choice support No Menus + conversational
Custom patterns No Persisted or one-off
Cross-platform Unix only Linux + macOS + Windows

Platform support

Platform Method Notes
Linux PTY + goroutines Full PTY, zero external deps
macOS PTY + goroutines Full PTY, zero external deps
Windows conpty (planned) Stub exists, full implementation coming

Development

git clone https://github.com/host452b/auto-yes.git
cd auto-yes

# Build (auto-installs Go if needed)
make build

# Test
make test

# Lint
make lint

# Show build environment
make info

# Release: cross-compile 6 platforms + build .whl wheels
make release     # → release/wheels/auto_yes-<ver>-py3-none-any.whl

# Publish to PyPI
make publish     # → release + twine upload

# Clean all artifacts
make clean

# Help
make help

Golden test cases

Drop a YAML file in testdata/cases/ and it becomes a test automatically:

name: "My edge case"
category: claude
raw: "❯ 1. Yes, I trust this folder"
expect:
  matched: true
  source: claude

See testdata/cases/README.md for 8 reusable templates covering all interaction scenarios: yes/no, numbered menus, agent multi-choice, Press Enter, SSH/Terraform, ANSI-encoded, dangerous actions (excluded), and long-output prompts. Plus real-world samples for Claude Code, Cursor, Gemini, Aider, and Terraform.

Architecture

cmd/auto-yes/   → entry point
cli/             → cobra commands (wrap, run, shell, session, list, patterns)
proxy/           → core engine (goroutine orchestration, timing guards, injection)
term/            → Terminal interface (Unix PTY, Windows conpty)
detect/          → text cleaning pipeline + bottom-up scanner
pattern/         → YAML pattern registry (14 builtin + external + CLI)
config/          → config loading (YAML, JSON migration) + session management
testdata/cases/  → golden test cases (drop-in YAML)
packaging/       → Python pip wrapper (execvp, ~30 lines)
scripts/         → build_wheels.py (goreleaser → .whl)

License

MIT

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

auto_yes-1.1.1-py3-none-any.whl (8.8 MB view details)

Uploaded Python 3

File details

Details for the file auto_yes-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: auto_yes-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for auto_yes-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8d804088c1377c6efd4810943ecb2c2e5d972fdf5163be650e6f99f901069425
MD5 a46a916873ce29f2198c06903f3cabd4
BLAKE2b-256 d7f239a64cee102b0ddbdd7c00d3ae6734e7a526c965568b2a506f840ef30131

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