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 planrecomputes 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 applymakes the graph (and the page files) match whatplanshowed. 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 promptsProceed? [y/N]before writing.
You never need plan between a change and an apply — apply 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:
| Action | When | Who acts |
|---|---|---|
noop | Nothing changed | — |
catalogue | A new identity, not yet promoted | Engine |
create | A new identity, already promoted | Engine (scaffolds the page) |
recompute | An unbuilt page’s inputs changed | Engine |
rewrite | A built page’s body inputs changed | The writer (the one LLM step) |
redirect | A slug changed | Human-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 loop — pull → plan → apply — keeps the map of everything that could exist in sync, and is safe to schedule. The deliberate production loop — promote → apply → write → seal → publish — decides which catalogued pages to actually build. promote is the gate between them.
Key files & flags
| Thing | What it is |
|---|---|
gtmesh plan | Read-only diff; writes .gtmesh/plan.json |
gtmesh plan --json | Machine-readable plan output |
gtmesh apply | Preview, confirm, then enact |
gtmesh apply --yes | Skip the prompt (CI / non-interactive shells) |
graph/{nodes.jsonl,edges.tsv} | The committed state the diff is computed against |
Related
plan— the read-only diff commandapply— the only writer- Lifecycle & reconcile — what every edit triggers, and who acts on it