Mindmap API for people, scripts and AI agents
← Back to the editor · Plain-text version (llms.txt) · Source
How it works
Mindmap is a static site. Maps are stored in your browser (IndexedDB) and never leave it unless you export them. There is no server, so there is no HTTP endpoint; instead the page itself is the API. Everything the editor does goes through one set of operations, and anything that can reach those operations has the same editing power as you. Three transports exist:
| Transport | Who it is for | Setup |
|---|---|---|
| Paste | Any AI, including chat assistants that cannot browse | None |
| Links | Any AI that can write a URL, bookmarks, other apps | None |
window.mindmap | Browser-driving agents (Claude in Chrome, Playwright, extensions), the devtools console | None; the object is always present |
Every change records an author. Nodes added by someone other than you get a small badge, and the Log tab shows who did what, so AI edits are visible and reversible (undo works on them too). Notes are comments attached to a node or the map, kept separate from node text so an agent can annotate without rewriting your words.
1. Paste round trip
- In the editor choose Export ▾ Copy JSON (complete) or Copy outline (compact markdown) and give it to the AI.
- Ask for a change. The AI replies with an outline, an operations array, or an edited map JSON.
- Select the node the material belongs under, then press Ctrl+V on the canvas, or paste into the AI / API panel and click Apply (there you can also set the author name).
Pasted outlines are added under the selected node (or the root). Operation arrays are applied to the open map. A full map JSON is imported as a new map.
2. Link commands
Open a URL of the form https://odoluca.github.io/mindmap/#command=value. One command per link. The value is either URL-encoded text/JSON or base64url prefixed with b64: (use mindmap.encodeForUrl(value) or mindmap.linkFor('ops', ops) to build one). The hash never reaches a server. After running, the command is removed from the address bar.
| Command | Effect |
|---|---|
#ops=[…] | Apply an operations array to the open map (the last-used map is opened first). |
#outline=… | Create a new map from a markdown outline (its first heading or item becomes the name). |
#import={…} | Import a full map JSON as a new map and open it. |
#open=<id> | Open the map with that id. |
#cmd={…} | General form: {"ops":[…], "author":"claude"}, {"outline":"…", "parent":"Node text", "append":true}, {"open":"id"}, {"map":{…}}. Keys can be combined; open runs first. |
https://odoluca.github.io/mindmap/#ops=[{"op":"addNode","text":"Ideas from today","color":"green"}]
https://odoluca.github.io/mindmap/#outline=%23%20Trip%0A-%20Pack%0A%20%20-%20Passport%0A-%20Book%20hotel
3. window.mindmap
A global object on the editor page. Node references (parent, from, to, id, target) accept a node id or a node text when that text is unique. Results are plain JSON copies. Call mindmap.help() for a short reminder.
| Call | Returns | Notes |
|---|---|---|
listMaps() | Promise of [{id, name, kind, nodes, updatedAt}] | Newest first. |
getMap() | The open map (JSON) | Synchronous. |
getMapById(id) | Promise of a map | Does not open it. |
openMap(id), createMap({name, kind, root}), importMap(json), deleteMap(id) | Promises | kind is mindmap or flowchart. |
apply(ops, {author}) | {ok:true, results:[…]} or {ok:false, error, index} | Atomic. One undo step. |
addNode(text, parent, extra) | new id | extra: shape, color, notes, tags, index, author… |
addTree(parent, nodes) | ids | nodes: [{text, children:[…]}] or strings. |
updateNode(id, fields), deleteNode(id, cascade) | id / ids | |
link(from, to, label, extra) | edge id | extra: directed, style, color. |
note(text, target) | note id | target null = map note. |
getNode(ref), find(query), children(ref), roots(), notes(ref), log(limit) | JSON | find searches text, notes and tags. |
outline(), addOutline(markdown, parent) | markdown / ids | |
describe() | one-line summary | |
select(ids), selection(), centerOn(id), fit(), undo(), redo() | — | View helpers. |
on(event, fn) | unsubscribe function | Events: change ({id, ops, author}), open, select. |
author | string property | Default author for calls without one (initially assistant). Set it to your name, for example mindmap.author = 'claude'. |
encodeForUrl(value), linkFor(command, value) | string | Build link commands. |
ops, shapes, colors, layouts, edgeStyles | arrays | The allowed values. |
mindmap.author = 'claude';
const map = mindmap.getMap();
const ids = mindmap.addTree('Research', [
{ text: 'Read papers', children: ['Survey A', 'Survey B'] },
{ text: 'Run experiment', shape: 'diamond', color: 'orange', notes: 'needs the GPU box' },
]);
mindmap.link(ids[0], 'Run experiment', 'then');
mindmap.note('Outline drafted from the meeting notes.', 'Research');
mindmap.fit();
Map JSON
{
"app": "mindmap", "version": 1,
"id": "m3k1…", "name": "Project plan", "kind": "mindmap",
"createdAt": "2026-11-09T10:00:00.000Z", "updatedAt": "…",
"settings": { "layout": "mindmap", "edgeStyle": "curved", "showAuthors": true },
"view": { "x": 0, "y": 0, "scale": 1 },
"nodes": [
{ "id": "n1", "text": "Project plan", "notes": "", "shape": "rounded", "color": "default",
"parent": null, "x": 0, "y": 0, "w": null, "h": null, "collapsed": false, "tags": [],
"author": "user", "createdAt": "…", "updatedAt": "…" },
{ "id": "n2", "text": "Phase 1", "parent": "n1", "color": "blue", … }
],
"edges": [ { "id": "e1", "from": "n2", "to": "n5", "label": "blocks", "directed": true, "style": null, "color": "default", "author": "user", "createdAt": "…" } ],
"notes": [ { "id": "c1", "target": "n2", "text": "Agreed on Monday", "author": "claude", "createdAt": "…" } ],
"log": [ { "at": "…", "author": "claude", "op": "addNote", "id": "c1", "summary": "Note on \"Phase 1\": Agreed on Monday" } ]
}
- The tree is given by
parent. Sibling order is the order of thenodesarray. Parent links are drawn automatically;edgesare extra links (cross references, flowchart arrows). shape:roundedrectellipsediamondparallelogramstadiumhexagoncylinderstickytext.color:defaultredorangeyellowgreentealbluepurplepinkgray.settings.layout:mindmaprightdownradiallayered-downlayered-rightfree. In every mode butfreethe positions are computed automatically andx/yare overwritten; infreethey are used as given.settings.edgeStyle:curvedstraightorthogonal. An edge's ownstyleoverrides it.w/hfix a node's size;nullmeans "fit the text".- Unknown fields are dropped and invalid references repaired on import, so a partially correct file still loads.
Operations
An operation is an object with an op key. Lists are applied in order and atomically: if one fails, nothing changes and the error names the failing index. Each operation records a log entry with the author.
| Operation | Fields | Result |
|---|---|---|
addNode | text, parent?, shape?, color?, notes?, tags?, index?, x?, y?, collapsed?, id?Omit parent for the root (mind maps) or a floating node (flowcharts); null forces floating. index is the position among siblings. | {id} |
addTree | parent?, nodes: array of {text, notes?, shape?, color?, tags?, children?:[…]} or plain strings | {ids} in depth-first order |
updateNode | id plus any of text notes shape color tags collapsed parent index x y w h | {id} |
moveNode | id, parent (null = top level), index? | {id} |
deleteNode | id, cascade? (default true; false re-attaches children to the grandparent) | {ids} removed |
addEdge | from, to, label?, directed? (default true), style?, color? | {id} |
updateEdge | id plus any of label directed style color from to | {id} |
deleteEdge | id | {id} |
addNote | text, target? (node or null for the map) | {id} |
updateNote / deleteNote | id, text | {id} |
setMap | name?, kind?, settings? (layout, edgeStyle, showAuthors, grid: snap-to-grid size in px for free placement, 0 = off), view? | {id} |
layout | mode, once? (apply to coordinates but keep the free mode) | {relayout} |
replaceMap | map: a full map JSON whose content replaces the open map's nodes, edges, notes and settings (the id stays) | {id} |
Outline format
The compact text form, used by Export ▾ Copy outline, by #outline= and by paste. It is ordinary markdown.
# Map name
- Root idea
- First branch {color=blue}
- Leaf with notes
> Notes can span
> several lines
- Decision {shape=diamond tags=risk,todo}
- Second branch
## Links
- Leaf with notes -> Second branch: see also
- First branch -- Second branch
## Notes
- A note on the whole map
- Two spaces (or a tab) per level. Bullets (
-,*,1.) are optional, so tab-indented plain text also works. - Lines starting with
>become the notes of the item above. {shape=… color=… tags=a,b}at the end of a line sets node properties.## Linkslists extra links by node text:->for an arrow,--for a plain line,: labeloptional.
Examples
Ask an AI to extend a branch (paste)
Here is my mind map as an outline: … (paste)
Add five sub-points under "Marketing" as a markdown outline, nothing else.
Select "Marketing", press Ctrl+V.
Operations array (paste or #ops=)
[
{ "op": "addTree", "parent": "Marketing", "nodes": [
{ "text": "Launch post", "children": ["Draft", "Review", "Publish"] },
{ "text": "Newsletter", "color": "teal" } ] },
{ "op": "addNote", "target": "Marketing", "text": "Suggested by Claude on request; adjust dates." },
{ "op": "updateNode", "id": "Old item", "color": "gray", "notes": "superseded by the launch post" }
]
A flowchart from scratch (window.mindmap)
await mindmap.createMap({ name: 'Login flow', kind: 'flowchart' });
mindmap.apply([
{ op: 'addNode', id: 'start', text: 'Start', shape: 'stadium' },
{ op: 'addNode', id: 'creds', text: 'Enter credentials', shape: 'parallelogram' },
{ op: 'addNode', id: 'ok', text: 'Valid?', shape: 'diamond', color: 'yellow' },
{ op: 'addNode', id: 'home', text: 'Show home', shape: 'rect' },
{ op: 'addNode', id: 'end', text: 'End', shape: 'stadium' },
{ op: 'addEdge', from: 'start', to: 'creds' },
{ op: 'addEdge', from: 'creds', to: 'ok' },
{ op: 'addEdge', from: 'ok', to: 'home', label: 'yes' },
{ op: 'addEdge', from: 'ok', to: 'creds', label: 'no' },
{ op: 'addEdge', from: 'home', to: 'end' },
{ op: 'layout', mode: 'layered-down', once: true },
], { author: 'claude' });
Watch for changes
mindmap.on('change', ({ author, ops }) => console.log(author, 'applied', ops.length, 'operations'));