COGANT
Public home: https://github.com/ActiveInferenceInstitute/COGANT · Earlier manuscript deposit: 10.5281/zenodo.20705351 (manuscript series: 10.5281/zenodo.20705350). The current computational artifact is identified by its Git commit.
Codebase-to-GNN translation — package under cogant/, manuscript under manuscript/. This checkout is self-contained at the COGANT project root; when linked into docxology/template, the same tree is expected to appear at projects/working/cogant/ and be rendered with the lifecycle-qualified project name working/cogant. See PROMOTION.md for the render-location checklist.
Top-level src/, tests/, and pyproject.toml
form a tiny compatibility shell for the parent docxology/template project
discovery contract. The actual installable COGANT package remains the nested
cogant/ tree.
Contents
Documentation
The complete documentation ships with the package. Start at the
documentation index for a map of every area, or jump straight
to the docs site home:
Installation ·
Quickstart ·
CLI reference ·
FAQ.
Status
- Works offline once installed: the forward pipeline, CLI, export formats,
finite-model compilation, and GNN validation are the supported surface today.
- Not yet published: COGANT is not on PyPI — install from source
(
cd cogant && uv sync --all-extras).
- Needs network: the default
run_all batch shallow-clones two small public
repos, and the optional upstream GNN conformance lane fetches a pinned external
checkout (only when COGANT_ENABLE_UPSTREAM_GNN is set and the upstream extra
is installed).
- Needs extra setup: the quantitative evaluation pipeline reads 12 vendored
git submodules under
cogant/evaluation/eval_repos/
(git submodule update --init --recursive); empty checkouts make benchmarks
skip rather than fail.
- Authoritative completeness check:
tools/release_gate.py
and the manuscript audits, run from this project root.
Location matrix
| Context |
COGANT project root |
COGANT package root |
Notes |
| Working sidecar checkout |
<cogant-sidecar> |
<cogant-sidecar>/cogant |
Current local checkout; run project-local commands here. |
| Parent-template render path |
<template-checkout>/projects/working/cogant |
<template-checkout>/projects/working/cogant/cogant |
Created by the sidecar/template linker; render with --project working/cogant. |
In this documentation, COGANT project root means the directory containing this README, run_all.py, tools/, scripts/, manuscript/, and the nested package directory. COGANT package root means the inner cogant/ directory containing pyproject.toml, py/cogant/, package tests, docs, and Rust crates.
Explicit finite state-space models
Alongside repository analysis, COGANT compiles authored finite state/action and
observation tables into A/B/C/D matrices and checks every declared coefficient.
The finite-model guide explains complete state
configurations, stochastic kernels, resource limits, and the agent-runtime handoff.
Its construction and reference-checking design draws on a
pinned review of Handwired.
GNN maintains a downstream adoption guide for repositories that consume the notation.
From this project root:
uv run --directory cogant cogant finite compile examples/finite_models/toggle.json -o output/finite/toggle.json
uv run --directory cogant cogant finite verify examples/finite_models/toggle.json output/finite/toggle.json
These commands consume an explicit model declaration. The repository-analysis
pipeline continues to produce evidence-bearing candidate models from source.
Execute exported GNN matrices
From this project root:
uv run --directory cogant cogant translate examples/control_positive/calculator -o output/calculator --no-dynamic --layout-output
uv run --directory cogant cogant infer output/calculator/gnn_package/model.gnn.md --steps 8 -o output/calculator/data/inference_trace.json
The inference guide describes supplied observations,
source-bound traces, action scores, admission limits, and native trajectory figures.
The batch runner performs this inference step for each enabled target.
Manuscript variables (madlib)
Run these from the COGANT project root:
# 1. Regenerate METRICS.yaml from live test + benchmark runs.
uv run --directory cogant python ../tools/regenerate_metrics.py
# 2. Build manuscript_variables.json + output/manuscript/ + output/figures/.
uv run python scripts/z_generate_manuscript_variables.py
# 3. Validate local links + manuscript structure.
uv run --directory cogant python docs/verify_manuscript_links.py
uv run python tools/audit_manuscript_crossrefs.py
uv run python tools/audit_manuscript_citations.py
uv run python tools/audit_manuscript_numbers.py
When linked under the parent template as projects/working/cogant/, also run from the template root:
uv run python -m infrastructure.validation.cli markdown projects/working/cogant/manuscript/
uv run python -m infrastructure.validation.cli markdown projects/working/cogant/output/manuscript/
Audit drift-sensitive docs and stubs:
uv run python tools/audit_docs_constants.py
uv run python tools/audit_folder_docs.py
uv run --directory cogant python ../tools/audit_stage_list.py
uv run python tools/audit_manuscript_crossrefs.py
uv run python tools/audit_manuscript_citations.py
uv run python tools/audit_manuscript_numbers.py
uv run --directory cogant python ../tools/audit_manuscript_module_refs.py
uv run python tools/check_coverage_table.py --strict
uv run python tools/check_metrics_fresh.py --fail-on-dirty
tools/audit_stage_list.py enforces RUNNER_STAGES vs. doc/CLI drift. tools/audit_manuscript_module_refs.py verifies every backticked cogant.* module/attribute cited in the manuscript still resolves in the installed package (run it from the inner cogant/ env so the package's dependencies are importable); it catches references to deleted modules such as the former cogant.viz.png_export. tools/check_metrics_fresh.py --fail-on-dirty is a release gate that refuses uncommitted metric provenance.
Coverage table ({#tbl:coverage-stmt-modules}). Per-module Stmts / Cover rows in manuscript/06_04_tests_mutation_and_benchmarks.md are hand-copied from coverage report. After uv run pytest tests/ --cov=py/cogant in cogant/ (inner package root), run uv run python tools/check_coverage_table.py from this project root to compare the table to the report; use --strict to fail on drift. See manuscript/AGENTS.md and PROMOTION.md.
Rendering uses output/manuscript/ when present. The repository-local render
entry point is scripts/render_manuscript.py; it injects the variables,
validates the figure registry against the generated files, and runs one
pandoc command:
uv run --directory cogant python ../scripts/render_manuscript.py
Missing figure sources fail before rendering; generate them with
cd cogant && uv run python ../run_all.py --targets calculator,flask_app. Parent
template rendering (scripts/03_render_pdf.py --project working/cogant) still
applies when this tree is linked under projects/working/cogant/.
The same generator refreshes manuscript figures under output/figures/ by
copying curated real run PNGs from cogant/output/ (program graph,
state-space factor graph, A/B/C/D matrices, upstream GNN visualization, and
the roundtrip batch Gantt). After a new run_all.py batch, re-run step 2
above or run uv run python tools/manuscript_figures.py --strict to fail if
any publication figure is missing.
Batch outputs (run_all)
Configurable orchestration at the project root (same level as this file):
run_all.sh — resolves the project root (works from here or from inner cogant/), then cd into the inner package and uv run python ../run_all.py
run_all.py — reads run_all.json (optional; else built-in defaults), runs cogant translate → scan/graph → export-gnn → infer → render → viz → validate (full COGANT GNN package validation; the optional upstream gnn check runs only when COGANT_ENABLE_UPSTREAM_GNN is truthy and the upstream extra is installed, and steps.validate_no_upstream_gnn forces it off) per target
run_all.example.json — copy to run_all.json and set targets / steps
Per-target output folders: everything for one run goes under <output_root>/<target_id>/ (data/bundle.json, gnn_package/, site/, figures/ PNGs, diagrams/, analysis/, exports/, roundtrip/, reports/run_summary.md). The shipped run_all.json and built-in no-config defaults set output_root: "cogant/output", so corpus runs land at cogant/output/<target_id>/; the minimal run_all.example.json sets output_root: "output" for project-root-relative smoke tests. A <output_root>/run_manifest.json records top-level metadata (started_at, staging_root