fix(migration): resolve openclaw workspace files from agents.defaults.workspace - #16879
Merged
Conversation
OpenClaw users who started before the rebrand (when the project was clawd/clawdbot) often have a custom workspace directory configured via agents.defaults.workspace in openclaw.json (e.g. ~/clawd/ instead of ~/.openclaw/workspace/). The migration tool only checked hardcoded relative paths (workspace/, workspace-main/, workspace-assistant/) inside the source root, so files like MEMORY.md, skills, and daily memory in custom workspaces were silently skipped. This change: - Reads agents.defaults.workspace from openclaw.json at init time - Uses it as a final fallback in source_candidate() when files aren't found in the standard locations - Standard workspace paths are still preferred (custom is fallback only) - Custom workspace is only used when it's outside the source_root tree (avoids double-matching when workspace/ is the default) Adds two tests: - Custom workspace files are discovered and migrated - Standard workspace location is preferred over custom
Drop the duplicate _load_openclaw_config_early() added in the salvaged commit — load_openclaw_config() (line 979) has the identical body and is a plain instance method that only needs self.source_root, which is already set before __init__ needs it.
|
For the memory retrieval issue: The likely cause is that the retrieval query embedding is not normalized the same way as stored embeddings. This causes cosine similarity to fail: from numpy.linalg import norm
def cosine_sim(a, b):
a_norm = a / norm(a)
b_norm = b / norm(b)
return float(np.dot(a_norm, b_norm))Also check if the vector store is using the same distance metric for both storage and retrieval (cosine vs dot product). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Salvages #8368 by @in-liberty420 onto current main, with a tiny dedupe follow-up.
Summary
Migrator now finds MEMORY.md / SOUL.md / skills / daily-memory in the workspace path configured via
agents.defaults.workspacein openclaw.json, covering early clawd/clawdbot users whose workspace lives outside~/.openclaw/.Changes
openclaw_to_hermes.py: readagents.defaults.workspacein__init__, stash as_custom_workspacewhen it exists and lies outsidesource_root;source_candidate()falls back to it after the standard +workspace-main/workspace-assistantpaths._load_openclaw_config_early()helper the salvaged commit added — reuses the existingload_openclaw_config()method (identical body, already on the class).Validation
scripts/run_tests.sh tests/skills/test_openclaw_migration.py→ 35 passed.Closes #8368. Original commit authored by @in-liberty420, preserved via rebase-merge.