The steps an agent intends to take, checked off live: numbered steps with sub-steps, elapsed times and a progress bar. When the plan changes, new steps fade in, removed ones fade out, moved ones slide and replaced ones are struck through. It can ask for approval before it runs, and collapses to one line.
On this page
- Show an agent's plan
- Approve a plan first
- Track step progress
- Edit steps before a run
- Collapse to one line
Examples
Installation
npx knowns-ui@latest add agent-planPaste 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 plan 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-plan
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-plan
```
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
- components/ui/knowns/spinner.tsx
- components/ui/knowns/button.tsx
- lib/knowns/motion.tsx
- lib/knowns/motion-utils.ts
- components/ui/knowns/agent-plan/agent-plan.tsx
- components/ui/knowns/agent-plan/plan-utils.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-plan, 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-plan" }) 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.Props
- steps
PlanStep[]- Default
[] - The plan, in order: { id, title, detail?, status?, startedAt?, endedAt?, steps?, replacedBy? }. Status is pending, active, done, skipped or failed.
- run
AgentRun- Read live state from a run: a step whose id matches a task takes its status, times and summary.
- actor
string- With run: this agent's tasks that are not in steps are added at the end.
- title / goal
ReactNode- Default
"Plan" / - - The header and one or two lines on what the plan is for.
- onApprove / onEdit
() => void- Show Approve plan and Edit plan while nothing has started.
- approval
string- With run: an approval request id. While it is pending, the buttons resolve it as approved or denied.
- approveLabel / editLabel
string- Default
"Approve plan" / "Edit plan" - Button text.
- collapsed / defaultCollapsed / onCollapsedChange
boolean / boolean / (collapsed) => void- Default
false - One summary line instead of the list, e.g. “Step 3 of 7: Run the full test suite”. The header toggles it.
- collapsible
boolean- Default
true - Let the header toggle the collapsed view.
- announce
boolean- Default
true - Announce step changes in a polite live region.
- onStepToggle
(id, done) => void- Opt-in: each step marker becomes a checkbox the reader can tick (a demo, a manual checklist). You update steps. Without it the markers are read-only.
- PlanStepMarker
component- The step marker on its own (status, n, small), for step lists outside a plan. Takes the step statuses plus waiting, an amber clock for a step that needs a person.
- now
() => number- Default
Date.now - Clock for elapsed times.
| Prop | Type | Default | Description |
|---|---|---|---|
| steps | PlanStep[] | [] | The plan, in order: { id, title, detail?, status?, startedAt?, endedAt?, steps?, replacedBy? }. Status is pending, active, done, skipped or failed. |
| run | AgentRun | - | Read live state from a run: a step whose id matches a task takes its status, times and summary. |
| actor | string | - | With run: this agent's tasks that are not in steps are added at the end. |
| title / goal | ReactNode | "Plan" / - | The header and one or two lines on what the plan is for. |
| onApprove / onEdit | () => void | - | Show Approve plan and Edit plan while nothing has started. |
| approval | string | - | With run: an approval request id. While it is pending, the buttons resolve it as approved or denied. |
| approveLabel / editLabel | string | "Approve plan" / "Edit plan" | Button text. |
| collapsed / defaultCollapsed / onCollapsedChange | boolean / boolean / (collapsed) => void | false | One summary line instead of the list, e.g. “Step 3 of 7: Run the full test suite”. The header toggles it. |
| collapsible | boolean | true | Let the header toggle the collapsed view. |
| announce | boolean | true | Announce step changes in a polite live region. |
| onStepToggle | (id, done) => void | - | Opt-in: each step marker becomes a checkbox the reader can tick (a demo, a manual checklist). You update steps. Without it the markers are read-only. |
| PlanStepMarker | component | - | The step marker on its own (status, n, small), for step lists outside a plan. Takes the step statuses plus waiting, an amber clock for a step that needs a person. |
| now | () => number | Date.now | Clock for elapsed times. |
From a run
Collapsed
What it handles
- 01Lists planned steps with a status of pending, active, done, skipped or failed, and sub-steps with elapsed times under each step.
- 02Reads the same plan from a run, where a task with a matching step id takes over its live state and extra tasks join the end.
- 03Shows a hairline progress bar and a done count such as 2/5, leaving replaced steps out of the total.
- 04Shows Approve plan and Edit plan while nothing has started or an approval is pending, and resolves that approval as approved or denied.
- 05Animates plan changes: new steps fade in, removed ones fade out and moved ones slide to their new place.
- 06Folds to one summary line with collapsed, and turns each marker into a checkbox only when you pass onStepToggle.
States
- First render
- Nothing. It paints as it is
- none
- A step is added
- It fades in and slides up
- 280ms, ease out
- A step is removed
- It fades out before it unmounts
- 180ms, ease out
- Steps reorder
- Rows slide from their old place
- 280ms, ease out
- A step turns done
- The check draws itself
- 180ms, ease out
- Marker hover
- The checkbox tints
- 120ms, ease out
- Reduced motion
- Steps appear, leave and move at once
- 0ms
| State | What moves | Timing |
|---|---|---|
| First render | Nothing. It paints as it is | none |
| A step is added | It fades in and slides up | 280ms, ease out |
| A step is removed | It fades out before it unmounts | 180ms, ease out |
| Steps reorder | Rows slide from their old place | 280ms, ease out |
| A step turns done | The check draws itself | 180ms, ease out |
| Marker hover | The checkbox tints | 120ms, ease out |
| Reduced motion | Steps appear, leave and move at once | 0ms |
Works with
When to use
When to use
- Showing the steps an agent intends to take before it runs, with Approve plan and Edit plan.
- Checking those steps off live, with elapsed times, sub-steps and a progress bar, as the plan changes.
When not to use
- The thinking before a chat answer: use Thinking State.
- Timing every call in a run: use Trace Waterfall.
- A fixed multi-step form: use Stepper.
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 Plan to my app and wire it to my own data.
- I need showing the steps an agent intends to take before it runs, with Approve plan and Edit plan. Set that up with the Knowns UI Agent Plan.
- Which Agent Plan props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "agent-plan" }) and search_docs({ query: "agent plan" }).