Skip to content

Add showboat var for persistent variables across cells#11

Closed
simonw wants to merge 5 commits into
mainfrom
claude/persistent-cell-variables-QhaRZ
Closed

Add showboat var for persistent variables across cells#11
simonw wants to merge 5 commits into
mainfrom
claude/persistent-cell-variables-QhaRZ

Conversation

@simonw
Copy link
Copy Markdown
Owner

@simonw simonw commented Feb 10, 2026

Cells executed via showboat exec can now set and read persistent
variables using showboat var set/get/list/del. Variables are stored
in a .vars JSON file alongside the markdown document.

The runner copies the showboat binary into a temp directory on PATH
and sets SHOWBOAT_VARS in the child environment, so cells can call
showboat var regardless of how the parent was invoked (go run, uvx,
system PATH, etc.). Works cross-platform (Windows .exe handling).

During verify, the vars file is cleared at the start for deterministic
replay and cleaned up afterward.

https://claude.ai/code/session_014nhLqsJZjScVShx13JFRFz

Cells executed via `showboat exec` can now set and read persistent
variables using `showboat var set/get/list/del`. Variables are stored
in a <file>.vars JSON file alongside the markdown document.

The runner copies the showboat binary into a temp directory on PATH
and sets SHOWBOAT_VARS in the child environment, so cells can call
`showboat var` regardless of how the parent was invoked (go run, uvx,
system PATH, etc.). Works cross-platform (Windows .exe handling).

During `verify`, the vars file is cleared at the start for deterministic
replay and cleaned up afterward.

https://claude.ai/code/session_014nhLqsJZjScVShx13JFRFz
Comprehensive demo showing: basic set/get, starting a background
http.server and saving its PID, fetching from the server, stopping
it with the saved PID, listing and deleting variables, and
cross-language usage from Python. Passes showboat verify.

https://claude.ai/code/session_014nhLqsJZjScVShx13JFRFz
showboatDir() now checks if the directory containing os.Executable()
already has a "showboat" entry (the common case for go install, system
PATH, etc.) and uses it directly — zero I/O, no temp dir, no cleanup.

Only when the binary lives elsewhere (uvx Python shim, go run, renamed
binary) does it fall back to creating a temp dir with a symlink. Copy
is a last resort for Windows without symlink privileges.

Both paths are covered by unit tests: TestShowboatDirFastPath and
TestShowboatDirSymlinkFallback.

https://claude.ai/code/session_014nhLqsJZjScVShx13JFRFz
Injects a failing symlinkFunc to force showboatDirFrom through the
copy path on Linux (where symlinks normally always succeed). Verifies
the copied file has correct content and executable permissions.

https://claude.ai/code/session_014nhLqsJZjScVShx13JFRFz
@simonw
Copy link
Copy Markdown
Owner Author

simonw commented Feb 14, 2026

I'm not convinced my this feature - it adds a lot of complexity.

I've decided to go with a feature that's specially for starting servers so they can be shut down later instead.

@simonw simonw closed this Feb 14, 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.

2 participants