From 98771afa86a971ee63131ae2bd305a9ed64d6867 Mon Sep 17 00:00:00 2001 From: nusquama Date: Thu, 13 Nov 2025 13:23:32 +0100 Subject: [PATCH] creation --- .../readme-7609.md | 272 ++++++++++++++++++ 1 file changed, 272 insertions(+) create mode 100644 workflows/Convert POML to AI-Ready Prompts & Chat Messages with Zero Dependencies-7609/readme-7609.md diff --git a/workflows/Convert POML to AI-Ready Prompts & Chat Messages with Zero Dependencies-7609/readme-7609.md b/workflows/Convert POML to AI-Ready Prompts & Chat Messages with Zero Dependencies-7609/readme-7609.md new file mode 100644 index 000000000..a1afe1028 --- /dev/null +++ b/workflows/Convert POML to AI-Ready Prompts & Chat Messages with Zero Dependencies-7609/readme-7609.md @@ -0,0 +1,272 @@ +Convert POML to AI-Ready Prompts & Chat Messages with Zero Dependencies + +https://n8nworkflows.xyz/workflows/convert-poml-to-ai-ready-prompts---chat-messages-with-zero-dependencies-7609 + + +# Convert POML to AI-Ready Prompts & Chat Messages with Zero Dependencies + +--- + +## 1. Workflow Overview + +This n8n workflow titled **"Convert POML to AI-Ready Prompts & Chat Messages with Zero Dependencies"** is designed to transform POML (Project Object Markup Language) — a structured XML-like markup format — into AI-consumable text prompts or chat message arrays without relying on external libraries. It supports contextual variable substitution, basic content structuring (headings, lists, code blocks, media, tables), and optional schema-driven validation of tags and attributes. + +The workflow’s main use cases include: + +- Converting structured authoring content (POML) into ready-to-use prompts for AI models. +- Generating chat message arrays for conversational AI interfaces. +- Supporting zero-dependency operation within n8n for portability and template-library friendliness. + +### Logical Blocks + +**1.1 Input Initialization** +- Prepares and sets all necessary input variables including POML markup, context for variable substitution, speaker mode flag, list styling, component attribute specifications, and attribute type specifications. + +**1.2 POML Parsing and Compilation** +- Parses the POML string into an abstract syntax tree (AST) using a custom XML-ish tokenizer. +- Recursively compiles the AST into either a Markdown prompt or structured chat messages, applying context variable substitution and respecting component and attribute schemas. + +**1.3 AI Processing** +- Feeds the generated prompt or messages into an AI agent node for further processing or response generation. +- Uses an OpenAI GPT-4.1 mini model as the underlying language model for the AI agent. + +**1.4 Manual Trigger** +- Entry point for manual execution of the workflow. + +**1.5 Documentation and Notes** +- Multiple sticky notes providing detailed instructions, usage examples, limitations, troubleshooting tips, and credits. + +--- + +## 2. Block-by-Block Analysis + +### 2.1 Input Initialization + +**Overview:** +This block sets all input data and parameters required for POML parsing and compilation. It defines the POML markup string, context object for variable substitution, speaker mode toggle, list style preference, and specifications for allowed components and attributes. + +**Nodes Involved:** +- Set_Variables + +**Node Details:** + +- **Set_Variables** + - Type: Set node + - Role: Initializes workflow inputs by defining static variables and objects. + - Configuration: + - `poml`: Contains a sample POML markup string with `` and `` tags with nested lists. + - `context`: JSON object describing project metadata (name, audience, timeframe, methods, success criteria) for variable substitution. + - `speakerMode`: Boolean flag set to `true` indicating output should be chat messages rather than plain prompt text. + - `listStyle`: String set to `dash` indicating the default bullet style for lists. + - `componentSpec`: Object defining allowed component tags and their allowed attributes, supporting case-insensitivity and detailed schema-driven validation. + - `attributeSpec`: Array specifying attribute types, descriptions, and applicable components (e.g., `boolean`, `integer`, `string`, `ai/human/system` roles). + - Input connections: Receives trigger from manual trigger node. + - Output connections: Passes data to the `Parse_POML` code node. + - Edge cases: Incorrect or missing inputs here will propagate errors downstream; static assignment reduces dynamic failure risk. + +--- + +### 2.2 POML Parsing and Compilation + +**Overview:** +This block translates the POML markup string into a Markdown prompt or structured chat messages, applying context substitutions and respecting component and attribute specifications. It uses a zero-dependency custom JavaScript parser and compiler implemented in an n8n Code node. + +**Nodes Involved:** +- Parse_POML + +**Node Details:** + +- **Parse_POML** + - Type: Code node (Function) + - Role: Parses POML markup to AST, compiles into prompt text or chat message array. + - Configuration highlights: + - Implements a minimal XML-ish tokenizer to convert POML string to AST. + - Performs substitution of `{{dot.path}}` style variables using provided context. + - Normalizes component and attribute specifications for validation and coercion. + - Supports a subset of tags: headings (``), text blocks (`

`, ``), emphasis (``, ``), lists (``, ``), code (``), media (``, `