Kiberon Labs
All products
Live
Graph Rewriting

Graph Grammar

Declarative graph transformation and rewriting.

Graph Grammar is a set of tools for rewriting graphs with declarative grammar rules. It finds and acts on structure through subgraph pattern matching, and chains rules together with a rudimentary goal-planning system to move a graph toward a target state. It's general-purpose. Converting AI workflows is one thing it's good at, but the same rules apply to anything you can model as a graph.

graph-grammar / walkthrough
A walkthrough of Graph Grammar: pattern matching, rewrite rules, and goal planning in action.

Match, rewrite, plan

graphs/*
01
pattern matching

Subgraph pattern matching

Find structure anywhere in a graph by matching subgraphs against declarative patterns. When a pattern matches, its rule can fire, with no hand-written traversal code to maintain.

02
grammar rules

Declarative rewriting

Describe transformations as grammar rules: the shape to find, and the shape to replace it with. Rules are composable, so complex rewrites stay small, testable, and readable.

03
goal planning

Goal-driven planning

Give it a target state and the rudimentary goal-planning system chains rules together to move the graph toward it. Multi-step conversions, like translating one AI workflow format into another, become a single request.

Why it fits

Rewrite anything you can model as a graph.

Graph Grammar is general-purpose: converting AI workflows is one thing it's good at, but the same declarative rules apply to any structured graph that needs to change shape.

Graph rewritingPattern matchingGoal planning
  • Rewrite and transform graphs through composable, declarative grammar rules
  • Match subgraphs against declarative patterns to detect and act on structure
  • Chain rules with a rudimentary goal-planning system toward a target state

Transforming graphs with Graph Grammar?

Whether you're converting AI workflows or rewriting your own graph structures, tell us what you're working on and we'll help you ship it.

Start a conversation