A build prompt for a migration tool to move your OpenClaw multi-agent deployment to Claude Code.
This project is not complete. The core migration pipeline (analyze, generate, verify, chat) works end-to-end, but several components are stubs or partially implemented. See Known Gaps below.
We are actively developing this tool against a live 16-agent OpenClaw deployment. The prompt and architecture are evolving as we resolve remaining issues.
CodeClawed is two things:
-
A CLI tool that reads an OpenClaw installation (
~/.openclaw/) and produces a fully functional Claude Code project — one directory per agent, with identity files, rules, memory, cron job wrappers, and a web chat frontend. -
A build prompt (
codeclawed-migration-prompt.md) that contains everything needed to reproduce the tool from scratch. Hand it to Claude Code and it will build the migration tool for your deployment.
The prompt is designed to be given to Claude Code (or any capable LLM) as a complete specification. It covers:
- OpenClaw's file formats and what each file does
- How each file maps to Claude Code's conventions
- The agent-runner abstraction (the single function that wraps
claude -p) - Cron-to-launchd schedule conversion
- The chat server with session resumption
- Memory system (files + optional pgvector)
- Build order and dependencies
- Read
codeclawed-migration-prompt.mdto understand the architecture - Point Claude Code at the prompt and your
~/.openclaw/directory - Adjust for your deployment's specifics (number of agents, which cron categories you use, tool restrictions)
- Run
analyze→generate→verify→chat
The prompt is the source of truth for the architecture. If you're fixing a bug or adding a feature, update the prompt document alongside the code so they stay in sync.
# Install dependencies
npm install
# Analyze your OpenClaw deployment
npx tsx src/cli.ts analyze --oc-home ~/.openclaw
# Generate the Claude Code project
npx tsx src/cli.ts generate --oc-home ~/.openclaw --output ./output
# Verify the output
npx tsx src/cli.ts verify --output ./output
# Start the chat frontend
npx tsx src/cli.ts chat --output ./output
# Open http://localhost:3456OpenClaw is a daemon. Claude Code is a stateless CLI. CodeClawed bridges the gap:
- Identity: OpenClaw's
SOUL.md+USER.md+IDENTITY.mdmerge into a singleCLAUDE.md(max 200 lines).AGENTS.mdshards into.claude/rules/*.mdfiles by section topic. - Agent invocation: A single
agent-runner.tsfunction wrapsclaude -p. Everything in the system — cron jobs, the chat server, scripts — calls through this one function. To change how agents are invoked, you change one file. - Conversation continuity: Claude Code supports
--resume <session-id>. The chat server captures session IDs and resumes conversations automatically, giving agents full context across messages. - Scheduling: Cron expressions convert to macOS launchd plists (abstracted behind a
Schedulerinterface for future Linux/systemd support). - Memory: Agent memory files are human-readable markdown, copied as-is. An optional pgvector MCP server adds semantic search.
output/agents/forge/
├── CLAUDE.md ← Claude Code auto-loads this as identity
├── .claude/
│ ├── rules/*.md ← Auto-loaded behavioral rules
│ └── mcp_config.json ← Tool extensions (memory search)
├── memory/ ← Agent's private memory files
└── shared-memory → ... ← Cross-agent shared knowledge
When claude -p runs with its working directory set to output/agents/forge/, it becomes Forge. There's no agent registry, no instantiation code, no daemon. The directory defines the agent.
- Telegram/Discord/WeChat etc support. I may not build this. PRs welcome. The current interface is a simple WebChat.
- Currently Mac only. I need Unix support, so this will get fixed.
- Workspaces are migrated verbatim, so references to OpenClaw etc need to be purged/updated.
- No doubt there is lots more to cover. I'VE BARELY TESTED ANY OF IT YET.
- Node.js >= 20
- Claude Code CLI (
claude) installed and on PATH - macOS (for launchd scheduler; Linux support is architected but not implemented)
- PostgreSQL + pgvector (optional, only needed for database-backed memory search)
MIT