#+TITLE: SKILL: Multi-Modal Diagrammer (Universal Literate Note) #+ID: skill-diagrammer #+STARTUP: content #+FILETAGS: :visual:diagram:mermaid:psf: * Overview The *Multi-Modal Diagrammer* enables the agent to communicate complex architectural plans visually using Mermaid.js and D2 synthesis. * Phase A: Demand (PRD) :PROPERTIES: :STATUS: FROZEN :END: ** 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 #+begin_src lisp :tangle projects/org-skill-diagrammer/src/diagram-logic.lisp (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))) #+end_src * Registration #+begin_src lisp (defskill :skill-diagrammer :priority 60 :trigger (lambda (context) (eq (getf (getf context :payload) :sensor) :visualize)) :neuro #'neuro-skill-diagrammer :symbolic (lambda (action context) action)) #+end_src