-
Notifications
You must be signed in to change notification settings - Fork 973
Description
Problem
Agents have no visibility into which variables are defined by which cells, or how cells depend on each other. This leads to repeated MB002 errors ("variable defined in multiple cells") when an agent creates or edits a cell that accidentally redefines a variable already exported by another cell.
Currently, the only way to check is to grep the raw .py file and manually parse the return (x, y, z) tuples — which is error-prone and doesn't account for marimo's internal dependency tracking.
GetTablesAndVariables shows a flat list of variables but doesn't map them to their defining cells or show the dependency relationships between cells.
Proposed solution
A tool that exposes the cell dependency graph. This could be:
get_dependency_graph()— Returns the full DAG: for each cell, its defined variables, referenced variables, and upstream/downstream cell dependencies- Or at minimum,
get_variable_owners()— A map of variable name to defining cell ID, so agents can check for conflicts before creating or editing a cell
Impact
Variable name conflicts are one of the most common agent errors in marimo notebooks. This would be a straightforward prevention mechanism — check what's taken before writing code — rather than relying on the agent to parse notebook internals.