@pmelab/gtd 9.12.0 → 9.14.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.
package/README.md CHANGED
@@ -1,7 +1,9 @@
1
1
  # gi[t]hings.**done**
2
2
 
3
- > „Fix all the tests." „✅ All tests pass!" „The E2E suite is red." „Ah, you
4
- > mean _those_ tests."
3
+ 🤓: „Fix all the tests."
4
+ 🤖: „✅ All tests pass!"
5
+ 😡: „The E2E suite is red."
6
+ 🤖: „Ah, you mean _those_ tests."
5
7
 
6
8
  **Chat is a terrible source of truth. Git isn't.**
7
9
 
@@ -21,27 +23,11 @@ Or run without installing (prefix every `gtd` below with `npx`) — see
21
23
  [Configuration](https://github.com/pmelab/gtd/blob/main/docs/configuration.md)
22
24
  for the settings most projects tune.
23
25
 
24
- ## First run
26
+ ## Quick start
25
27
 
26
- Paste this into your coding agent:
27
-
28
- ```
29
- !gtd install
30
- ```
31
-
32
- It prints a self-contained briefing that teaches the agent to set the project
33
- up, build two commands for itself in whatever shell or runtime it runs, and ask
34
- you what you want before it starts driving. You get one prompt to paste, not a
35
- state name to choose. The two commands: a **loop command** that drives beats
36
- until the process rests, and an **edit command** that opens the steering file
37
- the process is waiting on right now — falling back to `.gtd/TODO.md` when the
38
- resting state declares none. That fallback is also how you begin: on a clean
39
- repository the edit command opens the empty `.gtd/TODO.md`, and whatever you
40
- write there is the first sketch the whole process gets planned from.
41
-
42
- Writing a driver by hand instead? See
43
- [Driving the loop](https://github.com/pmelab/gtd/blob/main/docs/driver.md) for
44
- the full protocol and a complete minimal reference implementation.
28
+ Pipe the output of `gtd install` into your coding agent and answer its
29
+ questions. It should build you a script that will autonomously run the process
30
+ for you. Ask your agent if you have any questions.
45
31
 
46
32
  ## Why
47
33
 
@@ -52,14 +38,184 @@ the full protocol and a complete minimal reference implementation.
52
38
  lives in the commits, so another machine (or another person) picks up exactly
53
39
  where you left off.
54
40
  - **Files, not chat.** Plans live in `.gtd/` steering files (`REQUIREMENTS.md`,
55
- `ARCHITECTURE.md`, the package files under `.gtd/packages/`). Request changes
56
- by editing them, approve by leaving the tree clean — all in your own editor.
57
- There is no chat UI to lose.
41
+ `ARCHITECTURE.md`. Request changes by editing them, approve by leaving the
42
+ tree clean — all in your own editor. There is no chat UI to lose.
58
43
  - **Harness agnostic.** gtd emits prompts to stdout (or JSON). Claude Code, a
59
44
  bash loop, a CI job, or you reading it out loud — the workflow doesn't care
60
45
  who executes it.
61
46
 
62
- The loop behind all of this is one beat, repeated:
47
+ See [gtd --help](https://github.com/pmelab/gtd/blob/main/docs/cli.md) for the
48
+ full command/flag reference, and
49
+ [Configuration](https://github.com/pmelab/gtd/blob/main/docs/configuration.md)
50
+ for how to inspect or replace the workflow itself.
51
+
52
+ ## Basic concept
53
+
54
+ Two commands make up the whole cycle. **`gtd next` says what to do now.
55
+ `gtd land` records that it is done — as a commit.** Everything else follows from
56
+ that.
57
+
58
+ The fastest way to understand it is to drive a few beats by hand. Any git
59
+ repository with at least one commit will do — the first two beats need no setup
60
+ at all, and `gtd init` seeds the one setting that matters later (your test
61
+ command).
62
+
63
+ ### Beat 1 — `gtd next` says whose turn it is
64
+
65
+ ```bash
66
+ gtd next
67
+ ```
68
+
69
+ ```
70
+ No active gtd process.
71
+
72
+ To start one, make ANY change — a hand-edit to real code, a scratch note,
73
+ anything at all. .gtd/TODO.md is a good default place to start sketching.
74
+ ```
75
+
76
+ This means its your turn. Add a `TODO.md` file with a detailed, well articulated
77
+ idea:
78
+
79
+ ```bash
80
+ mkdir -p .gtd
81
+ echo "Make a billion dollar SaaS. Make no mistakes." > TODO.md
82
+ ```
83
+
84
+ Ask again, and the header now reports what gtd sees:
85
+
86
+ ```
87
+ Pending:
88
+ A TODO.md -> * **
89
+ Next: Start → unwind
90
+ ```
91
+
92
+ Your change matched the pattern `* **`, which routes to the `unwind` state. For
93
+ the moment its not important what that is. Important is the fact that changes to
94
+ the source tree control what is going to happen next.
95
+
96
+ ### Beat 2 — `gtd land` records it as a commit
97
+
98
+ `gtd land` prints a shell script and deliberately does not run it. Read it, then
99
+ pipe it:
100
+
101
+ ```bash
102
+ gtd land | sh
103
+ ```
104
+
105
+ ```
106
+ -> idle → unwind
107
+ .gtd/TODO.md
108
+ ```
109
+
110
+ ```bash
111
+ $ git log --oneline
112
+ 0fb0300 gtd(human): idle → unwind
113
+ 75b6836 chore: initial commit
114
+ ```
115
+
116
+ One beat, one commit. That commit **is** the state — nothing is stored anywhere
117
+ else, which is why the process survives a reboot and travels with the branch.
118
+
119
+ ### Beat 3 — the same two commands, now for a machine
120
+
121
+ ```bash
122
+ gtd next
123
+ ```
124
+
125
+ ```
126
+ State: unwind
127
+ Awaits: check
128
+ Label: Unwinding your input
129
+
130
+ #!/usr/bin/env sh
131
+ ...
132
+ git revert --no-commit "$commit"
133
+ ```
134
+
135
+ `Awaits: check` means this beat is not yours: it is a script. gtd never runs
136
+ anything itself, so run it and land it exactly as before:
137
+
138
+ ```bash
139
+ eval "$(gtd next --sh)"; sh -c "$gtd_content"
140
+ gtd land | sh
141
+ ```
142
+
143
+ Plain `gtd next` prints that human-readable header, so it is not pipeable into
144
+ `sh` — the runnable bytes come from `--sh` or `--json`.
145
+
146
+ Keep going and the beats keep arriving. The next one checks that your test
147
+ baseline is green:
148
+
149
+ ```
150
+ State: start-gate.check
151
+ Awaits: check
152
+ Next: C → design.triage
153
+ ```
154
+
155
+ `C` is the clean-tree pattern: the suite passed, nothing changed, so move on to
156
+ triage. A red suite instead writes `.gtd/FEEDBACK.md`, which matches a different
157
+ pattern and routes to `start-gate.blocked` — same two commands, different
158
+ outcome, decided entirely by what the beat left in the tree.
159
+
160
+ Land the green one, and the beat after it belongs to an agent.
161
+
162
+ ### Beat 4 — handing a beat to Claude
163
+
164
+ ```bash
165
+ gtd next | head -2
166
+ ```
167
+
168
+ ```
169
+ This file is a deliverable, not a chat reply — size follows the work, and
170
+ padding is the target of any cut. Lead with the answer immediately; never ...
171
+ ```
172
+
173
+ That is the prompt itself — those bytes are an agent's input, so gtd prints
174
+ nothing around them. Ask for structure when you want to know whose turn it is:
175
+
176
+ ```bash
177
+ eval "$(gtd next --sh)"
178
+ printf '%s / %s / %s\n' "$gtd_kind" "$gtd_state" "$gtd_file"
179
+ ```
180
+
181
+ ```
182
+ prompt / design.triage / .gtd/REQUIREMENTS.md
183
+ ```
184
+
185
+ Now hand it over.
186
+
187
+ ```bash
188
+ printf '%s' "$gtd_content" | claude -p --session-id "$gtd_session_id" \
189
+ --model "$gtd_model" --dangerously-skip-permissions
190
+ ```
191
+
192
+ Two of those variables are worth understanding:
193
+
194
+ - **`$gtd_session_id`** is derived from your history, never stored, so the same
195
+ part of the workflow always resumes the same conversation — across restarts,
196
+ and even on another machine that checks out the branch. Because it is derived
197
+ rather than remembered, treat `$gtd_session_resume` as a hint: try the flag it
198
+ points at, and fall back to the other one if the agent rejects it.
199
+ - **`$gtd_model`** is an opaque hint the workflow declared (`smart` and `base`
200
+ in the bundled one). gtd never interprets it — you map it onto whatever your
201
+ agent calls that tier.
202
+
203
+ The agent writes `.gtd/REQUIREMENTS.md`, and that file is the turn. Land it like
204
+ any other beat:
205
+
206
+ ```bash
207
+ gtd land | sh
208
+ ```
209
+
210
+ `$gtd_validate` is there if you want to check the agent's work first: a
211
+ ready-to-run script that validates the file the prompt asked for and prints a
212
+ complete fix prompt on failure, ready to pipe straight back into the same
213
+ session.
214
+
215
+ ### Then automate the beats
216
+
217
+ That was not very convenient. Running this manually doesn't make us faster. But
218
+ it is easy to put it into a loop:
63
219
 
64
220
  ```bash
65
221
  while :; do
@@ -69,20 +225,74 @@ while :; do
69
225
  script) sh -c "$gtd_content" ;;
70
226
  prompt) printf '%s' "$gtd_content" | your-agent ;;
71
227
  esac
72
- gtd land
228
+ gtd land | sh
73
229
  done
74
230
  ```
75
231
 
76
232
  gtd itself never executes anything — the driver owns running scripts, and every
77
233
  `gtd next` call is strictly mutation-free, safe to poll or peek at any time. See
78
234
  [Driving the loop](https://github.com/pmelab/gtd/blob/main/docs/driver.md) for
79
- the full protocol, including the `message`/`capture` gates and the stalled case
80
- this sketch leaves out.
235
+ the full protocol, including the `message`/`capture` gates, the stalled case,
236
+ and refusal handling — a real driver captures `gtd land --sh` and pipes its
237
+ `$gtd_script`, because a refusal exits non-zero with an empty script that `| sh`
238
+ would swallow.
81
239
 
82
- See [gtd --help](https://github.com/pmelab/gtd/blob/main/docs/cli.md) for the
83
- full command/flag reference, and
84
- [Configuration](https://github.com/pmelab/gtd/blob/main/docs/configuration.md)
85
- for how to inspect or replace the workflow itself.
240
+ ### Then let an agent build your own
241
+
242
+ Paste this into your coding agent:
243
+
244
+ ```
245
+ !gtd install
246
+ ```
247
+
248
+ It prints a self-contained briefing that teaches the agent to set the project
249
+ up, build two commands for itself in whatever shell or runtime it runs, and ask
250
+ you what you want before it starts driving. You get one prompt to paste, not a
251
+ state name to choose. The two commands: a **loop command** that drives beats
252
+ until the process rests, and an **edit command** that opens the steering file
253
+ the process is waiting on right now — falling back to `.gtd/TODO.md` when the
254
+ resting state declares none. That fallback is also how you begin: on a clean
255
+ repository the edit command opens the empty `.gtd/TODO.md`, and whatever you
256
+ write there is the first sketch the whole process gets planned from.
257
+
258
+ ### The workflow it ships with
259
+
260
+ Those beats all come from one built-in workflow. It is data, not code — a
261
+ `.gtdrc` `workflow:` key replaces it wholesale. Condensed:
262
+
263
+ 1. **idle** (you) — change anything. gtd treats it as a _sketch_, not as work.
264
+ 2. **unwind** (script) — reverts your sketch back out of the tree; its intent
265
+ survives in history for the next step to read.
266
+ 3. **start-gate** (script) — the suite must be green before new work starts. Red
267
+ routes to you, with the failing output in `.gtd/FEEDBACK.md`.
268
+ 4. **design** (agent, then you) — triages the reverted diff into
269
+ `.gtd/REQUIREMENTS.md`. Open product questions come back for you to answer
270
+ inline in that file.
271
+ 5. **architecture** (agent, then you) — turns it into `.gtd/ARCHITECTURE.md`,
272
+ asks technical questions the same way, then decomposes the work into one
273
+ package per concern under `.gtd/packages/`.
274
+ 6. **packages** (agent, looped) — per package: build, run the checks, fix what
275
+ is red, review it against its own package file, close it out. Repeats until
276
+ no package is left.
277
+ 7. **review** (agent, then you) — an agent writes `.gtd/REVIEW.md`; you tick its
278
+ boxes or write feedback into it. A clean sign-off ends the process; feedback
279
+ re-enters at step 2.
280
+ 8. **idle** — done, and HEAD is a linear history of every turn that got you
281
+ there.
282
+
283
+ Two side doors skip the front of that list. `gtd --entry fix-precheck` repairs a
284
+ red baseline as its own reviewed commit instead of starting a process. And
285
+
286
+ ```bash
287
+ gtd --entry review-gate.check --var reviewBase=<commitish>
288
+ ```
289
+
290
+ starts a pure review: it enters at step 7 with no planning or building at all,
291
+ reviewing everything from `<commitish>` to HEAD. Sign-off ends it; feedback
292
+ re-enters at step 2 as a full re-plan lap.
293
+
294
+ Every numbered step above is just beats. `gtd next` prints one, you or an agent
295
+ do it, `gtd land` commits it — all the way down.
86
296
 
87
297
  ## License
88
298