Skip to content

Claude Code Control

Verified

Programmatically control Claude Code in visible macOS Terminal windows via AppleScript for command input, screenshots, session logging, and terminal management.

417 downloads
$ Add to .claude/skills/

About This Skill

# Claude Code Control

Control Claude Code programmatically through visible Terminal.app windows on macOS.

How It Works

  1. Uses AppleScript to:
  2. Open Terminal.app and launch `claude code` in a project directory
  3. Type commands via System Events keystrokes
  4. Capture screenshots of just the Terminal window (not full screen)
  5. Record full sessions with timestamped logs

Requirements

  • macOS
  • Node.js 18+
  • Claude Code installed and authenticated
  • Accessibility permissions for Terminal.app + Script Editor (System Settings → Privacy & Security → Accessibility)

Usage

```javascript const cc = require('./index');

// Launch Claude Code visibly const session = await cc.launch('/path/to/project');

// Send a command (types it + presses Enter) const result = await cc.send(session, 'write tests for app.py', 30); // result.screenshot → path to Terminal window screenshot

// Save session recording await cc.saveSession(session, './recording.json');

// Close await cc.close(session); ```

API

| Function | Description | |---|---| | `launch(path, opts?)` | Open Terminal + start Claude Code. Returns session ID | | `send(id, command, waitSec?)` | Type command, wait, screenshot. Returns `{screenshot, duration_ms}` | | `verifyScreen(id, desc)` | Take a verification screenshot | | `approveSecurity(id)` | Handle "trust this folder" prompt | | `handleLogin(id)` | Send `/login` command | | `saveSession(id, path)` | Save session log to JSON | | `close(id)` / `closeAll()` | Exit Claude Code gracefully | | `takeScreenshot(path?)` | Capture Terminal window | | `focusTerminal()` | Bring Terminal to front |

Pro Features (Coming Soon)

  • 🎬 Video recording of sessions
  • 🤖 Multi-agent / multi-terminal orchestration
  • 📊 Session analytics
  • 🔄 Session replay
  • 🌐 Remote control via SSH

Use Cases

  • Programmatically launch Claude Code sessions in Terminal.app from an orchestrating agent
  • Capture screenshots of Claude Code terminal output for visual verification and logging
  • Record full coding sessions with timestamped logs for audit trails or training data
  • Automate security prompt handling ('trust this folder') during batch Claude Code operations
  • Control multiple Claude Code instances from a supervisory script for parallel task execution

Pros & Cons

Pros

  • +Captures Terminal window screenshots (not full screen) for focused visual verification
  • +Session recording with timestamped JSON enables replay and analysis of agent interactions
  • +Clean API with launch, send, verify, and close lifecycle methods

Cons

  • -macOS only — relies on AppleScript and System Events, not portable to Linux or Windows
  • -Requires Accessibility permissions for Terminal.app and Script Editor — security-sensitive setup
  • -Keystroke-based input is fragile — timing issues or focus changes can cause misdirected commands

FAQ

What does Claude Code Control do?
Programmatically control Claude Code in visible macOS Terminal windows via AppleScript for command input, screenshots, session logging, and terminal management.
What platforms support Claude Code Control?
Claude Code Control is available on Claude Code, OpenClaw.
What are the use cases for Claude Code Control?
Programmatically launch Claude Code sessions in Terminal.app from an orchestrating agent. Capture screenshots of Claude Code terminal output for visual verification and logging. Record full coding sessions with timestamped logs for audit trails or training data.

100+ free AI tools

Writing, PDF, image, and developer tools — all in your browser.

Next Step

Use the skill detail page to evaluate fit and install steps. For a direct browser workflow, move into a focused tool route instead of staying in broader support surfaces.