Agent Ledger
Everything an agent changed, each change with its before, after and an undo.
PROGet Agent Ledger and 168 other Pro components with pro lifetime — Get Pro
- Category
- AI Agent
- Access
- ProPro · unlocked
- Source
- 361 lines · one file
- States
- 7 drawn
- Added
- 2 Nov 2026
The decision inside it
Undo shows what depends on a change first
Reverting a price and leaving the quote that used it is worse than not undoing at all. So Undo lists every later change built on this one and reverts them together, newest first, and anything that can't be taken back, like an email already sent, is named and left alone with a follow-up offered.
When to use it
Use Agent Ledger to show what agents changed in your systems after the fact, with undo. For changes before they happen use Dry-Run Preview; for a read-only record of who did what use Audit Log Table.
Installation
How you get it
Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.
Use Liro's Agent Ledger for this.
Install it: npx shadcn@latest add @liro/agent-ledger
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/agent-ledger.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @liro registry with your CLI token: see the Namespaced tab.
Usage
import { AgentLedger, type LedgerChange } from "@/components/ui/agent-ledger";
export function AgentLedgerPanel({ changes, api }: {
changes: LedgerChange[];
api: { revert: (ids: string[]) => Promise<void>; followUp: (id: string) => Promise<void> };
}) {
return <AgentLedger changes={changes} onUndo={api.revert} onFollowUp={api.followUp} />;
}API reference
“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.
Props
Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.
| Type | Notes | ||
|---|---|---|---|
changes | LedgerChange[] | Yes | – |
title | string | No | – |
onUndo | (ids: string[]) => void | Promise<void> | No | Reverts these changes, newest first. May return a promise; the rows wait for it and stay put if it fails. |
onFollowUp | (id: string) => void | Promise<void> | No | Runs the follow-up for a change that can't be undone. |
now | Date | number | No | Fix the clock, for screenshots and tests. |
look | Look | No | Layered sets it in a tray with the status strip below. Flat is one card. |
Dependencies
npm packages
clsxframer-motionlucide-reacttailwind-mergeLiro foundations, installed alongside it
liro-themebadgebuttonStates
All of them are drawn by the component. None is left for you to design.
- Changes in place
- Undo with dependents
- Can't be undone
- Undoing
- Undo failed
- Undone
- Empty
Accessibility
- Keyboard reachable throughout, in visual order
- Focus trapped in overlays, Escape closes them
- Focus returns to whatever opened it
- Live regions announce what changed, not that something did
- Honours prefers-reduced-motion
Responsive behavior
- Sizes to its container, not the viewport
- Usable from 320px up
- Pointer-based interaction, so trackpad and touch both work
- No hover-only affordances