Files
wehub-resource-sync 555e282cc4
ci / changelog_check (push) Waiting to run
ci / check_changes (push) Waiting to run
ci / build_mem0 (3.10) (push) Blocked by required conditions
ci / build_mem0 (3.11) (push) Blocked by required conditions
ci / build_mem0 (3.12) (push) Blocked by required conditions
CLI Node CI / lint (push) Waiting to run
CLI Node CI / test (20) (push) Waiting to run
CLI Node CI / test (22) (push) Waiting to run
CLI Node CI / build (push) Waiting to run
CLI Python CI / lint (push) Waiting to run
CLI Python CI / test (3.10) (push) Waiting to run
CLI Python CI / test (3.11) (push) Waiting to run
CLI Python CI / test (3.12) (push) Waiting to run
CLI Python CI / build (push) Waiting to run
openclaw checks / lint (push) Waiting to run
openclaw checks / test (20) (push) Waiting to run
openclaw checks / test (22) (push) Waiting to run
openclaw checks / build (push) Waiting to run
opencode-plugin checks / build (push) Waiting to run
pi-agent-plugin checks / lint (push) Waiting to run
pi-agent-plugin checks / test (20) (push) Waiting to run
pi-agent-plugin checks / test (22) (push) Waiting to run
pi-agent-plugin checks / build (push) Waiting to run
TypeScript SDK CI / check_changes (push) Waiting to run
TypeScript SDK CI / changelog_check (push) Blocked by required conditions
TypeScript SDK CI / build_ts_sdk (20) (push) Blocked by required conditions
TypeScript SDK CI / build_ts_sdk (22) (push) Blocked by required conditions
TypeScript SDK CI / integration_ts_sdk (20) (push) Blocked by required conditions
TypeScript SDK CI / integration_ts_sdk (22) (push) Blocked by required conditions
chore: import upstream snapshot with attribution
2026-07-13 13:03:45 +08:00

74 lines
2.2 KiB
Python
Executable File

#!/usr/bin/env python3
"""Patch ~/.openclaw/openclaw.json with skills-mode settings."""
import json
import os
import shutil
import sys
def main():
api_key = os.environ.get("MEM0_API_KEY", "")
user_id = os.environ.get("MEM0_USER_ID", os.environ.get("USER", "default"))
config_path = os.path.expanduser("~/.openclaw/openclaw.json")
if not api_key:
print("Error: MEM0_API_KEY not set.", file=sys.stderr)
sys.exit(1)
if not os.path.exists(config_path):
print(f"Error: {config_path} not found. Run 'openclaw configure' first.", file=sys.stderr)
sys.exit(1)
# Backup original config
backup_path = config_path + ".pre-skills-backup"
if not os.path.exists(backup_path):
shutil.copy2(config_path, backup_path)
print(f" Backed up config to {backup_path}")
else:
print(f" Backup already exists at {backup_path}")
with open(config_path) as f:
cfg = json.load(f)
# 1. Tools profile = full (exposes plugin tools to the model)
cfg["tools"] = {"profile": "full"}
# 2. Disable built-in session-memory hook
cfg.setdefault("hooks", {}).setdefault("internal", {}).setdefault("entries", {})
cfg["hooks"]["internal"]["entries"]["session-memory"] = {"enabled": False}
# 3. Plugin config with skills enabled
entries = cfg.setdefault("plugins", {}).setdefault("entries", {})
entries["openclaw-mem0"] = {
"enabled": True,
"config": {
"apiKey": api_key,
"userId": user_id,
"skills": {
"triage": {"enabled": True},
"recall": {
"enabled": True,
"tokenBudget": 1500,
"rerank": True,
"keywordSearch": True,
"identityAlwaysInclude": True,
},
"dream": {"enabled": True},
"domain": "companion",
},
},
}
with open(config_path, "w") as f:
json.dump(cfg, f, indent=2)
print(" Config updated:")
print(" tools.profile = full")
print(" session-memory = disabled")
print(f" skills = enabled (user: {user_id}, domain: companion)")
if __name__ == "__main__":
main()