@zq-silk/yui 0.14.1 → 0.15.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 (185) hide show
  1. package/ARCHITECTURE.md +91 -47
  2. package/README.md +275 -145
  3. package/dist/agent/managedRuntimeEnvironment.js +5 -8
  4. package/dist/cli/commandCatalog.js +74 -109
  5. package/dist/cli/helpRenderer.js +1 -2
  6. package/dist/cli/interactionCandidates.js +10 -0
  7. package/dist/cli/interactionPolicy.js +76 -37
  8. package/dist/cli/roleWizard.js +5 -6
  9. package/dist/cli/updateCommand.js +17 -9
  10. package/dist/cli/updateOrchestrator.js +87 -19
  11. package/dist/cli/updatePorts.js +79 -13
  12. package/dist/cli/upgradeCommand.js +105 -23
  13. package/dist/cli.js +268 -231
  14. package/dist/commands/agentCommands.js +13 -0
  15. package/dist/commands/configCommands.js +7 -19
  16. package/dist/commands/configOverview.js +3 -2
  17. package/dist/commands/controllerCommands.js +1 -1
  18. package/dist/commands/durableJobCommands.js +1 -1
  19. package/dist/commands/executionAuditCommands.js +4 -9
  20. package/dist/commands/globalRoleCommands.js +17 -0
  21. package/dist/commands/profileCommands.js +200 -30
  22. package/dist/commands/sessionCommands.js +1 -1
  23. package/dist/commands/taskActor.js +29 -127
  24. package/dist/commands/taskChangeSetCommands.js +1 -3
  25. package/dist/commands/taskCommands.js +1771 -2107
  26. package/dist/commands/taskCompletionGate.js +27 -103
  27. package/dist/commands/taskContextCommand.js +47 -80
  28. package/dist/commands/taskExecutionCommands.js +9 -27
  29. package/dist/commands/taskInputCommands.js +10 -10
  30. package/dist/commands/taskIntegrationCommands.js +69 -61
  31. package/dist/commands/taskIntegrationQueueCommands.js +1 -1
  32. package/dist/commands/taskNextActionCommand.js +8 -29
  33. package/dist/commands/taskOverviewCommand.js +25 -3
  34. package/dist/commands/taskPublicationCommands.js +151 -85
  35. package/dist/commands/taskPublicationVerifyCommand.js +181 -0
  36. package/dist/commands/taskRemoteDeliveryCommand.js +134 -0
  37. package/dist/commands/taskRoleRuntimeStatus.js +5 -6
  38. package/dist/commands/taskUpstreamCommands.js +79 -95
  39. package/dist/config/configCatalog.js +1 -1
  40. package/dist/context/contextSnapshot.js +17 -2
  41. package/dist/context/sourceTurnContext.js +30 -0
  42. package/dist/context/turnContextPack.js +107 -48
  43. package/dist/context/turnInputContract.js +11 -4
  44. package/dist/context/wakeNotification.js +84 -22
  45. package/dist/controller/agentRuntimeObserver.js +9 -12
  46. package/dist/controller/clientRuntime.js +13 -13
  47. package/dist/controller/controller.js +11 -11
  48. package/dist/controller/fileSchedulerStoreAdapter.js +262 -219
  49. package/dist/controller/jobControl.js +11 -10
  50. package/dist/controller/resourceInventory.js +6 -6
  51. package/dist/controller/resourceInventoryLinux.js +2 -2
  52. package/dist/controller/runtime.js +18 -61
  53. package/dist/controller/runtimeEventInbox.js +57 -34
  54. package/dist/controller/runtimeEventProcessor.js +36 -96
  55. package/dist/controller/runtimeHookTurnFence.js +33 -57
  56. package/dist/controller/runtimeLaunchCoordinator.js +44 -40
  57. package/dist/controller/runtimeObservationHook.js +18 -12
  58. package/dist/controller/sessionNotify.js +43 -28
  59. package/dist/controller/sessionOwnerReconciliation.js +21 -21
  60. package/dist/controller/structuredProviderObservation.js +13 -16
  61. package/dist/coordination/workMailboxQueue.js +132 -0
  62. package/dist/core/controllerServer.js +6 -5
  63. package/dist/doctor/doctor.js +37 -14
  64. package/dist/domain/agentResultTransport.js +60 -0
  65. package/dist/execution/executionHealth.js +111 -118
  66. package/dist/execution/reviewMainTurn.js +161 -0
  67. package/dist/execution/workItemExecution.js +454 -0
  68. package/dist/execution/workItemExecutionProjection.js +309 -0
  69. package/dist/execution/workItemMainTurn.js +164 -0
  70. package/dist/executor/agentExecutor.js +19 -19
  71. package/dist/executor/executorRegistry.js +7 -28
  72. package/dist/executor/fileRoleLaunchPlanner.js +16 -82
  73. package/dist/external/githubPublicationVerifier.js +114 -0
  74. package/dist/external/gitlabPublicationVerifier.js +158 -0
  75. package/dist/external/pinnedCommandRunner.js +73 -0
  76. package/dist/integration/changeSetManifest.js +0 -3
  77. package/dist/integration/deliveryObligation.js +43 -6
  78. package/dist/integration/gitIntegrationService.js +284 -101
  79. package/dist/integration/integrationAttempt.js +64 -14
  80. package/dist/integration/integrationQueueEntry.js +5 -35
  81. package/dist/integration/integrationQueueService.js +65 -194
  82. package/dist/lifecycle/canonicalLifecycleEvent.js +16 -15
  83. package/dist/lifecycle/exactTurnTerminalization.js +100 -97
  84. package/dist/message/message.js +16 -0
  85. package/dist/observability/executionAudit.js +4 -25
  86. package/dist/observability/faultClassification.js +58 -70
  87. package/dist/observability/orchestrationMetrics.js +8 -50
  88. package/dist/observability/runtimeIdentity.js +48 -50
  89. package/dist/profile/agentProfile.js +60 -15
  90. package/dist/profile/agentProfileRuntime.js +100 -0
  91. package/dist/release/releaseWorkflowPorts.js +5 -68
  92. package/dist/release/runtimeRelease.js +9 -1
  93. package/dist/repository/executionLaneGitSnapshot.js +80 -0
  94. package/dist/repository/gitWorkspace.js +9 -67
  95. package/dist/repository/taskBaseFreshness.js +3 -1
  96. package/dist/repository/taskWorkspaceCoordinator.js +32 -4
  97. package/dist/repository/taskWorkspacePreparer.js +252 -411
  98. package/dist/resources/liveReferences.js +6 -55
  99. package/dist/resources/resourceDiscovery.js +1 -30
  100. package/dist/resources/resourceRegistrar.js +0 -23
  101. package/dist/review/deltaRecheck.js +8 -65
  102. package/dist/review/reviewAcceptance.js +22 -19
  103. package/dist/review/reviewConfig.js +0 -10
  104. package/dist/review/reviewDecision.js +2 -2
  105. package/dist/review/reviewRound.js +147 -273
  106. package/dist/review/reviewerAvailability.js +13 -23
  107. package/dist/role/role.js +3 -0
  108. package/dist/runtime/agentDriverObservation.js +1 -1
  109. package/dist/runtime/agentHost.js +51 -51
  110. package/dist/runtime/builtinAgentDrivers.js +9 -2
  111. package/dist/runtime/codexAppServerRuntime.js +23 -5
  112. package/dist/runtime/exactControlPlane.js +22 -296
  113. package/dist/runtime/firstProgressAdvisory.js +1 -1
  114. package/dist/runtime/index.js +1 -1
  115. package/dist/runtime/launchBroker.js +11 -11
  116. package/dist/runtime/lifecycleReservation.js +2 -2
  117. package/dist/runtime/managedCaller.js +111 -0
  118. package/dist/runtime/ports.js +16 -3
  119. package/dist/runtime/preallocatedNativeSession.js +2 -2
  120. package/dist/runtime/processExitObservation.js +3 -2
  121. package/dist/runtime/providerContinuationReconciliationService.js +1 -1
  122. package/dist/runtime/runtimeBinding.js +1 -1
  123. package/dist/runtime/runtimeObservation.js +33 -16
  124. package/dist/runtime/runtimeSessionCandidate.js +2 -2
  125. package/dist/runtime/runtimeStopReceipt.js +11 -11
  126. package/dist/runtime/sessionLaunchRequest.js +2 -2
  127. package/dist/runtime/sessionOwnerIdentity.js +9 -9
  128. package/dist/runtime/sessionOwnerRegistry.js +13 -13
  129. package/dist/runtime/sessionReconciliation.js +4 -4
  130. package/dist/runtime/sessionTerminationGuard.js +9 -9
  131. package/dist/runtime/sessionTokenMetrics.js +5 -7
  132. package/dist/runtime/structuredProviderHost.js +5 -5
  133. package/dist/runtime/taskRuntimeIsolation.js +24 -24
  134. package/dist/runtime/tmuxAdapters.js +32 -30
  135. package/dist/scheduler/activeRoleTurnDelivery.js +37 -15
  136. package/dist/scheduler/leaderWakeupProcessor.js +78 -55
  137. package/dist/scheduler/roleTurnLiveness.js +6 -6
  138. package/dist/scheduler/roleTurnStall.js +8 -9
  139. package/dist/scheduler/taskExecutionProjection.js +19 -41
  140. package/dist/scheduler/taskObservabilityProjection.js +75 -122
  141. package/dist/storage/currentTaskStore.js +6 -4
  142. package/dist/storage/sqliteSchema.js +135 -80
  143. package/dist/storage/sqliteStore.js +69 -52
  144. package/dist/storage/storageSchema.js +92 -230
  145. package/dist/storage/storageVersions.js +12 -13
  146. package/dist/storage/taskStore.js +8 -8
  147. package/dist/storage/upgrade/upgradeOrchestrator.js +276 -85
  148. package/dist/task/completionReadiness.js +17 -98
  149. package/dist/task/deliveryGuard.js +9 -11
  150. package/dist/task/draftPlan.js +142 -0
  151. package/dist/task/nextAction.js +179 -477
  152. package/dist/task/publicationVerification.js +1 -0
  153. package/dist/task/remoteDelivery.js +233 -0
  154. package/dist/task/task.js +108 -4
  155. package/dist/task/taskRecordReference.js +0 -1
  156. package/dist/turn/turn.js +109 -16
  157. package/dist/verification/verificationGateService.js +0 -26
  158. package/dist/version.js +3 -3
  159. package/dist/web/assets/client/components.js +99 -121
  160. package/dist/web/assets/client/i18n.js +136 -58
  161. package/dist/web/assets/client/view.js +44 -0
  162. package/dist/web/assets/styles/cards.js +3 -15
  163. package/dist/web/assets/styles/widgets.js +4 -0
  164. package/dist/web/webSnapshot.js +29 -14
  165. package/dist/workItem/dependencyGate.js +34 -0
  166. package/dist/workItem/workItem.js +99 -266
  167. package/dist/workspace/workItemChangeSetManager.js +15 -59
  168. package/docs/task-local-identity.md +9 -9
  169. package/i18n/README.zh-CN.md +189 -74
  170. package/package.json +1 -1
  171. package/skills/yui-leader/SKILL.md +272 -782
  172. package/skills/yui-operator/SKILL.md +190 -365
  173. package/skills/yui-reviewer/SKILL.md +40 -33
  174. package/skills/yui-runtime/SKILL.md +22 -0
  175. package/skills/yui-worker/SKILL.md +19 -6
  176. package/dist/execution/candidateConvergence.js +0 -623
  177. package/dist/execution/executionGroup.js +0 -854
  178. package/dist/execution/resourceBroker.js +0 -426
  179. package/dist/executor/launchPlan.js +0 -16
  180. package/dist/review/reviewFinding.js +0 -240
  181. package/dist/review/reviewFindingLedger.js +0 -550
  182. package/dist/review/reviewOutcomeClassifier.js +0 -255
  183. package/dist/scheduler/resourceQueueProjection.js +0 -71
  184. package/dist/storage/upgrade/recordVersions.js +0 -82
  185. package/dist/task/repairWave.js +0 -150
package/README.md CHANGED
@@ -72,12 +72,12 @@ export YUI_HOME=/absolute/path/to/yui-home
72
72
  yui setup
73
73
  ```
74
74
 
75
- The home contains `schema.json`, the authoritative SQLite database `yui.db`,
76
- Project Catalog and knowledge, and Controller discovery files. Stable Project
77
- checkouts and managed worktrees live under the configured workspace, outside
78
- Yui home. Runtime storage accepts only the exact current contract; it never
79
- falls back to `state.json`, normalizes an older shape, or repairs a historical
80
- Home in place.
75
+ The home contains the authoritative SQLite database `yui.db`, Project Catalog
76
+ and knowledge, and Controller discovery files. Stable Project checkouts and
77
+ managed worktrees live under the configured workspace, outside Yui home.
78
+ Legacy `schema.json` and `state.json` files are evidence only. Runtime storage
79
+ accepts only the exact current contract; supported earlier storage versions
80
+ enter only through the explicit upgrade boundary.
81
81
 
82
82
  Every Task-owned record family allocates a monotonically increasing local ID
83
83
  inside its Task. Different Tasks may therefore both contain `work-item-1`,
@@ -89,51 +89,84 @@ and `task integration start`, keep their subordinate IDs local to that Task.
89
89
  Candidate IDs are local to their WorkItem and carry both Task and WorkItem
90
90
  provenance.
91
91
 
92
- Yui records layout, aggregate, and per-record-family versions in `schema.json`,
93
- but runtime admission has only two outcomes: exact current, or rejected. A
94
- missing, older, newer, or malformed contract is never converted by the running
95
- release. `yui doctor` and `yui upgrade [--dry-run]` are read-only diagnostics;
96
- `yui upgrade` does not stage, repair, back up, or switch a Home.
92
+ Yui has one Home storage version, recorded by the append-only SQLite migration
93
+ ledger. Every CLI reports both its current storage version and its minimum
94
+ supported migration version. Runtime admission still has only two outcomes:
95
+ exact current, or rejected; a Controller never migrates storage while serving
96
+ work. `yui upgrade --dry-run` is read-only. `yui upgrade` quiesces a running
97
+ Controller, creates a consistent backup, applies every missing migration in
98
+ one transaction, validates the current contract, and then restarts the
99
+ Controller when it was running before the upgrade.
97
100
 
98
101
  `yui update` stages and pins one exact package, runs that staged binary's
99
- current-contract preflight, stops the exact old Controller, activates the same
100
- artifact, verifies the installed binary and current Home, and starts the
101
- replacement Controller. Storage is not copied or migrated. If the staged
102
- release cannot open the Home exactly, the update stops before activation and
103
- leaves both the Home and current installation unchanged.
104
-
105
- To retain an old Home, keep it byte-for-byte and open it only with its original
106
- Yui version for read-only inspection. For unfinished work, initialize a new
107
- Home and let the Operator create a new Task from the old Task's objective,
108
- relevant WorkItems, current repository state, and available result summaries.
109
- The Operator creates new identities; it does not import old runtime/session
110
- state or pretend that the old Task continued.
102
+ storage preflight, stops the exact old Controller, activates the same artifact,
103
+ applies the staged release's migration chain when required, verifies the
104
+ installed binary and current Home, and starts the replacement Controller. A
105
+ Home inside the staged release's supported range can upgrade directly across
106
+ multiple versions without installing intermediate releases. A newer Home, a
107
+ Home below the migration floor, an incomplete migration ledger, or malformed
108
+ data fails closed without a guessed repair.
109
+
110
+ Yui 0.15.0 establishes storage version 1 and the migration floor. Homes created
111
+ by earlier releases, including 0.14.2, are not on this compatibility line:
112
+ preserve them for inspection with their matching Yui release or initialize a
113
+ new Home. From 0.15.0 onward, each release retains the complete chain, so later
114
+ `yui update` invocations can cross versions directly.
111
115
 
112
116
  See [Task-local identity](docs/task-local-identity.md) for the current reference
113
117
  contract.
114
118
 
115
- Schema work across Tasks is not serialized: any Task may advance a version axis
116
- (`layout`, `aggregate`, or a `record` family) on its own isolated branch without
117
- waiting for another Task's schema change to land. The later-integrating branch
118
- owns the reconciliation — rebasing onto the latest project head, resolving schema
119
- and code conflicts, re-advancing the schema versions and record-version-map
120
- entries the rebase requires, rebuilding and re-validating the wiring, and
121
- re-running the isolated E2E and docs. This is a deliberate scheduling trade-off
122
- that avoids cross-Task blocking, not an accident to repair ad hoc. The
123
- current manifest descriptor map is re-derived against the newest head, while the
124
- post-baseline descriptor snapshot remains frozen. If another Task later lands a
125
- record-schema change, the integrating branch must supply the complete adjacent
126
- path (including an explicit `0->1` introduction for a new family) and re-test to
127
- convergence.
119
+ Schema work across Tasks is not serialized: any Task may propose the next
120
+ storage migration on its own isolated branch without waiting for another Task's
121
+ schema change to land. The later-integrating branch owns the reconciliation:
122
+ rebase onto the latest project head, preserve every already released migration
123
+ unchanged, allocate the next contiguous storage version, resolve schema and code
124
+ conflicts, and re-run the bounded validation. A migration may update physical
125
+ tables and current record payloads together; it must not introduce another
126
+ writable compatibility axis.
128
127
 
129
128
  Yui provides four reusable Worker Profile definitions through
130
- `yui config profile reset`; minimum setup leaves them unconfigured:
129
+ `yui config profile reset`; minimum setup makes each one inherit the current
130
+ Global Worker runtime:
131
131
 
132
132
  ```text
133
133
  worker explorer implementer reviewer
134
134
  ```
135
135
 
136
- Profiles are versioned, provider-neutral Worker behavior templates. They hold portable prompt instructions, Skills, access expectations, and optional model and effort selections, but do not bind an Agent or own a Session or workspace. A Task Role is the Task-bound Worker instance: applying a Yui Agent Profile copies the behavior plus model/effort into that Role's active Agent binding; explicit Role options may override the copied values. This is separate from a Codex native config profile selected with `--profile`.
136
+ Profiles are versioned Worker templates with two independent parts: portable
137
+ behavior (prompt instructions, Skills, and access intent) and runtime intent.
138
+ Runtime either follows the current Global Worker binding dynamically, or names
139
+ one explicit Agent with optional model and effort. `profile list` and `profile
140
+ show` resolve the effective Agent from current configuration and display the
141
+ Global Worker launch revision when inherited; that read does not rewrite or
142
+ revise the Profile. Profiles do not own Sessions or workspaces.
143
+ When an explicit Profile's Agent has a Global Worker binding, active or
144
+ dormant, its other binding settings come from that binding; an unbound Agent
145
+ uses provider defaults. A Worker binding referenced this way cannot be unbound
146
+ until the Profile is updated, changed to inheritance, or removed. The Profile
147
+ still owns model and effort, and omitting either means the provider default
148
+ rather than the Worker's value.
149
+
150
+ Creating a Task Role from a Profile freezes the Profile behavior and its fully
151
+ resolved runtime binding into the Role. Later Profile or Global Worker changes
152
+ do not rewrite existing Task Roles. On `task role add`, model, effort, and
153
+ other Agent settings require `--agent` so Yui can validate and persist one
154
+ complete explicit binding atomically. When `--profile` and `--agent` are both
155
+ present during creation, the Agent must match the Profile's resolved Agent;
156
+ the Profile runtime remains the base binding and explicit Agent settings
157
+ override corresponding fields. On `task role update`, omitted `--agent`
158
+ updates the active binding, while a provided `--agent` updates that binding
159
+ without activating it; only `task role bind` switches the active Agent. An
160
+ explicit Profile must resolve to that update target, where its runtime is the
161
+ base binding and explicit Agent settings override corresponding fields. An
162
+ inherited Worker Profile used by itself may update portable Role behavior
163
+ without retargeting a differently bound Agent; if `--agent` or Agent settings
164
+ are also present, its currently resolved Worker Agent must match the target.
165
+ Applying a Profile replaces the portable fields owned by AgentProfile
166
+ (`defaultAccess`, description, instructions, skills, and access-derived
167
+ constraints); explicit Role options in the same command apply afterward.
168
+ This Yui Agent Profile is separate from a Codex native config profile also
169
+ named `--profile`.
137
170
 
138
171
  ## Quick start
139
172
 
@@ -150,6 +183,10 @@ yui task create "Fix CSV escaping" --project app --type bugfix
150
183
  yui task create "Ship CSV export" --project app --type feature
151
184
  yui task update <task-id> --priority high --tags release,csv --due-at 2026-08-01T00:00:00Z
152
185
  yui task update <task-id> --clear-priority --clear-tags --clear-due-at
186
+ yui task message update <task-id>/<message-id> --body-file updated-message.md --wake-policy none
187
+ yui task work edit <task-id>/<work-item-id> --objective "Revised outcome" \
188
+ --accept "New observable criterion"
189
+ yui task work retire <task-id>/<work-item-id> --summary "Removed from the current Draft"
153
190
  yui task show <task-id>
154
191
  yui task context <task-id>
155
192
  yui task activate <task-id>
@@ -160,6 +197,15 @@ writable managed Workspace. `task activate` prepares every bound Project first,
160
197
  then commits the Task's `active` status and Task-owned Workspace together. A
161
198
  preparation or consistency failure leaves the Task Draft and reports the
162
199
  workspace diagnosis instead of exposing a partially adopted execution root.
200
+ Draft Message and WorkItem edits replace only the named mutable fields while
201
+ preserving record identity and audit history. Repeated options replace the
202
+ whole collection; matching `--clear-*` flags make an empty collection explicit.
203
+ Retired records remain visible in history but leave the current Draft. A
204
+ retired WorkItem never satisfies a dependency and does not redirect downstream
205
+ dependencies through its optional replacement; fix the remaining Draft before
206
+ activation. These Draft-only mutations do not create, stop, or clean runtime
207
+ resources, and activation validates the current dependency graph, Roles, and
208
+ Project scope before any Workspace is adopted.
163
209
 
164
210
  Task type describes intent rather than selecting an execution protocol.
165
211
  Software Projects use `bugfix` or `feature`: a bugfix is Leader-owned; if it
@@ -169,10 +215,10 @@ small enough to deliver on Task main or large enough for independently owned Wor
169
215
  one substantial requirement for one Worker, not a development step, test run,
170
216
  review finding, or local fix. Multiple WorkItems are useful only when distinct
171
217
  Workers can advance meaningful requirements independently. A WorkItem's
172
- governing Candidate defines its delivery obligation: its current ChangeSets
173
- must reach committed Integration or an explicit superseded queue disposition
174
- before Task-final Review or completion. Older Candidate and ChangeSet records
175
- remain audit evidence without keeping the Task open.
218
+ governing Candidate defines its delivery obligation: each writable Project's
219
+ exact start and result commits must be represented by a committed Integration
220
+ before Task-final Review or completion. Older Candidate, ChangeSet, and queue
221
+ records remain audit evidence without keeping the Task open.
176
222
 
177
223
  `project refresh` is the explicit network operation for a stable Project checkout. It fetches the
178
224
  configured stable branch directly from the Project remote URL and advances only through a clean,
@@ -294,9 +340,34 @@ to route evidence to the original Worker, accept, reject and redispatch that
294
340
  Worker in its existing Session, review again, or request user input.
295
341
  A failed review remains visible evidence and wakes the Leader, but does not
296
342
  take that decision away from the Leader.
297
- Task context and next-action expose direct Review facts: every frozen Project
298
- commit, its relation to the current candidate, the active Turn, and the Reviewer
299
- workspace. A request that fails after Round creation retains the ReviewRound
343
+
344
+ An explicit WorkItem Candidate or Task-final Review is direct unless the
345
+ Leader names Producer Roles. Policy-triggered WorkItem Review remains direct
346
+ by default:
347
+
348
+ ```sh
349
+ yui task work review <task-id>/<work-item-id>
350
+ yui task work review <task-id>/<work-item-id> \
351
+ --lane-role security-reviewer --lane-role correctness-reviewer
352
+
353
+ yui task review request <task-id> --role reviewer
354
+ yui task review request <task-id> --role reviewer \
355
+ --lane-role security-reviewer --lane-role correctness-reviewer
356
+ ```
357
+
358
+ Direct Review creates one main Reviewer Turn with no ExecutionGroup or Lane.
359
+ Replicated Review requires at least two distinct Producer Roles, all inspecting
360
+ the identical frozen Assignment in isolated Lane workspaces. Yui waits for
361
+ every Lane to settle and requires at least two successful Producer results
362
+ before creating one idempotent main Reviewer synthesis Turn. Successful
363
+ Producers are never rerun during Lane or main retry. Producer output is durable
364
+ non-authoritative evidence; only the exact completed main Reviewer Turn
365
+ completes the Round. The Leader reads that Turn's original result and decides
366
+ what it means.
367
+
368
+ Task context and next-action expose the Review shape, every frozen Project
369
+ commit, its relation to the current candidate, Producer and main Turns, and
370
+ their owned workspaces. A request that fails after Round creation retains the ReviewRound
300
371
  and reports its exact reason; the Leader opens that Round and decides whether
301
372
  to retry, inspect or clean the workspace, use another Reviewer, or continue
302
373
  other work.
@@ -399,19 +470,18 @@ yui task work isolate <task-id>/<work-item-id>
399
470
  yui task work reject <task-id>/<work-item-id> \
400
471
  --summary "Write scope expanded; continue in the refreshed workspace."
401
472
  yui task work dispatch <task-id>/<work-item-id>
402
- yui task work capture <task-id>/<work-item-id>
403
- yui task integration start <task-id> --project backend \
404
- --change-set <backend-change-set-id> --check "<validation command>"
473
+ yui task integration start <task-id> --work-item <work-item-id> \
474
+ --project backend --strategy cherry-pick --check "<validation command>"
405
475
  yui task integration cleanup <task-id>/<integration-id>
406
476
  yui task work cleanup <task-id>/<work-item-id> --integrated
407
477
  ```
408
478
 
409
- `capture` records one immutable ChangeSet per modified Project. Repeat capture
410
- at the same HEAD reuses the record; a repaired HEAD produces a new candidate.
411
- Integration remains a single-Project Git transaction, so the Leader integrates
412
- each Project independently. Acceptance succeeds only after every modified
413
- Project's latest candidate is integrated. Yui refuses integrated cleanup while
414
- any result remains unintegrated. Use `--abandon` only for deliberate discard.
479
+ The WorkItem Candidate records its exact start and result commits. Integration
480
+ remains a single-Project Git transaction, so the Leader integrates each Project
481
+ independently and chooses fast-forward, cherry-pick, merge, or manual
482
+ application. Acceptance succeeds only after every writable Project result has
483
+ a committed Integration, including an explicit successful no-op when the
484
+ result is already represented. Use `--abandon` only for deliberate discard.
415
485
  Dirty worktrees are retained. Native Agent Sessions may be scoped to their
416
486
  launch directory, so Yui retires a stopped Role Session whenever the Role moves
417
487
  between Task main and an isolated WorkItem worktree. The next dispatch starts a
@@ -460,11 +530,12 @@ resumes the newest entry directly. Starting a conversation is never a resume
460
530
  choice: the explicit `operator new` command starts a clean conversation and
461
531
  preserves the previous one in history.
462
532
 
463
- Create a Task-bound Worker instance from the configured global Worker, apply a
464
- Profile, and dispatch a WorkItem:
533
+ Create a Task-bound Worker instance from a Profile's resolved runtime and
534
+ dispatch a WorkItem:
465
535
 
466
536
  ```sh
467
537
  yui config role show worker
538
+ yui config profile show implementer
468
539
  yui task role add <task-id> implementer --profile implementer
469
540
  yui task role show <task-id> implementer
470
541
 
@@ -474,62 +545,35 @@ yui task work isolate <task-id>/<work-item-id>
474
545
  yui task work dispatch <task-id>/<work-item-id> --input "Implement and run focused tests"
475
546
  ```
476
547
 
477
- Dispatch remains `single` by default. A Leader can explicitly enable bounded
478
- multi-route exploration on a fresh WorkItem; each accepted stage advances
479
- `Plan Generate Compare Synthesize Verify Resolve`, and only the
480
- accepted Resolve stage materializes the existing single Candidate:
548
+ Without `--lane-role`, the assignee performs the WorkItem directly in its main
549
+ workspace. To request independent production attempts over exactly the same
550
+ frozen Assignment, provide at least two distinct Task Roles; one role is
551
+ rejected, roles cannot repeat, and the assignee cannot be a Lane:
481
552
 
482
553
  ```sh
483
554
  yui task work dispatch <task-id>/<work-item-id> \
484
- --mode parallel-diverse --max-rounds 2 --stage-max-attempts 2 \
485
- --strategy fixed:2 --lane-role critic \
486
- --stage-max-tokens 240000 --stage-max-tool-calls 200 \
487
- --stage-max-seconds 1800 --stage-quorum 2
488
- yui task work group resolve <task-id>/<work-item-id> \
489
- --decision accept --summary "Plan evidence is sufficient"
555
+ --input "Implement and run focused tests" \
556
+ --lane-role producer-a --lane-role producer-b
490
557
  ```
491
558
 
492
- Every stage is a new immutable ExecutionGroup. Its ContextSnapshot and selected
493
- parent Lane results are durable references; `retry` repeats a stage within its
494
- attempt budget, while `retry` at Resolve begins the next bounded round.
495
-
496
- Each new stage also freezes one Resource Broker contract: behavioral tool-call
497
- and wall-clock budgets; a display-only token threshold; quorum and deadline; a
498
- straggler window; and the minimum marginal value for more Lane spend. Omitted
499
- values reuse the existing context budget and runtime-health windows; stage
500
- retries share the original cumulative observations and absolute deadline.
501
- Observed token totals and the configured token threshold are cost context only:
502
- they never close spend, block admission, suppress scheduling, or stop a Lane.
503
- Execution, Lane retry, and Reviewer-panel
504
- admission all count active Lanes at Home, Task, WorkItem, Group, Provider,
505
- Agent, and model scopes. Capacity pressure keeps the excess Lane durably
506
- pending instead of failing the Group. Capacity release or deadline arrival
507
- wakes the Leader through the existing actionability path; rerunning the same
508
- dispatch resumes the frozen input. Released capacity is reserved for the
509
- oldest currently admissible waiter, while a Provider- or Agent-blocked queue
510
- head does not prevent independent scopes from making progress. Provider rate
511
- limits still use the existing in-place retry window and therefore never fan
512
- out into sibling failures.
513
-
514
- The Leader may add `--early-stop <0-100>` to an accepting Group resolution.
515
- Yui permits it only after quorum and T5's passed Verify/Resolve evidence prove
516
- sufficiency. It may skip Lanes that never started; active stragglers are
517
- reported and retained, never killed automatically for cost. If evidence is
518
- insufficient, behavioral tool-call/wall-clock budget or deadline exhaustion
519
- blocks the stage for Leader judgment instead of turning thin evidence into
520
- success.
521
-
522
- New exploration histories also freeze the structured candidate-convergence
523
- contract. Yui appends the exact stage-local JSON shape to every Lane assignment
524
- and validates selected reports before the Leader can advance: Compare must
525
- partition duplicate clusters and justify each selected route with a direct
526
- source, executable check, or frozen artifact; Synthesize uses a claim/evidence
527
- table for research, a decision matrix for architecture, and one frozen Git
528
- snapshot for code. Verify must use a Role independent from the selected
529
- Synthesize author. Only complete criterion evidence can produce `passed` and
530
- an accepted Resolve Candidate; explicit gaps produce `next-round` and can only
531
- continue through bounded Resolve `retry`. Votes and derived analysis remain
532
- reportable context, but never substitute for direct evidence.
559
+ Each Lane is a recoverable logical slot. A successful Lane points to its
560
+ immutable Producer Turn result; a failed Turn leaves the Lane open and visible
561
+ as `needs-attention`. The Leader retries or explicitly settles that exact Turn:
562
+
563
+ ```sh
564
+ yui task turn retry <task-id>/<failed-turn-id>
565
+ yui task turn settle <task-id>/<failed-turn-id>
566
+ ```
567
+
568
+ Yui waits until every Lane is settled. At least two successful Producer results
569
+ create one idempotent main Turn for the WorkItem assignee; fewer results fail
570
+ the WorkItem attempt without falling back to a single result. A main Turn retry
571
+ keeps the same source Group and never reruns successful Lanes. Only a successful
572
+ main Turn can become the Candidate used by Review and Integration. `task work
573
+ show`, `task work list`, Task context, and the Web control room derive execution
574
+ shape, recovery targets, synthesis eligibility, main Turn, Candidate provenance,
575
+ next action, and owner from the same persisted facts. Missing facts stay
576
+ `unknown` or `unobserved`; token, duration, and tool-call totals are display-only.
533
577
 
534
578
  Permission is one adapter-specific enum configuration on each Agent binding:
535
579
  `default` follows the provider, `bypass` compiles the provider's supported
@@ -539,16 +583,16 @@ set. Codex options are `sandbox` and `approval`; Claude options are `mode`,
539
583
  Profile behavior and Project write authority: only an exact WorkItem scope and
540
584
  matching managed workspace grant normal Project writes. A ReviewRound is the only non-WorkItem write
541
585
  purpose and must match its Turn, reviewRoundId, frozen base, and
542
- ReviewRound-owned workspace; every mismatch fails closed. Its diagnostic commit
586
+ ReviewRound-owned main workspace or exact isolated Producer Lane workspace;
587
+ every mismatch fails closed. Its diagnostic commit
543
588
  is visible history but is
544
589
  explicitly rejected by capture, ChangeSet, Integration, and acceptance paths.
545
590
  The Reviewer's final Provider response is its complete free-form Markdown or
546
- JSON report. If a JSON report
547
- includes known `checks` or `evidenceCommit` fields, Yui records them as
548
- structured evidence and verifies the reported commit against the managed
549
- Review branch HEAD; unknown fields remain part of the report. Dirty uncommitted
550
- diagnosis may end without a commit; the worktree is retained and cleanup
551
- refuses it until it is clean.
591
+ JSON result. Yui stores that text unchanged and does not parse headings, field
592
+ names, checks, severities, findings, or verdicts. Core-owned workspace and Git
593
+ evidence remains separate from Agent prose. Dirty uncommitted diagnosis may end
594
+ without a commit; the worktree is retained and cleanup refuses it until it is
595
+ clean.
552
596
 
553
597
  Every Role desired launch change increments its revision and applies only to a
554
598
  future launch. Each Turn and native Role Session stores the complete actual
@@ -614,7 +658,8 @@ still matches:
614
658
 
615
659
  ```sh
616
660
  yui task integration start <task-id> \
617
- --change-set <change-set-id> \
661
+ --work-item <work-item-id> \
662
+ --strategy cherry-pick \
618
663
  --check "npm test"
619
664
  ```
620
665
 
@@ -694,6 +739,78 @@ yui task context <task-id>
694
739
 
695
740
  Use the narrower `task work`, `task message`, `task turn`, and Task Knowledge commands when you need one collection or record.
696
741
 
742
+ Record a Task's confirmed PR/MR delivery state with one idempotent command:
743
+
744
+ ```sh
745
+ yui task publication upsert <task-id> --project <project> \
746
+ --provider github --repository <owner/name> --kind pull-request --id <number> \
747
+ --url <url> --state open --reported
748
+ ```
749
+
750
+ The required provider/repository/external ID selects the current Publication.
751
+ The first upsert creates it. Later upserts inherit omitted metadata and omitted
752
+ merge evidence only while the full evidence context remains unchanged. That
753
+ context is the local commit, PR/MR state, remote commit, evidence text, and
754
+ merge time. If any explicitly supplied context value differs, omitted
755
+ verification resets to `reported` and omitted merge-evidence fields are
756
+ cleared; changing the local commit without an explicit state also resets the
757
+ Publication to `open`. Resupplying identical values remains idempotent. Each
758
+ semantic change appends a new immutable record linked to the previous version,
759
+ while identical input creates no event. `list`, `show`, and `task context`
760
+ retain the complete history. This records facts already known to the caller;
761
+ it does not query a provider or replace Review, Integration, or Task completion
762
+ gates.
763
+
764
+ Verify one current GitHub or GitLab Publication against the real PR/MR state:
765
+
766
+ ```sh
767
+ yui task publication verify <task-id>/<publication-id>
768
+ ```
769
+
770
+ Verification is an explicit external read. GitHub uses a trusted, PATH-pinned
771
+ local `gh` executable; GitLab uses a trusted, PATH-pinned local `glab`
772
+ executable. Both reuse the CLI's existing authentication, and Yui stores no
773
+ provider token. The command requires the current unsuperseded Publication to
774
+ record the exact Task delivery head, then requires the provider to report the
775
+ same PR/MR head as merged and expose the integrated remote commit. It rechecks
776
+ the Task head and Publication after the remote call before appending a new
777
+ immutable `verified` record. Missing provider CLIs, unavailable
778
+ authentication, ambiguous provider output, open/closed PRs or MRs, moved
779
+ heads, and concurrent local changes fail without recording verification.
780
+ GitLab repositories may use nested namespaces; a recorded self-hosted MR URL
781
+ selects that GitLab host.
782
+
783
+ Query whether every delivered Project head is represented by a current merged
784
+ Publication:
785
+
786
+ ```sh
787
+ yui task remote-delivery <task-id>
788
+ yui task remote-delivery <task-id> --json
789
+ ```
790
+
791
+ This is a read-only derived projection, not a Task status or writable `merged`
792
+ flag. Active and reopened Tasks use the current clean Task-main heads and mark
793
+ them provisional; completed and archived Tasks use the latest frozen
794
+ `task.completed` heads. For each Project, Yui reports the expected local
795
+ commit, the matching current unsuperseded Publication, PR/MR state,
796
+ verification, and remote commit. Aggregate coverage is `none`, `unavailable`,
797
+ `pending`, `partial`, or `merged`, with independent `allMerged` and
798
+ `allVerified` values.
799
+ Only a current Publication whose `localCommit` exactly matches the expected
800
+ head and whose state is `merged` contributes merged coverage. Missing commits,
801
+ open/closed records, stale heads, and superseded Publications never imply
802
+ remote delivery. Projects whose Task head equals their managed base need no
803
+ Publication. `task show`, `task context`, `task next-action`, and the Web detail
804
+ projection use this same selector.
805
+ `Archive --integrated coverage` requires both `allMerged=true` and
806
+ `allVerified=true`.
807
+
808
+ When a valid older completed Task has no frozen completion heads, Yui reports
809
+ `unavailable` and keeps integrated archive fail-closed. Reopen and complete the
810
+ Task again to record exact heads, then retry archive. Yui does not guess the
811
+ missing head from a Publication or worktree, and `--force` never overrides
812
+ missing head evidence.
813
+
697
814
  When the requested outcome is finished, complete the Task to stop automatic Leader wakes without deleting its sessions or Task main worktree:
698
815
 
699
816
  ```sh
@@ -733,9 +850,17 @@ worktrees are non-blocking completion advisories, but they must be settled
733
850
  before archive. Every isolated WorkItem worktree is explicitly cleaned as
734
851
  integrated or abandoned; that cleanup also removes its managed branch. Archive
735
852
  requires `--integrated` or `--abandon` to state the Task main outcome and is
736
- allowed only after Task main is clean. It removes managed worktrees but retains
737
- Task and WorkItem records. The Task main branch is retained as a recovery
738
- artifact instead of being silently deleted.
853
+ allowed only after Task main is clean. `--integrated` additionally requires
854
+ remote-delivery `allMerged=true` and `allVerified=true`; Task completion or a
855
+ reported merge alone is never treated as verified remote delivery. When every
856
+ exact Task head is merged but one or more Publications remain `reported`, the
857
+ command identifies those Publications and refuses archive. An explicitly
858
+ authorized `task archive <task-id> --integrated --force` may override only that
859
+ verification gap and records the override in the archive event; it never
860
+ bypasses missing, stale, open, or closed merge evidence. An intentional
861
+ non-merge uses the existing explicit `--abandon` path. Archive removes managed
862
+ worktrees but retains Task and WorkItem records. The Task main branch is
863
+ retained as a recovery artifact instead of being silently deleted.
739
864
  Task lifecycle completion/selection only suggests valid source states: Draft for activate, active for complete, and completed for reopen.
740
865
 
741
866
  ## Sessions and tmux
@@ -790,10 +915,9 @@ Global Context entry:
790
915
  yui session enter <global-role>
791
916
  ```
792
917
 
793
- `yui update` accepts only the current Home contract and never migrates storage.
794
- For an older Home, keep its Sessions stopped, inspect it with the original Yui
795
- version, and let the current Operator recreate unfinished intent as new Tasks in
796
- a newly initialized Home. Runtime ids and mailbox state are not copied.
918
+ `yui update` accepts either the current Home contract or any valid historical
919
+ contract at or above the staged CLI's minimum supported migration version.
920
+ Unsupported newer Homes and Homes below that floor remain untouched.
797
921
 
798
922
  tmux fixes a pane's history capacity when that pane is created. Existing panes
799
923
  retain their configured capacity; managed runtime output remains observable in
@@ -875,38 +999,41 @@ hiding the resources that remain. Use `--all` to include discovered Yui homes.
875
999
 
876
1000
  `controller restart` replaces the Controller process and its scheduler/socket services with the currently installed Yui version. It can recover a lost discovery record only when the old process still matches the current UID, Controller entrypoint, physical Home, PID, and process-start identity. It does not stop or restart managed tmux/Agent sessions.
877
1001
 
878
- Successful `setup`, `upgrade`, and `update` commands ensure that the current
879
- Home has a running Controller, starting one when the Home was previously idle.
880
- Read-only commands and `upgrade --dry-run` do not start a Controller. `update`
881
- also replaces an already-running Controller only after the new binary passes its
882
- health checks.
1002
+ Successful `setup` and `update` commands ensure that the current Home has a
1003
+ running Controller, starting one when the Home was previously idle. A
1004
+ successful `upgrade` restores a Controller only when it stopped one for the
1005
+ migration. `update` starts the replacement only after migration and health
1006
+ checks pass.
883
1007
 
884
1008
  Its recovery reconciliation runs every 120 seconds by default. Normal durable state changes enqueue a Task, Role, or Operator key and return immediately; keys received in the same fixed 100 ms window trigger one non-overlapping targeted pass. Operator presentation has an independent lane, so a blocked Task workspace operation cannot delay a user question. Periodic Git/worktree work is limited to Tasks with durable Task-mailbox work, while active Role liveness uses one tmux inventory. Structured Agent Driver observations, whether received from native provider events or supported Hooks, are exact-fenced before they reach the durable runtime inbox. A terminal Turn observation atomically records the exact Turn result. Durable mailboxes freeze the current batch while new signals merge into the next batch. Task-orchestration failures retain the exact Controller-owned processing batch for two bounded fast retries and later periodic recovery; a successful retry completes that batch before newer pending work is claimed. Recommended InputRequest and pending Turn deadlines share one nearest-deadline selector and therefore do not wait for the recovery interval. Explicit `task reconcile` still requests an immediate recovery pass. The retained loop is:
885
1009
 
886
1010
  1. dispatch pending Leader wakes whose Task workspaces are already ready;
887
1011
  2. prepare active Project Task main worktrees with durable orchestration work;
888
- 3. deliver queued Worker Turns;
1012
+ 3. deliver active Role Turns from durable active-Turn state, using ordinary
1013
+ Role mailboxes only as optional delivery hints;
889
1014
  4. resolve due Turn completions and reconcile Role liveness;
890
1015
  5. dispatch Leader work created or unblocked by the later recovery phases.
891
1016
 
892
1017
  Automated input is sent only through tmux. Each pass performs one non-blocking process-state readiness check; a busy startup is retried through a small bounded mailbox timer, while later busy sessions are woken by canonical Agent Driver terminal observations. A pane-local receipt prevents the same Turn input from being typed twice after a Controller retry.
893
1018
 
894
- If a Role process exits without a terminal Provider result, the Controller fails that Turn and running WorkItem and queues the Leader. Recovery failures are exposed through the small Jobs view:
1019
+ If a Role process exits without a terminal Provider result, the Controller fails that Turn and queues the Leader. A replicated WorkItem or Review Producer Lane remains open for exact retry or explicit settlement; completed sibling results remain reusable. Recovery failures are exposed through the small Jobs view:
895
1020
 
896
1021
  ```sh
897
1022
  yui jobs list
898
1023
  yui jobs retry leader-recovery:<task-id>
899
1024
  yui task reconcile <task-id>
900
1025
  yui task turn retry <failed-turn-id>
901
- yui task turn settle <obsolete-failed-review-turn-id>
1026
+ yui task turn settle <failed-turn-id>
902
1027
  ```
903
1028
 
904
1029
  `jobs` is not a restored generic queue: it presents durable pending Leader wakes and Leader recovery failures only.
905
1030
 
906
- `task turn settle` is a Leader-only repair for one exact failed Reviewer Turn whose
907
- matching Task-final ReviewRound was stranded running by an older lifecycle. It
908
- closes only an obsolete frozen candidate, preserves the Turn, Round, workspace,
909
- and evidence, and never creates a retry Round.
1031
+ `task turn settle` records that the Leader will no longer recover the exact
1032
+ current failed Producer Lane Turn. Only then does the Lane become failed and the
1033
+ settled Group become eligible for WorkItem or Review synthesis when at least
1034
+ two Producer results succeeded. The same command retains its narrow repair for an obsolete failed
1035
+ Reviewer Turn whose Task-final ReviewRound is stranded on an old frozen
1036
+ candidate; that repair never creates a retry Round.
910
1037
 
911
1038
  Completion is the reversible execution fence. Archiving is terminal and is accepted only after active work is settled: it stops the Task's tmux session and removes clean managed worktrees. Dirty worktrees keep the Task completed and are preserved for deliberate resolution.
912
1039
 
@@ -945,7 +1072,8 @@ with an execution band that consolidates the Task's owner, current action,
945
1072
  attention list, blockers, and fail-closed indicators; Work items surface
946
1073
  their current ExecutionGroup with per-lane status, Candidates, and
947
1074
  retirement disposition; Turns show purpose, execution lineage, final result,
948
- and Leader disposition.
1075
+ and Leader disposition; Reviews show direct or replicated shape, frozen
1076
+ Assignment, Producer Lane state, main synthesis Turn, and authoritative result.
949
1077
 
950
1078
  The control room supports English and Simplified Chinese, selecting an initial locale from the browser and remembering manual changes. The theme selector switches between the dark Control Room, the light Paper Ledger, and the dark-blue Atlas themes. Both choices are stored only in browser `localStorage`; they do not modify `YUI_HOME`.
951
1079
 
@@ -967,15 +1095,17 @@ yui project reset|replace|retire|delete
967
1095
  ```
968
1096
 
969
1097
  `yui update` stages the newly published package side by side and asks that exact
970
- binary to verify that the Home already matches its current storage contract.
971
- Only then does it stop the exact old Controller, activate the same concrete
972
- package version, validate the actually installed binary and Home, and start the
973
- replacement Controller. It never migrates or switches storage. An older or
974
- otherwise unsupported Home blocks preflight and remains untouched.
975
-
976
- `yui upgrade [--dry-run]` is retained as a read-only storage admission
977
- diagnostic. It reports current, uninitialized, invalid, or unsupported state and
978
- the Operator action; it never performs an upgrade.
1098
+ binary to classify the Home. Only then does it stop the exact old Controller,
1099
+ activate the same concrete package version, apply the complete missing
1100
+ migration chain when needed, validate the actually installed binary and Home,
1101
+ and start the replacement Controller. Unsupported Homes block preflight and
1102
+ remain untouched.
1103
+
1104
+ `yui upgrade --dry-run` prints the ordered migration plan without writing.
1105
+ `yui upgrade` creates a timestamped SQLite backup and upgrades any valid Home
1106
+ from the CLI's minimum supported storage version to its current version. Yui
1107
+ 0.15.0 is storage version 1; pre-0.15.0 Homes remain outside that migration
1108
+ line and are never rewritten.
979
1109
 
980
1110
  Agent environment bindings store process-environment variable names, never secret values. Adapter-owned lifecycle arguments cannot be overridden through raw arguments.
981
1111
 
@@ -996,7 +1126,7 @@ npm test
996
1126
  ```
997
1127
 
998
1128
  The permanent suite is intentionally one seconds-scale core smoke. It checks
999
- CLI startup, a normal SQLite Task path, the supported migration graph, and the
1129
+ CLI startup, a normal SQLite Task path, exact-current storage admission, and the
1000
1130
  built-in Agent Drivers. Change-specific TDD fixtures and abnormal-data repros
1001
1131
  are temporary development evidence and are removed when the change is complete;
1002
1132
  they do not accumulate as permanent regression tests. See