{
  "schemaVersion": "1.0",
  "item": {
    "slug": "unfuck-my-git-state",
    "name": "Unfuck My Git State",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/delorenj/unfuck-my-git-state",
    "canonicalUrl": "https://clawhub.ai/delorenj/unfuck-my-git-state",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/unfuck-my-git-state",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=unfuck-my-git-state",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "README.md",
      "SKILL.md",
      "agents/openai.yaml",
      "references/recovery-checklist.md",
      "references/symptom-map.md",
      "scripts/guided_repair_plan.sh"
    ],
    "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. Then review README.md for any prerequisites, environment setup, or post-install checks. 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. Then review README.md for any prerequisites, environment setup, or post-install checks. 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/unfuck-my-git-state"
    },
    "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/unfuck-my-git-state",
    "agentPageUrl": "https://openagent3.xyz/skills/unfuck-my-git-state/agent",
    "manifestUrl": "https://openagent3.xyz/skills/unfuck-my-git-state/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/unfuck-my-git-state/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. Then review README.md for any prerequisites, environment setup, or post-install checks. 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. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "unfuck-my-git-state",
        "body": "Recover a repo without making the blast radius worse."
      },
      {
        "title": "Core Rules",
        "body": "Snapshot first. Do not \"just try stuff.\"\nPrefer non-destructive fixes before force operations.\nTreat .git/ as production data until backup is taken.\nUse git symbolic-ref before manually editing .git/HEAD.\nAfter each fix, run verification before proceeding."
      },
      {
        "title": "Fast Workflow",
        "body": "Capture diagnostics:\n\nbash scripts/snapshot_git_state.sh .\n\nRoute by symptom using references/symptom-map.md.\nGenerate non-destructive command plan:\n\nbash scripts/guided_repair_plan.sh --repo .\n\nApply the smallest matching playbook.\nRun references/recovery-checklist.md verification gate.\nEscalate only if the gate fails.\n\nFor explicit routing:\n\nbash scripts/guided_repair_plan.sh --list\nbash scripts/guided_repair_plan.sh --symptom phantom-branch-lock"
      },
      {
        "title": "Regression Harness",
        "body": "Use disposable simulation tests before changing script logic:\n\nbash scripts/regression_harness.sh\n\nRun one scenario:\n\nbash scripts/regression_harness.sh --scenario orphaned-worktree"
      },
      {
        "title": "Playbook A: Orphaned Worktree Metadata",
        "body": "Symptoms:\n\ngit worktree list shows a path that no longer exists.\nWorktree entries include invalid or zero hashes.\n\nSteps:\n\ngit worktree list --porcelain\ngit worktree prune -v\ngit worktree list --porcelain\n\nIf stale entries remain, back up .git/ and remove the specific stale folder under .git/worktrees/<name>, then rerun prune."
      },
      {
        "title": "Playbook B: Phantom Branch Lock",
        "body": "Symptoms:\n\ngit branch -d or git branch -D fails with \"already used by worktree\".\ngit worktree list seems to disagree with branch ownership.\n\nSteps:\n\ngit worktree list --porcelain\n\nFind the worktree using that branch, switch that worktree to another branch or detach HEAD there, then retry the branch operation in the main repo."
      },
      {
        "title": "Playbook C: Detached or Contradictory HEAD",
        "body": "Symptoms:\n\ngit status says detached HEAD unexpectedly.\ngit branch --show-current and git symbolic-ref -q HEAD disagree.\n\nSteps:\n\ngit symbolic-ref -q HEAD || true\ngit reflog --date=iso -n 20\ngit switch <known-good-branch>\n\nIf branch context is unknown, create a rescue branch from current commit:\n\ngit switch -c rescue/$(date +%Y%m%d-%H%M%S)\n\nThen reconnect to the intended branch after investigation."
      },
      {
        "title": "Playbook D: Missing or Broken Refs",
        "body": "Symptoms:\n\nunknown revision, not a valid object name, or cannot lock ref.\n\nSteps:\n\ngit fetch --all --prune\ngit show-ref --verify refs/remotes/origin/<branch>\ngit branch -f <branch> origin/<branch>\ngit switch <branch>\n\nUse reflog to recover local-only commits before forcing branch pointers."
      },
      {
        "title": "Last Resort: Manual HEAD Repair",
        "body": "Only after backup of .git/.\n\nPreferred:\n\ngit show-ref --verify refs/heads/<branch>\ngit symbolic-ref HEAD refs/heads/<branch>\n\nFallback when symbolic-ref cannot be used:\n\necho \"ref: refs/heads/<branch>\" > .git/HEAD\n\nImmediately run the verification gate."
      },
      {
        "title": "Verification Gate (Must Pass)",
        "body": "Run checks in references/recovery-checklist.md. Minimum bar:\n\ngit status exits cleanly with no fatal errors.\ngit symbolic-ref -q HEAD matches intended branch.\ngit worktree list --porcelain has no missing paths and no zero hashes.\ngit fsck --no-reflogs --full has no new critical errors."
      },
      {
        "title": "Escalation Path",
        "body": "Archive .git:\n\ntar -czf git-metadata-backup-$(date +%Y%m%d-%H%M%S).tar.gz .git\n\nClone fresh from remote.\nRecover unpushed work with reflog and cherry-pick from old clone.\nDocument failure mode and add guardrails to automation."
      },
      {
        "title": "Automation Hooks",
        "body": "When building worktree tooling (iMi, scripts, bots), enforce:\n\npreflight snapshot and state validation\npost-operation verification gate\nhard stop on HEAD/ref inconsistency\nexplicit user confirmation before destructive commands"
      },
      {
        "title": "Resources",
        "body": "Symptom router: references/symptom-map.md\nVerification checklist: references/recovery-checklist.md\nDiagnostic snapshot script: scripts/snapshot_git_state.sh\nGuided plan generator: scripts/guided_repair_plan.sh\nDisposable regression harness: scripts/regression_harness.sh"
      }
    ],
    "body": "unfuck-my-git-state\n\nRecover a repo without making the blast radius worse.\n\nCore Rules\nSnapshot first. Do not \"just try stuff.\"\nPrefer non-destructive fixes before force operations.\nTreat .git/ as production data until backup is taken.\nUse git symbolic-ref before manually editing .git/HEAD.\nAfter each fix, run verification before proceeding.\nFast Workflow\nCapture diagnostics:\nbash scripts/snapshot_git_state.sh .\n\nRoute by symptom using references/symptom-map.md.\nGenerate non-destructive command plan:\nbash scripts/guided_repair_plan.sh --repo .\n\nApply the smallest matching playbook.\nRun references/recovery-checklist.md verification gate.\nEscalate only if the gate fails.\n\nFor explicit routing:\n\nbash scripts/guided_repair_plan.sh --list\nbash scripts/guided_repair_plan.sh --symptom phantom-branch-lock\n\nRegression Harness\n\nUse disposable simulation tests before changing script logic:\n\nbash scripts/regression_harness.sh\n\n\nRun one scenario:\n\nbash scripts/regression_harness.sh --scenario orphaned-worktree\n\nPlaybook A: Orphaned Worktree Metadata\n\nSymptoms:\n\ngit worktree list shows a path that no longer exists.\nWorktree entries include invalid or zero hashes.\n\nSteps:\n\ngit worktree list --porcelain\ngit worktree prune -v\ngit worktree list --porcelain\n\n\nIf stale entries remain, back up .git/ and remove the specific stale folder under .git/worktrees/<name>, then rerun prune.\n\nPlaybook B: Phantom Branch Lock\n\nSymptoms:\n\ngit branch -d or git branch -D fails with \"already used by worktree\".\ngit worktree list seems to disagree with branch ownership.\n\nSteps:\n\ngit worktree list --porcelain\n\n\nFind the worktree using that branch, switch that worktree to another branch or detach HEAD there, then retry the branch operation in the main repo.\n\nPlaybook C: Detached or Contradictory HEAD\n\nSymptoms:\n\ngit status says detached HEAD unexpectedly.\ngit branch --show-current and git symbolic-ref -q HEAD disagree.\n\nSteps:\n\ngit symbolic-ref -q HEAD || true\ngit reflog --date=iso -n 20\ngit switch <known-good-branch>\n\n\nIf branch context is unknown, create a rescue branch from current commit:\n\ngit switch -c rescue/$(date +%Y%m%d-%H%M%S)\n\n\nThen reconnect to the intended branch after investigation.\n\nPlaybook D: Missing or Broken Refs\n\nSymptoms:\n\nunknown revision, not a valid object name, or cannot lock ref.\n\nSteps:\n\ngit fetch --all --prune\ngit show-ref --verify refs/remotes/origin/<branch>\ngit branch -f <branch> origin/<branch>\ngit switch <branch>\n\n\nUse reflog to recover local-only commits before forcing branch pointers.\n\nLast Resort: Manual HEAD Repair\n\nOnly after backup of .git/.\n\nPreferred:\n\ngit show-ref --verify refs/heads/<branch>\ngit symbolic-ref HEAD refs/heads/<branch>\n\n\nFallback when symbolic-ref cannot be used:\n\necho \"ref: refs/heads/<branch>\" > .git/HEAD\n\n\nImmediately run the verification gate.\n\nVerification Gate (Must Pass)\n\nRun checks in references/recovery-checklist.md. Minimum bar:\n\ngit status exits cleanly with no fatal errors.\ngit symbolic-ref -q HEAD matches intended branch.\ngit worktree list --porcelain has no missing paths and no zero hashes.\ngit fsck --no-reflogs --full has no new critical errors.\nEscalation Path\nArchive .git:\ntar -czf git-metadata-backup-$(date +%Y%m%d-%H%M%S).tar.gz .git\n\nClone fresh from remote.\nRecover unpushed work with reflog and cherry-pick from old clone.\nDocument failure mode and add guardrails to automation.\nAutomation Hooks\n\nWhen building worktree tooling (iMi, scripts, bots), enforce:\n\npreflight snapshot and state validation\npost-operation verification gate\nhard stop on HEAD/ref inconsistency\nexplicit user confirmation before destructive commands\nResources\nSymptom router: references/symptom-map.md\nVerification checklist: references/recovery-checklist.md\nDiagnostic snapshot script: scripts/snapshot_git_state.sh\nGuided plan generator: scripts/guided_repair_plan.sh\nDisposable regression harness: scripts/regression_harness.sh"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/delorenj/unfuck-my-git-state",
    "publisherUrl": "https://clawhub.ai/delorenj/unfuck-my-git-state",
    "owner": "delorenj",
    "version": "0.2.1",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/unfuck-my-git-state",
    "downloadUrl": "https://openagent3.xyz/downloads/unfuck-my-git-state",
    "agentUrl": "https://openagent3.xyz/skills/unfuck-my-git-state/agent",
    "manifestUrl": "https://openagent3.xyz/skills/unfuck-my-git-state/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/unfuck-my-git-state/agent.md"
  }
}