Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add divinevideo/divine-mobile --skill nostr-replaceable-event-mutation-overwritegit clone --depth 1 https://github.com/divinevideo/divine-mobileWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/divinevideo/divine-mobile/nostr-replaceable-event-mutation-overwrite)<a href="https://agentmods.dev/skills/divinevideo/divine-mobile/nostr-replaceable-event-mutation-overwrite"><img src="https://agentmods.dev/badge/skills/divinevideo/divine-mobile/nostr-replaceable-event-mutation-overwrite.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00172 | $0.01829 |
| Opus 5 | $0.00086 | $0.00915 |
| Sonnet 5 | $0.00034 | $0.00366 |
| Haiku 4.5 | $0.00017 | $0.00183 |
Grade A, and why
nostr-replaceable-event-mutation-overwrite scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 183 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Nostr Replaceable Event Mutation Overwrite
Problem
Nostr replaceable events (Kind 0, 3, 10002, etc.) use a full-replace model: publishing a new event completely replaces the previous one. If a client publishes a mutation based on stale, incomplete, or null cached state, it silently overwrites the canonical version on relays, causing data loss. The most common case is follow list (Kind 3) wipes when a user follows someone before the client has loaded their existing contact list.
Context / Trigger Conditions
- User reports "I followed someone and lost all my other follows"
- Follow/unfollow action on a fresh browser session or mobile login
- Profile update loses existing metadata fields
- Relay list update drops existing relays
- Any mutation on a replaceable event where the UI passes cached state to the mutation function
- React Query / TanStack Query
dataisundefinedwhen mutation fires (query still loading) - The mutation function accepts the current event as a parameter from the UI layer
Solution
1. Always Fetch Fresh State Inside the Mutation
Never rely solely on the UI's cached/query state. Fetch the latest version of the replaceable event directly from the relay inside the mutation function, before publishing:
// BAD: Relies on UI cache which may be null/stale
mutationFn: async ({ targetPubkey, currentContactList }) => {
const currentTags = currentContactList?.tags || []; // null -> [] -> data loss!
// ... publish with only the new follow
}
// GOOD: Fetches fresh from relay before mutating
mutationFn: async ({ targetPubkey, currentContactList }) => {
let bestContactList = currentContactList;
try {
const relayEvents = await nostr.query([
{ kinds: [3], authors: [userPubkey], limit: 1 },
], { signal: AbortSignal.timeout(5000) });
const relayContactList = relayEvents
.sort((a, b) => b.created_at - a.created_at)[0] || null;
if (relayContactList) {
// NIP-01 already fixes which copy of a replaceable event wins:
// the higher created_at, and on an exact tie the lower event id.
// Never compare tag counts — a shorter list is what a legitimate
// unfollow produces.
const passed = currentContactList;
const isNewer =
!passed ||
relayContactList.created_at > passed.created_at ||
(relayContactList.created_at === passed.created_at &&
relayContactList.id < passed.id);
if (isNewer) {
bestContactList = relayContactList;
}
}
} catch {
// The read failed. It cannot be told apart from "the relay holds
// nothing", so refuse to publish rather than replacing from a guess.
throw new Error('Could not confirm the current list. Please try again.');
}
if (!bestContactList) {
throw new Error('Could not load existing data. Please try again.');
}
// Now mutate bestContactList...
}
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday Changed · +29 lines 3952636a02a8
- 3d ago First seen · 154 lines · 172 tokens per session scan A c6c0997b54c2
nostr-replaceable-event-mutation-overwrite is a skill published in the GitHub repository divinevideo/divine-mobile (265 stars, last pushed today), licensed MPL-2.0. It adds 172 tokens to every session and 1,829 once invoked, about $0.0009 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other skills, from other repositories
code-changes
Orchestration workflow for any task that ends in code changes: issue analysis, pull request review, feature implementation, bug fixes, refactors, or fleshing out an idea. MUST be invoked at the start of such a task, before reading or writing any code. Defines how to analyze first, gate on user approval, plan, pick the…
alchemy-cli
Use the Alchemy CLI (@alchemy/cli) for live blockchain data, transaction lookups, NFT/token/portfolio queries, simulation, tracing/debugging, contract reads/writes, wallet-signed sends, swaps and cross-chain bridges, Solana RPC/DAS plus wallet sends, webhook management, and Alchemy app administration. Preferred…
skmtc-debug
Diagnose failures in SKMTC sessions — no output, wrong output, error messages, bundle freshness, parseIssues, "Registered definition mismatch", ref cycles, "Module not found" in generated code, or any other broken behavior. Applies across both CLI usage and generator authoring contexts. Use this skill when the user…
finish-it
Scope-cutting and shipping discipline from Derek Yu's 'Finishing a Game' and 'Death Loops', jam culture, and veteran shipping practice — diagnose why a game project stalled, cut to a shippable core, define a binary finish line, ship it. Use when: a game project is stalled or sprawling, 'I keep adding features', 'it's…
cross-environment-semantic-drift
L1 trigger - audits L1/L2 boundary bugs, precompile context assumptions, integer width mismatches at environment boundaries, and EVM-on-non-EVM drift.
genvm-lint
Validate GenLayer intelligent contracts with the GenVM linter.