AI-friendly by design
Coding assistants get canonical invariants, decision matrices, recipes, and anti-patterns — so they pick the right history shape without inventing semantics.
useState-shaped
useUndoableState returns [value, set, reset] — the same mental model as useState, with Ctrl+Z + coalescing built in.
Multi-scope, async, single-flight
One provider, many independent scopes. Async commands cancel cleanly via AbortSignal. Transactions collapse N mutations into one undoable composite.
Reversible state in two hooks
import { AmnesiaProvider, AmnesiaShortcuts, useUndoableState } from "react-amnesia";
function TitleEditor() {
const [title, setTitle] = useUndoableState("Untitled", {
label: "Edit title",
coalesceKey: "edit:title",
});
return <input value={title} onChange={(e) => setTitle(e.target.value)} />;
}
export default function App() {
return (
<AmnesiaProvider capacity={200}>
<AmnesiaShortcuts />
<TitleEditor />
</AmnesiaProvider>
);
}
Ctrl+Z / Cmd+Z undoes; Ctrl+Shift+Z / Cmd+Shift+Z / Ctrl+Y redoes. Rapid keystrokes sharing a coalesceKey collapse into a single history entry.
AI Resources
react-amnesia ships dedicated retrieval surfaces for coding assistants, DeepWiki, and local MCP-style documentation setups.
AI Docs
Canonical invariants, decision matrix, recipes, anti-patterns, and setup guidance.
Open AI Docsllms-full.txt
Long-form export for indexing, retrieval, and larger prompt contexts.
Open llms-full.txtDeepWiki Priorities
DeepWiki steering file pointing retrieval toward the highest-signal sources.
Open DeepWiki PrioritiesAssistant Setup
Generated instruction packs plus the documented MCP-friendly retrieval path.
Open Assistant Setup