@pmelab/gtd 47.0.0 → 49.0.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 (50) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +53 -45
  3. package/dist/chunks/{reserved-DF1HD6jL.mjs → reserved-CYZ1bSBy.mjs} +93 -24
  4. package/dist/chunks/{review-Bv40kZu9.mjs → review-BewyJflS.mjs} +58 -14
  5. package/dist/chunks/{steering-D7hWeMgE.mjs → steering-BXwjmocB.mjs} +7 -1
  6. package/dist/chunks/{tail-D89fU_wf.mjs → tail-C1Oi2YEy.mjs} +1 -1
  7. package/dist/gtd.bundle.mjs +203 -867
  8. package/dist/steering.mjs +2 -2
  9. package/dist/testkit.mjs +90 -54
  10. package/dist/workflow-kit.mjs +1 -1
  11. package/dist/workflows/cleanup.mjs +2 -2
  12. package/dist/workflows/feature.mjs +16 -9
  13. package/dist/workflows/fix.mjs +3 -3
  14. package/dist/workflows/review.mjs +3 -3
  15. package/dist/workflows/rollout.mjs +1 -1
  16. package/dist/workflows.mjs +164 -39
  17. package/package.json +1 -1
  18. package/src/cli/Cli.test.ts +0 -2
  19. package/src/cli/Cli.ts +0 -15
  20. package/src/cli/Program.test.ts +0 -1
  21. package/src/cli/Program.ts +0 -8
  22. package/src/cli/ToolCommands.ts +1 -2
  23. package/src/install/Install.ts +89 -35
  24. package/src/steering/index.ts +1 -0
  25. package/src/steering/review.test.ts +29 -0
  26. package/src/steering/review.ts +10 -0
  27. package/src/testkit/Layers.ts +0 -1
  28. package/src/wire/ContextLimit.ts +1 -1
  29. package/src/workflows/feature/coverage.feature +3 -3
  30. package/src/workflows/feature/fast-path.feature +2 -2
  31. package/src/workflows/feature/feature.ts +10 -3
  32. package/src/workflows/feature/flag-mode.feature +2 -2
  33. package/src/workflows/feature/lens-review.feature +116 -13
  34. package/src/workflows/feature/one-step-land.feature +2 -2
  35. package/src/workflows/feature/refactor-absorbs.feature +2 -2
  36. package/src/workflows/feature/refactor-first.feature +2 -2
  37. package/src/workflows/feature/refactor-rebuild.feature +2 -2
  38. package/src/workflows/feature/refactor-review.feature +6 -6
  39. package/src/workflows/feature/review-answers.feature +44 -5
  40. package/src/workflows/feature/review-gate.feature +6 -6
  41. package/src/workflows/feature/reviewer-walkthrough.feature +229 -0
  42. package/src/workflows/feature/seam-rejection.feature +2 -2
  43. package/src/workflows/feature/seam.feature +2 -2
  44. package/src/workflows/feature/slice-findings.feature +56 -5
  45. package/src/workflows/feature/slicing.feature +6 -6
  46. package/src/workflows/feature/standards.feature +25 -1
  47. package/src/workflows/shared/review.ts +108 -13
  48. package/src/workflows/shared/steps.ts +3 -2
  49. package/src/workflows/shared/text.test.ts +126 -0
  50. package/src/workflows/shared/text.ts +125 -19
package/dist/steering.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { C as parseFootnotes, D as headingSectionBodies, E as getParseCount, O as headingSections, S as openThreadFindings, T as parseThreadsWithFindings, _ as unansweredNotes, a as unansweredQuestions, b as FOOTNOTE_ACTION_TITLE, c as stripCodeThreads, d as ANSWER_FIX, f as ANSWER_LEAD, g as reviewRisks, h as reviewNotes, i as steeringFormatOrFreeForm, k as formatFinding, l as freeFormFormat, m as reviewDecisions, n as openThreads, o as viewOf, p as ANSWER_WONT_FIX, r as steeringFormatFor, s as parseCodeThreads, t as BUILT_IN_MODE_NAMES, u as applySteeringEdits, v as FREE_TEXT_PLACEHOLDER, w as parseThreads, x as THREAD_REPLY_ACTION_TITLE, y as isAnswered } from "./chunks/steering-D7hWeMgE.mjs";
2
- export { ANSWER_FIX, ANSWER_LEAD, ANSWER_WONT_FIX, BUILT_IN_MODE_NAMES, FOOTNOTE_ACTION_TITLE, FREE_TEXT_PLACEHOLDER, THREAD_REPLY_ACTION_TITLE, applySteeringEdits, formatFinding, freeFormFormat, getParseCount, headingSectionBodies, headingSections, isAnswered, openThreadFindings, openThreads, parseCodeThreads, parseFootnotes, parseThreads, parseThreadsWithFindings, reviewDecisions, reviewNotes, reviewRisks, steeringFormatFor, steeringFormatOrFreeForm, stripCodeThreads, unansweredNotes, unansweredQuestions, viewOf };
1
+ import { A as formatFinding, C as openThreadFindings, D as getParseCount, E as parseThreadsWithFindings, O as headingSectionBodies, S as THREAD_REPLY_ACTION_TITLE, T as parseThreads, _ as reviewRisks, a as unansweredQuestions, b as isAnswered, c as stripCodeThreads, d as ANSWER_FIX, f as ANSWER_LEAD, g as reviewNotes, h as reviewDecisions, i as steeringFormatOrFreeForm, k as headingSections, l as freeFormFormat, m as reviewChunks, n as openThreads, o as viewOf, p as ANSWER_WONT_FIX, r as steeringFormatFor, s as parseCodeThreads, t as BUILT_IN_MODE_NAMES, u as applySteeringEdits, v as unansweredNotes, w as parseFootnotes, x as FOOTNOTE_ACTION_TITLE, y as FREE_TEXT_PLACEHOLDER } from "./chunks/steering-BXwjmocB.mjs";
2
+ export { ANSWER_FIX, ANSWER_LEAD, ANSWER_WONT_FIX, BUILT_IN_MODE_NAMES, FOOTNOTE_ACTION_TITLE, FREE_TEXT_PLACEHOLDER, THREAD_REPLY_ACTION_TITLE, applySteeringEdits, formatFinding, freeFormFormat, getParseCount, headingSectionBodies, headingSections, isAnswered, openThreadFindings, openThreads, parseCodeThreads, parseFootnotes, parseThreads, parseThreadsWithFindings, reviewChunks, reviewDecisions, reviewNotes, reviewRisks, steeringFormatFor, steeringFormatOrFreeForm, stripCodeThreads, unansweredNotes, unansweredQuestions, viewOf };
package/dist/testkit.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { answered, applyScript, checkScript, configProblems, configure, installContext, isFactoryWorkflow, moveScript, numeric, protocolMismatch, removeScript, restoreScript, revertScript, showScript, t as flows_exports, writeScript } from "./flows.mjs";
2
2
  import { A as beatKindOf, B as ACCESS_REFUSAL, C as renderLandPlain, D as renderBeatJson, E as beatDocument, O as statusOf, S as renderLandJson, T as renderBeatPlain, U as renderFormat, _ as selectPath, a as contextLimitFault, g as resolveSession, h as globMatches, j as demandOf, l as parseContextWindow, m as slicesDocument, o as contextShapeFault, p as renderSlicesJson, v as judgeJson, x as noopText, y as landFields } from "./chunks/wire-BJuZWR3C.mjs";
3
- import { D as headingSectionBodies, O as headingSections, T as parseThreadsWithFindings, a as unansweredQuestions, k as formatFinding, n as openThreads, r as steeringFormatFor, s as parseCodeThreads, t as BUILT_IN_MODE_NAMES } from "./chunks/steering-D7hWeMgE.mjs";
3
+ import { A as formatFinding, E as parseThreadsWithFindings, O as headingSectionBodies, a as unansweredQuestions, k as headingSections, n as openThreads, r as steeringFormatFor, s as parseCodeThreads, t as BUILT_IN_MODE_NAMES } from "./chunks/steering-BXwjmocB.mjs";
4
4
  import { $ as logWarning, $i as BaseProto, $n as map$5, $r as make$19, $t as provide$1, A as catchIf, Ai as add$1, An as scopeMake, Ar as flatMap$3, At as suspend$5, B as flatMap$4, Bi as getOrElse, Bn as get$3, Br as sync$1, Bt as unsafeMakeLatch, C as all$1, Ci as toArray, Cn as isInterrupted, Cr as exitFail, Ct as sandbox, D as async, Di as GenericTag, Dn as squash, Dr as exitZipRight, Dt as scopedWith$1, E as asVoid$1, Ei as unsafeHead, En as reduceWithContext, Er as exitVoid, Et as scoped$4, F as ensuring$2, Fi as fromIterable, Fn as join$3, Fr as map$3, Ft as tryMap, G as forkIn, Gi as match$4, Gn as TypeId$10, Gr as whenEffect, Gt as zipLeft, H as fnUntraced, Hi as isNone, Hn as modify$1, Hr as uninterruptible, Ht as when, I as exit, Ii as splitAt, In as sequential, Ir as onInterrupt, It as tryPromise, J as ignore, Ji as isLeft, Jn as all, Jr as DeferredTypeId$1, Jt as spaced$1, K as forkScoped, Ki as none, Kn as Class, Kr as withFiberRuntime, Kt as zipRight$3, L as fail$5, Li as filter$1, Ln as bind, Lr as scopeClose, Lt as try_, M as die$2, Mi as getOption, Mn as _await$2, Mr as interruptAsFiber, Mt as tap, N as dieMessage, Ni as omit, Nn as inheritAll$1, Nr as interruptFiber, Nt as tapErrorCause, O as catchAll$1, Oi as Reference, On as ensuring$3, Or as fiberId, Ot as serviceOption, P as either, Pi as empty$5, Pn as interruptAllAs$1, Pr as interruptible$1, Pt as timeout, Q as isEffect, Qi as pipeArguments, Qn as isFailure, Qr as ids, Qt as mergeAll$2, R as failCause$4, Ri as flatMap$5, Rn as bindTo, Rr as succeed$4, Rt as uninterruptible$1, S as addFinalizer$1, Si as takeRight, Sn as isDieType, Sr as exitAs, St as runtime, T as as, Ti as unsafeGet, Tn as map$6, Tr as exitSucceed, Tt as scopeWith, U as forEach$2, Ui as isSome, Un as set$1, Ur as uninterruptibleMask$1, Ut as withFiberRuntime$1, V as flatten$4, Vi as getOrUndefined, Vn as make$16, Vr as tap$1, Vt as unsafeMakeSemaphore$1, W as forkDaemon, Wi as map$8, Wn as update$1, Wr as void_$2, Wt as zip$1, X as interruptible, Xi as match$2, Xn as fail$4, Xr as combine, Xt as tagged, Y as interrupt$4, Yi as left, Yn as die, Yr as empty$6, Yt as TaggedError$1, Z as intoDeferred, Zi as right, Zn as failCause$3, Zr as combineAll, Zt as fromEffect$5, _ as decodeSync, _i as of, _n as fail$3, _r as deferredIsDone, _t as raceWith, a as Literal, aa as constFalse, ai as size$2, an as updateContext$1, ar as zipRight$2, at as matchCause, b as acquireRelease, bi as reverse, bn as interrupt$3, br as deferredUnsafeDone, bt as runPromise, c as String$, ca as constVoid, ci as append$1, cn as Scope, cr as asyncInterrupt, ct as negate, d as Union, da as pipe, di as empty$4, dn as close, dr as deferredAwait, dt as orElse, ea as NodeInspectSymbol, ei as none$1, en as provideMerge$1, er as mapBoth, et as makeSemaphore, f as between, fi as filter, fn as extend, fr as deferredComplete, ft as orElseSucceed, gi as map$7, gn as die$1, gr as deferredInterruptWith, gt as race, hi as isEmpty$2, hn as NoSuchElementException, hr as deferredInterrupt, ht as provideService, i as Defect, ia as hasProperty, ii as has, in as unsafeRunPromiseExit, ir as zip$2, it as match$5, j as catchTag, ji as get$5, jn as scopeTag, jr as interrupt$2, jt as sync$2, k as catchAllCause, ki as Tag, kn as forEachConcurrentDiscard, kr as fiberRefLocally, kt as succeed$6, l as Struct, la as dual, li as appendAll, ln as addFinalizer, lr as catchAll, lt as onError, m as optional$1, mi as isChunk, mn as make$18, mr as deferredFailCause, mt as provide$2, n as Boolean$, na as toJSON, ni as make$17, nn as succeed$3, nr as succeed$5, nt as mapBoth$1, o as Never, oa as constTrue, oi as decode, on as forkIn$1, or as as$1, ot as matchCauseEffect, p as decodeUnknown, pi as fromIterable$1, pn as fork, pr as deferredFail, pt as promise, q as gen, qi as some, qn as spanTag, qr as zipRight$1, qt as zipWith, r as Cause, ra as equals, ri as set$2, rn as unsafeFork, rr as void_$3, rt as mapError, s as Number$, sa as constUndefined, si as isFinite, sn as unsafeMakeSemaphore, sr as asVoid, st as matchEffect, t as Array$, ta as format, ti as get$4, tn as scoped$3, tr as match$3, tt as map$4, u as TaggedError, ua as identity, ui as drop, un as addFinalizerExit, ur as currentContext$1, ut as orDie, v as encodeSync, vi as prepend, vn as failureOrCause, vr as deferredMake, vt as repeat, w as annotateLogs, wi as unsafeFromArray, wn as isInterruptedOnly, wr as exitFailCause, wt as scope, x as acquireUseRelease$2, xi as take$2, xn as interruptors, xr as deferredUnsafeMake, xt as runPromiseExit$1, y as _void, yi as reduce, yn as flipCauseOption, yr as deferredSucceed, yt as retry, z as fiberIdWith, zi as fromNullable, zn as sleep, zr as suspend$4, zt as uninterruptibleMask } from "./chunks/Schema-C6fLlQzx.mjs";
5
5
  import { createRequire } from "node:module";
6
6
  import * as Crypto from "node:crypto";
@@ -6154,8 +6154,15 @@ export CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1
6154
6154
  export BASH_DEFAULT_TIMEOUT_MS=1800000
6155
6155
  export BASH_MAX_TIMEOUT_MS=7200000
6156
6156
 
6157
+ # gtd's paths, scripts and checks are relative to the repository root.
6158
+ cd "$(git rev-parse --show-toplevel)"
6159
+
6157
6160
  beat=1
6158
6161
  while :; do
6162
+ cost=
6163
+ model=
6164
+ judged_before="\${judged:-}"
6165
+ judged=
6159
6166
  # One value per invocation: \`gtd next --json=<path>\` is a pure read (peek
6160
6167
  # or dispatch, indistinguishable, always safe to call again), so nothing is
6161
6168
  # lost by reading \`kind\`/\`idle\` as two separate calls rather than one
@@ -6183,14 +6190,22 @@ while :; do
6183
6190
  # \`gtd judge run\` and land the verdict via \`gtd judge answer\`. POSIX sh has
6184
6191
  # no pipefail, so each step is captured first and only piped on when it
6185
6192
  # succeeded; if \`gtd judge run\` fails or \`gtd judge answer\` rejects the
6186
- # verdict, its stderr reaches you and we fall through to the human hand-off.
6193
+ # verdict, its stderr reaches you and the gate is handed to you — on the
6194
+ # opening beat too, so it never lands unanswered — as it is when the gate
6195
+ # we just answered comes straight back.
6187
6196
  message)
6188
- if [ -n "$(gtd next --json=judge)" ] &&
6189
- verdict="$(gtd judge --json | gtd judge run)" &&
6190
- script="$(printf '%s\\n' "$verdict" | gtd judge answer --json=script)"; then
6191
- printf '%s\\n' "$script" | sh
6192
- beat=$((beat + 1))
6193
- continue
6197
+ if [ -n "$(gtd next --json=judge)" ]; then
6198
+ state="$(gtd next --json=state)"
6199
+ if [ "$state" != "$judged_before" ] &&
6200
+ verdict="$(gtd judge --json | gtd judge run)" &&
6201
+ script="$(printf '%s\\n' "$verdict" | gtd judge answer --json=script)"; then
6202
+ printf '%s\\n' "$script" | sh
6203
+ judged="$state"
6204
+ beat=$((beat + 1))
6205
+ continue
6206
+ fi
6207
+ gtd next
6208
+ exit 0
6194
6209
  fi
6195
6210
  [ "$beat" = 1 ] || {
6196
6211
  gtd next
@@ -6209,45 +6224,83 @@ while :; do
6209
6224
  model="$(gtd next --json=model)"
6210
6225
  system="$(gtd next --json=system)"
6211
6226
  validate="$(gtd next --json=validate)"
6227
+ context="$(gtd next --json=context)"
6212
6228
  log="$(gtd next --json=log)"
6229
+ # Absolute, since the hook runs wherever the agent last cd'ed to.
6230
+ case "$log" in /*) ;; *) log="$(git rev-parse --show-toplevel)/$log" ;; esac
6213
6231
  # \`model\` is a hint, not a model name — the bundled workflow ships
6214
6232
  # \`smart\` and \`base\`, which \`claude --model\` rejects. Resolve them
6215
- # with the variables \`gtd loop\` reads; unset, the hint is dropped and
6216
- # the agent runs its own default. Any other value is a real model name.
6233
+ # from your environment; unset, the hint is dropped and the agent runs
6234
+ # its own default. Any other value is a real model name.
6217
6235
  case "$model" in
6218
6236
  smart) model="\${GTD_LOOP_MODEL_SMART:-}" ;;
6219
6237
  base) model="\${GTD_LOOP_MODEL_BASE:-}" ;;
6220
6238
  esac
6221
- # The prompt embeds a full diff, so it goes to the agent over stdin,
6222
- # never as an argv positional — argv is capped (~1 MB on macOS, and
6223
- # POSIX guarantees only 4 KB, ARG_MAX), and a diff crosses that far
6224
- # sooner than you'd expect. Piping plain \`gtd next\` (not
6225
- # --json=content) means the diff is rendered once, for this input,
6226
- # rather than twice.
6227
- agent_turn() { gtd next | claude -p "$1" "$session_id" \\
6228
- \${model:+--model "$model"} \\
6229
- \${system:+--system-prompt "$system"} \\
6230
- --dangerously-skip-permissions >>"$log" 2>&1; }
6239
+ # The step's context limit, as a Claude Code hook after every tool
6240
+ # call and before compacting. Past \`hard\` it stops the turn and
6241
+ # appends why to the stop file, so we land nothing and stop too.
6242
+ soft="$(printf '%s' "$context" | sed -n 's/.*"soft":\\([0-9.]*\\).*/\\1/p')"
6243
+ hard="$(printf '%s' "$context" | sed -n 's/.*"hard":\\([0-9.]*\\).*/\\1/p')"
6244
+ window="\${GTD_LOOP_CONTEXT_WINDOW:-}"
6245
+ case "$model" in *'[1m]'* | *'[1M]'*) window="\${window:-1000000}" ;; esac
6246
+ hook="gtd context-hook\${soft:+ --soft $soft}\${hard:+ --hard $hard}\${window:+ --window $window}"
6247
+ hooks="[{\\"hooks\\":[{\\"type\\":\\"command\\",\\"command\\":\\"$hook\\"}]}]"
6248
+ settings="{\\"hooks\\":{\\"PostToolUse\\":$hooks,\\"PreCompact\\":$hooks}}"
6249
+ stop="$log.context-stop"
6250
+ rm -f "$stop"
6251
+ # One turn, its prompt on stdin. The prompt embeds a full diff, so it
6252
+ # never goes on argv — argv is capped (~1 MB on macOS, and POSIX
6253
+ # guarantees only 4 KB, ARG_MAX), and a diff crosses that far sooner
6254
+ # than you'd expect. Every turn passes the same $model/$system:
6255
+ # whether \`claude --resume\` re-applies the original session's is a
6256
+ # harness detail gtd cannot verify from outside. Its JSON envelope
6257
+ # goes to the log, and its \`total_cost_usd\` adds up into $cost. An
6258
+ # \`is_error\` envelope (max turns, an error mid-turn) or one another
6259
+ # hook stopped fails the turn even at exit 0: landing it would land
6260
+ # the failure as work. Only a turn that never ran (no envelope: the
6261
+ # session flag was refused) is worth retrying under the other flag.
6262
+ turn() {
6263
+ out="$(GTD_LOOP_CONTEXT_STOP_FILE="$stop" claude -p "$@" \\
6264
+ \${model:+--model "$model"} \\
6265
+ \${system:+--system-prompt "$system"} \\
6266
+ --settings "$settings" --output-format json \\
6267
+ --dangerously-skip-permissions 2>>"$log")" && ok=0 || ok=$?
6268
+ printf '%s\\n' "$out" >>"$log"
6269
+ case "$out" in *'"type":"result"'*) ran=true ;; *) ran=false ;; esac
6270
+ case "$out" in
6271
+ *'"is_error":true'* | *'"terminal_reason":"hook_stopped"'*) ok=1 ;;
6272
+ esac
6273
+ usd="$(printf '%s\\n' "$out" | sed -n 's/.*"total_cost_usd":\\([0-9.eE+-]*\\).*/\\1/p' | tail -n 1)"
6274
+ [ -z "$usd" ] || cost="$(awk -v a="\${cost:-0}" -v b="$usd" 'BEGIN { printf "%.6f", a + b }')"
6275
+ [ "\${cost:-}" != 0.000000 ] || cost=
6276
+ if [ -s "$stop" ]; then
6277
+ cat "$stop" >&2
6278
+ exit 1
6279
+ fi
6280
+ return "$ok"
6281
+ }
6282
+ # Plain \`gtd next\` (not --json=content) renders the diff once.
6283
+ gtd next >"$log.prompt"
6231
6284
  if [ "\${resume:-}" = true ]
6232
- then agent_turn --resume || agent_turn --session-id
6233
- else agent_turn --session-id || agent_turn --resume
6285
+ then first=--resume second=--session-id
6286
+ else first=--session-id second=--resume
6234
6287
  fi
6288
+ turn "$first" "$session_id" <"$log.prompt" ||
6289
+ { [ "$ran" = false ] && turn "$second" "$session_id" <"$log.prompt"; } || {
6290
+ echo "agent turn failed — see $log" >&2
6291
+ exit 1
6292
+ }
6235
6293
  n=0
6236
6294
  while [ -n "\${validate:-}" ] && ! fix="$(sh -c "$validate" 2>&1)"; do
6237
6295
  n=$((n + 1)) && [ "$n" -gt 3 ] && { printf '%s\\n' "$fix" >&2; exit 1; }
6238
- # $fix IS the fix prompt, verbatim — piped for the same reason the
6239
- # agent's own turn above is. Whether \`claude --resume\` re-applies the
6240
- # original session's model/system prompt is a harness detail gtd
6241
- # cannot verify from outside, so this passes the identical
6242
- # $model/$system on both calls rather than assume it does —
6243
- # otherwise this fix turn might silently fall back to Claude Code's
6244
- # own defaults while the turn that produced the file ran under the
6245
- # workflow's own model and persona.
6246
- printf '%s' "$fix" | claude -p --resume "$session_id" \\
6247
- \${model:+--model "$model"} \\
6248
- \${system:+--system-prompt "$system"} \\
6249
- --dangerously-skip-permissions >>"$log" 2>&1
6250
- done ;;
6296
+ # $fix IS the fix prompt, verbatim.
6297
+ printf '%s' "$fix" >"$log.prompt"
6298
+ turn --resume "$session_id" <"$log.prompt" || {
6299
+ echo "fix turn failed — see $log" >&2
6300
+ exit 1
6301
+ }
6302
+ done
6303
+ rm -f "$log.prompt" ;;
6251
6304
  esac
6252
6305
 
6253
6306
  # Read every value the landing needs BEFORE piping the script to \`sh\`:
@@ -6257,7 +6310,8 @@ while :; do
6257
6310
  # before the script runs and changes the tree out from under them.
6258
6311
  settled="$(gtd land --json=settled)"
6259
6312
  idle="$(gtd land --json=idle)"
6260
- gtd land --json=script | sh
6313
+ # A prompt beat's turns record their cost, tagged with the model that ran.
6314
+ gtd land --json=script \${cost:+--cost="$cost"} \${cost:+\${model:+--model="$model"}} | sh
6261
6315
  if [ "\${settled:-}" = true ]; then
6262
6316
  [ "\${idle:-}" = true ] && gtd next
6263
6317
  exit 0
@@ -10893,7 +10947,6 @@ const runInstallCommand = (out) => gen(function* () {
10893
10947
  yield* (yield* Workspace).write(WORKFLOW_MODULE, CONFIG_SCAFFOLD);
10894
10948
  yield* (yield* Narrator).warn(`gtd install: wrote ${WORKFLOW_MODULE}, importing gtd's shipped workflows — commit it before your first \`gtd land\``);
10895
10949
  });
10896
- const runLoopCommand = () => flatMap$4(ToolCommands, (tools) => tools.loop(selfGtd()));
10897
10950
  /**
10898
10951
  * Exactly one trailing newline — duplicated from `Cli.ts`'s own
10899
10952
  * `normalizeTrailingNewline` rather than imported, to avoid a circular value
@@ -11471,7 +11524,6 @@ const needsOf = (kind) => {
11471
11524
  switch (kind) {
11472
11525
  case "lsp":
11473
11526
  case "install":
11474
- case "loop":
11475
11527
  case "contextHook":
11476
11528
  case "judgeRun":
11477
11529
  case "strays": return "none";
@@ -11511,7 +11563,6 @@ const dispatchVoidCommand = (command, json, out) => {
11511
11563
  return runCheckCommand(command.mode, command.file, command.openQuestions ?? false, command.openThreads ?? false);
11512
11564
  case "uncheck": return runUncheckCommand(command.file);
11513
11565
  case "install": return runInstallCommand(out);
11514
- case "loop": return runLoopCommand();
11515
11566
  case "contextHook": return runContextHookCommand(command, out);
11516
11567
  case "summary": return runSummaryCommand(out, command.slice);
11517
11568
  case "base": return runBaseCommand(out);
@@ -12038,20 +12089,6 @@ const COMMAND_ROWS = [
12038
12089
  "else it writes nothing."
12039
12090
  ]
12040
12091
  },
12041
- {
12042
- token: "loop",
12043
- kind: "loop",
12044
- arity: "none",
12045
- details: [
12046
- "Drive this worktree's process until it rests on you: read",
12047
- "each beat, run the agent turn or script it demands, and",
12048
- "land the result. Exits 0 at a human gate, at idle and when",
12049
- "a landing settles; exits 1 on a stall or a failed turn or",
12050
- "landing. The agent CLI and the model each workflow hint",
12051
- "maps to are per-machine settings (GTD_LOOP_* variables, or",
12052
- "~/.config/gtd/loop.json); see docs/driver.md"
12053
- ]
12054
- },
12055
12092
  {
12056
12093
  token: "context-hook",
12057
12094
  kind: "contextHook",
@@ -13403,7 +13440,6 @@ const missingTool = (name) => () => fail$5(/* @__PURE__ */ new Error(`gtd ${name
13403
13440
  const missingToolCommands = {
13404
13441
  ui: missingTool("ui"),
13405
13442
  lsp: missingTool("lsp"),
13406
- loop: missingTool("loop"),
13407
13443
  contextHook: missingTool("context-hook"),
13408
13444
  judge: () => Promise.reject(/* @__PURE__ */ new Error("gtd judge run: ToolCommands has no test double wired into testLayers()"))
13409
13445
  };
@@ -1,5 +1,5 @@
1
1
  import { changes, changesSince, hasThreadFor, head, mark, read, refuse, requireReplies, requireThreadsClosed, scope } from "./flows.mjs";
2
- import { _ as unansweredNotes, c as stripCodeThreads, g as reviewRisks, h as reviewNotes, m as reviewDecisions, w as parseThreads } from "./chunks/steering-D7hWeMgE.mjs";
2
+ import { T as parseThreads, _ as reviewRisks, c as stripCodeThreads, g as reviewNotes, h as reviewDecisions, v as unansweredNotes } from "./chunks/steering-BXwjmocB.mjs";
3
3
  //#region src/workflow-kit/health.ts
4
4
  /** Hand a red suite that repeated attempts could not fix to a person, until `limit` rounds are spent. */
5
5
  const escalation = async (count, steps) => {
@@ -1,6 +1,6 @@
1
1
  import { agent, changes, glob, read, refuse, scope, start, vars } from "../flows.mjs";
2
- import { Ct as defaults, It as flagReferences, Rt as registryEntry, S as coder, i as skills, n as summary, o as flagShipped, r as access, t as steering, wt as envDefaults, zt as requireFlag } from "../chunks/reserved-DF1HD6jL.mjs";
3
- import { a as refusePendingHandOff, r as handOffTail } from "../chunks/tail-D89fU_wf.mjs";
2
+ import { Dt as envDefaults, Et as defaults, Ht as requireFlag, S as coder, Vt as registryEntry, i as skills, n as summary, o as flagShipped, r as access, t as steering, zt as flagReferences } from "../chunks/reserved-CYZ1bSBy.mjs";
3
+ import { a as refusePendingHandOff, r as handOffTail } from "../chunks/tail-C1Oi2YEy.mjs";
4
4
  //#region src/workflows/cleanup/cleanup.ts
5
5
  const removingPrompt = (name, registry) => `Clean up the release flag "${name}", which is default-on: delete its entry in ${registry}, and remove every \`GTD_FLAG_${name.toUpperCase()}\` check from the shipped sources. Keep the flag-on path; delete code only the off path reached, including tests that pin the off path.`;
6
6
  const cleanupFlow = async () => {
@@ -1,8 +1,8 @@
1
1
  import { agent, answered, applyScript, changes, changesSince, check, codeChanges, env, hasThreadFor, head, human, judge, judgeDiffShape, kept, mark, matches, quote, read, refuse, removeScript, requireAnswers, requireProgress, requireReplies, requireThreadsClosed, revertScript, run, scope, slice, start, vars, wrote } from "../flows.mjs";
2
2
  import { lensEntriesOf } from "../workflow-kit.mjs";
3
- import { $ as naivePassPrompt, B as coverageQuestion, C as collecting, Ct as defaults, F as builderSystem, G as designTriagePrompt, H as criterionLine, I as clearCriteriaMessage, L as clearCriteriaQuestion, M as agentWithSkills, N as buildReviewCollectingPrompt, O as planner, Q as naiveApplyFailure, S as coder, T as fixNits, Tt as testFileGlobs, U as designGateAnswerMessage, V as coveringPrompt, W as designSystem, X as implementBuildingPrompt, Y as idleMessage, Z as implementFixPrompt, _ as REQUIREMENTS, _t as slicingPrompt, a as flagModeOn, at as refactorDroppedRefusal, b as answerReviewQuestions, bt as unwindFailedMessage, ct as refactorRules, d as healthy, et as normaliseCriteriaScript, f as FEEDBACK, g as REFACTOR_NOTE, gt as seamSteerMessage, h as REFACTOR, ht as seamByHandMessage, i as skills, it as refactorBuildingPrompt, l as gate, mt as reviewerSystem, n as summary, ot as refactorFixPrompt, p as HANDOFF, r as access, s as shipped, st as refactorNotePrompt, t as steering, tt as oversizedMessage, vt as startGateBlockedMessage, wt as envDefaults, xt as unwindFailure, y as SLICES, yt as uncoveredMessage, z as coverageMessage } from "../chunks/reserved-DF1HD6jL.mjs";
4
- import { a as refusePendingHandOff, c as joinReports, o as tail } from "../chunks/tail-D89fU_wf.mjs";
5
- import { i as reUnwind, n as humanReview, r as isCode$1, t as buildTail } from "../chunks/review-Bv40kZu9.mjs";
3
+ import { $ as naivePassPrompt, B as coverageQuestion, C as collecting, Dt as envDefaults, Et as defaults, F as builderSystem, G as designTriagePrompt, H as criterionLine, I as clearCriteriaMessage, L as clearCriteriaQuestion, M as agentWithSkills, N as buildReviewCollectingPrompt, O as planner, Ot as testFileGlobs, Q as naiveApplyFailure, S as coder, St as unwindFailure, T as fixNits, U as designGateAnswerMessage, V as coveringPrompt, W as designSystem, X as implementBuildingPrompt, Y as idleMessage, Z as implementFixPrompt, _ as REQUIREMENTS, _t as slicingPrompt, a as flagModeOn, at as refactorDroppedRefusal, b as answerReviewQuestions, bt as uncoveredMessage, ct as refactorRules, d as healthy, et as normaliseCriteriaScript, f as FEEDBACK, g as REFACTOR_NOTE, gt as seamSteerMessage, h as REFACTOR, ht as seamByHandMessage, i as skills, it as refactorBuildingPrompt, l as gate, mt as reviewerSystem, n as summary, ot as refactorFixPrompt, p as HANDOFF, r as access, s as shipped, st as refactorNotePrompt, t as steering, tt as oversizedMessage, vt as startGateBlockedMessage, xt as unwindFailedMessage, y as SLICES, z as coverageMessage } from "../chunks/reserved-CYZ1bSBy.mjs";
4
+ import { a as refusePendingHandOff, c as joinReports, o as tail } from "../chunks/tail-C1Oi2YEy.mjs";
5
+ import { i as reUnwind, n as humanReview, r as isCode$1, t as buildTail } from "../chunks/review-BewyJflS.mjs";
6
6
  import { posix } from "node:path";
7
7
  //#region src/workflows/shared/fences.ts
8
8
  const markFenced = (text) => {
@@ -1171,14 +1171,21 @@ const buildSlice = async (sliceBase, build) => {
1171
1171
  });
1172
1172
  });
1173
1173
  };
1174
- /** The quality lap of slice `last.slice`, then the human review since `base`, listing what earlier slices' `laps` left too. */
1174
+ /**
1175
+ * The quality lap of slice `last.slice`, then a reviewer's walkthrough since
1176
+ * `base` for the human, carrying what earlier slices' `laps` left too.
1177
+ */
1175
1178
  const reviewedTail = (base, lensBase, last = {
1176
1179
  slice: "",
1177
1180
  laps: []
1178
- }) => tail((escalations, report) => humanReview(base, escalations, { report: last.laps.length === 0 ? report : joinReports([...last.laps, {
1179
- slice: last.slice,
1180
- report
1181
- }]) }), {
1181
+ }, lap = "first") => tail((escalations, report) => humanReview(base, escalations, {
1182
+ report: last.laps.length === 0 ? report : joinReports([...last.laps, {
1183
+ slice: last.slice,
1184
+ report
1185
+ }]),
1186
+ walkthrough: true,
1187
+ lap
1188
+ }), {
1182
1189
  green: true,
1183
1190
  lensBase
1184
1191
  });
@@ -1200,7 +1207,7 @@ const featureFeedback = async (first, lensBase, ids) => {
1200
1207
  tier: riskTierOn() ? recordRisk() : void 0,
1201
1208
  amend: true
1202
1209
  });
1203
- outcome = await reviewedTail(outcome.base, lensBase);
1210
+ outcome = await reviewedTail(outcome.base, lensBase, void 0, "feedback");
1204
1211
  }
1205
1212
  };
1206
1213
  /** Design — skipped when the sketch's own criteria are judged clear — then `buildFeature`. */
@@ -1,7 +1,7 @@
1
1
  import { read, refuse, removeScript, run, scope, start } from "../flows.mjs";
2
- import { g as reviewRisks, h as reviewNotes } from "../chunks/steering-D7hWeMgE.mjs";
3
- import { Ct as defaults, K as finisherSystem, M as agentWithSkills, S as coder, c as baseline, i as skills, n as summary, q as fixReviewNotesPrompt, r as access, s as shipped, t as steering, v as REVIEW, wt as envDefaults } from "../chunks/reserved-DF1HD6jL.mjs";
4
- import { r as handOffTail, t as REVIEW_ORIG } from "../chunks/tail-D89fU_wf.mjs";
2
+ import { _ as reviewRisks, g as reviewNotes } from "../chunks/steering-BXwjmocB.mjs";
3
+ import { Dt as envDefaults, Et as defaults, K as finisherSystem, M as agentWithSkills, S as coder, c as baseline, i as skills, n as summary, q as fixReviewNotesPrompt, r as access, s as shipped, t as steering, v as REVIEW } from "../chunks/reserved-CYZ1bSBy.mjs";
4
+ import { r as handOffTail, t as REVIEW_ORIG } from "../chunks/tail-C1Oi2YEy.mjs";
5
5
  //#region src/workflows/fix/fix.ts
6
6
  /**
7
7
  * Fix every note a human left in a handed-off `.gtd/REVIEW.md` and every
@@ -1,7 +1,7 @@
1
1
  import { read, refuse, removeScript, run, start } from "../flows.mjs";
2
- import { Ct as defaults, K as finisherSystem, M as agentWithSkills, S as coder, _ as REQUIREMENTS, dt as reviewFeedbackFixPrompt, ft as reviewGateBlockedMessage, i as skills, l as gate, n as summary, r as access, s as shipped, t as steering, wt as envDefaults } from "../chunks/reserved-DF1HD6jL.mjs";
3
- import { a as refusePendingHandOff } from "../chunks/tail-D89fU_wf.mjs";
4
- import { i as reUnwind, t as buildTail } from "../chunks/review-Bv40kZu9.mjs";
2
+ import { Dt as envDefaults, Et as defaults, K as finisherSystem, M as agentWithSkills, S as coder, _ as REQUIREMENTS, dt as reviewFeedbackFixPrompt, ft as reviewGateBlockedMessage, i as skills, l as gate, n as summary, r as access, s as shipped, t as steering } from "../chunks/reserved-CYZ1bSBy.mjs";
3
+ import { a as refusePendingHandOff } from "../chunks/tail-C1Oi2YEy.mjs";
4
+ import { i as reUnwind, t as buildTail } from "../chunks/review-BewyJflS.mjs";
5
5
  //#region src/workflows/review/review.ts
6
6
  const fixFeedback = async () => {
7
7
  await agentWithSkills("feedback.fixing", reviewFeedbackFixPrompt(), {
@@ -1,5 +1,5 @@
1
1
  import { agent, changesSince, glob, head, mark, read, refuse, removeScript, run, scope, vars } from "../flows.mjs";
2
- import { Ct as defaults, Ft as flagMentions, Lt as flipProblems, S as coder, f as FEEDBACK, i as skills, l as gate, n as summary, o as flagShipped, r as access, t as steering, wt as envDefaults, zt as requireFlag } from "../chunks/reserved-DF1HD6jL.mjs";
2
+ import { Bt as flipProblems, Dt as envDefaults, Et as defaults, Ht as requireFlag, Rt as flagMentions, S as coder, f as FEEDBACK, i as skills, l as gate, n as summary, o as flagShipped, r as access, t as steering } from "../chunks/reserved-CYZ1bSBy.mjs";
3
3
  //#region src/workflows/rollout/rollout.ts
4
4
  const flippingPrompt = (name, registry) => `Roll out the release flag "${name}": in ${registry}, set \`defaultOn: true\` on its entry. Change nothing else — no other entry, no other field, no other file, no comments.`;
5
5
  const suiteBlockedMessage = () => "The suite is red after the rollout. Fix it by hand — a rollout may only touch the flag's registry entry — then land.";