OmniscioGuidesClaude Code and Jupyter notebooks
Claude Code in a Jupyter notebook: cell edits, cleared output, and running one
A notebook is a file of cells with outputs saved beside them, not a script, so "edit it" means something different. Anthropic ships a tool for it, and the surprises are all in how that tool treats a cell.
This page is the notebook itself. The VS Code guide covers installing and driving the extension, and the tools guide covers how a tool name becomes a permission rule. Here: what Claude may change in a notebook, what happens to the output, and when you get asked before code runs.
Sources read November 25, 2026. By the Omniscio team. Updated .
How Claude edits a notebook
NotebookEdit modifies a Jupyter notebook one cell at a time, targeting cells by their cell_id. It does not perform string replacement across the notebook the way Edit does on plain files, which is the first thing to know if you expected a find-and-replace.
Three edit modes control what happens to the target cell:
| Mode | What it does |
|---|---|
replace | Overwrite the cell's source. This is the default. |
insert | Add a new cell after the target; with no cell_id the new cell goes at the start of the notebook, and cell_type must be code or markdown |
delete | Remove the target cell |
Because the target is a cell id rather than a string, asking for a change works best when you name the cell, or say which one it is by what it does. A request phrased like a search and replace across a notebook is the one shape the tool has no mode for. The edit error reference covers the string-replacement behaviour of Edit itself, which is where that expectation comes from.
Why the output disappears
When NotebookEdit replaces a code cell, its execution count and saved outputs are cleared. To get the output back, re-run the cell and any cells that use the functions or variables it defines.
The edit does not require a kernel restart, because NotebookEdit writes only the file and does not connect to your kernel. The change is on disk, nothing restarts, and the cell's printed result is gone until you run it again.
That asymmetry is worth planning for on a long analysis: an edit tells you what the cell now says, not whether the notebook still runs top to bottom. For that you restart the kernel and run it again yourself.
Save the notebook before you ask
Anthropic's warning for the VS Code workflow: save the notebook before you ask for an edit, because the extension's autosave setting does not save before NotebookEdit.
The save is one of two steps nothing else does for you; re-running the cell afterwards is the other, and the tool does not do that either.
What it refuses
NotebookEdit refuses a notebook file that does not decode as UTF-8, under the same rule as Edit, and writes nothing. One difference in that rule's wording is worth knowing: Edit accepts a file that starts with a little-endian UTF-16 byte-order mark, and NotebookEdit does not. Refused files include non-ASCII text saved in a legacy encoding such as Windows-1252 or Shift-JIS, binary files, and UTF-8 with an invalid byte sequence.
A second refusal comes from a Perforce workspace: with CLAUDE_CODE_PERFORCE_MODE set to 1, Edit, Write and NotebookEdit refuse to overwrite read-only files and tell Claude to run p4 edit first.
Permission rules use the Edit(...) path format, so a rule such as Edit(notebooks/**) covers NotebookEdit calls on files in that directory. Anthropic documents that format for notebook edits, so write the rule against the file path rather than the tool name.
The diagnostics tool beside it follows a different rule: a Read deny rule covers neither mcp__ide__getDiagnostics nor the chat panel's own diagnostics tool, mcp__claude-vscode__getDiagnostics, so both are blocked by name. The tools guide covers what each rule form actually matches.
Running a cell, and why it always asks
Running notebook code is a separate capability from editing it, and the route Anthropic documents goes through VS Code: the extension's IDE server exposes mcp__ide__executeCode, which runs Python code in the active Jupyter notebook's kernel.
Anthropic's wording is that it cannot run anything silently. Each call goes through three steps: the code is inserted as a new cell at the end of the active notebook, VS Code scrolls that cell into view, and a native Quick Pick asks you to Execute or Cancel.
Cancelling, or dismissing the picker with Esc, returns an error to Claude and nothing runs. The tool also refuses outright when there is no active notebook, when the Jupyter extension ms-toolsai.jupyter is not installed, or when the kernel is not Python.
That Quick Pick is separate from PreToolUse hooks, and Anthropic is precise about what an allowlist entry buys you: it lets Claude propose running a cell, while the Quick Pick inside VS Code is what lets it actually run.
The VS Code guide covers the extension itself, including the diagnostics tool its server exposes beside this one and the separate server the chat panel uses.
Sources
Every line on this page rests on one of these. The date beside each one is the day we read it.
- Tools reference, for the
NotebookEditmodes, thecell_idtargeting, the cleared outputs, the UTF-8 refusal, theEdit(...)rule format and the non-UTF-8 file list. Read November 25, 2026. - Use Claude Code in VS Code, for the notebook workflow, the re-run step, the autosave warning, the
mcp__ide__executeCodeconfirmation flow with its refusals, and the diagnostics tools and the rule that blocks them by name. Read November 25, 2026.
Notebook support is one of the areas that moves fastest, because both the tool and the extension are involved. Re-read the NotebookEdit entry and the Jupyter section of the VS Code page before you trust a copy of this page from a few months back.
Common questions
Can Claude Code edit a Jupyter notebook?
Yes, with the NotebookEdit tool. Anthropic documents it as changing one cell at a time, targeting cells by their cell_id, with replace, insert and delete as the three edit modes.
Why did the output disappear from the cell Claude edited?
NotebookEdit clears the cell's saved output and execution count when it replaces a code cell. Re-running the cell, and any cell that uses what it defines, brings the output back.
Does Claude Code need to restart the kernel after an edit?
No. NotebookEdit writes only the file and does not connect to your kernel, so nothing restarts; you re-run the cell, and any cell that uses the functions or variables it defines.
Can Claude Code run a notebook cell by itself?
The route Anthropic documents is the VS Code extension's mcp__ide__executeCode, and every call goes through a Quick Pick where you choose Execute or Cancel. Cancelling runs nothing, and the tool refuses when there is no active notebook, the Jupyter extension is missing, or the kernel is not Python.
Which permission rule covers notebook edits?
NotebookEdit uses the Edit path format, so a rule such as Edit(notebooks/**) covers NotebookEdit calls on files in that directory, the same way it covers Edit.
Notebooks, scripts and sessions in one window
Omniscio runs several agent sessions side by side in one window, each with its own context and its own diff view, so a notebook change and the script beside it are two panes rather than two terminals. Any model, any harness: Claude Code, Codex, OpenCode, Devin, Pi and Hermes are all supported.