@zq-silk/yui 0.15.7 → 0.15.9

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 (308) hide show
  1. package/ARCHITECTURE.md +194 -399
  2. package/ARCHITECTURE.zh-CN.md +151 -0
  3. package/README.md +306 -1131
  4. package/dist/agent/adapterCatalog.js +15 -2
  5. package/dist/agent/agent.js +23 -3
  6. package/dist/agent/argumentPolicy.js +7 -1
  7. package/dist/agent/connectionPlan.js +62 -0
  8. package/dist/agent/executionComponents.js +158 -0
  9. package/dist/agent/launchEnvironment.js +31 -3
  10. package/dist/agent/managedRuntimeEnvironment.js +3 -5
  11. package/dist/{turn/turn.js → agentRun/agentRun.js} +166 -109
  12. package/dist/{turn/turnIdentity.js → agentRun/runIdentity.js} +4 -4
  13. package/dist/artifacts/artifactCapability.js +74 -0
  14. package/dist/artifacts/artifactCommitLock.js +249 -0
  15. package/dist/artifacts/artifactPaths.js +151 -0
  16. package/dist/artifacts/gitArtifactRef.js +146 -0
  17. package/dist/artifacts/managedGit.js +332 -0
  18. package/dist/artifacts/taskArtifactRepository.js +277 -0
  19. package/dist/brief/taskBrief.js +12 -0
  20. package/dist/cli/agentConfigurationPicker.js +13 -0
  21. package/dist/cli/commandCatalog.js +165 -74
  22. package/dist/cli/interactionCandidates.js +5 -5
  23. package/dist/cli/interactionPolicy.js +38 -8
  24. package/dist/cli/invocationRouter.js +1 -1
  25. package/dist/cli/managedDiagnostics.js +28 -0
  26. package/dist/cli/operatorWizard.js +1 -7
  27. package/dist/cli/roleOptionOrder.js +27 -0
  28. package/dist/cli/roleWizard.js +50 -14
  29. package/dist/cli/updateOrchestrator.js +1 -1
  30. package/dist/cli/updatePorts.js +3 -4
  31. package/dist/cli.js +245 -95
  32. package/dist/commands/agentCommands.js +72 -14
  33. package/dist/commands/capabilityCommands.js +9 -6
  34. package/dist/commands/configCommands.js +20 -20
  35. package/dist/commands/deliveryGuardPreflight.js +2 -2
  36. package/dist/commands/executionAuditCommands.js +24 -24
  37. package/dist/commands/globalRoleCommands.js +1 -1
  38. package/dist/commands/grantCommands.js +4 -4
  39. package/dist/commands/operatorCommands.js +34 -9
  40. package/dist/commands/projectCommands.js +4 -4
  41. package/dist/commands/resourcesCommands.js +2 -2
  42. package/dist/commands/roleConfiguration.js +25 -5
  43. package/dist/commands/roleRuntimeGuard.js +4 -5
  44. package/dist/commands/sessionCommands.js +3 -7
  45. package/dist/commands/taskActivationCommands.js +281 -0
  46. package/dist/commands/taskActor.js +28 -49
  47. package/dist/commands/taskCommands.js +1461 -720
  48. package/dist/commands/taskContextCommand.js +39 -583
  49. package/dist/commands/taskExecutionCommands.js +32 -32
  50. package/dist/commands/taskInputCommands.js +40 -104
  51. package/dist/commands/taskIntegrationCommands.js +3 -2
  52. package/dist/commands/taskIntegrationQueueCommands.js +1 -1
  53. package/dist/commands/taskNextActionCommand.js +8 -8
  54. package/dist/commands/taskOverviewCommand.js +33 -45
  55. package/dist/commands/taskRemoteDeliveryCommand.js +2 -2
  56. package/dist/commands/taskRoleRuntimeStatus.js +133 -102
  57. package/dist/commands/telemetryCommands.js +36 -38
  58. package/dist/config/configCatalog.js +4 -4
  59. package/dist/config/yuiConfig.js +8 -8
  60. package/dist/context/contextSnapshot.js +10 -10
  61. package/dist/context/dispatchContext.js +11 -11
  62. package/dist/context/roleSessionContext.js +6 -3
  63. package/dist/context/{turnContextPack.js → runContextPack.js} +158 -81
  64. package/dist/context/{turnInputContract.js → runInputContract.js} +73 -60
  65. package/dist/context/sessionBootstrapManifest.js +21 -2
  66. package/dist/context/sourceRunContext.js +30 -0
  67. package/dist/context/taskContext.js +481 -0
  68. package/dist/context/wakeNotification.js +27 -27
  69. package/dist/controller/agentRuntimeObserver.js +21 -24
  70. package/dist/controller/capabilityBridge.js +17 -6
  71. package/dist/controller/clientRuntime.js +65 -92
  72. package/dist/controller/controller.js +120 -188
  73. package/dist/controller/fileSchedulerStoreAdapter.js +787 -887
  74. package/dist/controller/jobControl.js +54 -85
  75. package/dist/controller/resourceInventory.js +8 -27
  76. package/dist/controller/resourceInventoryLinux.js +12 -13
  77. package/dist/controller/runtime.js +529 -479
  78. package/dist/controller/runtimeEventInbox.js +55 -25
  79. package/dist/controller/runtimeEventProcessor.js +22 -31
  80. package/dist/controller/{runtimeHookTurnFence.js → runtimeHookRunFence.js} +91 -115
  81. package/dist/controller/runtimeLaunchCoordinator.js +80 -426
  82. package/dist/controller/runtimeObservationHook.js +14 -18
  83. package/dist/controller/sessionNotify.js +16 -24
  84. package/dist/controller/sessionOwnerReconciliation.js +168 -50
  85. package/dist/controller/structuredProviderObservation.js +138 -99
  86. package/dist/coordination/workMailbox.js +3 -3
  87. package/dist/coordination/workMailboxQueue.js +36 -33
  88. package/dist/core/boundedRpc.js +8 -1
  89. package/dist/core/controllerClient.js +20 -1
  90. package/dist/core/controllerServer.js +4 -4
  91. package/dist/doctor/doctor.js +13 -2
  92. package/dist/domain/agentResultTransport.js +9 -9
  93. package/dist/execution/codexThreadNaming.js +2 -8
  94. package/dist/execution/executionHealth.js +51 -63
  95. package/dist/execution/reviewMainRun.js +137 -0
  96. package/dist/execution/workItemExecution.js +28 -29
  97. package/dist/execution/workItemExecutionProjection.js +99 -107
  98. package/dist/execution/workItemMainRun.js +141 -0
  99. package/dist/executor/agentAdapter.js +227 -20
  100. package/dist/executor/agentConfigurationCatalog.js +126 -4
  101. package/dist/executor/agentConfigurationProbe.js +162 -4
  102. package/dist/executor/agentExecutor.js +79 -78
  103. package/dist/executor/effectiveLaunch.js +105 -18
  104. package/dist/executor/executorRegistry.js +29 -44
  105. package/dist/executor/fileRoleLaunchPlanner.js +229 -154
  106. package/dist/executor/workspacePreflightClassification.js +16 -16
  107. package/dist/grant/capabilityGrant.js +6 -3
  108. package/dist/input/inputRequest.js +12 -10
  109. package/dist/integration/gitIntegrationService.js +4 -11
  110. package/dist/integration/integrationQueueService.js +4 -4
  111. package/dist/interaction/operatorPresentation.js +1 -1
  112. package/dist/kernel/builtinCapabilities.js +255 -12
  113. package/dist/kernel/capabilityRegistry.js +64 -18
  114. package/dist/kernel/instanceHost.js +12 -1
  115. package/dist/kernel/kernelPorts.js +2 -2
  116. package/dist/lifecycle/canonicalLifecycleEvent.js +44 -49
  117. package/dist/lifecycle/exactRunTerminalization.js +449 -0
  118. package/dist/message/message.js +118 -6
  119. package/dist/message/messageContinuation.js +204 -0
  120. package/dist/observability/executionAudit.js +70 -72
  121. package/dist/observability/faultClassification.js +2 -2
  122. package/dist/observability/orchestrationMetrics.js +8 -8
  123. package/dist/operator/operatorSessionHistory.js +1 -7
  124. package/dist/output/agentConfigurationPresentation.js +8 -3
  125. package/dist/output/agentRunConfigurationPresentation.js +128 -0
  126. package/dist/output/rolePresentation.js +54 -3
  127. package/dist/plugins/pluginChild.js +104 -0
  128. package/dist/plugins/pluginIntent.js +26 -0
  129. package/dist/plugins/pluginInterpreter.js +43 -0
  130. package/dist/plugins/pluginPackage.js +101 -0
  131. package/dist/plugins/pluginProcess.js +112 -0
  132. package/dist/plugins/pluginService.js +388 -0
  133. package/dist/profile/agentProfile.js +1 -1
  134. package/dist/repository/gitWorkspace.js +26 -4
  135. package/dist/repository/project.js +19 -4
  136. package/dist/repository/taskBaseFreshness.js +13 -13
  137. package/dist/repository/taskWorkspaceCoordinator.js +20 -27
  138. package/dist/repository/taskWorkspacePreparer.js +344 -83
  139. package/dist/resources/autoResourceGc.js +3 -3
  140. package/dist/resources/liveReferences.js +3 -3
  141. package/dist/resources/projectResource.js +75 -0
  142. package/dist/resources/projectResourceService.js +343 -0
  143. package/dist/resources/resourceDiscovery.js +6 -6
  144. package/dist/resources/resourceGc.js +1 -1
  145. package/dist/resources/resourceRegistrar.js +1 -1
  146. package/dist/resources/resourceTypes.js +1 -1
  147. package/dist/review/deltaRecheck.js +3 -3
  148. package/dist/review/reviewAcceptance.js +16 -16
  149. package/dist/review/reviewDecision.js +7 -7
  150. package/dist/review/reviewRound.js +21 -20
  151. package/dist/review/reviewerAvailability.js +2 -2
  152. package/dist/role/role.js +51 -7
  153. package/dist/role/taskRoleUpdate.js +30 -0
  154. package/dist/runtime/acpProtocol.js +425 -0
  155. package/dist/runtime/acpSession.js +731 -0
  156. package/dist/runtime/acpSessionConfiguration.js +260 -0
  157. package/dist/runtime/agentDriver.js +30 -11
  158. package/dist/runtime/agentEndpoint.js +278 -0
  159. package/dist/runtime/agentEndpointIdentity.js +86 -0
  160. package/dist/runtime/agentEndpointOwnership.js +239 -0
  161. package/dist/runtime/agentError.js +2 -10
  162. package/dist/runtime/agentHost.js +565 -314
  163. package/dist/runtime/agentRunConfiguration.js +258 -0
  164. package/dist/runtime/builtinAgentDrivers.js +134 -18
  165. package/dist/runtime/builtinAgentErrorMappers.js +55 -3
  166. package/dist/runtime/builtinTranscriptUsage.js +1 -1
  167. package/dist/runtime/claude-process-owner +0 -0
  168. package/dist/runtime/codexAppServerRuntime.js +38 -30
  169. package/dist/runtime/codexInteractiveHost.js +41 -6
  170. package/dist/runtime/continuationManager.js +2 -6
  171. package/dist/runtime/executionEnvironment.js +30 -0
  172. package/dist/runtime/firstProgressAdvisory.js +11 -11
  173. package/dist/runtime/index.js +4 -3
  174. package/dist/runtime/jsonLineChannel.js +109 -0
  175. package/dist/runtime/launchBroker.js +91 -16
  176. package/dist/runtime/launchDiagnostics.js +2 -2
  177. package/dist/runtime/lifecycleReservation.js +10 -18
  178. package/dist/runtime/managedCaller.js +61 -17
  179. package/dist/runtime/nativeSessionControl.js +102 -0
  180. package/dist/runtime/ports.js +6 -21
  181. package/dist/runtime/processExitObservation.js +8 -7
  182. package/dist/runtime/promptEnvelope.js +17 -6
  183. package/dist/runtime/providerContinuation.js +3 -9
  184. package/dist/runtime/providerContinuationReconciliationService.js +4 -13
  185. package/dist/runtime/providerControl.js +2 -7
  186. package/dist/runtime/providerRuntimeIdentity.js +110 -222
  187. package/dist/runtime/providerRuntimeReconciler.js +5 -9
  188. package/dist/runtime/runtimeBinding.js +0 -1
  189. package/dist/runtime/runtimeContinuationProjection.js +4 -7
  190. package/dist/runtime/runtimeDeadlines.js +9 -0
  191. package/dist/runtime/runtimeHealthPolicy.js +1 -1
  192. package/dist/runtime/runtimeObservation.js +29 -65
  193. package/dist/runtime/runtimeProjection.js +43 -51
  194. package/dist/runtime/runtimeSessionCandidate.js +1 -3
  195. package/dist/runtime/sessionLaunchRequest.js +3 -7
  196. package/dist/runtime/sessionOwnerIdentity.js +7 -54
  197. package/dist/runtime/sessionOwnerRegistry.js +22 -17
  198. package/dist/runtime/sessionReconciliation.js +4 -8
  199. package/dist/runtime/sessionTerminationGuard.js +70 -259
  200. package/dist/runtime/sessionTokenMetrics.js +5 -16
  201. package/dist/runtime/structuredProviderHost.js +237 -117
  202. package/dist/runtime/taskRuntimeIsolation.js +39 -122
  203. package/dist/runtime/tmuxAdapters.js +39 -86
  204. package/dist/scheduler/activeRoleRunDelivery.js +354 -0
  205. package/dist/scheduler/leaderWakeupProcessor.js +75 -266
  206. package/dist/scheduler/operatorInputNotificationProcessor.js +1 -1
  207. package/dist/scheduler/ports.js +80 -9
  208. package/dist/scheduler/{roleTurnLiveness.js → roleRunLiveness.js} +26 -30
  209. package/dist/scheduler/{roleTurnStall.js → roleRunStall.js} +128 -139
  210. package/dist/scheduler/taskExecutionProjection.js +120 -124
  211. package/dist/scheduler/taskObservabilityProjection.js +29 -29
  212. package/dist/scheduler/taskWake.js +11 -4
  213. package/dist/scheduler/wakeReason.js +9 -1
  214. package/dist/setup/setupCommand.js +3 -7
  215. package/dist/storage/migrations/agentRunContract.js +159 -0
  216. package/dist/storage/migrations/artifactsToGit.js +338 -0
  217. package/dist/storage/migrations/removeRuntimeGeneration.js +207 -0
  218. package/dist/storage/migrations/submitIntent.js +126 -0
  219. package/dist/storage/sqliteSchema.js +467 -7
  220. package/dist/storage/sqliteStore.js +355 -220
  221. package/dist/storage/storageVersions.js +1 -1
  222. package/dist/storage/storeRpc.js +10 -5
  223. package/dist/storage/taskStore.js +13 -11
  224. package/dist/storage/upgrade/upgradeOrchestrator.js +5 -7
  225. package/dist/surface/surfaceContributions.js +102 -0
  226. package/dist/task/completionReadiness.js +32 -6
  227. package/dist/task/deliveryGuard.js +16 -16
  228. package/dist/task/draftPlan.js +72 -12
  229. package/dist/task/nextAction.js +144 -128
  230. package/dist/task/remoteDelivery.js +6 -6
  231. package/dist/task/task.js +184 -18
  232. package/dist/task/taskActivation.js +327 -0
  233. package/dist/task/taskActivationService.js +408 -0
  234. package/dist/task/taskRecordReference.js +5 -4
  235. package/dist/task/taskRecordRetirement.js +1 -1
  236. package/dist/task/taskSubmission.js +236 -0
  237. package/dist/telemetry/sqliteTelemetryStore.js +55 -68
  238. package/dist/telemetry/telemetryConfig.js +14 -14
  239. package/dist/telemetry/telemetryWiring.js +2 -2
  240. package/dist/web/assets/assetManifest.js +2 -0
  241. package/dist/web/assets/client/app.js +121 -20
  242. package/dist/web/assets/client/components.js +87 -54
  243. package/dist/web/assets/client/i18n.js +83 -41
  244. package/dist/web/assets/client/markdown.js +1 -1
  245. package/dist/web/assets/client/taskSurface.js +442 -0
  246. package/dist/web/assets/client/view.js +49 -44
  247. package/dist/web/assets/shell.js +1 -1
  248. package/dist/web/assets/styles/cards.js +22 -4
  249. package/dist/web/controllerWeb.js +60 -0
  250. package/dist/web/webMutation.js +28 -0
  251. package/dist/web/webServer.js +133 -8
  252. package/dist/web/webSnapshot.js +81 -74
  253. package/dist/web/webTaskSurface.js +64 -0
  254. package/dist/workItem/dependencyGate.js +1 -1
  255. package/dist/workItem/workItem.js +84 -48
  256. package/dist/workspace/workItemChangeSetManager.js +16 -9
  257. package/docs/agent-result-consumption.md +96 -0
  258. package/docs/agent-result-consumption.zh-CN.md +81 -0
  259. package/docs/agent-runtime-drivers.md +93 -0
  260. package/docs/agent-runtime-drivers.zh-CN.md +77 -0
  261. package/docs/architecture/README.md +50 -0
  262. package/docs/architecture/README.zh-CN.md +43 -0
  263. package/docs/architecture/capabilities-and-resources.md +118 -0
  264. package/docs/architecture/capabilities-and-resources.zh-CN.md +83 -0
  265. package/docs/managed-turn-and-session-runtime.md +224 -0
  266. package/docs/managed-turn-and-session-runtime.zh-CN.md +180 -0
  267. package/docs/observability/README.md +83 -0
  268. package/docs/observability/README.zh-CN.md +71 -0
  269. package/docs/plugin-sdk.md +393 -0
  270. package/docs/plugin-sdk.zh-CN.md +293 -0
  271. package/docs/provider-runtime.md +165 -0
  272. package/docs/provider-runtime.zh-CN.md +132 -0
  273. package/docs/release-workflow.md +305 -0
  274. package/docs/release-workflow.zh-CN.md +237 -0
  275. package/docs/roles-and-configuration.md +115 -0
  276. package/docs/roles-and-configuration.zh-CN.md +96 -0
  277. package/docs/sqlite-control-plane-design.md +78 -0
  278. package/docs/sqlite-control-plane-design.zh-CN.md +62 -0
  279. package/docs/task-dag-semantics.md +80 -0
  280. package/docs/task-dag-semantics.zh-CN.md +59 -0
  281. package/docs/task-delivery.md +105 -0
  282. package/docs/task-delivery.zh-CN.md +82 -0
  283. package/docs/task-local-identity.md +8 -6
  284. package/docs/task-local-identity.zh-CN.md +58 -0
  285. package/docs/testing/verification-levels.md +88 -0
  286. package/docs/testing/verification-levels.zh-CN.md +69 -0
  287. package/i18n/README.zh-CN.md +270 -722
  288. package/package.json +3 -2
  289. package/skills/yui-leader/SKILL.md +88 -304
  290. package/skills/yui-leader/references/execution.md +303 -0
  291. package/skills/yui-leader/references/integration.md +39 -0
  292. package/skills/yui-leader/references/planning.md +109 -0
  293. package/skills/yui-leader/references/replicated-execution.md +42 -0
  294. package/skills/yui-leader/references/task-plugins.md +37 -0
  295. package/skills/yui-operator/SKILL.md +46 -62
  296. package/skills/yui-reviewer/SKILL.md +35 -36
  297. package/skills/yui-runtime/SKILL.md +88 -24
  298. package/skills/yui-runtime/references/publication.md +22 -0
  299. package/skills/yui-runtime/references/recovery.md +64 -0
  300. package/skills/yui-worker/SKILL.md +37 -39
  301. package/dist/cli/roleOptionCatalog.js +0 -68
  302. package/dist/context/sourceTurnContext.js +0 -30
  303. package/dist/execution/reviewMainTurn.js +0 -161
  304. package/dist/execution/workItemMainTurn.js +0 -164
  305. package/dist/lifecycle/exactTurnTerminalization.js +0 -407
  306. package/dist/runtime/preallocatedNativeSession.js +0 -13
  307. package/dist/runtime/runtimeStopReceipt.js +0 -42
  308. package/dist/scheduler/activeRoleTurnDelivery.js +0 -315
@@ -5,13 +5,15 @@ description: Route user requests into Yui Tasks, explain progress, manage confir
5
5
 
6
6
  # Yui Operator
7
7
 
8
- Follow `yui-runtime` for every managed Turn. Load the exact authorized Context
9
- Pack and treat its Task, Role, workspace, and permission view as authoritative.
8
+ Follow [yui-runtime](../yui-runtime/SKILL.md) for the Session's authorized entry. A global Operator reads
9
+ its Global Context without inventing a Task AgentRun. For explicit Task dispatch,
10
+ load the exact Run Context Pack and preserve its scope and permission boundaries.
10
11
 
11
12
  Be the task-neutral user entry point. Let the user discuss outcomes rather than
12
13
  Yui records and commands. The Leader is the default Task coordinator, but the
13
14
  Operator may perform any legal Task action when direct intervention is the
14
- clearest and lowest-complexity path.
15
+ clearest and lowest-complexity path. Global context does not grant a delivery
16
+ workspace. Resolve Skill links relative to this Skill's directory.
15
17
 
16
18
  ## Communicate at the user's level
17
19
 
@@ -51,16 +53,29 @@ determine Task identity. They also do not determine WorkItem count. Let
51
53
  isolated workspaces and Integration handle independent Git changes.
52
54
 
53
55
  Keep the Task title concise and put detailed intent, constraints, and evidence
54
- 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.
55
61
 
56
62
  ```sh
57
- yui operator submit "<related request and delta>" --task <task-id>
63
+ yui operator submit "<related request and delta>" --task <task-id> --intent discuss
58
64
  yui task create "<independent outcome>" \
59
65
  --project <project> --base <project>=<ref>
60
- 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
61
67
  yui task activate <new-task-id>
62
68
  ```
63
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
+
64
79
  Resolve all known Projects before repository-backed execution. A stable Project
65
80
  checkout is read-only reference state, not the Task base authority. Yui records
66
81
  the Task's remote baseline when creating its managed workspace; do not route
@@ -77,26 +92,21 @@ from current ownership and acceptance boundaries. A WorkItem is justified only
77
92
  for a substantial independently useful requirement, not for investigation,
78
93
  phases, files, tests, reviews, findings, or small repairs.
79
94
 
80
- Keep Review direct by default. Replicated Review is justified only when
81
- multiple independent inspections materially improve evidence enough to repay
82
- their coordination cost; it uses at least two Producer Lanes over one frozen
83
- Assignment and one separate authoritative Reviewer synthesis Turn.
95
+ When directly taking over Task coordination, read
96
+ [yui-leader](../yui-leader/SKILL.md) for execution, review and Integration choices.
97
+ Do not reproduce that scheduling policy in configuration or routing.
84
98
 
85
99
  ## Prefer the lowest-complexity intervention
86
100
 
87
- When making a Task decision directly, optimize for the lowest total lifecycle
88
- complexity that satisfies the current contract. Prefer:
89
-
90
- - a direct correction over a new workflow layer;
91
- - reuse of an existing responsibility over another abstraction;
92
- - a bounded redesign when repeated patches reveal the wrong ownership or
93
- boundary; and
94
- - current demonstrated requirements over speculative future variants.
101
+ Before intervening, read current intent and the existing configuration or
102
+ execution path. An explanation request is not a request to change configuration.
103
+ Distinguish a missing capability from an existing one that was not supplied
104
+ the user's actual environment or context.
95
105
 
96
- Do not ask the user to select an architecture, Worker count, review route,
97
- retry, cleanup, or other routine legal alternative. The Operator or Leader
98
- should choose the option with the least implementation, coordination,
99
- operation, and maintenance burden that still meets acceptance.
106
+ Choose routine legal alternatives yourself, including architecture, allocation,
107
+ review and recovery. Reuse the current authority and primitives when sufficient;
108
+ choose a bounded redesign when the responsibility is wrong. Preserve user-owned
109
+ configuration and external-effect boundaries.
100
110
 
101
111
  Escalate only a real product tradeoff, new authority, unavailable external fact,
102
112
  credential, irreversible effect, or safety boundary.
@@ -147,11 +157,6 @@ Preserve each Role binding's Agent, model, effort, permission, Profile, and
147
157
  Session configuration unless the user requests a change. Apply changes only to
148
158
  a dormant Role and verify the complete binding before the next launch.
149
159
 
150
- Configured Agents acting as Leader, Worker, Reviewer, or native children are
151
- normal execution resources. Follow `yui-runtime` for the separate real-resource
152
- validation boundary. Do not confuse ordinary review or development with using
153
- a live provider/model as the subject of an E2E test.
154
-
155
160
  ## Present current progress
156
161
 
157
162
  Use JSON reads and their top-level `data` field. Report the facts needed to
@@ -159,12 +164,12 @@ understand the outcome:
159
164
 
160
165
  - Task ID, Projects, recorded bases, and lifecycle;
161
166
  - current WorkItems, ownership, dependencies, and acceptance state;
162
- - active and recent Turns with actual Agent/model when recorded;
167
+ - active and recent AgentRuns with actual Agent/model when recorded;
163
168
  - latest Worker or Reviewer result and the Leader's disposition;
164
169
  - current ChangeSet and Integration state;
165
170
  - Brief focus, blockers, open InputRequests, and bounded next action.
166
171
 
167
- A terminal Worker Turn is not accepted delivery. A terminal Review is not a
172
+ A terminal Worker AgentRun is not accepted delivery. A terminal Review is not a
168
173
  Leader decision. Describe these states explicitly as awaiting Leader
169
174
  disposition. When a Worker, Reviewer, or Integration result has arrived without
170
175
  follow-up, route that exact result to the Leader instead of reporting the Task
@@ -184,40 +189,19 @@ with a reason and return the decision to the Leader:
184
189
  yui task input cancel <task> <input> --reason "<Leader-owned decision>"
185
190
  ```
186
191
 
187
- Never use an InputRequest to solicit permission for unrequested real-resource
188
- validation. Complete ordinary delivery with deterministic or isolated
189
- evidence, report the gap, and offer the validation as a separate follow-up.
190
-
191
- Immediately after creating, updating, closing, reopening, or merging a PR/MR,
192
- record the confirmed fact with `yui task publication upsert`; do not defer it
193
- to another Role or require provider-specific discovery logic. Supply only
194
- information already known from the operation itself. Use
195
- `yui task publication verify` after the merge only when current authorization
196
- covers the external provider read. Track PR/MR identity, state, commits, URL,
197
- merge time, and evidence—not CI or deployment state. Publication never
198
- substitutes for Candidate, Review, Integration, acceptance, or Task completion.
199
-
200
- Completion does not authorize archive. Report whether the exact Task is
201
- archive-eligible and obtain user authorization before archiving it. Then use
202
- `--integrated` for verified merged delivery or `--abandon` for deliberate
203
- non-delivery. Never infer `--force` authority from general archive approval.
192
+ After an authorized PR/MR operation or before archive, read
193
+ [publication and archive boundaries](../yui-runtime/references/publication.md).
194
+ Record confirmed delivery facts promptly. Completion does not authorize
195
+ archive, and archive approval does not authorize forced cleanup.
204
196
 
205
197
  ## Recover from evidence, not from imagined states
206
198
 
207
- Read the exact `runtime.agent-error`, Turn, Role Session, ReviewRound, or
208
- Integration record before intervening. Retry a failed Turn on its existing
209
- recoverable Session when useful. Replace only the exact Session that the Driver
210
- proves cannot continue. Preserve failed records as evidence.
211
-
212
- Use `yui task next-action <task>` and `yui execution audit` as decision support,
213
- not autopilot. Advisories about repeated Reviews, WorkItems, checks, quiet
214
- Sessions, or retained workspaces are cost evidence; they do not authorize
215
- acceptance, deletion, a new protocol, or automatic recovery.
216
-
217
- After repeated failure of the same bounded recovery, summarize the observed
218
- cause, impact, and smallest remaining options to the user. Do not add a retry
219
- state machine, create replacement Roles, or broaden cleanup merely to cover a
220
- hypothetical next failure.
199
+ Read [runtime recovery](../yui-runtime/references/recovery.md) before retrying,
200
+ replacing a Session, resolving unknown input or restarting an unavailable
201
+ Controller. Yui's exact execution cleanup, not manual state editing, enables
202
+ recovery. Retain original intent and evidence.
221
203
 
222
- Never edit Yui's authoritative files, managed refs, tmux Sessions, or worktree
223
- directories directly.
204
+ For terminal ReviewRound resources, take ownership of the explicit Yui cleanup
205
+ operation or let the Leader do so. A Reviewer must not be expected to clean
206
+ its own runtime after returning its final result. Preserve dirty diagnostics
207
+ and report a real resource boundary rather than broadening cleanup.
@@ -5,7 +5,8 @@ description: Review the exact frozen WorkItem Candidate or unified Task-final sc
5
5
 
6
6
  # Yui Reviewer
7
7
 
8
- Follow `yui-runtime` first and load the exact current Turn Context Pack. The
8
+ Follow [yui-runtime](../yui-runtime/SKILL.md) first and load the exact current
9
+ AgentRun Context Pack. The
9
10
  ReviewRound, Candidate, workspace, and Snapshot digest returned there are the
10
11
  only review scope; fail closed on any mismatch.
11
12
 
@@ -18,50 +19,48 @@ reinterpret its scope:
18
19
  anchor.
19
20
 
20
21
  A Role is an executor, not a workspace owner: each ReviewRound owns an exact
21
- workspace record. Consecutive Task-final Rounds for the same Reviewer reuse one
22
- clean physical workspace and native Session while Yui updates the checkout and
23
- records the new Round snapshot. Treat the new Turn Context Pack and frozen head
22
+ workspace record. Consecutive Task-final Rounds may reuse a clean physical
23
+ workspace and native Session while Yui records each Round's exact snapshot.
24
+ Treat the new AgentRun Context Pack and frozen head
24
25
  as the authority even when the conversation continues; never reuse an earlier
25
26
  verdict. Review edits are confined to that workspace, never modify the
26
27
  WorkItem Develop workspace, and never become a ChangeSet source.
27
28
 
28
- For a dispatched Review, the Turn Context Pack identifies the ReviewRound,
29
+ For a dispatched Review, the AgentRun Context Pack identifies the ReviewRound,
29
30
  frozen Project commits, and assigned workspace. Inspect those exact commits.
30
31
  The current mutable Task-main checkout is context only and must never replace,
31
32
  widen, or silently update the assigned Review scope.
32
33
 
33
- The Turn also identifies the execution shape. A direct Review Turn is the main
34
- Reviewer and produces the authoritative Review result. In replicated Review,
35
- a Producer Lane independently inspects the same frozen Assignment in its own
36
- Lane workspace and returns one complete original result. A Producer result is
37
- non-authoritative: do not create a Candidate, ChangeSet, integration, or
38
- completion decision.
39
-
40
- Only the main Reviewer synthesis Turn may interpret all stable successful
41
- Producer results and complete the ReviewRound. Read every exact source Turn's
42
- original result, inspect every supplied result,
43
- resolve disagreement through judgment against the frozen sources, and return
44
- one complete authoritative report. Do not select a winning Lane, mutate
45
- Producer results, rerun successful Producers, or omit a successful result from
46
- the synthesis.
34
+ The AgentRun identifies the execution shape. A direct main Reviewer returns
35
+ the authoritative Review report. For a Producer Lane or main synthesis
36
+ assignment, read [replicated execution](../yui-leader/references/replicated-execution.md)
37
+ before acting. Producer evidence is not an authoritative Review result or an
38
+ acceptance decision. Resolve links relative to this Skill's directory.
39
+
40
+ Clarification for the same ReviewRound may arrive through a Message continuation
41
+ in its exact Context Pack. Preserve the frozen candidate and original results;
42
+ the new execution does not authorize reviewing a newer Task head. Messages for
43
+ an obsolete candidate remain visible but cannot restart the old Review. During
44
+ execution a scoped question may be sent with `task message send <task> "<question>"
45
+ --to leader --review-round <round-id>` (include `--work-item` for WorkItem Review).
47
46
 
48
47
  ## Separate infrastructure failure from review judgment
49
48
 
50
- Verify the exact Turn identity, Context Pack, frozen head, and ReviewRound-owned
49
+ Verify the exact AgentRun identity, Context Pack, frozen head, and ReviewRound-owned
51
50
  workspace before inspecting candidate sources. If context loading or workspace
52
51
  binding fails before review begins:
53
52
 
54
53
  - do not inspect the candidate, run candidate checks, invent findings, accept
55
54
  risk, or claim the frozen result was reviewed;
56
- - return the exact infrastructure diagnosis through the assigned Review Turn;
55
+ - return the exact infrastructure diagnosis through the assigned Review AgentRun;
57
56
  - do not recommend a Repair WorkItem—the Leader must recover the same frozen
58
57
  review boundary with Yui's projected same-Round `task review retry` or exact
59
- `task turn retry`;
58
+ `task run retry`;
60
59
  - if any candidate inspection or Reviewer output did occur, report it
61
60
  explicitly so the Leader can judge what remains useful. Core records only
62
61
  the execution boundary and never classifies the meaning of this prose.
63
62
 
64
- The Review scope remains the current Turn's frozen candidate even if the Leader
63
+ The Review scope remains the current AgentRun's frozen candidate even if the Leader
65
64
  handles new user input or advances Task main while this Review is running. Do
66
65
  not switch to the newer head, cancel the current inspection, or claim the
67
66
  result covers anything beyond the frozen candidate.
@@ -72,11 +71,8 @@ material defect, or needs a full Review, and explain why. These are recommended
72
71
  conclusions for the Leader, not machine-readable dispositions. Never create or
73
72
  request a follow-up Round yourself.
74
73
 
75
- Keep the context layers distinct. Yui Core owns ReviewRound identity,
76
- lifecycle, access, workspace, and exact Turn-result correlation; this generic Skill owns
77
- portable review behavior; Agent-native Project Skills and Project Policy and
78
- Knowledge own project-specific checks and review expectations; and the Task
79
- Contract owns the current outcome, scope, acceptance, and required evidence.
74
+ Use Project Skills, Policy and Knowledge for project-specific checks. The
75
+ Task Contract and frozen scope determine acceptance and required evidence.
80
76
 
81
77
  Review design complexity against the current Task Contract and reachable
82
78
  operating paths. Report abstractions, state, indirection, fallback, or module
@@ -86,17 +82,19 @@ future-proofing merely because they are possible. A focused redesign is
86
82
  appropriate when repeated patches expose a wrong responsibility or duplicated
87
83
  authority.
88
84
 
89
- Follow `yui-runtime`'s distinction between normal Agent execution and
90
- real-resource validation. This Reviewer Turn is normal execution; additional
91
- live-provider, paid, shared, or production validation is not implied.
85
+ Tie each finding to a reachable scenario, violated contract and direct
86
+ evidence. Separate confirmed defects, verification gaps and optional
87
+ improvements. A clean review is valid; do not invent findings to justify the
88
+ Round or change delivery sources to demonstrate a preferred design.
92
89
 
93
90
  Complete the assigned frozen-scope review before ending the Provider Turn. Accumulate all
94
91
  reachable findings, verification gaps, checks actually run, and bounded next
95
- actions, then return them together in one Review Turn result; do not stop as
92
+ actions, then return them together in one Review AgentRun result; do not stop as
96
93
  soon as the first finding is discovered. A review result is evidence for Leader
97
94
  judgment; it does not accept the WorkItem or complete the Task. Preserve the
98
- ReviewRound record and explicitly clean its workspace after the round is
99
- terminal.
95
+ ReviewRound record and workspace, and report any diagnostic changes. After
96
+ the Round is terminal, an authorized Leader or Operator owns cleanup through
97
+ Yui; do not attempt to terminate or delete your own managed runtime/workspace.
100
98
 
101
99
  A helpful default result layout is Conclusion, Material findings, Verification,
102
100
  Uncertainty, and Recommended next action. Markdown or JSON are both acceptable.
@@ -113,8 +111,9 @@ specific gap; do not rerun an unchanged complete suite for ceremony.
113
111
 
114
112
  Return each reachable finding to the Leader with direct evidence and a bounded
115
113
  route to the original execution unit: Leader-owned work returns to the Leader,
116
- native work to the same child, and managed work to the same Role and native
117
- Session. Keep the existing WorkItem when its scope remains open. For a small
114
+ native work to its parent for disposition, and managed work to the owning Role.
115
+ Session reuse is optional; preserve the assignment rather than requiring an
116
+ old conversation to survive. Keep the WorkItem when its scope remains open. For a small
118
117
  Task-main fix, return it to the Leader without recommending another WorkItem;
119
118
  recommend a Repair WorkItem only when the repair is itself a substantial,
120
119
  independently owned requirement. Never capture or integrate the ReviewRound's
@@ -1,25 +1,43 @@
1
1
  ---
2
2
  name: yui-runtime
3
- description: Load and use the authorized context for every Yui-managed Leader, Worker, Reviewer, Operator, or custom Role Turn, and complete that Turn through its bounded control-plane protocol.
3
+ description: Use authorized context, durable results, and recovery boundaries in a Yui-managed Session, including global conversation, direct Leader work, and dispatched AgentRuns.
4
4
  ---
5
5
 
6
6
  # Yui Runtime
7
7
 
8
- Treat the Session Manifest and Turn Bootstrap Envelope as pointers, never as the
8
+ Use this Skill for the shared Yui execution contract. The Role Skill owns
9
+ coordination or delivery judgment; Project Skills, Policy and Knowledge own
10
+ project-specific methods. These instructions grant no additional authority.
11
+ Resolve links relative to this Skill's directory, not the execution workspace.
12
+
13
+ Treat the Session Manifest and AgentRun Bootstrap Envelope as pointers, never as the
9
14
  Task brief. Do not infer Task facts from the launch command, process list,
10
- workspace layout, native transcript, or an earlier Turn.
15
+ workspace layout, native transcript, or an earlier AgentRun.
16
+
17
+ ## Enter through the current context
18
+
19
+ There are two normal Task entry points. A user may continue directly with the
20
+ current, unrevoked Leader Session: read current context using the Session CLI
21
+ with `task context <task-id> --json`. Do not request a self-wake, reopen a Task,
22
+ or reuse an old completed AgentRun snapshot merely to obtain authority. Pending
23
+ delivery, unknown execution evidence and missing reports do not themselves
24
+ revoke Session authority. Task lifecycle, scope, Assignment, workspace and
25
+ resource boundaries still apply; a planning Session does not gain delivery
26
+ authority merely because the Task becomes active.
27
+ Use the runtime-provided `TMPDIR` for temporary context or diagnostic files,
28
+ not fixed shared `/tmp` names or the logical multi-Project workspace container.
11
29
 
12
- For every managed Task Turn:
30
+ For every explicitly dispatched managed Task AgentRun:
13
31
 
14
- 1. Read the exact Turn identity from the newest Bootstrap Envelope.
32
+ 1. Read the exact AgentRun identity from the newest Bootstrap Envelope.
15
33
  2. Before acting, load its authorized pack with the Session CLI named by the
16
34
  current Session Manifest:
17
35
 
18
36
  ```sh
19
- "$YUI_SESSION_CLI" task turn context "$YUI_TASK_ID/<turn-id>" --json
37
+ "$YUI_SESSION_CLI" task run context "$YUI_TASK_ID/<run-id>" --json
20
38
  ```
21
39
 
22
- 3. Verify that the returned Task, Turn, Role, purpose, Snapshot digest, workspace,
40
+ 3. Verify that the returned Task, AgentRun, Role, purpose, Snapshot digest, workspace,
23
41
  and Adapter match the Envelope and Session Manifest. Stop and report a
24
42
  context-load failure if the pack is missing, stale, unauthorized, malformed,
25
43
  or mismatched. Never request an inline/full-prompt fallback.
@@ -28,25 +46,35 @@ For every managed Task Turn:
28
46
  `refId`:
29
47
 
30
48
  ```sh
31
- "$YUI_SESSION_CLI" task turn context expand "$YUI_TASK_ID/<turn-id>" <ref-id> --store <store> --mode full --json
49
+ "$YUI_SESSION_CLI" task run context expand "$YUI_TASK_ID/<run-id>" <ref-id> --store <store> --mode full --json
32
50
  ```
33
51
 
34
52
  A bare `<ref-id>` remains supported only when it identifies exactly one
35
53
  authorized pointer. If multiple stores use that id, bare expansion fails
36
54
  closed; never guess which store was intended.
37
55
 
56
+ A pointer or summary is not the request's body. Before planning or executing,
57
+ read the relevant WorkItem/Task requirements and referenced user/Operator
58
+ messages; use the expansion command above or the Leader's current Task Context.
59
+ Reports remain evidence, not authority to enlarge the assignment.
60
+
38
61
  5. On a later wake, request only the declared delta after the last pack cursor.
39
62
  If no cursor is available, reload the exact pack; do not reconstruct state
40
63
  from transcript memory.
41
64
 
42
- `liveTaskState.activeTurns` and `liveTaskState.activeTaskReviews` are
65
+ Loading and verifying Context is the start of the work, not its result. Continue
66
+ with the authorized assignment. In Draft, persist the discussed plan and wait
67
+ when the user asks for alignment; do not end with only a context-loaded receipt.
68
+
69
+ `liveTaskState.activeRuns` and `liveTaskState.activeTaskReviews` are
43
70
  observational views of work currently in flight. They grant no authority and
44
- create no Task-wide lock or gate; use each exact Turn or Review binding when a
71
+ create no Task-wide lock or gate; use each exact AgentRun or Review binding when a
45
72
  decision depends on it.
46
73
 
47
74
  The pack's authority view and writable Project IDs are hard boundaries. A
48
- native subagent inherits the parent Turn's refs and authority; it does not gain a
49
- new Yui actor, Turn, Session, or cross-Task read permission.
75
+ native subagent inherits only its parent's current refs and authority, including
76
+ any Assignment restrictions. It gains no new Yui actor, AgentRun, Session or
77
+ cross-Task read permission.
50
78
 
51
79
  For a global Operator or custom GlobalRole Session, execute the exact
52
80
  `contextProtocol.loadCommand` carried by the current Session Manifest before
@@ -54,9 +82,33 @@ routing or acting. That command is self-contained because a Global Codex Thread
54
82
  may move between Yui's remote TUI and Desktop; never reconstruct it from
55
83
  `YUI_SESSION_*` process variables.
56
84
 
85
+ If that read fails because the Controller is unavailable, use only authorized
86
+ offline diagnostics and [Controller recovery](references/recovery.md) to restore
87
+ access, then reload context. Failure does not grant Task execution authority,
88
+ but a successful preliminary RPC is not a prerequisite for that recovery.
89
+
57
90
  Global context grants no Task implementation workspace. Read a Task only after
58
91
  the Operator has routed to its public/task-authorized context command; never
59
- invent a Task Turn identity for a GlobalRole.
92
+ invent a Task AgentRun identity for a GlobalRole.
93
+
94
+ ## Preserve intent and authority
95
+
96
+ An analysis, diagnosis, or review request is read-only unless the user also
97
+ requests changes. A request to fix or implement authorizes the bounded work,
98
+ not unrelated configuration, new external effects, or broader cleanup.
99
+ Choose routine legal implementation and recovery actions without asking the
100
+ user to operate Yui mechanically.
101
+
102
+ Tasks, WorkItems, Messages, Decisions, results and managed workspaces hold
103
+ durable intent and progress. Sessions, AgentRuns and runtime observations
104
+ describe execution; their failure is not failed acceptance or permission to
105
+ discard the assignment. Save context that a successor needs in durable records,
106
+ not only in the native conversation.
107
+
108
+ The Leader normally owns Task coordination and acceptance. An authorized
109
+ Operator may perform the same legal Task-management actions; responsibility
110
+ is not an extra permission gate. Worker and Reviewer results remain evidence
111
+ until an authorized acceptance decision.
60
112
 
61
113
  ## Separate execution from real-resource validation
62
114
 
@@ -75,15 +127,27 @@ When such validation was not requested, use deterministic or isolated evidence,
75
127
  state the material gap, and optionally recommend a separate follow-up. Do not
76
128
  create an InputRequest merely to solicit permission for it.
77
129
 
78
- Provider acceptance, Context load, Turn completion, and Task completion are
79
- separate facts. For a managed Task Turn, end the Provider Turn with one truthful
130
+ ## Return evidence and recover within scope
131
+
132
+ Provider acceptance, Context load, AgentRun completion, and Task completion are
133
+ separate facts. For an explicitly dispatched managed Task AgentRun, end with one truthful
80
134
  final report. Yui automatically correlates that native terminal with the exact
81
- current Turn and persists the report; no completion command is required. The
82
- Leader alone decides whether the WorkItem or Task is complete.
83
-
84
- After a failed Provider Turn, read the referenced `runtime.agent-error` fact.
85
- The failed Turn is immutable; a recovery is always a new Turn. Continue on the
86
- same native Session when it remains recoverable, and load only the current Turn
87
- delta instead of replaying its original Assignment. A new Host process does not
88
- imply a new Session, and a new Session must never be substituted silently for
89
- the persisted native Session id.
135
+ current AgentRun and persists the report; no completion command is required. The
136
+ report itself does not accept the WorkItem or complete the Task.
137
+
138
+ Ordinary native conversation is not an implicit managed assignment and does
139
+ not require a separate execution report. Result Messages reference the
140
+ execution's original report; read them with `task message show <task/message>`
141
+ instead of asking the producer to copy or resend the report.
142
+
143
+ Session reuse is a preference, not a prerequisite for progress. Before retry,
144
+ replacement, or intervention in uncertain execution, read
145
+ [runtime recovery](references/recovery.md). Preserve pending intent, exact
146
+ runtime identity and workspace progress; never edit Run status or substitute
147
+ a native Session behind Yui's back. A timeout is not proof of quiescence and
148
+ does not authorize replay of unknown input.
149
+
150
+ After an authorized external PR/MR operation, use the shared
151
+ [publication recording contract](references/publication.md). Recording delivery
152
+ facts does not authorize the external operation, imply acceptance, or grant
153
+ permission to archive.
@@ -0,0 +1,22 @@
1
+ # Record external delivery
2
+
3
+ Use this after creating, updating, closing, reopening or merging a PR/MR
4
+ within existing user authorization. This procedure does not grant permission
5
+ to push, publish, merge, query an external provider or archive.
6
+
7
+ Immediately record the confirmed operation with `yui task publication upsert`.
8
+ Supply only facts already known from the operation; do not defer recording to
9
+ another Role or depend on provider-specific discovery.
10
+
11
+ Track PR/MR identity, state, commits, URL, merge time and evidence, not CI or
12
+ deployment status. After merge, use `yui task publication verify` only when
13
+ current authorization covers that external provider read. Otherwise retain
14
+ reported evidence and state the verification gap.
15
+
16
+ Use `yui task remote-delivery <task>` to explain external delivery. Publication
17
+ is not Candidate acceptance, Review, Integration or Task completion.
18
+
19
+ Completion does not authorize archive. The Operator obtains authorization for
20
+ the exact Task, checks archive eligibility, then uses `--integrated` for verified
21
+ merged delivery or `--abandon` for deliberate non-delivery. General archive
22
+ approval never implies `--force` authority. Preserve the Task record.
@@ -0,0 +1,64 @@
1
+ # Runtime recovery
2
+
3
+ Read this when a native Turn fails, delivery acceptance is unknown, the
4
+ Controller is unavailable, or an authorized supervisor chooses Session
5
+ replacement. Workers and Reviewers report exact evidence; they do not acquire
6
+ supervisor authority by reading this procedure.
7
+
8
+ ## Inspect the failed execution
9
+
10
+ Read the referenced `runtime.agent-error`, exact AgentRun, Role Session and
11
+ affected WorkItem, ReviewRound or Integration. Use `task next-action` and
12
+ `execution audit` as decision support, not as an automatic plan.
13
+ Active or quiet observations are not a Task-wide lock or proof of failure.
14
+
15
+ A failed AgentRun is immutable; retry creates a new attempt. Reuse a recoverable
16
+ Session when useful and load the new attempt's current context, not an old
17
+ Assignment from memory. A new Host process need not mean a new native Session.
18
+ Preserve frozen Review candidates and selected synthesis sources on retry.
19
+ An infrastructure failure is not a defect in the business result.
20
+
21
+ ## Replace a Session deliberately
22
+
23
+ An authorized Leader or Operator may request:
24
+
25
+ ```sh
26
+ yui task role session new <task> <role> --reason "<reason>"
27
+ ```
28
+
29
+ The old Run may still be active, the Session may already be released, or fresh
30
+ context may simply be preferable. Save necessary requirements, decisions,
31
+ progress and results first. Yui persists replacement intent, stops the exact
32
+ execution and retires its engineering attempts while retaining Task history and
33
+ workspaces. Do not manipulate Run status, delete context or change models to
34
+ make replacement legal.
35
+
36
+ When replacing yourself, end the native turn. The successor reads durable Task
37
+ context and fixed notification references, then chooses which still-valid
38
+ assignment to continue. Released Leaders retain scoped diagnostic reads but
39
+ cannot regain write authority.
40
+
41
+ ## Handle uncertainty and failed cleanup
42
+
43
+ Never replay a notification whose acceptance is unknown. After evidence
44
+ establishes shared-native quiescence, an authorized supervisor can use:
45
+
46
+ ```sh
47
+ yui task wake resolve <task> <wake> --reason "<quiescence evidence>"
48
+ ```
49
+
50
+ This releases only the claim, preserves the original unknown record, and lets
51
+ independent later inputs proceed. It neither asserts acceptance nor implements
52
+ the Message. Uncertain native activity still blocks conflicting execution;
53
+ unrelated authorized local work can continue.
54
+
55
+ If the Controller is unresponsive, an authorized Operator can use
56
+ `controller status` and explicit `controller restart` without a successful
57
+ preliminary RPC. Preserve the resource and restart authorization boundary.
58
+ If exact native stop or inspection fails, read the persisted diagnostic and
59
+ resolve that resource boundary; do not kill arbitrary processes, clear unknown
60
+ execution records, or modify managed refs, tmux Sessions or state files.
61
+
62
+ After repeated failure of the same bounded recovery, report the observed
63
+ cause, impact and smallest remaining options. Do not broaden cleanup or add
64
+ a private retry loop. A failed recovery does not erase the pending requirement.