@zq-silk/yui 0.15.8 → 0.15.11

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 (151) hide show
  1. package/ARCHITECTURE.md +2 -0
  2. package/ARCHITECTURE.zh-CN.md +151 -0
  3. package/README.md +211 -14
  4. package/dist/agent/launchEnvironment.js +7 -0
  5. package/dist/artifacts/artifactCapability.js +74 -0
  6. package/dist/artifacts/artifactCommitLock.js +249 -0
  7. package/dist/artifacts/artifactPaths.js +151 -0
  8. package/dist/artifacts/gitArtifactRef.js +146 -0
  9. package/dist/artifacts/managedGit.js +332 -0
  10. package/dist/artifacts/taskArtifactRepository.js +277 -0
  11. package/dist/cli/commandCatalog.js +40 -16
  12. package/dist/cli/interactionPolicy.js +3 -3
  13. package/dist/cli/updateOrchestrator.js +24 -1
  14. package/dist/cli/updatePorts.js +7 -3
  15. package/dist/cli/upgradeCommand.js +42 -2
  16. package/dist/cli.js +403 -93
  17. package/dist/commands/globalRoleCommands.js +314 -4
  18. package/dist/commands/operatorCommands.js +33 -2
  19. package/dist/commands/projectCommands.js +6 -7
  20. package/dist/commands/releaseCommands.js +18 -0
  21. package/dist/commands/taskActivationCommands.js +22 -0
  22. package/dist/commands/taskActor.js +25 -0
  23. package/dist/commands/taskCommands.js +846 -155
  24. package/dist/commands/taskIntegrationCommands.js +16 -38
  25. package/dist/commands/taskIntegrationQueueCommands.js +1 -1
  26. package/dist/commands/taskRemoteDeliveryCommand.js +6 -6
  27. package/dist/commands/taskRoleRuntimeStatus.js +35 -0
  28. package/dist/context/runContextPack.js +28 -16
  29. package/dist/context/taskContext.js +64 -5
  30. package/dist/controller/agentHostObservation.js +155 -0
  31. package/dist/controller/clientRuntime.js +17 -2
  32. package/dist/controller/controller.js +11 -2
  33. package/dist/controller/fileSchedulerStoreAdapter.js +446 -13
  34. package/dist/controller/globalInputDelivery.js +119 -0
  35. package/dist/controller/jobControl.js +6 -2
  36. package/dist/controller/resourceInventory.js +14 -4
  37. package/dist/controller/resourceInventoryLinux.js +2 -6
  38. package/dist/controller/runtime.js +81 -6
  39. package/dist/controller/runtimeEventInbox.js +32 -3
  40. package/dist/controller/runtimeEventProcessor.js +26 -6
  41. package/dist/controller/runtimeHookRunFence.js +75 -19
  42. package/dist/controller/structuredProviderObservation.js +133 -70
  43. package/dist/coordination/workMailboxQueue.js +5 -0
  44. package/dist/execution/workItemExecutionProjection.js +1 -1
  45. package/dist/executor/agentExecutor.js +64 -4
  46. package/dist/executor/executorRegistry.js +3 -0
  47. package/dist/executor/fileRoleLaunchPlanner.js +78 -118
  48. package/dist/integration/deliveryObligation.js +2 -1
  49. package/dist/integration/gitIntegrationService.js +312 -382
  50. package/dist/integration/integrationAttempt.js +30 -4
  51. package/dist/integration/integrationQueueService.js +7 -7
  52. package/dist/integration/integrationSourceApplication.js +323 -0
  53. package/dist/kernel/builtinCapabilities.js +32 -24
  54. package/dist/message/globalInterrupt.js +33 -0
  55. package/dist/message/inputControlResolution.js +106 -0
  56. package/dist/message/message.js +423 -0
  57. package/dist/message/messageContinuation.js +126 -3
  58. package/dist/message/taskInterrupt.js +34 -0
  59. package/dist/observability/orchestrationMetrics.js +1 -1
  60. package/dist/plugins/pluginService.js +11 -3
  61. package/dist/release/releaseHandover.js +22 -0
  62. package/dist/release/releaseWorkflowPorts.js +15 -7
  63. package/dist/repository/gitWorkspace.js +72 -15
  64. package/dist/repository/taskWorkspaceCoordinator.js +134 -0
  65. package/dist/repository/taskWorkspacePreparer.js +120 -49
  66. package/dist/repository/workItemCandidateSnapshot.js +34 -0
  67. package/dist/resources/projectResource.js +0 -48
  68. package/dist/resources/projectResourceService.js +3 -81
  69. package/dist/resources/resourceDiscovery.js +3 -2
  70. package/dist/runtime/agentHost.js +152 -72
  71. package/dist/runtime/agentHostCompatibility.js +127 -0
  72. package/dist/runtime/agentHostProtocol.js +53 -0
  73. package/dist/runtime/executionEnvironment.js +0 -19
  74. package/dist/runtime/launchBroker.js +6 -0
  75. package/dist/runtime/sessionReconciliation.js +4 -4
  76. package/dist/runtime/taskRuntimeIsolation.js +30 -6
  77. package/dist/runtime/tmuxAdapters.js +5 -3
  78. package/dist/scheduler/operatorEvent.js +4 -0
  79. package/dist/scheduler/taskExecutionProjection.js +12 -1
  80. package/dist/scheduler/wakeReason.js +7 -1
  81. package/dist/scheduler/wakeupQueue.js +2 -0
  82. package/dist/setup/setupCommand.js +29 -16
  83. package/dist/storage/homeLayout.js +130 -0
  84. package/dist/storage/migrations/artifactsToGit.js +338 -0
  85. package/dist/storage/migrations/collapseWorktreeLayout.js +963 -0
  86. package/dist/storage/migrations/integrationContinuation.js +104 -0
  87. package/dist/storage/migrations/submitIntent.js +126 -0
  88. package/dist/storage/migrations/unifyHomeLayout.js +925 -0
  89. package/dist/storage/sqliteSchema.js +173 -7
  90. package/dist/storage/sqliteStore.js +41 -22
  91. package/dist/storage/storageVersions.js +1 -1
  92. package/dist/storage/storeRpc.js +2 -1
  93. package/dist/storage/upgrade/upgradeOrchestrator.js +95 -2
  94. package/dist/task/archiveDiagnostics.js +128 -0
  95. package/dist/task/nextAction.js +44 -11
  96. package/dist/task/taskActivation.js +26 -0
  97. package/dist/task/taskActivationService.js +85 -69
  98. package/dist/task/taskSubmission.js +236 -0
  99. package/dist/web/assets/client/app.js +58 -2
  100. package/dist/web/assets/client/components.js +1 -0
  101. package/dist/web/assets/client/i18n.js +6 -0
  102. package/dist/web/assets/client/taskSurface.js +202 -7
  103. package/dist/web/assets/client/view.js +7 -4
  104. package/dist/web/assets/shell.js +23 -0
  105. package/dist/web/assets/styles/layout.js +1 -1
  106. package/dist/web/assets/styles/widgets.js +12 -0
  107. package/dist/web/webServer.js +135 -4
  108. package/dist/web/webSnapshot.js +4 -3
  109. package/dist/web/webTaskSurface.js +225 -8
  110. package/dist/workItem/workItem.js +14 -10
  111. package/dist/workspace/workItemChangeSetManager.js +18 -2
  112. package/docs/agent-result-consumption.md +2 -0
  113. package/docs/agent-result-consumption.zh-CN.md +81 -0
  114. package/docs/agent-runtime-drivers.md +2 -0
  115. package/docs/agent-runtime-drivers.zh-CN.md +77 -0
  116. package/docs/architecture/README.md +44 -32
  117. package/docs/architecture/README.zh-CN.md +43 -0
  118. package/docs/architecture/capabilities-and-resources.md +118 -79
  119. package/docs/architecture/capabilities-and-resources.zh-CN.md +83 -0
  120. package/docs/managed-turn-and-session-runtime.md +2 -0
  121. package/docs/managed-turn-and-session-runtime.zh-CN.md +180 -0
  122. package/docs/observability/README.md +2 -0
  123. package/docs/observability/README.zh-CN.md +71 -0
  124. package/docs/plugin-sdk.md +320 -217
  125. package/docs/plugin-sdk.zh-CN.md +293 -0
  126. package/docs/provider-runtime.md +2 -0
  127. package/docs/provider-runtime.zh-CN.md +132 -0
  128. package/docs/release-workflow.md +41 -0
  129. package/docs/release-workflow.zh-CN.md +266 -0
  130. package/docs/roles-and-configuration.md +2 -0
  131. package/docs/roles-and-configuration.zh-CN.md +96 -0
  132. package/docs/sqlite-control-plane-design.md +225 -1
  133. package/docs/sqlite-control-plane-design.zh-CN.md +62 -0
  134. package/docs/task-dag-semantics.md +80 -57
  135. package/docs/task-dag-semantics.zh-CN.md +59 -0
  136. package/docs/task-delivery.md +2 -0
  137. package/docs/task-delivery.zh-CN.md +82 -0
  138. package/docs/task-local-identity.md +2 -0
  139. package/docs/task-local-identity.zh-CN.md +58 -0
  140. package/docs/testing/verification-levels.md +26 -0
  141. package/docs/testing/verification-levels.zh-CN.md +80 -0
  142. package/i18n/README.zh-CN.md +199 -10
  143. package/package.json +2 -1
  144. package/skills/yui-leader/SKILL.md +88 -331
  145. package/skills/yui-leader/references/execution.md +405 -0
  146. package/skills/yui-leader/references/integration.md +52 -2
  147. package/skills/yui-leader/references/planning.md +109 -0
  148. package/skills/yui-leader/references/task-plugins.md +8 -4
  149. package/skills/yui-operator/SKILL.md +22 -4
  150. package/skills/yui-runtime/SKILL.md +27 -0
  151. package/skills/yui-runtime/references/publication.md +20 -0
@@ -0,0 +1,405 @@
1
+ # Active execution
2
+
3
+ Read this after the [Leader stage entry](../SKILL.md) selects authorized
4
+ delivery. These implementation, dispatch, review and acceptance instructions
5
+ are not requirements for ending a planning discussion or answering a query.
6
+
7
+ ## Choose the simplest coherent result
8
+
9
+ Start from the current Task Contract and trace the existing implementation,
10
+ ownership and supported operating path before choosing a change. Establish
11
+ whether a failure is reachable with the user's actual inputs and configuration;
12
+ do not make a test fixture's accidental differences into new product policy.
13
+
14
+ Choose the lowest total implementation, verification, coordination and
15
+ maintenance cost that satisfies the contract. Reuse a coherent responsibility;
16
+ redesign a misplaced boundary when that lowers the complete cost. Add a
17
+ mechanism only for a demonstrated requirement or hard boundary that existing
18
+ primitives cannot satisfy. Derived views must not become competing truth.
19
+
20
+ Make routine legal choices yourself. Do not ask the user to choose among
21
+ implementation patterns, scheduling options, review routing, or recoverable
22
+ runtime actions. Create an InputRequest only for a real product choice, new
23
+ authority, irreversible external effect, or unavailable external fact.
24
+
25
+ ## Separate the work unit, executor, and concurrency
26
+
27
+ Honor the user's explicit choice of direct work or delegation. Otherwise make
28
+ three independent judgments; Review is a fourth judgment below.
29
+
30
+ **Does this result need its own management and acceptance boundary?** A WorkItem
31
+ is a substantial result worth managing and accepting separately inside the Task.
32
+ It need not have a different person, an independent release, or parallel execution.
33
+ Use zero WorkItems when the Task already holds one coherent outcome. One WorkItem
34
+ can be Leader-owned or hold a justified whole-result managed Assignment and
35
+ Candidate. Copying the Task unchanged or displaying progress is not a reason
36
+ to create it. Do not split analysis, editing, testing, Review, and ordinary
37
+ repairs into phase-shaped WorkItems.
38
+
39
+ **Who should execute?** Direct Leader execution is the default viable path for
40
+ one coupled result when current context, delivery authority, and tools suffice.
41
+ A native child can supply bounded specialist attention or parallel investigation
42
+ inside this Session when a best-effort result suffices; it creates no Yui identity,
43
+ authority, or WorkItem by itself.
44
+
45
+ Choose a managed Worker only for a concrete benefit that repays requirement
46
+ restatement, context reload, startup, waiting, inspection/rework, Integration,
47
+ and lifecycle management. Benefits include safely parallel independent results,
48
+ a needed capability or execution environment, a genuinely necessary separately
49
+ recoverable lifecycle, freeing the Leader for another actual responsibility,
50
+ or explicit user delegation. An available Worker, cheaper/different model,
51
+ many files, high risk, long duration, or generic maintainability alone is not
52
+ enough. Risk can justify independent Review without delegating implementation.
53
+ When delegation involves a material tradeoff, leave one sentence of concrete
54
+ benefit in the existing Brief; no form, approval, or separate decision record
55
+ is needed.
56
+
57
+ **Should separate units run concurrently?** Multiple WorkItems may run serially
58
+ because of a real dependency, or concurrently when their results can advance
59
+ independently and the net benefit exceeds coordination and Integration cost.
60
+ Neither a single WorkItem nor multiple executors proves parallelism. Keep
61
+ coupled changes together.
62
+
63
+ For example, fix one coupled behavior directly in Task main, even when it touches
64
+ many files. Delegate an independent import tool while the Leader implements its
65
+ consumer when the two have a stable boundary and useful parallel progress.
66
+ Keep two separately accepted stages serial when the second genuinely needs the
67
+ first result. Do not wrap a whole Task in an `implementer` WorkItem merely because
68
+ that Role exists.
69
+
70
+ Apply these choices to new work. Do not automatically cancel an existing Worker,
71
+ reassign/retire WorkItems, or move workspaces to conform to a new default; preserve
72
+ their current ownership and evidence until a justified explicit change.
73
+
74
+ An ordinary managed dispatch uses the WorkItem assignee; omit `--lane-role`.
75
+ Use [replicated execution](replicated-execution.md) only when
76
+ independent attempts over the same frozen Assignment repay their coordination
77
+ cost. Direct managed execution already provides durable ownership.
78
+
79
+ ## Give Agents outcomes, not premature implementations
80
+
81
+ Make delegated work decision-complete:
82
+
83
+ - objective and observable acceptance criteria;
84
+ - relevant Task and Project context;
85
+ - hard scope, authority, and workspace boundaries;
86
+ - known constraints, risks, dependencies, and existing decisions; and
87
+ - expected checks and evidence.
88
+
89
+ Let the receiving Agent choose its implementation plan, internal structure, and
90
+ tools unless a particular ordering or mechanism is itself part of the accepted
91
+ contract. Do not encode the Leader's speculative design as mandatory Worker
92
+ steps.
93
+
94
+ For Project-backed work, use the Project Skills, Policy, and Knowledge exposed
95
+ through current context. Keep repository-specific build, migration, release,
96
+ and test rules in that Project-owned layer.
97
+
98
+ ## Inspect execution facts
99
+
100
+ Use `yui task context <task-id>` and `yui task next-action <task-id>` as
101
+ decision support. They expose current facts, exact refs, and legal
102
+ alternatives; they do not replace Leader judgment.
103
+ An empty WorkItem list does not mean the user requested direct execution.
104
+ Honor explicit delegation and independent Review requirements in the user's
105
+ messages and Task Brief. Neither `next-action` nor a disabled default review
106
+ policy authorizes dropping them to make completion easier.
107
+
108
+ An Integration Job's success is not the final target update. For that
109
+ notification, read [Integration](integration.md) and continue from its exact
110
+ evidence; do not start a duplicate operation. Read that guidance also for an
111
+ ordinary Git conflict or an attempt that cannot be reliably resumed.
112
+
113
+ Before dispatch, Review, Integration, or completion, inspect
114
+ `liveTaskState.activeRuns` and `liveTaskState.activeTaskReviews` in the current
115
+ Context Pack. They report work in flight but gate nothing by themselves; reason
116
+ from each exact binding and frozen candidate instead of treating activity as a
117
+ global Task lock.
118
+
119
+ ## Execute the chosen path
120
+
121
+ ### Choose input timing without changing intent
122
+
123
+ Submission intent (`record`, `discuss`, `develop`) and delivery timing are
124
+ different facts. Input controls do not activate a Task, expand an Assignment,
125
+ or elevate a planning Session. Keep the submission contract when using `send`;
126
+ choose queue, steer or interrupt from the user's intent and current facts:
127
+
128
+ ```sh
129
+ yui task message queue <task> "<continuation>" --request-id <id> --to <role> --work-item <work-id>
130
+ yui task message steer <task> "<current-turn correction>" --request-id <id> --to leader --expected-target <turn>
131
+ yui task role interrupt <task> <role> --expected-target <turn> [--then-message <task/message>] [--request-id <id>]
132
+ ```
133
+
134
+ Queue waits for the next legal opportunity. Steer addresses only the exact
135
+ current native Turn; Worker/Reviewer steer also needs its existing WorkItem or
136
+ ReviewRound. Bare interrupt stores a control request, not a new Message.
137
+ `interrupt-requested` is not a terminal or proof that background resources
138
+ stopped. Then names an already-saved input and reserves its next opportunity
139
+ only within the original Session/writer boundary.
140
+
141
+ Read `task role session inspect` first. Unsupported and proven-unsubmitted
142
+ steer may be composed with interrupt when the user's intent permits stopping;
143
+ accepted, pending or unknown steer must not be resent through another action
144
+ or request id. Never silently cancel, replace a Session or downgrade to queue.
145
+
146
+ Global inputs use `role message queue|steer <role>` and `role interrupt <role>`
147
+ with their own owner, not a fabricated Task/Run. See
148
+ [Runtime](../../yui-runtime/SKILL.md) for scope and controlled-console boundaries.
149
+
150
+ Managed dispatch freezes the Assignment for its assignee. For ordinary
151
+ clarification, feedback or a continuation of that same work, send a Message:
152
+
153
+ ```sh
154
+ yui task message send <task> "<clarification or continuation>" --to <role> --work-item <work-id>
155
+ yui task message send <task> "<review clarification>" --to <role> --review-round <round-id>
156
+ ```
157
+
158
+ Busy execution queues the Message. Its terminal triggers continuation in the
159
+ same compatible Session and workspace; do not fabricate a failure, submit an
160
+ unfinished Candidate, or change WorkItem status merely to answer a question.
161
+ Read Message delivery and the exact resulting AgentRun separately from business
162
+ acceptance. A Message never expands scope, applies desired configuration, or
163
+ changes a Review's frozen candidate. An ownership change preserves the original
164
+ recipient; transfer still-pending input only with explicit `task message handoff`.
165
+ Late input to terminal work or an obsolete Review remains visible with a bounded
166
+ nondelivery reason. Use the existing formal operation for new scope or Review.
167
+
168
+ For unknown delivery or Session replacement, read
169
+ [runtime recovery](../../yui-runtime/references/recovery.md). Preserve the original
170
+ input; do not replay uncertainty or treat it as a global Task lock.
171
+
172
+ ### Direct delivery with zero WorkItems
173
+
174
+ The current delivery Leader needs no self-dispatched AgentRun or placeholder
175
+ WorkItem. Read the full Task requirements and relevant Messages, then implement,
176
+ verify, and fix the coherent result in Task main on its managed branch. Commit
177
+ and leave it clean. Run focused checks while changing behavior and the required
178
+ Project delivery checks on the final result.
179
+
180
+ Keep the Brief as a current summary, not a replacement for Task requirements.
181
+ Preserve changed intent and reasons in Messages/Decisions, substantial documents
182
+ in Task artifacts, and code and verification evidence in the actual delivery.
183
+ Zero WorkItems reduces coordination records, not requirements or evidence.
184
+
185
+ Inspect the complete final diff and decide Review separately. If a Task-final
186
+ Review is required or adds useful evidence, request it against the clean Task
187
+ heads using `yui task review request <task> --role <reviewer>`. No WorkItem is
188
+ needed. Consume the original result, fix reachable findings directly in Task
189
+ main, and decide whether the changed result needs another Review. Honor immutable
190
+ Review contracts and explicit user/Project requirements even if a default is
191
+ disabled. Once the outcome and obligations are satisfied, use `task complete`
192
+ with the outcome, checks, and remaining risk; a final chat message is not completion.
193
+
194
+ ### Leader-owned WorkItem
195
+
196
+ Use this only when the result merits separate management/acceptance. Omit
197
+ `--role` for direct execution: the Leader owns coordination and performs the
198
+ work without a managed executor Assignment. `--role leader` instead selects the
199
+ Leader Role as a **managed AgentRun executor**; it is not how to label direct
200
+ ownership. Do not self-dispatch merely to gain execution authority.
201
+
202
+ For a writable Project result, create and inspect its WorkItem-owned workspace
203
+ before editing. The Leader can work there directly; isolation does not require a
204
+ Worker. Task main, WorkItem Develop, and Review workspaces remain distinct owners.
205
+
206
+ ```sh
207
+ yui task work create <task> "<separately accepted result>" \
208
+ --project <project> --objective "<outcome>" --accept "<criterion>"
209
+ yui task work isolate <work-id>
210
+ yui task work update <work-id> running
211
+ # Implement and verify in the returned WorkItem workspace; commit and leave it clean.
212
+ yui task work update <work-id> done --summary "<result and evidence>"
213
+ ```
214
+
215
+ `done` freezes a direct Candidate, not an AgentRun result or acceptance.
216
+ Inspect it, then integrate the exact isolated result before acceptance:
217
+
218
+ ```sh
219
+ yui task integration start <task> --work-item <work-id> \
220
+ --project <project> --strategy <ff|cherry-pick|merge|manual>
221
+ # Inspect the attempt and finish it through Integration's normal checks/continuation.
222
+ yui task work accept <work-id> --summary "<decision and evidence>"
223
+ ```
224
+
225
+ Read [Integration](integration.md) for checks, continuation, and recovery.
226
+ Keep the same unit through ordinary fixes.
227
+ A read-only or Gitless result with no writable Projects needs no Git isolation;
228
+ submit its actual evidence and accept it explicitly. Existing exact Task-final
229
+ metadata-only Candidates retain their contract; do not establish a special Review
230
+ contract merely to avoid the ordinary writable WorkItem isolation boundary.
231
+
232
+ For a native child, pass a bounded brief and applicable Profile constraints
233
+ through the provider's child tools. A small investigation needs no synthetic
234
+ WorkItem. If the child implements an existing Leader-owned WorkItem, keep that
235
+ WorkItem roleless, supply its exact workspace and scope, and mark it running.
236
+ Native children inherit only current parent authority and gain no Yui Role,
237
+ AgentRun, Session or broader workspace. Their
238
+ results are best-effort until Yui externalizes them; use a managed Task Role
239
+ when independent durability matters. Inspect the returned result before
240
+ submitting `done` or recording failure progress. `done` creates a Candidate;
241
+ `work accept` records the separate acceptance. WorkItem responsibility remains
242
+ open through execution failure and becomes accepted only on that decision.
243
+ A Profile's runtime source applies when
244
+ materializing a Task Role, not when launching a native child. The child
245
+ inherits the Leader Agent; apply a Profile model or effort only when the native
246
+ tool actually supports and confirms that override.
247
+
248
+ ### Managed Task Role
249
+
250
+ ```sh
251
+ yui task role add <task-id> <role> --profile <profile>
252
+ yui task role show <task-id> <role>
253
+ yui task work create <task-id> "<outcome>" --role <role> \
254
+ --project <project> --objective "<bounded outcome>" --accept "<criterion>"
255
+ yui task work dispatch <work-id> --input "<decision-complete brief>"
256
+ ```
257
+
258
+ Add `--after` only for a real dependency. Likely file overlap is not by itself
259
+ a dependency. A Worker may read the complete authorized Task context but may
260
+ write only its WorkItem Projects and workspace. Dispatch prepares that isolated
261
+ workspace and freezes the Assignment; inspect the completed original AgentRun
262
+ result before submitting its exact Candidate, integrating, and accepting.
263
+
264
+ Profiles carry portable behavior plus either a dynamic Global Worker runtime
265
+ source or an explicit Agent with optional model and effort. Applying a Profile
266
+ to a Task Role resolves and freezes the complete binding; later Profile or
267
+ Global Worker changes do not rewrite that Role. Before dispatch, use
268
+ `config profile show` and `task role show` to read the exact behavior, Agent, model,
269
+ effort, Profile, and workspace. Do not reconstruct or guess launch
270
+ configuration. Use the WorkItem assignee directly unless replicated execution
271
+ was deliberately selected.
272
+
273
+ Managed Task main, WorkItem, ReviewRound, and Integration workspaces have
274
+ different owners. Never edit stable Project checkouts, managed refs, Yui state
275
+ files, or another owner's workspace. A Task's recorded base is durable; do not
276
+ silently replace it merely because its remote branch later moves.
277
+
278
+ ## Extend capabilities within this Task's authority
279
+
280
+ Use `capability search`, `describe`, and `call` to inspect current tools.
281
+ Prefer existing tools, composition or a one-off script when sufficient.
282
+ For reusable Task-local capabilities, read [Task plugins](task-plugins.md)
283
+ before creation, validation or activation. Plugin management permission does
284
+ not grant code execution or broader external effects. Never issue your own
285
+ grants, impersonate Operator, or modify the core installation to obtain a tool.
286
+
287
+ ## Validate and make the review judgment
288
+
289
+ Use the smallest evidence that establishes the accepted behavior and material
290
+ boundaries. Do not repeat a successful unchanged check. Run the Project's
291
+ complete local delivery validation once on the final candidate when its Policy
292
+ requires it.
293
+
294
+ As part of accepting a WorkItem or completing a Task, decide whether additional
295
+ review would add useful evidence:
296
+
297
+ - inspect directly when the change is clear and existing evidence is enough;
298
+ - use one independent Worker, native child, or Reviewer when independent
299
+ inspection materially reduces a reachable risk; or
300
+ - rely on an already completed applicable Review.
301
+
302
+ This is Leader judgment inside the acceptance decision, not a separate record,
303
+ checklist, or workflow phase. A managed Reviewer is optional unless the user,
304
+ Project or Task Contract requires it. Do not create a
305
+ Reviewer Role or ReviewRound for ceremony. Honor an existing Candidate's
306
+ snapshotted `always` policy and any immutable Task-final Review contract.
307
+ Otherwise choose whether another review adds enough evidence to justify its
308
+ cost.
309
+
310
+ Use one direct main Reviewer by default. If independent replicas materially
311
+ improve evidence, read [replicated execution](replicated-execution.md)
312
+ before dispatch or synthesis. Honor required review contracts even when a
313
+ cheaper execution path is otherwise available.
314
+
315
+ When several WorkItems contribute to one outcome, prefer one independent
316
+ Task-final Review after their accepted results are integrated over repeating a
317
+ complete Review for every WorkItem. Request an earlier WorkItem Review only
318
+ when that frozen Candidate has a specific risk that should be resolved before
319
+ Integration.
320
+
321
+ When a Worker or Reviewer result arrives, resolve its exact AgentRun and read the
322
+ complete original `AgentRunResult.output` before starting new work or waiting
323
+ again. Treat headings or JSON fields only as communication aids; never infer
324
+ that Core parsed or accepted them. Decide whether to accept, repair, review
325
+ again, retry execution, or ask for a genuinely user-owned decision. Route
326
+ reachable issues to the original execution owner. Fix a small Task-main issue
327
+ directly; create a Repair WorkItem only when the repair is itself a substantial
328
+ independently owned requirement.
329
+
330
+ A failed ReviewRound is an execution failure, not an automatic retry or repair
331
+ wave. Inspect its exact Round, AgentRun, candidate, Core failure, and
332
+ `task next-action` facts, then choose the smallest recovery that preserves the
333
+ frozen boundary. Do not invent a retry loop or silently replace the Reviewer
334
+ Session. For replicated execution, choose whether to retry a failed Producer,
335
+ settle that Lane, or synthesize selected available results. Retry a failed
336
+ main synthesis through its exact AgentRun, preserving its selected source snapshot.
337
+
338
+ ## Accept, integrate, and complete
339
+
340
+ A Worker or Reviewer AgentRun result is evidence, not acceptance. Inspect the
341
+ result, diff, checks, and current Candidate before deciding.
342
+
343
+ If a result is insufficient, reject it with bounded feedback and redispatch
344
+ the same WorkItem and Role while scope remains valid. Before accepting isolated
345
+ Git changes, read [Integration](integration.md) to capture and
346
+ integrate the latest Candidate. Do not edit managed refs or bypass Yui's
347
+ compare-and-swap boundary.
348
+
349
+ After an authorized PR/MR operation, follow
350
+ [publication recording](../../yui-runtime/references/publication.md).
351
+ External delivery and Task completion remain separate facts.
352
+
353
+ After a ReviewRound is terminal, the Leader or authorized Operator owns
354
+ `task work review cleanup <task>/<round>`. Preserve dirty diagnostic evidence
355
+ and resolve it explicitly; do not ask a Reviewer to clean its own runtime
356
+ after its final report. Cleanup can remain advisory at completion. Ordinary
357
+ archive requires settled resources; explicitly authorized force archive preserves
358
+ unresolved resources and diagnostics under the shared
359
+ [archive contract](../../yui-runtime/references/publication.md). The Leader
360
+ does not gain independent archive authorization.
361
+
362
+ Complete only when the Task outcome is satisfied, required checks and review
363
+ contracts are settled, WorkItems are accepted or deliberately retired, latest
364
+ isolated results are integrated, and user inputs are resolved:
365
+
366
+ ```sh
367
+ yui task complete <task-id> \
368
+ --summary "<outcome, validation, and remaining risk>"
369
+ ```
370
+
371
+ Completion records the exact Project heads. Archive is a separate,
372
+ user-authorized Operator action.
373
+
374
+ If completion reports `pending-user-input`, new user intent has not yet reached
375
+ the current notification window. End this native turn so the next notification
376
+ can be delivered, then read the original messages and reassess the outcome.
377
+ Do not spin on completion, drop messages, or manufacture another Run to proceed.
378
+ A current Leader Session can create a formal InputRequest during an ordinary
379
+ notification; no active AgentRun is required.
380
+
381
+ ## Finish an active execution turn
382
+
383
+ Before ending authorized execution:
384
+
385
+ 1. Inspect the wake delta, resolve every referenced Worker or Reviewer AgentRun
386
+ with `yui task run show`, read each original result in full, and make the
387
+ next decision.
388
+ 2. Persist actual WorkItem lifecycle and material Brief, Decision, Milestone,
389
+ Message, or Knowledge changes.
390
+ 3. Choose one truthful outcome: continue through an owned native child, complete
391
+ the Task, create a justified InputRequest, or leave the active Task waiting
392
+ for a real durable event.
393
+ 4. For an explicitly dispatched AgentRun, return its truthful original final
394
+ report with outcome, checks, remaining risk and bounded next action.
395
+ Direct conversation and notifications do not require a separate execution
396
+ report; use the [stage-specific close](../SKILL.md#close-the-current-turn).
397
+
398
+ Do not claim completion only in prose when durable Task or WorkItem state still
399
+ needs updating. Do not poll managed Roles or emit waiting Messages. Managed
400
+ results enter a later Leader notification; that notification is not an implicit
401
+ AgentRun and requires no separate execution report. An unchanged active Task remains quiet.
402
+
403
+ Use the shared [runtime recovery](../../yui-runtime/references/recovery.md) contract
404
+ for failed execution. Persist successor context before replacing yourself,
405
+ then end this turn; engineering cleanup is not discarded Task intent.
@@ -11,7 +11,7 @@ before acceptance:
11
11
  ```sh
12
12
  yui task work capture <work-id>
13
13
  yui task integration start <task> --project <project> \
14
- --change-set <change-set-id> \
14
+ --work-item <work-id> --strategy <ff|cherry-pick|merge|manual> \
15
15
  --check "<Project Policy command>"
16
16
  yui task work accept <work-id> --summary "<decision and evidence>"
17
17
  ```
@@ -20,7 +20,23 @@ These are distinct decisions; confirm Integration succeeded before acceptance.
20
20
  Preserve each managed workspace's owner and the Task's recorded base. Do not
21
21
  silently advance that base because a remote branch moved.
22
22
 
23
- ## Finish the same attempt
23
+ ## Resolve ordinary Git conflicts yourself
24
+
25
+ `conflicted` is an engineering step owned by the Leader, not a request for
26
+ user authorization. Read both sides' intent and the current Task contract,
27
+ inspect the exact Integration source, target and workspace, resolve and stage
28
+ the files there, then run `integration continue`. No preceding
29
+ `resolve --option manual-resolution` is required for an ordinary conflict.
30
+ Core completes the matching Git operation, records the candidate, runs or
31
+ recovers its exact checks and advances the original target by CAS.
32
+
33
+ Do not close the Task execution gate, stop unrelated work, create an
34
+ InputRequest or end in passive waiting merely because Git conflicted.
35
+ Escalate only a real product choice, changed scope, unavailable external fact
36
+ or new authority. The explicit `manual` strategy still requires a recorded
37
+ resolution rationale; it is not the ordinary conflict path.
38
+
39
+ ## Continue from exact evidence
24
40
 
25
41
  For direct Integration checks running as a DurableJob, Job success is not
26
42
  the final target update. Read the terminal result, then use:
@@ -32,8 +48,42 @@ yui task integration continue <task>/<integration>
32
48
  This also applies when no manual conflict resolution was needed. Do not start
33
49
  a duplicate Integration or wait for an empty queue to finalize it.
34
50
 
51
+ Resume interrupted Git/Job work on this attempt when its source/candidate and
52
+ Job identities can be proved. A clean HEAD, leftover REBASE_HEAD or successful
53
+ Job alone does not prove source application or target advancement. Read
54
+ diagnostics when evidence is missing or the source, workspace, candidate,
55
+ target or check conditions changed. Never blindly replay a finished rebase
56
+ or repeat a successful unchanged check.
57
+
35
58
  Resolve failures using the exact conflict or check evidence and the supplied
36
59
  Integration workspace. Never bypass compare-and-swap, update managed refs by
37
60
  hand, or create a replacement WorkItem for ordinary Integration correction.
38
61
  Recheck changed behavior or unresolved failures; do not rerun unchanged
39
62
  successful validation without a current reason.
63
+
64
+ ## Abandon an unprovable attempt without discarding delivery
65
+
66
+ If this attempt cannot safely continue, preserve its candidate, modifications,
67
+ logs and successful evidence, then formally `integration abort --reason ...`
68
+ (or reject a pending resolution). A failed attempt does not require keeping
69
+ the same ID forever or repairing a shared installation before any delivery.
70
+ Choose a new Integration or another already-authorized delivery path.
71
+
72
+ For `validating`, `abort` checks the exact target and Jobs under the same Git
73
+ fence as `continue`. An unadvanced target can be abandoned despite changed
74
+ check conditions. If CAS already advanced the target, the action records
75
+ `committed` instead of pretending delivery was aborted. Read the returned
76
+ outcome. A concurrent operation, unknown Job, or ambiguous target requires
77
+ inspection, not a forced status change or rollback of current Project policy.
78
+
79
+ Formal abort preserves history and workspaces. It is not Git abort, branch
80
+ deletion, target advancement, or proof that a Job/process has stopped.
81
+ Inspect all Jobs owned by the exact attempt, including an unbound Job;
82
+ cancel and establish quiescence by exact identity before reusing or cleaning
83
+ resources. Successful Job evidence and Task acceptance remain separate.
84
+
85
+ Direct Task-main delivery is an alternative only when current delivery
86
+ authority, ownership and the Task contract already permit it, with no other
87
+ writer or active check using that workspace. Do not edit managed refs or the
88
+ control-plane DB, modify another owner's workspace, upgrade shared tools,
89
+ or expand publication authority to work around an Integration failure.
@@ -0,0 +1,109 @@
1
+ # Planning and activation handoff
2
+
3
+ Use this for Draft discussion, planning-only Sessions and the boundary into
4
+ delivery. The [Leader entry](../SKILL.md) owns shared context maintenance and
5
+ turn reporting; [Runtime](../../yui-runtime/SKILL.md) owns authority.
6
+
7
+ ## Discuss and preserve the outcome
8
+
9
+ If the user asked only to create/store a Task, preserve the requirements and
10
+ stop: do not start a planning Session. Once discussion is authorized, clarify
11
+ requirements, inspect authorized current facts, compare options and revise the
12
+ technical approach as the conversation develops. Distinguish unresolved
13
+ questions, recommendations and accepted decisions.
14
+
15
+ Planning can include research explicitly authorized by the user and permitted
16
+ by the Session, Project and resource boundaries. Discussion is not delivery
17
+ authorization: do not modify Project code or run implementation tests merely
18
+ to support a proposal. Keep full planning results in supported Task result
19
+ storage and maintain the Brief's current summary and references. Planning
20
+ storage and Project delivery workspaces have different purposes and authority.
21
+
22
+ Saving a useful revision, reporting what changed and waiting for feedback is
23
+ the normal end of a discussion. Do not create implementation WorkItems,
24
+ dispatch, Review, acceptance or Task completion to make a planning turn look
25
+ finished. An InputRequest is not required for ordinary continued discussion.
26
+
27
+ ## Hand off only through authorized activation
28
+
29
+ User/Operator submissions use `--intent record|discuss|develop` on
30
+ `operator submit` or an unaddressed `task message send`. The default is
31
+ `discuss`; Core does not infer intent from message text.
32
+
33
+ - `record` saves the message without waking the Leader.
34
+ - `discuss` on an unplanned Draft records the planning route and wakes planning.
35
+ - `develop` on an unplanned Draft saves the requirement and activation intent,
36
+ then enters delivery through formal activation, without first starting planning.
37
+ - `develop` after planning has been entered saves the input but does not wake
38
+ or activate; the routing result is `planned-needs-manual-activation`.
39
+
40
+ Read the returned routing/feedback and current context before taking the next
41
+ action. Active submissions do not downgrade or reactivate the Task; terminal
42
+ submissions do not reopen it. A stopped execution gate is not permission to
43
+ resume. `--request-id <key>` on submissions preserves the original result on a
44
+ matching retry, not permission to replay uncertain work or change its content.
45
+
46
+ Once planning has been entered, starting delivery requires a distinct,
47
+ explicit activation authorization. A development remark during discussion,
48
+ the end or failure of a planning Run, or Session replacement is not that
49
+ action and does not restore “blank Draft” status. Accepted planning routing
50
+ and historical Runs/Sessions count even when no Session is currently busy.
51
+ “Manual activation” means an explicit user action, not that the user must type
52
+ CLI commands: an authorized Operator can perform the mechanical operation.
53
+
54
+ With that authorization, use the formal supported activation operation
55
+ (`task activate <task-id>`) within the caller's authority, or have the Operator
56
+ perform it. Inspect the observable result. Preserve a busy or unknown
57
+ operation's exact request and follow
58
+ [Runtime recovery](../../yui-runtime/references/recovery.md); do not
59
+ self-dispatch, interrupt, kill or replace a Session to bypass the handoff.
60
+ New discussion during a pending handoff does not authorize a competing
61
+ planning Session. A failure calls for an explicit diagnosis and authorized
62
+ recovery, not automatic downgrade or replay.
63
+
64
+ Continue the durable requirements once the Task is formally active and a
65
+ delivery-authorized Session/workspace is ready. Do not demand another
66
+ “continue.” An old planning Session remains planning-scoped: preserve its
67
+ successor context and end its turn rather than promoting itself.
68
+
69
+ ## Task artifact operations
70
+
71
+ These operations apply to planning and delivery results. The current Leader
72
+ adopts contributions from other Agents' authorized workspaces; do not share
73
+ an uncoordinated Git index or edit Yui storage directly.
74
+
75
+ ```sh
76
+ yui task artifact list <task-id>
77
+ yui task artifact save <task-id> plans/design.md "<UTF-8 content>" --message "Revise design"
78
+ yui task artifact read <task-id> plans/design.md
79
+ yui task artifact read <task-id> plans/design.md <full-commit>
80
+ ```
81
+
82
+ `save` writes and locally commits exactly one relative path, creating the
83
+ repository on first save. The `artifact.save` capability takes `taskId`,
84
+ `relativePath`, `content`, optional `message` and optional `expectedHead`;
85
+ the CLI equivalent is `--expected-head <commit>`. A head conflict leaves
86
+ the save unapplied: re-read and reconcile the intended update, not overwrite
87
+ blindly. The text interface accepts UTF-8 files up to 8 MiB, not arbitrary
88
+ binary payloads or an invented directory-upload command.
89
+
90
+ Current reads use Task and relative path at HEAD. Frozen Candidate, Review,
91
+ Context and completion evidence use the returned `taskId + commit +
92
+ relativePath`; do not replace a pinned read with a current read. For same-Task
93
+ string reference lists, use `git:<full-commit>:<relativePath>`, including
94
+ `task complete ... --artifact-ref "git:<full-commit>:plans/design.md"`.
95
+ The commit must be the artifact repository's returned commit, not the Project
96
+ code head. Preserve fixed old references when updating the current document.
97
+
98
+ After a meaningful save, update the Brief's summary/reference; keep Decisions
99
+ to the choice, reason and boundary. No document-body, HEAD or timestamp mirror
100
+ is needed. The artifact repository has no remote or transport; this does not
101
+ prohibit a Project code repository's legitimate remote. Saving in Draft grants
102
+ no delivery authority; Session handoff and archive preserve the artifacts.
103
+ Stored scripts/HTML remain data and are never implicitly executed or previewed.
104
+
105
+ These commands describe this source version's interface. A managed Session
106
+ still uses its authorized CLI and actual available capabilities. If an older
107
+ installation lacks them, report that version boundary; do not switch it to
108
+ an unapproved checkout CLI, migrate a shared Home, or upgrade the installation
109
+ merely to save a result.
@@ -27,7 +27,11 @@ external effect does not authorize rerunning the action chain. After activation,
27
27
  query the directory again and use the new capability through the same bridge
28
28
  and native Session; no native tool-schema change or Controller restart is needed.
29
29
 
30
- Save the actual business result through `artifact.save` and retain the reference
31
- in Task results. Plugin source or successful loading alone is not delivery.
32
- Historical Artifacts remain readable after disable or restart; saved enable
33
- intent does not automatically execute code on restart.
30
+ Save the actual business result as a file artifact with `artifact.save`
31
+ (`relativePath` plus `content`): it commits exactly that path into the Task's
32
+ local Git repository and returns a self-certifying `commit + relativePath`
33
+ reference to retain in Task results. Plugin source or successful loading alone
34
+ is not delivery. Committed artifacts remain readable after disable or restart
35
+ through `artifact.read` at HEAD or a pinned commit; saved enable intent does not
36
+ automatically execute code on restart, and an artifact's script or HTML is data,
37
+ not a program to run under Yui authority.
@@ -53,16 +53,29 @@ determine Task identity. They also do not determine WorkItem count. Let
53
53
  isolated workspaces and Integration handle independent Git changes.
54
54
 
55
55
  Keep the Task title concise and put detailed intent, constraints, and evidence
56
- in its description or routed Message:
56
+ in its description or routed Message. The examples below are separate
57
+ operations, not an automatic create/submit/activate sequence. For creation-only
58
+ intent, save the Task without starting planning. Discussion does not authorize
59
+ delivery; follow the Leader's [planning and activation boundary](../yui-leader/references/planning.md)
60
+ before activation. Do not reopen terminal Tasks merely because new input arrives.
57
61
 
58
62
  ```sh
59
- yui operator submit "<related request and delta>" --task <task-id>
63
+ yui operator submit "<related request and delta>" --task <task-id> --intent discuss
60
64
  yui task create "<independent outcome>" \
61
65
  --project <project> --base <project>=<ref>
62
- yui operator submit "<request and routing context>" --task <new-task-id>
66
+ yui operator submit "<request and routing context>" --task <new-task-id> --intent develop
63
67
  yui task activate <new-task-id>
64
68
  ```
65
69
 
70
+ Choose the submission intent explicitly; it is never inferred from the message
71
+ text. `discuss` (the default, and what an old client sends) routes the Draft to
72
+ planning; `record` saves the message without waking the Leader; `develop` asks an
73
+ unplanned Draft to activate now, and reports the exact next step when it cannot
74
+ (already planned → activate manually; execution stopped → start it first). Pass
75
+ `--request-id <key>` to make a submission idempotent: retrying the same key
76
+ returns the original message and routing instead of creating a duplicate, and the
77
+ same key with different text is refused as a conflict.
78
+
66
79
  Resolve all known Projects before repository-backed execution. A stable Project
67
80
  checkout is read-only reference state, not the Task base authority. Yui records
68
81
  the Task's remote baseline when creating its managed workspace; do not route
@@ -179,7 +192,12 @@ yui task input cancel <task> <input> --reason "<Leader-owned decision>"
179
192
  After an authorized PR/MR operation or before archive, read
180
193
  [publication and archive boundaries](../yui-runtime/references/publication.md).
181
194
  Record confirmed delivery facts promptly. Completion does not authorize
182
- archive, and archive approval does not authorize forced cleanup.
195
+ archive, and ordinary archive approval does not authorize `--force`.
196
+ When the user explicitly authorizes force archive for an eligible terminal
197
+ Task, archive even if delivery proof or cleanup is incomplete. Report the
198
+ warnings and retained resources without claiming merge verification or physical
199
+ quiescence. Force archive is not permission to delete dirty/uncertain resources,
200
+ kill unrelated execution, abandon delivery or rewrite historical evidence.
183
201
 
184
202
  ## Recover from evidence, not from imagined states
185
203