What
Claude Code has a dedicated NotebookEdit tool for editing .ipynb cells directly (add/edit/delete a specific cell by index, preserving notebook JSON structure, outputs, and metadata) instead of forcing the model to hand-edit raw notebook JSON through edit_file. KlaatCode has no notebook-aware tool today — editing a .ipynb currently means the model manipulating the raw JSON via edit_file/write_file, which is fragile (easy to corrupt cell structure, execution counts, output arrays).
Where to start
- New tool
notebook_edit (src/tools/index.ts, following the existing tool-registration pattern): operations insert_cell / edit_cell / delete_cell, addressed by cell index, cell_type: "code" | "markdown".
- Parse/serialize with the standard nbformat JSON structure — preserve everything the tool isn't explicitly asked to change (outputs, execution_count, metadata) except when editing a cell's source clears its outputs, matching normal notebook-editing semantics.
- Route through the same sandbox/write-allowlist and permission-prompt flow as other write tools; diff preview can show the affected cell's before/after source.
- Read-side: a
notebook_read or extending read_file's existing handling to summarize a notebook (cell count, types, first line of each) rather than dumping raw JSON, so the model doesn't need the whole file to decide which cell to touch.
Acceptance criteria
- Model can add/edit/delete a specific cell in a real
.ipynb file without corrupting the surrounding notebook structure.
- A few unit tests round-tripping a small fixture notebook through insert/edit/delete.
Why it matters
Niche but bounded — data-science/ML users editing notebooks currently get a worse, riskier experience than plain source files.
What
Claude Code has a dedicated
NotebookEdittool for editing.ipynbcells directly (add/edit/delete a specific cell by index, preserving notebook JSON structure, outputs, and metadata) instead of forcing the model to hand-edit raw notebook JSON throughedit_file. KlaatCode has no notebook-aware tool today — editing a.ipynbcurrently means the model manipulating the raw JSON viaedit_file/write_file, which is fragile (easy to corrupt cell structure, execution counts, output arrays).Where to start
notebook_edit(src/tools/index.ts, following the existing tool-registration pattern): operationsinsert_cell/edit_cell/delete_cell, addressed by cell index,cell_type: "code" | "markdown".notebook_reador extendingread_file's existing handling to summarize a notebook (cell count, types, first line of each) rather than dumping raw JSON, so the model doesn't need the whole file to decide which cell to touch.Acceptance criteria
.ipynbfile without corrupting the surrounding notebook structure.Why it matters
Niche but bounded — data-science/ML users editing notebooks currently get a worse, riskier experience than plain source files.