Skip to Content

Plan & apply

plan and apply are the core loop. They behave exactly like terraform plan and terraform apply: one reads and previews, the other reconciles reality to match desired state — idempotently.

What it is

  • gtmesh plan recomputes desired state from your inputs and diffs it against the committed graph. It is read-only and free: it prints the diff to stdout and writes a derived, git-ignored .gtmesh/plan.json, but it changes nothing and spends no API credits.
  • gtmesh apply makes the graph (and the page files) match what plan showed. It is idempotent — it only acts where there is a real difference, so running it twice in a row does nothing the second time. Terraform-style, it previews the intended actions and prompts Proceed? [y/N] before writing.

You never need plan between a change and an applyapply computes the same diff itself. plan is the optional preview; apply is the one that writes.

Why it matters

The diff is graph-to-graph: GoToMesh compares the hashes stored in the graph against freshly computed desired state, never by re-reading your rendered pages. That is what makes the loop deterministic (a frozen input always yields the same plan) and auditable (the diff is a reviewable Git change). Because apply is idempotent, an automated nightly or weekly run is harmless when nothing changed.

How it works

plan emits one action per identity — exactly one decision per page that could exist. The action depends on what you changed and whether the page is built or unbuilt:

ActionWhenWho acts
noopNothing changed
catalogueA new identity, not yet promotedEngine
createA new identity, already promotedEngine (scaffolds the page)
recomputeAn unbuilt page’s inputs changedEngine
rewriteA built page’s body inputs changedThe writer (the one LLM step)
redirectA slug changedHuman-gated

A projection-only change — a moved mesh link, a new sibling — is not an action at all: the engine re-derives site.manifest.json and the page’s prose is untouched (a zero-rewrite change you review in the manifest diff).

This drives the two loops. The cheap catalogue looppull → plan → apply — keeps the map of everything that could exist in sync, and is safe to schedule. The deliberate production looppromote → apply → write → seal → publish — decides which catalogued pages to actually build. promote is the gate between them.

Key files & flags

ThingWhat it is
gtmesh planRead-only diff; writes .gtmesh/plan.json
gtmesh plan --jsonMachine-readable plan output
gtmesh applyPreview, confirm, then enact
gtmesh apply --yesSkip the prompt (CI / non-interactive shells)
graph/{nodes.jsonl,edges.tsv}The committed state the diff is computed against
Last updated on