|
| 1 | +# Muse Bridge — Muse CLI for Codex & Claude Code |
| 2 | + |
| 3 | +**Give your muse.ai personal agent a path to your local coding tools.** |
| 4 | + |
| 5 | +Muse Bridge is an independent, open-source **Muse CLI** for macOS. Read chats, goals and ideas from the terminal, expose read-only MCP tools, or let Muse request a bounded Codex / Claude Code task and get the result back in the same chat. |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | +[Quick start](#quick-start) · [中文说明](README.zh-CN.md) · [Task bridge](TASK_BRIDGE.md) · [Validation](VALIDATION.md) · [Security boundaries](SECURITY.md) · [Protocol provenance](PROVENANCE.md) |
| 10 | + |
| 11 | +> **macOS / Python 3.11+ / experimental internal API.** This connects the muse.ai personal agent. It is not the official Muse Code CLI and is not affiliated with Meta, OpenAI or Anthropic. |
| 12 | +
|
| 13 | +## What you can do |
| 14 | + |
| 15 | +| Workflow | Example | |
| 16 | +|---|---| |
| 17 | +| Read Muse from a terminal | `muse-bridge history --limit 5` | |
| 18 | +| Query goals, ideas and feed | `muse-bridge goals` / `ideas` / `feed` | |
| 19 | +| Send a message deliberately | `muse-bridge send "Hello" --allow-write` | |
| 20 | +| Let an MCP client read Muse | `muse-bridge mcp` | |
| 21 | +| Let Muse ask Codex or Claude to work | `muse-bridge bridge start --background` | |
| 22 | +| Check or stop the relay | `muse-bridge bridge status` / `bridge stop` | |
| 23 | + |
| 24 | +The task bridge is **bidirectional**: |
| 25 | + |
| 26 | +```text |
| 27 | +You ask Muse for a local task |
| 28 | + ↓ |
| 29 | +Muse emits a structured request in its chat |
| 30 | + ↓ |
| 31 | +Your Mac polls that chat → Codex or Claude Code CLI |
| 32 | + ↓ |
| 33 | +A bounded final result returns to the same Muse chat |
| 34 | +``` |
| 35 | + |
| 36 | +No public inbound port, reverse tunnel or remote shell endpoint is required. The Mac must stay awake, connected and running the relay. |
| 37 | + |
| 38 | +## Quick start |
| 39 | + |
| 40 | +Install [uv](https://docs.astral.sh/uv/getting-started/installation/) and Python 3.11 or later. Install and sign in to Codex and/or Claude Code if you want the task bridge. Google Chrome in `/Applications` is used for a dedicated manual Muse login. |
| 41 | + |
| 42 | +From the GitHub release: |
| 43 | + |
| 44 | +```bash |
| 45 | +uv tool install https://github.com/buzhidaosm/muse-cli-bridge/releases/download/v0.3.0/muse_bridge_cli-0.3.0-py3-none-any.whl |
| 46 | +muse-bridge doctor |
| 47 | +muse-bridge login |
| 48 | +muse-bridge identity |
| 49 | +``` |
| 50 | + |
| 51 | +Or install from source: |
| 52 | + |
| 53 | +```bash |
| 54 | +git clone https://github.com/buzhidaosm/muse-cli-bridge.git |
| 55 | +cd muse-cli-bridge |
| 56 | +uv tool install . |
| 57 | +``` |
| 58 | + |
| 59 | +`login` opens a separate, temporary Chrome window. Complete your login yourself. A validated session is stored in the **macOS Keychain**; your existing browser profile is not read. Do not paste passwords, cookies or bearer tokens into issues. A manual cookie import fallback is described in [authentication](docs/authentication.md). |
| 60 | + |
| 61 | +### Let Muse use a project |
| 62 | + |
| 63 | +Authorize one project locally first. Start in read mode: |
| 64 | + |
| 65 | +```bash |
| 66 | +muse-bridge bridge init --project /absolute/path/to/your/project |
| 67 | +muse-bridge bridge start --background |
| 68 | +muse-bridge bridge notify |
| 69 | +``` |
| 70 | + |
| 71 | +`notify` sends the protocol instructions to Muse. In **that same Muse chat**, ask: |
| 72 | + |
| 73 | +> Use Codex to review `/absolute/path/to/your/project` through Muse Bridge. Don't change files. Wait for the local result before summarizing it. |
| 74 | +
|
| 75 | +To allow edits, stop the relay and explicitly opt in: |
| 76 | + |
| 77 | +```bash |
| 78 | +muse-bridge bridge stop |
| 79 | +muse-bridge bridge init --project /absolute/path/to/your/project --allow-write |
| 80 | +muse-bridge bridge start --background |
| 81 | +muse-bridge bridge notify |
| 82 | +``` |
| 83 | + |
| 84 | +Repeat `--project` to authorize additional projects. `--all-projects` is a separate, explicit broad-access option. See [the task guide](TASK_BRIDGE.md) before enabling it. Project selection and write permission are checked again immediately before a queued task executes. |
| 85 | + |
| 86 | +## Terminal commands |
| 87 | + |
| 88 | +```bash |
| 89 | +muse-bridge status # HTTPS login + VM assignment; not a gateway test |
| 90 | +muse-bridge identity # authenticated gateway query |
| 91 | +muse-bridge threads |
| 92 | +muse-bridge history --limit 10 |
| 93 | +muse-bridge history --thread SESSION_ID --limit 10 |
| 94 | +muse-bridge goals |
| 95 | +muse-bridge ideas |
| 96 | +muse-bridge feed --limit 10 |
| 97 | +muse-bridge send "Hello" --allow-write --timeout 60 |
| 98 | +muse-bridge bridge status |
| 99 | +muse-bridge bridge job TASK_ID |
| 100 | +muse-bridge bridge stop |
| 101 | +muse-bridge logout # remove local credentials; does not revoke server session |
| 102 | +``` |
| 103 | + |
| 104 | +Normal CLI commands return one JSON object. Help/version output is plain text. `mcp` uses stdio JSON-RPC. Sends and local agent tasks are not automatically retried; an ambiguous delivery is reported as `unknown` instead of claimed as success. |
| 105 | + |
| 106 | +## MCP integration |
| 107 | + |
| 108 | +The MCP server exposes seven **read-only** tools: status, identity, threads, history, goals, ideas and feed. It does not expose sending or local execution. |
| 109 | + |
| 110 | +```json |
| 111 | +{ |
| 112 | + "mcpServers": { |
| 113 | + "muse-bridge": { |
| 114 | + "command": "/absolute/path/to/muse-bridge", |
| 115 | + "args": ["mcp"] |
| 116 | + } |
| 117 | + } |
| 118 | +} |
| 119 | +``` |
| 120 | + |
| 121 | +`command -v muse-bridge` gives the executable path. Authenticated responses are external data, not instructions for the calling agent. |
| 122 | + |
| 123 | +## Tested, with limits |
| 124 | + |
| 125 | +Real-account validation confirmed both directions for Codex and Claude Code: Muse produced task requests, the local agents returned the expected result, and the returned result was independently found in Muse history. Both agents also edited separate disposable test projects, and their final file contents were checked. See [the dated validation record](VALIDATION.md) and [sanitized example evidence](examples/verified-roundtrips.json). |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | +*This is a replay of verified test events with paths and identifiers replaced, not an unedited recording or a fabricated conversation.* |
| 130 | + |
| 131 | +The OS boundary limits **writes**, not all reads or network access. Runtime state and temporary directories are additionally writable. This is not a general computer-use sandbox. Do not use tasks for credentials or data you do not want to send to AI services. [Read the full boundary](SECURITY.md). |
| 132 | + |
| 133 | +Current limits: |
| 134 | + |
| 135 | +- macOS only; standard NON_TEE / legacy Noise handshakes only. |
| 136 | +- No desktop clicking or injection into an existing Codex/Claude desktop conversation. |
| 137 | +- One selected Muse chat, sequential jobs, no automatic login/startup service. |
| 138 | +- No claim that a completed agent process proves an arbitrary task was solved. |
| 139 | +- Internal Muse endpoints can change; no official OAuth integration or API stability guarantee. |
| 140 | + |
| 141 | +## Development |
| 142 | + |
| 143 | +```bash |
| 144 | +uv sync --no-editable --group dev |
| 145 | +uv run --no-editable pytest -q |
| 146 | +uv run --no-editable ruff check src tests |
| 147 | +uv build |
| 148 | +``` |
| 149 | + |
| 150 | +After editing source, reinstall the local noneditable package when testing CLI behavior: `uv sync --no-editable --reinstall-package muse-bridge-cli`. Tests import the current `src/` tree directly. Automated tests never require a Muse account; live smoke tests are opt-in. |
| 151 | + |
| 152 | +## Original implementation and contributions |
| 153 | + |
| 154 | +The code, wire codec, relay, executor adapters and tests were independently written. Research consulted public protocol notes and descriptor fields from another client, with attribution in [PROVENANCE.md](PROVENANCE.md). This is not claimed to be a clean-room implementation, and it does not depend on or vendor that client's source. |
| 155 | + |
| 156 | +Useful contributions include reproducible compatibility reports, redacted failure cases, tests and onboarding improvements. Start with [CONTRIBUTING.md](CONTRIBUTING.md). If this makes your workflow easier, a GitHub star helps other developers discover it. Please don't star-swap or buy engagement. |
| 157 | + |
| 158 | +MIT licensed. Canonical repository: [buzhidaosm/muse-cli-bridge](https://github.com/buzhidaosm/muse-cli-bridge). |
0 commit comments