openclaw

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 37 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package openclaw ports the OpenClaw migration engine and the import-agent openclaw and claw commands

Index

Constants

View Source
const (
	EntryDelimiter           = "\n§\n"
	DefaultMemoryCharLimit   = 2200
	DefaultUserCharLimit     = 1375
	SkillCategoryDirname     = "openclaw-imports"
	SkillCategoryDescription = "Skills migrated from an OpenClaw workspace."
)
View Source
const (
	StatusMigrated = "migrated"
	StatusArchived = "archived"
	StatusSkipped  = "skipped"
	StatusConflict = "conflict"
	StatusError    = "error"
)

Item statuses of the report, the vocabulary report.json consumers read

View Source
const (
	ReasonTargetExists           = "Target exists and overwrite is disabled"
	ReasonBlockedByApplyConflict = "blocked by earlier apply conflict"
	RedactedMigrationValue       = "[redacted]"
)

Variables

View Source
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

View Source
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

View Source
var SkillConflictModes = []string{"overwrite", "rename", "skip"}

Imported skill directory conflict policies

View Source
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

Renames leftover OpenClaw directories to .pre-migration, returning the exit status

func DumpYAMLFile

func DumpYAMLFile(path string, data map[string]any) (err error)

Writes data as YAML through a synced temp file and an atomic rename, a symlinked target written through its link

func ExtractMarkdownEntries

func ExtractMarkdownEntries(text string) []string

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

func LoadYAMLFile(path string) (map[string]any, error)

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

func ParseSelectionValues(values []string) []string

Comma separated values split, stripped and lowercased with empty parts dropped

func RebrandText

func RebrandText(text string) string

Text with OpenClaw, ClawdBot and MoltBot renamed to Icebath, an all lowercase match becoming lowercase icebath

func RedactMigrationValue

func RedactMigrationValue(value any) (out any, err error)

Deep copy of a report value with credential keys and token shaped strings redacted

func ResolveSecretInput

func ResolveSecretInput(value any, env map[string]string) (string, bool)

Plain string of an OpenClaw SecretInput, an env template or env SecretRef resolved through env

func ResolveSelectedOptions

func ResolveSelectedOptions(include, exclude []string, preset string) (map[string]bool, error)

Selected option ids for include, exclude and preset, a ValueError for unknown names

func WriteReport

func WriteReport(outputDir string, report *jsonutil.Object) (err error)

Writes the redacted report.json and summary.md into outputDir

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

type KindError struct {
	Type string
	Msg  string
}

Python exception raised by the engine, str giving the message the script would print

func (*KindError) Error

func (e *KindError) Error() string

func (*KindError) ErrorKind

func (e *KindError) ErrorKind() string

Python exception class name of the error

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

func (*Migrator) Migrate

func (m *Migrator) Migrate() (report *Report, err error)

Runs every selected step and returns the report, written to the output directory when there is one

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

type OptionMeta struct {
	ID          string
	Label       string
	Description string
}

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 Preset

type Preset struct {
	ID      string
	Options []string
}

One named preset and the option ids it selects

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) JSON

func (r *Report) JSON() *jsonutil.Object

JSON object of the report in the key order report.json carries

func (*Report) OutputDirText

func (r *Report) OutputDirText() string

Output directory text, empty for None

type Summary

type Summary struct {
	// contains filtered or unexported fields
}

Status counts in first seen order, the five standard statuses always present

func (*Summary) Get

func (s *Summary) Get(key string) int

Count of a status, zero when absent

func (*Summary) JSON

func (s *Summary) JSON() *jsonutil.Object

JSON object of the counts

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL