[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6JTH7KG40A7WXMCR5Z14225":3,"skill-same:01M6JTH7KG40A7WXMCR5Z14225":74},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":49,"ownerHtmlUrl":50,"ownerBlogUrl":51,"ownerDescription":52,"updatedAt":53,"install":54,"resources":67},"01M6JTH7KG40A7WXMCR5Z14225","xedit-automation",null,"Use whenever the task involves inspecting, modifying, or building plugins for Bethesda games via the forked xEdit automation daemon. Loads first; routes to the right path (MCP intent tool, MCP atomic passthrough, or sub-agent delegation) and prevents the agent from bypassing the harness.","hashgraph-online\u002Fawesome-codex-plugins","hashgraph-online","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F160371962?v=4","01M6CNB6NRJVNNGN14TR01Q6D3","HOL (Hashgraph Online)","01M6JT1HSKKG9V68KQAQGBA7XP",1575,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002FBB-84C\u002Fbgs-modding-superpowers\u002Fskills\u002Fxedit-automation\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"automation","xedit automation","loads","MCP","sub-agent","for","path","daemon","games","atomic","building plugins","delegation","via","task","intent","use","tool","first","plugins","harness","2026-11-10 10:12:30",false,"---\nname: xedit-automation\ndescription: Use whenever the task involves inspecting, modifying, or building plugins for Bethesda games via the forked xEdit automation daemon. Loads first; routes to the right path (MCP intent tool, MCP atomic passthrough, or sub-agent delegation) and prevents the agent from bypassing the harness.\n---\n\n# xEdit Automation — Hub Skill\n\nThis skill is the always-loaded entry point for any xEdit work. It is the single source of truth for \"which path do I use\" and \"what must I never do.\" Specialised task skills (e.g. `xedit-conflict-audit`) inherit its routing, anti-patterns, and verification discipline; they do not restate them.\n\n## Toolbox at a glance (progressive disclosure, r6-aware)\n\nThe forked xEdit daemon is best treated as a progressive-disclosure surface:\nstart with the small MCP intent tools, ask the live daemon which r6 capability\nblocks it supports, then switch to the richer one-call patterns only when the\ncorresponding `system.capabilities.supports.*` key is present.\n\n- **Discovery & session** — `xedit_session`, `xedit_list_capabilities`. Call\n  `xedit_session` first every conversation. Then call `xedit_list_capabilities`\n  once to see the command digest, `contractVersionExpected`, and r6\n  `supports.*` anchors.\n- **Reading records & conflicts** — `xedit_find_record`, `xedit_read_record`,\n  `xedit_inspect_conflicts`. These are the W2 (conflict audit) backbone; branch\n  to atomic passthrough when W2 needs an r6 response block that no intent tool\n  exposes yet.\n- **Atomic passthrough** — `xedit_call(command, args)`. For any native daemon\n  command that does not have an intent tool yet. Still runs the full pipeline\n  (validation → state → rules → audit). Use it whenever the intent tools do not\n  fit.\n\nFor deep reference material, query the structured BGS KB first (`bgs_kb_query`\n\u002F `bgs_kb_get`). Deep reference records live under\n`knowledge\u002Fbgs-kb\u002Fpacks\u002Fcore\u002Frecords\u002Fxedit\u002F` (queryable via `bgs_kb_query` \u002F\n`bgs_kb_get`).\n\n## Routing doctrine (which path to use)\n\n| Task shape | Path |\n|---|---|\n| High-frequency known intent (audit a conflict, read a record, run a job, write a patch) | **MCP intent tool** |\n| Novel \u002F debugging \u002F free composition of native commands | **MCP atomic passthrough**: `xedit_call(command, args)` — still in harness |\n| Exploratory atomic-op storm (trial-and-error, repeated read-eval, hypothesis testing) | **Delegate to a read-only investigator sub-agent** with this skill loaded; the sub-agent burns its own context, returns a distilled summary |\n| Large formalisable bulk mutation | **MCP `xedit_run_script`** (Batch 4+) with dry-run + snapshot |\n| Daemon explicitly in default (non-MCP) mode, manual debug only | Direct `xedit-client.ps1` is acceptable — but ONLY when the user has explicitly accepted the risk and the daemon is not in `-automation-mcp-mode` |\n\n**The agent should never have a reason to bypass the MCP.** Atomic passthrough exists for that.\n\n## 补丁创作判断 \u002F Patch authoring judgment\n\n### Overview\n\nPatch authoring is not \"make the red go away.\" It is a small compatibility\nargument: preserve the current winner, forward only the upstream values that\nshould still survive, and leave behind a reversible patch plugin whose contents\nsay what you meant. Sorting is a single-choice lever; patching is how you keep\ntwo mods' intended values active at once. But true-in-principle is not\ntrue-at-pack-scale: if the plan is to stitch every FormID because \"xEdit can fix\nanything,\" the plan is already broken.\n\nUse this section when you are about to author or judge a patch through the MCP.\nUse `xedit-conflict-audit` first when the question is still \"what wins, what\nconflicts, and should this be patch-vs-reorder?\" That skill owns the\npatch-vs-reorder call; this section owns whether the patch you are about to\nwrite is well-formed.\n\n### Decision flow: is this patch well-formed?\n\n```dot\ndigraph patch_authoring_judgment {\n  \u002F\u002F Pending-shutdown saves block lifecycle operations; see Dirty-state and\n  \u002F\u002F relaunch control below. A restart is not a durability mechanism.\n  rankdir=TB;\n  node [shape=box];\n\n  start [shape=doublecircle, label=\"Need a patch?\"];\n  audit [label=\"Audit actual winner + conflict fields\\n(xedit-conflict-audit if not already done)\"];\n  reorder [shape=diamond, label=\"Is ordering enough\\nwithout losing needed values?\"];\n  no_patch [shape=doublecircle, label=\"No patch: reorder \u002F leave winner\\nthen verify readback\"];\n  winner [label=\"Copy\u002Ftarget the current winner\\nnot an older loser\"];\n  intent [label=\"Name each value to forward\\nWhat does it do? Why should it survive?\"];\n  noise [shape=diamond, label=\"Any unchanged copied values\\nor green\u002FITM-style noise?\"];\n  clean [label=\"Remove unchanged\u002Fno-intent values\"];\n  refs [shape=diamond, label=\"Deleting or mark-deleting\\nrecords\u002Felements?\"];\n  referenced [label=\"Run referenced_by \u002F reference audit\\nStop if consequences are unknown\"];\n  esl [label=\"Choose patch form deliberately\\nUsually ESP flagged ESL when safe; avoid native ESL\u002FESM if sort freedom matters\"];\n  reversible [shape=diamond, label=\"Separate reversible patch\\n(no direct source-mod edit, no unmanaged overwrite spill)?\"];\n  fix_shape [label=\"Move into managed MO2 mod\\nor create dedicated patch plugin\"];\n  verify [label=\"Save + restart + readback\\nwinning override shows intended values\"];\n  pass [shape=doublecircle, label=\"Well-formed patch\"];\n\n  start -> audit -> reorder;\n  reorder -> no_patch [label=\"yes\"];\n  reorder -> winner [label=\"no, need combined values\"];\n  winner -> intent -> noise;\n  noise -> clean [label=\"yes\"];\n  noise -> refs [label=\"no\"];\n  clean -> refs;\n  refs -> referenced [label=\"yes\"];\n  refs -> esl [label=\"no\"];\n  referenced -> esl;\n  esl -> reversible;\n  reversible -> fix_shape [label=\"no\"];\n  reversible -> verify [label=\"yes\"];\n  fix_shape -> verify -> pass;\n  \u002F\u002F Contract 0.23 pending saves use xedit_flush; restart alone is not proof.\n  verify [label=\"Save + inspect pending state; xedit_flush if needed; fresh readback\"];\n}\n```\n\n> **Deferred-save correction:** The diagram's historical `Save + restart +\n> readback` node is superseded. If `session.save` reports a nonzero\n> `savePendingShutdownCount`, inspect `xedit_dirty`, then use `xedit_flush` on a\n> contract-0.23 daemon. The tool validates the drain response and confirms the\n> daemon's promised self-exit. A `partial` or unknown `lastFlush` is not durability\n> proof. Normal stop\u002Frestart remains refused while a live pending queue exists;\n> `force:true` abandons state and is never evidence of durability.\n\n### Authoring checks\n\n- **Forward the winner.** The game reads the final\u002Fwinning override for a\n  FormID. Build the patch from the current winner, then forward only the older\n  mod values that still need to survive.\n- **No unchanged cargo.** If a copied value does not change meaning, it is\n  ITM-style noise, not compatibility. Remove it unless you can state why it is\n  intentionally carried.\n- **Patch as separate layer.** Do not drag values directly into the source mod\n  just because it is the rightmost column today. A patch should be reversible by\n  disabling\u002Fremoving the patch layer, not by hand-deleting fields from someone\n  else's plugin.\n- **Preserve references.** If deletion or mark-delete enters the plan, stop and\n  run the referenced-by\u002Freadback path first. Unknown references mean unknown\n  blast radius.\n- **Choose plugin form deliberately.** Ordinary compatibility patches usually\n  want normal ESP sort freedom plus ESL flagging when safe. Native ESL\u002FESM\n  load-order behavior is not a free cleanliness upgrade.\n- **Good patch vs band-aid patch.** A good patch has named intent per forwarded\n  value and reduces conflict debt. A band-aid patch copies whole records, edits\n  source mods, or tries to stitch every FormID because sorting was treated as\n  irrelevant.\n\n### KB query discipline\n\nThis judgment section is game-agnostic. Query KB for game-specific patching\ngotchas, record-family caveats, and current toolchain facts rather than\nfossilizing them here.\n\n```text\nbgs_kb_query({ query: \"xedit patch authoring gotchas\", domains: [\"xedit\", \"load-order\"], games: [\"\u003Ccurrent game>\"] })\n```\n\nIf KB is silent, mark `[GAP]` and keep the patching rule at the framework level\ninstead of inventing a game-specific doctrine.\n\n### Red Flags (STOP)\n\n| Thought | Reality |\n|---|---|\n| \"It's red, so copy the left value.\" | Red is a prompt to inspect. It is not a verdict that the losing value should survive. |\n| \"The rightmost mod is wrong; I'll edit it directly.\" | Then you made the source mod the patch. Use a separate override patch so reversal is clean. |\n| \"Sorting does not matter because xEdit can patch anything.\" | In principle, yes; across hundreds of thousands of FormIDs, no. Use ordering to reduce repair debt, then patch the meaningful remainder. |\n| \"Green\u002Funchanged copied values are harmless.\" | They are no-intent cargo. If they do not change meaning, remove them. |\n| \"Native ESL is cleaner than ESP flagged ESL.\" | Native ESL\u002FESM can cost normal sort freedom. Use ESP flagged ESL when that is the safe patch shape. |\n| \"This looks unused; delete it.\" | Referenced-by first. Deletion without reference knowledge is unknown blast radius. |\n\n### Rationalizations\n\n| Excuse | Reality |\n|---|---|\n| \"I'll just drag one field into the winning plugin.\" | One field is still a source-mod edit. Make a patch layer, or future-you hand-removes stray fields one by one. |\n| \"The patch should preserve everything any mod touched.\" | Preserve intent, not history. Some edits are core to the mod; some are incidental author preference that should lose to a systemic rule. |\n| \"I do not know what this field does, so I'll copy the version that looks plausible.\" | Unknown field meaning is a research task, not a dice roll. Read the record structure, CK\u002Fwiki\u002Fcommunity examples, and actual in-pack behavior. |\n| \"Overwrite is fine; MO2 sees it.\" | Overwrite is spill. A real patch belongs in a managed mod layer with a name future-you can understand. |\n| \"The response said ok; the patch is done.\" | Patch acceptance is winning-override readback after save\u002Frestart, with the intended values visible and no unintended cargo. |\n\n## R6 progressive-disclosure capability checks\n\nDo not assume every daemon is r6. Read `xedit_list_capabilities` once and branch\non the support keys below. On pre-r6 daemons, fall back to the older explicit\nrecord-list \u002F child-walk \u002F per-record loop patterns; on r6+ daemons, use the\none-call or page-aware form to reduce round-trips and preserve context.\n\n| Capability key | Contract | Prefer this pattern | KB record |\n|---|---:|---|---|\n| `supports.childGroupNavigation` | 0.13 | Navigate CELL\u002FWRLD\u002FDIAL\u002FQUST ChildGroups through `elements.children` stubs | `xedit.childgroup-navigation.v1` |\n| `supports.createParentSpec` | 0.16 \u002F 0.18 | Create records directly under parent ChildGroups with `records.create` `parent` | `xedit.records-create-parent-spec.v1` |\n| `supports.elementsChildrenPagination` | 0.17 | Page `elements.children` with `limit` \u002F `offset` | `xedit.elements-children-pagination.v1` |\n| `supports.reverseNavigation` | 0.19 | Add `includeParents:true` and read `relations.parents` | `xedit.reverse-navigation.v1` |\n\nFor the whole r6 contract delta, query KB record `xedit.r6-contract-summary.v1`.\n\n### ChildGroup navigation (`supports.childGroupNavigation`)\n\nOn r6+ daemons, `elements.children` on CELL, WRLD, DIAL, and QUST records\nreturns a virtual child entry with `kind: \"child_group\"`. Treat that entry as a\nread-only navigation stub, not as a real mutable element.\n\nUse it one generation at a time:\n\n```text\nelements.children({ file, formId, path: \"\\\\Child Group\" })\nelements.children({ file, formId, path: \"\\\\Child Group\\\\Persistent\" })\nelements.children({ file, formId, path: \"\\\\Child Group\\\\Temporary\" })\nelements.children({ file, formId, path: \"\\\\Child Group\\\\Visible when Distant\" })\nelements.children({ file, formId, path: \"\\\\Child Group\\\\Block X, Y\" })\nelements.children({ file, formId, path: \"\\\\Child Group\\\\Block X, Y\\\\Sub-Block M, N\" })\n```\n\n- Walk exactly the next level; do not ask for the whole tree when a page or one\n  ChildGroup label is enough.\n- The `\\\\Child Group...` paths are synthetic and READ-ONLY. Mutation verbs must\n  use flat FormID locators (`{ file, formId }`) or a `records.create.parent`\n  spec; do not pass synthetic locator paths to mutators.\n- For WRLD cells, use `Persistent` or the Block\u002FSub-Block\u002Fcoordinate route\n  depending on the target child group.\n- Deep reference: `xedit.childgroup-navigation.v1`.\n\n### `elements.children` pagination (`supports.elementsChildrenPagination`)\n\nOn r6+ daemons, `elements.children` accepts `limit` and `offset`:\n\n```text\nelements.children({ file, formId, path, limit: 200, offset: 0 })\n```\n\n- `limit` is clamped to 1-1000 and defaults to 200.\n- Responses include `count`, `total`, `offset`, and `truncated`.\n- If `truncated` is true, keep the same `limit`, add `count` to `offset`, and\n  fetch the next page until covered.\n- Do not assume CELL child groups are small: FO4 vanilla CELL `00000025`\n  `Temporary` contains 742 records.\n- Deep reference: `xedit.elements-children-pagination.v1`.\n\n### Reverse navigation (`supports.reverseNavigation`)\n\nOn r6+ daemons, add `includeParents: true` when you need to know ownership or\ncontainment without a second verb. Supported read calls include:\n\n- `records.get`\n- `records.find_by_form_id` \u002F `records.find_by_editor_id` and MCP wrappers such\n  as `xedit_find_record`\n- `records.master_or_self`\n- `records.winning_override`\n- `elements.get`\n- `elements.children`\n\nThe response may include:\n\n```text\nrelations.parents: [{ locator, object }, ...]\n```\n\nParents are nearest-first with a daemon depth cap of 16. This is the preferred\nanswer to \"which CELL owns this REFR?\" or \"which QUST\u002FDIAL group contains this\nchild?\" Use the parent chain as readback evidence; do not build a custom\nreverse-index loop unless the support key is absent. Deep reference:\n`xedit.reverse-navigation.v1`.\n\n### `records.create` parent-spec (`supports.createParentSpec`)\n\nMutating record creation into ChildGroups is r6-gated and still requires the\nnormal MCP mutation consent path. When supported, author the target parent\nexplicitly instead of trying to mutate synthetic `\\\\Child Group` paths.\n\nCELL, DIAL, and QUST children:\n\n```text\nrecords.create({\n  targetFile,\n  signature,\n  editorId,\n  parent: { file, formId, subGroup? }\n})\n```\n\nWRLD children:\n\n```text\nrecords.create({\n  targetFile,\n  signature,\n  editorId,\n  parent: { file, formId, subGroup: \"Persistent\" }\n})\n\nrecords.create({\n  targetFile,\n  signature,\n  editorId,\n  parent: { file, formId, coords: [X, Y] }\n})\n```\n\nFor `coords`, native xEdit creates the needed Block\u002FSub-Block groups. Validate\nwith `records.get` or `elements.children({ includeParents: true })` after the\npreview\u002Fcommit flow, then inspect `xedit_dirty` for `pendingShutdownSave` after\nthe save. A pending-shutdown result blocks normal lifecycle operations; do not\nuse a restart as a durability shortcut. Deep reference:\n`xedit.records-create-parent-spec.v1`.\n\n## Anti-patterns (hard bans)\n\nNever do any of the following. Each ban is encoded as an MCP rule or daemon-side refusal, but the skill states them so the agent does not even attempt:\n\n1. **Do not write Python (or any other language) to parse `.esp\u002F.esm\u002F.esl` files directly.** The daemon is the only correct path. If you find yourself reaching for a binary plugin parser, stop and use `xedit_call` instead.\n2. **Do not treat restart as a durability mechanism.** `session.save` reports `savedFilesPendingShutdown` and `savePendingShutdownCount` when xEdit queued a shutdown-time write. Contract 0.23 adds authoritative pending readback and `session.flush`; use the lifecycle-owned `xedit_flush`, not `xedit_call`, then perform fresh-daemon readback. `force:true` on stop\u002Frestart is explicit abandonment, not persistence proof.\n3. **Do not call mutating ops in mcp-mode without going through the MCP.** Direct pipe writes will be refused by the daemon with `mcp_mode_required`.\n4. **Do not page `system.capabilities` every session.** The digest in `xedit_list_capabilities` already carries the curated map; only call live capabilities once to check drift.\n5. **Do not delete or mark-deleted a record that is referenced by other plugins** without first calling `xedit_call records.referenced_by` and accepting the consequences. Snapshot does not cleanly recover deletions.\n\n## Enabling consent (`-IKnowWhatImDoing`)\n\nMutating intent tools (`xedit_create_child_record`, `xedit_call records.create`,\n`xedit_call records.delete`, `xedit_call records.copy_into`, etc.) require the\nxEdit daemon to be launched in consent mode — otherwise they fast-fail with\n`code: \"mutation_requires_iknowwhatimdoing\"` BEFORE the daemon is contacted.\n\nEnable consent at launch time via the MCP arg:\n\n```\nxedit_start({ iKnowWhatImDoing: true, ...other overrides })\nxedit_restart({ iKnowWhatImDoing: true, ...other overrides })  # if already running\n```\n\nThe flag is forwarded as `--i-know-what-im-doing 1` to `xedit-client.ps1`, which\nappends `-IKnowWhatImDoing` to xEdit's startup argv. Verify post-launch:\n\n```\nxedit_session()  # data.consentEnabled === true ?\n```\n\nIf `consentEnabled` is still `false` after passing `iKnowWhatImDoing: true`,\nthe flag did not propagate — check that the MCP is on a build that includes\nthe consent forwarding (commit `xxx` and later; see `RELEASE-NOTES.md`).\n\nConsent is per-launch and explicit only: there is no env-var fallback, no\nruntime toggle, and the audit log captures the consent decision at the call\nsite. To revoke consent, call `xedit_stop` then `xedit_start` without the flag.\n\n## Confidence + dry-run discipline (borrowed from skyrimvr-claude-toolkit)\n\nBefore any mutating action:\n\n1. State your confidence (0-100%) and your top 3 assumptions.\n2. If confidence \u003C 90%, investigate first (read records, inspect conflicts, list references) until ≥ 90%.\n3. For HIGH-RISK mutations, the MCP will return a preview envelope with `confirmToken`. Read the preview, decide, then commit with the token. Treat the preview as the contract.\n\n## Sub-agent delegation recipes (role-agnostic)\n\nWhen delegating, do not hard-code role names — the harness will map them. Use these recipes:\n\n**Read-only investigator** — for exploratory storms, conflict surveys, and \"what's in this plugin\" reconnaissance:\n\n> Dispatch a read-only investigator sub-agent with this skill loaded. Provide the question, the target files, and the budget (token \u002F time \u002F step count). The sub-agent should return a distilled summary (verdict + key evidence + open questions), not the raw daemon round-trips.\n\n**Bounded mutation worker** — for well-defined batch edits (Batch 4+):\n\n> Dispatch a bounded-execution sub-agent with this skill and the patch-authoring skill loaded. Provide the spec, the snapshot expectations, and the acceptance checks. The sub-agent should perform the mutations through the MCP and return the snapshot IDs + readback proof.\n\n## Self-growing knowledgebase\n\nAfter any session that produced a footgun (an unexpected refusal, a non-obvious recovery, a surprising daemon behavior):\n\n1. Identify whether the gotcha is a durable fact, not project-internal noise. Project-local lessons that do not belong in the public KB go in the project devlog instead.\n2. Author a KB record at `\u003Cpack-root>\u002Frecords\u002F\u003Cdomain>\u002F\u003Cslug>.v1.md` with YAML frontmatter that validates against `knowledge\u002Fbgs-kb\u002Fschema\u002Frecord.schema.json`.\n3. Pick the pack deliberately: cross-game \u002F cross-tool facts go under `knowledge\u002Fbgs-kb\u002Fpacks\u002Fcore\u002Frecords\u002F`; game-specific facts go into the matching per-game pack (`bgs-kb-skyrim`, `bgs-kb-fallout4`, `bgs-kb-fallout3-fnv`, `bgs-kb-starfield`).\n4. Run `node tools\u002Fbgs-kb-mcp\u002Fdist\u002Fcli.js validate \u003Cpack-root>` and then `node tools\u002Fbgs-kb-mcp\u002Fdist\u002Fcli.js build \u003Cpack-root>` to refresh that pack, unless the current phase explicitly forbids rebuilds and gives a narrower validation path.\n5. Verify retrieval from a fresh MCP connection with `bgs_kb_query` and confirm the new record appears for a query a future agent would actually use.\n6. If the footgun is mechanically detectable, mark the KB record as a rule candidate when the schema supports it and track the reserved rule ID in a planning doc. Candidates require human review before promotion into `tools\u002Fxedit-mcp` enforcement.\n\nWorked example:\n\n1. Gotcha: xEdit daemon responses may include `0x`-prefixed FormIDs, while the MCP normalizes them at the edge.\n2. Pack\u002Fpath: `knowledge\u002Fbgs-kb\u002Fpacks\u002Fcore\u002Frecords\u002Fxedit\u002Fformid-prefix-normalization.v1.md`.\n3. Validate\u002Fbuild: `node tools\u002Fbgs-kb-mcp\u002Fdist\u002Fcli.js validate knowledge\u002Fbgs-kb\u002Fpacks\u002Fcore` then `node tools\u002Fbgs-kb-mcp\u002Fdist\u002Fcli.js build knowledge\u002Fbgs-kb\u002Fpacks\u002Fcore`.\n4. Verify: query `bgs_kb_query({ query: \"0x FormID normalization\", domains: [\"xedit\"] })` and confirm the record is returned.\n\n## When this skill applies\n\n- Any task involving Bethesda plugin files (`.esp\u002F.esm\u002F.esl`) for FO4, Skyrim, FO76, Starfield in this repo's MO2 harness.\n- Any conflict \u002F patching \u002F cleaning \u002F ESL \u002F scripting task against xEdit.\n- Whenever the task description names xEdit, plugin records, FormIDs, masters, conflicts, ITM\u002FUDR, ESL flagging, or Pascal Edit Scripts.\n\nWhen in doubt, load it.\n\n## Sibling skills\n\n- **`writing-bgs-load-order`** — authoritative reference for editing\n  `plugins.txt` \u002F `loadorder.txt`. Use it whenever the task is about\n  activating, deactivating, reordering, adding, or removing plugins from the\n  load order. Do NOT edit `plugins.txt` blindly; xEdit can not change load\n  order itself (docs 2.3), so the file edit is the only path for those\n  operations, and the asterisk-format rules + official-master detection rules\n  are non-obvious.\n- **`setting-up-bgs-modding-environment`** — first-run setup including the\n  MO2 `gamePath` inspection step you must do before launching xEdit with the\n  `dataPath` override.\n\n## Launching xEdit with explicit args (NEW)\n\nThe `xedit_start` MCP tool accepts optional overrides:\n\n```\nxedit_start({\n  launcherPath?: string,    \u002F\u002F xEdit.exe path\n  gameMode?: string,        \u002F\u002F \"Fallout4\", \"SkyrimSE\", etc.\n  dataPath?: string,        \u002F\u002F -D: flag; MO2 \u003CgamePath>\\\\Data\n  pluginsFile?: string,     \u002F\u002F -P: flag; agent-authored plugins.txt\n  moProfile?: string,       \u002F\u002F MO2 profile name; defaults to env\n  starfieldRedPill?: boolean, \u002F\u002F Starfield save-unlock trio; defaults true\n})\n```\n\n**Always pass `dataPath`** when the user wants xEdit to see the MO2-managed\ngame tree. Without it, xEdit falls back to the Windows registry, which\nreturns the raw Steam install path — and your conflict audit will be against\nthe wrong game data. Read MO2's `ModOrganizer.ini` `gamePath` value, append\n`\\\\Data`, and pass that.\n\nFor load-order experimentation (test a subset of plugins to isolate a\nconflict, or rehearse a sort), generate a plugins.txt under an\n**agent-owned artifacts path** per `writing-bgs-load-order` and pass it as\n`pluginsFile`.\n\n## Starfield save unlock (RedPill switches)\n\nSymptom: SF1Edit refuses to save Starfield small\u002Fmedium\u002Flocalized ESMs with an\nerror like `Medium flagged files can't be saved in SF1Edit`.\n\nUpstream xEdit 4.1.5k added the required switch trio:\n`-ItJustWorksTM -ThisIsFine -GiveMeTheRedPill`. This plugin's launcher passes\nall three by **default** for `gameMode: \"Starfield\"` sessions. Opt out only when\nyou are intentionally testing vanilla SF1 save gates:\n\n```\nxedit_start({ gameMode: \"Starfield\", starfieldRedPill: false })\n```\n\nSide effects when RedPill is on:\n\n- The xEdit window title shows `ItJustWorks[TM] Edition`; this is ceremonial,\n  not a bug.\n- `files.create` no longer auto-adds `Starfield.esm` as a master. Call\n  `files.create({ ..., initialMasters: [\"Starfield.esm\"] })` or follow with\n  `files.add_required_masters` when the new file needs the base master.\n\n## Dirty-state and relaunch control (NEW)\n\nThe daemon exposes `session.get_dirty_state`. Contract 0.23 includes\n`pendingShutdownFiles` and `pendingShutdownCount`; the MCP treats a complete\nreadback as authoritative and retains local `session.save` observations as a\nfail-closed fallback for older daemons or failed probes. Neither source is\ncleared by `dirty:false`: xEdit marks queued saves clean before their physical\nwrite is durable. The MCP exposes these lifecycle helpers:\n\n- `xedit_dirty({})` — returns `{ dirty, dirtyFiles, unsavedChangeCount,\n  pendingShutdownSave }` when ready. File-summary objects are normalized to\n  plugin names. This is the safe thing to call before any lifecycle action.\n- `xedit_flush({ force?: true })` — contract-0.23 pending-rename drain. It is\n  consent-gated, refuses unsaved dirty files unless `force:true`, validates\n  `flushedFiles` \u002F `pendingRemaining`, waits for the managed PID to exit, and\n  reports `completed`, `partial`, or an unknown result. `session.flush` is\n  lifecycle-owned and deliberately refused through `xedit_call`. A failed\n  in-band rename remains queued for one final normal exit-time retry. Start a\n  fresh daemon and read the plugin back before deciding whether a partial result\n  became durable.\n- `xedit_stop({ force?: true })` — if the session is dirty or the MCP has a\n  pending-shutdown save and `force` is not set, refuses with `code:\n  \"dirty_state\"` or `\"pending_save\"` respectively. `force:true` remains an\n  explicit abandonment and returns an auditable risk record. If the dirty-state\n  probe itself fails, normal lifecycle action refuses with\n  `dirty_state_unavailable`; retry `xedit_dirty` instead of guessing.\n- `xedit_restart({ launcherPath?, gameMode?, dataPath?, pluginsFile?, moProfile?, force?: true })`\n  — same pending-save and dirty-state safety as stop, then relaunches\n  asynchronously with new overrides only when the lifecycle boundary is safe.\n\nUse `xedit_restart` only when you need to reboot xEdit with a different custom\n`pluginsFile` or `dataPath` and `pendingShutdownSave.count` is zero. For a\ndeferred save, call `xedit_flush`, require `completed` with zero remaining, then\nlaunch a fresh daemon and read the plugin back. If `lastFlush` is `partial` or\nhas `outcome: unknown`, surface the residue rather than claiming durability.\nOnce a fresh daemon is ready, that old summary appears as\n`previousSessionFlush` with the originating PID and timestamp; use fresh plugin\nreadback to close it.\n\nIf `xedit_flush` reports that the drain response arrived but daemon exit was not\nconfirmed, do not force-stop immediately. The daemon may still be running its\nnormal close path and final rename retry. Wait briefly and call `xedit_health`;\nthe health tool rechecks the managed PID and clears the retained failed state\nonly after delayed exit is confirmed.\n","# xEdit Automation — Hub Skill\n\nThis skill is the always-loaded entry point for any xEdit work. It is the single source of truth for \"which path do I use\" and \"what must I never do.\" Specialised task skills (e.g. `xedit-conflict-audit`) inherit its routing, anti-patterns, and verification discipline; they do not restate them.\n\n## Toolbox at a glance (progressive disclosure, r6-aware)\n\nThe forked xEdit daemon is best treated as a progressive-disclosure surface:\nstart with the small MCP intent tools, ask the live daemon which r6 capability\nblocks it supports, then switch to the richer one-call patterns only when the\ncorresponding `system.capabilities.supports.*` key is present.\n\n- **Discovery & session** — `xedit_session`, `xedit_list_capabilities`. Call\n  `xedit_session` first every conversation. Then call `xedit_list_capabilities`\n  once to see the command digest, `contractVersionExpected`, and r6\n  `supports.*` anchors.\n- **Reading records & conflicts** — `xedit_find_record`, `xedit_read_record`,\n  `xedit_inspect_conflicts`. These are the W2 (conflict audit) backbone; branch\n  to atomic passthrough when W2 needs an r6 response block that no intent tool\n  exposes yet.\n- **Atomic passthrough** — `xedit_call(command, args)`. For any native daemon\n  command that does not have an intent tool yet. Still runs the full pipeline\n  (validation → state → rules → audit). Use it whenever the intent tools do not\n  fit.\n\nFor deep reference material, query the structured BGS KB first (`bgs_kb_query`\n\u002F `bgs_kb_get`). Deep reference records live under\n`knowledge\u002Fbgs-kb\u002Fpacks\u002Fcore\u002Frecords\u002Fxedit\u002F` (queryable via `bgs_kb_query` \u002F\n`bgs_kb_get`).\n\n## Routing doctrine (which path to use)\n\n| Task shape | Path |\n|---|---|\n| High-frequency known intent (audit a conflict, read a record, run a job, write a patch) | **MCP intent tool** |\n| Novel \u002F debugging \u002F free composition of native commands | **MCP atomic passthrough**: `xedit_call(command, args)` — still in harness |\n| Exploratory atomic-op storm (trial-and-error, repeated read-eval, hypothesis testing) | **Delegate to a read-only investigator sub-agent** with this skill loaded; the sub-agent burns its own context, returns a distilled summary |\n| Large formalisable bulk mutation | **MCP `xedit_run_script`** (Batch 4+) with dry-run + snapshot |\n| Daemon explicitly in default (non-MCP) mode, manual debug only | Direct `xedit-client.ps1` is acceptable — but ONLY when the user has explicitly accepted the risk and the daemon is not in `-automation-mcp-mode` |\n\n**The agent should never have a reason to bypass the MCP.** Atomic passthrough exists for that.\n\n## 补丁创作判断 \u002F Patch authoring judgment\n\n### Overview\n\nPatch authoring is not \"make the red go away.\" It is a small compatibility\nargument: preserve the current winner, forward only the upstream values that\nshould still survive, and leave behind a reversible patch plugin whose contents\nsay what you meant. Sorting is a single-choice lever; patching is how you keep\ntwo mods' intended values active at once. But true-in-principle is not\ntrue-at-pack-scale: if the plan is to stitch every FormID because \"xEdit can fix\nanything,\" the plan is already broken.\n\nUse this section when you are about to author or judge a patch through the MCP.\nUse `xedit-conflict-audit` first when the question is still \"what wins, what\nconflicts, and should this be patch-vs-reorder?\" That skill owns the\npatch-vs-reorder call; this section owns whether the patch you are about to\nwrite is well-formed.\n\n### Decision flow: is this patch well-formed?\n\n```dot\ndigraph patch_authoring_judgment {\n  \u002F\u002F Pending-shutdown saves block lifecycle operations; see Dirty-state and\n  \u002F\u002F relaunch control below. A restart is not a durability mechanism.\n  rankdir=TB;\n  node [shape=box];\n\n  start [shape=doublecircle, label=\"Need a patch?\"];\n  audit [label=\"Audit actual winner + conflict fields\\n(xedit-conflict-audit if not already done)\"];\n  reorder [shape=diamond, label=\"Is ordering enough\\nwithout losing needed values?\"];\n  no_patch [shape=doublecircle, label=\"No patch: reorder \u002F leave winner\\nthen verify readback\"];\n  winner [label=\"Copy\u002Ftarget the current winner\\nnot an older loser\"];\n  intent [label=\"Name each value to forward\\nWhat does it do? Why should it survive?\"];\n  noise [shape=diamond, label=\"Any unchanged copied values\\nor green\u002FITM-style noise?\"];\n  clean [label=\"Remove unchanged\u002Fno-intent values\"];\n  refs [shape=diamond, label=\"Deleting or mark-deleting\\nrecords\u002Felements?\"];\n  referenced [label=\"Run referenced_by \u002F reference audit\\nStop if consequences are unknown\"];\n  esl [label=\"Choose patch form deliberately\\nUsually ESP flagged ESL when safe; avoid native ESL\u002FESM if sort freedom matters\"];\n  reversible [shape=diamond, label=\"Separate reversible patch\\n(no direct source-mod edit, no unmanaged overwrite spill)?\"];\n  fix_shape [label=\"Move into managed MO2 mod\\nor create dedicated patch plugin\"];\n  verify [label=\"Save + restart + readback\\nwinning override shows intended values\"];\n  pass [shape=doublecircle, label=\"Well-formed patch\"];\n\n  start -> audit -> reorder;\n  reorder -> no_patch [label=\"yes\"];\n  reorder -> winner [label=\"no, need combined values\"];\n  winner -> intent -> noise;\n  noise -> clean [label=\"yes\"];\n  noise -> refs [label=\"no\"];\n  clean -> refs;\n  refs -> referenced [label=\"yes\"];\n  refs -> esl [label=\"no\"];\n  referenced -> esl;\n  esl -> reversible;\n  reversible -> fix_shape [label=\"no\"];\n  reversible -> verify [label=\"yes\"];\n  fix_shape -> verify -> pass;\n  \u002F\u002F Contract 0.23 pending saves use xedit_flush; restart alone is not proof.\n  verify [label=\"Save + inspect pending state; xedit_flush if needed; fresh readback\"];\n}\n```\n\n> **Deferred-save correction:** The diagram's historical `Save + restart +\n> readback` node is superseded. If `session.save` reports a nonzero\n> `savePendingShutdownCount`, inspect `xedit_dirty`, then use `xedit_flush` on a\n> contract-0.23 daemon. The tool validates the drain response and confirms the\n> daemon's promised self-exit. A `partial` or unknown `lastFlush` is not durability\n> proof. Normal stop\u002Frestart remains refused while a live pending queue exists;\n> `force:true` abandons state and is never evidence of durability.\n\n### Authoring checks\n\n- **Forward the winner.** The game reads the final\u002Fwinning override for a\n  FormID. Build the patch from the current winner, then forward only the older\n  mod values that still need to survive.\n- **No unchanged cargo.** If a copied value does not change meaning, it is\n  ITM-style noise, not compatibility. Remove it unless you can state why it is\n  intentionally carried.\n- **Patch as separate layer.** Do not drag values directly into the source mod\n  just because it is the rightmost column today. A patch should be reversible by\n  disabling\u002Fremoving the patch layer, not by hand-deleting fields from someone\n  else's plugin.\n- **Preserve references.** If deletion or mark-delete enters the plan, stop and\n  run the referenced-by\u002Freadback path first. Unknown references mean unknown\n  blast radius.\n- **Choose plugin form deliberately.** Ordinary compatibility patches usually\n  want normal ESP sort freedom plus ESL flagging when safe. Native ESL\u002FESM\n  load-order behavior is not a free cleanliness upgrade.\n- **Good patch vs band-aid patch.** A good patch has named intent per forwarded\n  value and reduces conflict debt. A band-aid patch copies whole records, edits\n  source mods, or tries to stitch every FormID because sorting was treated as\n  irrelevant.\n\n### KB query discipline\n\nThis judgment section is game-agnostic. Query KB for game-specific patching\ngotchas, record-family caveats, and current toolchain facts rather than\nfossilizing them here.\n\n```text\nbgs_kb_query({ query: \"xedit patch authoring gotchas\", domains: [\"xedit\", \"load-order\"], games: [\"\u003Ccurrent game>\"] })\n```\n\nIf KB is silent, mark `[GAP]` and keep the patching rule at the framework level\ninstead of inventing a game-specific doctrine.\n\n### Red Flags (STOP)\n\n| Thought | Reality |\n|---|---|\n| \"It's red, so copy the left value.\" | Red is a prompt to inspect. It is not a verdict that the losing value should survive. |\n| \"The rightmost mod is wrong; I'll edit it directly.\" | Then you made the source mod the patch. Use a separate override patch so reversal is clean. |\n| \"Sorting does not matter because xEdit can patch anything.\" | In principle, yes; across hundreds of thousands of FormIDs, no. Use ordering to reduce repair debt, then patch the meaningful remainder. |\n| \"Green\u002Funchanged copied values are harmless.\" | They are no-intent cargo. If they do not change meaning, remove them. |\n| \"Native ESL is cleaner than ESP flagged ESL.\" | Native ESL\u002FESM can cost normal sort freedom. Use ESP flagged ESL when that is the safe patch shape. |\n| \"This looks unused; delete it.\" | Referenced-by first. Deletion without reference knowledge is unknown blast radius. |\n\n### Rationalizations\n\n| Excuse | Reality |\n|---|---|\n| \"I'll just drag one field into the winning plugin.\" | One field is still a source-mod edit. Make a patch layer, or future-you hand-removes stray fields one by one. |\n| \"The patch should preserve everything any mod touched.\" | Preserve intent, not history. Some edits are core to the mod; some are incidental author preference that should lose to a systemic rule. |\n| \"I do not know what this field does, so I'll copy the version that looks plausible.\" | Unknown field meaning is a research task, not a dice roll. Read the record structure, CK\u002Fwiki\u002Fcommunity examples, and actual in-pack behavior. |\n| \"Overwrite is fine; MO2 sees it.\" | Overwrite is spill. A real patch belongs in a managed mod layer with a name future-you can understand. |\n| \"The response said ok; the patch is done.\" | Patch acceptance is winning-override readback after save\u002Frestart, with the intended values visible and no unintended cargo. |\n\n## R6 progressive-disclosure capability checks\n\nDo not assume every daemon is r6. Read `xedit_list_capabilities` once and branch\non the support keys below. On pre-r6 daemons, fall back to the older explicit\nrecord-list \u002F child-walk \u002F per-record loop patterns; on r6+ daemons, use the\none-call or page-aware form to reduce round-trips and preserve context.\n\n| Capability key | Contract | Prefer this pattern | KB record |\n|---|---:|---|---|\n| `supports.childGroupNavigation` | 0.13 | Navigate CELL\u002FWRLD\u002FDIAL\u002FQUST ChildGroups through `elements.children` stubs | `xedit.childgroup-navigation.v1` |\n| `supports.createParentSpec` | 0.16 \u002F 0.18 | Create records directly under parent ChildGroups with `records.create` `parent` | `xedit.records-create-parent-spec.v1` |\n| `supports.elementsChildrenPagination` | 0.17 | Page `elements.children` with `limit` \u002F `offset` | `xedit.elements-children-pagination.v1` |\n| `supports.reverseNavigation` | 0.19 | Add `includeParents:true` and read `relations.parents` | `xedit.reverse-navigation.v1` |\n\nFor the whole r6 contract delta, query KB record `xedit.r6-contract-summary.v1`.\n\n### ChildGroup navigation (`supports.childGroupNavigation`)\n\nOn r6+ daemons, `elements.children` on CELL, WRLD, DIAL, and QUST records\nreturns a virtual child entry with `kind: \"child_group\"`. Treat that entry as a\nread-only navigation stub, not as a real mutable element.\n\nUse it one generation at a time:\n\n```text\nelements.children({ file, formId, path: \"\\\\Child Group\" })\nelements.children({ file, formId, path: \"\\\\Child Group\\\\Persistent\" })\nelements.children({ file, formId, path: \"\\\\Child Group\\\\Temporary\" })\nelements.children({ file, formId, path: \"\\\\Child Group\\\\Visible when Distant\" })\nelements.children({ file, formId, path: \"\\\\Child Group\\\\Block X, Y\" })\nelements.children({ file, formId, path: \"\\\\Child Group\\\\Block X, Y\\\\Sub-Block M, N\" })\n```\n\n- Walk exactly the next level; do not ask for the whole tree when a page or one\n  ChildGroup label is enough.\n- The `\\\\Child Group...` paths are synthetic and READ-ONLY. Mutation verbs must\n  use flat FormID locators (`{ file, formId }`) or a `records.create.parent`\n  spec; do not pass synthetic locator paths to mutators.\n- For WRLD cells, use `Persistent` or the Block\u002FSub-Block\u002Fcoordinate route\n  depending on the target child group.\n- Deep reference: `xedit.childgroup-navigation.v1`.\n\n### `elements.children` pagination (`supports.elementsChildrenPagination`)\n\nOn r6+ daemons, `elements.children` accepts `limit` and `offset`:\n\n```text\nelements.children({ file, formId, path, limit: 200, offset: 0 })\n```\n\n- `limit` is clamped to 1-1000 and defaults to 200.\n- Responses include `count`, `total`, `offset`, and `truncated`.\n- If `truncated` is true, keep the same `limit`, add `count` to `offset`, and\n  fetch the next page until covered.\n- Do not assume CELL child groups are small: FO4 vanilla CELL `00000025`\n  `Temporary` contains 742 records.\n- Deep reference: `xedit.elements-children-pagination.v1`.\n\n### Reverse navigation (`supports.reverseNavigation`)\n\nOn r6+ daemons, add `includeParents: true` when you need to know ownership or\ncontainment without a second verb. Supported read calls include:\n\n- `records.get`\n- `records.find_by_form_id` \u002F `records.find_by_editor_id` and MCP wrappers such\n  as `xedit_find_record`\n- `records.master_or_self`\n- `records.winning_override`\n- `elements.get`\n- `elements.children`\n\nThe response may include:\n\n```text\nrelations.parents: [{ locator, object }, ...]\n```\n\nParents are nearest-first with a daemon depth cap of 16. This is the preferred\nanswer to \"which CELL owns this REFR?\" or \"which QUST\u002FDIAL group contains this\nchild?\" Use the parent chain as readback evidence; do not build a custom\nreverse-index loop unless the support key is absent. Deep reference:\n`xedit.reverse-navigation.v1`.\n\n### `records.create` parent-spec (`supports.createParentSpec`)\n\nMutating record creation into ChildGroups is r6-gated and still requires the\nnormal MCP mutation consent path. When supported, author the target parent\nexplicitly instead of trying to mutate synthetic `\\\\Child Group` paths.\n\nCELL, DIAL, and QUST children:\n\n```text\nrecords.create({\n  targetFile,\n  signature,\n  editorId,\n  parent: { file, formId, subGroup? }\n})\n```\n\nWRLD children:\n\n```text\nrecords.create({\n  targetFile,\n  signature,\n  editorId,\n  parent: { file, formId, subGroup: \"Persistent\" }\n})\n\nrecords.create({\n  targetFile,\n  signature,\n  editorId,\n  parent: { file, formId, coords: [X, Y] }\n})\n```\n\nFor `coords`, native xEdit creates the needed Block\u002FSub-Block groups. Validate\nwith `records.get` or `elements.children({ includeParents: true })` after the\npreview\u002Fcommit flow, then inspect `xedit_dirty` for `pendingShutdownSave` after\nthe save. A pending-shutdown result blocks normal lifecycle operations; do not\nuse a restart as a durability shortcut. Deep reference:\n`xedit.records-create-parent-spec.v1`.\n\n## Anti-patterns (hard bans)\n\nNever do any of the following. Each ban is encoded as an MCP rule or daemon-side refusal, but the skill states them so the agent does not even attempt:\n\n1. **Do not write Python (or any other language) to parse `.esp\u002F.esm\u002F.esl` files directly.** The daemon is the only correct path. If you find yourself reaching for a binary plugin parser, stop and use `xedit_call` instead.\n2. **Do not treat restart as a durability mechanism.** `session.save` reports `savedFilesPendingShutdown` and `savePendingShutdownCount` when xEdit queued a shutdown-time write. Contract 0.23 adds authoritative pending readback and `session.flush`; use the lifecycle-owned `xedit_flush`, not `xedit_call`, then perform fresh-daemon readback. `force:true` on stop\u002Frestart is explicit abandonment, not persistence proof.\n3. **Do not call mutating ops in mcp-mode without going through the MCP.** Direct pipe writes will be refused by the daemon with `mcp_mode_required`.\n4. **Do not page `system.capabilities` every session.** The digest in `xedit_list_capabilities` already carries the curated map; only call live capabilities once to check drift.\n5. **Do not delete or mark-deleted a record that is referenced by other plugins** without first calling `xedit_call records.referenced_by` and accepting the consequences. Snapshot does not cleanly recover deletions.\n\n## Enabling consent (`-IKnowWhatImDoing`)\n\nMutating intent tools (`xedit_create_child_record`, `xedit_call records.create`,\n`xedit_call records.delete`, `xedit_call records.copy_into`, etc.) require the\nxEdit daemon to be launched in consent mode — otherwise they fast-fail with\n`code: \"mutation_requires_iknowwhatimdoing\"` BEFORE the daemon is contacted.\n\nEnable consent at launch time via the MCP arg:\n\n```\nxedit_start({ iKnowWhatImDoing: true, ...other overrides })\nxedit_restart({ iKnowWhatImDoing: true, ...other overrides })  # if already running\n```\n\nThe flag is forwarded as `--i-know-what-im-doing 1` to `xedit-client.ps1`, which\nappends `-IKnowWhatImDoing` to xEdit's startup argv. Verify post-launch:\n\n```\nxedit_session()  # data.consentEnabled === true ?\n```\n\nIf `consentEnabled` is still `false` after passing `iKnowWhatImDoing: true`,\nthe flag did not propagate — check that the MCP is on a build that includes\nthe consent forwarding (commit `xxx` and later; see `RELEASE-NOTES.md`).\n\nConsent is per-launch and explicit only: there is no env-var fallback, no\nruntime toggle, and the audit log captures the consent decision at the call\nsite. To revoke consent, call `xedit_stop` then `xedit_start` without the flag.\n\n## Confidence + dry-run discipline (borrowed from skyrimvr-claude-toolkit)\n\nBefore any mutating action:\n\n1. State your confidence (0-100%) and your top 3 assumptions.\n2. If confidence \u003C 90%, investigate first (read records, inspect conflicts, list references) until ≥ 90%.\n3. For HIGH-RISK mutations, the MCP will return a preview envelope with `confirmToken`. Read the preview, decide, then commit with the token. Treat the preview as the contract.\n\n## Sub-agent delegation recipes (role-agnostic)\n\nWhen delegating, do not hard-code role names — the harness will map them. Use these recipes:\n\n**Read-only investigator** — for exploratory storms, conflict surveys, and \"what's in this plugin\" reconnaissance:\n\n> Dispatch a read-only investigator sub-agent with this skill loaded. Provide the question, the target files, and the budget (token \u002F time \u002F step count). The sub-agent should return a distilled summary (verdict + key evidence + open questions), not the raw daemon round-trips.\n\n**Bounded mutation worker** — for well-defined batch edits (Batch 4+):\n\n> Dispatch a bounded-execution sub-agent with this skill and the patch-authoring skill loaded. Provide the spec, the snapshot expectations, and the acceptance checks. The sub-agent should perform the mutations through the MCP and return the snapshot IDs + readback proof.\n\n## Self-growing knowledgebase\n\nAfter any session that produced a footgun (an unexpected refusal, a non-obvious recovery, a surprising daemon behavior):\n\n1. Identify whether the gotcha is a durable fact, not project-internal noise. Project-local lessons that do not belong in the public KB go in the project devlog instead.\n2. Author a KB record at `\u003Cpack-root>\u002Frecords\u002F\u003Cdomain>\u002F\u003Cslug>.v1.md` with YAML frontmatter that validates against `knowledge\u002Fbgs-kb\u002Fschema\u002Frecord.schema.json`.\n3. Pick the pack deliberately: cross-game \u002F cross-tool facts go under `knowledge\u002Fbgs-kb\u002Fpacks\u002Fcore\u002Frecords\u002F`; game-specific facts go into the matching per-game pack (`bgs-kb-skyrim`, `bgs-kb-fallout4`, `bgs-kb-fallout3-fnv`, `bgs-kb-starfield`).\n4. Run `node tools\u002Fbgs-kb-mcp\u002Fdist\u002Fcli.js validate \u003Cpack-root>` and then `node tools\u002Fbgs-kb-mcp\u002Fdist\u002Fcli.js build \u003Cpack-root>` to refresh that pack, unless the current phase explicitly forbids rebuilds and gives a narrower validation path.\n5. Verify retrieval from a fresh MCP connection with `bgs_kb_query` and confirm the new record appears for a query a future agent would actually use.\n6. If the footgun is mechanically detectable, mark the KB record as a rule candidate when the schema supports it and track the reserved rule ID in a planning doc. Candidates require human review before promotion into `tools\u002Fxedit-mcp` enforcement.\n\nWorked example:\n\n1. Gotcha: xEdit daemon responses may include `0x`-prefixed FormIDs, while the MCP normalizes them at the edge.\n2. Pack\u002Fpath: `knowledge\u002Fbgs-kb\u002Fpacks\u002Fcore\u002Frecords\u002Fxedit\u002Fformid-prefix-normalization.v1.md`.\n3. Validate\u002Fbuild: `node tools\u002Fbgs-kb-mcp\u002Fdist\u002Fcli.js validate knowledge\u002Fbgs-kb\u002Fpacks\u002Fcore` then `node tools\u002Fbgs-kb-mcp\u002Fdist\u002Fcli.js build knowledge\u002Fbgs-kb\u002Fpacks\u002Fcore`.\n4. Verify: query `bgs_kb_query({ query: \"0x FormID normalization\", domains: [\"xedit\"] })` and confirm the record is returned.\n\n## When this skill applies\n\n- Any task involving Bethesda plugin files (`.esp\u002F.esm\u002F.esl`) for FO4, Skyrim, FO76, Starfield in this repo's MO2 harness.\n- Any conflict \u002F patching \u002F cleaning \u002F ESL \u002F scripting task against xEdit.\n- Whenever the task description names xEdit, plugin records, FormIDs, masters, conflicts, ITM\u002FUDR, ESL flagging, or Pascal Edit Scripts.\n\nWhen in doubt, load it.\n\n## Sibling skills\n\n- **`writing-bgs-load-order`** — authoritative reference for editing\n  `plugins.txt` \u002F `loadorder.txt`. Use it whenever the task is about\n  activating, deactivating, reordering, adding, or removing plugins from the\n  load order. Do NOT edit `plugins.txt` blindly; xEdit can not change load\n  order itself (docs 2.3), so the file edit is the only path for those\n  operations, and the asterisk-format rules + official-master detection rules\n  are non-obvious.\n- **`setting-up-bgs-modding-environment`** — first-run setup including the\n  MO2 `gamePath` inspection step you must do before launching xEdit with the\n  `dataPath` override.\n\n## Launching xEdit with explicit args (NEW)\n\nThe `xedit_start` MCP tool accepts optional overrides:\n\n```\nxedit_start({\n  launcherPath?: string,    \u002F\u002F xEdit.exe path\n  gameMode?: string,        \u002F\u002F \"Fallout4\", \"SkyrimSE\", etc.\n  dataPath?: string,        \u002F\u002F -D: flag; MO2 \u003CgamePath>\\\\Data\n  pluginsFile?: string,     \u002F\u002F -P: flag; agent-authored plugins.txt\n  moProfile?: string,       \u002F\u002F MO2 profile name; defaults to env\n  starfieldRedPill?: boolean, \u002F\u002F Starfield save-unlock trio; defaults true\n})\n```\n\n**Always pass `dataPath`** when the user wants xEdit to see the MO2-managed\ngame tree. Without it, xEdit falls back to the Windows registry, which\nreturns the raw Steam install path — and your conflict audit will be against\nthe wrong game data. Read MO2's `ModOrganizer.ini` `gamePath` value, append\n`\\\\Data`, and pass that.\n\nFor load-order experimentation (test a subset of plugins to isolate a\nconflict, or rehearse a sort), generate a plugins.txt under an\n**agent-owned artifacts path** per `writing-bgs-load-order` and pass it as\n`pluginsFile`.\n\n## Starfield save unlock (RedPill switches)\n\nSymptom: SF1Edit refuses to save Starfield small\u002Fmedium\u002Flocalized ESMs with an\nerror like `Medium flagged files can't be saved in SF1Edit`.\n\nUpstream xEdit 4.1.5k added the required switch trio:\n`-ItJustWorksTM -ThisIsFine -GiveMeTheRedPill`. This plugin's launcher passes\nall three by **default** for `gameMode: \"Starfield\"` sessions. Opt out only when\nyou are intentionally testing vanilla SF1 save gates:\n\n```\nxedit_start({ gameMode: \"Starfield\", starfieldRedPill: false })\n```\n\nSide effects when RedPill is on:\n\n- The xEdit window title shows `ItJustWorks[TM] Edition`; this is ceremonial,\n  not a bug.\n- `files.create` no longer auto-adds `Starfield.esm` as a master. Call\n  `files.create({ ..., initialMasters: [\"Starfield.esm\"] })` or follow with\n  `files.add_required_masters` when the new file needs the base master.\n\n## Dirty-state and relaunch control (NEW)\n\nThe daemon exposes `session.get_dirty_state`. Contract 0.23 includes\n`pendingShutdownFiles` and `pendingShutdownCount`; the MCP treats a complete\nreadback as authoritative and retains local `session.save` observations as a\nfail-closed fallback for older daemons or failed probes. Neither source is\ncleared by `dirty:false`: xEdit marks queued saves clean before their physical\nwrite is durable. The MCP exposes these lifecycle helpers:\n\n- `xedit_dirty({})` — returns `{ dirty, dirtyFiles, unsavedChangeCount,\n  pendingShutdownSave }` when ready. File-summary objects are normalized to\n  plugin names. This is the safe thing to call before any lifecycle action.\n- `xedit_flush({ force?: true })` — contract-0.23 pending-rename drain. It is\n  consent-gated, refuses unsaved dirty files unless `force:true`, validates\n  `flushedFiles` \u002F `pendingRemaining`, waits for the managed PID to exit, and\n  reports `completed`, `partial`, or an unknown result. `session.flush` is\n  lifecycle-owned and deliberately refused through `xedit_call`. A failed\n  in-band rename remains queued for one final normal exit-time retry. Start a\n  fresh daemon and read the plugin back before deciding whether a partial result\n  became durable.\n- `xedit_stop({ force?: true })` — if the session is dirty or the MCP has a\n  pending-shutdown save and `force` is not set, refuses with `code:\n  \"dirty_state\"` or `\"pending_save\"` respectively. `force:true` remains an\n  explicit abandonment and returns an auditable risk record. If the dirty-state\n  probe itself fails, normal lifecycle action refuses with\n  `dirty_state_unavailable`; retry `xedit_dirty` instead of guessing.\n- `xedit_restart({ launcherPath?, gameMode?, dataPath?, pluginsFile?, moProfile?, force?: true })`\n  — same pending-save and dirty-state safety as stop, then relaunches\n  asynchronously with new overrides only when the lifecycle boundary is safe.\n\nUse `xedit_restart` only when you need to reboot xEdit with a different custom\n`pluginsFile` or `dataPath` and `pendingShutdownSave.count` is zero. For a\ndeferred save, call `xedit_flush`, require `completed` with zero remaining, then\nlaunch a fresh daemon and read the plugin back. If `lastFlush` is `partial` or\nhas `outcome: unknown`, surface the residue rather than claiming durability.\nOnce a fresh daemon is ready, that old summary appears as\n`previousSessionFlush` with the originating PID and timestamp; use fresh plugin\nreadback to close it.\n\nIf `xedit_flush` reports that the drain response arrived but daemon exit was not\nconfirmed, do not force-stop immediately. The daemon may still be running its\nnormal close path and final rename retry. Wait briefly and call `xedit_health`;\nthe health tool rechecks the managed PID and clears the retained failed state\nonly after delayed exit is confirmed.\n",{"name":5,"description":7},"main","b0f0a87593c578a7898eccaf1b363f7f87c1f99b","plugins\u002FBB-84C\u002Fbgs-modding-superpowers\u002Fskills\u002Fxedit-automation",491,"https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins","https:\u002F\u002Fhol.org\u002Fplugins\u002Fbest-codex-plugins","https:\u002F\u002Fgithub.com\u002Fhashgraph-online","https:\u002F\u002Fhol.org","Open-source standards and developer tools for interoperable AI agents: discovery, identity, communication, payments, privacy and security.","2026-11-14 14:06:13",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add hashgraph-online\u002Fawesome-codex-plugins --skill xedit-automation",{"tool":60,"command":61},"bunx","bunx skills add hashgraph-online\u002Fawesome-codex-plugins --skill xedit-automation",{"tool":63,"command":64},"pnpm","pnpm dlx skills add hashgraph-online\u002Fawesome-codex-plugins --skill xedit-automation","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002FBB-84C\u002Fbgs-modding-superpowers\u002Fskills\u002Fxedit-automation\u002FSKILL.md",true,[68],{"path":69,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":72,"sourceHtmlUrl":73},"xedit-knowledgebase.md","REFERENCE","参考文档",1524,"https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002FBB-84C\u002Fbgs-modding-superpowers\u002Fskills\u002Fxedit-automation\u002Fxedit-knowledgebase.md",[75,85,93,101,109,117],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":79,"licenseFileUrl":80,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":84},"01M7DV332YQMGD8WTRJ9DZQXTB","worktable-review-with-annotations","Create, inspect, reply to, update, or resolve situated Worktable annotations. Use when feedback belongs to a Doc section, block, text range, or HTML Doc, or when the user asks to address existing review feedback and coordinate a requested artifact edit.","MIT","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-review-with-annotations\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-review-with-annotations\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":79,"licenseFileUrl":89,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":84},"01M7DV2YGHCZVBEB1AHYB6CGHE","worktable-find-and-synthesize-context","Find, assess, and synthesize context from Worktable Docs and Records. Use when the user asks what a workspace contains, wants workspace-backed research, needs current facts reconciled across artifacts, or requests a cited synthesis without changing workspace state.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-find-and-synthesize-context\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-find-and-synthesize-context\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":79,"licenseFileUrl":97,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":84},"01M7DV2TQN1H11ME2SAF9MXN7V","worktable-create-or-update-docs","Create, edit, rename, or maintain narrative Worktable Docs. Use for plans, decisions, briefs, notes, research syntheses, and other durable prose when the user requests a new artifact or a safe update to an existing one.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-update-docs\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-update-docs\u002FSKILL.md",[],[],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":79,"licenseFileUrl":105,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":84},"01M7DV2NE452NEA8TXATKSNAJH","worktable-create-or-manage-records","Organize repeated structured information as durable Worktable Records. Use for research datasets, inventories, directories, pipelines, trackers, and other collections whose items need identity, fields, filtering, links, validation, or individual updates.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-manage-records\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-manage-records\u002FSKILL.md",[],[],{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":79,"licenseFileUrl":113,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":84},"01M7DV2HENRBR2KSCVM064WH0Y","worktable-create-or-manage-interactive-html","Create or improve durable visual and interactive artifacts in Worktable. Use for dashboards, trackers, calculators, mini apps, slide presentations, and other requests that benefit from a polished HTML Doc.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-manage-interactive-html\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-create-or-manage-interactive-html\u002FSKILL.md",[],[],{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":79,"licenseFileUrl":121,"sourceHtmlUrl":122,"categories":123,"keywords":124,"publishedAt":84},"01M7DV2CADR5R7RQFFYPNAGR9Y","worktable-collaborate-threads","Read, answer, and hand off messages through durable Worktable threads with users or other authenticated participants. Use when the user asks to check addressed messages, reply to a participant, continue a thread, request another agent's help, wait briefly for a response, or watch for comments and messages sent to the agent.","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-collaborate-threads\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fhashgraph-online\u002Fawesome-codex-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Fworktable\u002Fworktable-plugin\u002Fskills\u002Fworktable-collaborate-threads\u002FSKILL.md",[],[]]