The GNN (Generalized Notation Notation) Pipeline is a comprehensive 25-step system for processing Active Inference generative models. Each module follows the thin orchestrator pattern where numbered scripts delegate to modular implementations.
- Step 0: template/ - Pipeline template and initialization
- Step 1: setup/ - Environment setup and dependency management
- Step 2: tests/ - Comprehensive test suite execution
- Step 3: gnn/ - GNN file discovery, parsing, and multi-format serialization
- Step 4: model_registry/ - Model versioning and registry management
- Step 5: type_checker/ - Type checking and validation
- Step 6: validation/ - Advanced validation and consistency checking
- Step 7: export/ - Multi-format export generation
- Step 8: visualization/ - Graph and matrix visualization
- Step 9: advanced_visualization/ - Advanced visualization and interactive plots
- Step 10: ontology/ - Active Inference ontology processing
- Step 11: render/ - Code generation for simulation frameworks
- Step 12: execute/ - Execute rendered simulation scripts
- Step 13: llm/ - LLM-enhanced analysis and interpretation
- Step 14: ml_integration/ - Machine learning integration
- Step 15: audio/ - Audio generation and sonification
- Step 16: analysis/ - Advanced statistical analysis
- Step 17: integration/ - System integration and coordination
- Step 18: security/ - Security validation and access control
- Step 19: research/ - Research tools and experimental features
- Step 20: website/ - Static HTML website generation
- Step 21: mcp/ - Model Context Protocol processing
- Step 22: gui/ - Interactive GUI for model construction (includes gui_1, gui_2, gui_3, oxdraw)
- Step 23: report/ - Comprehensive analysis report generation
- Step 24: intelligent_analysis/ - AI-powered pipeline analysis and executive reports
- utils/ - Shared utilities and helper functions
- pipeline/ - Pipeline orchestration and configuration
- api/ - REST API (FastAPI)
- cli/ -
gnnCLI entry point - lsp/ - Language Server Protocol support
- sapf/ - SAPF public entry point (implementation in
src/audio/sapf/) - doc/ - In-repo technical documentation subtree
Safe-by-design contracts and additive live wiring introduced in v3.0.0 ("Long-Running Orchestration"). The three core contracts are pure data layers that generate, validate, and serialize plans without mutating any live infrastructure.
durable_streams.py- Durable observation streams: pure, replayable file/array stream manifests and traces (foundation laid before any live sensor/device stream)run_session.py- Resumable run-session management: durable run manifests, status inspection, and resume semantics for extended acceptance runscontainer_plan.py- Auditable container plans: validated, hardened container plans with static security review and rollback semanticssession_acceptance.py- Live wiring that wraps the manifest-driven model-family acceptance runner in a resumable run sessionrun_manifest.py- Additive, real-object emission turning a completed pipeline run'soutput/artifacts into durable, replayable v3 artifactspipeline_container_plan.py- Generates an auditable, hardened container plan for running the GNN pipeline, derived from the real pipeline config
- gnn/ - GNN Documentation System
- deployment/ - Deployment Documentation
graph TB
subgraph "Orchestrator Layer"
Script[N_Module.py<br/>Thin Orchestrator]
end
subgraph "Module Layer"
Init[__init__.py<br/>Public API]
Processor[processor.py<br/>Core Logic]
Framework[framework/<br/>Framework Code]
MCP[mcp.py<br/>MCP Tools]
end
Script -->|Calls| Init
Init -->|Delegates| Processor
Processor -->|Uses| Framework
Processor -->|Registers| MCP
style Script fill:#e3f2fd
style Init fill:#f3e5f5
style Processor fill:#fff3e0
Numbered Scripts (src/N_module.py):
- Handle argument parsing via
utils.argument_utils.ArgumentParser - Setup logging via
utils.logging.logging_utils.setup_step_logging - Get output directories via
pipeline.config.get_output_dir_for_script - Call module processing functions from
module/__init__.py - Return standardized exit codes (0=success, 1=error, 2=warning)
Module Implementation (src/module/):
- Contains all domain logic in
processor.pyand subdirectories - Provides public API via
__init__.pyexports - Implements explicit error handling, skip statuses, and dependency diagnostics
- Registers MCP tools in
mcp.py
src/
├── 11_render.py # Thin orchestrator (< 150 lines)
├── render/ # Module implementation
│ ├── __init__.py # Public API exports
│ ├── AGENTS.md # This documentation
│ ├── processor.py # Core logic
│ ├── pymdp/ # Framework-specific code
│ ├── rxinfer/
│ └── mcp.py # MCP tool registration
All module processing functions follow this pattern:
def process_module(
target_dir: Path,
output_dir: Path,
verbose: bool = False,
**kwargs
) -> bool:
"""
Main processing function for module.
Parameters:
target_dir: Directory containing input files
output_dir: Directory for output files
verbose: Enable verbose logging
**kwargs: Additional module-specific options
Returns:
True if processing succeeded, False otherwise
"""flowchart TD
Main[src/main.py] -->|Orchestrates| Steps[25 Pipeline Steps]
Steps --> Step0[Step 0: Template]
Step0 --> Step1[Step 1: Setup]
Step1 --> Step2[Step 2: Tests]
Step2 --> Step3[Step 3: GNN]
Step3 --> Step4[Step 4: Registry]
Step4 --> Step5[Step 5: Type Check]
Step5 --> Step6[Step 6: Validation]
Step6 --> Step7[Step 7: Export]
Step7 --> Step8[Step 8: Visualization]
Step8 --> Step9[Step 9: Advanced Viz]
Step9 --> Step10[Step 10: Ontology]
Step10 --> Step11[Step 11: Render]
Step11 --> Step12[Step 12: Execute]
Step12 --> Step13[Step 13: LLM]
Step13 --> Step14[Step 14: ML Integration]
Step14 --> Step15[Step 15: Audio]
Step15 --> Step16[Step 16: Analysis]
Step16 --> Step17[Step 17: Integration]
Step17 --> Step18[Step 18: Security]
Step18 --> Step19[Step 19: Research]
Step19 --> Step20[Step 20: Website]
Step20 --> Step21[Step 21: MCP]
Step21 --> Step22[Step 22: GUI]
Step22 --> Step23[Step 23: Report]
Step23 --> Step24[Step 24: Intelligent Analysis]
Step24 --> Output[output/]
Output --> Summary[pipeline_execution_summary.json]
graph TD
Step3[Step 3: GNN Parse] -->|Parsed Models| Step5[Step 5: Type Check]
Step3 -->|Parsed Models| Step6[Step 6: Validation]
Step3 -->|Parsed Models| Step7[Step 7: Export]
Step3 -->|Parsed Models| Step8[Step 8: Visualization]
Step3 -->|Parsed Models| Step10[Step 10: Ontology]
Step3 -->|Parsed Models| Step11[Step 11: Render]
Step3 -->|Parsed Models| Step13[Step 13: LLM]
Step11 -->|Generated Code| Step12[Step 12: Execute]
Step12 -->|Execution Results| Step16[Step 16: Analysis]
Step5 -->|Type Info| Step6
Step6 -->|Validation Results| Step7
Step7 -->|Exported Data| Step8
Step8 -->|Visualizations| Step16
Step13 -->|LLM Insights| Step16
Step16 -->|Analysis Results| Step23[Step 23: Report]
- The pipeline contains 25 steps and follows the thin orchestrator pattern.
- Module docs and tests are maintained as part of normal development.
- Use current CI/local runs for exact pass counts and performance measurements.
- Visual Progress Indicators: Real-time progress bars and status icons across all pipeline steps
- Color-Coded Output: Consistent color schemes (green=success, yellow=warning, red=error)
- Structured Summaries: Formatted tables showing step metrics, timing, and memory usage
- Correlation ID Tracking: Unique tracking IDs for debugging and monitoring pipeline execution
- Screen Reader Support: Accessible output with emoji-free alternatives for assistive technologies
- Performance Monitoring: Built-in timing and resource consumption tracking with visual displays
- Docs audit:
uv run --extra dev python doc/development/docs_audit.py --strict --check-anchors --no-writereports no broken links, anchor gaps, or AGENTS/README coverage gaps. - GNN doc patterns:
uv run --extra dev python scripts/check_gnn_doc_patterns.py --strictreports no banned GNN documentation patterns. - Tests: command of record is
uv run --extra dev python -m pytest src/tests/ -q --tb=no -rsx --ignore=src/tests/llm/test_llm_ollama.py --ignore=src/tests/llm/test_llm_ollama_integration.py; latest local evidence (2026-06-18) is 2,495 passed, 0 skipped, and 0 xfailed. Re-enablesrc/tests/llm/test_llm_ollama*.pywhenollamais installed and reachable. - LLM Default Model:
smollm2:135m-instruct-q4_K_Svia Ollama (llm.defaults.DEFAULT_OLLAMA_MODEL; override withOLLAMA_MODEL/input/config.yaml). - Renderer inventory: PyMDP, RxInfer, JAX, NumPyro, Stan, PyTorch, ActiveInference.jl, DisCoPy, and bnlearn have maintained render paths. The public root
output/contract is the POMDP GridWorld full run with strict execution proof for PyMDP, RxInfer.jl, and ActiveInference.jl. - Default dev suite: FastAPI, websocket bridge, and LSP tests run under the
devextra; browser, public-network, live GUI, audio-DSP, and Ollama integrations remain explicit opt-in surfaces rather than hidden default-suite skips. - Visual Accessibility: All pipeline steps now include enhanced visual indicators and progress tracking.
Module-level status is maintained in each module's own AGENTS.md and test files. As of v3.0.0, the src/pipeline/ orchestration contracts (durable_streams, run_session, container_plan) and their live wiring (session_acceptance, run_manifest, pipeline_container_plan) are validated by the strict scripts/run_v3_orchestration_acceptance.py gate.
brew install just # macOS — or: cargo install just
just # See available recipes
just test # Fast test suite
just lint # Ruff lint check
just pipeline # Full 25-step pipeline
just pipeline-steps "3,5,11,12" # Specific steps
just render-health # Check renderer availability
just test-mod render # Test a specific modulepython src/main.py --target-dir input/gnn_files --verbosepython src/main.py --only-steps "3,5,7,8,11,12" --verbosepython src/3_gnn.py --target-dir input/gnn_files --output-dir output --verbose- Create module directory:
src/new_module/ - Implement
__init__.pywith public API - Create
AGENTS.mddocumentation - Add numbered script:
N_new_module.py - Implement tests in
src/tests/ - Add MCP tools in
mcp.py(if applicable)
- Follow thin orchestrator pattern
- Use type hints for all public functions
- Document all classes and methods
- Maintain >80% test coverage
- Include explicit error handling, status reporting, and dependency diagnostics
python src/2_tests.py --comprehensiveuv run --extra dev python -m pytest src/tests/test_[module]*.py -vpytest --cov=src --cov-report=term-missingEach module provides specialized agent capabilities for different aspects of Active Inference model processing:
- Dynamic configuration generation
- Context-aware template selection
- Automated dependency resolution
- Performance-optimized execution planning
- Intelligent dependency resolution
- Virtual environment optimization
- Platform-specific configuration
- Automated security scanning
- Comprehensive test orchestration
- Performance benchmarking
- Coverage analysis and reporting
- Regression detection and alerting
- Multi-format file discovery
- Intelligent parsing and validation
- Semantic analysis and inference
- Cross-format data transformation
- Version control and tracking
- Metadata extraction and indexing
- Model comparison and analysis
- Provenance and lineage tracking
- Static type analysis
- Resource estimation and optimization
- Constraint verification
- Performance prediction modeling
- Cross-reference validation
- Logical consistency verification
- Mathematical constraint checking
- Domain-specific rule enforcement
- Multi-format data export
- Schema transformation
- Metadata preservation
- Format-specific optimization
- Network topology visualization
- Matrix heatmap generation
- Interactive diagram creation
- Performance metric plotting
- 3D visualization generation
- Interactive dashboard creation
- Real-time data streaming
- Custom visualization frameworks
- Active Inference term mapping
- Semantic relationship discovery
- Knowledge graph construction
- Domain-specific reasoning
- Multi-framework code generation
- Language-specific optimization
- Framework-specific templates
- Performance-tuned implementations
- ActiveInferenceAgent: Primary full-fidelity execution engine
- Multi-environment execution (PyMDP, RxInfer, JAX, PyTorch, NumPyro)
- Resource monitoring and optimization
- Explicit failure, skip, and retry reporting
- Cross-platform compatibility
- Natural language analysis
- Model interpretation and explanation
- Automated documentation generation
- Multi-modal reasoning
- Model training and evaluation
- Hyperparameter optimization
- Performance comparison
- Integration with ML frameworks
- Multi-backend audio generation
- Real-time audio processing
- Audio feature extraction
- Sonification of model dynamics
- Advanced statistical analysis
- Performance metric computation
- Trend analysis and forecasting
- Anomaly detection
- Cross-module data flow
- Pipeline orchestration
- Resource allocation
- Inter-module communication
- Input validation and sanitization
- Access control implementation
- Threat detection and mitigation
- Compliance verification
- Research workflow management
- Experimental design assistance
- Literature review automation
- Collaboration tools
- Static site generation
- Documentation compilation
- Cross-reference linking
- Search and navigation
- Tool registration and discovery
- Protocol compliance
- Cross-system communication
- Standard interface implementation
- Multi-modal GUI generation
- Real-time interaction
- User experience optimization
- Accessibility compliance
- Comprehensive report generation
- Multi-format output
- Executive summary creation
- Performance visualization
Released in v3.0.0 ("Long-Running Orchestration"), this capability adds three safe-by-design src/pipeline/ contracts plus additive live wiring, with no live infrastructure mutation:
- Durable observation streams (
durable_streams.py): replayable file/array stream manifests and traces for long observation runs - Resumable run sessions (
run_session.py, wired live viasession_acceptance.py): durable, resumable manifests for extended model-family acceptance runs - Auditable container plans (
container_plan.py,pipeline_container_plan.py): validated, hardened container plans with static security review and rollback semantics, derived from the real pipeline config - Durable run artifacts (
run_manifest.py): turns a completed run'soutput/into replayable v3 artifacts - 3 new MCP tools exposing these contracts to agents
- Strict acceptance gate:
scripts/run_v3_orchestration_acceptance.pyexercises all three contracts end to end with positive and negative checks and fails closed
uv run --extra dev python scripts/run_v3_orchestration_acceptance.py- When implementing an attached plan, do not edit the plan file itself; use the existing to-do items and complete them without recreating them.
- Documentation fixes should verify file paths, commands, and signposts against the current repository rather than preserving stale examples.
- Prefer measured verification outputs over estimates when reporting test, pipeline, or scaling behavior.
- Pipeline
--target-dirarguments must point to directories; single.mdfile paths are not discovered by the currentPath.rglob-based flow. - The PyMDP scaling study expands dense
Btensors as O(n^3) text, so largeNvalues require explicit file-size and disk-space guardrails. - Step 12 execution runs rendered
.pyand.jlscripts via the execute processor; auxiliary per-framework helper scripts are not the primary pipeline path.
- Main Documentation: README.md
- Architecture Guide: ARCHITECTURE.md
- Pipeline Rules: .agent_rules
Last Updated: 2026-06-20 Pipeline Version: 3.0.0 ("Long-Running Orchestration") Total Steps: 25 (0-24) Status: Maintained