@zq-silk/yui 0.15.8 → 0.15.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/ARCHITECTURE.md +2 -0
  2. package/ARCHITECTURE.zh-CN.md +151 -0
  3. package/README.md +211 -14
  4. package/dist/agent/launchEnvironment.js +7 -0
  5. package/dist/artifacts/artifactCapability.js +74 -0
  6. package/dist/artifacts/artifactCommitLock.js +249 -0
  7. package/dist/artifacts/artifactPaths.js +151 -0
  8. package/dist/artifacts/gitArtifactRef.js +146 -0
  9. package/dist/artifacts/managedGit.js +332 -0
  10. package/dist/artifacts/taskArtifactRepository.js +277 -0
  11. package/dist/cli/commandCatalog.js +40 -16
  12. package/dist/cli/interactionPolicy.js +3 -3
  13. package/dist/cli/updateOrchestrator.js +24 -1
  14. package/dist/cli/updatePorts.js +7 -3
  15. package/dist/cli/upgradeCommand.js +42 -2
  16. package/dist/cli.js +403 -93
  17. package/dist/commands/globalRoleCommands.js +314 -4
  18. package/dist/commands/operatorCommands.js +33 -2
  19. package/dist/commands/projectCommands.js +6 -7
  20. package/dist/commands/releaseCommands.js +18 -0
  21. package/dist/commands/taskActivationCommands.js +22 -0
  22. package/dist/commands/taskActor.js +25 -0
  23. package/dist/commands/taskCommands.js +846 -155
  24. package/dist/commands/taskIntegrationCommands.js +16 -38
  25. package/dist/commands/taskIntegrationQueueCommands.js +1 -1
  26. package/dist/commands/taskRemoteDeliveryCommand.js +6 -6
  27. package/dist/commands/taskRoleRuntimeStatus.js +35 -0
  28. package/dist/context/runContextPack.js +28 -16
  29. package/dist/context/taskContext.js +64 -5
  30. package/dist/controller/agentHostObservation.js +155 -0
  31. package/dist/controller/clientRuntime.js +17 -2
  32. package/dist/controller/controller.js +11 -2
  33. package/dist/controller/fileSchedulerStoreAdapter.js +446 -13
  34. package/dist/controller/globalInputDelivery.js +119 -0
  35. package/dist/controller/jobControl.js +6 -2
  36. package/dist/controller/resourceInventory.js +14 -4
  37. package/dist/controller/resourceInventoryLinux.js +2 -6
  38. package/dist/controller/runtime.js +81 -6
  39. package/dist/controller/runtimeEventInbox.js +32 -3
  40. package/dist/controller/runtimeEventProcessor.js +26 -6
  41. package/dist/controller/runtimeHookRunFence.js +75 -19
  42. package/dist/controller/structuredProviderObservation.js +133 -70
  43. package/dist/coordination/workMailboxQueue.js +5 -0
  44. package/dist/execution/workItemExecutionProjection.js +1 -1
  45. package/dist/executor/agentExecutor.js +64 -4
  46. package/dist/executor/executorRegistry.js +3 -0
  47. package/dist/executor/fileRoleLaunchPlanner.js +78 -118
  48. package/dist/integration/deliveryObligation.js +2 -1
  49. package/dist/integration/gitIntegrationService.js +312 -382
  50. package/dist/integration/integrationAttempt.js +30 -4
  51. package/dist/integration/integrationQueueService.js +7 -7
  52. package/dist/integration/integrationSourceApplication.js +323 -0
  53. package/dist/kernel/builtinCapabilities.js +32 -24
  54. package/dist/message/globalInterrupt.js +33 -0
  55. package/dist/message/inputControlResolution.js +106 -0
  56. package/dist/message/message.js +423 -0
  57. package/dist/message/messageContinuation.js +126 -3
  58. package/dist/message/taskInterrupt.js +34 -0
  59. package/dist/observability/orchestrationMetrics.js +1 -1
  60. package/dist/plugins/pluginService.js +11 -3
  61. package/dist/release/releaseHandover.js +22 -0
  62. package/dist/release/releaseWorkflowPorts.js +15 -7
  63. package/dist/repository/gitWorkspace.js +72 -15
  64. package/dist/repository/taskWorkspaceCoordinator.js +134 -0
  65. package/dist/repository/taskWorkspacePreparer.js +120 -49
  66. package/dist/repository/workItemCandidateSnapshot.js +34 -0
  67. package/dist/resources/projectResource.js +0 -48
  68. package/dist/resources/projectResourceService.js +3 -81
  69. package/dist/resources/resourceDiscovery.js +3 -2
  70. package/dist/runtime/agentHost.js +152 -72
  71. package/dist/runtime/agentHostCompatibility.js +127 -0
  72. package/dist/runtime/agentHostProtocol.js +53 -0
  73. package/dist/runtime/executionEnvironment.js +0 -19
  74. package/dist/runtime/launchBroker.js +6 -0
  75. package/dist/runtime/sessionReconciliation.js +4 -4
  76. package/dist/runtime/taskRuntimeIsolation.js +30 -6
  77. package/dist/runtime/tmuxAdapters.js +5 -3
  78. package/dist/scheduler/operatorEvent.js +4 -0
  79. package/dist/scheduler/taskExecutionProjection.js +12 -1
  80. package/dist/scheduler/wakeReason.js +7 -1
  81. package/dist/scheduler/wakeupQueue.js +2 -0
  82. package/dist/setup/setupCommand.js +29 -16
  83. package/dist/storage/homeLayout.js +130 -0
  84. package/dist/storage/migrations/artifactsToGit.js +338 -0
  85. package/dist/storage/migrations/collapseWorktreeLayout.js +963 -0
  86. package/dist/storage/migrations/integrationContinuation.js +104 -0
  87. package/dist/storage/migrations/submitIntent.js +126 -0
  88. package/dist/storage/migrations/unifyHomeLayout.js +925 -0
  89. package/dist/storage/sqliteSchema.js +173 -7
  90. package/dist/storage/sqliteStore.js +41 -22
  91. package/dist/storage/storageVersions.js +1 -1
  92. package/dist/storage/storeRpc.js +2 -1
  93. package/dist/storage/upgrade/upgradeOrchestrator.js +95 -2
  94. package/dist/task/archiveDiagnostics.js +128 -0
  95. package/dist/task/nextAction.js +44 -11
  96. package/dist/task/taskActivation.js +26 -0
  97. package/dist/task/taskActivationService.js +85 -69
  98. package/dist/task/taskSubmission.js +236 -0
  99. package/dist/web/assets/client/app.js +58 -2
  100. package/dist/web/assets/client/components.js +1 -0
  101. package/dist/web/assets/client/i18n.js +6 -0
  102. package/dist/web/assets/client/taskSurface.js +202 -7
  103. package/dist/web/assets/client/view.js +7 -4
  104. package/dist/web/assets/shell.js +23 -0
  105. package/dist/web/assets/styles/layout.js +1 -1
  106. package/dist/web/assets/styles/widgets.js +12 -0
  107. package/dist/web/webServer.js +135 -4
  108. package/dist/web/webSnapshot.js +4 -3
  109. package/dist/web/webTaskSurface.js +225 -8
  110. package/dist/workItem/workItem.js +14 -10
  111. package/dist/workspace/workItemChangeSetManager.js +18 -2
  112. package/docs/agent-result-consumption.md +2 -0
  113. package/docs/agent-result-consumption.zh-CN.md +81 -0
  114. package/docs/agent-runtime-drivers.md +2 -0
  115. package/docs/agent-runtime-drivers.zh-CN.md +77 -0
  116. package/docs/architecture/README.md +44 -32
  117. package/docs/architecture/README.zh-CN.md +43 -0
  118. package/docs/architecture/capabilities-and-resources.md +118 -79
  119. package/docs/architecture/capabilities-and-resources.zh-CN.md +83 -0
  120. package/docs/managed-turn-and-session-runtime.md +2 -0
  121. package/docs/managed-turn-and-session-runtime.zh-CN.md +180 -0
  122. package/docs/observability/README.md +2 -0
  123. package/docs/observability/README.zh-CN.md +71 -0
  124. package/docs/plugin-sdk.md +320 -217
  125. package/docs/plugin-sdk.zh-CN.md +293 -0
  126. package/docs/provider-runtime.md +2 -0
  127. package/docs/provider-runtime.zh-CN.md +132 -0
  128. package/docs/release-workflow.md +41 -0
  129. package/docs/release-workflow.zh-CN.md +266 -0
  130. package/docs/roles-and-configuration.md +2 -0
  131. package/docs/roles-and-configuration.zh-CN.md +96 -0
  132. package/docs/sqlite-control-plane-design.md +225 -1
  133. package/docs/sqlite-control-plane-design.zh-CN.md +62 -0
  134. package/docs/task-dag-semantics.md +80 -57
  135. package/docs/task-dag-semantics.zh-CN.md +59 -0
  136. package/docs/task-delivery.md +2 -0
  137. package/docs/task-delivery.zh-CN.md +82 -0
  138. package/docs/task-local-identity.md +2 -0
  139. package/docs/task-local-identity.zh-CN.md +58 -0
  140. package/docs/testing/verification-levels.md +26 -0
  141. package/docs/testing/verification-levels.zh-CN.md +80 -0
  142. package/i18n/README.zh-CN.md +199 -10
  143. package/package.json +2 -1
  144. package/skills/yui-leader/SKILL.md +88 -331
  145. package/skills/yui-leader/references/execution.md +405 -0
  146. package/skills/yui-leader/references/integration.md +52 -2
  147. package/skills/yui-leader/references/planning.md +109 -0
  148. package/skills/yui-leader/references/task-plugins.md +8 -4
  149. package/skills/yui-operator/SKILL.md +22 -4
  150. package/skills/yui-runtime/SKILL.md +27 -0
  151. package/skills/yui-runtime/references/publication.md +20 -0
@@ -1,337 +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](../yui-runtime/SKILL.md) first. For explicit dispatch, load
9
- the exact AgentRun Context Pack and deltas. For direct user collaboration, read current Task context from
10
- your valid Leader Session; no active AgentRun or self-dispatch is required. Session
11
- identity grants management scope, not permission to bypass Assignment,
12
- planning/delivery, workspace or resource boundaries. Never infer authority
13
- from launch text, workspace layout, or transcript memory.
14
-
15
- Own Task direction, decomposition, acceptance, integration and durable context
16
- within the Runtime authority contract. Read current state and let Yui's
17
- transactional boundaries resolve races. Resolve Skill links relative to this
18
- Skill's directory.
19
-
20
- Read the actual user/Operator message bodies and current Brief, not only their
21
- IDs or summaries. Use that durable intent to decide and take the next action.
22
- In Draft, revise plans and independently owned requirements as discussion evolves;
23
- do not start delivery until requested. An activation request is that request to
24
- start: once the Task is active, continue from its durable facts without requiring
25
- the user to repeat "continue." Ordinary fact edits do not require a self-wake.
26
-
27
- ## Choose the simplest coherent result
28
-
29
- Start from the current Task Contract and trace the existing implementation,
30
- ownership and supported operating path before choosing a change. Establish
31
- whether a failure is reachable with the user's actual inputs and configuration;
32
- do not make a test fixture's accidental differences into new product policy.
33
-
34
- Choose the lowest total implementation, verification, coordination and
35
- maintenance cost that satisfies the contract. Reuse a coherent responsibility;
36
- redesign a misplaced boundary when that lowers the complete cost. Add a
37
- mechanism only for a demonstrated requirement or hard boundary that existing
38
- primitives cannot satisfy. Derived views must not become competing truth.
39
-
40
- Make routine legal choices yourself. Do not ask the user to choose among
41
- implementation patterns, scheduling options, review routing, or recoverable
42
- runtime actions. Create an InputRequest only for a real product choice, new
43
- authority, irreversible external effect, or unavailable external fact.
44
-
45
- ## Choose execution topology from ownership
46
-
47
- A WorkItem is one substantial requirement with an independent owner and useful
48
- acceptance boundary. It is not a container for every phase, file, test,
49
- finding, repair, or progress update. Task type, risk labels, file count, and
50
- subsystem names do not determine topology.
51
-
52
- Choose the smallest useful executor:
53
-
54
- 1. **Leader directly** when current context, authority, and tools are enough.
55
- 2. **Native subagent** for bounded specialist attention or parallel
56
- investigation inside the current Agent Session when a best-effort child
57
- result is sufficient.
58
- 3. **Task Role AgentRun** when work needs independent durable ownership, a distinct
59
- Agent/provider or credential set, a managed workspace, or a separately
60
- recoverable Session and AgentRun lifecycle.
61
-
62
- Create multiple WorkItems only when their requirements can make useful
63
- independent progress, normally in parallel, and the coordination and
64
- Integration cost is lower than keeping one coherent owner. Keep coupled
65
- changes together.
66
-
67
- An ordinary WorkItem uses its assignee directly; dispatch without `--lane-role`.
68
- Use [replicated execution](references/replicated-execution.md) only when
69
- independent attempts over the same frozen Assignment repay their coordination
70
- cost. Direct managed execution already provides durable ownership.
71
-
72
- ## Give Agents outcomes, not premature implementations
73
-
74
- Make delegated work decision-complete:
75
-
76
- - objective and observable acceptance criteria;
77
- - relevant Task and Project context;
78
- - hard scope, authority, and workspace boundaries;
79
- - known constraints, risks, dependencies, and existing decisions; and
80
- - expected checks and evidence.
81
-
82
- Let the receiving Agent choose its implementation plan, internal structure, and
83
- tools unless a particular ordering or mechanism is itself part of the accepted
84
- contract. Do not encode the Leader's speculative design as mandatory Worker
85
- steps.
86
-
87
- For Project-backed work, use the Project Skills, Policy, and Knowledge exposed
88
- through current context. Keep repository-specific build, migration, release,
89
- and test rules in that Project-owned layer.
90
-
91
- ## Keep durable context useful
92
-
93
- Use `yui task context <task-id>` and `yui task next-action <task-id>` as
94
- decision support. They expose current facts, exact refs, and legal
95
- alternatives; they do not replace Leader judgment.
96
- An empty WorkItem list does not mean the user requested direct execution.
97
- Honor explicit delegation and independent Review requirements in the user's
98
- messages and Task Brief. Neither `next-action` nor a disabled default review
99
- policy authorizes dropping them to make completion easier.
100
-
101
- An Integration Job's success is not the final target update. For that
102
- notification, read [Integration](references/integration.md) and finish the same
103
- attempt; do not start a duplicate operation.
104
-
105
- Before dispatch, Review, Integration, or completion, inspect
106
- `liveTaskState.activeRuns` and `liveTaskState.activeTaskReviews` in the current
107
- Context Pack. They report work in flight but gate nothing by themselves; reason
108
- from each exact binding and frozen candidate instead of treating activity as a
109
- global Task lock.
110
-
111
- Maintain only context that changes future decisions:
112
-
113
- - Keep the Brief current after material semantic progress. Use
114
- `task brief update` with only intended fields; same-field edits use the last
115
- explicit write. Read `task event list` before deliberately restoring a value.
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 run 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
- Dispatch establishes the first owner and frozen Assignment. For ordinary
130
- clarification, feedback or a continuation of that same work, send a Message:
131
-
132
- ```sh
133
- yui task message send <task> "<clarification or continuation>" --to <role> --work-item <work-id>
134
- yui task message send <task> "<review clarification>" --to <role> --review-round <round-id>
135
- ```
136
-
137
- Busy execution queues the Message. Its terminal triggers continuation in the
138
- same compatible Session and workspace; do not fabricate a failure, submit an
139
- unfinished Candidate, or change WorkItem status merely to answer a question.
140
- Read Message delivery and the exact resulting AgentRun separately from business
141
- acceptance. A Message never expands scope, applies desired configuration, or
142
- changes a Review's frozen candidate. An ownership change preserves the original
143
- recipient; transfer still-pending input only with explicit `task message handoff`.
144
- Late input to terminal work or an obsolete Review remains visible with a bounded
145
- nondelivery reason. Use the existing formal operation for new scope or Review.
146
-
147
- For unknown delivery or Session replacement, read
148
- [runtime recovery](../yui-runtime/references/recovery.md). Preserve the original
149
- input; do not replay uncertainty or treat it as a global Task lock.
150
-
151
- For direct work, change only Task main, keep it on its managed branch, commit
152
- the result, and leave it clean. Run the smallest check that can catch the
153
- changed behavior while implementing.
154
-
155
- For a substantial delegated requirement:
156
-
157
- ```sh
158
- yui task work create <task-id> "<title>" \
159
- --project <project-to-modify> \
160
- --objective "<bounded outcome>" \
161
- --accept "<observable criterion>"
162
- ```
163
-
164
- Add `--after` only for a real dependency. Likely file overlap is not by itself
165
- a dependency. A Worker may read the complete authorized Task context but may
166
- write only its WorkItem Projects and workspace.
167
-
168
- For a Leader-owned WorkItem, mark it running, complete it directly, then record
169
- its actual result:
170
-
171
- ```sh
172
- yui task work update <work-id> running
173
- yui task work update <work-id> done --summary "<result and evidence>"
174
- yui task work accept <work-id> --summary "<explicit acceptance and evidence>"
175
- ```
176
-
177
- For a native child, pass a bounded brief and applicable Profile constraints
178
- through the provider's child tools. A small investigation needs no synthetic
179
- WorkItem. If the child implements an existing Leader-owned WorkItem, keep that
180
- WorkItem roleless and mark it running. Native children inherit only current
181
- parent authority and gain no Yui Role, AgentRun, Session or broader workspace. Their
182
- results are best-effort until Yui externalizes them; use a managed Task Role
183
- when independent durability matters. Inspect the returned result before
184
- submitting `done` or recording failure progress. `done` creates a Candidate;
185
- `work accept` records the separate acceptance. WorkItem responsibility remains
186
- open through execution failure and becomes accepted only on that decision.
187
- A Profile's runtime source applies when
188
- materializing a Task Role, not when launching a native child. The child
189
- inherits the Leader Agent; apply a Profile model or effort only when the native
190
- tool actually supports and confirms that override.
191
-
192
- For a managed Task Role:
193
-
194
- ```sh
195
- yui task role add <task-id> <role> --profile <profile>
196
- yui task role show <task-id> <role>
197
- yui task work create <task-id> "<outcome>" --role <role>
198
- yui task work dispatch <work-id> --input "<decision-complete brief>"
199
- ```
200
-
201
- Profiles carry portable behavior plus either a dynamic Global Worker runtime
202
- source or an explicit Agent with optional model and effort. Applying a Profile
203
- to a Task Role resolves and freezes the complete binding; later Profile or
204
- Global Worker changes do not rewrite that Role. Before dispatch, use
205
- `profile show` and `task role show` to read the exact behavior, Agent, model,
206
- effort, Profile, and workspace. Do not reconstruct or guess launch
207
- configuration. Use the WorkItem assignee directly unless replicated execution
208
- was deliberately selected.
209
-
210
- Managed Task main, WorkItem, ReviewRound, and Integration workspaces have
211
- different owners. Never edit stable Project checkouts, managed refs, Yui state
212
- files, or another owner's workspace. A Task's recorded base is durable; do not
213
- silently replace it merely because its remote branch later moves.
214
-
215
- ## Extend capabilities within this Task's authority
216
-
217
- Use `capability search`, `describe`, and `call` to inspect current tools.
218
- Prefer existing tools, composition or a one-off script when sufficient.
219
- For reusable Task-local capabilities, read [Task plugins](references/task-plugins.md)
220
- before creation, validation or activation. Plugin management permission does
221
- not grant code execution or broader external effects. Never issue your own
222
- grants, impersonate Operator, or modify the core installation to obtain a tool.
223
-
224
- ## Validate and make the review judgment
225
-
226
- Use the smallest evidence that establishes the accepted behavior and material
227
- boundaries. Do not repeat a successful unchanged check. Run the Project's
228
- complete local delivery validation once on the final candidate when its Policy
229
- requires it.
230
-
231
- As part of accepting a WorkItem or completing a Task, decide whether additional
232
- review would add useful evidence:
233
-
234
- - inspect directly when the change is clear and existing evidence is enough;
235
- - use one independent Worker, native child, or Reviewer when independent
236
- inspection materially reduces a reachable risk; or
237
- - rely on an already completed applicable Review.
238
-
239
- This is Leader judgment inside the acceptance decision, not a separate record,
240
- checklist, or workflow phase. A managed Reviewer is optional unless the user,
241
- Project or Task Contract requires it. Do not create a
242
- Reviewer Role or ReviewRound for ceremony. Honor an existing Candidate's
243
- snapshotted `always` policy and any immutable Task-final Review contract.
244
- Otherwise choose whether another review adds enough evidence to justify its
245
- cost.
246
-
247
- Use one direct main Reviewer by default. If independent replicas materially
248
- improve evidence, read [replicated execution](references/replicated-execution.md)
249
- before dispatch or synthesis. Honor required review contracts even when a
250
- cheaper execution path is otherwise available.
251
-
252
- When several WorkItems contribute to one outcome, prefer one independent
253
- Task-final Review after their accepted results are integrated over repeating a
254
- complete Review for every WorkItem. Request an earlier WorkItem Review only
255
- when that frozen Candidate has a specific risk that should be resolved before
256
- Integration.
257
-
258
- When a Worker or Reviewer result arrives, resolve its exact AgentRun and read the
259
- complete original `AgentRunResult.output` before starting new work or waiting
260
- again. Treat headings or JSON fields only as communication aids; never infer
261
- that Core parsed or accepted them. Decide whether to accept, repair, review
262
- again, retry execution, or ask for a genuinely user-owned decision. Route
263
- reachable issues to the original execution owner. Fix a small Task-main issue
264
- directly; create a Repair WorkItem only when the repair is itself a substantial
265
- independently owned requirement.
266
-
267
- A failed ReviewRound is an execution failure, not an automatic retry or repair
268
- wave. Inspect its exact Round, AgentRun, candidate, Core failure, and
269
- `task next-action` facts, then choose the smallest recovery that preserves the
270
- frozen boundary. Do not invent a retry loop or silently replace the Reviewer
271
- Session. For replicated execution, choose whether to retry a failed Producer,
272
- settle that Lane, or synthesize selected available results. Retry a failed
273
- main synthesis through its exact AgentRun, preserving its selected source snapshot.
274
-
275
- ## Accept, integrate, and complete
276
-
277
- A Worker or Reviewer AgentRun result is evidence, not acceptance. Inspect the
278
- result, diff, checks, and current Candidate before deciding.
279
-
280
- If a result is insufficient, reject it with bounded feedback and redispatch
281
- the same WorkItem and Role while scope remains valid. Before accepting isolated
282
- Git changes, read [Integration](references/integration.md) to capture and
283
- integrate the latest Candidate. Do not edit managed refs or bypass Yui's
284
- compare-and-swap boundary.
285
-
286
- After an authorized PR/MR operation, follow
287
- [publication recording](../yui-runtime/references/publication.md).
288
- External delivery and Task completion remain separate facts.
289
-
290
- After a ReviewRound is terminal, the Leader or authorized Operator owns
291
- `task work review cleanup <task>/<round>`. Preserve dirty diagnostic evidence
292
- and resolve it explicitly; do not ask a Reviewer to clean its own runtime
293
- after its final report. Cleanup can remain advisory at completion, but all
294
- required resources must be settled before user-authorized archive.
295
-
296
- Complete only when the Task outcome is satisfied, required checks and review
297
- contracts are settled, WorkItems are accepted or deliberately retired, latest
298
- isolated results are integrated, and user inputs are resolved:
299
-
300
- ```sh
301
- yui task complete <task-id> \
302
- --summary "<outcome, validation, and remaining risk>"
303
- ```
304
-
305
- Completion records the exact Project heads. Archive is a separate,
306
- user-authorized Operator action.
307
-
308
- If completion reports `pending-user-input`, new user intent has not yet reached
309
- the current notification window. End this native turn so the next notification
310
- can be delivered, then read the original messages and reassess the outcome.
311
- Do not spin on completion, drop messages, or manufacture another Run to proceed.
312
- A current Leader Session can create a formal InputRequest during an ordinary
313
- notification; no active AgentRun is required.
314
-
315
- ## Finish every Leader AgentRun
316
-
317
- Before ending the AgentRun:
318
-
319
- 1. Inspect the wake delta, resolve every referenced Worker or Reviewer AgentRun
320
- with `yui task run show`, read each original result in full, and make the
321
- next decision.
322
- 2. Persist actual WorkItem lifecycle and material Brief, Decision, Milestone,
323
- Message, or Knowledge changes.
324
- 3. Choose one truthful outcome: continue through an owned native child, complete
325
- the Task, create a justified InputRequest, or leave the active Task waiting
326
- for a real durable event.
327
- 4. Return one concise final report with outcome, checks, remaining risk, and
328
- bounded next action.
329
-
330
- Do not claim completion only in prose when durable Task or WorkItem state still
331
- needs updating. Do not poll managed Roles or emit waiting Messages. Managed
332
- results enter a later Leader notification; that notification is not an implicit
333
- AgentRun and requires no separate execution report. An unchanged active Task remains quiet.
334
-
335
- Use the shared [runtime recovery](../yui-runtime/references/recovery.md) contract
336
- for failed execution. Persist successor context before replacing yourself,
337
- then end this turn; engineering cleanup is not discarded Task intent.
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.