oh-my-claude
by avianthonf
README.md
# oh-my-claude
Gives Claude (claude.ai and Claude Code) control of live omp sessions over MCP: read screens, send prompts, answer dialogs, run shell jobs, and attach to sessions from a phone or another machine. It runs as an omp extension plus a local session daemon, with an optional tailnet/Funnel server for remote access.
## Install
Install the omp plugin:
```sh
omp plugin install github:avianthonf/oh-my-claude
```
That one command also writes the `oh-my-claude` launcher to `~/.local/bin` (omp initializes the plugin's extension during install). The launcher runs the CLI with omp's embedded Bun, so nothing else needs installing. If `~/.local/bin` is not on your PATH, add `export PATH="$HOME/.local/bin:$PATH"` to your shell profile. If the launcher is ever missing, run `~/.omp/plugins/node_modules/.bin/oh-my-claude install-launcher`.
To also route interactive omp through the wrapper (optional), run:
```sh
oh-my-claude install-shim
```
`install-shim` writes an `omp` shim and the `oh-my-claude` launcher to `~/.local/bin`. Use `--dir` to choose another directory. It refuses to overwrite a file that is not an oh-my-claude file.
## Connect claude.ai
1. Enable remote access on the machine that runs omp:
```sh
oh-my-claude remote setup
```
Setup downloads and verifies the sidecar (`omc-tsnet`), starts it, and prints a Tailscale login URL if needed. If the output reports a fix, apply it in the Tailscale admin console:
- HTTPS certificates: https://login.tailscale.com/admin/dns
- Funnel permission: add this to the ACL at https://login.tailscale.com/admin/acls/file
```json
"nodeAttrs": [{"target": ["autogroup:member"], "attr": ["funnel"]}]
```
Re-run `oh-my-claude remote setup` after applying a fix. When ready, setup prints the connector URL.
2. Pair claude.ai with this machine:
```sh
oh-my-claude remote pair
```
This prints a six-word code that works once within 10 minutes. Five failed attempts lock pairing for 15 minutes.
3. In claude.ai, add a connector with this URL, replacing `<tailnet>` with your tailnet name:
```
https://oh-my-claude.<tailnet>.ts.net/mcp
```
On the consent page, enter the pairing code. The three scopes (`omc:read`, `omc:control`, `omc:exec`) are pre-checked; untick any you do not want to grant.
## Connect Claude Code
**Same machine.** Register the local server:
```sh
claude mcp add omp -- oh-my-claude mcp
```
This needs `oh-my-claude` on your PATH (see Install).
**Remote machine.** This path needs **Bun** on the machine running Claude Code, because it starts the server with `bunx`. Install Bun from https://bun.sh first. Then, on the machine that runs omp, create a tailnet bearer token:
```sh
oh-my-claude remote token
```
Copy the token (it is shown once; only its hash is stored). On the Claude Code machine:
```sh
claude mcp add omp -e OMC_TOKEN=<token> -- bunx github:avianthonf/oh-my-claude mcp --remote oh-my-claude
```
`--remote oh-my-claude` names the tailnet host of the server. The client starts `omc-tsnet client` and proxies MCP over it, so the Claude Code machine must be on the same tailnet and allowed by the owner's tailnet user or tag.
## Capability ladder
For each session, oh-my-claude uses the strongest route available:
1. **Native extension**: the omp extension talks to the daemon directly. Full state, plan review, and notices.
2. **Wrapper shim**: `install-shim` routes interactive omp through `oh-my-claude wrap`, which runs omp on a PTY and exposes its screen and keyboard over a socket.
3. **tmux / zellij**: sessions running in a multiplexer pane can be read and typed into through the pane.
4. **PTY**: sessions the daemon starts itself in a PTY.
5. **Assisted**: none of the above. Claude can see what the extension reports, and a human answers dialogs in the session window.
Lower rungs lose capability. See Known limitations.
### Wrapper shim
`install-shim` writes a small `omp` script that finds the real omp on PATH (skipping itself). When both stdin and stdout are terminals, it runs omp under `oh-my-claude wrap`. Otherwise (pipes, scripts, `--mode rpc`) it execs the real omp directly.
The wrapper is byte-transparent: keystrokes go to omp unchanged and output comes back unchanged, so the terminal behaves as if omp were run directly. Non-TTY invocations are passed straight through with no PTY and no change in behavior.
## Security model
- **Funnel is public.** The `/mcp` endpoint is reachable from the internet through Tailscale Funnel. It is protected by the layers below.
- **OAuth 2.1 with PKCE (S256)** for Funnel clients. Access tokens last one hour. Refresh tokens rotate on every use, slide while in use, and expire after 90 days unused. Reusing a rotated token revokes the whole family.
- **Pairing code.** Authorization needs a one-time code from `oh-my-claude remote pair`.
- **Scopes.** `omc:read` (events, link view, session list), `omc:control` (other session control), `omc:exec` (shell jobs and raw RPC). All are pre-checked by default.
- **IP allowlist, enforced by default.** Funnel requests must come from an address in `allow`, default `160.79.104.0/21` (Anthropic's range). Requests from other addresses get 403 and an audit entry. If a blocked request carries an otherwise valid token, you get an alert (at most one per IP per hour) with the command to allow it: `oh-my-claude remote allow <ip>/32`. Set `allowMode` to `report` in `remote.json` to log without blocking.
- **Tailnet path.** Requests over the tailnet need `Authorization: Bearer <token>` from `oh-my-claude remote token`, and the caller's tailnet login (from WhoIs) must be in `tailnetUsers` or carry a tag in `tailnetTags`. There is no OAuth on this path.
- **Revoke everything.** `oh-my-claude remote revoke --all` invalidates all OAuth and tailnet credentials.
- **Audit log.** Authorizations, refusals, and revocations are recorded.
Other commands: `oh-my-claude remote enable|disable|status`, `oh-my-claude remote allow <cidr>`.
## Maintainer
Release signing uses minisign. Never let an agent generate the key.
1. Generate the key pair locally (on your machine, not in CI or by an agent):
```sh
minisign -G
```
2. Add GitHub Actions secrets in the repository settings:
- `MINISIGN_SECRET_KEY`: the contents of the secret key file
- `MINISIGN_PASSWORD`: the key's password
3. Paste the public key (the base64 line from `minisign.pub`, second line) into `MINISIGN_PUBKEY` in `src/remote-cli/verify.ts`. Until this is set, `remote setup` refuses to install the sidecar, by design.
4. Cut a release by pushing a tag `vX.Y.Z`. The release workflow (`.github/workflows/release.yml`) builds `omc-tsnet` for darwin and linux, writes `sha256sums.txt`, signs it with minisign, and uploads everything to the GitHub release.
## Known limitations
- **Dialogs need a human in plain sessions.** An `ask` dialog in a live session without a wrapper, tmux pane, or PTY can only be answered in the session window. See [01](docs/upstream/01-extension-api-non-tui.md).
- **Exec of built-in tools is unsupported.** `exec` with `kind: "tool"` is refused until omp ships `invoke_tool`. See [01](docs/upstream/01-extension-api-non-tui.md).
- **Takeover is refused while the queue has messages.** The extension cannot read queue contents, so a busy session with a non-empty queue cannot be taken over. See [02](docs/upstream/02-queue-and-subagents.md).
- **Subagent message and cancel are relayed through the main agent.** They are reported as `viaAgent`, cost a model turn, and depend on the model complying. See [02](docs/upstream/02-queue-and-subagents.md).
- **Attach notices depend on undocumented display behavior.** The notice shown when a session is attached uses `appendEntry`, whose display behavior omp does not document. See [01](docs/upstream/01-extension-api-non-tui.md).
- **Keys typed before the first draw are dropped.** omp ignores keystrokes that arrive before its first screen draw. Wait for the startup tip line before typing.
- **Anthropic IP range changes trigger alerts.** If Anthropic changes the outbound range, requests are blocked and you get the alert. Update `allow` with `oh-my-claude remote allow <cidr>`.
## License
MIT. See [LICENSE](LICENSE).