# Scratchpad: MACP OC Bridge (2026-03-30)

- Objective: Replace the OpenClaw MACP plugin's Pi-direct `runTurn` with the MACP controller queue bridge.
- Scope: `plugins/macp/src/macp-runtime.ts`, `plugins/macp/src/index.ts`, `plugins/macp/openclaw.plugin.json`, `plugins/macp/README.md`.
- Plan:
  1. Read controller/dispatcher/plugin docs and confirm queue/result contract.
  2. Queue tasks through `.mosaic/orchestrator/tasks.json` using a brief file and controller trigger.
  3. Poll result JSON, stream output back to ACP, then validate with typecheck/format checks.
- Risks:
  - The repo orchestrator must be enabled in `.mosaic/orchestrator/config.json`.
  - Result JSON does not always embed worker output, so the runtime falls back to metadata-linked output files or a formatted result summary.
- Verification:
  - `npx tsc --noEmit --target es2022 --module nodenext --moduleResolution nodenext --skipLibCheck plugins/macp/src/macp-runtime.ts plugins/macp/src/index.ts`
  - `pnpm prettier --write "plugins/macp/**/*.{ts,json,md}"`
  - `pnpm format:check`
  - `npx tsc --noEmit -p plugins/macp/tsconfig.json` still fails in this branch because `plugins/macp/tsconfig.json` extends a missing `packages/config/typescript/library.json` file and also pulls in pre-existing external OpenClaw type noise.
