Files
ContractorAgent/docs/claude/PLAN.md
hzhang 76a7931f97 feat: implement MCP proxy for OpenClaw tool access in contractor agent
Complete the MCP tool call chain:
- contractor-agent bridge exposes /mcp/execute endpoint for tool callbacks
- openclaw-mcp-server.mjs proxies OpenClaw tool defs to Claude as MCP tools
- sdk-adapter passes --mcp-config on first turn with all OpenClaw tools
- tool-test plugin registers contractor_echo in globalThis tool handler map
- agent-config-writer auto-sets tools.profile=full so OpenClaw sends tool defs
- Fix --mcp-config arg ordering: prompt must come before <configs...> flag

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 13:05:03 +01:00

54 lines
2.3 KiB
Markdown

# ContractorAgent Plan
## Project Goal
Build an OpenClaw plugin that turns Claude Code into an OpenClaw-managed contractor agent.
Phase 1: Claude only. Gemini deferred.
## Product Direction
OpenClaw manages agent identity, routing, workspace, and session ownership.
Claude Code manages the live conversational and task context for its own session.
The plugin bridges the two without duplicating context management.
See ARCHITECTURE.md for component design.
See IMPLEMENTATION.md for file structure and build order.
See BRIDGE_MODEL_FINDINGS.md for probe test results that confirm the design.
## Phase 1 Scope
### In scope
- Claude contractor agent provisioning via plugin-owned CLI
- `contractor-claude-bridge` model: OpenAI-compatible sidecar that proxies OpenClaw turns into Claude Code sessions
- Session map: persistent mapping of OpenClaw session keys to Claude session UUIDs
- Input filter: strip OpenClaw system prompt, extract latest user message, inject one-time bootstrap
- SSE streaming: bridge sidecar must stream Claude output back as SSE
- Install script: writes provider config to `openclaw.json`, registers plugin
### Out of scope for now
- Gemini implementation
- Full OpenClaw tool bridging to Claude
- Advanced recovery and replay semantics
- UI polish and operational tooling
## Open Questions
1. ~~What is the implementation seam for the bridge model?~~ **Resolved**`openclaw.json` provider entry pointing to a local OpenAI-compatible sidecar. No plugin SDK model registration API. See BRIDGE_MODEL_FINDINGS.md.
2. How should contractor metadata be persisted — agent runtime stanza, plugin config, or both?
3. ~~What is the canonical identifier for Claude session continuation?~~ **Resolved** — UUID returned as `message.session_id` from the Claude Agent SDK. Resume via `options.resume`. See BRIDGE_MODEL_FINDINGS.md.
4. Which minimal OpenClaw tools should be exposed first to Claude? (deferred to later)
5. How should `/reset` and `/new` map to Claude-side session recreation?
## Next Steps
1. ~~Verify bridge model registration mechanism~~ Done
2. ~~Verify Claude session continuation identifier~~ Done
3. **Build bridge sidecar** with SSE streaming and Claude SDK dispatch
4. Implement input filter and session map store
5. Add bootstrap injection and recovery
6. Implement CLI (`openclaw contractor-agents add`)
7. Write install script