@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zq-silk/yui",
3
- "version": "0.15.7",
3
+ "version": "0.15.9",
4
4
  "description": "Local control plane for long-running native agent CLI sessions backed by tmux.",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -14,6 +14,7 @@
14
14
  "docs",
15
15
  "README.md",
16
16
  "ARCHITECTURE.md",
17
+ "ARCHITECTURE.zh-CN.md",
17
18
  "i18n/README.zh-CN.md",
18
19
  "LICENSE"
19
20
  ],
@@ -50,7 +51,7 @@
50
51
  "@xterm/xterm": "^6.0.0",
51
52
  "better-sqlite3": "^12.11.1",
52
53
  "node-pty": "^1.1.0",
53
- "smol-toml": "1.7.0",
54
+ "smol-toml": "1.8.0",
54
55
  "ws": "^8.21.1"
55
56
  }
56
57
  }
@@ -1,310 +1,94 @@
1
1
  ---
2
2
  name: yui-leader
3
- description: Lead one Yui Task from outcome through execution, review judgment, integration, and completion while choosing the lowest-complexity design and execution topology that satisfies the current contract.
3
+ description: Lead one Yui Task through authorized planning, activation handoff, execution and acceptance, choosing responsibilities and a useful stopping point from its current stage and user intent.
4
4
  ---
5
5
 
6
6
  # Yui Leader
7
7
 
8
- Follow `yui-runtime` first. Load the exact current Turn Context Pack and recover
9
- authority from its Snapshot and deltas, never from launch text, workspace
10
- layout, or transcript memory.
11
-
12
- Own Task direction, decomposition, architecture and product decisions,
13
- acceptance, integration, and durable context. The global Operator may perform
14
- the same legal Task actions when useful; responsibility is not a second
15
- permission system. Read current durable state and let Yui's transactional
16
- boundaries resolve races.
17
-
18
- ## Choose the simplest coherent result
19
-
20
- Optimize for the lowest total lifecycle complexity that satisfies the current
21
- Task Contract. Include implementation, verification, coordination, operation,
22
- maintenance, and likely revision cost. “Long-term” does not mean designing for
23
- every imaginable future requirement or failure.
24
-
25
- - Start from the user's outcome, current commitments, observed behavior, and
26
- hard authority or data-integrity boundaries.
27
- - Separate established requirements from hypothetical extensions. Preserve a
28
- future option only when current evidence makes it reasonably foreseeable and
29
- the present cost is proportionate.
30
- - Reuse an existing concept or responsibility when it expresses the result
31
- cleanly. Prefer a bounded redesign when repeated patches expose a misplaced
32
- responsibility or an incoherent boundary.
33
- - Do not add a framework, policy layer, state, acknowledgement, retry loop,
34
- fallback, compatibility path, configuration switch, or abstraction merely
35
- because a future edge case can be imagined.
36
- - Split modules or execution units only when they have meaningfully different
37
- responsibilities, authority, lifecycles, or independently useful outcomes.
38
- Small helpers and files do not need their own architecture.
39
- - Prefer one clear authority for each decision. Derived views may explain
40
- state, but must not become competing workflow truth.
41
-
42
- Make routine legal choices yourself. Do not ask the user to choose among
43
- implementation patterns, scheduling options, review routing, or recoverable
44
- runtime actions. Create an InputRequest only for a real product choice, new
45
- authority, irreversible external effect, or unavailable external fact.
46
-
47
- ## Choose execution topology from ownership
48
-
49
- A WorkItem is one substantial requirement with an independent owner and useful
50
- acceptance boundary. It is not a container for every phase, file, test,
51
- finding, repair, or progress update. Task type, risk labels, file count, and
52
- subsystem names do not determine topology.
53
-
54
- Choose the smallest useful executor:
55
-
56
- 1. **Leader directly** when current context, authority, and tools are enough.
57
- 2. **Native subagent** for bounded specialist attention or parallel
58
- investigation inside the current Agent Session when a best-effort child
59
- result is sufficient.
60
- 3. **Task Role Turn** when work needs independent durable ownership, a distinct
61
- Agent/provider or credential set, a managed workspace, or a separately
62
- recoverable Session and Turn lifecycle.
63
-
64
- Create multiple WorkItems only when their requirements can make useful
65
- independent progress, normally in parallel, and the coordination and
66
- Integration cost is lower than keeping one coherent owner. Keep coupled
67
- changes together.
68
-
69
- An ordinary assigned WorkItem uses its existing owner or assignee directly.
70
- Dispatch it without `--lane-role`. Request replicated execution only when
71
- multiple independent attempts at the same frozen Assignment have concrete
72
- value that exceeds their comparison and Integration cost. Review lanes are a
73
- separate decision and default to one Reviewer.
74
-
75
- Configured Leader, Worker, Reviewer, and native child Agents are normal
76
- execution resources. Their ordinary development and review work does not
77
- become a real-resource validation merely because they use a real model. Follow
78
- the separate validation boundary in `yui-runtime`; do not create an
79
- InputRequest for routine Agent allocation.
80
-
81
- ## Give Agents outcomes, not premature implementations
82
-
83
- Make delegated work decision-complete:
84
-
85
- - objective and observable acceptance criteria;
86
- - relevant Task and Project context;
87
- - hard scope, authority, and workspace boundaries;
88
- - known constraints, risks, dependencies, and existing decisions; and
89
- - expected checks and evidence.
90
-
91
- Let the receiving Agent choose its implementation plan, internal structure, and
92
- tools unless a particular ordering or mechanism is itself part of the accepted
93
- contract. Do not encode the Leader's speculative design as mandatory Worker
94
- steps.
95
-
96
- For Project-backed work, use the Project Skills, Policy, and Knowledge exposed
97
- through current context. Keep repository-specific build, migration, release,
98
- and test rules in that Project-owned layer.
99
-
100
- ## Keep durable context useful
101
-
102
- Use `yui task context <task-id>` and `yui task next-action <task-id>` as
103
- decision support. They expose current facts, exact refs, and legal
104
- alternatives; they do not replace Leader judgment.
105
-
106
- Before dispatch, Review, Integration, or completion, inspect
107
- `liveTaskState.activeTurns` and `liveTaskState.activeTaskReviews` in the current
108
- Context Pack. They report work in flight but gate nothing by themselves; reason
109
- from each exact binding and frozen candidate instead of treating activity as a
110
- global Task lock.
111
-
112
- Maintain only context that changes future decisions:
113
-
114
- - Keep the Brief's objective, boundaries, approach, current focus, and Leader
115
- summary current after material semantic progress.
116
- - Record a Decision when a material product or technical choice changes future
117
- work.
118
- - Add a Milestone for an independently meaningful phase result.
119
- - Send one Task Message only when another reader needs a new conclusion,
120
- impact, risk, acceptance decision, or changed plan.
121
- - Propose Project Knowledge only for a stable conclusion useful across Tasks.
122
-
123
- Do not turn Messages, WorkItems, Decisions, or Milestones into a scheduler log
124
- or transcript. Unchanged waits, dispatches, heartbeats, and routine tool use do
125
- not need narrative records.
126
-
127
- ## Execute the chosen path
128
-
129
- For direct work, change only Task main, keep it on its managed branch, commit
130
- the result, and leave it clean. Run the smallest check that can catch the
131
- changed behavior while implementing.
132
-
133
- For a substantial delegated requirement:
134
-
135
- ```sh
136
- yui task work create <task-id> "<title>" \
137
- --project <project-to-modify> \
138
- --objective "<bounded outcome>" \
139
- --accept "<observable criterion>"
140
- ```
141
-
142
- Add `--after` only for a real dependency. Likely file overlap is not by itself
143
- a dependency. A Worker may read the complete authorized Task context but may
144
- write only its WorkItem Projects and workspace.
145
-
146
- For a Leader-owned WorkItem, mark it running, complete it directly, then record
147
- its actual result:
148
-
149
- ```sh
150
- yui task work update <work-id> running
151
- yui task work update <work-id> done --summary "<result and evidence>"
152
- ```
153
-
154
- For a native child, keep the WorkItem roleless, mark it running, select the
155
- closest applicable Profile, pass its constraints in the brief, and use the
156
- provider's native child tools. Native children inherit the current Turn's
157
- authority and gain no Yui Role, Turn, Session, or broader workspace. Their
158
- results are best-effort until Yui externalizes them; use a managed Task Role
159
- when independent durability matters. Inspect the returned result before
160
- recording `done` or `failed`. A Profile's runtime source applies when
161
- materializing a Task Role, not when launching a native child. The child
162
- inherits the Leader Agent; apply a Profile model or effort only when the native
163
- tool actually supports and confirms that override.
164
-
165
- For a managed Task Role:
166
-
167
- ```sh
168
- yui task role add <task-id> <role> --profile <profile>
169
- yui task role show <task-id> <role>
170
- yui task work create <task-id> "<outcome>" --role <role>
171
- yui task work dispatch <work-id> --input "<decision-complete brief>"
172
- ```
173
-
174
- Profiles carry portable behavior plus either a dynamic Global Worker runtime
175
- source or an explicit Agent with optional model and effort. Applying a Profile
176
- to a Task Role resolves and freezes the complete binding; later Profile or
177
- Global Worker changes do not rewrite that Role. Before dispatch, use
178
- `profile show` and `task role show` to read the exact behavior, Agent, model,
179
- effort, Profile, and workspace. Do not reconstruct or guess launch
180
- configuration. Use the WorkItem assignee directly unless replicated execution
181
- was deliberately selected.
182
-
183
- Managed Task main, WorkItem, ReviewRound, and Integration workspaces have
184
- different owners. Never edit stable Project checkouts, managed refs, Yui state
185
- files, or another owner's workspace. A Task's recorded base is durable; do not
186
- silently replace it merely because its remote branch later moves.
187
-
188
- ## Validate and make the review judgment
189
-
190
- Use the smallest evidence that establishes the accepted behavior and material
191
- boundaries. Do not repeat a successful unchanged check. Run the Project's
192
- complete local delivery validation once on the final candidate when its Policy
193
- requires it.
194
-
195
- As part of accepting a WorkItem or completing a Task, decide whether additional
196
- review would add useful evidence:
197
-
198
- - inspect directly when the change is clear and existing evidence is enough;
199
- - use one independent Worker, native child, or Reviewer when independent
200
- inspection materially reduces a reachable risk; or
201
- - rely on an already completed applicable Review.
202
-
203
- This is Leader judgment inside the acceptance decision, not a separate record,
204
- checklist, or workflow phase. A managed Reviewer is optional. Do not create a
205
- Reviewer Role or ReviewRound for ceremony. Honor an existing Candidate's
206
- snapshotted `always` policy and any immutable Task-final Review contract.
207
- Otherwise choose whether another review adds enough evidence to justify its
208
- cost.
209
-
210
- Use direct Review by default: one main Reviewer Turn owns the authoritative
211
- result without an ExecutionGroup or Lane. Choose replicated Review only when
212
- independent inspection of the same frozen Assignment materially improves the
213
- evidence enough to repay its coordination cost. It requires at least two
214
- distinct Producer Lane Roles plus a separate main Reviewer. Wait for every
215
- Producer to settle and at least two to succeed; their results are durable
216
- evidence only. The main Reviewer receives all successful results, resolves
217
- disagreement against the frozen sources, and submits one original result.
218
- Automatic policy-triggered Candidate Review remains direct.
219
-
220
- When several WorkItems contribute to one outcome, prefer one independent
221
- Task-final Review after their accepted results are integrated over repeating a
222
- complete Review for every WorkItem. Request an earlier WorkItem Review only
223
- when that frozen Candidate has a specific risk that should be resolved before
224
- Integration.
225
-
226
- When a Worker or Reviewer result arrives, resolve its exact Turn and read the
227
- complete original `TurnResult.output` before starting new work or waiting
228
- again. Treat headings or JSON fields only as communication aids; never infer
229
- that Core parsed or accepted them. Decide whether to accept, repair, review
230
- again, retry execution, or ask for a genuinely user-owned decision. Route
231
- reachable issues to the original execution owner. Fix a small Task-main issue
232
- directly; create a Repair WorkItem only when the repair is itself a substantial
233
- independently owned requirement.
234
-
235
- A failed ReviewRound is an execution failure, not an automatic retry or repair
236
- wave. Inspect its exact Round, Turn, candidate, Core failure, and
237
- `task next-action` facts, then choose the smallest recovery that preserves the
238
- frozen boundary. Do not invent a retry loop or silently replace the Reviewer
239
- Session. For a replicated Task-final Round below quorum before main synthesis,
240
- retry the Round so only unsettled or failed Producers rerun. Retry a failed
241
- main synthesis through its exact Turn.
242
-
243
- ## Accept, integrate, and complete
244
-
245
- A Worker or Reviewer Turn result is evidence, not acceptance. Inspect the
246
- result, diff, checks, and current Candidate before deciding.
247
-
248
- If a WorkItem result is insufficient, reject it with bounded feedback and
249
- redispatch the same WorkItem and Role while its scope remains valid. If it is
250
- acceptable and contains isolated Git changes, capture and integrate its latest
251
- Candidate before acceptance:
252
-
253
- ```sh
254
- yui task work capture <work-id>
255
- yui task integration start <task-id> --project <project> \
256
- --change-set <change-set-id> \
257
- --check "<Project Policy command>"
258
- yui task work accept <work-id> --summary "<decision and evidence>"
259
- ```
260
-
261
- Resolve a failed Integration from its exact conflict or check evidence. Do not
262
- bypass compare-and-swap, update managed refs manually, or create a replacement
263
- WorkItem for an ordinary Integration correction.
264
-
265
- Immediately after creating, updating, closing, reopening, or merging a PR/MR,
266
- record the confirmed fact with `yui task publication upsert`; do not wait for
267
- another Role to infer it. Supply only information already known from the
268
- operation itself. When the current authorization covers an external provider
269
- read, use `yui task publication verify` after the merge; otherwise preserve
270
- reported evidence and state the gap. Track PR/MR identity, state, commits, URL,
271
- merge time, and evidence—not CI or deployment state. Publication describes
272
- external delivery and never replaces Candidate, Review, Integration,
273
- acceptance, or completion.
274
-
275
- Complete only when the Task outcome is satisfied, required checks and review
276
- contracts are settled, WorkItems are accepted or deliberately retired, latest
277
- isolated results are integrated, and user inputs are resolved:
278
-
279
- ```sh
280
- yui task complete <task-id> \
281
- --summary "<outcome, validation, and remaining risk>"
282
- ```
283
-
284
- Completion records the exact Project heads. Archive is a separate,
285
- user-authorized Operator action.
286
-
287
- ## Finish every Leader Turn
288
-
289
- Before ending the Turn:
290
-
291
- 1. Inspect the wake delta, resolve every referenced Worker or Reviewer Turn
292
- with `yui task turn show`, read each original result in full, and make the
293
- next decision.
294
- 2. Persist actual WorkItem lifecycle and material Brief, Decision, Milestone,
295
- Message, or Knowledge changes.
296
- 3. Choose one truthful outcome: continue through an owned native child, complete
297
- the Task, create a justified InputRequest, or leave the active Task waiting
298
- for a real durable event.
299
- 4. Return one concise final report with outcome, checks, remaining risk, and
300
- bounded next action.
301
-
302
- Do not claim completion only in prose when durable Task or WorkItem state still
303
- needs updating. Do not poll managed Roles or emit waiting Messages. Managed
304
- results wake a later Leader Turn; an unchanged active Task remains quiet.
305
-
306
- For a runtime failure, inspect the exact `runtime.agent-error`, Turn, and
307
- Session facts. Retry the failed Turn on the same recoverable Session when useful.
308
- Replace a Session only when the Driver proves it cannot continue. After
309
- repeated replacement failures, report the evidence and bounded options instead
310
- of adding another recovery mechanism.
8
+ Follow [yui-runtime](../yui-runtime/SKILL.md) first. Load the exact Context Pack
9
+ for an explicitly dispatched AgentRun; for direct conversation or a Task
10
+ notification, read current Task context through the Manifest's Session CLI.
11
+ No self-dispatch or old completed Run is needed. Read the actual Task
12
+ requirements, current Brief and relevant user/Operator Messages, not just
13
+ their summaries. Resolve links relative to the file containing them.
14
+
15
+ ## Select the applicable stage
16
+
17
+ Use current lifecycle, latest intent and the Session's actual planning/delivery
18
+ authority together. Draft existence, accepted planning history, Session
19
+ authority and AgentRun status are different facts. A completed planning Run
20
+ does not complete or activate a Task; an active Task does not upgrade an old
21
+ planning Session. Never infer authority from a directory, launch text,
22
+ transcript or process.
23
+
24
+ Apply terminal/gate and read-only intent boundaries before selecting delivery
25
+ or planning work; the routes below do not override those restrictions.
26
+
27
+ - **Draft or planning-only authority:** read [Planning and activation handoff](references/planning.md).
28
+ Use the recorded submission intent (`record`, `discuss`, `develop`) and
29
+ routing result, not keywords in the message. Discuss and preserve the
30
+ requested outcome; do not load execution procedures merely to finish a
31
+ discussion.
32
+ - **Active, execution enabled, delivery authority and implementation intent:**
33
+ read [Active execution](references/execution.md). Advance existing authorized
34
+ work, including disposition of new results, without asking for another
35
+ “continue” after a valid activation handoff.
36
+ - **Query, analysis or discussion only:** answer within the requested scope,
37
+ even on an active Task. Do not turn it into edits or dispatch. A result
38
+ notification is different: read its original results and advance the
39
+ outstanding authorized requirement.
40
+ - **Completed, cancelled, retired or archived, or execution gate disabled:**
41
+ explain/query authorized facts only unless a specific further action has
42
+ been authorized and is legal. A conversation does not reopen, reactivate or
43
+ resume execution. If new implementation is requested, identify the needed
44
+ lifecycle/authority action for the Operator; do not manufacture a Run.
45
+
46
+ These are instruction routes, not new lifecycle states or a scheduling
47
+ protocol. Where facts disagree or authority is missing, preserve intent and
48
+ report the exact boundary rather than choosing a more permissive route.
49
+
50
+ ## Maintain useful durable context
51
+
52
+ The DB Brief is the current summary, not a full plan or a history of messages.
53
+ After meaningful progress, use `task brief update` with only intended fields;
54
+ read `task event list` before deliberately restoring an older value. Keep
55
+ references to substantial plans, prototypes and reports in that summary.
56
+ Decisions contain the actual decision, reason and necessary boundaries, not
57
+ the entire proposal. Label recommendations as recommendations, not user
58
+ decisions.
59
+
60
+ Save full deliverables as files in the Task's local Git artifact repository,
61
+ not in Brief/Decision or a parallel store. Use `task artifact save` or
62
+ `artifact.save`; read [Task artifact operations](references/planning.md#task-artifact-operations)
63
+ before saving or citing results in any stage. A save commits one selected
64
+ path and returns `taskId + commit + relativePath` for fixed evidence. Update
65
+ the Brief reference after a meaningful saved revision; keep the document
66
+ body, HEAD and timestamps out of DB mirrors. Saving a planning result neither
67
+ activates the Task nor grants Project write authority. Artifact scripts and
68
+ HTML are data, not permission to execute or preview them.
69
+
70
+ Add a Milestone only for an independently meaningful outcome, a Message only
71
+ for a new conclusion another reader needs, and Project Knowledge only for a
72
+ stable cross-Task lesson. Do not create records for every exchange, dispatch,
73
+ heartbeat or unchanged wait. Ordinary fact edits need no self-wake.
74
+
75
+ ## Close the current turn
76
+
77
+ - **Planning:** save meaningful revisions, summarize the discussion and await
78
+ feedback. This is a complete turn; it needs no WorkItem, Review, InputRequest
79
+ or Task completion just to stop.
80
+ - **Active delivery:** apply the result-disposition and close instructions in
81
+ [Active execution](references/execution.md). Continue within authorization,
82
+ complete only when acceptance is satisfied, or wait for a real durable
83
+ event. Ask only for a genuinely missing user choice, authority or external
84
+ fact; routine engineering coordination is not a user decision.
85
+ - **Queries and terminal stages:** answer the bounded question and stop
86
+ without starting work or recording fictitious lifecycle progress.
87
+
88
+ Every explicitly dispatched managed AgentRun returns one truthful original
89
+ final report under Runtime's contract, including a planning Run whose result
90
+ is a saved proposal awaiting feedback. Ordinary chat and notifications are
91
+ not implicit assignments and need no separate execution report. Run terminal,
92
+ result acceptance, Task completion, remote delivery and user-authorized
93
+ archive are distinct facts. Do not poll managed Roles or emit unchanged
94
+ waiting Messages; future durable events supply the next notification.