Files
memex/notes/org-skill-diagrammer.org

1.6 KiB

SKILL: Multi-Modal Diagrammer (Universal Literate Note)

Overview

The Multi-Modal Diagrammer enables the agent to communicate complex architectural plans visually using Mermaid.js and D2 synthesis.

Phase A: Demand (PRD)

1. Purpose

Enable visual communication of plans and system states.

2. User Needs

  • Mermaid Synthesis: Generate valid Mermaid.js graph code.
  • D2 Support: Support D2 for complex layout requirements.
  • Org-Integration: Embed results in `#+begin_src mermaid` blocks.

Phase D: Build (Implementation)

Synthesis Logic

(defun synthesize-mermaid (nodes edges)
  "Creates a Mermaid graph string from a list of nodes and edges."
  (let ((header "graph TD"))
    (format nil "~a~%~{  ~a --> ~a~%~}" header 
            (loop for e in edges append (list (car e) (cdr e))))))

(defun neuro-skill-diagrammer (context)
  "Neural stage: Converts a plan description into a visual graph structure."
  (let* ((payload (getf context :payload))
         (plan (getf payload :plan)))
    (format nil "
      Generate a Mermaid.js graph for the following plan:
      ---
      ~a
      ---
      Return only the Mermaid code block.
    " plan)))

Registration

(defskill :skill-diagrammer
  :priority 60
  :trigger (lambda (context) (eq (getf (getf context :payload) :sensor) :visualize))
  :neuro #'neuro-skill-diagrammer
  :symbolic (lambda (action context) action))