openclaw: auto-register agents on install

After copying workspace files, call `openclaw agents add --non-interactive`
for each agent so they're immediately usable by agentId without any manual
config steps. Guarded by `command -v openclaw` so it's a no-op when OpenClaw
isn't installed. Adds a post-install reminder to restart the gateway.

Tested by Pip — an OpenClaw instance running on the machine that maintains
the agency-agents repo. 🫛
This commit is contained in:
Pip
2026-03-10 17:42:31 -05:00
parent 42393d76ab
commit 6c78886ec9

View File

@@ -358,9 +358,16 @@ install_openclaw() {
cp "$d/SOUL.md" "$dest/$name/SOUL.md" cp "$d/SOUL.md" "$dest/$name/SOUL.md"
cp "$d/AGENTS.md" "$dest/$name/AGENTS.md" cp "$d/AGENTS.md" "$dest/$name/AGENTS.md"
cp "$d/IDENTITY.md" "$dest/$name/IDENTITY.md" cp "$d/IDENTITY.md" "$dest/$name/IDENTITY.md"
# Register with OpenClaw so agents are usable by agentId immediately
if command -v openclaw >/dev/null 2>&1; then
openclaw agents add "$name" --workspace "$dest/$name" --non-interactive 2>/dev/null || true
fi
(( count++ )) || true (( count++ )) || true
done < <(find "$src" -mindepth 1 -maxdepth 1 -type d -print0) done < <(find "$src" -mindepth 1 -maxdepth 1 -type d -print0)
ok "OpenClaw: $count workspaces -> $dest" ok "OpenClaw: $count workspaces -> $dest"
if command -v openclaw >/dev/null 2>&1; then
warn "OpenClaw: run 'openclaw gateway restart' to activate new agents"
fi
} }
install_cursor() { install_cursor() {