/ir-generate

PVM L2+ Production low usage

/ir-generate

Overview

/ir-generate is a production command in the PVM category of the Prismatic Platform that transforms natural language descriptions into fully structured Intermediate Representation (IR) workflows. This command bridges the gap between human intent and machine-executable workflow specifications by leveraging the ir-generator agent's deep understanding of IR syntax, semantics, and optimization patterns.

The ability to generate IR from natural language descriptions is a cornerstone of the Prismatic Platform's accessibility philosophy. Rather than requiring developers to learn the complete IR specification before building workflows, /ir-generate allows them to describe their desired data flow, processing steps, and error handling requirements in plain English and receive a valid, optimized IR workflow as output. The generated IR is not a rough draft -- it is production-quality code that passes all validation and linting checks.

This command operates under the L2+ authority level and is executed by the ir-generator agent, which combines natural language understanding capabilities with comprehensive knowledge of the IR specification, PVM execution semantics, and platform best practices. It is part of the platform's 216-command slash command registry, built on the AIAD (Autonomous Intelligence Agent Design) standard.

The generation process is not a simple template fill -- it involves semantic analysis of the natural language input, identification of required processing stages, construction of an optimal DAG topology, type inference for all data flows, and insertion of appropriate error handling and retry logic. The result is a complete IR workflow that would be indistinguishable from one authored by an expert IR developer.

Architecture

The generation pipeline processes natural language input through multiple transformation stages, each adding structure and refinement.

+---------------------+     +-------------------+     +------------------+
| NL Parser           | --> | Intent Extractor  | --> | DAG Builder      |
| (Tokenize + Parse)  |     | (Semantic Analysis)|    | (Topology Design)|
+---------------------+     +-------------------+     +------------------+
         |                          |                          |
         v                          v                          v
+---------------------+     +-------------------+     +------------------+
| Context Resolver    |     | Type Inferencer   |     | IR Emitter       |
| (Platform Entities) |     | (Flow Analysis)   |     | (Code Generation)|
+---------------------+     +-------------------+     +------------------+
                                                               |
                                                               v
                                                      +------------------+
                                                      | Post-Processing  |
                                                      | (Validate + Lint)|
                                                      +------------------+

The NL Parser tokenizes and parses the natural language input, identifying key concepts, relationships, and constraints. The Intent Extractor performs semantic analysis to determine the user's intended workflow structure, including data sources, transformations, and outputs. The DAG Builder constructs an optimal directed acyclic graph topology based on the extracted intent, considering parallelization opportunities and dependency ordering. The Type Inferencer analyzes data flows through the DAG to assign types to all edges, ensuring type safety. The IR Emitter generates syntactically correct IR code from the enriched DAG, and the Post-Processing stage runs validation and linting to ensure the output meets production quality standards.

Usage

Basic Generation

# Generate from a natural language description
/ir-generate "Fetch data from the REST API, transform JSON to CSV, and upload to S3"

# Generate with explicit output file
/ir-generate "Process user events in parallel, aggregate by session, and store results" --output event_pipeline.ir

# Generate from a description file
/ir-generate --from-file requirements.txt

Guided Generation

# Interactive guided generation with prompts
/ir-generate --interactive

# Generate with constraints
/ir-generate "Build ETL pipeline for financial data" --max-parallelism 4 --error-strategy retry

# Generate with specific node types
/ir-generate "Data validation pipeline" --prefer-nodes validator,transformer,aggregator

Generation with Context

# Generate using existing workflows as style reference
/ir-generate "Similar to data_pipeline but for user analytics" --reference workflows/data_pipeline.ir

# Generate with platform entity resolution
/ir-generate "Use the OSINT investigator to analyze domain, then score with perimeter agent"

# Generate with explicit type constraints
/ir-generate "Process image batch" --input-type "list(binary)" --output-type "list(map)"

Iterative Refinement

# Generate initial version
/ir-generate "Build monitoring workflow" --output monitor.ir

# Refine generated workflow with additional requirements
/ir-generate --refine monitor.ir "Add alerting when metrics exceed thresholds"

# Optimize generated workflow for performance
/ir-generate --optimize monitor.ir --target latency

Options & Parameters

OptionTypeDefaultDescription
(positional)stringrequiredNatural language description of the desired workflow
--outputstringstdoutOutput file path for the generated IR
--from-filestring-Read description from a file instead of command line
--interactivebooleanfalseEnable interactive guided generation mode
--referencestring-Existing IR file to use as style and pattern reference
--refinestring-Existing IR file to refine with additional requirements
--optimizestring-Existing IR file to optimize for a specific target
--targetstringbalancedOptimization target: latency, throughput, memory, balanced
--max-parallelismintegerautoMaximum parallel execution paths in generated DAG
--error-strategystringretryError handling strategy: retry, fallback, abort, circuit-breaker
--prefer-nodesstringautoComma-separated list of preferred node types
--input-typestringautoExplicit input type specification
--output-typestringautoExplicit output type specification
--validatebooleantrueRun validation on generated output
--lintbooleantrueRun linting on generated output
--formatstringstandardIR output format: standard, compact, annotated
--dry-runbooleanfalseShow generation plan without producing output
--verbosebooleanfalseShow detailed generation process and decisions

Execution Flow

  1. Input Acquisition: The natural language description is acquired from the command line, a file (--from-file), or through interactive prompts (--interactive). Multi-sentence descriptions are supported and encouraged for complex workflows.

  2. Semantic Parsing: The NL parser breaks the description into semantic units, identifying verbs (operations), nouns (data entities), adjectives (constraints), and connectors (flow relationships). Domain-specific terminology is resolved against the platform's glossary.

  3. Intent Resolution: The intent extractor maps semantic units to IR concepts: operations become nodes, data flows become edges, constraints become node parameters, and connectors become DAG topology decisions.

  4. Context Resolution: Platform entities mentioned in the description (agent names, app references, data sources) are resolved against the live platform registry. Ambiguous references trigger clarification prompts in interactive mode or best-match selection in batch mode.

  5. DAG Construction: The DAG builder constructs the workflow topology, optimizing for the specified target (latency, throughput, memory, or balanced). Parallelization opportunities are identified and exploited up to the --max-parallelism limit.

  6. Type Inference: Data flow types are inferred from node input/output signatures, explicit type constraints, and contextual analysis. Type mismatches are resolved through automatic coercion insertion or reported as errors.

  7. Error Handling Insertion: Error handling logic is inserted according to the specified --error-strategy, including retry policies, fallback paths, circuit breakers, and dead letter queues as appropriate.

  8. IR Emission: The complete IR workflow is emitted in the specified format. The annotated format includes inline comments explaining each generation decision.

  9. Post-Processing: If --validate and --lint are enabled (default), the generated IR is passed through /ir-validate and /ir-lint. Any issues are reported, and in interactive mode, the user is offered the opportunity to refine.

Integration Points

ComponentIntegration TypeDescription
Prismatic AgentsExecutionExecuted by the ir-generator agent
IR ValidatorPost-ProcessingGenerated IR is validated automatically
IR LinterPost-ProcessingGenerated IR is linted for quality
PVM CompilerDownstreamGenerated IR feeds into the PVM compilation pipeline
AIAD RegistryEntity ResolutionPlatform entities referenced in descriptions are resolved
Quality GatesEnforcementGenerated IR must pass all quality gates
TelemetryObservabilityGeneration events and quality metrics tracked

Best Practices

Be specific in your descriptions. The more detail you provide about data sources, transformations, error handling requirements, and output formats, the more accurate the generated IR will be. Vague descriptions produce valid but generic workflows that may require significant refinement.

Use the --reference flag when generating workflows similar to existing ones. The generator uses the reference file to match coding style, node selection patterns, and error handling conventions, producing output that is consistent with your project's existing codebase.

Leverage iterative refinement rather than trying to specify everything in a single description. Start with the core data flow, generate, then use --refine to add error handling, monitoring, and optimization in subsequent passes. This produces better results than monolithic descriptions.

Always review generated IR before deploying to production. While the generator produces high-quality output that passes all validation and linting checks, it cannot fully understand business-specific constraints or performance requirements that were not expressed in the natural language description.

Use --dry-run for complex workflows to preview the generation plan before committing to output. The dry-run shows the identified intent, proposed DAG topology, and type assignments without generating the full IR.

Error Handling

Error ConditionResponseRecovery
Ambiguous descriptionLists possible interpretations for clarificationRefine description or use --interactive mode
Unknown platform entityReports unresolved references with suggestionsCorrect entity name or use explicit node types
Type conflict in inferred flowShows conflicting types with source analysisAdd explicit --input-type or --output-type
Unsatisfiable constraintsExplains which constraints conflictRelax constraints or restructure description
Validation failure on outputShows validation errors with generation contextRefine description or manually edit output
Reference file not foundExits with path suggestionVerify reference file path

Doctrine Compliance

All commands operate under the NO MERCY, NO DOUBTS doctrine:

  • NO MERCY: Zero tolerance for incomplete execution or quality violations. Generated IR must pass all validation and linting checks. The generator never produces "draft" or "skeleton" output -- every generated workflow is complete and production-ready. Incomplete generation due to ambiguity results in explicit error reporting rather than best-guess output.
  • NO DOUBTS: Full investigation before action, evidence-based results. The generator performs full semantic analysis before emitting any IR. All generation decisions are traceable through the --verbose flag, and the annotated format includes inline justification for each decision.
  • /ir-validate - Comprehensive validation of IR workflows with DAG analysis and type safety
  • /ir-lint - Static analysis and code quality enforcement for IR workflows
  • /ir-benchmark - Comprehensive performance benchmarking with Benchee integration for IR workflows
  • /ir-examples - Interactive examples, templates and learning resources for IR workflows
  • /pvm-compile - Compile validated IR to optimized PVM bytecode
  • /pvm-execute - Execute compiled PVM programs with fault tolerance and real-time monitoring
  • /pvm-trace - Real-time execution tracing and debugging for PVM programs
  • /doc - Technical documentation and API reference generation

Connect & Contribute

Created by Tomáš Korcak (korczis) | Open Source under GHL