| category | wiki-concept | ||||
|---|---|---|---|---|---|
| updated | 2026-05-30 | ||||
| tags |
|
This document details the categories, keywords, conflict matrices, affinity scoring formulas, and LLM core prompts used inside the PLG compilation engine (semanticCompiler.js).
The compiler employs an offline rule-based dictionary categorizing prompt fragments into 9 core dimensions. Each category carries a priority weight to enforce proper prompt structure (subject first, environmental details later, styles and effects at the end).
| Category Name | Identifier | Priority | Sample Core Keywords |
|---|---|---|---|
| Subject | subject |
100 |
man, woman, creature, ghost, zombie, portrait, entity, face |
| Environment | environment |
90 |
hospital, forest, city, ruins, dungeon, background, hallway |
| Action | action |
80 |
running, standing, screaming, floating, crawling, staring |
| Emotion | emotion |
70 |
scary, eerie, unsettling, peaceful, melancholic, sinister |
| Lighting | lighting |
60 |
dark, candles, moonlight, neon, volumetric, shadows |
| Style | style |
50 |
ps1, ps2, realistic, cartoon, anime, low poly, watercolor, retro |
| Camera | camera |
40 |
close-up, wide shot, fisheye, macro, dutch angle, tracking, pov |
| Effects | effects |
30 |
grain, particles, glitch, vignette, chromatic aberration, bloom |
| Detail | detail |
45 |
(Fallback for general descriptors, has no custom keyword catalog) |
To prevent stylistic contradictions (e.g., prompting for a highly realistic cartoon), the compiler matches tokens against a 2D conflict matrix:
export const CONFLICTS = [
['realistic','cartoon'], ['photorealistic','cartoon'], ['realistic','anime'], ['photorealistic','anime'],
['realistic','toon'], ['hyperrealistic','pixel'], ['dark','bright'], ['day','night'], ['dawn','dusk'],
['colorful','monochrome'], ['detailed','minimalist'], ['cute','horror'], ['cute','terrifying'],
['peaceful','terrifying'], ['happy','horror'], ['calm','chaotic'], ['clean','grunge']
];When evaluating compatibility, the compiler calculates the overlap weight:
Where:
- Overlap Tokens: Common words shared between the candidate and the baseline positive stream (multiplied by 2).
-
Category Affinity: Added (
$+1$ ) if the candidate category's keywords already exist in the baseline context text. - Priority Weight: Normalised contribution from the categories dictionary.
-
Conflicts Penalty: Deducts
$3.0$ points for every matched conflict term pair.
When in AI Mode, the compiler bypasses offline rules and triggers direct prompt generation prompts to the active AI endpoint.
- System Prompt:
You are the AI compiler for an "AND Gate" inside a visual prompt-building IDE. Your job is to take the current positive prompt baseline and merge it with two new prompt fragments (A and B). You must merge them into a single, cohesive positive prompt: (1) rank foundational elements (subjects, environments) first, style/modifiers later; (2) remove duplicates or highly redundant statements; (3) maintain proper flow. Respond with ONLY the optimized, merged positive prompt text, no markdown, no quotes, no extra commentary. - User Input:
Baseline Positive Prompt So Far: "{baselinePos}" New Fragment A: "{A}" New Fragment B: "{B}" Return the merged prompt:
- System Prompt:
You are the AI compiler for an "OR Gate" inside a visual prompt-building IDE. Your job is to read the current positive prompt context and evaluate two competing candidate prompt fragments (A and B). You must select the SINGLE best candidate that is most semantically compatible with the current context, explain your choice in one sentence, and output the updated positive prompt. Respond with STRICT JSON in this format: {"selected": "A" or "B", "reason": "Your brief explanation", "updated_prompt": "The consolidated prompt including the chosen candidate"} - User Input:
Baseline Positive Prompt Context So Far: "{baselinePos}" Candidate Prompt A: "{A}" Candidate Prompt B: "{B}" Return JSON:
- System Prompt:
You are the AI compiler for a "NOT Gate" inside a visual prompt-building IDE. Your job is to read the current prompt baseline and a concept to suppress (A). You must: (1) strip any positive trace or reference of A from the prompt if it exists, (2) append a natural clause or instruction explicitly stating not to do, use, or include A and related concepts (e.g. "avoid A", "without A", "do not include A"). Respond with STRICT JSON in this format: {"updated_positive": "The sanitized prompt with explicit negation instructions built-in"} - User Input:
Baseline Prompt: "{baselinePos}" Concept to Suppress (NOT A): "{A}" Return JSON:
- System Prompt:
(If preceding questions exist, the system appends):
You are an expert AI prompt engineer. Your job is to analyze the positive prompt compiled so far, identify any gaps, ambiguities, or unclear stylistic directions, and generate a list of exactly {count} crucial clarifying questions that the user should answer to make the prompt perfect. If the prompt is empty or very short, ask foundational questions about what the user wants to create. You must respond with STRICT JSON containing a list of strings: {"questions": ["Clarifying question 1", ..., "Clarifying question {count}"]}. No commentary, no markdown.CRITICAL CONSTRAINT: You MUST NOT ask any questions that are semantically identical or highly similar to the following questions which have ALREADY been asked: {excludedQs} Generate {count} entirely NEW and different questions.
- System Prompt:
You are an expert AI prompt engineer. Your job is to take a baseline positive prompt, a list of clarifying questions, and the user's typed answers, and synthesize them into a single, cohesive, highly optimized positive prompt. You must: 1. Merge the answers naturally and seamlessly into the flow of the baseline prompt. 2. Maintain proper structure (foundational details first, modifier elements later). 3. Do NOT include the questions or literal "Clarification on Q..." strings. Just output the refined, integrated prompt text. 4. Keep the output extremely clean. Respond with ONLY the optimized, merged positive prompt text. No markdown, no quotes, no extra commentary.
The semantic compiler supports three distinct compilation depth settings (Normal, Thinking, and DeepThinking), allowing the visual circuit output to be formatted in different levels of density and styling.
- Behavior: Executes the topological compilation and outputs the final de-conflicted baseline list of visual tokens separated by commas.
- Aesthetic: Direct, clean, and optimized for immediate baseline parsing.
- AI Prompt:
You are a professional prompt architect. Your task is to take a raw list of prompt tokens and rephrase them into a cohesive, natural, highly detailed, and beautifully styled positive prompt. Enhance the visual descriptors, vocabulary, and sensory details while retaining all original concepts. Output ONLY the rephrased prompt itself, with NO quotes, NO introductory text, and NO markdown. - Offline/Rule-Based Fallback:
Filters kept visual elements and groups them by their visual category. Synthesizes a structured natural paragraph:
A masterpiece showcasing [Subject] [Action] set within a highly detailed [Environment], evoking a strong sense of [Emotion]. The scene is beautifully illuminated with [Lighting] lighting, captured from a stunning [Camera] perspective. The artistic aesthetic is rendered in [Style] style with subtle [Effects] visual effects. Enriched with intricate details including [Detail].
- AI Prompt:
You are a principal prompt architect and visual director. Your task is to compile the given visual prompt elements into an exhaustive, highly structured prompt specification document. Organize the output into these distinct sections using a premium Markdown layout: # VISUAL SPECIFICATION DOCUMENT ## 1. PRIMARY SUBJECT & DIRECTIVES - **Focus**: [Subject details] - **Action/Narrative**: [Vivid description of subject actions] - **Emotional Profile**: [Expressions and mood] ## 2. ENVIRONMENT & SPACE - **Location & Architecture**: [Spatial settings and background elements] - **Atmosphere & Depth**: [Climate, depth levels, and environmental details] ## 3. LIGHTING & COMPOSITION - **Lighting setup**: [Types, directions, colors, and shadows] - **Camera Framing**: [Shot type, lens, angle, and distance] ## 4. STYLE & TECHNICAL ARTISTRY - **Art Medium**: [Style description, artistic emulations] - **Effects & Grading**: [Grain, lens effects, particles, post-processing] ## 5. NEGATIVE DIRECTIVES - **Explicitly Suppress**: [Instruct to avoid these negative/suppressed concepts] Integrate all raw prompt elements naturally. Do not include meta-commentary or preambles. Output ONLY the beautifully structured Markdown specifications block. - Offline/Rule-Based Fallback: Outputs a premium visual specifications document in Markdown structure, complete with bulleted category lists for all connected visual nodes, and a dedicated negative directives section.
To optimize de-confliction and semantic ranking across highly diverse generation tasks (e.g. creating a Midjourney landscape vs. a React component class), the compiler implements a Priority Manager.
The Priority Manager maintains five distinct semantic domains, each loading its own vocabulary catalog, conflict matrices, and category hierarchies:
- Image (
image): Tailored for cinematic artistic prompts. Prioritizes camera setups, ambient lighting, emotional profiles, and post-processing effects. - Code (
code): Tailored for high-fidelity code specifications. Prioritizes syntax rules, parameter casing standards, design patterns, and performance constraints (perf_rules). - Debug (
debug): Tailored for error diagnosis and logging. Prioritizes diagnostic patterns, stack trace formats, error categories, and testing assertions. - Architecture (
architecture): Tailored for system design. Prioritizes dependency structures, interface specifications, structural constraints, and API layouts. - GUI (
gui): Tailored for user interface layouts. Prioritizes color tokens (HSL), grid layouts, responsive padding rules, and interaction transitions.
When the compiler's priority schema is set to Auto Detect (auto), it executes a lexical classification scan across the positive prompt baseline stream.
Where:
-
$\text{Count}(w)$ : Frequency of keyword$w$ in the active prompt stream. -
$\text{Weight}_{d}(w)$ : Semantic weight parameter mapping keyword$w$ to domain$d$ .
- The baseline classifier matches tokens against a dynamic keyword database.
-
Pivoting Threshold: If the highest-scoring domain scores
$\ge 2$ points, the compiler dynamically swaps the baseline de-confliction matrix and keyword catalogs to the winning domain. - Tie-Breaking: If scores are equal, the compiler defaults to the Image domain for visual tasks, or Code for programming tasks.
When a Context Memory (Memory Bank) node is connected and marked active (enabled: true), the compiler enforces strict alignment boundaries on all downstream AI gates. The system injects a comprehensive AI Memory Aligner Prompt into the LLM system context.
When calling the LLM endpoint, the system automatically appends the following alignment context:
========================================================================
CRITICAL INSTRUCTION: STAGE EXPLICIT ALIGNMENT WITH COMPRESSED CONTEXT MEMORY
========================================================================
You must strictly align your generated visual prompt with the following active Context Memory Ledger.
[ACTIVE MEMORY LEDGER]
{extractedMemory}
Strict Sync Invariants:
1. PRESERVE VARIABLE CASING: You must preserve the letter casing and naming conventions of all indexed code variables (e.g. camelCase, PascalCase, snake_case) with 100% fidelity. Do not alter casing, abbreviations, or symbols.
2. ADHERE TO SEMANTIC CONSTRAINTS: Respect all aesthetic rules, color palettes, and formatting constraints declared in the style ledger.
3. PREVENT CONFLICTS: Do not generate concepts that contradict the system rules and invariants listed in the ledger.
4. UNIFIED INLINE NEGATION: Strip out any obsolete negative prompt elements and replace them with direct inline negation suppression directives.
========================================================================
This alignment ensures that even in AI Mode, the LLM preserves precise parameter specs, variables, and color tokens defined inside raw workspace files.