From 9f2f1f3eeb938d2804be5c6f59a98c6d3965601a Mon Sep 17 00:00:00 2001 From: abhinay gadikoppula Date: Fri, 19 Jun 2026 11:24:38 -0400 Subject: [PATCH] =?UTF-8?q?Add=20cowork-to-code-bridge=20skill=20=E2=80=94?= =?UTF-8?q?=20async=20bridge=20from=20Cowork/agents=20to=20Claude=20Code?= =?UTF-8?q?=20on=20local=20machine?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a new skill that lets Claude Cowork sessions and agent frameworks (CrewAI, AutoGen, LlamaIndex, LiteLLM, Hermes, n8n) queue tasks to Claude Code running on a developer's local machine and retrieve results through a shared async RPC bridge. Co-Authored-By: Claude Sonnet 4.6 --- cowork-to-code-bridge/SKILL.md | 120 +++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 cowork-to-code-bridge/SKILL.md diff --git a/cowork-to-code-bridge/SKILL.md b/cowork-to-code-bridge/SKILL.md new file mode 100644 index 000000000..148afefeb --- /dev/null +++ b/cowork-to-code-bridge/SKILL.md @@ -0,0 +1,120 @@ +--- +name: cowork-to-code-bridge +description: Connects Claude Cowork sandboxes and AI agents to Claude Code running on your local machine, enabling cloud agents to queue tasks and receive results through a shared async RPC bridge. +--- + +# cowork-to-code-bridge + +An async file-based RPC bridge that lets Claude Cowork sessions (and any AI agent framework) queue work to Claude Code on your local machine and receive the results back — without polling, without webhooks, without a VPS. + +The local daemon watches a bind-mounted bridge directory, executes queued tasks, and returns results. The cloud agent queues work and picks up results — fully decoupled, fully async. + +## When to Use This Skill + +- You want a Cowork agent (or any cloud-side AI) to run code, shell commands, or tool calls on your local machine +- You need a bridge between a sandboxed AI environment and your local Claude Code instance +- You are building multi-agent pipelines where one agent orchestrates work on a developer's machine +- You want fire-and-forget task queuing with automatic retry and idempotency guarantees + +## What This Skill Does + +1. **Queue tasks from the cloud**: A Cowork session or agent framework calls `queue_task()` with an `idempotency_key` — the daemon picks it up and runs it locally. +2. **Block-and-wait for fast tasks**: `call_remote()` blocks until the local daemon returns a result (best for tasks under ~30s). +3. **Post messages back**: `post_message_to_cowork()` lets the local Claude Code send status updates back to the cloud session. +4. **Detect incoming messages**: `detect_messages_from_claude_code()` lets the cloud side read those updates (idempotent, safe to poll). + +## Installation + +### Option A — Homebrew (recommended) + +```bash +brew tap abhinaykrupa/tap +brew install cowork-to-code-bridge +brew services start cowork-to-code-bridge +``` + +### Option B — Install script + +```bash +curl -fsSL https://raw.githubusercontent.com/abhinaykrupa/cowork-to-code-bridge/main/install.sh | bash +``` + +Set the shared bridge root (defaults to `~/cowork-bridge`): + +```bash +export BRIDGE_ROOT=~/cowork-bridge +``` + +## How to Use + +### Basic — blocking call (fast tasks) + +```python +from cowork_to_code_bridge.client import call_remote + +result = call_remote("run_tests", {"suite": "unit"}) +print(result) +``` + +### Async — queue and poll (long tasks) + +```python +from cowork_to_code_bridge.client import queue_task, poll_task_result + +task_id = queue_task( + "deploy_staging", + {"branch": "main"}, + idempotency_key="deploy-2026-06-19", +) + +# Later — poll until done +result = poll_task_result(task_id) +``` + +### First-connection initialization + +```python +from cowork_to_code_bridge.bridge_init import ( + is_first_connection, + get_initialization_message, + get_bridge_context, + mark_bridge_initialized, +) + +if is_first_connection(): + print(get_initialization_message()) + print(get_bridge_context()) + mark_bridge_initialized() +``` + +## Example + +**Scenario**: A CrewAI agent needs to run the local test suite and report results. + +**Agent side (cloud)**: +```python +task_id = queue_task("pytest", {"args": "-x tests/"}, idempotency_key="ci-run-42") +``` + +**Daemon (local Mac/Linux)** picks it up, runs `pytest -x tests/`, and writes the result back. + +**Agent polls**: +```python +result = poll_task_result(task_id) +# {"exit_code": 0, "stdout": "5 passed in 1.2s", "stderr": ""} +``` + +## Compatible Frameworks + +Works as an MCP server or direct Python client with: + +- **CrewAI** — agent tasks that need local execution +- **AutoGen** — multi-agent conversations with local tool calls +- **LlamaIndex** — RAG pipelines that index local files +- **LiteLLM** — model-agnostic agents bridging to local tools +- **Hermes** — orchestration workflows +- **n8n** — workflow automation via MCP server mode + +## Full Documentation + +https://github.com/abhinaykrupa/cowork-to-code-bridge