Skip to main content
Glama
README.md
# Agent Design Workbench

A local design workspace where agents author HTML and people review it. Explore on a spatial canvas, compare exact revisions, and leave feedback tied to the screen or component you saw. A workbench document is a folder you can keep in Git.

![The Workbench canvas with two screens, an active agent label, and the selected screen’s revision history](docs/images/workspace.png)

## Get started

Install Node.js 22 or newer, then run:

```sh
git clone https://github.com/harish-anumula/agent-design-workbench.git
cd agent-design-workbench
npm ci
npx playwright install chromium
npm start
```

Open [the local workspace](http://127.0.0.1:46185/) on a desktop to try the Workbench Library. Focused review links also support narrow screens. Select a screen to see its actions, and use **Open screen** to inspect it. Review a pair, pin the comparison, or mark a point and leave a comment. Preview folders can include HTML, styles, scripts, local images and bundled components.

Start the local viewer when you want to review in a browser, and stop it with Ctrl+C when you’re done. It reads the document, serves the saved previews, and writes feedback to the project folder. Your designs and comments stay on disk between sessions, and the CLI works on those files directly. Individual HTML designs can open on their own when their bundles support file URLs.

<details>
<summary>Use another document or port</summary>

```sh
node bin/workbench.mjs serve --doc /path/to/design-document --port 0
```

The command prints its loopback URL. Port 0 lets the OS choose a free port. On Linux, use `npx playwright install --with-deps chromium` if the browser needs system libraries. Serve and normal file operations can run before installing Chromium. Install it for CLI and MCP screenshot capture and scripted replay.

</details>

## Review a change

Open a focused link from your agent to see a specific frame, revision or before/after pair. Comments keep the revision and viewport they came from even while an agent publishes another change. Copy a component reference into chat to point the agent at the relevant source.

![Side-by-side comparison of two phone-width revisions with the compact playback toolbar and a selected comment showing Edit and Delete](docs/images/review.png)

## Give an agent the workbench

Point the agent to the [project skill](.agents/skills/design-workbench/SKILL.md). The skill and its local references cover task framing, small-screen checks, exact revisions, and concurrent authors. The CLI emits structured JSON. Use an operation's `--help` for its schema.

```sh
node bin/workbench.mjs guide --doc examples/workbench-library
node bin/workbench.mjs list --doc examples/workbench-library
node bin/workbench.mjs status --doc examples/workbench-library --short
```

### Prompts you can give an agent

Open this repository in your coding agent, or give it the absolute path to the repository and the document folder. Point it to [the Workbench skill](.agents/skills/design-workbench/SKILL.md) so it can use the CLI. If you've configured MCP, it can use the equivalent tools.

**Explore alternatives**

> Read the Design Workbench skill. Open `examples/workbench-motion` as the document. Inspect the Editing indicators frame, then create a scratchpad with two new editing indicator options. Use the same artboard and editing state for both. Capture each at desktop width and give me a Workbench link where I can compare them.

**Revise a screen without losing the baseline**

> In `examples/workbench-library`, check out the latest revision of `annotation-composer` to a new folder. Keep the post button beside the character count at narrow widths. Save a new revision from that checkout, run the `examples/replay/composer.json` recipe with the new revision and a fresh output folder, and give me a before-and-after review link.

**Act on visual feedback**

> After I leave a comment, read it on the Workbench Library’s annotation composer. Inspect the exact revision and component attached to the comment. Make the change in a checkout, save it as a new revision, and reply to the comment with what changed and the new revision.

**Show that an agent is working**

> Open the Workbench Library canvas. Start an activity for `annotation-composer` with your agent name and a short label for what you’re doing. Keep it active with a heartbeat as needed, and finish the activity when you’re done. Leave saved revisions available for review.

### Add a scratchpad

A source bundle is a directory with an `index.html` and relative assets. Workbench snapshots it so an older link or comment still resolves to the same design.

```sh
node bin/workbench.mjs init --doc ./my-design --title "My design"
node bin/workbench.mjs page --doc ./my-design --id workspace --title "Workspace"
node bin/workbench.mjs frame --doc ./my-design --id layout-a --title "Layout A" --scratch true
node bin/workbench.mjs save --doc ./my-design --frame layout-a --sourceDir ./my-html-bundle --label "Initial layout"
node bin/workbench.mjs promote --doc ./my-design --frame layout-a --page workspace
```

Check out a revision to a new directory before editing it. The checkout carries its base revision. Independent file edits and edits to separate named HTML regions can merge. An overlap returns the current head and intervening changes so the author can reconcile them. Use `log` to inspect provenance and `review` to build an exact human handoff.

### Capture a design

```sh
node bin/workbench.mjs capture --doc examples/workbench-library \
  --frame annotation-composer --revision latest --width 390 --height 844 \
  --output artifacts/phone.png
```

The result includes a screenshot and potential clipping or overflow findings. View the image at the intended scale and exercise the interaction before deciding whether it works.

### Connect an MCP client

Add a stdio server to your client's MCP configuration. Substitute your checkout and design document paths:

```json
{
  "mcpServers": {
    "design-workbench": {
      "command": "node",
      "args": ["/absolute/path/agent-design-workbench/bin/workbench.mjs", "mcp", "--doc", "/absolute/path/my-design"]
    }
  }
}
```

Operations are named `workbench_<operation>`. Begin with `workbench_guide` and `workbench_list`. `workbench_capture` can return a PNG inline. `workbench_serve` starts a local viewer for the client session.

## Manage feedback

Click the **Comments** count to open the review sidebar. A numbered canvas pin opens its exact thread. Select a comment for **Edit** and **Delete**. Editing keeps the comment’s revision, position and replies. Deleting removes its pin and thread from review after confirmation.

Agents can use `edit-comment` and `delete-comment` through the CLI or matching MCP tools. Read `comments` and send the comment’s `version` to protect newer feedback from a stale write.

## Review animation

Select a screen on the canvas or open it, then use the triangle button labelled **Replay motion** to see an animation from the start. An open screen restarts at its current saved HTML page. Replay resets the preview’s in-memory state and scroll, so a loading sequence can run again. A URL anchor takes the preview back to its target. On desktop, use the triangle on either side of a comparison or **Replay both**. On a phone, the triangle replays the visible side.

Use **Loop motion** beside the replay button to restart the whole preview every five seconds. Change the interval in **Size & zoom**, alongside the device and zoom controls. Desktop comparisons loop both previews, and phones loop the visible side. Loop stops when you interact with the preview or start placing feedback.

Select **Pick** to see a component’s outline and stable ID as you move the pointer. Click the highlighted component, then choose **Copy ID**. Keyboard users can move the target with the arrow keys and press Enter.

Try the [editing motion study](docs/examples.md) to compare the shipped pencil label with three alternate treatments. To check a loader as an agent, write a replay recipe that captures the loading state and waits for the completed state before taking another screenshot.

## Replay an interaction

Run the same action sequence at phone and desktop sizes in one browser. Each case begins in a fresh context and returns a screenshot plus page errors, failed requests and layout findings.

```sh
node bin/workbench.mjs replay --doc examples/workbench-library \
  --recipe examples/replay/composer.json
```

The [example recipe](examples/replay/composer.json) captures the empty composer, enters a note, posts it and waits for the new message. Review the final images and the JSON. Each invocation creates a fresh `runDir` under `outputDir`, so earlier evidence stays available. `ok` means the requested steps completed. `clean` reports browser and request errors separately. A failed case keeps evidence and other cases can still run.

Recipes can start from a saved revision or an unsaved `sourceDir`, and select a relative `file` inside the bundle. They support explicit clicks, input, selects, keyboard events, hover, wait conditions and named snapshots. The same operation is available through `workbench_replay` in MCP. See `replay --help` for the recipe schema.

## How it fits together

- **Documents** hold immutable browser bundles, pages, placements, annotations and pinned pairs under `.adw`. Commit the document folder to share revisions. Keep active sessions on one machine for concurrent publication.
- **The viewer** serves the canvas and sandboxed revision previews over loopback.
- **CLI and MCP** operate on the same document model. Set `WORKBENCH_AGENT` to give your edits and activity a readable author.

## Development

```sh
npm ci
npx playwright install chromium
npm test
```

The tests cover storage and concurrent writers, the CLI, stdio MCP, and real Chromium interactions. The sample Library opens with `npm start`. [Other examples](docs/examples.md) · [Design skill research](docs/design-skill-research.md)

[Contributing](CONTRIBUTING.md) · [MIT license](LICENSE)