Write error divergence

From PlamenTSV/plamen · View interactive version

Write error divergence is an AI agent skill from the GitHub repository PlamenTSV/plamen. L1 trigger - audits file/database write paths for metadata commits, cache updates, and success returns that diverge when writes fail.

How to use this skill

Skill file

Injectable Skill: Write Error Divergence

L1 trigger: STORAGE or DATABASE_TX flag OR file/DB write APIs detected (write_all, fs::write, rename, flush, commit, put, insert, batch, transaction)

Inject Into: depth-state-trace, depth-edge-case

Language: Go and Rust

Finding prefix: [WED-N]

Purpose

Node clients often pair durable writes with in-memory metadata, indexes, caches, or database transactions. If metadata advances before the durable write succeeds, restart or reorg behavior can diverge from the actual persisted state.

1. Write Unit Enumeration

For each storage path, enumerate the logical write unit:

| Write Unit | Data Write | Metadata/Index Update | Error Check | Rollback/Cleanup | Verdict |

|------------|------------|-----------------------|-------------|------------------|---------|

Include:

2. Required Checks

For each write unit:

Tag evidence as [WED-METADATA-BEFORE-DATA:{file}:{line}], [WED-COMMIT-BEFORE-CHECK:{file}:{line}], [WED-SUCCESS-BEFORE-WRITE:{file}:{line}], or [WED-RESTART-DIVERGE:{file}:{line}].

3. Non-Finding Rules

Do not report internal best-practice issues unless a failed write can produce stale reads, corrupted state, replay, permanent data loss, fork-choice divergence, or a liveness failure after restart.

4. Output

Use normal finding format. If no finding exists, still emit the write-unit table with file:line evidence for each safe rollback or commit path.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.