@pmelab/gtd 8.6.0 → 9.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +389 -179
  2. package/dist/gtd.bundle.mjs +1246 -352
  3. package/package.json +2 -3
  4. package/bin/gtd +0 -878
package/README.md CHANGED
@@ -17,7 +17,7 @@ No chat scrollback. No lost sessions. No infinite fix loops. Just git.
17
17
 
18
18
  - **Durable & replayable.** The workflow state _is_ your git history — a pure
19
19
  fold over commit subjects and the working tree. Kill the session, reboot, come
20
- back next week: run `gtd` and it resumes exactly where it stopped.
20
+ back next week: run the driver and it resumes exactly where it stopped.
21
21
  - **Shareable.** Push the branch, and the workflow travels with it — the state
22
22
  lives in the commits, so another machine (or another person) picks up exactly
23
23
  where you left off.
@@ -43,10 +43,10 @@ No chat scrollback. No lost sessions. No infinite fix loops. Just git.
43
43
  npm install -g @pmelab/gtd
44
44
  ```
45
45
 
46
- Or run without installing:
46
+ Or run without installing (prefix every `gtd` below with `npx`):
47
47
 
48
48
  ```bash
49
- npx @pmelab/gtd
49
+ npx @pmelab/gtd next
50
50
  ```
51
51
 
52
52
  That's it — gtd ships the **unified** workflow as its **built-in default**, so a
@@ -66,7 +66,7 @@ format only, so gtd still validates the `qa`/`review` ones; `prose`, used by the
66
66
  simple flow's plan file, has no validator to begin with); edit or drop either
67
67
  freely (point `testCommand` at your suite, swap Prettier for dprint or a script,
68
68
  delete a key). It writes **no** `workflow:` key — the machine is built in — so
69
- review and commit the file before your first `gtd step`. `gtd init` takes no
69
+ review and commit the file before your first `gtd land`. `gtd init` takes no
70
70
  argument and refuses to clobber an existing config; it may also run in a plain
71
71
  parent directory (not a git repo) to seed a shared config a nested repo picks
72
72
  up. To customize the machine itself, add a `workflow:` key (there is no default
@@ -79,10 +79,28 @@ carrying one piece of content (a script, a prompt, a message, or a squash commit
79
79
  template), with an ordered set of change-patterns routing to the next state.
80
80
 
81
81
  The loop is one beat, repeated: run `gtd next --json` and dispatch on `kind` —
82
- `"message"` means it's a human's move (stop and hand off); `"script"` means the
83
- driver runs `content` itself, then steps its actor; `"prompt"` means feed
84
- `content` to your agent, then run `gtd step <actor>` once it's done. gtd itself
85
- never executes anything — the driver owns running scripts.
82
+ `"message"` means it's a human's move (stop and hand off, unless it's the run's
83
+ opening beat, which the human triggered by re-running the driver: land that one,
84
+ since changing nothing is itself a declared outcome at some gates); `"capture"`
85
+ means a human gate the human already acted on (land it immediately); `"script"`
86
+ means the driver runs `content` itself, then lands it; `"prompt"` means feed
87
+ `content` to your agent — using the accompanying `session.id`/`session.resume`
88
+ to continue or start that agent conversation (see "Driving the loop" below) —
89
+ then run `gtd land` once it's done. gtd itself never executes anything — the
90
+ driver owns running scripts. Every `gtd next` call is strictly mutation-free,
91
+ safe to poll or peek at any time: `session.id`/`session.resume` are DERIVED,
92
+ never stored, so looking is free — nothing distinguishes a peek from a dispatch,
93
+ and there is no separate claiming form at all. A `prompt` beat whose turn
94
+ changes nothing still lands: `gtd land` commits an EMPTY `gtd(<actor>): <state>`
95
+ attempt instead of silently doing nothing, so the fruitless dispatch is visible
96
+ in history rather than invisible. `"kind": "stalled"` is derived from that
97
+ history — HEAD is an empty attempt at the resting state and the tree is clean —
98
+ so every `gtd next --json` call reports it, and it stays reported on a repeat
99
+ (there's no marker to consume) until something actually changes. The fix for a
100
+ repeated stall is either a better prompt, a `retry:` cap on the state that
101
+ redirects to an escalation state after N fruitless attempts, or — if the state
102
+ can legitimately finish with nothing to change — declaring a `C` (clean-tree)
103
+ pattern on it.
86
104
 
87
105
  An `on` edge may also carry a short imperative `action` (e.g. `Accept plan`)
88
106
  alongside its existing `describe` sentence — a human-facing name for the choice
@@ -120,27 +138,27 @@ for). The two steering-file entries are chosen by which file you create:
120
138
  Both flows converge on the same tail: an agent hands you a `.gtd/REVIEW.md`
121
139
  checkbox review of the diff — the prompt never inlines the diff itself; it names
122
140
  the commit the changes are based at and the agent runs `git diff` to read the
123
- range before writing the review. While the process rests at that gate, gtd opens
124
- a **review checkout window**: HEAD is rewound to the review base with the
125
- working tree untouched, so the whole reviewable change shows up as ordinary
126
- uncommitted changes in your editor's normal git integration (and files added
127
- during the process show up as ordinary untracked files, so discarding one
128
- deletes it). The window closes on the next gtd invocation. Tick a box as you
129
- review each hunk (ticking just records "I read this"), and leave a **comment**
130
- to request changes: a note on a line, an inline `// TODO`-style comment in the
131
- code, or a direct code edit. Any comment sends a build + re-review round — an
132
- agent first turns your comments into an explicit instruction list, then a build
133
- turn implements it (a re-review then covers only the follow-through, and a
134
- hand-edit is treated as your own fix the agent completes without reverting your
135
- lines; a comment can't be silently dropped — a build turn that addresses nothing
136
- is refused). For the simple flow, the build turn that follows through on
137
- feedback and the turn that drafts the final squash message both resume the same
138
- session that built the feature in the first place, since the review tail is
139
- nested inside that build identity rather than sitting beside it. Ticking every
140
- box with no comment is the sign-off, which collapses the whole process into one
141
- commit (a **squash finale** whose message an agent drafts). Stepping with a box
142
- still unticked and no comment is refused (finish reviewing first), as is
143
- deleting `.gtd/REVIEW.md`.
141
+ range before writing the review. While the process rests at that gate, the
142
+ landing script opens a **review checkout window**: HEAD is rewound to the review
143
+ base with the working tree untouched, so the whole reviewable change shows up as
144
+ ordinary uncommitted changes in your editor's normal git integration (and files
145
+ added during the process show up as ordinary untracked files, so discarding one
146
+ deletes it). The next landing's own script closes the window before it commits.
147
+ Tick a box as you review each hunk (ticking just records "I read this"), and
148
+ leave a **comment** to request changes: a note on a line, an inline
149
+ `// TODO`-style comment in the code, or a direct code edit. Any comment sends a
150
+ build + re-review round — an agent first turns your comments into an explicit
151
+ instruction list, then a build turn implements it (a re-review then covers only
152
+ the follow-through, and a hand-edit is treated as your own fix the agent
153
+ completes without reverting your lines; a comment can't be silently dropped — a
154
+ build turn that addresses nothing is refused). For the simple flow, the build
155
+ turn that follows through on feedback and the turn that drafts the final squash
156
+ message both resume the same session that built the feature in the first place,
157
+ since the review tail is nested inside that build identity rather than sitting
158
+ beside it. Ticking every box with no comment is the sign-off, which collapses
159
+ the whole process into one commit (a **squash finale** whose message an agent
160
+ drafts). Landing with a box still unticked and no comment is refused (finish
161
+ reviewing first), as is deleting `.gtd/REVIEW.md`.
144
162
 
145
163
  The same review tail also has a direct entry point —
146
164
  `gtd --entry review-gate.check --var reviewBase=<commitish>` starts a brand new
@@ -157,9 +175,9 @@ no commit is left behind.
157
175
 
158
176
  `--entry` itself isn't limited to states flagged `entry: true` — it accepts
159
177
  **any** declared, non-commit state of the active workflow (see
160
- [`gtd step`](#commands)/`gtd --entry` below). `entry: true` only marks a state
161
- as an _extra_ reachability root (and drives a badge in `gtd visualize`) for a
162
- state that would otherwise be unreachable from the ordinary `idle` rest —
178
+ [`gtd --entry`](#commands) below). `entry: true` only marks a state as an
179
+ _extra_ reachability root (and drives a badge in `gtd visualize`) for a state
180
+ that would otherwise be unreachable from the ordinary `idle` rest —
163
181
  `review-gate.check` and `fix-precheck` need it for exactly that reason, while
164
182
  `plan-gate.check`/`spec-gate.check` carry it too (the bundled template dedups
165
183
  the three `entryGate` instances into one shared machine, so flagging the shared
@@ -186,12 +204,6 @@ the workflow is just `.gtdrc` config.
186
204
  Usage: gtd [command] [options]
187
205
 
188
206
  Commands:
189
- (no command), loop
190
- Launch the loop driver (bin/gtd), which repeatedly drives
191
- an agent through gtd next/gtd step calls until the
192
- workflow rests at a human gate (a non-autonomous state)
193
- or settles. A bare gtd invocation and gtd loop both
194
- launch it identically
195
207
  init Scaffold a minimal .gtdrc.json for this repo, seeding the
196
208
  default variables you are most likely to change (the test
197
209
  command) and a Prettier formatting suggestion. gtd runs its
@@ -200,19 +212,21 @@ Commands:
200
212
  Takes no argument. Run once per repo; refuses if a gtd
201
213
  config already exists. Leaves the file uncommitted for you
202
214
  to review and commit
203
- step <actor> Authenticate as <actor>, match the resolved rest's
204
- declared patterns against the pending changes, and commit
205
- (or squash) the one resulting transition. Pass
206
- --cost=<n> (optionally --model=<name>) to record the
207
- just-finished invocation's token cost and model on the
208
- turn commit (summed into it.processCost/processCostByModel).
209
- Pass --entry <state> to start a brand NEW process at
210
- <state> instead — any declared, non-commit state — with
211
- repeatable --var <name>=<value> supplying that new
212
- process's fixed it.vars overrides
215
+ land Land whatever the tree now shows at the currently
216
+ resolved rest — a human capture, an agent/check turn, an
217
+ empty attempt (a fruitless prompt turn), or a squash — and
218
+ print the script that records it; a driver runs the
219
+ script, e.g. `gtd land | bash`. Pass --cost=<n>
220
+ (optionally --model=<name>) to record the just-finished
221
+ invocation's token cost and model on the turn commit
222
+ (summed into it.processCost/processCostByModel). Exits 0
223
+ when a script is emitted (or a benign no-op at a clean
224
+ message rest), 3 when SETTLED — nothing owed: a no-op at a
225
+ script rest, or the initial-state collapse (stdout still
226
+ carries the script) — 1 on any refusal
213
227
  (no command) --entry <state>
214
- Short form of 'step human --entry <state>' — starts a new
215
- process authenticated as human, e.g. 'gtd --entry <state>'
228
+ Starts a new process authenticated as human, e.g.
229
+ 'gtd --entry <state>'
216
230
  abandon End the process currently underway without completing it:
217
231
  close any open review checkout window, then rewind HEAD to
218
232
  the commit the process started from, keeping everything it
@@ -224,7 +238,12 @@ Commands:
224
238
  Refuses on a dirty working tree, when there is no retained
225
239
  history, or when HEAD has advanced past the squash with
226
240
  commits that would be lost
227
- next Print the resolved rest's rendered script/prompt/message (no mutation)
241
+ next Print the resolved rest's rendered script/prompt/message
242
+ (no mutation, safe to poll). --json emits the whole beat
243
+ document instead: kind (capture|message|script|prompt|
244
+ stalled) selects what a driver does, content is what it
245
+ runs or shows, plus the prompt session, model, validate
246
+ script, log path and the resting state's own fields
228
247
  status Print the resolved rest's state/actor and which declared
229
248
  pattern (if any) each pending change matches (no mutation)
230
249
  validate Print the script that formats (when declared) then
@@ -234,7 +253,10 @@ Commands:
234
253
  own exit code/output. Always exits 0; --json emits
235
254
  {state, file?, mode?, script} (script is "" when there is
236
255
  nothing to validate; plain text prints "nothing to
237
- validate" in that case)
256
+ validate" in that case). On a non-zero validate exit
257
+ the emitted script prints a ready-to-send fix prompt
258
+ (instruction + findings) and exits with the
259
+ validator's own code
238
260
  lsp Start the LSP server for .gtd/ steering files (stdio)
239
261
  visualize Serve an interactive diagram of the active workflow on a
240
262
  local web server (--port <n>, --no-open; --json prints the
@@ -247,6 +269,12 @@ Commands:
247
269
  reads no config — standalone, runnable from any directory
248
270
  with <mode>/<file> given explicitly. This is what a
249
271
  workflow's emitted validation script invokes as a leaf step
272
+ install Print a complete, self-contained briefing that teaches an
273
+ agent (or a human) to build a gtd driver in any shell or
274
+ runtime — the self-serve version of README's 'Writing
275
+ your own driver'. Writes nothing: this installs knowledge
276
+ into the calling agent's context, not files on disk. Runs
277
+ from any directory, in or out of a repository
250
278
  version Print version and exit
251
279
  help Print this help and exit
252
280
 
@@ -254,13 +282,11 @@ Options:
254
282
  --json Output structured JSON instead of plain text
255
283
  --port=<n> (gtd visualize only) port to serve on (default: a free port)
256
284
  --no-open (gtd visualize only) do not open the browser
257
- --cost=<n> (gtd step only) record the invocation's token cost
258
- --model=<name> (gtd step only, with --cost) tag that cost's model
259
- --entry <state> (gtd step, or with no command at all) start a brand new
260
- process at <state> — any declared, non-commit state —
261
- instead of stepping the one currently resting. Not
262
- combinable with --cost/--model (an entry is not a metered
263
- agent turn)
285
+ --cost=<n> (gtd land only) record the invocation's token cost
286
+ --model=<name> (gtd land only, with --cost) tag that cost's model
287
+ --entry <state> (with no command at all) start a brand new process at
288
+ <state> — any declared, non-commit state — authenticated
289
+ as human
264
290
  --var <name>=<value>
265
291
  (with --entry; repeatable) supply a fixed it.vars
266
292
  override for the new process; the name must already be
@@ -271,44 +297,46 @@ Options:
271
297
 
272
298
  `--version` (`-v`) / `gtd version` and `--help` (`-h`) / `gtd help`
273
299
  short-circuit before any git or repository-state work — they run outside a repo
274
- and in any repo state. Bare `gtd` (no subcommand) and `gtd loop` both launch the
275
- loop driver immediately — neither is a usage error. Any other, truly unknown
276
- subcommand is a usage error: it prints the help text and exits 1 without
277
- touching the repository. Every other (recognized) command must be run from the
300
+ and in any repo state. Bare `gtd` (no subcommand) and `gtd loop` are both usage
301
+ errors that exit 1 and print help — gtd decides and prints, full stop; driving a
302
+ loop is a driver's job, not a bundled command (see
303
+ [Driving the loop](#driving-the-loop) below). Any other, truly unknown
304
+ subcommand is likewise a usage error: it prints the help text and exits 1
305
+ without touching the repository. The state commands (`land`, `--entry`,
306
+ `abandon`, `restore`, `next`, `status`, `validate`) must run from the
278
307
  **repository root** — gtd derives the workflow, pending changes, and process
279
- history relative to cwd, so it refuses with a clear error if invoked from a
280
- subdirectory.
281
-
282
- `--json`, `--cost=<n>`, `--model=<name>` (the latter two only for `gtd step`),
283
- `--entry <state>` (`gtd step` or no command at all), and `--var <name>=<value>`
284
- (with `--entry`, repeatable) are the only long options the compiled bundle
285
- recognizes. `--entry`/`--var` accept both the `--flag=value` and the
286
- space-separated `--flag value` form. Any other `--` option (including a typo
287
- like `--jsn`) is rejected with a usage error rather than silently ignored, so a
288
- mistyped flag can never degrade a JSON caller to plain-text mode. `--var` with
289
- no `--entry`, a duplicate `--var` name, or `--cost`/`--model` combined with
290
- `--entry` are all usage errors too. A bare `--cost`/`--model` with no value, a
291
- non-numeric or negative `--cost`, an empty `--model`, `--model` without
292
- `--cost`, or either flag on any command other than `gtd step` are all usage
293
- errors.
294
-
295
- `--once` is a separate, bash-level flag handled entirely by the `bin/gtd` driver
296
- itself, stripped before anything reaches the bundle.
308
+ history relative to cwd, so they refuse with a clear error from a subdirectory;
309
+ `lsp`, `init`, `visualize`, `check`, and `install` are standalone and run from
310
+ anywhere (see each command's own help entry).
311
+
312
+ `--json`, `--cost=<n>`, `--model=<name>` (the latter two only for `gtd land`),
313
+ `--entry <state>` (no other command at all), and `--var <name>=<value>` (with
314
+ `--entry`, repeatable) are the only long options the compiled bundle recognizes.
315
+ `--entry`/`--var` accept both the `--flag=value` and the space-separated
316
+ `--flag value` form. Any other `--` option (including a typo like `--jsn`) is
317
+ rejected with a usage error rather than silently ignored, so a mistyped flag can
318
+ never degrade a JSON caller to plain-text mode. `--var` with no `--entry`, a
319
+ duplicate `--var` name, or `--cost`/`--model`/`--entry` combined with another
320
+ command are all usage errors too — landing and entering are different verbs, so
321
+ `gtd land --entry <state>` is a usage error, not a synonym. A bare
322
+ `--cost`/`--model` with no value, a non-numeric or negative `--cost`, an empty
323
+ `--model`, `--model` without `--cost`, or `--cost`/`--model` on any command
324
+ other than `gtd land` are all usage errors.
297
325
 
298
326
  ### `gtd status`'s `Next:`/`next`
299
327
 
300
328
  Both plain and `--json` output include a headline preview of what would happen
301
329
  next: the first declared `on` edge whose pattern matches the pending changes AS
302
- A WHOLE (the same first-match-wins semantics `gtd step` itself uses), using its
330
+ A WHOLE (the same first-match-wins semantics `gtd land` itself uses), using its
303
331
  `action` when the edge declares one, else its raw pattern, alongside its target
304
332
  state. Plain output prints a `Next: <action-or-pattern> → <target>` line (or
305
333
  `Next: (no match — nothing would happen)`); `--json`'s `next` key mirrors it as
306
334
  `{ action?, pattern, target }`, or `null` on no match.
307
335
 
308
336
  This reports the **declared** route only: a capped `retry` may redirect
309
- elsewhere at real step time, which `Next:`/`next` does not apply — it previews
310
- what the declared `on` patterns would match, not a guarantee of where a real
311
- `gtd step` lands.
337
+ elsewhere when the land is decided, which `Next:`/`next` does not apply — it
338
+ previews what the declared `on` patterns would match, not a guarantee of where a
339
+ real `gtd land` lands.
312
340
 
313
341
  ### Error envelope
314
342
 
@@ -332,31 +360,34 @@ already authored with its own `gtd:`/`gtd <cmd>:` prefix is never doubled.
332
360
 
333
361
  ## Driving the loop
334
362
 
335
- Bare `gtd` (or `gtd loop`) is a ready-to-run driver for the whole protocol —
336
- point it at a repo and it runs the loop until it's your turn. It drives the
363
+ gtd itself is not a loop — it decides and prints, full stop; driving a loop is a
364
+ driver's job. The README's minimal driver below (see
365
+ [A complete minimal driver](#a-complete-minimal-driver)) is that driver: save it
366
+ as `~/.local/bin/gtd-loop`, `chmod +x` it, and run it from a repository root —
367
+ it takes no arguments and runs the loop until it's your turn. It drives the
337
368
  autonomous states (agent turns, check runs) and stops at the first
338
- non-autonomous one: reaching a human gate it prints the gate and exits. You act
339
- by editing files (answer a plan question, tick a review box, fix code) and
340
- re-launching it — its opening move captures whatever you left, so you never run
341
- `gtd step human` by hand.
369
+ non-autonomous one: reaching a human gate it prints the gate's message and
370
+ exits. You act by editing files (answer a plan question, tick a review box, fix
371
+ code) and re-running it — your pending edit arrives as the loop's first beat
372
+ (`kind: "capture"`, landed immediately), so you never run `gtd land` by hand.
373
+
374
+ Some gates accept by INACTION instead: the bundled template's `plan.await-plan`
375
+ routes its `"C"` (clean-tree) pattern onward, so changing nothing there means
376
+ "accept the plan". That reaches the driver as `kind: "message"`, which no
377
+ inspection can tell apart from a gate you have not read yet — so the driver
378
+ treats its OPENING beat as yours either way and lands it: you re-ran it while
379
+ resting there, and that invocation IS the decision. Every later beat halts as
380
+ usual, because a gate the driver produced mid-run is one you have not seen.
381
+ Landing an opening beat at a gate with no `"C"` pattern is harmless — a benign
382
+ no-op (see `gtd land`'s exit codes below) — and the gate then prints on the next
383
+ beat. A mid-process restart simply resumes driving from whatever beat is
384
+ actually next.
342
385
 
343
386
  Anything richer at that boundary — opening your editor, desktop notifications,
344
- terminal-multiplexer status — is the job of an outer wrapper around `gtd`, not
345
- of the loop itself; see
387
+ terminal-multiplexer status — is the job of an outer wrapper around the driver,
388
+ not of the loop itself; see
346
389
  [Terminal-multiplexer status: a herdr wrapper](#terminal-multiplexer-status-a-herdr-wrapper)
347
- below for a worked example. Pass `--once` to restrict a run to exactly one beat
348
- — one human-gate capture, one check, or one agent turn — instead of driving all
349
- the way to idle.
350
-
351
- Bare `gtd` prints one line per event — colored and emoji on a real terminal,
352
- plain ASCII under `NO_COLOR` or when piped — and redirects the noisier
353
- agent/check/step subprocess output to a per-repo/per-worktree log file (its path
354
- is the run's first output line, ready to `tail -f`). Any execution that FAILS
355
- also replays its last 20 lines of output inline on stderr, on top of the log
356
- still holding the complete record: an agent turn that fails stops the loop (it
357
- would fail identically next lap), while a check script that exits non-zero is
358
- reported as a warning and the loop carries on, because the outcome lives in the
359
- tree, not in the script's exit code.
390
+ below for a worked example.
360
391
 
361
392
  A workflow state can declare an optional `label:` — a human-readable display
362
393
  name surfaced in `gtd next --json`/`gtd status`. The driver uses it for its
@@ -388,20 +419,30 @@ resumes an implementer's session, and vice versa** — a reviewer machine and th
388
419
  implementer machine it reviews are always different instances with different
389
420
  scopes.
390
421
 
391
- The loop driver (`bin/gtd`) tracks this as a per-scope **session table** — one
392
- `<key> <session_id>` row per scope — persisted at `$gitdir/gtd-loop-memory` (the
393
- git dir, never the working tree, so `gtd status` and the pending diff never see
394
- it), not a single "last" value: this is what lets a scope's session survive an
395
- excursion into a child machine's own agent turn (the child writes its own row;
396
- the parent's row is untouched). On each agent-prompt turn, the driver looks the
397
- current key up by exact string match against the table (a hit resumes that row's
398
- session, a miss starts fresh) and, on write, replaces only the ONE row whose
399
- scope matches the current key's scope — every other scope's row is left as-is.
400
- This is exported to the agent adapter as `$GTD_LOOP_MEMORY` (the key),
401
- `$GTD_LOOP_SESSION_ID`, and `$GTD_LOOP_MEMORY_RESUME` (`"1"` when resuming). If
402
- the remembered session no longer exists (retention expired, `~/.claude/projects`
403
- wiped, a machine change), the driver degrades to a fresh session with a warning
404
- instead of stopping the loop.
422
+ `gtd` itself stores NOTHING to make this work: `session.id` is
423
+ `UUIDv5(<fixed gtd namespace>, <memory key>)` — a deterministic hash of the
424
+ computed `<scope>#<hash7>` key above — so the same scope-run always re-derives
425
+ the exact same id, and there is no table, no file, no write to keep in sync.
426
+ `session.resume` is `true` iff a prior `prompt` turn already landed within that
427
+ same scope-run. Because nothing is written, calling `gtd next --json` twice in a
428
+ row — a driver's own opening peek, a status poll, a curious human — derives
429
+ IDENTICAL `session.id`/`session.resume` values both times, since there is
430
+ nothing to poison: looking is free, and there is no separate claiming form to
431
+ protect. The per-scope survival story (a child machine's own excursion doesn't
432
+ disturb the parent's session) falls out of the key itself, not out of a
433
+ per-scope row: the parent's anchor commit is unaffected by whatever the child
434
+ scope does in between. A driver maps `session.id`/`session.resume` straight onto
435
+ the agent CLI's own session flags — the README's minimal driver passes them as
436
+ `--session-id <id>`/`--resume <id>` to `claude -p`, but treats `resume` as a
437
+ HINT rather than a contract: it tries the flag `resume` points at first and
438
+ falls back to the other on failure. That fallback is what recovers BOTH
439
+ mismatches that used to need manual intervention — a crashed prior turn that
440
+ minted an id but landed no commit (so the next lap re-derives the SAME id with
441
+ `resume: false`, and `--session-id` on an already-used id fails, so the driver
442
+ falls back to `--resume`), and the inverse (`resume: true`, but the remembered
443
+ session is gone — retention expired, `~/.claude/projects` wiped — so `--resume`
444
+ fails and the driver falls back to `--session-id`). There is no file to delete
445
+ and nothing to restart.
405
446
 
406
447
  ### Terminal-multiplexer status: a herdr wrapper
407
448
 
@@ -410,19 +451,18 @@ reports `gtd`'s own lifecycle to that status without any herdr-specific
410
451
  knowledge in `gtd` itself: `working` while the loop drives, `blocked` when it
411
452
  comes to rest on a human (a gate, a stall, a non-zero exit), and `idle`
412
453
  (rendered as "done" once the pane's tab is unfocused) when a run ends without
413
- anything owed. It needs nothing from `gtd` beyond `gtd next --json`'s `.actor`
414
- field, which the loop's driver already reads at every beat.
454
+ anything owed. It needs nothing from `gtd` beyond `gtd status --json`'s `.actor`
455
+ field — a strictly read-only orientation peek.
415
456
 
416
457
  Save this as `~/.local/bin/gtdh`, `chmod +x` it, and run `gtdh` in place of
417
- `gtd` — it's a plain bash file, so it works from fish or any other shell, and it
418
- forwards every argument (`gtdh --once`, `gtdh status`, ...).
458
+ `gtd-loop` — it's a plain bash file, so it works from fish or any other shell.
419
459
 
420
460
  ```bash
421
461
  #!/usr/bin/env bash
422
462
  # Report gtd's own lifecycle to the herdr pane it runs in: working while the
423
463
  # loop drives, blocked when it rests on you, idle (shown as "done") otherwise.
424
- # Needs nothing from gtd but `gtd next --json`. Outside herdr it is a plain
425
- # passthrough. Requires `jq` — so does gtd's own loop driver.
464
+ # Needs nothing from gtd but `gtd status --json`. Outside herdr it is a plain
465
+ # passthrough. Requires `jq` — so does the README's minimal driver.
426
466
  set -uo pipefail
427
467
 
428
468
  pane="${HERDR_PANE_ID:-}"
@@ -444,12 +484,15 @@ trap 'report blocked; exit 130' INT TERM
444
484
  # without it no `claude -p` turn reports a claude SESSION identity for this
445
485
  # pane. That is load-bearing, not cosmetic — a pane that owns one rejects every
446
486
  # later state report, so the report below would be dropped.
447
- env -u HERDR_PANE_ID gtd "$@"
487
+ env -u HERDR_PANE_ID gtd-loop
448
488
  rc=$?
449
489
 
450
- # Whose turn is it now? `gtd next --json` is mutation-free. A human actor means
451
- # gtd is waiting on you; anything else means the run ended with nothing owed.
452
- actor="$(gtd next --json 2>/dev/null | jq -r '.actor // ""' 2>/dev/null || true)"
490
+ # Whose turn is it now? `gtd status --json` is a strictly read-only peek —
491
+ # every gtd command is, including `gtd next --json` (its prompt session id is
492
+ # derived, never minted/stored) — only the emitted scripts a driver runs
493
+ # actually touch git. A human actor means gtd is waiting on you; anything else
494
+ # means the run ended with nothing owed.
495
+ actor="$(gtd status --json 2>/dev/null | jq -r '.actor // ""' 2>/dev/null || true)"
453
496
 
454
497
  if [ "$rc" -ne 0 ] || [ -z "$actor" ] || [ "$actor" = human ]; then
455
498
  report blocked
@@ -484,53 +527,221 @@ than the state itself.
484
527
 
485
528
  ## Writing your own driver
486
529
 
487
- `bin/gtd` is gtd's own reference driver, not a privileged one — the engine
488
- itself is a supported public surface, and anything below holds for any driver
489
- you write against it. gtd decides and prints; it never touches git itself. The
490
- four commands that change anything — `gtd step [<actor>]` (including
491
- `--entry <state>`), `gtd abandon`, and `gtd restore` — perform no git write when
492
- run. Instead, under `--json`, each one's output object carries two extra string
493
- fields, `required` and `optional`: bash scripts for YOU to execute. (Plain-text
494
- output, without `--json`, never shows these — it prints only the human-facing
495
- result line, e.g. `committed: <subject>`, so a plain-text caller never sees a
496
- script at all.) A driver that only prints gtd's plain-text output is not driving
497
- anything; to actually land a turn, run `gtd ... --json`, pull `required`/
498
- `optional` out with `jq`, and execute them.
530
+ Run `gtd install` to print this whole chapter's protocol as a complete,
531
+ self-contained briefing — paste it into an agent's context (or read it yourself)
532
+ to build a driver without leaving your terminal. The briefing ends by directing
533
+ the agent to INTERVIEW you first — which agent CLI runs the turns, under what
534
+ permission model, how you want to invoke the loop, what should happen at a human
535
+ gate — and to build the driver your answers describe rather than copying the
536
+ reference bash. It writes nothing: "install" means installing knowledge into the
537
+ calling agent's context, and the briefing it prints is always exactly as current
538
+ as the `gtd` that printed it.
539
+
540
+ The README's minimal driver below is gtd's own reference driver, not a
541
+ privileged one — the engine itself is a supported public surface, and anything
542
+ below holds for any driver you write against it. gtd decides and prints; it
543
+ never touches git itself. The four commands that change anything — `gtd land`,
544
+ `gtd --entry <state>`, `gtd abandon`, and `gtd restore` — perform no git write
545
+ when run. Instead, each one's output carries `required`/ `optional`: bash
546
+ scripts for YOU to execute. Plain-text output (no `--json`) prints them combined
547
+ into ONE pasteable script — `required` verbatim, then `optional` wrapped so its
548
+ own failure can't turn a landed turn into a non-zero exit — so `gtd land | bash`
549
+ is a complete, single-command way to land a turn. Under `--json`, each one's
550
+ output object instead carries `required`/`optional` as two separate string
551
+ fields (plus, for `gtd land`, the same two combined into `script`), for a driver
552
+ that wants to run them apart (e.g. to skip `optional` outright). Either way,
553
+ printing gtd's output and never running it is not driving anything; a driver
554
+ must pipe or `jq`-and-execute what gtd prints.
499
555
 
500
556
  - **`required`** is everything that decides what lands in git — closing an open
501
557
  review checkout window, the resting state's own steering-mode
502
- `format:`/`validate:` commands, then the commit or squash itself (`gtd step`
503
- and `gtd --entry <state>`), or the ref update and reset that undo a process
504
- (`gtd abandon`, `gtd restore`). Run this one. Skipping it means the turn never
505
- lands.
558
+ `format:`/`validate:` commands, the commit or squash itself (`gtd land` and
559
+ `gtd --entry <state>`), or the ref update and reset that undo a process
560
+ (`gtd abandon`, `gtd restore`) — and, last, a printed line naming what just
561
+ landed (`src/OutcomeScript.ts`'s `gtd_report_*` calls): a transition or
562
+ capture's changed-file rows, or the abandon/restore prose, resolved from the
563
+ repository AFTER the write above it. Run this one. Skipping it means the turn
564
+ never lands, and you never see what it did.
506
565
  - **`optional`** is presentation only: re-opening the review checkout window
507
- (the `<<<<<<< HEAD` diff view) after a `gtd step` lands at a
566
+ (the `<<<<<<< HEAD` diff view) after `gtd land` lands at a
508
567
  `reviewWindow: true` state, so an editor's diff view has something to show.
509
568
  Skip it and you lose nothing but that view — the workflow is still driven
510
569
  correctly. `gtd abandon`/`gtd restore` always emit `optional: ""` (there is no
511
570
  window to reopen after either).
512
571
 
513
- Either field may be the empty string `""`, meaning "nothing to do here" — a
514
- no-op `gtd step` (a clean tree matching no `on` pattern) emits
515
- `required: ""`/`optional: ""` and exits zero; run nothing and move on. Both
516
- scripts are self-contained (each carries its own precondition assert and retry
517
- helper) and safe to run standalone, in sequence, or not at all — paste either
518
- into a terminal and it does exactly what it says.
572
+ `gtd next --json` carries one more field worth a custom driver's attention:
573
+
574
+ - **`log`** — the per-worktree loop log path, always present. It's derived from
575
+ the worktree's own git dir, so two worktrees looping concurrently never share
576
+ one file; set `$GTD_LOOP_LOG` to override it verbatim. gtd itself neither
577
+ creates nor truncates this file — a driver appends subprocess output to it and
578
+ truncates once at the start of a run, exactly like the driver above does.
579
+
580
+ `optional` may be the empty string `""`, meaning "nothing to do here".
581
+ `required` is never empty — even a genuine no-op `gtd land` (a clean tree
582
+ matching no `on` pattern) emits a PRINT-ONLY script: no git write, just the same
583
+ `nothing to do at "<state>"` line the script prints when a driver runs it (or,
584
+ under plain text with no `--json`, when gtd prints the very same script back to
585
+ you). Both scripts are self-contained (each carries its own precondition assert
586
+ and retry helper) and safe to run standalone, in sequence, or not at all — paste
587
+ either into a terminal and it does exactly what it says, printed output
588
+ included: the scripts detect their own tty/`NO_COLOR` at RUN time (not at the
589
+ moment gtd generated them), so the fancy/plain rendering always matches wherever
590
+ you actually run them.
591
+
592
+ A driver has no opening move. It does not need to know whose turn it is before
593
+ it starts — `gtd next --json` tells it, and a human's pending edit arrives as an
594
+ ordinary `kind: "capture"` beat that the driver lands like any other. The rule
595
+ this replaces: never `gtd land` outside a beat you dispatched. A stray land at a
596
+ clean `prompt` rest authors an empty attempt on purpose (that IS the stall
597
+ bookkeeping), so an unconditional opening land would manufacture a stall out of
598
+ a fresh start.
599
+
600
+ `gtd land`'s exit code IS the settled signal: 0 for an ordinary landing
601
+ (capture, turn, attempt, squash, or a benign no-op at a clean `message` rest), 3
602
+ for SETTLED, 1 for a refusal or usage error. SETTLED means nothing owed, for
603
+ either of two terminal shapes — a no-op at a `script` rest (the check ran, left
604
+ nothing any pattern claims, and re-running the same beat cannot change that), or
605
+ a step whose decision rewinds the process back to the workflow's initial state
606
+ retaining nothing (`gtd --entry fix-precheck` against a green suite is the
607
+ shipped example — the probe collapses away rather than landing a round trip
608
+ through the log). Either way a loop should exit rather than spin — with
609
+ `set -o pipefail`, `gtd land | bash` propagates gtd's own exit code through the
610
+ pipe, and `--json` carries the same fact as `settled: true`. A no-op at a
611
+ `prompt` rest is NOT settled — an agent that was asked to act and produced
612
+ nothing is a stall, a driver's own concern, not this signal's. Declaring a `C`
613
+ edge on a `script` state is the workflow-side way to make the state advance
614
+ instead of settling.
615
+
616
+ ### Drivers other than bash
617
+
618
+ The protocol above is JSON in, subprocesses out — bash is one convenient shape,
619
+ not the only one. A **program** parses `gtd next --json`, switches on `kind`,
620
+ and runs `content`/`required`/`optional` as subprocesses — no bash anywhere in
621
+ it. A **human** runs plain `gtd next` (no `--json`), does what it says, and
622
+ pastes `gtd land | bash`: plain-text output exists for exactly this, printing
623
+ `required` and `optional` already combined into one pasteable script. An
624
+ **agent** gets `gtd install` as its instructions — the same protocol, in a form
625
+ built to be pasted into a context window rather than read. A **CI job** is the
626
+ program case with the `prompt` arm pointed at a headless agent CLI, and
627
+ `kind: "message"`/`kind: "stalled"` mapped onto "stop and report".
628
+
629
+ ### A complete minimal driver
630
+
631
+ This is the whole protocol described above, compressed into a loop small enough
632
+ to paste from this README and own outright — save it as `~/.local/bin/gtd-loop`
633
+ (`chmod +x`) and it's the ready-to-run driver
634
+ [Driving the loop](#driving-the-loop) above points at; swap the `claude` line
635
+ for any agent CLI and it keeps working.
636
+
637
+ This exact fenced block is extracted and executed by
638
+ `tests/integration/features/readme-driver.feature` — renaming the heading above
639
+ or splitting the block into more than one fence breaks the build.
640
+
641
+ ```bash
642
+ #!/usr/bin/env bash
643
+ set -euo pipefail
644
+
645
+ # The bundle plans; this executes. Emitted scripts print their own outcomes.
646
+ # Exit 3 means SETTLED — nothing owed — so this exits the whole driver at 0.
647
+ gtd_land() {
648
+ local json code=0
649
+ json="$(gtd land --json)" || code=$?
650
+ [ "$code" = 0 ] || [ "$code" = 3 ] || return "$code"
651
+ bash -c "$(jq -r '.required // empty' <<<"$json")" || return $?
652
+ bash -c "$(jq -r '.optional // empty' <<<"$json")" ||
653
+ echo "warn: presentation follow-up failed — continuing" >&2
654
+ [ "$code" = 3 ] && exit 0
655
+ return 0
656
+ }
657
+
658
+ beat=1
659
+ while :; do
660
+ next="$(gtd next --json)" || exit 1
661
+ kind="$(jq -r .kind <<<"$next")"
662
+ log="$(jq -r .log <<<"$next")"
663
+ case "$kind" in
664
+ stalled) jq -r .content <<<"$next" >&2; exit 1 ;;
665
+ # you re-ran us resting here: you either edited something or accepted by
666
+ # editing nothing, so land the opening beat either way. Later beats are
667
+ # gates we just produced and you have not read yet — hand off.
668
+ message) [ "$beat" = 1 ] || { jq -r .content <<<"$next"; exit 0; } ;;
669
+ capture) ;; # the human already acted — just land it
670
+ script) bash -c "$(jq -r .content <<<"$next")" >>"$log" 2>&1 || true ;;
671
+ prompt)
672
+ sid="$(jq -r '.session.id // empty' <<<"$next")"
673
+ c="$(jq -r .content <<<"$next")" model="$(jq -r '.model // empty' <<<"$next")"
674
+ agent_turn() { claude -p "$c" "$1" "$sid" ${model:+--model "$model"} \
675
+ --dangerously-skip-permissions >>"$log" 2>&1; }
676
+ if [ "$(jq -r '.session.resume // false' <<<"$next")" = true ]
677
+ then agent_turn --resume || agent_turn --session-id
678
+ else agent_turn --session-id || agent_turn --resume
679
+ fi
680
+ v="$(jq -r '.validate // empty' <<<"$next")" n=0
681
+ while [ -n "$v" ] && ! out="$(bash -c "$v" 2>&1)"; do
682
+ n=$((n + 1)) && [ "$n" -gt 3 ] && { printf '%s\n' "$out" >&2; exit 1; }
683
+ claude -p "$out" --resume "$sid" --dangerously-skip-permissions \
684
+ >>"$log" 2>&1 # $out IS the fix prompt, verbatim
685
+ done ;;
686
+ esac
687
+ gtd_land || exit 1
688
+ beat=$((beat + 1))
689
+ done
690
+ ```
691
+
692
+ Line by line it is the protocol described above: no opening move at all — a
693
+ human's pending edit arrives as the `capture` beat, and a stray `gtd land`
694
+ outside a beat you acted on would author an empty attempt at a clean prompt rest
695
+ on purpose; one `gtd next --json` beat document read per loop (`kind: "stalled"`
696
+ guarding against a spinning agent); `message` halts unless it is the opening
697
+ beat, which the human's own re-invocation authored and which therefore lands
698
+ like any other decision (see [Driving the loop](#driving-the-loop) above — this
699
+ is the one place the driver, not gtd, decides, because "has the human read this
700
+ gate" is run-scoped knowledge gtd deliberately does not keep); `capture` lands a
701
+ human's already-made edit outright, `script` runs in the driver, `prompt` goes
702
+ to the agent with the document's own `session.id`/`session.resume` mapped onto
703
+ the agent's session flags — trying `resume`'s hinted flag first and falling back
704
+ to the other on failure, since `session.id` is derived, not remembered (see
705
+ [Driving the loop](#driving-the-loop) above) — and its embedded `.validate`
706
+ script's output re-prompted verbatim on failure (the driver owns only the retry
707
+ cap); and every landed turn executed — and reported — by the emitted scripts
708
+ themselves, with `gtd land`'s exit 3 (SETTLED) ending a run that has nothing
709
+ left to do.
710
+
711
+ ### The self-validation gate
712
+
713
+ After an agent turn at a state that declares `file:`+`mode:`, run the script:
714
+ either `gtd next --json`'s own embedded `.validate` field (present at every
715
+ `prompt` beat that hands over a validatable file), or, standalone,
716
+ `gtd validate --json`'s `.script` — both resolve the exact same script from one
717
+ shared resolver. Exit 0 means the file is well-formed — proceed to `gtd land`. A
718
+ non-zero exit means the script's own captured output IS a complete,
719
+ ready-to-send fix prompt (an instruction plus the findings, see `src/Emit.ts`'s
720
+ `failurePromptWrapper`): send it back to the same agent session verbatim, and
721
+ cap how many fix attempts you allow yourself — the driver owns that retry count,
722
+ not gtd. Landing never TRUSTS that you validated, either: the emitted `land`
723
+ script carries the same format/validate commands ahead of its own commit and
724
+ fails without committing when they fail, so a malformed file is never captured
725
+ whether or not you ran the validate script first.
519
726
 
520
727
  ### Failure taxonomy and recovery
521
728
 
522
- Two different things can go wrong, and they mean different things:
729
+ Two different things can go wrong, and they mean different things — and one
730
+ non-zero-looking exit is not a failure at all:
523
731
 
524
- - **`gtd` itself exits non-zero.** Nothing was attempted — this is a refusal (a
525
- guard rejected the turn) or a usage error. No script was ever produced.
732
+ - **`gtd` itself exits 1.** Nothing was attempted — this is a refusal (a guard
733
+ rejected the turn) or a usage error. No script was ever produced.
734
+ - **`gtd land` exits 3 (SETTLED).** This is NOT a failure: nothing is owed, and
735
+ stdout still carries a script (a print-only note, or a genuine retain+rewind)
736
+ that a driver must still run.
526
737
  - **An emitted script exits non-zero when YOU run it.** Something may have
527
738
  partially happened — e.g. a `gtd_retry`-wrapped git write landed but a later
528
739
  step in the same script failed.
529
740
 
530
- Recovery is the same in both cases: **re-invoke `gtd`.** It re-reads the real
531
- repository state fresh every time — never a cached plan — and emits whatever
532
- still needs to happen from there. This works because every emitted script opens
533
- by asserting its own precondition
741
+ Recovery is the same in every case: **ask gtd again** (`gtd next`, then land).
742
+ It re-reads the real repository state fresh every time — never a cached plan —
743
+ and emits whatever still needs to happen from there. This works because every
744
+ emitted script opens by asserting its own precondition
534
745
  (`[ "$(git rev-parse --verify --quiet HEAD 2>/dev/null)" = <expected> ] || { ...; exit 1; }`,
535
746
  and the same shape for a review window's saved ref — see `src/Emit.ts`'s
536
747
  `headAssertion`/`reviewWindowAssertion`), so a script generated against a
@@ -567,10 +778,10 @@ retry/resume logic beyond "if the script failed, ask gtd again."
567
778
  ### The normalization-only contract on `format:`
568
779
 
569
780
  A mode's `format:` command may reformat a steering file — whitespace, wrapping,
570
- reordering — but must NEVER change what a step-capture guard would decide. gtd's
781
+ reordering — but must NEVER change what a land-capture guard would decide. gtd's
571
782
  guards (the review sign-off check, the feedback-progress check, the
572
783
  answer-completeness check — `src/StepGuards.ts`) decide ONCE, against whichever
573
- bytes are on disk at the moment `gtd step` runs, which may be before OR after an
784
+ bytes are on disk at the moment `gtd land` runs, which may be before OR after an
574
785
  emitted script's own `format:` line has run (the script runs `format:` then
575
786
  `validate:` then the commit — see `src/SteeringMode.ts`'s
576
787
  `renderSteeringCommands` — but gtd's decision and the driver's script execution
@@ -698,8 +909,8 @@ workflow:
698
909
 
699
910
  There is no `memory:` key anywhere in this shape — a state's memory scope is
700
911
  never authored, only computed from its position in the machine tree (see
701
- [Driving the loop](#driving-the-loop) above for the key format and the driver's
702
- per-scope session table).
912
+ [Driving the loop](#driving-the-loop) above for the key format and how it
913
+ derives a driver's session id).
703
914
 
704
915
  The top-level `entry:` key (naming the root machine, `entry.default`) and a
705
916
  state's own `entry: true` flag are the same word at two different levels, by
@@ -753,11 +964,10 @@ model, pattern grammar, load-time rules, and how to verify a change compiles.
753
964
  > Those two keys, and the `gtd review <commitish>`/`gtd fix` commands that used
754
965
  > them, are gone. Replace `entry.review: <target>`/`entry.fix: <target>` with a
755
966
  > plain `entry: true` flag on that same state, and enter it with
756
- > `gtd step <actor> --entry <state>` (or the actor-less short form
757
- > `gtd --entry <state>`) instead of the removed commands.
967
+ > `gtd --entry <state>` instead of the removed commands.
758
968
  > `gtd review <commitish>` required a clean tree and a `<commitish>` argument;
759
969
  > the replacement instead captures whatever is pending in the working tree (just
760
- > like an ordinary `gtd step`) and takes the commitish as a
970
+ > like an ordinary `gtd land`) and takes the commitish as a
761
971
  > `--var reviewBase=<commitish>` override consumed by that state's own
762
972
  > template-form `reviewBase:` (see the `workflow:` shape above and
763
973
  > [`gtd --entry`](#commands)). `gtd fix` likewise becomes
@@ -821,12 +1031,11 @@ assembled from four layers, **later wins**:
821
1031
  2. **A top-level `.gtdrc` `vars:` key** (a sibling of `workflow:`, NOT nested
822
1032
  inside it) — per-repo tuning without redefining the whole workflow.
823
1033
  3. **The current process's entry `--var` overrides**, if it was started via
824
- `gtd step <actor> --entry <state>`/`gtd --entry <state>` — repeatable
825
- `--var <name>=<value>` flags fixed at the moment of entry and recorded as
826
- `Gtd-Var: <name>=<value>` trailers on the process's oldest commit, re-parsed
827
- on every turn for as long as that process is underway. Each `--var` name must
828
- already be declared by layer 1 or 2; an undeclared name is a usage error, not
829
- a silent no-op.
1034
+ `gtd --entry <state>` — repeatable `--var <name>=<value>` flags fixed at the
1035
+ moment of entry and recorded as `Gtd-Var: <name>=<value>` trailers on the
1036
+ process's oldest commit, re-parsed on every turn for as long as that process
1037
+ is underway. Each `--var` name must already be declared by layer 1 or 2; an
1038
+ undeclared name is a usage error, not a silent no-op.
830
1039
  4. **`GTD_<UPPERCASE-name>` environment variables** — highest precedence,
831
1040
  checked at every invocation, case-insensitively against each name already
832
1041
  declared by layers 1–3: `GTD_TESTCOMMAND` overrides `testCommand`. The
@@ -863,7 +1072,7 @@ Config-shape problems (unknown keys, wrong types, unreadable file references)
863
1072
  are collected together; if the shape is clean, the assembled definition is
864
1073
  additionally run through the engine's own validation. A bad config throws
865
1074
  **one** error listing every finding, at load time — before anything touches the
866
- repository — never partially, and never deferred to step time:
1075
+ repository — never partially, and never deferred to land time:
867
1076
 
868
1077
  ```
869
1078
  workflow config:
@@ -887,7 +1096,7 @@ the compiler's job at load time.
887
1096
  - **Single writer, linear branch.** A process's history is walked via
888
1097
  **first-parent** commits only.
889
1098
  - **Test/build artifacts must be gitignored.** This is **load-bearing**, not a
890
- style preference: every step decision detects "clean" via
1099
+ style preference: every land decision detects "clean" via
891
1100
  `git diff --name-status HEAD` (tracked changes) unioned with
892
1101
  `git ls-files --others --exclude-standard` (untracked files), which silently
893
1102
  omits anything matched by `.gitignore`. If a `script` state's command (or the
@@ -897,8 +1106,9 @@ the compiler's job at load time.
897
1106
  before wiring gtd into a repo.
898
1107
  - **Repository root invocation.** Every state subcommand must run from the git
899
1108
  repository root. `--help`/`--version` (and the `help`/`version` subcommands),
900
- `lsp`, and `visualize` skip this guard entirely (`visualize` still reads the
901
- `.gtdrc` workflow, but needs no git state).
1109
+ `lsp`, `init`, `visualize`, `check`, and `install` skip this guard entirely
1110
+ (`visualize` still reads the `.gtdrc` workflow, but needs no git state; `init`
1111
+ may even run outside a repository to seed a shared parent-dir config).
902
1112
  - **Linked worktrees are independent.** N `git worktree` worktrees of one
903
1113
  repository (sharing a single `.git`) each run their own gtd process: state is
904
1114
  derived from that worktree's own HEAD, and the review checkout window's refs
@@ -929,7 +1139,7 @@ but `gtd lsp` never runs a shell command per keystroke, so live diagnostics
929
1139
  become one `Information` notice pointing at `gtd validate` instead of the
930
1140
  built-in findings. Any OTHER mode name — `prose` (used by the simple flow's plan
931
1141
  file), or a project's own declared name — has no built-in format, so it gets no
932
- live editor support at all: `gtd validate`'s emitted script and the `gtd step`
1142
+ live editor support at all: `gtd validate`'s emitted script and the `gtd land`
933
1143
  gate still format and validate it like any other mode.
934
1144
 
935
1145
  ## Development
@@ -964,7 +1174,7 @@ now into a single snapshot, and whose `planStep`/`planEntry` pair separates
964
1174
  deciding a transition from performing it — so a command's own capture guards run
965
1175
  between the two. The edge reaches the outside world through two content ports
966
1176
  (`src/RepoFiles.ts` for working-tree and committed reads, `src/CommandRunner.ts`
967
- for the one place gtd spawns a subprocess itself), with the `gtd step` capture
1177
+ for the one place gtd spawns a subprocess itself), with the `gtd land` capture
968
1178
  guards (`src/StepGuards.ts`) built on top of them.
969
1179
 
970
1180
  `src/testing/` holds the in-memory git/config/filesystem test double every