taskforce-loop-engineering 0.7.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 ADDED
@@ -0,0 +1,1191 @@
1
+ # Taskforce Loop Engineering
2
+
3
+ OpenClaw-native loop engineering for repeated agent work. It provides a small
4
+ Node CLI that executes JSON loop specs, records append-only run artifacts, and
5
+ uses a circuit breaker to escalate repeated failures.
6
+
7
+ It also includes a small durable task queue runner for explicit loop-managed
8
+ work handoffs, plus an assisted code queue mode that runs each task in an
9
+ isolated git worktree.
10
+
11
+ ## Install
12
+
13
+ From npm:
14
+
15
+ ```bash
16
+ npm install -g taskforce-loop-engineering
17
+ ```
18
+
19
+ Or run without installing:
20
+
21
+ ```bash
22
+ npx -p taskforce-loop-engineering loop-engineering --help
23
+ ```
24
+
25
+ ## OpenClaw conversation installer
26
+
27
+ Installing the npm package alone does not intercept chat messages or choose an
28
+ execution agent. Use the OpenClaw installer to plan a conversation integration:
29
+
30
+ ```bash
31
+ loop-engineering-openclaw-install \
32
+ --root /path/to/openclaw/workspace \
33
+ --queue agent-tasks
34
+ ```
35
+
36
+ The installer reads `openclaw agents list --json` during the plan. Without
37
+ `--worker-agent`, it chooses an existing `main`, or the only available agent
38
+ when exactly one exists. If there is no unambiguous choice, it fails with the
39
+ available agent ids and asks for `--worker-agent`; it never creates an agent.
40
+ An explicitly selected worker must already exist.
41
+
42
+ The default is read-only and reports the selected worker and files it would
43
+ create. After review,
44
+ install the queue, configurable worker dispatcher, atomic route-and-run wrapper,
45
+ channel-neutral asynchronous notifier, workspace health preflight, and managed
46
+ `AGENTS.md` routing block with:
47
+
48
+ ```bash
49
+ loop-engineering-openclaw-install \
50
+ --root /path/to/openclaw/workspace \
51
+ --queue agent-tasks \
52
+ --worker-agent main \
53
+ --confirm-install
54
+ ```
55
+
56
+ The generated dispatcher uses a per-task session key of
57
+ `agent:<worker-agent>:loop-task-<task-id>` and explicitly marks the task as
58
+ already loop-managed to prevent recursive re-enqueue. Existing generated files
59
+ are not overwritten unless `--force` is supplied after review. The installed
60
+ conversation policy treats `走 loop` as enqueue plus immediate execution;
61
+ `只入队` and `只排队` remain explicit queue-only overrides.
62
+ After every installed runner tick, the wrapper idempotently scans human-input
63
+ gates and terminal tasks. The generated notifier delivers through
64
+ `openclaw message send` using the task's recorded `channel`, `target`, `account`,
65
+ and `reply_to`; it refuses delivery when channel or target metadata is missing.
66
+
67
+ Validate the installation without sending a real message:
68
+
69
+ ```bash
70
+ loop-engineering-openclaw-doctor \
71
+ --root /path/to/openclaw/workspace \
72
+ --queue agent-tasks \
73
+ --worker-agent main
74
+ ```
75
+
76
+ The doctor checks generated files, queue wiring, the OpenClaw CLI, the selected
77
+ worker agent, and a notification dry-run. It reports `externalWrite: false` and
78
+ uses `openclaw message send --dry-run` for the delivery probe.
79
+
80
+ After doctor passes, run the disposable end-to-end smoke:
81
+
82
+ ```bash
83
+ loop-engineering-openclaw-smoke \
84
+ --root /path/to/openclaw/workspace \
85
+ --queue agent-tasks \
86
+ --worker-agent main
87
+ ```
88
+
89
+ It creates a uniquely named temporary queue, routes a read-only task through
90
+ the configured worker session, verifies task contract/development plan/
91
+ acceptance plan/final judgement artifacts, scans human gates, and exercises the
92
+ terminal return with notification dry-run. The temporary config and runtime are
93
+ removed in a guarded `finally` block. Use `--keep-artifacts` only for explicit
94
+ debugging review.
95
+
96
+ Plan upgrades or removal before changing an existing integration:
97
+
98
+ ```bash
99
+ loop-engineering-openclaw-manage --root /path/to/workspace --action upgrade-plan
100
+ loop-engineering-openclaw-manage --root /path/to/workspace --action upgrade --confirm-upgrade
101
+ loop-engineering-openclaw-manage --root /path/to/workspace --action uninstall-plan
102
+ loop-engineering-openclaw-manage --root /path/to/workspace --action uninstall --confirm-uninstall
103
+ ```
104
+
105
+ The installer manifest records SHA-256 hashes for generated files and the exact
106
+ managed `AGENTS.md` block. Upgrade/uninstall refuses when managed content was
107
+ edited. Uninstall removes only clean managed files and that exact instructions
108
+ block; queue runtime is explicitly retained.
109
+
110
+ ## Commands
111
+
112
+ ```bash
113
+ loop-engineering init --root /path/to/workspace
114
+ loop-engineering verify --root /path/to/workspace
115
+ loop-engineering run --root /path/to/workspace --config configs/loops/workspace-health.json
116
+ loop-engineering status --root /path/to/workspace
117
+ loop-engineering doctor --root /path/to/workspace
118
+ loop-engineering repair-plan --id workspace-health --output repair-plan.json
119
+ loop-engineering summarize --root /path/to/workspace --limit 20
120
+ loop-engineering project-intake --name launch-site --brief "Build a launch website" --type auto
121
+ loop-engineering project-plan --project launch-site
122
+ loop-engineering project-status --project launch-site
123
+ loop-engineering queue-init --queue agent-tasks
124
+ loop-engineering code-queue-init --queue code-tasks
125
+ loop-engineering enqueue --queue agent-tasks --title "Check logs" --task "Inspect the latest logs."
126
+ loop-engineering run-queue --config configs/loops/queues/agent-tasks.json
127
+ loop-engineering run-queue-drain --config configs/loops/queues/agent-tasks.json --max-tasks 100
128
+ loop-engineering queue-status --queue agent-tasks
129
+ loop-engineering queue-scheduler-tick --config configs/loops/queues/agent-tasks.json
130
+ loop-engineering queue-scheduler-tick --queue agent-tasks --plan-only --json
131
+ loop-engineering queue-peek --queue agent-tasks
132
+ loop-engineering queue-cancel --queue agent-tasks --task-id <id> --reason "not needed"
133
+ loop-engineering queue-requeue --queue agent-tasks --task-id <id>
134
+ loop-engineering queue-revision-plan --queue agent-tasks --task-id <id> --output-dir
135
+ loop-engineering queue-revision-apply-plan --from-review action-list.json --output apply-report.md
136
+ loop-engineering queue-revision-review --queue agent-tasks --needs-action --stale-after 24h --applied-report apply-report.json --output action-list.md
137
+ loop-engineering queue-revision-audit-chain --review action-list.json --apply-report apply-report.json --verify-current --fail-on-drift --output audit-chain.md --drift-report drift-report.md --drift-summary-format github --drift-summary-append-github-step --drift-github-annotations
138
+ loop-engineering queue-revision-ci-check --review action-list.json --apply-report apply-report.json --baseline previous-audit.json --drift-report drift-report.md
139
+ loop-engineering queue-revision-ci-bootstrap --queue agent-tasks
140
+ loop-engineering queue-revision-ci-workflow-template --queue agent-tasks --output .github/workflows/loop-revision-ci.yml
141
+ loop-engineering queue-revision-ci-status-badge --queue agent-tasks --output loop-revision-ci-badge.md
142
+ loop-engineering queue-revision-ci-readme-update --queue agent-tasks --readme README.md
143
+ loop-engineering queue-revision-ci-install-guide --queue agent-tasks --output loop-revision-ci-install-guide.md
144
+ loop-engineering queue-revision-ci-self-test --queue agent-tasks --output loop-revision-ci-self-test.md
145
+ loop-engineering queue-revision-ci-doctor --queue agent-tasks --output loop-revision-ci-doctor.md
146
+ loop-engineering queue-revision-ci-repair-plan --queue agent-tasks --output loop-revision-ci-repair-plan.md
147
+ loop-engineering queue-revision-ci-apply-repair-plan --from loop-revision-ci-repair-plan.json --confirm-apply --output loop-revision-ci-apply-repair-plan.md
148
+ loop-engineering queue-revision-ci-health-summary --queue agent-tasks --output loop-revision-ci-health-summary.md
149
+ loop-engineering queue-revision-ci-dashboard --output loop-revision-ci-dashboard.md
150
+ loop-engineering queue-revision-ci-release-checklist --output loop-revision-ci-release-checklist.md
151
+ loop-engineering queue-revision-ci-baseline-update --from current-audit.json --output previous-audit.json
152
+ loop-engineering queue-revision-drift-allow-template --type unreported_actionable_review_plan --output drift-allow.json
153
+ loop-engineering queue-revision-next --queue agent-tasks --task-id <id>
154
+ loop-engineering queue-lineage --queue agent-tasks --task-id <id>
155
+ loop-engineering queue-lineage-bundle --queue agent-tasks --task-id <id>
156
+ loop-engineering queue-human-decision --queue agent-tasks --task-id <id> --decision approve|request_changes|reject
157
+ loop-engineering workflow-metrics --queue agent-tasks
158
+ loop-engineering code-worktree-list --queue code-tasks
159
+ loop-engineering code-worktree-inspect --queue code-tasks --task-id <id>
160
+ loop-engineering code-worktree-diff --queue code-tasks --task-id <id>
161
+ loop-engineering code-worktree-export --queue code-tasks --task-id <id>
162
+ loop-engineering code-patch-verify --patch runtime/loops/code-tasks/patches/<id>.patch
163
+ loop-engineering code-patch-apply-plan --patch runtime/loops/code-tasks/patches/<id>.patch
164
+ loop-engineering code-patch-apply --patch runtime/loops/code-tasks/patches/<id>.patch --confirm-apply
165
+ loop-engineering code-review-bundle --queue code-tasks --task-id <id>
166
+ loop-engineering code-task-closeout --queue code-tasks --task-id <id>
167
+ loop-engineering code-task-autoflow --queue code-tasks --task-id <id>
168
+ loop-engineering code-task-autoflow --queue code-tasks --all-actionable --until closeout
169
+ loop-engineering code-task-finish --queue code-tasks --task-id <id> --confirm-apply --confirm-cleanup
170
+ loop-engineering code-task-run --queue code-tasks --title "Task" --task "Do the work" --confirm-apply --confirm-cleanup
171
+ loop-engineering code-task-dashboard --queue code-tasks
172
+ loop-engineering code-task-status --queue code-tasks
173
+ loop-engineering code-worktree-cleanup-plan --queue code-tasks
174
+ loop-engineering code-worktree-cleanup --queue code-tasks --confirm-cleanup
175
+ ```
176
+
177
+ Artifacts are written to:
178
+
179
+ ```text
180
+ runtime/loops/<loop_id>/state.json
181
+ runtime/loops/<loop_id>/runs/*.json
182
+ ```
183
+
184
+ ## Explainable configuration drift
185
+
186
+ Use a `json-value` check when a loop must compare one JSON configuration value
187
+ without hiding the evidence inside a shell command:
188
+
189
+ ```json
190
+ {
191
+ "id": "default-model",
192
+ "type": "json-value",
193
+ "file": "config/app.json",
194
+ "pointer": "/agents/defaults/model/primary",
195
+ "expected": "provider/model"
196
+ }
197
+ ```
198
+
199
+ Run artifacts record `expected`, `actual`, and a structured drift kind. After a
200
+ failed run, `repair-plan --id <loop>` creates a read-only review artifact. It
201
+ never edits the checked configuration or applies a repair.
202
+
203
+ ## Project Intake
204
+
205
+ Use project intake when the input is still a project brief rather than a queue
206
+ task. It turns a fuzzy request into a conservative project spec, initial
207
+ backlog, queue config, checks, and human gates while keeping execution separate.
208
+
209
+ ```bash
210
+ loop-engineering project-intake \
211
+ --root /path/to/workspace \
212
+ --name launch-site \
213
+ --brief "Build a launch website for a new product" \
214
+ --type auto \
215
+ --check "npm test"
216
+ ```
217
+
218
+ `project-intake` writes a timestamped intake artifact plus a stable latest copy:
219
+
220
+ ```text
221
+ runtime/loops/projects/<project>/intake/<timestamp>_<project>.json
222
+ runtime/loops/projects/<project>/intake/latest.json
223
+ runtime/loops/projects/<project>/plans/project-plan.md
224
+ ```
225
+
226
+ Then solidify the plan:
227
+
228
+ ```bash
229
+ loop-engineering project-plan --root /path/to/workspace --project launch-site
230
+ ```
231
+
232
+ `project-plan` writes:
233
+
234
+ ```text
235
+ configs/loops/projects/<project>.json
236
+ configs/loops/queues/<project>-dev.json or configs/loops/queues/<project>-tasks.json
237
+ runtime/loops/projects/<project>/backlog/initial.json
238
+ runtime/loops/projects/<project>/plans/project-plan.md
239
+ ```
240
+
241
+ For code-oriented project types, the generated queue is a code worktree queue.
242
+ For research, content, operations, QA, knowledge-base, infra-audit, and
243
+ assistant-workflow types, it is a standard artifact queue. The project spec
244
+ defaults to local work, progress reports, and human confirmation for push,
245
+ publish, deploy, external writes, destructive actions, production config, and
246
+ credential changes.
247
+
248
+ Inspect the project-level view without changing queue state:
249
+
250
+ ```bash
251
+ loop-engineering project-status --root /path/to/workspace --project launch-site
252
+ ```
253
+
254
+ Project intake does not enqueue work or run a scheduler by itself. Use the
255
+ generated backlog and existing queue commands when the plan is ready.
256
+
257
+ ## Observability
258
+
259
+ Use `doctor` for a read-only health view of the loop workspace:
260
+
261
+ ```bash
262
+ loop-engineering doctor --root /path/to/workspace
263
+ loop-engineering doctor --root /path/to/workspace --json
264
+ ```
265
+
266
+ It checks the workspace root, loop configs, queue configs, runtime directories,
267
+ latest loop outcomes, queue status, active tasks, failed tasks, and active queue
268
+ locks. It exits non-zero only on hard failures; warnings are reported but do not
269
+ fail the command.
270
+
271
+ Use `summarize` to inspect recent run artifacts:
272
+
273
+ ```bash
274
+ loop-engineering summarize --root /path/to/workspace --limit 20
275
+ loop-engineering summarize --root /path/to/workspace --id workspace-health
276
+ loop-engineering summarize --root /path/to/workspace --queue agent-tasks
277
+ ```
278
+
279
+ The summary reports inspected/readable/skipped run counts, status counts,
280
+ success rate, average duration, latest matching run, and recent failure reasons.
281
+ `--id` filters loop-spec runs, while `--queue` filters queue-dispatch runs.
282
+
283
+ Use `workflow-metrics` when the loop itself needs review:
284
+
285
+ ```bash
286
+ loop-engineering workflow-metrics --root /path/to/workspace --queue agent-tasks
287
+ loop-engineering workflow-metrics --root /path/to/workspace --queue agent-tasks --limit 100 --json
288
+ loop-engineering workflow-tune-plan --root /path/to/workspace --queue agent-tasks --json
289
+ ```
290
+
291
+ It reports status counts, final judgement counts, duration percentiles,
292
+ verification failures, revision pressure, human-gate pressure, common failure
293
+ signatures, progress phase counts, and optimization recommendations. The
294
+ command is read-only and does not rewrite queue state or configuration.
295
+ `workflow-tune-plan` is also read-only: it turns those metrics into an
296
+ operator-reviewable tuning plan with action items and a config overlay preview
297
+ for things such as `revisionPolicy` and human-action blocker patterns.
298
+
299
+ ## Cron Wrapper
300
+
301
+ Use the bundled wrapper after installing the package:
302
+
303
+ ```bash
304
+ LOOP_WORKDIR=/path/to/workspace \
305
+ run-loop-cron.sh configs/loops/workspace-health.json
306
+ ```
307
+
308
+ Set `LOOP_ALERT_COMMAND` to a command that accepts one message argument when
309
+ you want non-zero loop exits to notify a channel.
310
+
311
+ ## Queue Runner
312
+
313
+ The queue runner is for explicit task handoffs. It does not route ordinary chat
314
+ or simple commands by itself.
315
+
316
+ Conversation integrations can use `route-message` to separate read-only status
317
+ questions from explicit execution handoffs:
318
+
319
+ ```bash
320
+ loop-engineering route-message \
321
+ --message "走 loop 修复这个问题" \
322
+ --queue agent-tasks \
323
+ --route \
324
+ --confirm-execute \
325
+ --source-channel feishu \
326
+ --source-target user-id \
327
+ --source-account main \
328
+ --source-message-id message-id
329
+ ```
330
+
331
+ Status intent summarizes without enqueueing. Routed execution tasks retain
332
+ their source metadata and use `risk=model_assessed`: the router does not reject
333
+ goals or create human gates from topic/tool keywords. The planner and executor
334
+ assess concrete actions contextually under their applicable authorization
335
+ policy.
336
+
337
+ Use a timer or watcher to deliver terminal states back to recorded sources:
338
+
339
+ ```bash
340
+ loop-engineering queue-terminal-notify \
341
+ --queue agent-tasks \
342
+ --notify-command "send-loop-message"
343
+ ```
344
+
345
+ Successful delivery is recorded once per task/status under
346
+ `runtime/loops/<queue>/notifications/`. The notify command receives the message
347
+ as its final argument plus `LOOP_NOTIFICATION_*` environment variables. Use
348
+ `--dry-run` to inspect notifications without writing an idempotency ledger.
349
+
350
+ Human-input checkpoints use a separate resumable protocol:
351
+
352
+ ```bash
353
+ loop-engineering queue-human-input-notify \
354
+ --queue agent-tasks \
355
+ --notify-command "send-loop-message"
356
+
357
+ loop-engineering queue-human-input-resolve \
358
+ --queue agent-tasks \
359
+ --gate-id "<task-id>:<checkpoint-id>" \
360
+ --input "123456"
361
+ ```
362
+
363
+ The human-input notifier scans active and terminal tasks, sends the concrete
364
+ checkpoint blocker, and records a `waiting_for_human` gate. Resolution is
365
+ idempotent; a terminal blocked task is requeued with the response attached.
366
+
367
+ Goal-directed controllers can use the exported `normalizeGoalDecision`,
368
+ `goalLoopTransition`, and `goalStrategyFingerprint` helpers. They distinguish
369
+ an approach failure from a goal failure, require evidence-based replanning, and
370
+ stop only for achievement, a concrete human gate, proven unreachability, or an
371
+ explicit exploration budget/repetition breaker.
372
+
373
+ Create a queue config:
374
+
375
+ ```bash
376
+ loop-engineering queue-init --queue agent-tasks
377
+ ```
378
+
379
+ That writes `configs/loops/queues/agent-tasks.json`:
380
+
381
+ ```json
382
+ {
383
+ "queue": "agent-tasks",
384
+ "dispatcher": "node scripts/dispatch-task.mjs",
385
+ "preflightConfig": "configs/loops/workspace-health.json",
386
+ "timeoutMs": 1800000,
387
+ "leaseMs": 1860000,
388
+ "staleActiveMs": 3600000,
389
+ "scheduler": {
390
+ "initialInterval": "10m",
391
+ "minInterval": "1m",
392
+ "maxInterval": "4h",
393
+ "speedupFactor": 0.5,
394
+ "backoffFactor": 2,
395
+ "idleBackoffFactor": 2,
396
+ "humanGateBackoffFactor": 3,
397
+ "longRunHeadroomFactor": 1.25,
398
+ "jitter": "30s",
399
+ "progressReport": {
400
+ "enabled": true,
401
+ "minInterval": "30m",
402
+ "idleInterval": "4h",
403
+ "notifyOnFailure": true,
404
+ "notifyOnHumanGate": true,
405
+ "notifyOnCompletion": true,
406
+ "notifyOnStatusChange": true
407
+ }
408
+ },
409
+ "retry": {
410
+ "maxAttempts": 1,
411
+ "retryDelayMs": 0,
412
+ "retryExitCodes": [1],
413
+ "requiresHumanActionPatterns": [
414
+ "INSTALL_FAILED_USER_RESTRICTED",
415
+ "device unauthorized",
416
+ "no devices/emulators found",
417
+ "Permission denied",
418
+ "Operation not permitted",
419
+ "requires human",
420
+ "需要人工",
421
+ "权限未开"
422
+ ]
423
+ },
424
+ "revisionPolicy": {
425
+ "enabled": true,
426
+ "maxRevisionRounds": 3,
427
+ "sameFailureThreshold": 2,
428
+ "requireStrategyChange": true,
429
+ "strategyChangeFailureThreshold": 2
430
+ }
431
+ }
432
+ ```
433
+
434
+ ```bash
435
+ loop-engineering enqueue \
436
+ --queue agent-tasks \
437
+ --title "Check target app logs" \
438
+ --task "Inspect the latest logs and summarize blockers."
439
+ ```
440
+
441
+ Process one task:
442
+
443
+ ```bash
444
+ loop-engineering run-queue \
445
+ --config configs/loops/queues/agent-tasks.json
446
+ ```
447
+
448
+ Drive a queue with adaptive cadence:
449
+
450
+ ```bash
451
+ loop-engineering queue-scheduler-tick \
452
+ --config configs/loops/queues/agent-tasks.json
453
+ ```
454
+
455
+ The scheduler starts at 10 minutes by default, then persists its own state under
456
+ `runtime/loops/<queue>/scheduler/state.json`. Successful runs with more queued
457
+ work speed up toward `minInterval`; empty queues, failures, and human gates back
458
+ off toward `maxInterval`; long runs automatically push the next interval beyond
459
+ the observed duration to avoid re-entry. Use `--plan-only` to compute and write
460
+ the next schedule without running a queue tick, or `--force-due` to wake the
461
+ queue immediately after a manual nudge.
462
+
463
+ Scheduler ticks also write a human-readable progress report to
464
+ `runtime/loops/<queue>/progress/latest.json`. Progress reporting is enabled by
465
+ default and writes a local artifact on every scheduler tick;
466
+ the report is throttled by `minInterval`, but failures, human gates, status
467
+ changes, and queue completion can notify immediately. Pass
468
+ `--progress-notify-command "command"` to hand the summary text to an external
469
+ messaging wrapper; without that command the CLI only writes local artifacts. Use
470
+ `--no-progress-report` or `scheduler.progressReport.enabled=false` for explicit
471
+ quiet mode.
472
+
473
+ The dispatcher receives task details through environment variables:
474
+
475
+ ```text
476
+ LOOP_QUEUE_ID
477
+ LOOP_TASK_ID
478
+ LOOP_TASK_TITLE
479
+ LOOP_TASK_BODY
480
+ LOOP_TASK_FILE
481
+ LOOP_TASK_FILE_REL
482
+ LOOP_TASK_RUNTIME_DIR
483
+ LOOP_TASK_RUNTIME_DIR_REL
484
+ LOOP_TASK_CONTRACT_FILE
485
+ LOOP_TASK_CONTRACT_FILE_REL
486
+ LOOP_ACCEPTANCE_PLAN_FILE
487
+ LOOP_ACCEPTANCE_PLAN_FILE_REL
488
+ LOOP_DEV_PLAN_FILE
489
+ LOOP_DEV_PLAN_FILE_REL
490
+ LOOP_CHECKPOINTS_DIR
491
+ LOOP_CHECKPOINTS_DIR_REL
492
+ LOOP_REVIEWS_DIR
493
+ LOOP_REVIEWS_DIR_REL
494
+ LOOP_HUMAN_REVIEW_DECISION_FILE
495
+ LOOP_HUMAN_REVIEW_DECISION_FILE_REL
496
+ LOOP_HUMAN_REVISION_REQUEST_FILE
497
+ LOOP_HUMAN_REVISION_REQUEST_FILE_REL
498
+ LOOP_RUN_ID
499
+ LOOP_ATTEMPT
500
+ LOOP_MAX_ATTEMPTS
501
+ ```
502
+
503
+ Before dispatch, `run-queue` writes planning artifacts under
504
+ `runtime/loops/<queue>/tasks/<task_id>/`: `task_contract.json`,
505
+ `acceptance_plan.json`, `dev_plan.json`, `checkpoints/`, `reviews/`, and
506
+ `final_judgement.json`; when acceptance requires more work, it also writes
507
+ `revision_request.json`. The dispatcher can
508
+ read them through `LOOP_TASK_CONTRACT_FILE`, `LOOP_ACCEPTANCE_PLAN_FILE`,
509
+ `LOOP_DEV_PLAN_FILE`, `LOOP_CHECKPOINTS_DIR`, and `LOOP_REVIEWS_DIR`; the queue
510
+ run artifact records their paths, inferred risk level, human-gate flag,
511
+ acceptance check counts, planned checkpoint count, produced checkpoint files,
512
+ generated acceptance reviews, final judgement outcome, and revision request
513
+ summary. It also records a `lineage` summary so later rounds can see the root
514
+ task, current path, revision edges, and each known attempt's checkpoint,
515
+ review, final judgement, and revision request status.
516
+
517
+ During intake, the runner searches recent queue runs as a compact local error
518
+ and success library. Similar failed runs are written to `task_contract.json` as
519
+ `historical_patterns.error_library_matches`; similar successful runs become
520
+ `success_pattern_matches`. The contract also carries guidance so the dispatcher
521
+ can avoid known blockers and reuse successful tactics before it starts work.
522
+
523
+ Acceptance review includes a deterministic multi-critic baseline. Each
524
+ checkpoint review writes `critic_reviews` for correctness, safety, regression,
525
+ and domain/risk coverage. These critics are intentionally local and conservative
526
+ in v0.4.x, but the artifact shape is ready for stronger model or tool-backed
527
+ critics later.
528
+
529
+ Queues can add or override critics with `acceptanceCritics`:
530
+
531
+ ```json
532
+ {
533
+ "acceptanceCritics": [
534
+ {
535
+ "id": "artifact_traceability",
536
+ "focus": "The task must leave enough evidence for review and handoff.",
537
+ "requiredEvidence": ["summary", "verification", "files_changed"],
538
+ "failureStatus": "revise",
539
+ "revisionHint": "Produce a replayable checkpoint with changed files and verification output.",
540
+ "evidenceHints": {
541
+ "files_changed": "List the exact files or artifacts changed in the next checkpoint."
542
+ }
543
+ }
544
+ ]
545
+ }
546
+ ```
547
+
548
+ Supported evidence keys are `summary`, `verification`, `no_blockers`,
549
+ `risks_array`, `status_ready`, `files_changed`, `manual_review`,
550
+ `regression_checks`, `edge_cases`, `blocked_actions`, and `risk_level`.
551
+ If a configured critic reuses a default id such as `safety`, it overrides that
552
+ default critic's focus or evidence requirements while preserving the same review
553
+ artifact shape.
554
+
555
+ Critics can also declare revision guidance. `revisionHint` becomes the overall
556
+ next-round goal when that critic fails, and `evidenceHints` maps individual
557
+ missing evidence keys into concrete development instructions. Checkpoint
558
+ reviews write `missing_evidence`, `evidence_results`, and
559
+ `next_development_goals`; `revision_request.json`, revision task bodies, and
560
+ lineage bundles carry those fields forward so custom critics produce actionable
561
+ next-round work instead of a generic failed-critic note.
562
+
563
+ Live instrumentation and process-control requests are gated even when they are
564
+ local-only. Tasks mentioning tools or actions such as `frida`, `tcpdump`,
565
+ `adb`, `mitmproxy`, `hook`, `spawn`, `attach`, `decrypt`, `pcap`, `su`, `kill`,
566
+ or `pkill` are inferred as at least L2; destructive process cleanup is inferred
567
+ as L3. Dispatchers should stop at artifacts and wait for human review before
568
+ running those actions.
569
+
570
+ `run-queue` reports progress as it works so long-running tasks do not feel like
571
+ a black box. In normal CLI mode it prints concise stage events to stderr for
572
+ queue activation, planning, preflight, worktree setup, dispatch attempts,
573
+ verification, acceptance review, final judgement, revision requests, and final
574
+ queue status. `--json` keeps stdout/stderr machine-clean while still including
575
+ the same events in the returned JSON and the run artifact as `progress`.
576
+
577
+ `queue-lineage-bundle` turns that lineage into a human-readable Markdown review
578
+ bundle plus a JSON sidecar under `runtime/loops/<queue>/lineage-bundles/`.
579
+ The bundle highlights what each round produced, why acceptance failed, what the
580
+ next revision requested, and whether the latest round is ready for human review.
581
+
582
+ `queue-human-decision` records the human gate for a task under
583
+ `runtime/loops/<queue>/tasks/<task_id>/human_review_decision.json`. Decisions
584
+ are `approve`, `request_changes`, or `reject`. A `request_changes` decision
585
+ also writes `human_revision_request.json`, and `--enqueue-revision` can create
586
+ the next queued revision task from that feedback.
587
+
588
+ `queue-revision-plan` is the read-only preview for a failed task whose final
589
+ judgement is `needs_revision`. It reads the same `revision_request.json`, builds
590
+ the next task body, runs `revisionStrategyDiff`, and reports the revision guard
591
+ decision without writing to the queue. `queue-revision-next` uses the same plan
592
+ path, then creates the fresh queued task when the guard allows it. Both commands
593
+ can also use `human_revision_request.json` after a human `request_changes`
594
+ decision.
595
+ Pass `--output plan.json` or `--output plan.md` to save one preview artifact, or
596
+ pass `--output-dir` to write both
597
+ `runtime/loops/<queue>/revision-plans/<source-task-id>.json` and `.md` with a
598
+ stable default name. `--output-dir custom/dir` writes the same JSON/Markdown pair
599
+ under a custom workspace-relative directory. The output is written even when the
600
+ guard blocks the plan, so a blocked preview can be inspected and attached to a
601
+ human decision.
602
+ Use `queue-revision-apply-plan --plan plan.json` after review to enqueue the
603
+ saved JSON plan exactly as written instead of regenerating a fresh preview.
604
+ Blocked plans still require `--force`, and `--queue` can be supplied as an
605
+ extra assertion that the artifact is for the expected queue. Use
606
+ `queue-revision-apply-plan --from-review action-list.json` to apply the
607
+ safe enqueue actions from a saved review artifact in a batch. By default it
608
+ applies only `apply_ready` and `apply_or_refresh_stale`; `--action` can narrow
609
+ that list. The command refreshes current plan state before enqueueing, skips
610
+ already-applied plans, and never applies blocked, queue-mismatched, or unreadable
611
+ plans from the review. Pass `--output apply-report.md` or
612
+ `--output apply-report.json` to save the applied/skipped result as an audit
613
+ artifact; existing reports require `--force` to overwrite.
614
+ Use `queue-revision-review` to scan a queue's `revision-plans/` directory and
615
+ summarize which saved plans can enqueue, which guard reasons are present, their
616
+ strategy diff counts, and whether a plan has already been applied by a queued or
617
+ completed revision task. Pass `--plans-dir custom/dir` to review a custom plan
618
+ directory. Pass `--applied-report apply-report.json` to attach the latest batch
619
+ apply audit result to each matching plan, so a later action list can show which
620
+ report applied or skipped that plan. Pass `--needs-action` to hide already-applied plans and show only
621
+ plans that need an apply, blocked-plan review, queue-mismatch review, or
622
+ unreadable-file review. Pass `--stale-after 24h` to mark unapplied plans whose
623
+ generated time or file mtime is older than the threshold; supported units are
624
+ `ms`, `s`, `m`, `h`, and `d`. Pass `--output action-list.md` or
625
+ `--output action-list.json` to save the current filtered review as a human
626
+ approval artifact; existing outputs require `--force` to overwrite.
627
+ Use `queue-revision-audit-chain --review action-list.json --apply-report
628
+ apply-report.json --output audit-chain.md` to create a dedicated audit artifact
629
+ that links each reported plan to its review decision, saved plan JSON, apply
630
+ result, and resulting revision task when one was created. Add
631
+ `--verify-current` to rescan the current queue task directories and record where
632
+ each resulting task now lives, whether it still exists, and whether its current
633
+ `revisionPlanPath` still points back to the audited plan.
634
+ Add `--fail-on-drift` for CI-style checks. It implies current-state verification
635
+ and exits 2 when an error-level drift is found, including current task missing,
636
+ task-plan mismatch, source task mismatch, queue mismatch, unreadable plan JSON,
637
+ duplicate current task ids, or an apply report entry that is not present in the
638
+ review artifact. Actionable review plans that were not included in the apply
639
+ report are reported as warnings. Pass `--drift-report drift-report.md` or
640
+ `--drift-report drift-report.json` to save only the drift summary and findings
641
+ as a shorter CI artifact; existing drift reports require `--force` to overwrite.
642
+ When writing a Markdown drift report for GitHub Actions, add
643
+ `--drift-summary-format github` to produce a compact step-summary-friendly
644
+ report with a metric table and concise findings table; the default format
645
+ remains the existing detailed Markdown. In GitHub Actions, add
646
+ `--drift-summary-append-github-step` to append the same GitHub summary directly
647
+ to `$GITHUB_STEP_SUMMARY`; this does not require `--drift-report`, though both
648
+ can be used together when a saved artifact is also useful. Add
649
+ `--drift-github-annotations` to emit GitHub Actions `::error` / `::warning`
650
+ workflow commands for non-allowed drift findings on stderr, so the Checks UI can
651
+ link directly to the affected plan files without breaking `--json` stdout.
652
+ Use `queue-revision-ci-check --review action-list.json --apply-report
653
+ apply-report.json` as the short CI wrapper for the strict default: it implies
654
+ current-state verification, `--fail-on-drift`, `--drift-severity warning`,
655
+ GitHub annotations, and GitHub-format drift reports. When
656
+ `GITHUB_STEP_SUMMARY` is present, it also appends the summary automatically;
657
+ outside GitHub Actions it skips that append instead of failing. Use
658
+ `--no-github-step-summary` or `--no-github-annotations` to disable those CI UI
659
+ integrations.
660
+ Pass `--baseline previous-audit.json` or a previous drift-report JSON to compare
661
+ current findings with the saved baseline. Baseline-known findings remain visible
662
+ in JSON, Markdown, and step summary output, but CI failure and annotations only
663
+ use new non-allowed findings.
664
+ After a human has accepted the current drift, run
665
+ `queue-revision-ci-baseline-update --from current-audit.json --output
666
+ previous-audit.json` to write a compact JSON baseline for the next CI run. The
667
+ source may be an audit-chain JSON artifact or a drift-report JSON artifact.
668
+ For a first CI landing on a queue, use `queue-revision-ci-bootstrap --queue
669
+ agent-tasks`. It writes a complete artifact set under
670
+ `runtime/loops/<queue>/ci-bootstrap/<timestamp>/`: `action-list.json`,
671
+ `apply-report.json`, `audit-chain.json`, GitHub-style `drift-report.md`,
672
+ `previous-audit.json`, and `bootstrap.json`. Pass `--output-dir` to choose a
673
+ stable artifact directory, or `--baseline-output` when the baseline should be
674
+ written somewhere else.
675
+ Use `queue-revision-ci-workflow-template --queue agent-tasks --output
676
+ .github/workflows/loop-revision-ci.yml` to generate a starter GitHub Actions
677
+ workflow. The template creates a baseline on the first run when none exists,
678
+ then uses `queue-revision-ci-check` on later runs with GitHub step summary,
679
+ annotations, and artifact upload wired in.
680
+ Use `queue-revision-ci-status-badge --queue agent-tasks --output
681
+ loop-revision-ci-badge.md` to generate a README-ready badge snippet for that
682
+ workflow. The command infers `owner/repo` from the GitHub origin remote when it
683
+ can; pass `--repo owner/name`, `--workflow`, `--branch`, or `--label` to make
684
+ the badge explicit.
685
+ Use `queue-revision-ci-readme-update --queue agent-tasks --readme README.md`
686
+ to insert or refresh the same badge and a short status note inside a stable
687
+ `<!-- loop-revision-ci:start -->` / `<!-- loop-revision-ci:end -->` marker
688
+ block. Without an existing block, the command inserts one after the README
689
+ title. Pass `--section-title`, `--repo`, `--workflow`, `--branch`, or `--label`
690
+ to customize the generated section.
691
+ Use `queue-revision-ci-install-guide --queue agent-tasks --output
692
+ loop-revision-ci-install-guide.md` to generate a reviewable onboarding checklist
693
+ for a new queue. The guide links the workflow template, README marker update,
694
+ initial bootstrap baseline, strict CI check, and optional drift allow-file
695
+ template commands without writing those target files directly. Use `.json`
696
+ instead of `.md` when another script should consume the same plan.
697
+ Use `queue-revision-ci-self-test --queue agent-tasks --output
698
+ loop-revision-ci-self-test.md` to run a local smoke test in a temporary
699
+ workspace. The self-test writes a workflow template, drift allow-file template,
700
+ README marker, bootstrap artifacts, baseline, strict CI check artifacts, health
701
+ summary, and dashboard under `/tmp/loop-revision-ci-self-test-*`, then reports
702
+ the artifact paths. It
703
+ does not modify the current project except for the optional self-test report
704
+ specified by `--output`.
705
+ Use `queue-revision-ci-doctor --queue agent-tasks --output
706
+ loop-revision-ci-doctor.md` after landing revision CI in a real project. The
707
+ doctor checks that the workflow exists and references the queue, bootstrap,
708
+ strict CI check, baseline, and artifact directory; that README has the stable
709
+ marker block; that the baseline is readable and queue-matched; and that the
710
+ optional drift allow-file has an auditable shape when present. Failure-level
711
+ drift exits 2, while missing optional allow-files are warnings.
712
+ Use `queue-revision-ci-repair-plan --queue agent-tasks --output
713
+ loop-revision-ci-repair-plan.md` to turn a failed doctor run into a reviewable
714
+ command list. The repair plan can read an existing `queue-revision-ci-doctor`
715
+ JSON report with `--from doctor.json`, or run doctor inline. It proposes
716
+ commands to regenerate the workflow, refresh the README marker, rebuild the
717
+ baseline, refresh the drift allow-file, and rerun doctor, but it does not apply
718
+ those repairs itself.
719
+ Use `queue-revision-ci-apply-repair-plan --from repair-plan.json
720
+ --confirm-apply --output apply-repair-plan.md` after reviewing a JSON repair
721
+ plan. The command applies only known safe repair actions, can be narrowed with
722
+ `--action regenerate_workflow,rebuild_baseline`, writes an optional audit
723
+ report, and automatically reruns `queue-revision-ci-doctor` after the selected
724
+ repairs. Without `--confirm-apply`, it reports `confirmation_required` and
725
+ does not modify project files.
726
+ Use `queue-revision-ci-health-summary --queue agent-tasks --output
727
+ loop-revision-ci-health-summary.md` for a short read-only inspection view. It runs the
728
+ revision CI doctor, reads the configured baseline and drift allow-file, discovers
729
+ the latest bootstrap manifest under `runtime/loops/<queue>/ci-bootstrap/`, and
730
+ summarizes linked review/apply/audit/drift artifacts. Pass `--repair-plan` or
731
+ `--apply-report` to include a specific reviewed repair or apply report. The
732
+ command exits 2 when core health needs attention.
733
+ Use `queue-revision-ci-dashboard --output loop-revision-ci-dashboard.md` for a
734
+ read-only multi-queue overview. Without `--queue`, it scans
735
+ `configs/loops/queues/*.json`, runs the same health summary for each queue, and
736
+ renders a compact table with doctor, bootstrap, baseline, drift, and finding
737
+ status. Add `--queue agent-tasks` to narrow the dashboard to one queue. The
738
+ command exits 2 when any queue needs attention.
739
+ Use `queue-revision-ci-release-checklist --output
740
+ loop-revision-ci-release-checklist.md` before publishing or handing off the
741
+ revision CI setup. It reuses the dashboard inspection, turns each queue's
742
+ doctor/bootstrap/baseline/drift/health state into blocker checks, and adds
743
+ manual release gates for `npm run check`, workspace `doctor`, and
744
+ `npm pack --dry-run`. The command is read-only and exits 2 while any blocker is
745
+ open.
746
+ By default, `--fail-on-drift` fails only on error-level findings. Add
747
+ `--drift-severity warning` when a stricter queue should also fail on warnings;
748
+ use `--drift-severity error` to keep the default explicit in CI scripts. Pass
749
+ `--drift-allow current_task_missing,unreported_actionable_review_plan` to
750
+ temporarily allow named finding types; allowed findings stay visible in the
751
+ audit and drift reports but do not contribute to the fail-on-drift decision.
752
+ For auditable CI exceptions, pass `--drift-allow-file drift-allow.json`:
753
+
754
+ ```json
755
+ {
756
+ "allowed": [
757
+ {
758
+ "type": "unreported_actionable_review_plan",
759
+ "reason": "Pending owner review before the next batch apply.",
760
+ "owner": "platform-ci",
761
+ "expiresAt": "2026-07-22T00:00:00.000Z"
762
+ }
763
+ ]
764
+ }
765
+ ```
766
+
767
+ Expired allow-file entries remain visible in reports but do not allow findings.
768
+ Use `queue-revision-drift-allow-template` to create the file shape without
769
+ hand-writing JSON:
770
+
771
+ ```bash
772
+ loop-engineering queue-revision-drift-allow-template \
773
+ --type unreported_actionable_review_plan \
774
+ --owner platform-ci \
775
+ --reason "Pending owner review before the next batch apply." \
776
+ --ttl 24h \
777
+ --output drift-allow.json
778
+ ```
779
+
780
+ The template command refuses existing outputs unless `--force` is used. It also
781
+ supports `--expires-at 2026-07-22T00:00:00.000Z` instead of `--ttl`.
782
+
783
+ The planned or queued task stores `revisionStrategyDiff`, which compares the
784
+ previous failed goals with the next task body and reports which targets were
785
+ carried forward, which have explicit changed-strategy signals, and which still
786
+ need a concrete new diagnosis, tactic, evidence source, or verification step.
787
+ Pass `--strategy "..."` or `--strategy-file strategy.md` to append a focused
788
+ `Changed strategy` section without replacing the generated revision task body;
789
+ the strategy is stored as `revisionStrategy` and participates in
790
+ `revisionStrategyDiff`.
791
+
792
+ `revisionPolicy` keeps the loop persistent without letting it repeat the same
793
+ failed approach forever. By default, a lineage can create up to 3 revision
794
+ rounds. If two consecutive rounds produce the same revision-goal signature,
795
+ `queue-revision-next` refuses to enqueue another automatic round. When
796
+ `requireStrategyChange` is enabled, `revisionStrategyDiff` is also enforced: if
797
+ two consecutive revision tasks carry failed targets forward without explicit
798
+ changed-strategy detail, the next automatic revision is blocked. The generated
799
+ revision task includes anti-loop instructions requiring a changed diagnosis,
800
+ implementation tactic, evidence source, or verification step. Use
801
+ `queue-lineage-bundle` and a human decision when the guard stops progress;
802
+ `queue-revision-next --force` is reserved for explicit human overrides.
803
+
804
+ Operational commands:
805
+
806
+ ```bash
807
+ loop-engineering queue-status --config configs/loops/queues/agent-tasks.json
808
+ loop-engineering queue-peek --config configs/loops/queues/agent-tasks.json
809
+ loop-engineering queue-cancel --config configs/loops/queues/agent-tasks.json --task-id <id>
810
+ loop-engineering queue-requeue --config configs/loops/queues/agent-tasks.json --task-id <id>
811
+ loop-engineering queue-revision-plan --config configs/loops/queues/agent-tasks.json --task-id <id> --output-dir
812
+ loop-engineering queue-revision-apply-plan --config configs/loops/queues/agent-tasks.json --plan runtime/loops/agent-tasks/revision-plans/plan.json
813
+ loop-engineering queue-revision-review --config configs/loops/queues/agent-tasks.json
814
+ loop-engineering queue-revision-next --config configs/loops/queues/agent-tasks.json --task-id <id>
815
+ loop-engineering queue-lineage --config configs/loops/queues/agent-tasks.json --task-id <id>
816
+ loop-engineering queue-lineage-bundle --config configs/loops/queues/agent-tasks.json --task-id <id>
817
+ loop-engineering queue-human-decision --config configs/loops/queues/agent-tasks.json --task-id <id> --decision approve
818
+ ```
819
+
820
+ `run-queue` processes one task. `run-queue-drain` is an explicit batch/daemon
821
+ command that keeps claiming queued tasks serially until the inbox is empty or
822
+ `--max-tasks` is reached. The generated OpenClaw conversation wrapper does not
823
+ use drain mode: a new `走 loop` request while a task is active supersedes the
824
+ active task, records the replacement lineage, stops the old dispatcher process
825
+ group, and starts the corrected task after the lock is released. Explicit
826
+ queue-only wording still creates ordinary queued work. `继续当前 loop,补充要求:…`
827
+ uses the amendment path instead: it keeps the same task and worker session,
828
+ writes `amendments/NNNN.json`, increments `amendment_version` in the task
829
+ contract, acceptance plan, and dev plan, and requires the worker to reread the
830
+ latest amendment before each checkpoint and final completion. Both commands use a lease lock so overlapping ticks do not process the same
831
+ task. `staleActiveMs` moves abandoned active tasks to `failed/` before the next
832
+ task is processed. `retry.maxAttempts` retries dispatcher failures whose exit
833
+ code is listed in `retry.retryExitCodes`.
834
+
835
+ Pass `--progress-notify-command` from a conversation wrapper to keep the source
836
+ session informed while the worker runs. The runner sends ordered, idempotent
837
+ milestones for activation, completed planning, preflight, worker start/result,
838
+ worktree/verification, acceptance, and final judgement. During a long dispatch
839
+ it sends a heartbeat every five minutes by default, and a checkpoint watcher
840
+ reports newly written checkpoints without waiting for the worker process to
841
+ finish. Source channel/target/account/reply metadata is reused; missing scoped
842
+ source metadata fails closed. Notification ledgers live under
843
+ `tasks/<task-id>/progress_notifications/` so retries do not resend the same
844
+ milestone.
845
+
846
+ Dispatcher command timeouts terminate the whole spawned process group, not just
847
+ the shell wrapper, so child processes such as `frida`, `tcpdump`, or `adb`
848
+ cannot keep running after the queue run has timed out. Dispatcher failures are
849
+ also classified before retry: output matching
850
+ `retry.requiresHumanActionPatterns` is marked `requires_human_action`, the task
851
+ finishes as `needs_human_input`, and no automatic retry is attempted. Use this
852
+ for device permissions, human approval prompts, missing authorization, or other
853
+ states where another run would repeat the same blocker.
854
+
855
+ Queue artifacts live under:
856
+
857
+ ```text
858
+ runtime/loops/<queue>/inbox/*.json
859
+ runtime/loops/<queue>/active/*.json
860
+ runtime/loops/<queue>/done/*.json
861
+ runtime/loops/<queue>/failed/*.json
862
+ runtime/loops/<queue>/canceled/*.json
863
+ runtime/loops/<queue>/runs/*.json
864
+ ```
865
+
866
+ ## Assisted Code Worktrees
867
+
868
+ `v0.3.0` adds L2 assisted code queues. A code queue still uses `enqueue` and
869
+ `run-queue`, but the runner creates a git worktree and branch for the task,
870
+ runs the dispatcher inside that worktree, then runs configured verification
871
+ commands. It records the branch, worktree path, verification results, `git
872
+ status --short`, `git diff --stat`, and `git diff --name-status` in the run
873
+ artifact, plus untracked file names.
874
+
875
+ Create a starter config:
876
+
877
+ ```bash
878
+ loop-engineering code-queue-init --queue code-tasks
879
+ ```
880
+
881
+ That writes `configs/loops/queues/code-tasks.json` with:
882
+
883
+ ```json
884
+ {
885
+ "queue": "code-tasks",
886
+ "dispatcher": "node scripts/dispatch-code-task.mjs",
887
+ "preflightConfig": "configs/loops/workspace-health.json",
888
+ "worktree": {
889
+ "enabled": true,
890
+ "baseDir": "runtime/loops/code-tasks/worktrees",
891
+ "branchPrefix": "loop/code-tasks",
892
+ "verifyCommands": ["npm test"],
893
+ "keepOnSuccess": true
894
+ }
895
+ }
896
+ ```
897
+
898
+ The dispatcher receives the normal queue environment variables plus:
899
+
900
+ ```text
901
+ LOOP_ROOT
902
+ LOOP_WORKTREE_PATH
903
+ LOOP_WORKTREE_PATH_REL
904
+ LOOP_WORKTREE_BRANCH
905
+ ```
906
+
907
+ The runner deliberately does not push, merge, or delete worktrees. Treat the
908
+ artifact as a prepared patch workspace for review.
909
+
910
+ `v0.3.1` adds read-only worktree artifact inspection:
911
+
912
+ ```bash
913
+ loop-engineering code-worktree-list --queue code-tasks
914
+ loop-engineering code-worktree-inspect --queue code-tasks --task-id <id>
915
+ loop-engineering code-worktree-inspect --queue code-tasks --run-id <id> --json
916
+ ```
917
+
918
+ These commands read queue run artifacts and report branch, path, dirty status,
919
+ verification status, diff summaries, and untracked files. They do not remove
920
+ worktrees or change git state.
921
+
922
+ `v0.3.2` adds read-only patch review from the recorded worktree:
923
+
924
+ ```bash
925
+ loop-engineering code-worktree-diff --queue code-tasks --task-id <id>
926
+ loop-engineering code-worktree-diff --queue code-tasks --run-id <id> --json
927
+ ```
928
+
929
+ It resolves the worktree from the run artifact, keeps the path inside the
930
+ workspace root, then prints `git diff --stat HEAD`, `git diff --name-status
931
+ HEAD`, `git diff --binary HEAD`, and untracked file names. It does not stage,
932
+ commit, push, merge, delete, or checkout anything.
933
+
934
+ `v0.3.3` adds patch export artifacts:
935
+
936
+ ```bash
937
+ loop-engineering code-worktree-export --queue code-tasks --task-id <id>
938
+ loop-engineering code-worktree-export --queue code-tasks --run-id <id> --output review.patch --json
939
+ ```
940
+
941
+ By default it writes `runtime/loops/<queue>/patches/<taskId>.patch` plus a
942
+ `.json` manifest containing source run, worktree, diff summary, and untracked
943
+ file names. It refuses to overwrite existing exports unless `--force` is set
944
+ and does not change git or queue state.
945
+
946
+ `v0.3.4` adds offline patch verification:
947
+
948
+ ```bash
949
+ loop-engineering code-patch-verify --patch runtime/loops/code-tasks/patches/<taskId>.patch
950
+ loop-engineering code-patch-verify --patch review.patch --json
951
+ ```
952
+
953
+ It reads an exported patch, strips loop-engineering metadata comments, and runs
954
+ `git apply --check --binary` from the target workspace root. This verifies
955
+ whether the patch still applies without staging, committing, checking out,
956
+ merging, or changing queue state.
957
+
958
+ `v0.3.5` adds code worktree maintenance planning:
959
+
960
+ ```bash
961
+ loop-engineering code-worktree-cleanup-plan --queue code-tasks
962
+ loop-engineering code-worktree-cleanup-plan --queue code-tasks --json
963
+ ```
964
+
965
+ It inspects recent code queue run artifacts, checks whether recorded worktrees
966
+ still exist, detects dirty worktrees without exported patches, verifies default
967
+ patch exports when present, and reports orphan worktree directories under the
968
+ configured worktree base directory. It only prints recommendations and cleanup
969
+ commands; it does not remove worktrees or change git/queue state. `doctor`
970
+ also reports these code queue findings as warnings.
971
+
972
+ `v0.3.6` adds confirmation-gated patch application:
973
+
974
+ ```bash
975
+ loop-engineering code-patch-apply-plan --patch runtime/loops/code-tasks/patches/<taskId>.patch
976
+ loop-engineering code-patch-apply --patch runtime/loops/code-tasks/patches/<taskId>.patch --confirm-apply
977
+ ```
978
+
979
+ `code-patch-apply-plan` is read-only. It strips loop-engineering metadata,
980
+ checks `git apply --check --binary`, reports affected files, and blocks when
981
+ those affected files are already dirty unless `--allow-dirty` is supplied.
982
+ `code-patch-apply` requires `--confirm-apply` and runs the same plan first; it
983
+ only applies the patch when the plan is ready. It does not stage, commit, push,
984
+ merge, checkout, delete worktrees, or change queue state.
985
+
986
+ `v0.3.7` adds review bundle artifacts:
987
+
988
+ ```bash
989
+ loop-engineering code-review-bundle --queue code-tasks --task-id <taskId>
990
+ loop-engineering code-review-bundle --queue code-tasks --run-id <runId> --output review.md --json
991
+ ```
992
+
993
+ It writes `runtime/loops/<queue>/reviews/<taskId>.md` plus a `.json` sidecar by
994
+ default. The bundle collects the task/run identity, worktree summary,
995
+ verification results, current worktree diff, exported patch presence,
996
+ `code-patch-verify`, and `code-patch-apply-plan` when a default exported patch
997
+ exists. It refuses to overwrite unless `--force` is set and does not export,
998
+ apply, stage, commit, push, merge, delete worktrees, or change queue state.
999
+
1000
+ `v0.3.8` adds confirmation-gated worktree cleanup:
1001
+
1002
+ ```bash
1003
+ loop-engineering code-worktree-cleanup --queue code-tasks --confirm-cleanup
1004
+ loop-engineering code-worktree-cleanup --queue code-tasks --confirm-cleanup --include-orphans --json
1005
+ ```
1006
+
1007
+ It reruns `code-worktree-cleanup-plan` and removes only gated candidates with
1008
+ `git worktree remove`. Dirty worktrees require a default exported patch,
1009
+ successful `code-patch-verify`, and an existing review bundle Markdown plus
1010
+ JSON sidecar. Orphan worktree directories are skipped unless `--include-orphans`
1011
+ is supplied. The command does not stage, commit, push, merge, delete branches,
1012
+ or change queue state.
1013
+
1014
+ `v0.3.9` adds closeout artifacts:
1015
+
1016
+ ```bash
1017
+ loop-engineering code-task-closeout --queue code-tasks --task-id <taskId>
1018
+ loop-engineering code-task-closeout --queue code-tasks --run-id <runId> --output closeout.md --json
1019
+ ```
1020
+
1021
+ It writes `runtime/loops/<queue>/closeouts/<taskId>.md` plus a `.json` sidecar
1022
+ by default. The closeout gathers run identity, verification, current worktree
1023
+ state when present, patch export/verify/apply-plan status, review bundle
1024
+ presence, cleanup recommendation, and remaining next actions. It refuses to
1025
+ overwrite unless `--force` is set and does not apply patches, remove worktrees,
1026
+ stage, commit, push, merge, delete branches, or change queue state.
1027
+
1028
+ `v0.3.10` adds a task-level status ledger:
1029
+
1030
+ ```bash
1031
+ loop-engineering code-task-status --queue code-tasks
1032
+ loop-engineering code-task-status --queue code-tasks --task-id <taskId> --json
1033
+ ```
1034
+
1035
+ It reads recent code queue run artifacts and reports each task's queue state,
1036
+ worktree existence, patch export and verification status, review bundle
1037
+ presence, closeout status, cleanup recommendation, aggregate counts, and next
1038
+ recommended commands. It is read-only and does not apply patches, remove
1039
+ worktrees, stage, commit, push, merge, delete branches, or change queue state.
1040
+
1041
+ `v0.3.11` adds a safe code task autoflow:
1042
+
1043
+ ```bash
1044
+ loop-engineering code-task-autoflow --queue code-tasks --task-id <taskId>
1045
+ loop-engineering code-task-autoflow --queue code-tasks --task-id <taskId> --until closeout --json
1046
+ ```
1047
+
1048
+ By default, `code-task-autoflow` runs the review preparation flow through
1049
+ `export -> verify -> apply-plan -> review`. With `--until closeout`, it also
1050
+ generates the closeout artifact. Existing patch, review, and closeout artifacts
1051
+ are skipped unless `--force` is set. It does not apply patches, remove
1052
+ worktrees, stage, commit, push, merge, delete branches, or change queue state.
1053
+
1054
+ `v0.3.12` adds batch autoflow for actionable code tasks:
1055
+
1056
+ ```bash
1057
+ loop-engineering code-task-autoflow --queue code-tasks --all-actionable
1058
+ loop-engineering code-task-autoflow --queue code-tasks --all-actionable --until closeout --json
1059
+ ```
1060
+
1061
+ Batch autoflow reads `code-task-status`, selects tasks whose next actions need
1062
+ patch export, review generation, or, with `--until closeout`, closeout
1063
+ generation, then runs the same safe autoflow for each selected task. Custom
1064
+ output paths are intentionally disabled in batch mode. It still does not apply
1065
+ patches, remove worktrees, stage, commit, push, merge, delete branches, or
1066
+ change queue state.
1067
+
1068
+ `v0.3.13` adds a read-only dashboard for code task queues:
1069
+
1070
+ ```bash
1071
+ loop-engineering code-task-dashboard --queue code-tasks
1072
+ loop-engineering code-task-dashboard --queue code-tasks --json
1073
+ ```
1074
+
1075
+ The dashboard combines queue counts, task ledger counts, next-action counts,
1076
+ cleanup/orphan summaries, priority tasks, and recommended follow-up commands.
1077
+ It is read-only and does not apply patches, remove worktrees, stage, commit,
1078
+ push, merge, delete branches, or change queue state.
1079
+
1080
+ `v0.3.14` adds confirmation-gated single-task finish:
1081
+
1082
+ ```bash
1083
+ loop-engineering code-task-finish --queue code-tasks --task-id <taskId> --confirm-apply --confirm-cleanup
1084
+ loop-engineering code-task-finish --queue code-tasks --run-id <runId> --confirm-apply --confirm-cleanup --json
1085
+ ```
1086
+
1087
+ Finish requires default patch export/manifest, review bundle Markdown/JSON,
1088
+ closeout Markdown/JSON, a ready `code-patch-apply-plan`, and a passing cleanup
1089
+ gate. It then applies the patch to the main workspace and removes that one
1090
+ reviewed worktree, writing `runtime/loops/<queue>/finishes/<taskId>.md` plus a
1091
+ JSON sidecar. It is intentionally single-task only, requires both confirmation
1092
+ flags, and still does not stage, commit, push, merge, delete branches, or
1093
+ change queue state.
1094
+
1095
+ `v0.3.15` makes finish artifacts visible in status and dashboard views:
1096
+
1097
+ ```bash
1098
+ loop-engineering code-task-status --queue code-tasks --task-id <taskId>
1099
+ loop-engineering code-task-dashboard --queue code-tasks --json
1100
+ ```
1101
+
1102
+ After closeout artifacts are present and the cleanup gate is ready, the status
1103
+ ledger reports `ready_to_finish` and recommends the single-task
1104
+ `code-task-finish` command. After finish succeeds, the same task reports
1105
+ `landed`, includes finish artifact status, patch-applied, and worktree-cleaned
1106
+ fields, and has no remaining next actions. Dashboards include landed tasks and
1107
+ finish action counts. These views remain read-only.
1108
+
1109
+ `v0.3.16` adds a single end-to-end code task command for the basic loop
1110
+ engineering workflow:
1111
+
1112
+ ```bash
1113
+ loop-engineering code-task-run \
1114
+ --queue code-tasks \
1115
+ --title "Implement the feature" \
1116
+ --task "Make the code change, update tests, and keep the package checks green." \
1117
+ --confirm-apply \
1118
+ --confirm-cleanup
1119
+ ```
1120
+
1121
+ `code-task-run` enqueues the task, processes one code worktree queue task,
1122
+ runs autoflow through closeout, finishes the task by applying the reviewed
1123
+ patch and cleaning that worktree, then reruns the queue's configured
1124
+ `worktree.verifyCommands` in the main workspace. It stops at the first failed
1125
+ stage and reports the artifact to inspect. It still requires
1126
+ `--confirm-apply` and `--confirm-cleanup`, and it does not stage, commit, push,
1127
+ merge, or delete branches.
1128
+
1129
+ `v0.6.0` adds explainable configuration drift and a standard OpenClaw
1130
+ integration lifecycle. Structured checks preserve expected/actual evidence,
1131
+ while `repair-plan` remains read-only. The integration installer supports
1132
+ plan-only installation, doctor, disposable end-to-end smoke, hash-audited
1133
+ upgrade, and safe uninstall with formal queue runtime retention. Generated
1134
+ conversation wrappers enqueue and run one tick by default, use isolated
1135
+ configured-worker sessions, prevent recursive routing, and deliver idempotent
1136
+ human-gate or terminal notifications back to recorded source conversations.
1137
+ See `MIGRATING.md` for the 0.5 to 0.6 transition.
1138
+
1139
+ `v0.5.0` connects loop-managed work to conversations and strengthens
1140
+ goal-directed execution. `route-message` distinguishes status questions from
1141
+ explicit execution handoffs while retaining source metadata for contextual
1142
+ notifications. Human-input checkpoints can now notify the originating
1143
+ conversation and resume idempotently from `LOOP <gate-id> <input>` replies.
1144
+ Goal Loop controllers can distinguish an approach failure from a goal failure,
1145
+ replan from evidence, fingerprint strategies to prevent repetition, and stop
1146
+ only for achievement, a concrete human gate, proven unreachability, or an
1147
+ explicit exploration breaker.
1148
+
1149
+ `v0.4.4` adds project intake and scheduler progress reporting. Project briefs
1150
+ can now be converted into deterministic project specs, queue configs, initial
1151
+ backlogs, action policies, checks, and project-level status without
1152
+ auto-enqueueing work. Queue scheduler ticks now adapt cadence from a 10-minute
1153
+ bootstrap interval and write progress artifacts by default, with optional
1154
+ throttled chat notification hooks for surrounding wrappers.
1155
+
1156
+ `v0.4.3` adds a generic revision CI workflow for loop queues. It includes
1157
+ revision plan preview/apply/review/audit artifacts, strict CI drift checks,
1158
+ baseline updates, workflow and README onboarding helpers, self-test, doctor,
1159
+ repair plan/apply, health summary, dashboard, and a release checklist. It also
1160
+ adds workflow metrics, read-only tuning plans, configurable acceptance critics,
1161
+ critic evidence hints, historical pattern retrieval, and strategy-diff guards
1162
+ for repeated revision attempts.
1163
+
1164
+ `v0.4.2` hardens queue execution around live instrumentation failures. Command
1165
+ timeouts now terminate the whole spawned process group, dispatcher output can be
1166
+ classified as `requires_human_action` to stop retry, and default queue templates
1167
+ recognize common device authorization and permission blockers such as
1168
+ `INSTALL_FAILED_USER_RESTRICTED`. Task contracts also gate `frida`, `tcpdump`,
1169
+ `adb`, process control, device install, and root shell work behind human review.
1170
+ Queue runs now record and print concise progress events for long-running work.
1171
+
1172
+ `v0.4.1` adds revision persistence guards so development loops keep trying with
1173
+ new evidence or strategy changes while blocking repeated identical failures.
1174
+ Queue runs now create a task contract, acceptance plan, development plan,
1175
+ checkpoint directory, acceptance review files, final judgement, revision
1176
+ requests, lineage summaries, human review bundles, and human gate decision
1177
+ records. Human reviewers can approve, reject, or request changes with
1178
+ `queue-human-decision`; requested changes can be turned into the next revision
1179
+ task with `--enqueue-revision`.
1180
+
1181
+ ## Skill
1182
+
1183
+ The bundled skill is in `skills/taskforce-loop-engineering/SKILL.md`. Install it from
1184
+ ClawHub or copy it into an agent's skill directory when you want Codex/OpenClaw
1185
+ agents to follow the loop trigger policy and operational workflow.
1186
+
1187
+ ClawHub:
1188
+
1189
+ ```text
1190
+ https://clawhub.ai/ambitioncn/skills/taskforce-loop-engineering
1191
+ ```