Gnn

From ActiveInferenceInstitute/GeneralizedNotationNotation · View interactive version

Gnn is an AI agent skill from the GitHub repository ActiveInferenceInstitute/GeneralizedNotationNotation. GNN file discovery, parsing, and multi-format serialization. Use when reading GNN model files, parsing StateSpaceBlock definitions, extracting connections, validating GNN syntax, or converting between GNN formats.

How to use this skill

Skill file

GNN Parsing (Step 3)

Purpose

Discovers, parses, and validates GNN model files. Extracts structured data from Markdown-based GNN specifications including state spaces, connections, parameterizations, and ontology annotations.

Key Commands

# Parse all GNN files in a directory
python src/gnn/3_gnn.py --target-dir input/gnn_files --output-dir output --verbose

# As part of pipeline
python src/gnn/main.py --only-steps 3 --verbose

GNN File Sections

| Section | Purpose | Example |

| --------- | --------- | --------- |

| GNNSection | Model type declaration | ActInfPOMDP |

| ModelName | Model identifier | T-Maze Agent |

| StateSpaceBlock | Matrix/vector definitions | A[3,3,type=float] |

| Connections | Directed (>) and undirected (-) edges | D>s, s-A |

| InitialParameterization | Default values | A={(0.9,0.05,0.05)} |

| ActInfOntologyAnnotation | Semantic labels | A=LikelihoodMatrix |

API

import logging
from pathlib import Path
from gnn import (
    discover_gnn_files,
    parse_gnn_file,
    process_gnn_directory,
    process_gnn_multi_format,
    validate_gnn_syntax,
)
from gnn import GNNFormalParser

logger = logging.getLogger(__name__)

# Discover GNN files in a directory
files = discover_gnn_files("input/gnn_files/")

# Parse a single file (lightweight dict-style summary)
model = parse_gnn_file("input/gnn_files/my_model.md")

# Process entire directory (used by pipeline)
results = process_gnn_directory("input/gnn_files/", "output/")

# Multi-format processing (requires a Logger — same contract as 3_gnn.py)
process_gnn_multi_format(
    Path("input/gnn_files"),
    Path("output"),
    logger,
    verbose=True,
)

# Formal parsing and validation
is_valid, errors = validate_gnn_syntax(content_string)

Key Exports

Output

Parsed models are consumed by downstream steps:

MCP Tools

This module registers tools with the GNN MCP server (see mcp.py):

References


Documentation

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.