{
  "schemaVersion": "1.0",
  "item": {
    "slug": "graceful-restart",
    "name": "优雅重启 Gateway。解决重启后丢失会话上下文的问题，重启前设置一次性 cron 任务，重启后自动发送消息到主会话恢复任务。默认 10 秒后唤醒。触发词：重启、restart",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/scotthuang/graceful-restart",
    "canonicalUrl": "https://clawhub.ai/scotthuang/graceful-restart",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/graceful-restart",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=graceful-restart",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "_meta.json",
      "CHANGELOG.md",
      "graceful-restart.js",
      "SKILL.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-07T17:22:31.273Z",
      "expiresAt": "2026-05-14T17:22:31.273Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=afrexai-annual-report",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=afrexai-annual-report",
        "contentDisposition": "attachment; filename=\"afrexai-annual-report-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/graceful-restart"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/graceful-restart",
    "agentPageUrl": "https://openagent3.xyz/skills/graceful-restart/agent",
    "manifestUrl": "https://openagent3.xyz/skills/graceful-restart/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/graceful-restart/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "触发条件",
        "body": "当用户要求重启 Gateway 时，自动触发此 skill。"
      },
      {
        "title": "问题背景",
        "body": "Gateway 重启后，会丢失上一轮会话的任务上下文，导致：\n\n主会话被中断，无法自动恢复\n需要用户手动发送消息才能继续"
      },
      {
        "title": "功能",
        "body": "自动执行\"重启后自唤醒\"流程：\n\n设置一次性 cron 任务（默认 10 秒后触发）\n执行 Gateway 重启\n重启后自动发送消息到主会话"
      },
      {
        "title": "English Description",
        "body": "Problem: After Gateway restarts, OpenClaw loses the previous session context - the main session is interrupted and cannot resume automatically.\n\nSolution: Auto-restart Gateway with self-wakeup. Sets a one-time cron task (default 10s) before restart, then sends a message to main session after Gateway recovers to resume tasks.\n\n⚠️ Important: Must use this skill, NOT exec:\n\n# ✅ Correct\nnode ~/.openclaw/workspace/skills/graceful-restart/graceful-restart.js --task \"config changed\"\n\n# ❌ Wrong\nexec openclaw gateway restart  # Don't do this!\n\nTrigger: \"重启\", \"restart Gateway\""
      },
      {
        "title": "使用方式",
        "body": "用户说\"重启\"时，自动执行：\n\n[自动触发 graceful-restart skill]\n\n或者用户可以指定任务：\n\n重启 Gateway，继续之前的任务：安装 Python 包"
      },
      {
        "title": "命令行调用",
        "body": "node ~/.openclaw/workspace/skills/graceful-restart/graceful-restart.js\nnode ~/.openclaw/workspace/skills/graceful-restart/graceful-restart.js --task \"继续安装 Python 包\"\nnode ~/.openclaw/workspace/skills/graceful-restart/graceful-restart.js --task \"继续安装 Python 包\" --delay 60"
      },
      {
        "title": "实现原理",
        "body": "使用 --session main + --system-event：\n\nCron 在主会话里注入一个 system event\nGateway 重启后，heartbeat 轮询到并交付给主会话\n主会话收到消息后回复用户"
      },
      {
        "title": "注意事项",
        "body": "Cron 任务时间可调整（默认 10 秒）\n使用 --delete-after-run 确保一次性任务自动清理"
      },
      {
        "title": "📝 更新 SOUL.md",
        "body": "使用此 skill 后，建议在 SOUL.md 中添加自动触发规则（见上方）。"
      },
      {
        "title": "⚠️ 重要：禁止使用 exec",
        "body": "Gateway 重启必须使用此 skill，禁止直接用 exec 执行：\n\n✅ 正确：\n\nnode ~/.openclaw/workspace/skills/graceful-restart/graceful-restart.js --task \"配置已修改，需要重启后生效\"\n\n❌ 错误：\n\nexec openclaw gateway restart  # 禁止！\n\n这样写"
      }
    ],
    "body": "graceful-restart skill\n触发条件\n\n当用户要求重启 Gateway 时，自动触发此 skill。\n\n问题背景\n\nGateway 重启后，会丢失上一轮会话的任务上下文，导致：\n\n主会话被中断，无法自动恢复\n需要用户手动发送消息才能继续\n功能\n\n自动执行\"重启后自唤醒\"流程：\n\n设置一次性 cron 任务（默认 10 秒后触发）\n执行 Gateway 重启\n重启后自动发送消息到主会话\nEnglish Description\n\nProblem: After Gateway restarts, OpenClaw loses the previous session context - the main session is interrupted and cannot resume automatically.\n\nSolution: Auto-restart Gateway with self-wakeup. Sets a one-time cron task (default 10s) before restart, then sends a message to main session after Gateway recovers to resume tasks.\n\n⚠️ Important: Must use this skill, NOT exec:\n\n# ✅ Correct\nnode ~/.openclaw/workspace/skills/graceful-restart/graceful-restart.js --task \"config changed\"\n\n# ❌ Wrong\nexec openclaw gateway restart  # Don't do this!\n\n\nTrigger: \"重启\", \"restart Gateway\"\n\n使用方式\n\n用户说\"重启\"时，自动执行：\n\n[自动触发 graceful-restart skill]\n\n\n或者用户可以指定任务：\n\n重启 Gateway，继续之前的任务：安装 Python 包\n\n命令行调用\nnode ~/.openclaw/workspace/skills/graceful-restart/graceful-restart.js\nnode ~/.openclaw/workspace/skills/graceful-restart/graceful-restart.js --task \"继续安装 Python 包\"\nnode ~/.openclaw/workspace/skills/graceful-restart/graceful-restart.js --task \"继续安装 Python 包\" --delay 60\n\n实现原理\n\n使用 --session main + --system-event：\n\nCron 在主会话里注入一个 system event\nGateway 重启后，heartbeat 轮询到并交付给主会话\n主会话收到消息后回复用户\n注意事项\nCron 任务时间可调整（默认 10 秒）\n使用 --delete-after-run 确保一次性任务自动清理\n📝 更新 SOUL.md\n\n使用此 skill 后，建议在 SOUL.md 中添加自动触发规则（见上方）。\n\n⚠️ 重要：禁止使用 exec\n\nGateway 重启必须使用此 skill，禁止直接用 exec 执行：\n\n✅ 正确：\n\nnode ~/.openclaw/workspace/skills/graceful-restart/graceful-restart.js --task \"配置已修改，需要重启后生效\"\n\n\n❌ 错误：\n\nexec openclaw gateway restart  # 禁止！\n\n\n这样写"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/scotthuang/graceful-restart",
    "publisherUrl": "https://clawhub.ai/scotthuang/graceful-restart",
    "owner": "scotthuang",
    "version": "1.0.4",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/graceful-restart",
    "downloadUrl": "https://openagent3.xyz/downloads/graceful-restart",
    "agentUrl": "https://openagent3.xyz/skills/graceful-restart/agent",
    "manifestUrl": "https://openagent3.xyz/skills/graceful-restart/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/graceful-restart/agent.md"
  }
}