Back to Openfang

Migrating to OpenFang

MIGRATION.md

0.6.411.5 KB
Original Source

Migrating to OpenFang

This guide covers migrating from OpenClaw (and other frameworks) to OpenFang. The migration engine handles config conversion, agent import, memory transfer, channel re-configuration, and skill scanning.

Table of Contents


Quick Migration

Run a single command to migrate your entire OpenClaw workspace:

bash
openfang migrate --from openclaw

This auto-detects your OpenClaw workspace at ~/.openclaw/ and imports everything into ~/.openfang/.

Options

bash
# Specify a custom source directory
openfang migrate --from openclaw --source-dir /path/to/openclaw/workspace

# Dry run -- see what would be imported without making changes
openfang migrate --from openclaw --dry-run

Migration Report

After a successful migration, a migration_report.md file is saved to ~/.openfang/ with a summary of everything that was imported, skipped, or needs manual attention.

Other Frameworks

LangChain and AutoGPT migration support is planned:

bash
openfang migrate --from langchain   # Coming soon
openfang migrate --from autogpt     # Coming soon

What Gets Migrated

ItemSource (OpenClaw)Destination (OpenFang)Status
Config~/.openclaw/config.yaml~/.openfang/config.tomlFully automated
Agents~/.openclaw/agents/*/agent.yaml~/.openfang/agents/*/agent.tomlFully automated
Memory~/.openclaw/agents/*/MEMORY.md~/.openfang/agents/*/imported_memory.mdFully automated
Channels~/.openclaw/messaging/*.yaml~/.openfang/channels_import.tomlAutomated (manual merge)
Skills~/.openclaw/skills/Scanned and reportedManual reinstall
Sessions~/.openclaw/agents/*/sessions/Not migratedFresh start recommended
Workspace files~/.openclaw/agents/*/workspace/Not migratedCopy manually if needed

Channel Import Note

Channel configurations (Telegram, Discord, Slack) are exported to a channels_import.toml file. You must manually merge the [channels] section into your ~/.openfang/config.toml.

Skills Note

OpenClaw skills (Node.js) are detected and listed in the migration report but not automatically converted. After migration, reinstall skills using:

bash
openfang skill install <skill-name-or-path>

OpenFang automatically detects OpenClaw-format skills and converts them during installation.


Manual Migration Steps

If you prefer migrating by hand (or need to handle edge cases), follow these steps:

1. Initialize OpenFang

bash
openfang init

This creates ~/.openfang/ with a default config.toml.

2. Convert Your Config

Translate your config.yaml to config.toml:

OpenClaw (~/.openclaw/config.yaml):

yaml
provider: anthropic
model: claude-sonnet-4-20250514
api_key_env: ANTHROPIC_API_KEY
temperature: 0.7
memory:
  decay_rate: 0.05

OpenFang (~/.openfang/config.toml):

toml
[default_model]
provider = "anthropic"
model = "claude-sonnet-4-20250514"
api_key_env = "ANTHROPIC_API_KEY"

[memory]
decay_rate = 0.05

[network]
listen_addr = "127.0.0.1:4200"

3. Convert Agent Manifests

Translate each agent.yaml to agent.toml:

OpenClaw (~/.openclaw/agents/coder/agent.yaml):

yaml
name: coder
description: A coding assistant
provider: anthropic
model: claude-sonnet-4-20250514
tools:
  - read_file
  - write_file
  - execute_command
tags:
  - coding
  - dev

OpenFang (~/.openfang/agents/coder/agent.toml):

toml
name = "coder"
version = "0.1.0"
description = "A coding assistant"
author = "openfang"
module = "builtin:chat"
tags = ["coding", "dev"]

[model]
provider = "anthropic"
model = "claude-sonnet-4-20250514"

[capabilities]
tools = ["file_read", "file_write", "shell_exec"]
memory_read = ["*"]
memory_write = ["self.*"]

4. Convert Channel Configs

OpenClaw (~/.openclaw/messaging/telegram.yaml):

yaml
type: telegram
bot_token_env: TELEGRAM_BOT_TOKEN
default_agent: coder
allowed_users:
  - "123456789"

OpenFang (add to ~/.openfang/config.toml):

toml
[channels.telegram]
bot_token_env = "TELEGRAM_BOT_TOKEN"
default_agent = "coder"
allowed_users = ["123456789"]

5. Import Memory

Copy any MEMORY.md files from OpenClaw agents to OpenFang agent directories:

bash
cp ~/.openclaw/agents/coder/MEMORY.md ~/.openfang/agents/coder/imported_memory.md

The kernel will ingest these on first boot.


Config Format Differences

AspectOpenClawOpenFang
FormatYAMLTOML
Config location~/.openclaw/config.yaml~/.openfang/config.toml
Agent definitionagent.yamlagent.toml
Channel configSeparate files per channelUnified in config.toml
Tool permissionsImplicit (tool list)Capability-based (tools, memory, network, shell)
Model configFlat (top-level fields)Nested ([model] section)
Agent moduleImplicitExplicit (module = "builtin:chat" / "wasm:..." / "python:...")
SchedulingNot supportedBuilt-in ([schedule] section: reactive, continuous, periodic, proactive)
Resource quotasNot supportedBuilt-in ([resources] section: tokens/hour, memory, CPU time)
NetworkingNot supportedOFP protocol ([network] section)

Tool Name Mapping

Tools were renamed between OpenClaw and OpenFang for consistency. The migration engine handles this automatically.

OpenClaw ToolOpenFang ToolNotes
read_filefile_readNoun-first naming
write_filefile_write
list_filesfile_list
execute_commandshell_execCapability-gated
web_searchweb_searchUnchanged
fetch_urlweb_fetch
browser_navigatebrowser_navigateUnchanged
memory_searchmemory_recall
memory_recallmemory_recall
memory_savememory_store
memory_storememory_store
sessions_sendagent_send
agent_messageagent_send
agents_listagent_list
agent_listagent_list

New Tools in OpenFang

These tools have no OpenClaw equivalent:

ToolDescription
agent_spawnSpawn a new agent from within an agent
agent_killTerminate another agent
agent_findSearch for agents by name, tag, or description
memory_storeStore key-value data in shared memory
memory_recallRecall key-value data from shared memory
task_postPost a task to the shared task board
task_claimClaim an available task
task_completeMark a task as complete
task_listList tasks by status
event_publishPublish a custom event to the event bus
schedule_createCreate a scheduled job
schedule_listList scheduled jobs
schedule_deleteDelete a scheduled job
image_analyzeAnalyze an image
location_getGet location information

Tool Profiles

OpenClaw's tool profiles map to explicit tool lists:

OpenClaw ProfileOpenFang Tools
minimalfile_read, file_list
codingfile_read, file_write, file_list, shell_exec, web_fetch
messagingagent_send, agent_list, memory_store, memory_recall
researchweb_fetch, web_search, file_read, file_write
fullAll 10 core tools

Provider Mapping

OpenClaw NameOpenFang NameAPI Key Env Var
anthropicanthropicANTHROPIC_API_KEY
claudeanthropicANTHROPIC_API_KEY
openaiopenaiOPENAI_API_KEY
gptopenaiOPENAI_API_KEY
groqgroqGROQ_API_KEY
ollamaollama(none required)
openrouteropenrouterOPENROUTER_API_KEY
deepseekdeepseekDEEPSEEK_API_KEY
togethertogetherTOGETHER_API_KEY
mistralmistralMISTRAL_API_KEY
fireworksfireworksFIREWORKS_API_KEY

New Providers in OpenFang

ProviderDescription
vllmSelf-hosted vLLM inference server
lmstudioLM Studio local models

Feature Comparison

FeatureOpenClawOpenFang
LanguageNode.js / TypeScriptRust
Config formatYAMLTOML
Agent manifestsYAMLTOML
Multi-agentBasic (message passing)First-class (spawn, kill, find, workflows, triggers)
Agent schedulingManualBuilt-in (reactive, continuous, periodic, proactive)
MemoryMarkdown filesSQLite + KV store + semantic search + knowledge graph
Session managementJSONL filesSQLite with context window tracking
LLM providers~511 (Anthropic, OpenAI, Groq, OpenRouter, DeepSeek, Together, Mistral, Fireworks, Ollama, vLLM, LM Studio)
Per-agent modelsNoYes (per-agent provider + model override)
SecurityNoneCapability-based (tools, memory, network, shell, agent spawn)
Resource quotasNonePer-agent token/hour limits, memory limits, CPU time limits
Workflow engineNoneBuilt-in (sequential, fan-out, collect, conditional, loop)
Event triggersNonePattern-matching event triggers with templated prompts
WASM sandboxNoneWasmtime-based sandboxed execution
Python runtimeNoneSubprocess-based Python agent execution
NetworkingNoneOFP (OpenFang Protocol) peer-to-peer
API serverBasic RESTREST + WebSocket + SSE streaming
WebChat UISeparateEmbedded in daemon
Channel adaptersTelegram, DiscordTelegram, Discord, Slack, WhatsApp, Signal, Matrix, Email
Skills/Pluginsnpm packagesTOML + Python/WASM/Node.js, FangHub marketplace
CLIBasicFull CLI with daemon auto-detect, MCP server
MCP supportNoBuilt-in MCP server (stdio)
Process supervisorNoneHealth monitoring, panic/restart tracking
PersistenceFile-basedSQLite (agents survive restarts)

Troubleshooting

Migration reports "Source directory not found"

The migration engine looks for ~/.openclaw/ by default. If your OpenClaw workspace is elsewhere:

bash
openfang migrate --from openclaw --source-dir /path/to/your/workspace

Agent fails to spawn after migration

Check the converted agent.toml for:

  • Valid tool names (see the Tool Name Mapping table)
  • A valid provider name (see the Provider Mapping table)
  • Correct module field (should be "builtin:chat" for standard LLM agents)

Skills not working

OpenClaw Node.js skills must be reinstalled:

bash
openfang skill install /path/to/openclaw/skills/my-skill

The installer auto-detects OpenClaw format and converts the skill manifest.

Channel not connecting

After migration, channels are exported to channels_import.toml. You must merge them into your config.toml manually:

bash
cat ~/.openfang/channels_import.toml
# Copy the [channels.*] sections into ~/.openfang/config.toml

Then restart the daemon:

bash
openfang start