How a desktop app and an AI agent CLI share one Cmd+Z Undo history

Letting Claude Code or Codex rewrite 80 Markdown files directly in your vault is fast until it corrupts a select field or overwrites an edit you just made. Here is how BaseStudio routes CLI and MCP commands through a local user socket into the running desktop app so every agent edit is validated and reversible with Cmd/Ctrl+Z.

A recurring complaint on Hacker News and r/ClaudeCode captures the core problem with letting AI agents manage personal notes and task lists:

“There is no Undo button in the terminal.”

When an agent edits YAML front matter directly with shell tools or file-write calls, three things go wrong in practice:

  1. Schema drift: Your status column allows Idea, Planned, In progress, Blocked, and Done. The agent writes Shipped or completed into 14 notes.
  2. Silent overwrites: You edited a project note five minutes ago. The agent read the file earlier in its session and writes back stale front matter over your changes.
  3. No clean rollback: People answer “git is my undo” — until an agent touches files you had uncommitted edits in, or edits records inside a binary SQLite file where git diff cannot show row-level changes.

BaseStudio was built so the human UI and the AI agent execute the exact same application code and share one persistent Undo history.

The architecture: one local socket, standalone fallback

When you install the command line tool on macOS (Apple Silicon) or Linux (BaseStudio → Install Command Line Tool…), the basestudio binary does not re-implement a separate parser or write directly to disk behind the desktop app’s back.

Instead, every basestudio invocation — whether typed in a terminal, run by Claude Code via the Agent Skill, or triggered through the stdio MCP server (basestudio mcp) — checks for the running desktop app’s local Unix domain socket inside your user profile:

Agent (Claude Code / Codex / MCP)
│
▼
basestudio CLI
├── Desktop app running? ──► Local user-only Unix socket (version-checked JSON + 5s heartbeat)
│ └── Runs inside app's live session:
│ • Validates column types & select options
│ • Checks expect_revision against live record
│ • Updates open Table/Board/Timeline views immediately
│ • Pushes one named entry ("Claude · Edit 9 records") to Undo
│
└── Desktop app closed? ──► Runs the exact same core service headless against disk
└── Persists the action into the Base's Undo history on disk
so the next app launch still sees it in Undo

Version guards and heartbeats

A subtle edge case in desktop-plus-CLI tools is an in-place app upgrade: the CLI on disk was updated to version N+1 while the running desktop window is still on version N. Every socket request sends the CLI’s exact app version. If the running app is a different version, it refuses cleanly and tells you to restart BaseStudio rather than silently mixing schemas. Long-running bulk commands stream periodic whitespace heartbeats over the socket every 5 seconds so the CLI knows the app is actively working and not hung.

Four write guardrails before a byte touches disk

Before any agent write commits, BaseStudio enforces the same four checks as the desktop UI:

  1. Column type & option validation: A select column rejects values not in its option list (Refused: "Shipped" is not a valid Status option). A number column rejects arbitrary text.
  2. Optimistic revision checks (--expect-revision): basestudio get and basestudio tasks return each record’s current revision hash. Passing --expect-revision <hash> to set or apply-update guarantees the write is refused if you edited the record after the agent read it.
  3. Preview before applying (--dry-run): Bulk updates and task updates accept --dry-run to print every field diff without writing anything:
Terminal window
basestudio bulk-set ~/Documents/Projects.base status="In progress" \
--where status=Planned --as Claude --dry-run
  1. Named, reversible Undo (--as NAME): Every write signed with --as Claude (or sent via MCP, which signs automatically with the client’s clientInfo name) records a single grouped action in the Base’s persistent Undo stack:
Terminal window
# Apply the edit — appears in BaseStudio's Undo menu as "Claude · Edit 3 records"
basestudio bulk-set ~/Documents/Projects.base status="In progress" \
--where status=Planned --as Claude
# Reverse it from the terminal — or press Cmd/Ctrl+Z inside the desktop app
basestudio undo ~/Documents/Projects.base

Even undo itself is guarded: if you manually edited one of those notes in Obsidian after Claude’s batch, BaseStudio refuses to blindly clobber your newer edit during Undo.

Why this beats raw file edits and hosted cloud MCPs

Approach Local speed & offline Schema validation Shared GUI Undo Context overhead
Agent edits .md YAML directly Yes None (depends on prompts) None (manual git reset) Low
Hosted Notion / Airtable MCP No (OAuth + API rate limits) Server-side Cloud version restore only High
BaseStudio CLI + Skill / local MCP Yes (100% local) Checked against Base schema Live Cmd/Ctrl+Z + basestudio undo ~3,200 tokens (Skill) or ~18 core MCP tools

Honest limits today

  • macOS (Apple Silicon) and Linux only for CLI/MCP. The Windows desktop package does not ship the basestudio CLI launcher yet.
  • Free record limit applies to agents too. The free version allows editing Bases up to 30 records (read-only above that); Pro removes the limit with one payment.

You can test the live schema refusal and shared Cmd/Ctrl+Z Undo right in your browser on the live demo, or explore the full AI agent workflow.

Try BaseStudio on your own files — or in the browser first.

Free forever for Bases up to 30 records, with no account and plain Markdown or SQLite files on your disk.