feat(notebooks): add append-only edit command#495
Merged
Conversation
Adds `pup notebooks edit <id> --file <cells.json>` which appends cells to an existing notebook without clobbering existing content. Internally does a read-modify-write: fetches the current notebook, appends the cells array from --file, then writes back via the existing update endpoint. The --file should contain a JSON array of cell objects (not the full notebook body). This is distinct from `notebooks update` which does a full replace. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
25 tasks
platinummonkey
approved these changes
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why this is needed
This command is required to ship the LLMObs skills (
/eval-trace-rca,/eval-bootstrap,/experiment-analyzer) on top of pup.Those skills currently call Datadog MCP notebook tools (
create_datadog_notebook,edit_datadog_notebook) to write persistent analysis artifacts. When the skills run through pup instead of the MCP server, they need an equivalent pup command.notebooks createalready exists; this PR adds the missing append-only variant.Skills that break without this
/eval-trace-rcaand/llm-obs-trace-rca— Phase 6 exports the root cause analysis report as a formatted Datadog notebook. Withoutnotebooks edit, the skill produces console-only output with no shareable artifact. It also breaks the downstream chaining workflow described below./eval-bootstrap— After bootstrapping an evaluator suite, the skill detects whether a prior RCA notebook was created in the same session (by matching the notebook URL) and appends the bootstrapped evaluator summary to that notebook rather than creating a new one. This is the append-only pattern: the skill callsedit_datadog_notebookwithappend_only=trueto preserve the existing RCA content and add new cells alongside it. Withoutnotebooks edit, this entire chained workflow —/eval-trace-rca→ creates notebook →/eval-bootstrap→ appends to same notebook — is broken at the second step./experiment-analyzer— Phase 5 optionally exports the analysis report to a Datadog notebook. Withoutnotebooks edit(ornotebooks create), the skill falls back to chat-only output with no persistent artifact.What breaks end-to-end
The most impactful breakage is the RCA → bootstrap chain:
Users lose the ability to produce a single unified notebook that documents both the root cause diagnosis and the evaluator suite that addresses it.
Summary
Adds
pup notebooks edit <id> --file <cells.json>as an append-only alternative tonotebooks update. Instead of replacing the entire notebook, it fetches the current notebook, appends the provided cells, and writes back — preventing accidental clobber of existing content.Changes
src/commands/notebooks.rs— newedit()function (read-modify-write via typed API)src/main.rs—NotebookActions::Editvariant and routingInterface
Example cells file:
[ { "attributes": { "definition": { "type": "markdown", "text": "## New Section\n\nContent here." } }, "type": "notebook_cells" } ]Testing
Automated
cargo test— passingcargo clippy -- -D warnings— cleancargo fmt --check— cleanManual smoke tests
pup notebooks edit 13937752 --file /tmp/cells.json— cell appended to notebook, returns updated notebook (exit 0)pup notebooks edit 999999999 --file /tmp/cells.json— 404 "Notebook not found" on the initial fetch (exit 1)🤖 Generated with Claude Code