Skip to content

ActiveInferenceInstitute/GeneralizedNotationNotation

GNN on GitHub — project hub

Generalized Notation Notation (GNN) is a text-based language for Active Inference generative models. This repository implements a 25-step pipeline (steps 0–24) that discovers and parses GNN sources (Markdown with structured sections), registers models, type-checks and validates them, exports and visualizes structure, attaches ontology annotations, renders executable code for multiple simulation frameworks, executes those scripts, and continues through LLM-assisted analysis, ML integration, audio, statistical analysis, integration/security/research steps, static site generation, MCP exposure, GUI tooling, reporting, and intelligent analysis.

This file is the GitHub-oriented entry point: GNN concepts, deep links into language and pipeline docs, repository layout, CI, and local validation. The narrative overview, badges, publication block, and long examples live in the root README.md.

Last updated: 2026-03-24


Contents


What GNN is

  • Notation: Models are written as Markdown with labeled sections (for example ## GNNSection, ## StateSpaceBlock, ## Connections, ## InitialParameterization, ontology annotations). The normative and reference material is split across doc/gnn/gnn_syntax.md (v1.1 living spec), doc/gnn/reference/gnn_syntax.md (examples and patterns), and the language hub.
  • Processing: A single orchestrator (src/main.py) runs the numbered steps in order (or a subset via --only-steps / --skip-steps). Step 3 produces parsed representations consumed by type checking, validation, export, visualization, ontology, render, LLM, and related steps; 11 → 12 is the main generate code → run simulation bridge. See doc/gnn/reference/architecture_reference.md and doc/gnn/reference/technical_reference.md.
  • Architecture: Each step is a thin orchestrator (src/N_*.py) delegating to src/<module>/ with AGENTS.md and usually processor.py. Diagram and conventions: root AGENTS.md, ARCHITECTURE.md, src/README.md.

GNN files and data flow

Typical inputs

Typical outputs

  • Per-step folders under output/ (see root README directory overview). Policy: tracked in git per AGENTS.md / project conventions.
flowchart LR md[GNN_Markdown] --> s3[Step3_parse] s3 --> s5[Step5_typecheck] s3 --> s6[Step6_validate] s3 --> s8[Step8_viz] s3 --> s10[Step10_ontology] s3 --> s11[Step11_render] s11 --> s12[Step12_execute] s12 --> s16[Step16_analysis] s16 --> s23[Step23_report] 
Loading

Troubleshooting and operator notes: doc/gnn/operations/gnn_troubleshooting.md, doc/gnn/operations/gnn_tools.md.


Pipeline: all 25 steps

Orchestrator scripts live in src/; module AGENTS in each folder; per-step documentation in doc/gnn/modules/.

Step Module Orchestrator Module AGENTS Step doc
0 template 0_template.py template/AGENTS.md 00_template.md
1 setup 1_setup.py setup/AGENTS.md 01_setup.md
2 tests 2_tests.py tests/AGENTS.md 02_tests.md
3 gnn 3_gnn.py gnn/AGENTS.md 03_gnn.md
4 model_registry 4_model_registry.py model_registry/AGENTS.md 04_model_registry.md
5 type_checker 5_type_checker.py type_checker/AGENTS.md 05_type_checker.md
6 validation 6_validation.py validation/AGENTS.md 06_validation.md
7 export 7_export.py export/AGENTS.md 07_export.md
8 visualization 8_visualization.py visualization/AGENTS.md 08_visualization.md
9 advanced_visualization 9_advanced_viz.py advanced_visualization/AGENTS.md 09_advanced_viz.md
10 ontology 10_ontology.py ontology/AGENTS.md 10_ontology.md
11 render 11_render.py render/AGENTS.md 11_render.md
12 execute 12_execute.py execute/AGENTS.md 12_execute.md
13 llm 13_llm.py llm/AGENTS.md 13_llm.md
14 ml_integration 14_ml_integration.py ml_integration/AGENTS.md 14_ml_integration.md
15 audio 15_audio.py audio/AGENTS.md 15_audio.md
16 analysis 16_analysis.py analysis/AGENTS.md 16_analysis.md
17 integration 17_integration.py integration/AGENTS.md 17_integration.md
18 security 18_security.py security/AGENTS.md 18_security.md
19 research 19_research.py research/AGENTS.md 19_research.md
20 website 20_website.py website/AGENTS.md 20_website.md
21 mcp 21_mcp.py mcp/AGENTS.md 21_mcp.md
22 gui 22_gui.py gui/AGENTS.md 22_gui.md
23 report 23_report.py report/AGENTS.md 23_report.md
24 intelligent_analysis 24_intelligent_analysis.py intelligent_analysis/AGENTS.md 24_intelligent_analysis.md

Also documented: init.md (template init), main.md (orchestrator). Infrastructure (not separate numbered steps): pipeline/AGENTS.md, utils/AGENTS.md, api/AGENTS.md, cli/AGENTS.md, lsp/AGENTS.md, src/doc/AGENTS.md.

Run examples

uv run python src/main.py --target-dir input/gnn_files --verbose uv run python src/main.py --only-steps "3,5,11,12" --verbose uv run python src/3_gnn.py --target-dir input/gnn_files --output-dir output --verbose

More command patterns: CLAUDE.md, doc/gnn/operations/gnn_tools.md.


Render and execute backends

Code generation and execution are organized under src/render/ and src/execute/. Documentation:

Topic Link
Integration overview framework_integration_guide.md
Implementation patterns gnn_implementation.md
Per-framework index implementations/README.md
PyMDP pymdp.md, doc/pymdp/gnn_pymdp.md
JAX jax.md
RxInfer rxinfer.md, doc/rxinfer/gnn_rxinfer.md
ActiveInference.jl activeinference_jl.md, activeinference-jl.md
NumPyro numpyro.md
PyTorch pytorch.md
DisCoPy discopy.md, doc/discopy/gnn_discopy.md
Stan stan.md
CatColab catcolab.md, doc/catcolab/catcolab_gnn.md

Visualization and export docs: integration/gnn_visualization.md, integration/gnn_export.md. Optional Julia installs for Julia backends are called out in CLAUDE.md and SETUP_GUIDE.md.


Interfaces: CLI, API, LSP, MCP

Interface Code Documentation
CLI (gnn command) src/cli/ cli/README.md, cli/AGENTS.md
REST API src/api/ api/AGENTS.md, doc/api/README.md
LSP src/lsp/ lsp/AGENTS.md, lsp/README.md
MCP tools src/mcp/ doc/gnn/mcp/README.md, doc/gnn/mcp/tool_reference.md, doc/gnn/testing/mcp_audit.md

Active Inference and cognitive modeling docs

Resource Link
Active Inference (conceptual hub in this repo) doc/active_inference/README.md
Learning paths doc/learning_paths.md
Cognitive phenomena examples doc/cognitive_phenomena/README.md
GNN + LLM / neurosymbolic gnn_llm_neurosymbolic_active_inference.md
Ontology system ontology_system.md

Deep link map (doc/gnn and neighbors)

Hub and manifest

Language and reference

Tutorials and examples

Operations and quality

Templates (authoring)


Canonical documentation

Resource Description
README.md Main project overview, quick start, pipeline table, examples
AGENTS.md Master registry of all pipeline modules and agent scaffolding
CLAUDE.md Contributor quick reference: commands, architecture, key paths
DOCS.md Consolidated documentation map and diagrams
ARCHITECTURE.md Implementation patterns (thin orchestrators, data flow)
SETUP_GUIDE.md Installation and optional dependency groups
CONTRIBUTING.md How to contribute; includes CI parity commands
SECURITY.md Security policy and reporting
CODE_OF_CONDUCT.md Community standards
SUPPORT.md Help and community links
SKILL.md In-repo skill / tooling notes for agents
CHANGELOG.md Release history
CITATION.cff Citation metadata

Doc tree entry points

Path Role
doc/README.md Documentation subtree overview
doc/INDEX.md Machine-oriented index
doc/START_HERE.md Guided entry into docs
doc/quickstart.md Step-by-step first pipeline run
doc/gnn/README.md GNN language and pipeline doc hub
doc/development/docs_audit.py Markdown link and AGENTS/README pairing audit
doc/development/agents_readme_triple_review.md Three-pass AGENTS/README review checklist

Repository map

Path Description
src/main.py Pipeline orchestrator (run full or selected steps)
src/AGENTS.md Per-folder technical notes for src/
src/gnn/, src/render/, src/execute/ Parse, codegen, simulation
src/tests/ Pytest suite
input/gnn_files/ Sample GNN models; input/config.yaml defaults
output/ Pipeline outputs (tracked per repo policy)
pyproject.toml Dependencies and tool config
pytest.ini Test markers and pytest settings

Community and policies

Link Use
Issues Bugs and tracked work
Discussions Ideas and Q&A
Contributors Contribution history

Publication reference and DOI appear in the root README.md (Overview).


Automation in this folder

This directory holds Dependabot configuration and GitHub Actions workflows. Workflow-focused summary: workflows/README.md. Maintainer guardrails: AGENTS.md.

Directory index

Path Role
dependabot.yml Dependabot version updates (pip + GitHub Actions)
AGENTS.md Permissions, standards, maintenance checklist
README.md This hub
workflows/ci.yml Tests, Ruff, Bandit on application code paths
workflows/docs-audit.yml Strict Markdown / doc structure audit
workflows/actionlint.yml Workflow YAML lint
workflows/dependency-review.yml PR dependency and license gate
workflows/codeql.yml CodeQL static analysis (Python)
workflows/supply-chain-audit.yml Scheduled pip-audit on lockfile exports
workflows/README.md Workflow table and local actionlint
workflows/AGENTS.md Workflow agent guide

Dependabot

Configured in dependabot.yml:

  • pip (directory: /): weekly Monday 06:00 UTC, target branch main, grouped pip-dependencies pattern *, labels dependencies / python, commit prefix deps(pip), up to 15 open PRs, auto rebase.
  • github-actions (directory: /): weekly Monday 06:30 UTC, same branch, commit prefix deps(actions), labels dependencies / github-actions, auto rebase.

Workflows

Workflow Triggers What it runs
ci.yml push and pull_request to main (opened, synchronize, reopened, ready_for_review); paths-ignore: **/*.md, doc/**. workflow_dispatch test: matrix Python 3.11 / 3.12 / 3.13 — uv sync --frozen --extra dev, pytest -m "not pipeline and not mcp"; on 3.12 only, MCP tool count must be ≥ 131. lint: Ruff on src/. security: Bandit medium+ on src (JSON artifact upload).
docs-audit.yml push / pull_request to main when paths include **/*.md, doc/**, root AGENTS.md, CLAUDE.md, README.md, SKILL.md, or doc/development/docs_audit.py. workflow_dispatch uv sync --frozen --extra dev, uv run python doc/development/docs_audit.py --strict
actionlint.yml push / pull_request when .github/workflows/** changes. workflow_dispatch rhysd/actionlint@v1
dependency-review.yml pull_request to main. workflow_dispatch actions/dependency-review-action@v4fail-on-severity: high; denies AGPL licenses listed in the workflow
codeql.yml push / pull_request to main, weekly schedule, workflow_dispatch CodeQL init + analyze for Python
supply-chain-audit.yml Weekly cron (0 6 * * 1 UTC), workflow_dispatch pip-audit (core): uv export --frozen --no-dev --no-hashes --no-emit-project then OSV pip-audit. pip-audit (all extras, no dev): uv export --frozen --all-extras --no-dev --no-hashes --no-emit-project then same.

Why CI and docs-audit split

ci.yml ignores Markdown-only and doc/** path changes so documentation edits do not spin the full Python matrix. docs-audit.yml runs when those paths (or the audit script) change, keeping relative links and AGENTS/README pairing checks enforced.

Automation on a typical PR

flowchart TB pr[PR_to_main] pr --> dep[dependency_review] pr --> cq[CodeQL] pr --> ci[CI_tests_Ruff_Bandit_if_not_docs_only] pr --> da[docs_audit_if_md_doc_or_audit_script] pr --> al[actionlint_if_workflows_change] 
Loading

Local validation (parity with automation)

From the repository root:

uv run python doc/development/docs_audit.py --strict actionlint .github/workflows/*.yml uv sync --frozen --extra dev uv run pytest -m "not pipeline and not mcp" --tb=short -q uv run ruff check src/ uv run bandit -r src -c pyproject.toml --severity-level medium --confidence-level medium

Full local suite (broader than default CI marker filter): uv run pytest src/tests/ -v. Ollama integration tests may need a local daemon; see README.md and pytest.ini.


Related tooling docs

About

No description or website provided.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors