COGANT Cookbook
Practical recipes for common COGANT workflows. Each recipe is self-contained, takes 2-15 minutes to complete, and ships with copy-pasteable commands. Use the cookbook when you have a specific outcome in mind; use ../tutorials/ when you want a guided walkthrough and ../concepts/ when you want background theory.
Contents
| # | Recipe | Description | Level |
|---|---|---|---|
| 01 | Scan your first project | Run cogant scan on a Python repo and read the summary table |
Beginner |
| 02 | Export as JSON | Pipe the program graph into a JSON file for downstream tools | Beginner |
| 03 | Explain a node | Understand why a node was assigned its Active Inference role | Beginner |
| 04 | Custom thresholds | Tune confidence thresholds via pipeline config YAML | Intermediate |
| 05 | Monorepo scanning | Run COGANT across multiple packages in a monorepo | Intermediate |
| 06 | Reverse synthesis | Generate a runnable Python package from a GNN markdown file | Intermediate |
| 07 | Custom package layout | Control the output directory and structure of synthesized code | Intermediate |
| 08 | CI/CD integration | Add COGANT validation to a GitHub Actions workflow | Intermediate |
| 09 | Pre-commit hook | Detect GNN drift before commits land | Intermediate |
| 10 | Docker | Run COGANT inside a container for reproducible builds | Intermediate |
| 11 | JavaScript/TypeScript | Scan JS/TS projects alongside Python | Intermediate |
| 12 | Batch scanning | Translate many repos in a single shell loop | Intermediate |
| 13 | Incremental rescanning | Skip unchanged files with cogant changed |
Intermediate |
| 14 | GNN validation | Validate a hand-written or edited GNN package | Intermediate |
| 15 | Markov blanket visualization | Visualize blanket partitions in the program graph | Intermediate |
| 16 | PNG export | Rasterize Mermaid/SVG/dot diagrams to PNG | Beginner |
| 17 | Benchmarking | Measure pipeline wall-clock performance | Advanced |
| 18 | Role filtering | Filter results by semantic role using jq |
Intermediate |
| 19 | Custom translation rules | Add a new rule to the translation engine | Advanced |
| 20 | Dataset export | Export a training dataset for ML from COGANT output | Advanced |
Numbering scheme
Recipes are numbered NN_slug.md roughly in the order a new user is likely
to encounter them: basics first (01-05), then integration and workflow
(06-13), then the more advanced workflows (14-20). Numbers are editorial
only — they do not encode dependencies, and you can jump to any recipe
directly.
Non-numbered recipes
Three stable recipes predate the numbering scheme and are kept under their original slugs so external links do not break. They remain valid but new content should go into a new numbered recipe rather than extending these.
| Recipe | Description | Status |
|---|---|---|
| Analyze a Flask app | End-to-end Flask analysis walkthrough | Stable; overlaps with ../tutorials/03_flask_walkthrough.md |
| Custom translation rules | Author a new translation rule for the engine | Stable; overlaps with 19_extend_rules.md |
| Interpret GNN output | Read and interpret a generated GNN package | Stable; overlaps with 03_explain_node.md |
Recommended Reading Order
- 01 Scan your first project — confirm COGANT works end-to-end on your machine.
- 02 Export as JSON and 03 Explain a node — learn to read and interrogate the output.
- 04 Custom thresholds — your first configuration tweak.
- 08 CI/CD integration and 09 Pre-commit hook — wire COGANT into your day-to-day workflow.
- 06 Reverse synthesis and 14 GNN validation — exercise the reverse pipeline and validation surface.
- Pick targeted recipes from the rest of the table as use cases arise.
Prerequisites
All recipes assume COGANT is installed. COGANT is not on PyPI yet, so install from a checkout:
uv sync --extra all
Once the release is published, pip install cogant (or
pip install "cogant[viz]" for the visualization extras) will work.
Verify your environment:
cogant doctor
Agent notes: AGENTS.md - Hub: ../index.md