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 registry. 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 registry (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 registry-to-registry: GoToMesh compares the hashes stored in the registry 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 row is built or unbuilt:

ActionWhenWho acts
noopNothing changed
catalogueA new identity, not yet promotedEngine
createA new identity, already promotedEngine (scaffolds the page)
recomputeAn unbuilt row’s inputs changedEngine
rewriteA built page’s body inputs changedThe writer (the one LLM step)
restampA built page’s render projection changed (reason relink for a moved edge)Engine
redirectA slug changedHuman-gated
pruneAn identity’s input vanishedHuman-gated

This drives the two loops. The cheap catalogue loopextract → 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)
gtmesh apply --pruneAlso remove carried-forward rows + bundles (destructive)
registry/pages.csvThe committed state the diff is computed against
Last updated on