Agents editing a document like teammates in a shared editor: live pointers with names, what they are doing and what they spent, suggestions typed in as tracked changes, images they resize, code they fix and comments beside the page.
- Agents editing a doc
- Review tracked changes
- Accept all suggestions
- Co-edit a table
- Show who is where
Examples
Installation
npx knowns-ui@latest add agent-cursorsPaste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install Agent cursors from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/agent-cursors
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add agent-cursors
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- lib/knowns/icons/actor-icon.tsx
- lib/knowns/icons/model-icons.tsx
- lib/knowns/icons/tool-icons.tsx
- lib/knowns/icons/model-icons.data.ts
- lib/knowns/icons/tool-icons.data.ts
- lib/knowns/icons/LICENSES.md
- components/ui/knowns/spinner.tsx
- components/ui/knowns/button.tsx
- lib/knowns/motion.tsx
- lib/knowns/motion-utils.ts
- components/ui/knowns/segmented-control.tsx
- components/ui/knowns/agent-cursors/agent-cursors.tsx
- components/ui/knowns/agent-cursors/cursor-parts.tsx
- components/ui/knowns/agent-cursors/cursors-model.ts
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0, class-variance-authority@^0.7.1.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/agent-cursors, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "agent-cursors" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.Agents work in your document the way teammates do in a shared editor. Each has a pointer in its own colour with its name, what it is doing and what it has spent. Text changes arrive letter by letter as tracked suggestions: the old words struck through, the new ones underlined in the agent's colour, with a bar in the margin beside the block. Images get resize handles and a live size, code blocks are edited like text, and comments land in the rail beside the page with a typing indicator while they are written.
Hover or focus a suggestion to accept or reject it; with the keyboard, Tab to it and press Enter to accept or Delete to reject. Accept all takes every open suggestion. Screen readers hear each suggestion as a sentence ("Fact-checker suggests: replace 10,000 with 50,000"); the pointers are decorative and hidden from them. Pointers move with transforms only and stop when the component is offscreen. With reduced motion, pointers sit at their targets and changes appear whole. Below 760px the comments move under their blocks.
Props
- run
AgentRun- Agents with label, model, spend, state and activity. Each gets a colour from the house palette, ordered so pointers next to each other differ.
- actors
Actor[]- Default
[] - Plain data instead of a run.
- doc
CursorDoc- { path?, blocks }. Blocks: heading (level 1 or 2), paragraph, bullet, code, image { alt, width, height, src?, caption? }.
- table
CursorTable- { columns, rows: { id, cells }[] } adds a Table tab. Cell ids are row.id + ":" + column index.
- suggestions
Suggestion[]- Default
[] - Text: { id, agentId, blockId, range: [start, end], insert } on the original text. Resize: { id, agentId, blockId, kind: "resize", width }.
- comments
CursorComment[]- Default
[] - { id, agentId, blockId, text, at? }, shown in the rail beside their block.
- presence
Record<agentId, Presence>- Default
{} - { target?, action?, away? }. target is a block, cell, suggestion or comment id. While an agent types, its pointer follows the caret.
- onAccept / onReject
(s) => void- A suggestion was accepted or rejected. The view applies it with a short highlight; update your document to keep it.
- onAcceptAll
(accepted) => void- Accept all, with the suggestions it took.
- tab / defaultTab / onTabChange
"doc"|"table"- Default
"doc" - Controlled or uncontrolled tab.
- typing
boolean- Default
true - Type changes in letter by letter. Off (or reduced motion) shows them whole.
- typeSpeed
number- Default
34 - ms per character.
| Prop | Type | Default | Description |
|---|---|---|---|
| run | AgentRun | - | Agents with label, model, spend, state and activity. Each gets a colour from the house palette, ordered so pointers next to each other differ. |
| actors | Actor[] | [] | Plain data instead of a run. |
| doc | CursorDoc | - | { path?, blocks }. Blocks: heading (level 1 or 2), paragraph, bullet, code, image { alt, width, height, src?, caption? }. |
| table | CursorTable | - | { columns, rows: { id, cells }[] } adds a Table tab. Cell ids are row.id + ":" + column index. |
| suggestions | Suggestion[] | [] | Text: { id, agentId, blockId, range: [start, end], insert } on the original text. Resize: { id, agentId, blockId, kind: "resize", width }. |
| comments | CursorComment[] | [] | { id, agentId, blockId, text, at? }, shown in the rail beside their block. |
| presence | Record<agentId, Presence> | {} | { target?, action?, away? }. target is a block, cell, suggestion or comment id. While an agent types, its pointer follows the caret. |
| onAccept / onReject | (s) => void | - | A suggestion was accepted or rejected. The view applies it with a short highlight; update your document to keep it. |
| onAcceptAll | (accepted) => void | - | Accept all, with the suggestions it took. |
| tab / defaultTab / onTabChange | "doc" | "table" | "doc" | Controlled or uncontrolled tab. |
| typing | boolean | true | Type changes in letter by letter. Off (or reduced motion) shows them whole. |
| typeSpeed | number | 34 | ms per character. |
What it handles
- 01Draws a coloured pointer for each agent with its name, current action and spend, placed on the block or cell named in presence.
- 02Types suggestions and comments in letter by letter at typeSpeed ms per character, 34 by default, or shows them whole with typing off.
- 03Marks a suggestion as a tracked change that you accept or reject by button, or with Enter and Delete or Backspace on the focused change.
- 04Accepts everything at once with Accept all and calls onAcceptAll with the suggestions it accepted.
- 05Handles image resize and code edits as suggestions too, with a stand-in picture that scales while an agent resizes the block.
- 06Adds a Table tab through the table prop so the same agents edit cells, and an agent marked away fades to grey.
States
- First render
- Nothing. Blocks and pointers paint as they are
- none
- A suggestion lands
- Its highlight fades from a tint to the plain colour
- 280ms, ease out
- Pointer moves
- It follows its target frame by frame
- none
- Agent goes away
- Its avatar fades and loses colour
- 180ms, ease out
- Switch to Table tab
- Rows fade in and settle
- 280ms, ease in-out
- Typing dots
- Three dots pulse while an agent types
- none
- Reduced motion
- Suggestions appear whole, with no typing
- 0ms
| State | What moves | Timing |
|---|---|---|
| First render | Nothing. Blocks and pointers paint as they are | none |
| A suggestion lands | Its highlight fades from a tint to the plain colour | 280ms, ease out |
| Pointer moves | It follows its target frame by frame | none |
| Agent goes away | Its avatar fades and loses colour | 180ms, ease out |
| Switch to Table tab | Rows fade in and settle | 280ms, ease in-out |
| Typing dots | Three dots pulse while an agent types | none |
| Reduced motion | Suggestions appear whole, with no typing | 0ms |
Works with
When to use
When to use
- Agents that edit a document, spec or table while people watch, where it matters who changed what.
- Keeping every agent edit as a suggestion until a person accepts it, one by one or all at once.
- Showing several agents at work in one place, each with its own colour, task and spend.
When not to use
- A plain before and after of one file or a code change: use Inline Diff.
- Following when each call ran and how long it took: use Trace Waterfall.
- Agents that never touch a shared document: show their progress instead: use Agent Lanes.
Using with AI
Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:
- Add the Knowns UI Agent Cursors to my app and wire it to my own data.
- I need agents that edit a document, spec or table while people watch, where it matters who changed what. Set that up with the Knowns UI Agent Cursors.
- Which Agent Cursors props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "agent-cursors" }) and search_docs({ query: "agent cursors" }).