agentsclimarketplace

Nested memory trigger consume and clear

Skill ychampion/cskill-agents/agents/claude-code/skills/nested-memory-trigger-consume-and-clear

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 nested-memory-trigger-consume-and-clear

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

Process every nested-memory trigger before wiping the trigger set so subsequent iterations only see new paths.

SKILL.md

2.0 KB, as published. Nobody here has run it

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

  • Guard the expensive getAppState() call with an early return whenever nestedMemoryAttachmentTriggers is empty.
  • Iterate through every trigger before clearing the set so no pending path disappears mid-loop.
  • Collect nested attachments with the shared appState object to avoid repeated renders.
  • Clear the trigger set explicitly after collecting results, not before, so next invocations start fresh.

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)

  • Do not clear the trigger set before iterating; that can make the next call think the paths were already handled.
  • Do not call getAppState() when there are no triggers, which wastes React render cycles.

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.