Documentation
¶
Overview ¶
Package openclaw ports the OpenClaw migration engine and the import-agent openclaw and claw commands
Index ¶
- Constants
- Variables
- func Cleanup(ctx context.Context, args agentimport.OpenClawCleanupArgs) (int, error)
- func DumpYAMLFile(path string, data map[string]any) (err error)
- func ExtractMarkdownEntries(text string) []string
- func FindOpenClawDirs() []string
- func LoadYAMLFile(path string) (map[string]any, error)
- func Migrate(ctx context.Context, args agentimport.OpenClawArgs) (int, error)
- func ParseSelectionValues(values []string) []string
- func RebrandText(text string) string
- func RedactMigrationValue(value any) (out any, err error)
- func ResolveSecretInput(value any, env map[string]string) (string, bool)
- func ResolveSelectedOptions(include, exclude []string, preset string) (map[string]bool, error)
- func WriteReport(outputDir string, report *jsonutil.Object) (err error)
- type ConfigReadError
- type ItemResult
- type KindError
- type MergeStats
- type Migrator
- type MigratorOptions
- type OptionMeta
- type Preset
- type Report
- type Summary
Constants ¶
const ( EntryDelimiter = "\n§\n" DefaultMemoryCharLimit = 2200 DefaultUserCharLimit = 1375 SkillCategoryDirname = "openclaw-imports" SkillCategoryDescription = "Skills migrated from an OpenClaw workspace." )
const ( StatusMigrated = "migrated" StatusArchived = "archived" StatusSkipped = "skipped" StatusConflict = "conflict" StatusError = "error" )
Item statuses of the report, the vocabulary report.json consumers read
const ( ReasonTargetExists = "Target exists and overwrite is disabled" ReasonBlockedByApplyConflict = "blocked by earlier apply conflict" RedactedMigrationValue = "[redacted]" )
Variables ¶
var MigrationOptions = []OptionMeta{
{"soul", "SOUL.md", "Import the OpenClaw persona file into Icebath."},
{"workspace-agents", "Workspace instructions", "Copy the OpenClaw workspace instructions file into a chosen workspace."},
{"memory", "MEMORY.md", "Import long-term memory entries into Icebath memories."},
{"user-profile", "USER.md", "Import user profile entries into Icebath memories."},
{"messaging-settings", "Messaging settings", "Import Icebath-compatible messaging settings such as allowlists and working directory."},
{"secret-settings", "Allowlisted secrets", "Import the small allowlist of Icebath-compatible secrets when explicitly enabled."},
{"command-allowlist", "Command allowlist", "Merge OpenClaw exec approval patterns into Icebath command_allowlist."},
{"skills", "User skills", "Copy OpenClaw skills into ~/.icebath/skills/openclaw-imports/."},
{"tts-assets", "TTS assets", "Copy compatible workspace TTS assets into ~/.icebath/tts/."},
{"discord-settings", "Discord settings", "Import Discord bot token and allowlist into Icebath .env."},
{"slack-settings", "Slack settings", "Import Slack bot/app tokens and allowlist into Icebath .env."},
{"whatsapp-settings", "WhatsApp settings", "Import WhatsApp allowlist into Icebath .env."},
{"signal-settings", "Signal settings", "Import Signal account, HTTP URL, and allowlist into Icebath .env."},
{"provider-keys", "Provider API keys", "Import model provider API keys into Icebath .env (requires --migrate-secrets)."},
{"model-config", "Default model", "Import the default model setting into Icebath config.yaml."},
{"tts-config", "TTS configuration", "Import TTS provider and voice settings into Icebath config.yaml."},
{"shared-skills", "Shared skills", "Copy shared OpenClaw skills from ~/.openclaw/skills/ into Icebath."},
{"daily-memory", "Daily memory files", "Merge daily memory entries from workspace/memory/ into Icebath MEMORY.md."},
{"archive", "Archive unmapped docs", "Archive compatible-but-unmapped docs for later manual review."},
{"mcp-servers", "MCP servers", "Import MCP server definitions from OpenClaw into Icebath config.yaml."},
{"plugins-config", "Plugins configuration", "Archive OpenClaw plugin configuration and installed extensions for manual review."},
{"cron-jobs", "Cron / scheduled tasks", "Import cron job definitions. Archive for manual recreation via 'icebath cron'."},
{"hooks-config", "Hooks and webhooks", "Archive OpenClaw hook configuration (internal hooks, webhooks, Gmail integration)."},
{"agent-config", "Agent defaults and multi-agent setup", "Import agent defaults (compaction, context, thinking) into Icebath config. Archive multi-agent list."},
{"gateway-config", "Gateway configuration", "Import gateway port and auth settings. Archive full gateway config for manual setup."},
{"session-config", "Session configuration", "Archive advanced session settings; automatic reset timers are not imported."},
{"full-providers", "Full model provider definitions", "Import custom model providers (baseUrl, apiType, headers) into Icebath providers."},
{"deep-channels", "Deep channel configuration", "Import extended channel settings (Matrix, Mattermost, IRC, group configs). Archive complex settings."},
{"browser-config", "Browser configuration", "Import browser automation settings into Icebath config.yaml."},
{"tools-config", "Tools configuration", "Import tool settings (exec timeout, sandbox, web search) into Icebath config.yaml."},
{"approvals-config", "Approval rules", "Import approval mode and rules into Icebath config.yaml approvals section."},
{"memory-backend", "Memory backend configuration", "Archive OpenClaw memory backend settings (QMD, vector search, citations) for manual review."},
{"skills-config", "Skills registry configuration", "Archive per-skill enabled/config/env settings from OpenClaw skills.entries."},
{"ui-identity", "UI and identity settings", "Archive OpenClaw UI theme, assistant identity, and display preferences."},
{"logging-config", "Logging and diagnostics", "Archive OpenClaw logging and diagnostics configuration."},
}
Every migration option in report order
var MigrationPresets = []Preset{ {"user-data", []string{ "soul", "workspace-agents", "memory", "user-profile", "messaging-settings", "command-allowlist", "skills", "tts-assets", "discord-settings", "slack-settings", "whatsapp-settings", "signal-settings", "model-config", "tts-config", "shared-skills", "daily-memory", "archive", "mcp-servers", "agent-config", "session-config", "browser-config", "tools-config", "approvals-config", "deep-channels", "full-providers", "plugins-config", "cron-jobs", "hooks-config", "memory-backend", "skills-config", "ui-identity", "logging-config", "gateway-config", }}, {"full", allOptionIDs()}, }
Named presets in report order, user-data leaving out the secret groups
var SkillConflictModes = []string{"overwrite", "rename", "skip"}
Imported skill directory conflict policies
var SupportedSecretTargets = []string{
"ANTHROPIC_API_KEY", "ELEVENLABS_API_KEY", "OPENAI_API_KEY", "OPENROUTER_API_KEY", "TELEGRAM_BOT_TOKEN", "VOICE_TOOLS_OPENAI_KEY",
}
Secrets the allowlisted secret import may write
Functions ¶
func Cleanup ¶
func Cleanup(ctx context.Context, args agentimport.OpenClawCleanupArgs) (int, error)
Renames leftover OpenClaw directories to .pre-migration, returning the exit status
func DumpYAMLFile ¶
Writes data as YAML through a synced temp file and an atomic rename, a symlinked target written through its link
func ExtractMarkdownEntries ¶
Memory entries of a source markdown file, each bullet or paragraph prefixed with its heading path and deduplicated
func FindOpenClawDirs ¶
func FindOpenClawDirs() []string
Existing OpenClaw directories under the user home, current name first
func LoadYAMLFile ¶
YAML mapping of a config file, empty when absent or empty, ConfigReadError when unreadable or not a mapping
func Migrate ¶
func Migrate(ctx context.Context, args agentimport.OpenClawArgs) (int, error)
Runs the OpenClaw migration, preflight then preview then confirm then backup then apply, returning the exit status
func ParseSelectionValues ¶
Comma separated values split, stripped and lowercased with empty parts dropped
func RebrandText ¶
Text with OpenClaw, ClawdBot and MoltBot renamed to Icebath, an all lowercase match becoming lowercase icebath
func RedactMigrationValue ¶
Deep copy of a report value with credential keys and token shaped strings redacted
func ResolveSecretInput ¶
Plain string of an OpenClaw SecretInput, an env template or env SecretRef resolved through env
func ResolveSelectedOptions ¶
Selected option ids for include, exclude and preset, a ValueError for unknown names
Types ¶
type ConfigReadError ¶
type ConfigReadError struct{ Msg string }
Existing config file present but unreadable, the merge refused so the file stays byte identical
func (*ConfigReadError) Error ¶
func (e *ConfigReadError) Error() string
func (*ConfigReadError) ErrorKind ¶
func (e *ConfigReadError) ErrorKind() string
Python exception class name of the error
type ItemResult ¶
type ItemResult struct {
Kind string
Source *string
Destination *string
Status string
Reason string
Details *jsonutil.Object
Sensitive bool
}
One reported migration item, None source or destination held as nil
func (ItemResult) DestinationText ¶
func (i ItemResult) DestinationText() string
Destination text, empty for None
func (ItemResult) JSON ¶
func (i ItemResult) JSON() *jsonutil.Object
JSON object of the item in dataclass field order
type KindError ¶
Python exception raised by the engine, str giving the message the script would print
type MergeStats ¶
type MergeStats struct {
Existing, Added, Duplicates, Overflowed int
}
Merge counters of one memory import
func MergeEntries ¶
func MergeEntries(existing, incoming []string, limit int) ([]string, MergeStats, []string)
Existing entries plus each new incoming one that fits under limit, with the counters and the entries that overflowed
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
One OpenClaw to Icebath migration, a preview when Execute is off
func NewMigrator ¶
func NewMigrator(o MigratorOptions) (m *Migrator, err error)
Migrator for the options, a ValueError for an unknown skill conflict mode
type MigratorOptions ¶
type MigratorOptions struct {
SourceRoot string
TargetRoot string
Execute bool
WorkspaceTarget string
Overwrite bool
MigrateSecrets bool
OutputDir string
SelectedOptions map[string]bool
PresetName string
SkillConflictMode string
}
Inputs of one migration run, empty paths meaning None and an empty selection meaning every option
type OptionMeta ¶
One selectable migration option with its label and description
func OptionByID ¶
func OptionByID(id string) (OptionMeta, bool)
Metadata of an option id and whether it exists
type Report ¶
type Report struct {
Timestamp string
Mode string
SourceRoot string
TargetRoot string
WorkspaceTarget *string
OutputDir *string
MigrateSecrets bool
Preset *string
SkillConflictMode string
Selected []string
Summary *Summary
Items []ItemResult
Warnings []string
NextSteps []string
}
Migration report the engine returns and persists
func (*Report) OutputDirText ¶
Output directory text, empty for None