agentsclimarketplace

Turn scoped memory prefetch with disposal

Skill vishuwa2004/cskill-agents/agents/codex/skills/turn-scoped-memory-prefetch-with-disposal

Build curated agent skills for coding CLIs, terminal tools, context engines, remote bridges, and multi-agent runtimes

Install
npx -y skills add vishuwa2004/cskill-agents --skill turn-scoped-memory-prefetch-with-disposal

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

One thing to look at

  • 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Start a non-blocking, turn-scoped memory prefetch that auto-disposes and only injects results once per turn.

SKILL.md

2.6 KB, as published. Nobody here has run it

SKILL: Turn-Scoped Memory Prefetch with Disposal

Domain: context-management Trigger: When a turn needs contextual memory attachments but the main loop must stay streaming and reuse previous read state. Source Pattern: Distilled from reviewed session memory, compaction, and context-budgeting implementations.

Core Method

Launch a memory prefetch exactly once at the start of the turn and keep its handle alive while the main loop streams. Each loop iteration should check whether the prefetch has completed without blocking on it; if not, continue streaming and check again later. When the prefetch is ready, deduplicate the returned attachments against what the session has already read, emit the new attachments once, and mark the handle as consumed so later iterations do not re-send them. Dispose of the handle automatically when the turn ends, aborts, or transitions so no background work leaks across turns.

Key Rules

  • Start the prefetch before the streaming loop begins and store its handle with the turn state so it cannot accidentally restart on subsequent iterations.
  • Never block the main loop on the prefetch; poll readiness and continue streaming until the memory data is ready.
  • Before adding attachments to the turn output, dedupe them against the cumulative read file state (or equivalent) so repeated memory hits from earlier iterations are skipped.
  • After emitting attachments, set a consumed flag so downstream iterations skip re-emitting and the core method clearly signals it already produced this batch.
  • Ensure the handle is disposed automatically when the generator exits, even when the turn aborts or transitions, to avoid leaked async work and to emit consistent telemetry.

Example Application

If you build a new agent that reads documents for each user question, start a prefetch before streaming the model response, monitor the handle each loop, and only yield the resolved memories once so the UI can display them without delaying the primary response funnel.

Anti-Patterns (What NOT to do)

  • Re-running the prefetch on every iteration, which duplicates work and forces more disk/network traffic.
  • Blocking the assistant loop by awaiting the prefetch before the first attachment, which stalls streaming output for the turn.
  • Emitting memory attachments without filtering against the cumulative read state, resulting in repeated or stale content.

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.