2 Comments
User's avatar
Whistle650's avatar

I am new to Marimo and am specifically interested in using Claude Code CLI to speed my notebook development. I have been using the MCP you built as described here: https://marimo.io/blog/beyond-chatbots. It's very nice!

However, what I would really like is to have an agentic loop: the notebook should update upon edit (I am using the --watch flag, but the edits have some latency presumably, and I'm not sure how the reactive nature of the notebook is triggered), and the Claude Code CLI would see any errors and keep working at it. I have set the Runtime Configuration to autorun, but I find I have to use Cmd+Shift+R to execute the stale cells.

(It occurs to me now that maybe the --watch flag is not necessary because the the changes are happening via MCP not directly by editing the file....I'm not sure).

In any case, I was expecting with autrun on, changes to the notebook would trigger re-evaluation which would reveal errors which the Claude Code CLI would see and possibly continue to work on.

But in your blog post you explicitly say read-only tools.

Can you help me understand? thank you.

Joaquin Coromina's avatar

Thanks for the kind words, glad it’s been useful!

One clarification: Claude Code is editing the marimo .py file directly on disk, not “through MCP,” and --watch is what makes marimo stream those file changes into the browser editor so you see the notebook update. By default watched/synced code changes do not auto-execute; marimo marks affected cells as stale and you need to run stale cells (e.g., the runStale hotkey) to surface outputs and errors.

If you want a tighter agentic loop like you mentioned where after the agent edits the notebook, changes trigger execution of stale cells automatically, you can enable this by:

- Enabling autorun-on-save via the runtime config option (https://docs.marimo.io/guides/editor_features/watching/#watching-for-changes-to-your-notebook).

- Enabling Autosave in your Notebook Editor settings (https://docs.marimo.io/guides/configuration/#user-configuration)

Also note that when you start marimo with --mcp, watch mode is already enabled, so you don’t need to add --watch separately. Finally, the “read-only tools” line in the blog post is intentional: the MCP surface is non-mutating by design, and the edit/execute loop happens via file edits plus marimo’s watcher/runtime behavior. Hope this helps!