Collaborate in Nereid Mermaid sessions via MCP using AST-first, probe-refine workflows for sequence diagrams, flowcharts, xrefs, routes, and walkthroughs. Use when exploring or editing diagrams with a human watching live in TUI, and when coordinating attention through `attention.*`, `follow_ai.*`, and `selection.*`.
Collaborate on Mermaid-backed diagrams in a live, shared TUI/MCP session. Keep context small, edits structured, and attention explicit.
Assume co-presence by default:
Drive collaboration with this state model:
attention_human_read: read the human cursor/attention in TUI.attention_agent_read: read the agent spotlight object.attention_agent_set: move the agent spotlight to one object.attention_agent_clear: clear the agent spotlight.follow_ai_read / follow_ai_set: read or toggle whether TUI follows agent spotlight.selection_read / selection_update: shared working-set selection (multi-object).Treat these as separate concerns:
nereid-session.meta.json, diagrams/*.mmd, walkthroughs/*.wt.json) are app-managed snapshots and can be rewritten frequently while Nereid runs.ObjectRef everywhere: d:<diagram_id>/<category...>/<object_id>.
Supported category pairs are seq/participant, seq/message, seq/block, seq/section,
flow/node, flow/edge, class/class, class/relation, er/entity, er/relationship,
gantt/section, gantt/task, and gantt/lane.diagram_stat, diagram_get_slice, diagram_diff, walkthrough_diff).seq_*, flow_*, xref_*, route_find) before large snapshots.base_rev and keep ops minimal.| Kind | Mermaid header | Canonical object categories | Mutation path |
|---|---|---|---|
| Sequence | sequenceDiagram | seq/participant, seq/message, seq/block, seq/section | structured seq_* ops or Mermaid replace |
| Flowchart | flowchart / graph | flow/node, flow/edge | structured flow_* ops or Mermaid replace |
| Class | classDiagram | class/class, class/relation | Mermaid replace |
| ER | erDiagram | er/entity, er/relationship | Mermaid replace |
| Gantt | gantt | gantt/section, gantt/task, gantt/lane | Mermaid replace |
Creation, raw Mermaid reads, text rendering, xrefs, selection, and attention work for all five
kinds. diagram_get_ast and object_read return kind-specific fields, including class members,
typed ER cardinalities, and Gantt sections, starts, durations, and dependencies. Typed mutation ops
and dedicated query helpers remain sequence/flow-specific, so edit class, ER, and Gantt diagrams
with Mermaid replace. gantt/lane refs identify rendered time headers; prefer task or section refs
for structural probing.
src/, tests/, docs/, or data/ to answer runtime collaboration questions.diagram_list, diagram_open, diagram_delete, diagram_current, diagram_create_from_mermaiddiagram_stat, diagram_get_slice, diagram_diff, diagram_read, diagram_get_ast, diagram_render_textdiagram_propose_ops, diagram_apply_ops, diagram_replace_from_mermaidwalkthrough_list, walkthrough_open, walkthrough_currentwalkthrough_stat, walkthrough_diff, walkthrough_read, walkthrough_get_node, walkthrough_render_textwalkthrough_apply_opsattention_human_read, attention_agent_read, attention_agent_set, attention_agent_clear, follow_ai_read, follow_ai_set, selection_read, selection_update, view_read_statexref_list, xref_neighbors, xref_add, xref_removeobject_readroute_findseq_messages, seq_search, seq_traceflow_reachable, flow_paths, flow_cycles, flow_unreachable, flow_dead_ends, flow_degreesdiagram_current -> diagram_list -> diagram_open.walkthrough_current -> walkthrough_list -> walkthrough_open.diagram_create_from_mermaid.attention_human_read, attention_agent_read, follow_ai_read, selection_read.diagram_stat, diagram_get_slice, then one or two typed queries.attention_agent_set to the object currently being discussed.diagram_propose_ops -> diagram_apply_ops.walkthrough_apply_ops for walkthrough refinement.diagram_diff / walkthrough_diff (avoid full re-read unless needed).attention_agent_set before explaining a local change.selection_update for temporary multi-object working sets, not as a focus proxy.diagram_create_from_mermaid (and optional
attention_agent_set); avoid extra diagram_stat, diagram_render_text, or flow_* probes
unless the user asks for inspection/debugging.diagram_create_from_mermaidInput:
{
"mermaid": "flowchart TD\n A --> B",
"diagram_id": "d-my-flow",
"name": "My Flow",
"make_active": true
}
Output:
{
"diagram": {
"diagram_id": "d-my-flow",
"name": "My Flow",
"kind": "flowchart",
"rev": 0
},
"active_diagram_id": "d-my-flow"
}
diagram_deleteInput:
{
"diagram_id": "d-my-flow"
}
Output:
{
"deleted_diagram_id": "d-my-flow",
"active_diagram_id": "d-next"
}
diagram_get_sliceInput:
{
"diagram_id": "d-flow",
"center_ref": "d:d-flow/flow/node/n:a",
"radius": 1,
"depth": 1,
"filters": {
"include_categories": ["flow/node", "flow/edge"],
"exclude_categories": []
}
}
Output:
{
"objects": ["d:d-flow/flow/node/n:a", "d:d-flow/flow/node/n:b"],
"edges": ["d:d-flow/flow/edge/e:ab"]
}
diagram_apply_opsInput:
{
"diagram_id": "d-seq",
"base_rev": 3,
"ops": []
}
Output:
{
"new_rev": 4,
"applied": 1,
"delta": { "added": [], "removed": [], "updated": [] }
}
walkthrough_apply_opsInput:
{
"walkthrough_id": "w:1",
"base_rev": 0,
"ops": []
}
Output:
{
"new_rev": 1,
"applied": 1,
"delta": { "added": [], "removed": [], "updated": [] }
}
object_readInput:
{ "object_ref": "d:d-seq/seq/block/b:0000" }
Output:
{
"objects": [
{
"object_ref": "d:d-seq/seq/block/b:0000",
"object": {
"type": "seq_block",
"kind": "alt",
"header": "guard",
"section_ids": ["sec:0000:00", "sec:0000:01"],
"child_block_ids": []
}
},
{
"object_ref": "d:d-seq/seq/section/sec:0000:00",
"object": {
"type": "seq_section",
"kind": "main",
"header": "ok",
"message_ids": ["m:0000"]
}
}
],
"context": {}
}
attention_human_readInput:
{}
Output:
{
"object_ref": "d:d-auth-flow/flow/node/n:authorize",
"diagram_id": "d-auth-flow"
}
attention_agent_readInput:
{}
Output:
{
"object_ref": "d:d-auth-flow/flow/node/n:authorize",
"diagram_id": "d-auth-flow"
}
attention_agent_setInput:
{
"object_ref": "d:d-auth-flow/flow/node/n:authorize"
}
Output:
{
"object_ref": "d:d-auth-flow/flow/node/n:authorize",
"diagram_id": "d-auth-flow"
}
attention_agent_clearInput:
{}
Output:
{
"cleared": 1
}
follow_ai_readInput:
{}
Output:
{
"enabled": true
}
follow_ai_setInput:
{
"enabled": true
}
Output:
{
"enabled": true
}
selection_updateInput:
{
"object_refs": [
"d:d-auth-flow/flow/node/n:start",
"d:d-auth-flow/flow/node/n:authorize"
],
"mode": "replace"
}
Output:
{
"applied": [
"d:d-auth-flow/flow/node/n:authorize",
"d:d-auth-flow/flow/node/n:start"
],
"ignored": []
}
Use a shallow, typed exploration loop:
attention_human_read or explicit object_ref).diagram_get_slice.seq_*, flow_*, xref_*, route_find).Escalate to global reads (diagram_read, diagram_get_ast, diagram_render_text) only when local probes are insufficient.
diagram_propose_ops before diagram_apply_ops for non-trivial edits.diagram_stat or diagram_diff after apply to confirm resulting rev/state.Prefer structured ops over rewriting Mermaid when editing alt / opt / loop / par:
| Op type | Purpose |
|---|---|
| seq_add_block | Create block + main section (kind: alt/opt/loop/par) |
| seq_update_block | Patch block header |
| seq_remove_block | Remove block tree; messages remain |
| seq_add_section | Add else (under alt) or and (under par) |
| seq_update_section | Patch section header |
| seq_remove_section | Remove empty non-main section |
| seq_set_message_section | Attach/move/detach message membership (section_id: null detaches) |
| seq_add_message | Optional section_id to place message on create |
Rules agents must follow:
order_key order in one diagram_apply_ops.parent_block_id and must sit inside one parent section’s message range.diagram_get_ast or object_read on seq/block / seq/section refs (and diagram_read for Mermaid with blocks).Example batch (add alt/else with two messages):
{
"diagram_id": "d-seq",
"base_rev": 0,
"ops": [
{
"type": "seq_add_block",
"block_id": "b:cache",
"kind": "alt",
"header": "cache",
"main_section_id": "sec:cache:main"
},
{
"type": "seq_add_section",
"section_id": "sec:cache:else",
"block_id": "b:cache",
"kind": "else",
"header": "miss"
},
{
"type": "seq_add_message",
"message_id": "m:hit",
"from_participant_id": "p:A",
"to_participant_id": "p:B",
"kind": "sync",
"text": "hit",
"order_key": 1000,
"section_id": "sec:cache:main"
},
{
"type": "seq_add_message",
"message_id": "m:miss",
"from_participant_id": "p:A",
"to_participant_id": "p:B",
"kind": "sync",
"text": "miss",
"order_key": 2000,
"section_id": "sec:cache:else"
}
]
}
Build walkthroughs as resumable breadcrumbs:
refs).body_md.Use xrefs to preserve cross-diagram semantics:
xref_add for implementation/expansion links.xref_list and xref_neighbors for map and traversal.When mutation fails due to stale base_rev:
diagram_diff or walkthrough_diff from last known rev,current_rev,base_rev.If diff history window is exhausted, fetch a fresh snapshot (diagram_read or walkthrough_read) and resume delta-first flow.
Use diagram_replace_from_mermaid when a bulk rewrite is easier than structure ops:
{
"diagram_id": "d-seq",
"base_rev": 3,
"mermaid": "sequenceDiagram\n A->>B: Hello\n"
}
Behavior:
identity.preserved / identity.dropped / identity.newly_allocated and dangling_xref_ids.Report only what the user needs:
diagram_id/walkthrough_id) and revision movement (base_rev -> new_rev),Use references/mcp-playbooks.md for extra payload templates. Keep this file as the primary protocol and behavior contract.
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer