Nested memory trigger consume and clear

From ychampion/cskill-agents · View interactive version

Nested memory trigger consume and clear is an AI agent skill from the GitHub repository ychampion/cskill-agents. Process every nested-memory trigger before wiping the trigger set so subsequent iterations only see new paths.

How to use this skill

Skill file

SKILL: Nested Memory Trigger Consume and Clear

Domain: context-management

Trigger: Apply when a worker must fetch nested memory attachments whose trigger list can be cleared only after all paths are handled.

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

Core Method

Treat the trigger set as authoritative input, not a mutable queue that shrinks mid-processing. First return with an empty list if no triggers exist so render-bound helpers like getAppState() never run unnecessarily. Once you know work is required, snapshot the triggers, iterate over every path to gather nested attachments holding onto shared app state, append all results to the response, and only after the loop completes clear the trigger set. This prevents stale triggers from re-running in future turns while ensuring concurrent iterations do not drop paths that were just discovered.

Key Rules

Example Application

When multiple nested memories are queued while a thread is still running, fetch them all inside a single getNestedMemoryAttachments call, clear the triggers afterward, and then hand the flattened attachment list to the caller.

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.