Skip to content

refactor(agent): improve notebook prompts and add-cell response feedback#351

Open
moyiliyi wants to merge 2 commits into
plmbr:mainfrom
moyiliyi:exploration_prompts
Open

refactor(agent): improve notebook prompts and add-cell response feedback#351
moyiliyi wants to merge 2 commits into
plmbr:mainfrom
moyiliyi:exploration_prompts

Conversation

@moyiliyi
Copy link
Copy Markdown
Contributor

@moyiliyi moyiliyi commented May 28, 2026

Summary

This PR includes two focused improvements to notebook-agent behavior and feedback quality.

  1. Prompt instruction refinement for notebook editing/execution workflows.
  2. Tool response enhancement to return and surface inserted notebook cell indices.

Motivation

  1. In a data analysis and modeling task, the agent followed the prompt by first stating a high-level goal and then proceeding to generate the entire notebook implementation in one pass. For exploratory notebook work, this is not a reasonable default behavior. The notebook instructions should instead encourage incremental analysis, intermediate validation, and task-adaptive planning rather than upfront full-pipeline code generation.

  2. add-cell tool actions previously returned generic success responses, which made it harder to reference newly inserted cells in subsequent steps. Returning the inserted cellIndex improves traceability for iterative notebook workflows.

What changed

  • Updated NOTEBOOK_EDIT_INSTRUCTIONS to clarify when to prefer exploratory workflows vs. construction workflows.
  • Updated NOTEBOOK_EXECUTE_INSTRUCTIONS to encourage smaller, iterative execution cycles for exploratory/scientific tasks.
  • Updated notebook add_code_cell and add_markdown_cell command return shape from boolean success to an object containing:
    • cellIndex for the newly inserted cell
  • Updated Python tool wrappers (built-in toolsets and Claude tool handlers) to surface the inserted cell index in tool responses when available.

@moyiliyi moyiliyi changed the title Refine notebook editing and execution prompts refactor(prompts): Refine notebook editing and execution prompts May 28, 2026
@moyiliyi moyiliyi changed the title refactor(prompts): Refine notebook editing and execution prompts refactor(agent): improve notebook prompts and add-cell response feedback May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant