---
Date: 2026-07-07
Author: Hermes
Tags: [project, reyna-cli, browser-control, automation, gemini, image-generation]
---

# Reyna CLI Browser Control

## Goal

Add the remote browser-control workflow into `reyna-cli` so browser automations can become reusable CLI subcommands/scripts instead of one-off Hermes procedures.

## Initial Use Case

Gemini Web image generation through the iMac's headed Chrome browser:

- SSH target: `ssh imac`
- Remote Chrome CDP: `localhost:9222` on the iMac
- Local tunnel: `localhost:9222 -> imac:localhost:9222`
- Gemini URL: `https://gemini.google.com/app`
- Current prototype script lives in Hermes skill support files:
  - `~/.hermes/skills/computer-use/remote-browser-control/scripts/gemini_web_image.py`
- Current wrapper:
  - `~/.local/bin/gemini-web-image`

## Desired `reyna-cli` Direction

Create a `reyna-cli` browser-control namespace that can host reusable scripts, starting with Gemini image generation.

Potential command shape:

```bash
reyna-cli browser gemini-image \
  --prompt "Create a square image of ..." \
  --out ~/generated-images/gemini-web/output.png
```

or:

```bash
reyna-cli image gemini-web \
  --prompt "Create a square image of ..." \
  --out ~/generated-images/gemini-web/output.png
```

## Automation Requirements

The command should automate:

1. Ensure SSH host key works for `imac`.
2. Ensure headed Chrome with `--remote-debugging-port=9222` is running on the iMac.
3. Open/reuse an SSH tunnel to Chrome CDP.
4. Connect via Playwright CDP.
5. Open Gemini Web.
6. Start a new chat unless `--reuse-chat` is passed.
7. Submit an image prompt.
8. Wait for a real generated image, filtering out avatars/Gemini sparkle images.
9. Extract blob-backed images by drawing to canvas and exporting PNG.
10. Save the image to a deterministic local path.
11. Print machine-readable output with path, bytes, and dimensions.

## Speed Improvements to Add Later

- Keep Chrome CDP running on the iMac at boot/login.
- Keep a persistent SSH tunnel/service instead of opening a new tunnel per image.
- Default output folder: `~/generated-images/gemini-web/` with timestamped filenames.
- Add `--json` output for agent/tool consumption.
- Add batch mode: prompt file or multiple prompts.
- Add optional screenshot/debug artifacts on failure.
- Reuse the existing `remote-browser-control` Hermes skill as implementation notes.

## Related Notes

- [[Projects]]
