ProCowork 0.2.2: Which Rows, and Which Pro Window
This morning I posted the 0.2 update of ProCowork, my experimental ArcGIS Pro add-in that puts the Claude Code engine in a dockable chat panel. You type a request, Claude writes ArcPy, and the add-in runs it on the live, open project. Then I ran an audit on the code, and two hours later I had 0.2.2. Two of the fixes answer a question that matters a lot once an agent edits real data: which data does a call actually touch?
Which rows: path or layer
In ArcPy you can open the same data in two ways. A data-source path, such as
C:\data\city.gdb\Parcels, is the whole dataset. A live layer is the
user's view of that dataset. Cursors and geoprocessing tools that get the layer honor its
selection and definition query. So "set ZONE to 'R' for the parcels I have selected"
must go through the layer. If the call goes through the path, it changes every parcel.
The add-in makes this choice explicit. list_layers reports each layer's
source path, plus selected (the selection count) and
definition_query when they are set. The data tools
(search_cursor, calc_field, update_field) use
the path by default and take selected_only to switch to the layer. If
selected_only is set and nothing is selected, the tool refuses. It does not
fall back to every row.
This rule lived in one small Python function with no test. In 0.2.2 a plain Python test
pins it, with a stub arcpy, so it runs without ArcGIS Pro. I checked the test
against four deliberate mutations of the rule, and it fails on each one:
python tests\check_tool_catalogs.py
python tests\test_layer_or_path.py
Expected output:
ok: 14 tools, 7 C# reads, 7 ArcPy ops
ok: path-vs-layer rule
A related fix: search_cursor treated "limit": null as "no
limit" and read every row. Now null means "not given", and the default cap from the
Options page applies (10,000 rows unless you change it).
Which project: two Pro windows
This one surprised me. The bridge between Claude and Pro is a small MCP server inside the
Pro process, on a loopback port that the OS picks at startup, with a fresh Bearer token
per session. The add-in wrote the URL and token into one shared .mcp.json
in the workspace folder. Open a second Pro window, and it overwrote that file. The next
engine in the first window then connected to the second window's bridge. In other words,
you asked about project A, and Claude edited project B.
Now each Pro process writes its own .mcp.<pid>.json, and the engine
starts with --strict-mcp-config, so it reads only that file:
claude -p --output-format stream-json --input-format stream-json --verbose ^
--mcp-config "%USERPROFILE%\Documents\ArcGIS\ClaudeWorkspace\.mcp.<pid>.json" ^
--strict-mcp-config --permission-mode bypassPermissions --model claude-opus-5-5
The file is deleted when Pro shuts down cleanly, and the old shared file is removed at startup.
Three timeouts, in order
While documenting the bridge, I wrote down how its timeouts relate. The bridge runs one tool call at a time, so a second call can wait behind a long geoprocessing run. Each timeout must be longer than the one before it, so the user gets the cleanest error:
| Timeout | Value | What it does |
|---|---|---|
| Geoprocessing call | 290 s | The bridge cancels the tool and returns a clear "timed out" message. |
| MCP request | 320 s | The engine aborts the HTTP request. |
| MCP idle | 600 s | The engine gives up on the tool. Covers one queued call plus one running call. |
One caveat: the geoprocessing framework honors a cancel only when the tool yields, so a hung first call can run past 290 s. The first call after Pro starts is also slow, a minute or more, while Pro initializes its Python toolbox. Later calls take milliseconds.
Still YOLO
Generated code still runs on your open project with no approval prompt. The fixes above make the agent touch the data you meant. They are not a security boundary. Keep backups. This is my personal experiment, not an Esri product, and Esri does not support it. The panel is tested in Pro 3.7. On Pro 3.8.1 the build and the ArcPy write path pass, but I have not yet used the panel in the 3.8 UI.
The source code, build steps, and the tests are in the ProCowork repository. The review-and-approve card is still next on my list. More to come :-)
Comments