Skip to content

/import

Import an existing OpenClaw agent from its workspace directory into the current project. Triggers on /agent:import, "importar agente", "traer de openclaw", "import agent".

shell
$ npx -y skills add crisandrews/ClawCode --skill import --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/import
How auto-invocation works

Context preview

The summary Claude sees to decide when to auto-load this skill.

Import an existing OpenClaw agent from its workspace directory into the current project. Triggers on /agent:import, "importar agente", "traer de openclaw", "import agent".

SKILL.md

import.SKILL.md
name: import
description: Import an existing OpenClaw agent from its workspace directory into the current project. Triggers on /agent:import, "importar agente", "traer de openclaw", "import agent".
user-invocable: true
argument-hint: [agent-id]

Import an OpenClaw Agent

Import an existing agent from an OpenClaw installation into this directory, then offer the same setup steps a new agent gets (QMD, messaging, crons).

Part 1: Copy the agent

1. **Discover OpenClaw workspaces** across plausible source locations. Users commonly run OpenClaw as `root` and then run ClawCode as a non-root user (e.g. inside an LXC where the service user is `claude`), so checking only `~/.openclaw` misses those setups. Look in every readable root below and union the results:

   for root in \
     "${CLAWCODE_OPENCLAW_ROOT:-}" \
     "$HOME/.openclaw" \
     "/root/.openclaw"; do
     [[ -z "$root" ]] && continue
     [[ -r "$root" ]] || continue
     ls -d "$root"/workspace* 2>/dev/null
   done | sort -u

Override the search roots with the `CLAWCODE_OPENCLAW_ROOT` env var when OpenClaw data lives in a non-standard location (e.g. a mounted volume).

If the loop returns nothing, ask the user for an absolute path to the source workspace instead of silently falling back.

For each workspace found, read `IDENTITY.md` to show the agent's name. Typical layouts:

  • `<root>/workspace/` — default agent (main)
  • `<root>/workspace-eva/` — agent "eva"
  • `<root>/workspace-jack/` — agent "jack"

2. **Let the user choose** which agent to import (or use argument if provided).

3. **Determine the source path**: use the absolute path from the chosen workspace (e.g. `/root/.openclaw/workspace-eva/` or `/home/claude/.openclaw/workspace/`). Do NOT re-expand `~` from an agent-id alone — the discovered path already carries the correct root.

4. **Copy bootstrap files** to the current project root: Files to copy from the source workspace:

  • `SOUL.md`, `IDENTITY.md`, `USER.md`, `AGENTS.md`, `TOOLS.md`, `HEARTBEAT.md`

Also copy CLAUDE.md from the plugin templates (NOT from OpenClaw):

   cp ${CLAUDE_PLUGIN_ROOT}/templates/CLAUDE.md ./

5. **Import memory** (ask user first):

  • Copy `MEMORY.md` to `./memory/MEMORY.md`
  • Copy recent memory files from `memory/` (last 30 days by default, or all if user wants full history)
  • Create `./memory/.dreams/` directory with empty `short-term-recall.json`
  • **NEVER copy** files with `credential`, `password`, `secret`, `.env` in their name

**5a. Channel-content guard (privacy / scope provenance) — mandatory.** OpenClaw daily logs often summarize WhatsApp/Telegram chats. Copied verbatim into top-level `memory/*.md` they are classified `local` provenance and **bypass channel-scope filtering** until manually moved or curated — a log imported as local is never promoted to the `.scoped` lane by dreaming, so once scope is later armed in `enforce` that channel content stays visible to operators who should not see it. After copying the dated daily logs, scan their *contents* for channel markers and **flag, never auto-classify**:

      CHANNEL_MARKERS='whats[[:space:]-]?app|\bwsp\b|\bwacli\b|baileys|@g\.us|@s\.whatsapp\.net|\btelegram\b|t\.me/|(nota|mensaje|audio) de voz|voice (note|message)'

      # Dated daily logs only — `find` avoids the zsh no-match glob error.
      find ./memory -maxdepth 1 -type f \( -name '????-??-??.md' -o -name '????-??-??-*.md' \) -print0 |
        while IFS= read -r -d '' f; do
          if LC_ALL=C grep -qiE "$CHANNEL_MARKERS" "$f"; then
            markers=$(LC_ALL=C grep -Eio "$CHANNEL_MARKERS" "$f" | sort -fu | paste -sd ', ' -)
            printf '%s\t%s\n' "$f" "$markers"
          fi
        done

If any dated file is flagged, use `AskUserQuestion` (counts + sample file names and matched markers only — **never the content**):

      AskUserQuestion(
        question: "<N> imported memory files contain channel-derived content (e.g. WhatsApp). Kept as plain memory they bypass scope filtering if you later arm enforce. What should I do with them?",
        options: [
          { label: "Quarantine (recommended)", description: "Move to ./import-quarantine/ (gitignored, NOT indexed). Preserved for manual curation; no scope leak." },
          { label: "Skip them", description: "Delete the copies; don't import these files." },
          { label: "Import as local anyway", description: "Keep as memory/*.md. I accept they bypass scope filtering under enforce." }
        ]
      )

Apply the choice to the flagged files only:

  • **Quarantine**: `mkdir -p ./import-quarantine && mv <flagged> ./import-quarantine/`,

then ensure `import-quarantine/` is gitignored in the target project (append it to `.gitignore`, creating the file if absent). Files outside `memory/` are never indexed by builtin or QMD, so `memory_search` won't surface them.

  • **Skip**: `rm <flagged>`.
  • **Import as local anyway**: leave in place; record the acknowledged bypass in the backlog.

**Also scan `./memory/MEMORY.md` warn-only** with the same `CHANNEL_MARKERS`. `MEMORY.md` is the curated index and IS indexed — but never auto-quarantine it (gutting it breaks the agent). If it matches, record it in the backlog for manual curation instead of moving it.

Record every flagged file in `IMPORT_BACKLOG.md` under `## Memory — Channel-content flagged` (file name + marker matched + chosen action; **never the content**), noting that mixed personal+channel logs need manual split/curation to be both searchable-as-personal and scope-filtered.

6. **Adapt AGENTS.md** for Claude Code: After copying, remove or comment out sections referencing OpenClaw-specific tools:

  • `sessions_spawn`, `message tool`, `browser tool`
  • `gateway`, `cron tool` (native OpenClaw cron), OpenClaw CLI comm
Read more
Read it on GitHub ↗

Showing the first part of this file.

Ships withcrisandrews-agent

Persistent agents for Claude Code as a plugin, not a harness. Memory, personality, messaging across WhatsApp, Telegram, and Discord, plus a service mode for 24/7 runs. Imports from OpenClaw.

Get the whole plugin, auto-invoked
Stats
61
Stars
0
Views
14
Forks
Active
Maintenance
TypeScript
Language
MIT
License
2d ago
Last commit
3mo ago
Created

Repo: crisandrews/ClawCode

Other skills on crisandrews-agent.