Skip to content

fix(migration): resolve openclaw workspace files from agents.defaults.workspace - #16879

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-b4da4325
Apr 28, 2026
Merged

fix(migration): resolve openclaw workspace files from agents.defaults.workspace#16879
teknium1 merged 2 commits into
mainfrom
hermes/hermes-b4da4325

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

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.workspace in openclaw.json, covering early clawd/clawdbot users whose workspace lives outside ~/.openclaw/.

Changes

  • openclaw_to_hermes.py: read agents.defaults.workspace in __init__, stash as _custom_workspace when it exists and lies outside source_root; source_candidate() falls back to it after the standard + workspace-main/workspace-assistant paths.
  • tests: custom-workspace discovery + standard-path-preferred cases.
  • follow-up: dropped the duplicate _load_openclaw_config_early() helper the salvaged commit added — reuses the existing load_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.

in-liberty420 and others added 2 commits April 28, 2026 00:38
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.
@teknium1
teknium1 merged commit cff29fa into main Apr 28, 2026
9 of 11 checks passed
@teknium1
teknium1 deleted the hermes/hermes-b4da4325 branch April 28, 2026 07:40
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard labels Apr 28, 2026
@PHclaw

PHclaw commented Apr 28, 2026

Copy link
Copy Markdown

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants