edit-tool-compat-guard
Skill2 starsChanged 7 months agoMITView on GitHub
Guard edit tool usage on OpenClaw runtimes affected by edit wrapper validation drift; enforce canonical XOR payload rules, version-aware fallback, and retirement when upstream/runtime fix is present. Use when a task may call edit, mutate files, or recover from edit tool validation/mode-conflict errors.
In this repository47 other files it gives its agents.
- brainstormingSkill
- claude-code-termux-runbookSkill
- cli-patcherSkill
- code-review-workflowSkill
- commit-commandsSkill
- consulting-analysisSkill
- context7-cleanSkill
- data-analysisSkill
- deep-researchSkill
- env-managerSkill
- executing-plansSkill
- feature-devSkill
- firecrawlSkill
- frontend-designSkill
- gateway-device-pairingSkill
- githubSkill
- glibc-prebuilt-bundleSkill
- gogSkill
- image-generationSkill
- memory-setupSkill
- module-auditorSkill
- module-scaffoldSkill
- openclaw-config-guardianSkill
- openclaw-ollama-runtime-kbSkill
- plugin-cutover-guardianSkill
- plugin-runtime-guardianSkill
- python-env-managerSkill
- self-improving-agentSkill
- simplify-and-hardenSkill
- skill-benchSkill
- skill-creatorSkill
- skill-unificationSkill
- skill-vetterSkill
- socratic-groundingSkill
- subagent-orchestrationSkill
- systematic-debuggingSkill
- tailscale-oauth-bridgeSkill
- termux-packagerSkill
- termux-runnerSkill
- test-driven-developmentSkill
- vercel-deploy-claimableSkill
- verification-before-completionSkill
- video-generationSkill
- workspace-cleanupSkill
- writing-plansSkill
- yt-dlp-ingest-firstSkill
- zero-downtime-cutoverSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
20 rules. About 0 are common, 15 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈15
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 59
No file mutation is needed.
- Very specific: line 63
If runtime behavior is uncertain and the change is important, prefer read + write over speculative edit retries.
- Distinctive: line 64
If verification cannot prove the runtime fix, keep this guard active.
- Distinctive: line 67
Check whether the task intends single replacement mode or multi-edit mode.
- Very specific: line 71
Never mix edits[] with top-level oldText/newText in one request.
- Very specific: line 72
Prefer canonical fields (path, oldText, newText, edits) even if aliases may be accepted.
- Distinctive: line 73
If the runtime is in the affected-version window or not yet verified fixed:
- Very specific: line 75
if validation drifts or retries would require mixed semantics, switch to read + write
- Very specific: line 76
If edit returns a validation/mode error:
- Distinctive: line 78
do not keep retrying the same malformed shape
- Distinctive: line 80
When a runtime upgrade claims to fix this area, verify with a minimal repro before retiring the skill.
- Distinctive: line 81
If the repro proves the fix, mark the skill for removal/retirement rather than leaving a stale workaround in the routing pool.
- Distinctive: line 85
Treat as wrapper/runtime validation drift.
- Distinctive: line 88
Treat as a semantic payload bug.
- Distinctive: line 89
Remove mixed-mode fields; do not append more aliases.
- Distinctive: line 92
Do not rely on alias spellings to rescue a malformed semantic payload.
- Distinctive: line 95
if PASS on clean canonical single and clean canonical multi without workaround, retire the skill.
- Distinctive: line 101
if fallback was used, why
- Distinctive: line 104
no mixed semantic payload
- Distinctive: line 118
No recent runtime/session evidence shows the old wrapper error pattern.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Edit Tool Compat Guard
Indexed Reference Map
- @[SKILL.md#L1-L116] Frontmatter, scope, trigger rules, SOP, retirement contract.
- @[references/INDEX.md#L1-L17] Reading order and document inventory.
- @[references/QUICK_REFERENCE.md#L1-L34] Fast decision checklist and do/don't rules.
- @[references/CORE_API.md#L1-L57] Runtime contract, affected-version gating, and fallback policy.
- @[references/PATTERNS.md#L1-L43] Canonical payload patterns, retry discipline, and escalation rules.
- @[references/EXAMPLES.md#L1-L49] Good/bad payload examples and reporting examples.
- @[references/AI_WORKFLOW.md#L1-L17] Operational sequence for future models.
- @[references/RETIREMENT_CHECKLIST.md#L1-L16] Short gate for removing/deactivating the skill after runtime fix verification.
Scope
- In-scope:
- Guarding
edittool usage when runtime wrapper behavior may diverge from core tool contract. - Preventing mixed semantic payloads (
edits[]plus top-leveloldText/newText). - Choosing fallback to
read+writewheneditreliability is uncertain. - Version-aware retirement when the runtime/upstream fix is verified.
- Guarding
- Out-of-scope:
- Changing the core edit contract.
- Silently hiding invalid payloads that should fail.
- Permanent workarounds after the runtime has a verified upstream fix.
KB Mode Notes
- Reading order:
references/INDEX.mdreferences/QUICK_REFERENCE.mdreferences/CORE_API.mdreferences/PATTERNS.mdreferences/EXAMPLES.mdreferences/AI_WORKFLOW.mdreferences/RETIREMENT_CHECKLIST.md
- Coverage Matrix:
- version gate / retirement ->
references/CORE_API.md - canonical payload rules ->
references/PATTERNS.md - examples ->
references/EXAMPLES.md - execution sequence ->
references/AI_WORKFLOW.md - retirement decision gate ->
references/RETIREMENT_CHECKLIST.md
- version gate / retirement ->
- Portability note:
- Version markers in this skill are local operational gates for the current OpenClaw workspace; verify actual upstream/runtime behavior before porting to another host.
Trigger Rules
- Positive:
- A task may invoke
edit. - The user asks to fix a file with exact replacement or multiple disjoint replacements.
- There is evidence of
editvalidation errors, mode-conflict errors, alias drift, or uncertain wrapper/runtime behavior.
- A task may invoke
- Negative:
- No file mutation is needed.
- The task uses only
reador onlywritewith full replacement and there is noedituncertainty. - The runtime has already been verified to contain the upstream fix and the local retirement condition is satisfied.
- Escalation:
- If runtime behavior is uncertain and the change is important, prefer
read+writeover speculativeeditretries. - If verification cannot prove the runtime fix, keep this guard active.
- If runtime behavior is uncertain and the change is important, prefer
SOP
- Check whether the task intends single replacement mode or multi-edit mode.
- Normalize the plan to the core XOR contract:
- single replacement:
path+oldText+newText - multi-edit:
path+edits[]
- single replacement:
- Never mix
edits[]with top-leveloldText/newTextin one request. - Prefer canonical fields (
path,oldText,newText,edits) even if aliases may be accepted. - If the runtime is in the affected-version window or not yet verified fixed:
- issue at most one clean
editattempt - if validation drifts or retries would require mixed semantics, switch to
read+write
- issue at most one clean
- If
editreturns a validation/mode error:- identify whether the first failure is wrapper validation or core validation
- do not keep retrying the same malformed shape
- either send one corrected canonical payload or fall back to
read+write
- When a runtime upgrade claims to fix this area, verify with a minimal repro before retiring the skill.
- If the repro proves the fix, mark the skill for removal/retirement rather than leaving a stale workaround in the routing pool.
Error Handling
Missing required parameters: oldText alias, newText aliasonedits[]-only:- Treat as wrapper/runtime validation drift.
- Retry once with a clean canonical payload only if the original payload was malformed; otherwise use
read+writeor verify runtime fix state.
Use either edits or single replacement mode, not both.:- Treat as a semantic payload bug.
- Remove mixed-mode fields; do not append more aliases.
- Alias uncertainty:
- Prefer canonical fields.
- Do not rely on alias spellings to rescue a malformed semantic payload.
- Runtime upgraded:
- run minimal repro
- if PASS on clean canonical single and clean canonical multi without workaround, retire the skill.
Output Contract
- Artifact:
- chosen mutation mode (
single-edit|multi-edit|fallback-read-write) - whether runtime is
affected | verified-fixed | unknown - if fallback was used, why
- chosen mutation mode (
- Validation:
- request shape matches core XOR contract
- no mixed semantic payload
- retirement decision tied to actual repro evidence
- Compliance Verdict:
PASSwhen the chosen workflow respects XOR contract and version gatePARTIALwhen fallback was needed due to runtime uncertaintyFAILwhen mixed semantics or repeated malformed retries were used
Retirement Condition
Retire/remove this skill when all of the following are true:
- The active OpenClaw runtime version includes a verified upstream fix for edit wrapper validation drift.
- Minimal repro passes for:
- canonical single replacement
- canonical
edits[]multi-edit without local workaround logic.
- No recent runtime/session evidence shows the old wrapper error pattern.
- A maintainer explicitly removes or deactivates the skill after verification.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

