Main agent vs background memory extraction exclusion

From ychampion/cskill-agents · View interactive version

Main agent vs background memory extraction exclusion is an AI agent skill from the GitHub repository ychampion/cskill-agents. Skip the background memory extractor when the main agent already persisted memory during the same turn to avoid duplicates and race hazards.

How to use this skill

Skill file

SKILL: Main Agent Vs Background Memory Extraction Exclusion

Domain: context-management

Trigger: Apply whenever the background memory agent must determine whether the parent already saved the same memories so it can safely skip processing.

Source Pattern: Distilled from reviewed context, compaction, and memory-governance patterns.

Core Method

Track a cursor UUID pointing to the last assistant message where an auto-memory write occurred and compare incoming messages to that cursor before running extraction. If the parent thread already wrote to memory paths after the cursor, skip launching the background agent. Otherwise, proceed with the forked extraction and reset the cursor to the new save point so the next turn knows what’s already handled.

Key Rules

Example Application

Use this skill by having the background extractor call hasMemoryWritesSince before proceeding; if it returns true, emit a “already handled” log and skip, otherwise continue persistence and store the current assistant UUID for the next check.

Anti-Patterns (What NOT to do)

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.