nemo-relay-instrument-context-isolation — Claude Code skill
The nemo-relay-instrument-context-isolation skill keeps NeMo Relay scope stacks separate across concurrent work and preserves event ancestry as tasks cross execution boundaries.
Apache-2.0 211 installs ★ 4,106 updated 2026-10-23
npx skills add NVIDIA/skills --skill nemo-relay-instrument-context-isolation -a claude-codeWhat nemo-relay-instrument-context-isolation does
The skill treats scope-stack ownership as part of the request boundary. Each request, agent, or workflow gets its own stack, while nested scopes form a parent-child tree. That tree controls event ancestry, lifetime, and visibility for scope-local middleware and subscribers. Scope boundaries can carry semantic input and output values, while mark events cover retries, checkpoints, interrupts, and other state changes.
The guidance maps the model to several runtimes. Python uses get_scope_stack() with contextvars; Rust integrations can use create_scope_stack() and set_thread_scope_stack(...); Go uses NewScopeStack() and ScopeStack.Run(...); Node.js uses createScopeStack() and setThreadScopeStack(...). Registrations tied to a scope disappear when it closes. A thread-local stack is unsafe after crossing an async task, goroutine, or JavaScript worker boundary.
What it helps with
- isolate scope stacks for concurrent requests
- preserve NeMo Relay event ancestry
- propagate scope into async tasks and workers
- prevent middleware from leaking between agents
- mark retries and checkpoints without full spans
Example prompts for the agent
- Give each concurrent request its own NeMo Relay scope stack and preserve event ancestry.
- Show how to propagate the active scope across goroutines with
NewScopeStack()andScopeStack.Run(...). - Set up Node.js context isolation with
createScopeStack()andsetThreadScopeStack(...).
How to install nemo-relay-instrument-context-isolation
1Skills CLI (Vercel)
npx skills add NVIDIA/skills --skill nemo-relay-instrument-context-isolation -a claude-code2Manually: put the files in place
~/.claude/skills/nemo-relay-instrument-context-isolation/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/nemo-relay-instrument-context-isolation/
1Skills CLI (Vercel)
npx skills add NVIDIA/skills --skill nemo-relay-instrument-context-isolation -a codex2Manually: put the files in place
.agents/skills/nemo-relay-instrument-context-isolation/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add NVIDIA/skills --skill nemo-relay-instrument-context-isolation -a cursor2Manually: put the files in place
.cursor/skills/nemo-relay-instrument-context-isolation/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install NVIDIA/skills skills/nemo-relay-instrument-context-isolation2Manually: put the files in place
.github/skills/nemo-relay-instrument-context-isolation/SKILL.md1Skills CLI (Vercel)
npx skills add NVIDIA/skills --skill nemo-relay-instrument-context-isolation -a gemini-cli2Platform CLI
gemini skills install https://github.com/NVIDIA/skills --path skills/nemo-relay-instrument-context-isolationManually: put the files in place
.devin/skills/nemo-relay-instrument-context-isolation/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add NVIDIA/skills --skill nemo-relay-instrument-context-isolation -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about nemo-relay-instrument-context-isolation
How do I install nemo-relay-instrument-context-isolation in Claude Code?
Run npx skills add NVIDIA/skills --skill nemo-relay-instrument-context-isolation -a claude-code, then check ~/.claude/skills/nemo-relay-instrument-context-isolation/SKILL.md.
What does nemo-relay-instrument-context-isolation do?
It guides the agent to give each request, agent, or workflow an independent scope stack and maintain parent-child event ancestry. It also covers scope-local middleware and context propagation across concurrent work.
How does the skill handle different runtimes?
It uses contextvars for Python, stack helpers such as NewScopeStack() and ScopeStack.Run(...) for Go, and explicit stack setup with createScopeStack() and setThreadScopeStack(...) for Node.js. Rust integrations have their own stack helpers.
Source text
SKILL.md · Apache-2.0
--- name: nemo-relay-instrument-context-isolation description: Use this skill when concurrent requests, async tasks, threads, workers, goroutines, or agents need independent NeMo Relay scope stacks and correct ancestry propagation. license: Apache-2.0 metadata: author: NVIDIA Corporation and Affiliates --- # Use Context Isolation Use this skill when an application runs concurrent requests, worker pools, async tasks, goroutines, or multiple agents in the same process. Treat scope-stack ownership as part of the request boundary. ## Core Rule Each independent request, agent, or workflow needs its own scope stack. Do not share one mutable stack across unrelated concurrent work unless you want shared ancestry and shared scope-local middleware. ## Embedded Scope Model - A root scope is always present, and pushed scopes form a parent-child tree beneath it. - Scope hierarchy determines event parentage, lifetime boundaries, and visibility for scope-local middleware and subscribers. - Standard scope types include `Agent`, `Function`, `Tool`, `Llm`, `Retriever`, `Embedder`, `Reranker`, `Guardrail`, `Evaluator`, `Custom`, and `Unknown`. - Scope start and end events can carry semantic `input` and `output` payloads when the scope represents a request, task, or meaningful result boundary. - Scope-local registrations disappear when the owning scope closes; use them for behavior that should not outlive a request or agent run. - Mark events are useful for retries, checkpoints, interrupts, and important state transitions that are not full spans. ## Per-Language Defaults - **Python**: rely on task-local behavior via `get_scope_stack()` and `contextvars`, or explicitly propagate when work leaves the current execution context - **Rust core**: use runtime helpers such as `create_scope_stack()`, `current_scope_stack()`, and `set_thread_scope_stack(...)` when an integration needs explicit stack ownership - **Go**: use `NewScopeStack()` and `ScopeStack.Run(...)` for goroutine-safe usage - **Node.js**: create and set a scope stack explicitly for the current execution path with `createScopeStack()` and `setThreadScopeStack(...)` ## Common Failures - Events from different requests appear under one root UUID - Scope-local middleware leaks across requests - Worker-thread work runs without the expected active scope - Integrations activate NeMo Relay without an explicitly initialized stack - Relying on a thread-local stack after crossing async tasks, goroutines, or JS worker boundaries ## Related Skills - `nemo-relay-instrument-calls` - `nemo-relay-plugin-observability` - `nemo-relay-debug-runtime-integration`
© NVIDIA Corporation and Affiliates · Apache-2.0 · NVIDIA/skills