agentsclimarketplace

Mark after filter memory deduplication

Skill ychampion/cskill-agents/agents/claude-code/skills/mark-after-filter-memory-deduplication

Agent skills for coding CLIs, multi-agent runtimes, context engines, MCP extensions, and terminal tooling. Instead of using claude code's source code, give your agent skills to create your own!

Install
npx -y skills add ychampion/cskill-agents --skill mark-after-filter-memory-deduplication

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

What its author says it does

Copied from the file, not written here

Filter prefetched memory attachments against cumulative read state before mutating that state, so async surfacing does not dedupe itself away.

SKILL.md

2.3 KB, as published. Nobody here has run it

SKILL: Mark-After-Filter Memory Deduplication

Domain: context-management
Trigger: Apply when asynchronously prefetched memories or file attachments must be deduplicated against a cumulative read-state cache that they will also update after surviving the filter. Source Pattern: Distilled from reviewed context, compaction, and memory-governance patterns.

Core Method

When prefetch results need to consult a cumulative "already seen" index, treat that index as read-only during selection. First filter the candidate attachments against the existing state, then write only the survivors into the shared cache. This breaks the self-referential cycle where a prefetch marks everything as seen before dedupe runs, causing the filter to delete the very data it just found. Keep the dedupe state cumulative across the whole turn so later iterations and future turns still suppress genuine repeats.

Key Rules

  • Read from the shared dedupe state during filtering, but do not mutate it until the final survivor set is known.
  • Update the shared cache only for attachments that actually survive the filter and remain eligible for surfacing.
  • Use a cumulative state store that includes earlier loop iterations and prior surfaced memories, not just the current batch.
  • Keep the mutation step adjacent to the filter so future maintainers cannot reintroduce self-poisoning writes inside the prefetch path.

Example Application

If a background document selector prefetches five candidate help files while the main agent is still running tools, first drop any files already present in the session's read-state map. Only after that should you record the surviving files in the map, ensuring they surface once now and stay suppressed on later retries.

Anti-Patterns (What NOT to do)

  • Do not mark prefetched files as read before duplicate filtering; the filter will see its own writes and erase the whole batch.
  • Do not dedupe only against the current iteration's attachments; you need cumulative session state to avoid resurfacing files already read by tools or earlier turns.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.