Introduction

Components an AI agent can edit while a person approves.

Cube is a set of React components with a suggesting mode for AI. When an agent edits one, its changes show up in place, marked, the way suggested edits do in Google Docs or a diff does in Cursor. A person accepts or rejects them, all of a change or part of it. Until then nothing changes.

That is the whole idea. Agents are good at filling in, cleaning up and updating data, but you don't want them writing straight into your app, and a reply in a chat window leaves the person to copy the changes over by hand. Cube puts the agent's edit in the real place, so reviewing it is one click.

How it works

  • A proposal is a JSON Patch, a reason and an author. The agent sends the change as JSON Patch operations, says why in one line, and the person sees who proposed it.
  • Nothing changes until a person accepts. The accepted state and the state with every proposal applied are both there to render.
  • No silent overwrites. If a person edits the same place first, that part of the proposal goes stale instead of overwriting them.
  • One pending proposal per place. To change its mind, the agent revises its proposal with replaces.

Concepts covers each of these in detail.

What you get

  • usecube, the core: a store for any JSON state that agents write to as proposals and people accept, reject or edit. It gives any model two tools, read and propose. No dependencies.
  • Components you copy into your app with the shadcn CLI and own from then on. They draw proposals where they act: Doc, a block document, and Sheet, a spreadsheet. One store can drive both, so a doc can hold a live sheet and one proposal can change both; see Linking.

For agents

Every docs page is also Markdown: add .md to its address, or fetch it without asking for text/html. llms.txt lists them all, and Quickstart walks a coding agent through adding Cube to a project.

Open source

Cube is MIT licensed. The source is on GitHub.