nnsight is a Python library for examining and changing the internal values of deep-learning models, such as layer activations, gradients, and intermediate computations. Researchers and developers use it to study model behavior and causal effects in local PyTorch models or remotely through NDIF. The catalogue entry provides instructions for AI agents working with nnsight.
Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add instructions/ndif-team/nnsight/claude-mdgit clone --depth 1 https://github.com/ndif-team/nnsightWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/ndif-team/nnsight/claude-md)<a href="https://agentmods.dev/instructions/ndif-team/nnsight/claude-md"><img src="https://agentmods.dev/badge/instructions/ndif-team/nnsight/claude-md.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.03828 | $0.03828 |
| Opus 5 | $0.01914 | $0.01914 |
| Sonnet 5 | $0.00766 | $0.00766 |
| Haiku 4.5 | $0.00383 | $0.00383 |
Grade A, and why
nnsight CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 200 lines — stays where its author put it; the contents beside it link to each section on GitHub.
nnsight — Agent Guide
This file routes you to the right documentation under docs/ for whatever the user is asking about. The actual content lives in docs/. Read the relevant doc page before writing code — these docs are tight, recipe-style, and frequently updated to match the current branch.
If you're new to nnsight, read docs/concepts/index.md once. Otherwise jump directly to the doc that matches the user's task.
How to use this file
- Find the user's intent in "By task" below and follow the link.
- If the user's request maps to a model class (LanguageModel, VLLM, etc.), check "By model class".
- If something is broken, check "Errors" or "Gotchas".
- The "Inline gotcha cheat-sheet" at the bottom catches the most common agent mistakes — internalize them before writing any nnsight code.
By task
"I want to read activations / modify them on a single forward pass"
- docs/usage/trace.md —
model.trace(input) - docs/usage/access-and-modify.md —
.output,.input,.inputs, in-place vs replacement - docs/usage/save.md — keep values past the trace exit
"I want multi-token / autoregressive generation"
- docs/usage/generate.md —
model.generate(input, max_new_tokens=N) - docs/usage/iter-all-next.md —
tracer.iter[...],tracer.all(),tracer.next()/module.next()
"I want to run multiple prompts at once"
- docs/usage/invoke-and-batching.md —
tracer.invoke(...), batched lists, empty invokes - docs/usage/barrier.md —
tracer.barrier(n)for cross-invoke value sharing - docs/patterns/multi-prompt-comparison.md
"I want to look inside a module's forward (intermediate operations)"
- docs/usage/source.md —
model.<path>.source.<op_name>.output / .input - docs/concepts/source-tracing.md — how
.sourcerewrites the AST
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 6d ago First seen · 200 lines · 3,828 tokens per session scan A ba4b3c093715
nnsight CLAUDE.md is an instructions file published in the GitHub repository ndif-team/nnsight (1,087 stars, last pushed yesterday), licensed MIT. It adds 3,828 tokens to every session, about $0.0191 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other instructions, from other repositories
PINA AGENTS.md
AGENTS.md instructions for PINA-org/PINA, covering pina — physics-informed neural architectures, quick reference, workflow: problem → model → solver → trainer, problem types and condition types.
weightslab AGENTS.md
AGENTS.md instructions for GrayboxTech/weightslab, covering weightslab — agent context for users & debugging, 0. how to load this guide into claude code, 1. what it is and how the pieces connect, 2. install & run (the happy path) and ... your training loop ...
diffusers CLAUDE.md
Claude Code instructions for huggingface/diffusers, a project described as: 🤗 Diffusers: State-of-the-art diffusion models for image, video, and audio generation in PyTorch.
Traintools AGENTS.md
AGENTS.md instructions for AparajeetS/Traintools, covering traintools agent guide, discovery, when to suggest traintools, routing and integration rules.
tensorcircuit-ng AGENTS.md
AGENTS.md instructions for tensorcircuit/tensorcircuit-ng, covering tensorcircuit-ng repository guide for ai agents, mission, non-negotiable rules, environment rules and where to look first.
PortfolioOptimisers.jl copilot-instructions.md
Copilot instructions for dcelisgarza/PortfolioOptimisers.jl, covering copilot instructions for portfoliooptimisers.jl, project overview, architecture & key patterns, developer workflows and required before each commit.