@zq-silk/yui 0.15.6 → 0.15.8

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 (282) hide show
  1. package/ARCHITECTURE.md +192 -399
  2. package/README.md +127 -1149
  3. package/dist/agent/adapterCatalog.js +15 -2
  4. package/dist/agent/agent.js +23 -3
  5. package/dist/agent/argumentPolicy.js +7 -1
  6. package/dist/agent/connectionPlan.js +62 -0
  7. package/dist/agent/executionComponents.js +158 -0
  8. package/dist/agent/launchEnvironment.js +31 -3
  9. package/dist/agent/managedRuntimeEnvironment.js +3 -5
  10. package/dist/{turn/turn.js → agentRun/agentRun.js} +166 -109
  11. package/dist/{turn/turnIdentity.js → agentRun/runIdentity.js} +4 -4
  12. package/dist/brief/taskBrief.js +12 -0
  13. package/dist/cli/agentConfigurationPicker.js +13 -0
  14. package/dist/cli/commandCatalog.js +167 -70
  15. package/dist/cli/interactionCandidates.js +5 -5
  16. package/dist/cli/interactionPolicy.js +38 -8
  17. package/dist/cli/invocationRouter.js +1 -1
  18. package/dist/cli/managedDiagnostics.js +28 -0
  19. package/dist/cli/operatorWizard.js +1 -7
  20. package/dist/cli/roleOptionOrder.js +27 -0
  21. package/dist/cli/roleWizard.js +50 -14
  22. package/dist/cli/updateOrchestrator.js +1 -1
  23. package/dist/cli/updatePorts.js +3 -4
  24. package/dist/cli.js +188 -95
  25. package/dist/commands/agentCommands.js +72 -14
  26. package/dist/commands/capabilityCommands.js +57 -0
  27. package/dist/commands/configCommands.js +20 -20
  28. package/dist/commands/deliveryGuardPreflight.js +2 -2
  29. package/dist/commands/executionAuditCommands.js +24 -24
  30. package/dist/commands/globalRoleCommands.js +1 -1
  31. package/dist/commands/grantCommands.js +4 -4
  32. package/dist/commands/operatorCommands.js +1 -7
  33. package/dist/commands/projectCommands.js +4 -4
  34. package/dist/commands/resourcesCommands.js +2 -2
  35. package/dist/commands/roleConfiguration.js +25 -5
  36. package/dist/commands/roleRuntimeGuard.js +4 -5
  37. package/dist/commands/sessionCommands.js +3 -7
  38. package/dist/commands/taskActivationCommands.js +259 -0
  39. package/dist/commands/taskActor.js +28 -49
  40. package/dist/commands/taskCommands.js +1216 -730
  41. package/dist/commands/taskContextCommand.js +39 -583
  42. package/dist/commands/taskExecutionCommands.js +32 -32
  43. package/dist/commands/taskInputCommands.js +40 -104
  44. package/dist/commands/taskIntegrationCommands.js +3 -2
  45. package/dist/commands/taskIntegrationQueueCommands.js +1 -1
  46. package/dist/commands/taskNextActionCommand.js +8 -8
  47. package/dist/commands/taskOverviewCommand.js +33 -45
  48. package/dist/commands/taskRemoteDeliveryCommand.js +2 -2
  49. package/dist/commands/taskRoleRuntimeStatus.js +133 -102
  50. package/dist/commands/telemetryCommands.js +36 -38
  51. package/dist/config/configCatalog.js +4 -4
  52. package/dist/config/yuiConfig.js +8 -8
  53. package/dist/context/contextSnapshot.js +10 -10
  54. package/dist/context/dispatchContext.js +11 -11
  55. package/dist/context/roleSessionContext.js +6 -3
  56. package/dist/context/{turnContextPack.js → runContextPack.js} +146 -81
  57. package/dist/context/{turnInputContract.js → runInputContract.js} +73 -60
  58. package/dist/context/sessionBootstrapManifest.js +21 -2
  59. package/dist/context/sourceRunContext.js +30 -0
  60. package/dist/context/taskContext.js +458 -0
  61. package/dist/context/wakeNotification.js +27 -27
  62. package/dist/controller/agentRuntimeObserver.js +21 -24
  63. package/dist/controller/capabilityBridge.js +77 -0
  64. package/dist/controller/clientRuntime.js +65 -92
  65. package/dist/controller/controller.js +127 -188
  66. package/dist/controller/fileSchedulerStoreAdapter.js +787 -887
  67. package/dist/controller/jobControl.js +54 -85
  68. package/dist/controller/resourceInventory.js +8 -27
  69. package/dist/controller/resourceInventoryLinux.js +12 -13
  70. package/dist/controller/runtime.js +530 -476
  71. package/dist/controller/runtimeEventInbox.js +55 -25
  72. package/dist/controller/runtimeEventProcessor.js +22 -31
  73. package/dist/controller/{runtimeHookTurnFence.js → runtimeHookRunFence.js} +91 -115
  74. package/dist/controller/runtimeLaunchCoordinator.js +80 -426
  75. package/dist/controller/runtimeObservationHook.js +14 -18
  76. package/dist/controller/sessionNotify.js +16 -24
  77. package/dist/controller/sessionOwnerReconciliation.js +168 -50
  78. package/dist/controller/structuredProviderObservation.js +138 -99
  79. package/dist/coordination/workMailbox.js +3 -3
  80. package/dist/coordination/workMailboxQueue.js +36 -33
  81. package/dist/core/boundedRpc.js +8 -1
  82. package/dist/core/controllerClient.js +20 -1
  83. package/dist/core/controllerServer.js +4 -4
  84. package/dist/doctor/doctor.js +13 -2
  85. package/dist/domain/agentResultTransport.js +9 -9
  86. package/dist/execution/codexThreadNaming.js +2 -8
  87. package/dist/execution/executionHealth.js +51 -63
  88. package/dist/execution/reviewMainRun.js +137 -0
  89. package/dist/execution/workItemExecution.js +28 -29
  90. package/dist/execution/workItemExecutionProjection.js +99 -107
  91. package/dist/execution/workItemMainRun.js +141 -0
  92. package/dist/executor/agentAdapter.js +227 -20
  93. package/dist/executor/agentConfigurationCatalog.js +126 -4
  94. package/dist/executor/agentConfigurationProbe.js +162 -4
  95. package/dist/executor/agentExecutor.js +79 -78
  96. package/dist/executor/effectiveLaunch.js +105 -18
  97. package/dist/executor/executorRegistry.js +29 -44
  98. package/dist/executor/fileRoleLaunchPlanner.js +229 -154
  99. package/dist/executor/workspacePreflightClassification.js +16 -16
  100. package/dist/grant/capabilityGrant.js +6 -3
  101. package/dist/input/inputRequest.js +12 -10
  102. package/dist/integration/gitIntegrationService.js +4 -11
  103. package/dist/integration/integrationQueueService.js +4 -4
  104. package/dist/interaction/operatorPresentation.js +1 -1
  105. package/dist/kernel/builtinCapabilities.js +423 -0
  106. package/dist/kernel/capabilityRegistry.js +314 -0
  107. package/dist/kernel/capabilitySchema.js +91 -0
  108. package/dist/kernel/instanceHost.js +18 -1
  109. package/dist/kernel/kernelPorts.js +4 -1
  110. package/dist/lifecycle/canonicalLifecycleEvent.js +44 -49
  111. package/dist/lifecycle/exactRunTerminalization.js +449 -0
  112. package/dist/message/message.js +62 -6
  113. package/dist/message/messageContinuation.js +204 -0
  114. package/dist/observability/executionAudit.js +70 -72
  115. package/dist/observability/faultClassification.js +2 -2
  116. package/dist/observability/orchestrationMetrics.js +8 -8
  117. package/dist/operator/operatorSessionHistory.js +1 -7
  118. package/dist/output/agentConfigurationPresentation.js +8 -3
  119. package/dist/output/agentRunConfigurationPresentation.js +128 -0
  120. package/dist/output/rolePresentation.js +54 -3
  121. package/dist/plugins/pluginChild.js +104 -0
  122. package/dist/plugins/pluginIntent.js +26 -0
  123. package/dist/plugins/pluginInterpreter.js +43 -0
  124. package/dist/plugins/pluginPackage.js +101 -0
  125. package/dist/plugins/pluginProcess.js +112 -0
  126. package/dist/plugins/pluginService.js +380 -0
  127. package/dist/profile/agentProfile.js +1 -1
  128. package/dist/repository/gitWorkspace.js +26 -4
  129. package/dist/repository/project.js +19 -4
  130. package/dist/repository/taskBaseFreshness.js +13 -13
  131. package/dist/repository/taskWorkspaceCoordinator.js +20 -27
  132. package/dist/repository/taskWorkspacePreparer.js +344 -83
  133. package/dist/resources/autoResourceGc.js +3 -3
  134. package/dist/resources/liveReferences.js +3 -3
  135. package/dist/resources/projectResource.js +123 -0
  136. package/dist/resources/projectResourceService.js +421 -0
  137. package/dist/resources/resourceDiscovery.js +6 -6
  138. package/dist/resources/resourceGc.js +1 -1
  139. package/dist/resources/resourceRegistrar.js +1 -1
  140. package/dist/resources/resourceTypes.js +1 -1
  141. package/dist/review/deltaRecheck.js +3 -3
  142. package/dist/review/reviewAcceptance.js +16 -16
  143. package/dist/review/reviewDecision.js +7 -7
  144. package/dist/review/reviewRound.js +21 -20
  145. package/dist/review/reviewerAvailability.js +2 -2
  146. package/dist/role/role.js +51 -7
  147. package/dist/role/taskRoleUpdate.js +30 -0
  148. package/dist/runtime/acpProtocol.js +425 -0
  149. package/dist/runtime/acpSession.js +731 -0
  150. package/dist/runtime/acpSessionConfiguration.js +260 -0
  151. package/dist/runtime/agentDriver.js +30 -11
  152. package/dist/runtime/agentEndpoint.js +278 -0
  153. package/dist/runtime/agentEndpointIdentity.js +86 -0
  154. package/dist/runtime/agentEndpointOwnership.js +239 -0
  155. package/dist/runtime/agentError.js +2 -10
  156. package/dist/runtime/agentHost.js +565 -314
  157. package/dist/runtime/agentRunConfiguration.js +258 -0
  158. package/dist/runtime/builtinAgentDrivers.js +134 -18
  159. package/dist/runtime/builtinAgentErrorMappers.js +55 -3
  160. package/dist/runtime/builtinTranscriptUsage.js +1 -1
  161. package/dist/runtime/claude-process-owner +0 -0
  162. package/dist/runtime/codexAppServerRuntime.js +38 -30
  163. package/dist/runtime/codexInteractiveHost.js +41 -6
  164. package/dist/runtime/continuationManager.js +2 -6
  165. package/dist/runtime/executionEnvironment.js +30 -0
  166. package/dist/runtime/firstProgressAdvisory.js +11 -11
  167. package/dist/runtime/index.js +4 -3
  168. package/dist/runtime/jsonLineChannel.js +109 -0
  169. package/dist/runtime/launchBroker.js +91 -16
  170. package/dist/runtime/launchDiagnostics.js +2 -2
  171. package/dist/runtime/lifecycleReservation.js +10 -18
  172. package/dist/runtime/managedCaller.js +61 -17
  173. package/dist/runtime/nativeSessionControl.js +102 -0
  174. package/dist/runtime/ports.js +6 -21
  175. package/dist/runtime/processExitObservation.js +8 -7
  176. package/dist/runtime/promptEnvelope.js +17 -6
  177. package/dist/runtime/providerContinuation.js +3 -9
  178. package/dist/runtime/providerContinuationReconciliationService.js +4 -13
  179. package/dist/runtime/providerControl.js +2 -7
  180. package/dist/runtime/providerRuntimeIdentity.js +110 -222
  181. package/dist/runtime/providerRuntimeReconciler.js +5 -9
  182. package/dist/runtime/runtimeBinding.js +0 -1
  183. package/dist/runtime/runtimeContinuationProjection.js +4 -7
  184. package/dist/runtime/runtimeDeadlines.js +9 -0
  185. package/dist/runtime/runtimeHealthPolicy.js +1 -1
  186. package/dist/runtime/runtimeObservation.js +29 -65
  187. package/dist/runtime/runtimeProjection.js +43 -51
  188. package/dist/runtime/runtimeSessionCandidate.js +1 -3
  189. package/dist/runtime/sessionLaunchRequest.js +3 -7
  190. package/dist/runtime/sessionOwnerIdentity.js +7 -54
  191. package/dist/runtime/sessionOwnerRegistry.js +22 -17
  192. package/dist/runtime/sessionReconciliation.js +4 -8
  193. package/dist/runtime/sessionTerminationGuard.js +70 -259
  194. package/dist/runtime/sessionTokenMetrics.js +5 -16
  195. package/dist/runtime/structuredProviderHost.js +237 -117
  196. package/dist/runtime/taskRuntimeIsolation.js +39 -122
  197. package/dist/runtime/tmuxAdapters.js +39 -86
  198. package/dist/scheduler/activeRoleRunDelivery.js +354 -0
  199. package/dist/scheduler/leaderWakeupProcessor.js +75 -266
  200. package/dist/scheduler/operatorInputNotificationProcessor.js +1 -1
  201. package/dist/scheduler/ports.js +80 -9
  202. package/dist/scheduler/{roleTurnLiveness.js → roleRunLiveness.js} +26 -30
  203. package/dist/scheduler/{roleTurnStall.js → roleRunStall.js} +128 -139
  204. package/dist/scheduler/taskExecutionProjection.js +120 -124
  205. package/dist/scheduler/taskObservabilityProjection.js +29 -29
  206. package/dist/scheduler/taskWake.js +11 -4
  207. package/dist/scheduler/wakeReason.js +9 -1
  208. package/dist/setup/setupCommand.js +1 -0
  209. package/dist/storage/migrations/agentRunContract.js +159 -0
  210. package/dist/storage/migrations/removeRuntimeGeneration.js +207 -0
  211. package/dist/storage/sqliteSchema.js +431 -5
  212. package/dist/storage/sqliteStore.js +375 -220
  213. package/dist/storage/storageVersions.js +1 -1
  214. package/dist/storage/storeRpc.js +10 -5
  215. package/dist/storage/taskStore.js +13 -11
  216. package/dist/storage/upgrade/upgradeOrchestrator.js +5 -7
  217. package/dist/surface/surfaceContributions.js +102 -0
  218. package/dist/task/completionReadiness.js +32 -6
  219. package/dist/task/deliveryGuard.js +16 -16
  220. package/dist/task/draftPlan.js +72 -12
  221. package/dist/task/nextAction.js +144 -128
  222. package/dist/task/remoteDelivery.js +6 -6
  223. package/dist/task/task.js +184 -18
  224. package/dist/task/taskActivation.js +301 -0
  225. package/dist/task/taskActivationService.js +392 -0
  226. package/dist/task/taskRecordReference.js +5 -4
  227. package/dist/task/taskRecordRetirement.js +1 -1
  228. package/dist/telemetry/sqliteTelemetryStore.js +55 -68
  229. package/dist/telemetry/telemetryConfig.js +14 -14
  230. package/dist/telemetry/telemetryWiring.js +2 -2
  231. package/dist/web/assets/assetManifest.js +2 -0
  232. package/dist/web/assets/client/app.js +120 -20
  233. package/dist/web/assets/client/components.js +87 -54
  234. package/dist/web/assets/client/i18n.js +83 -41
  235. package/dist/web/assets/client/markdown.js +1 -1
  236. package/dist/web/assets/client/taskSurface.js +353 -0
  237. package/dist/web/assets/client/view.js +49 -44
  238. package/dist/web/assets/shell.js +1 -1
  239. package/dist/web/assets/styles/cards.js +22 -4
  240. package/dist/web/controllerWeb.js +60 -0
  241. package/dist/web/webMutation.js +28 -0
  242. package/dist/web/webServer.js +118 -8
  243. package/dist/web/webSnapshot.js +81 -74
  244. package/dist/web/webTaskSurface.js +64 -0
  245. package/dist/workItem/dependencyGate.js +1 -1
  246. package/dist/workItem/workItem.js +80 -48
  247. package/dist/workspace/workItemChangeSetManager.js +16 -9
  248. package/docs/agent-result-consumption.md +94 -0
  249. package/docs/agent-runtime-drivers.md +91 -0
  250. package/docs/architecture/README.md +38 -0
  251. package/docs/architecture/capabilities-and-resources.md +79 -0
  252. package/docs/managed-turn-and-session-runtime.md +222 -0
  253. package/docs/observability/README.md +81 -0
  254. package/docs/plugin-sdk.md +290 -0
  255. package/docs/provider-runtime.md +163 -0
  256. package/docs/release-workflow.md +303 -0
  257. package/docs/roles-and-configuration.md +113 -0
  258. package/docs/sqlite-control-plane-design.md +76 -0
  259. package/docs/task-dag-semantics.md +57 -0
  260. package/docs/task-delivery.md +103 -0
  261. package/docs/task-local-identity.md +6 -6
  262. package/docs/testing/verification-levels.md +86 -0
  263. package/i18n/README.zh-CN.md +98 -739
  264. package/package.json +5 -5
  265. package/skills/yui-leader/SKILL.md +130 -103
  266. package/skills/yui-leader/references/integration.md +39 -0
  267. package/skills/yui-leader/references/replicated-execution.md +42 -0
  268. package/skills/yui-leader/references/task-plugins.md +33 -0
  269. package/skills/yui-operator/SKILL.md +30 -59
  270. package/skills/yui-reviewer/SKILL.md +35 -36
  271. package/skills/yui-runtime/SKILL.md +88 -24
  272. package/skills/yui-runtime/references/publication.md +22 -0
  273. package/skills/yui-runtime/references/recovery.md +64 -0
  274. package/skills/yui-worker/SKILL.md +37 -39
  275. package/dist/cli/roleOptionCatalog.js +0 -68
  276. package/dist/context/sourceTurnContext.js +0 -30
  277. package/dist/execution/reviewMainTurn.js +0 -161
  278. package/dist/execution/workItemMainTurn.js +0 -164
  279. package/dist/lifecycle/exactTurnTerminalization.js +0 -407
  280. package/dist/runtime/preallocatedNativeSession.js +0 -13
  281. package/dist/runtime/runtimeStopReceipt.js +0 -42
  282. package/dist/scheduler/activeRoleTurnDelivery.js +0 -315
package/ARCHITECTURE.md CHANGED
@@ -1,399 +1,192 @@
1
- # Yui Architecture
2
-
3
- Yui is a local control plane for intelligent Agents doing durable work across
4
- Projects and native runtimes. The user talks to one Operator. The Operator
5
- routes each request to the right Project and Task; that Task's Leader owns
6
- decomposition, execution choice, review, integration, and completion.
7
-
8
- ## Design principles
9
-
10
- - **Agents own judgment.** Yui exposes current durable context and atomic
11
- capabilities; the Operator, Leader, and Workers choose plans, execution
12
- topology, sequencing, retry, and recovery from that context.
13
- - **Core provides primitives, not a prescribed workflow.** Reads, messages,
14
- bounded record transitions, workspace ownership, Session lifecycle, and
15
- acceptance are composable operations. Project Skills and Knowledge provide
16
- project-specific policy without adding core branches.
17
- - **Durable intent outranks runtime continuity.** Tasks, WorkItems, Messages,
18
- Decisions, results, Project Knowledge, and managed workspaces are authority.
19
- Provider Sessions, transcripts, processes, and observations are execution
20
- aids that may be resumed or replaced.
21
- - **Trust explicit Agent actions.** Once identity, authority, and scope are
22
- established, a valid Agent command is a semantic declaration. Core should not
23
- reconstruct the same judgment through another status protocol.
24
- - **Fail visibly and let the Agent adapt.** Preserve pending intent and return
25
- actionable state. Add automated retry, recovery, leases, or fallback only for
26
- a normal product path, a hard safety or data-integrity boundary, or a proven
27
- failure whose cost justifies the machinery.
28
- - **One question has one authority.** Projections and indexes may summarize
29
- state, but scheduling and lifecycle decisions must not depend on independently
30
- writable copies of the same fact.
31
-
32
- ## One outcome, Leader-chosen execution topology
33
-
34
- `Task` is the bounded user outcome. Its optional `type` describes intent, not
35
- execution topology; software Projects normally use `feature` or `bugfix`, while
36
- other Projects may define their own types. Yui does not store a Task-level
37
- direct versus integrated delivery mode. The `direct` and `replicated` labels
38
- below describe only the execution shape of one WorkItem.
39
-
40
- A software bugfix is Leader-owned: the Leader implements and verifies it in the
41
- managed Task main without manufacturing a WorkItem. If the scope proves to need
42
- independent delivery owners, reclassify it as a feature before creating those
43
- units. For a feature, the Leader judges whether the whole result is small
44
- enough to own in the same way or large enough to need independently owned
45
- delivery units.
46
-
47
- Operator updates have one durable path. Domain and runtime transitions first
48
- append an immutable TaskEvent; user-owned questions append an InputRequest.
49
- Only those record references enter the global Operator mailbox. The Controller
50
- batches pending references into one receipt-backed synthetic user message for
51
- the existing interactive Operator and defers the complete batch while that
52
- Operator is busy or unavailable. The message carries CLI read pointers rather
53
- than copied Task or Provider narrative. No lower layer calls the Operator, no
54
- mutable notification projection duplicates the event history, and no Goal or
55
- polling protocol is required to follow work.
56
-
57
- `WorkItem` means one substantial, independently acceptable requirement with a
58
- clear owner. Create multiple WorkItems only when multiple Workers can own and
59
- advance those requirements independently, normally in parallel. Internal
60
- implementation steps, test runs, review findings, and local fixes remain Turn,
61
- Event, report, or commit evidence under the existing Task or WorkItem; they are
62
- not new WorkItems.
63
-
64
- Native subagents may help an Agent investigate or critique inside its current
65
- conversation, but they are not a second Yui WorkItem execution model and do
66
- not create child-session records. A Yui-managed WorkItem dispatch has one
67
- logical main executor: the current Session for `WorkItem.assignee`. A Turn is
68
- an execution attempt, not a requirement, and repeated Turns may continue the
69
- same compatible Role Session.
70
-
71
- Without `--lane-role`, dispatch is `direct`: Yui creates only the main Turn and
72
- does not persist an ExecutionGroup or Lane. With at least two distinct
73
- non-assignee roles, dispatch is `replicated`: one ExecutionGroup freezes a
74
- canonical Assignment and every Lane independently executes that exact same
75
- Assignment. One Lane role is invalid, and Lane roles cannot introduce their
76
- own objective, directive, acceptance criteria, context, or write scope.
77
-
78
- A Lane is a recoverable logical slot whose durable disposition is `open`,
79
- `succeeded`, or `failed`. Failed Turns leave the Lane open for an exact
80
- `task turn retry`; `task turn settle` records the Leader's decision to stop
81
- recovering that Lane. Yui waits until every Lane is settled. At least two
82
- successful Lanes make synthesis eligible and create or wake one idempotent
83
- main Turn with every successful Producer result in stable Lane order. Fewer
84
- than two successes fail that Group attempt without degrading to a single
85
- result. Retrying the main Turn keeps the same Group and does not rerun a
86
- successful Lane.
87
-
88
- ## Profiles, Roles, and Agents
89
-
90
- - `Agent` selects a supported adapter such as Codex or Claude and defines its
91
- launch context.
92
- - `WorkerProfile` is a versioned, provider-neutral behavior template containing
93
- instructions, Skills, a read/write behavior intent, and optional model/effort hints.
94
- - `TaskRole` is a mutable Worker instance inside one Task. Applying a Profile
95
- copies its portable behavior and the optional model/effort selections into
96
- the active Agent binding. Its versioned desired launch configuration is
97
- next-launch-only. The Role may bind multiple Agents; every binding retains
98
- independent runtime configuration.
99
- - `Turn` records one managed dispatch and an immutable effective snapshot:
100
- actual Agent, adapter, model, effort, Profile behavior intent, exact writable
101
- Projects, provider permission strategy and native options, workspace, Role
102
- context, and source desired revision. A native Role Session stores the same snapshot; running processes
103
- are never hot-mutated by later Role edits.
104
- - A `WorkItemCandidate` is the explicit result currently awaiting Leader
105
- acceptance. A dispatched WorkItem Candidate can reference only a successful
106
- main Turn; the complete replicated provenance is derived through Main Turn
107
- -> ExecutionGroup -> Lane -> successful Producer Turn. A roleless delivery
108
- unit managed directly by the Leader may instead use the existing direct
109
- source. Lanes never become Candidates or enter Review or Integration.
110
- - `ReviewRound` records one semantic judgment. A WorkItem Review references
111
- that WorkItem's immutable Candidate. A Task-final Review references the
112
- frozen Task heads directly and has no synthetic WorkItem/Candidate anchor.
113
- Either scope executes directly through one main Reviewer Turn or, when the
114
- Leader explicitly supplies at least two Producer Roles, through one frozen
115
- replicated Assignment followed by one authoritative main synthesis Turn.
116
- It is never another WorkItem.
117
-
118
- Adding another Agent requires an explicit adapter implementation. Profiles do
119
- not choose adapters, own Sessions, or carry credentials.
120
-
121
- For a native subagent, the Leader must choose and read an explicit
122
- WorkerProfile, using `worker` when no specialist fits. The Leader includes the
123
- Profile instructions, Skills, behavior intent, workspace boundary, validation expectations, and
124
- supported model/effort hints in the child brief. Task Role Agent bindings are
125
- ignored because the child inherits the Leader Agent. Its output remains
126
- session-local collaboration evidence: it does not create a Yui Lane, Candidate,
127
- ReviewRound, or Integration source. When that evidence affects delivery, the
128
- main executor incorporates it into the WorkItem's authoritative result.
129
-
130
- ## Lifecycle and acceptance
131
-
132
- WorkItem delivery has one Leader-owned acceptance path regardless of execution
133
- shape:
134
-
135
- ```text
136
- todo -> running -> awaiting_acceptance
137
- | accept -> completed
138
- | reject -> failed -> redispatch -> running
139
- ```
140
-
141
- For `direct`, the assignee's successful main Turn supplies the result. For
142
- `replicated`, Lane Turns supply immutable Producer results and only the
143
- successful synthesis main Turn supplies the Candidate. Roleless WorkItems are
144
- advanced directly by the Leader but enter the same Candidate, ChangeSet,
145
- Integration, and acceptance boundary.
146
-
147
- The Provider's native Turn terminal ends its associated Turn and stores the
148
- final response as immutable Turn evidence. It never accepts the WorkItem. The
149
- Leader checks semantics, evidence, and Git state, then resolves the execution
150
- result and accepts or rejects it with bounded feedback. A rejected isolated
151
- WorkItem keeps its workspace so the next Turn can repair the same result.
152
-
153
- An optional global review rule names one existing Global Role and chooses
154
- `always`, `leader`, or `final`. Candidate rules remain live defaults; each
155
- WorkItem Candidate snapshots the effective review rule when submitted.
156
- Every managed execution result is stored first on its exact Turn. A Candidate
157
- is created only from the main result when the Leader resolves the execution
158
- output for acceptance.
159
- `always` dispatches a review Turn for every candidate, whether it comes
160
- from a completed execution Turn or a Leader-managed direct result; `leader`
161
- leaves every candidate for the Leader to accept directly or review explicitly.
162
- `final` keeps WorkItem acceptance and Integration independent and supplies the
163
- default Reviewer Role when the Leader decides the frozen Task result warrants
164
- an independent final Review. An immutable Task-final contract can require that
165
- Review. A Leader-requested Round remains evidence without becoming policy: a
166
- later Task head does not require another Round unless the Leader requests one
167
- or an explicit Task contract requires it. This final Reviewer evaluates the whole
168
- Task, so normal delivery does not pay for a complete review of every WorkItem.
169
- Review Turns complete only their exact ReviewRound, leave the WorkItem awaiting
170
- acceptance, and never trigger another review or append a Candidate. Successful
171
- and failed review attempts both wake the Leader and remain evidence for
172
- judgment, not a machine verdict. The ReviewRound stores only Core-owned
173
- identity, frozen Candidate, workspace provenance, execution topology, main
174
- Reviewer Turn reference, lifecycle, and failure diagnostics. The complete
175
- free-form Reviewer result lives only on that exact Turn. The Leader may route
176
- that result to the original Worker, but Yui never parses or merges it
177
- automatically.
178
-
179
- Roles describe Agent capability, but they do not own repository workspaces. A
180
- `ManagedWorkspace` is keyed by its durable owner (`Task`, `WorkItem`,
181
- `ReviewRound`, or `IntegrationAttempt`); an Turn carries only a launch
182
- snapshot. Review workspaces are writable copies at the frozen commit, so
183
- diagnostics cannot redirect Develop or become a ChangeSet source. Task-final
184
- Rounds keep independent immutable records but may reassign one clean physical
185
- workspace to the next Round for the same Reviewer Role. This lets the native
186
- Reviewer Session continue while every Turn remains bound to its exact Round and
187
- head.
188
-
189
- Dependencies are enforced at dispatch. A Role cannot have overlapping active
190
- Turns, and terminal Task state fences new messages, dispatches, retries, and
191
- late results until explicitly reopened.
192
-
193
- ## Project workspaces and integration
194
-
195
- Stable Project checkouts are read-only references. Task identity follows one
196
- bounded outcome rather than Project count. A Task binds zero or more Projects,
197
- records an independent base ref for each binding, and adopts one workspace root
198
- only when it becomes active. A Draft owns planning state and Project bindings,
199
- not a writable Workspace. Activation prepares physical worktrees first and then
200
- commits status, workspace identity, cwd, and durable Workspace ownership in one
201
- TaskStore transaction; failure discards unadopted resources and leaves the Task
202
- Draft. The active Workspace contains a managed main worktree for each binding.
203
- The `<workspace>/tasks/<task>/main` root is a logical multi-Project container,
204
- not a Git repository. Each Project child (for example
205
- `<workspace>/tasks/<task>/main/yui`) is the supported Git cwd and points to
206
- `<workspace>/worktree/<project>/<task>/main`; Git commands run in that child.
207
- For a single-Project workspace, the native Agent starts in that Project's
208
- managed worktree so its project configuration and Skills are discovered
209
- natively. For a multi-Project workspace, the Agent starts at this root and Yui
210
- registers every Project worktree through the provider's native
211
- additional-directory mechanism. The active Leader may append a Project when the
212
- same outcome expands; replacing an existing binding is not a scope-repair
213
- mechanism.
214
-
215
- Before a Role launch, Yui verifies that every physical Project HEAD still
216
- descends from its Workspace's recorded base. Normal committed progress is
217
- allowed; a reset or repoint outside that lineage is reported as
218
- `physical-drift` and fails closed before Provider launch.
219
-
220
- A WorkItem can read the full Task workspace but has an explicit Project write
221
- scope. Isolation creates a second root with independent worktrees for writable
222
- Projects and Task-main context for the rest. The managed dispatch and
223
- `yui-worker` Skill name both sets explicitly; the Agent must modify only the
224
- writable set. Provider permission is binding configuration: every managed Role
225
- defaults to `bypass`, while `default` and `configured` preserve provider-native
226
- behavior. Provider permission and Profile access intent do not grant Project
227
- writes. A Leader-owned source write requires the exact Task-main owner. A
228
- WorkItem source write requires an exact WorkItem write scope and matching
229
- managed workspace; a review write instead
230
- requires an exact ReviewRound owner and frozen Candidate base. Profiles and
231
- Skills constrain behavior even when provider prompts are bypassed. Provider
232
- permissions remain Session-wide rather than Project-specific, so the durable
233
- workspace owner and exact Project scope remain the authorization boundary.
234
- Scope is monotonic. A Worker cannot expand it directly: it reports the need,
235
- and the Leader either adds Projects to the existing scope, creates another
236
- WorkItem, or adds the Project to the Task.
237
-
238
- An isolated result is handled in this order:
239
-
240
- 1. the Worker Provider Turn ends and its Turn result is recorded;
241
- 2. the Leader reviews semantics and evidence;
242
- 3. Yui captures each writable Project HEAD as an immutable Project ChangeSet;
243
- 4. each Project integration applies the governing Candidate's ChangeSet in a candidate worktree;
244
- 5. configured checks run;
245
- 6. compare-and-swap advances the target only if its HEAD is unchanged;
246
- 7. the Leader accepts the WorkItem;
247
- 8. terminal Integration, ReviewRound, and WorkItem resources become cleanup
248
- advisories and are explicitly removed before archive.
249
-
250
- The context contract is layered: Yui Core owns durable identity, lifecycle,
251
- access, and workspace safety; generic role Skills own portable orchestration;
252
- Project Policy/Knowledge and Agent-native Skills versioned in each Project own
253
- project-specific engineering rules; and the Task Contract owns the requested
254
- outcome. Yui injects only its own generic Role Skills. It never scans or copies
255
- Project Skills into managed context; the selected Agent discovers them through
256
- its native project mechanism. Execution and review select their generic Skill
257
- by durable Turn purpose. A Reviewer result returns as the exact source Turn
258
- text. The Leader decides whether to send feedback to the existing Worker,
259
- accept, review again, handle a local or Integration issue, or create genuinely
260
- independent follow-up work. Core neither parses findings nor creates repair
261
- topology from Reviewer prose.
262
-
263
- Capture at the same HEAD reuses the existing ChangeSet. A repaired HEAD creates
264
- a new candidate; only the latest governing candidate may satisfy acceptance.
265
- An isolated WorkItem cannot be accepted, or a Task with WorkItems completed,
266
- while any writable Project's latest result is uncaptured or unintegrated.
267
- Leader-owned completion instead requires a clean committed exact Task-main snapshot.
268
- Workspace roots are
269
- multi-Project; ChangeSets and Integration Attempts remain single-Project Git
270
- boundaries.
271
-
272
- Conflicts store a compact report and block. The Leader chooses rejection or
273
- manual resolution in the retained candidate worktree. Failed checks, rejected
274
- results, conflicts, target movement, and abandoned work never advance the
275
- target. Full check output is streamed to cleanable artifact files; durable
276
- records retain compact evidence.
277
-
278
- ## Durable context
279
-
280
- Native transcripts remain native to their Agent. Yui persists only the control
281
- and knowledge needed to resume and audit work:
282
-
283
- - Task Brief: objective, boundaries, cross-Project technical approach, current
284
- focus, and Leader summary;
285
- - Decisions: material choices and supersession;
286
- - Milestones: independently useful phase outcomes;
287
- - Project Knowledge: stable facts reusable across Tasks;
288
- - WorkItems, Roles, Turns, Messages, InputRequests, Events, ChangeSets, and
289
- integration evidence.
290
-
291
- The Leader updates the Brief when durable Task context changes, records material choices as
292
- Decisions, records phase outcomes as Milestones, and promotes only cross-Task
293
- stable facts to Project Knowledge. `task context` is the consolidated recovery
294
- read; launches and wake messages carry record pointers rather than copied
295
- context.
296
-
297
- ## Runtime ownership
298
-
299
- Provider conversations remain user conversations. Yui adds the matching Role
300
- Skill and Session Manifest pointer, then uses provider-native requests for
301
- durable Task delivery; it does not own or mirror the full transcript. The
302
- Controller owns mailbox delivery, wakeups, Role liveness, recovery decisions,
303
- and exact receipts. tmux keeps Yui's client attachment observable where the
304
- provider path needs one. The Controller owns durable wake consumption and
305
- Provider submission; the Provider Runtime Binding owns the only Turn receipt.
306
-
307
- Session, Activation, and Turn identities are independent. A Session can span
308
- Turns and client attachments; one Activation identifies Yui's current
309
- attachment, not exclusive ownership of the Provider thread. One Turn identifies
310
- one provider-native execution, whether its input arrived through Yui or directly
311
- through the Provider UI. Yui's authority epoch fences only Yui's own submissions
312
- and retries.
313
-
314
- `Turn` is the single durable scheduling authority for a Role. It records the
315
- visible inputs, their source and channel, and the final Provider output; it does
316
- not copy reasoning or tool traffic. All input relayed or generated by Yui has
317
- source `yui`, while direct Provider input has source `user` and explicit Goal
318
- continuations have source `provider`.
319
- `TaskRole` likewise stores configuration and identity, not a writable runtime
320
- status. CLI and Web status views derive activity from the active Turn and
321
- add Session/Driver facts only as lifecycle and diagnostic detail.
322
- `AgentHost` is the serialized consumer: while a Provider Turn is active, the
323
- next mailbox wake remains durable and unsubmitted. When that Turn ends, Yui
324
- atomically stores the result. Worker and Reviewer completion enters the bounded
325
- Leader wake aggregation window; a later dispatch creates a new Turn while
326
- reusing the same live Session whenever its configuration remains compatible.
327
- Task and WorkItem completion remain Leader decisions and never follow merely
328
- from Provider termination.
329
-
330
- Codex Task threads remain ordinary native Sessions and can be opened and used
331
- directly in Desktop. Direct user Turns are recorded in the same Turn history. If
332
- one is active, Yui keeps its pending message until that Turn settles. Global
333
- interactive entry remains a native Session-lifecycle operation outside the Task
334
- delivery contract.
335
-
336
- Codex establishes an App Server WebSocket through the byte-forwarding
337
- `app-server proxy` to create or resume a normal thread on the shared daemon.
338
- Role model, effort, permission, workspace, and shell settings are passed at
339
- `thread/start`/`thread/resume`, while the ordinary Task message points to the
340
- Session Manifest and matching Role Skill. Yui does not write either to global
341
- Codex config. A native Codex profile is rejected because it cannot be isolated
342
- to one shared-daemon thread. The Agent Host owns only its proxy and WebSocket:
343
- Task execution stop discards the Yui attachment without waiting for or changing
344
- the daemon or native thread, and start creates a new attachment.
345
- Claude uses a persistent stream-json
346
- transport with exact user-message replay acknowledgement. In both cases, Yui
347
- records Turn intent before writing, accepts only exact Provider evidence, and
348
- maps an uncertain write to `delivery-unknown` without automatic resubmission.
349
-
350
- Role desired revisions and Turn/Session effective snapshots keep configuration
351
- history explicit. Resume compares the complete effective snapshot and
352
- workspace compatibility rather than revision alone. Desired drift is expected
353
- while an old process is running and becomes effective only on a later launch;
354
- control-plane wakes continue through the live Session's actual snapshot, and
355
- fresh replacement archives the stopped snapshot instead of rewriting it.
356
- Mailbox generations, reservations, liveness, and native Turn terminals remain
357
- the control-plane authority; configuration snapshots do not replace those
358
- execution facts. Lifecycle code uses structured Hook data, persisted identities, tmux
359
- process state, receipts, and pane fences. It never parses Agent terminal glyphs,
360
- progress text, trust dialogs, or final prose to infer readiness or success.
361
-
362
- All durable writes use process locking and atomic replacement. Storage validates
363
- record identity, legal transitions, dependency cycles, cross-record ownership,
364
- immutable Git evidence, and current Controller protocol compatibility. Worktree
365
- cleanup revalidates ownership and fails safely when concurrent state changes;
366
- manual retry is the recovery boundary rather than another durable state
367
- machine.
368
-
369
- Storage has one compatibility authority: the highest contiguous, checksummed
370
- version in SQLite's append-only migration ledger. The CLI exposes that release's
371
- current version and minimum supported migration version. Ordinary opening and
372
- Controller startup accept only the exact current version; historical decoding
373
- and rewriting exist only inside `yui upgrade` and the migration phase of
374
- `yui update`.
375
-
376
- Yui 0.15.0 establishes storage version 1 as the clean single-version baseline:
377
- `schema.json` has no authority, and layout/aggregate/record-version axes are
378
- absent from Home metadata. Pre-0.15.0 Homes are outside the migration floor.
379
- Future releases append one immutable migration per storage version and retain
380
- the complete chain from version 1. A fresh Home replays that same chain, so
381
- fresh and upgraded Homes converge on one current schema.
382
-
383
- The staged `upgrade --update-preflight` / `--update-apply` machine handshake is
384
- also a compatibility contract: target releases keep its established outcomes
385
- and required fields, plus the parent-owned handover-lock proof, readable by
386
- every updater released since version 1. Additive detail is allowed; renaming or
387
- removing consumed fields would strand an otherwise valid cross-version
388
- migration path.
389
-
390
- An upgrade runs only while the Controller is quiesced, creates a consistent
391
- database backup, applies all missing migrations in one transaction, and
392
- validates the current record model before writes resume. A missing or changed
393
- ledger row, a migration gap, a Home below the migration floor, a future Home,
394
- or malformed data fails closed. Runtime code contains no dual readers,
395
- historical normalizers, or independently writable compatibility state.
396
-
397
- The Web control room is loopback-only and never receives Controller socket
398
- credentials. It presents durable records and native terminal access without
399
- becoming a second source of truth.
1
+ # Yui architecture
2
+
3
+ Yui is a local control plane and context API for intelligent Agents. Agents own
4
+ planning, execution topology, semantic review, acceptance and recovery. Core
5
+ owns durable identity, authorization, workspace isolation, data integrity and
6
+ bounded effects. It exposes current facts and atomic operations rather than
7
+ choosing a workflow for the Agent.
8
+
9
+ ## Responsibilities
10
+
11
+ | Boundary | Owns | Does not own |
12
+ | --- | --- | --- |
13
+ | Operator / Leader | User coordination; Task outcome, planning and judgment | Forged runtime receipts or self-granted external authority |
14
+ | Task Store | Tasks, Roles, WorkItems, Runs, messages, results, events and resource ownership | Native transcript or inferred Provider activity |
15
+ | Context | Authorized bounded reads, immutable event deltas, exact execution snapshots | A second writable Task or delivery acknowledgement |
16
+ | Controller | Delivery, observations, Jobs, capability Host and Web listener | Semantic interpretation of Agent prose |
17
+ | CapabilityRegistry / InstanceHost | Descriptor resolution, scoped invocation, implementation references and disposal | Task planning, arbitrary plugin privileges or automatic recovery |
18
+ | AgentHost / AgentEndpoint / Driver | Native connection, input disposition, exact result correlation and observations | Task acceptance or ownership of a shared Provider daemon |
19
+ | Project / Resource | Knowledge, managed Git workspaces, adopted environments and durable artifacts | Permission inferred from a directory name |
20
+ | CLI / Web | Shared domain operations and projections | Independent business state or another plugin Host |
21
+
22
+ One `YUI_HOME` has one authoritative SQLite control-plane Store and one
23
+ Controller. Project Knowledge is maintained under the Home; repository material
24
+ can be evidence but is not a substitute for maintained Knowledge.
25
+
26
+ ## Intent, collaboration and execution
27
+
28
+ Task represents one bounded outcome, possibly across multiple Projects. Its
29
+ type describes intent and does not prescribe decomposition. A Leader can own
30
+ bounded work directly; WorkItems are substantial independently acceptable
31
+ requirements with explicit owners.
32
+
33
+ Task lifecycle is `draft / active / completed / cancelled / archived`.
34
+ WorkItem lifecycle is `open / accepted / retired`. Execution, waiting and
35
+ failure belong to AgentRuns and runtime observations, not extra WorkItem states.
36
+ Only accepted direct dependencies satisfy `dependsOn`; replacement metadata does
37
+ not redirect the graph.
38
+
39
+ A valid Leader Session can read Context and mutate scoped Task facts without
40
+ an active AgentRun. Worker and Reviewer actions retain their exact Assignment
41
+ and workspace boundaries. Replacing or revoking a Session changes authority;
42
+ a transient delivery failure does not grant or revoke unrelated authority.
43
+ Released Leaders retain scoped diagnostic reads, not write authority.
44
+
45
+ Durable Task context and engineering control data have separate purposes.
46
+ Requirements, decisions, acceptance and original results must survive outside
47
+ native conversations. AgentRun input/result history remains evidence, while its
48
+ active index, native delivery state, Host and Session selection only control an
49
+ execution attempt. Replacing that execution never completes or deletes the Task.
50
+
51
+ AgentRun records an explicitly requested execution with a frozen Context and
52
+ effective configuration. Native conversation, Goal continuation and ordinary
53
+ Leader notifications do not automatically create Runs. Messages can continue
54
+ already dispatched work through a new, exactly associated Run without changing
55
+ the requirement, captured permissions or workspace.
56
+
57
+ See [Session and AgentRun](docs/managed-turn-and-session-runtime.md) and
58
+ [Task dependencies](docs/task-dag-semantics.md).
59
+
60
+ ## Delivery and results
61
+
62
+ Explicit dispatch and ordinary notification share native input transport, but
63
+ keep different durable owners. The Controller claims a bounded mailbox batch;
64
+ AgentHost serializes submission through AgentEndpoint. The Provider binding
65
+ records actual acceptance and native correlation. A notification can settle
66
+ on acceptance without requiring a final execution report.
67
+
68
+ Busy with proven non-acceptance preserves the input for a subsequent attempt.
69
+ Transport submission alone does not prove acceptance. Unknown effects remain
70
+ visible and fenced: no blind resend or inferred success. Explicit replacement
71
+ first resolves actual native execution, then discards its engineering occupancy.
72
+ Input arriving during a claimed batch remains pending for the next batch.
73
+ Context reads do not consume delivery.
74
+
75
+ An exact terminal transaction persists one original AgentRunResult and a
76
+ reference Message. Core validates identity, transport and workspace facts;
77
+ it does not parse prose into findings, votes, repair topology or acceptance.
78
+ Provider success and semantic success are distinct.
79
+
80
+ Direct execution uses one main Run. Replicated execution freezes one Assignment
81
+ for distinct Producer Lanes. The Leader explicitly chooses terminal original
82
+ results and starts one main synthesis Run; selected failed results can be useful
83
+ evidence. Core checks provenance, not success counts or consensus. Lanes are not
84
+ Candidates or Integration sources.
85
+
86
+ ReviewRound references a frozen Candidate or Task heads and its exact Reviewer
87
+ Run. The original Reviewer output remains on that Run. Review policy and explicit
88
+ Task-final contracts govern when review is required; the Leader decides the
89
+ meaning of the report. See [result consumption](docs/agent-result-consumption.md).
90
+
91
+ ## Planning, workspaces and resources
92
+
93
+ Draft contains planning facts and Project bindings, not an adopted delivery
94
+ workspace. Its private planning directory is outside the control Home and
95
+ delivery trees. Planning Sessions capture `planning` authority. The Leader can
96
+ persist an activation request during a Run or ordinary discussion and return;
97
+ native quiescence releases the intent for current-authority and resource checks.
98
+
99
+ Activation prepares physical resources before atomically adopting Task status,
100
+ workspace identity and ownership. Failure preserves intent and a diagnosis,
101
+ notifies the Leader and stops automatic repetition of that failed adoption.
102
+ Success notifies the Leader to enter delivery without another user prompt.
103
+ Task activation cannot change a live Session's captured authority into
104
+ `delivery`; a compatible delivery launch must establish that boundary.
105
+
106
+ Stable Project checkouts are read-only references. Managed workspace owners are
107
+ Task, WorkItem, ReviewRound or IntegrationAttempt, not Role names. Multi-Project
108
+ workspaces contain per-Project Git roots. Write scopes and exact Git lineage
109
+ are checked where effects occur; a Profile's behavior intent is not a grant.
110
+
111
+ An isolated result is captured as immutable per-Project ChangeSets and integrated
112
+ through a candidate worktree. Checks precede compare-and-swap advancement of the
113
+ target head. Conflicts or target movement retain evidence and do not advance it.
114
+ The Leader accepts delivery separately.
115
+
116
+ Resources support immutable content, external-version and receipt artifacts,
117
+ plus explicitly marked reference material. Environment prepare, adopt, bind and
118
+ release are separate operations. Selection affects future native execution;
119
+ active Sessions retain their captured environment. Trusted-local adoption is
120
+ not an OS sandbox and release never implies deleting user directories.
121
+
122
+ ## Runtime identity and replacement
123
+
124
+ Agent execution component, connection plan, native Session, Host attachment and
125
+ AgentRun identify different things. Codex CLI uses App Server, Claude Code CLI
126
+ uses stream-json, and ACP peers use the ACP connection implementation. Unknown
127
+ ACP product identity remains unknown.
128
+
129
+ Desired Role configuration, frozen effective launch and actual Agent-reported
130
+ configuration are separate facts. Requested model or permission is not evidence
131
+ that it is currently in effect. ACP configuration is applied and checked through
132
+ negotiated options; unsupported axes fail explicitly instead of being guessed.
133
+
134
+ The Host owns disposable clients, not shared native conversations. Session
135
+ implementations are pinned to their actual code boundary. New calls or Sessions
136
+ can select a new implementation while old references drain. A timeout or client
137
+ exit does not prove descendant resources stopped; unresolved disposal remains
138
+ observable rather than being reported as clean.
139
+
140
+ Session reuse is optional. `task role session new` records replacement intent
141
+ in the existing runtime mailbox, including when a Run is active or the prior
142
+ Session has already ended. Once its resources stop, Yui cancels the old Role's
143
+ engineering attempts, retains history and workspaces, and selects a new Session.
144
+ Unprocessed notification references are carried into the successor's context,
145
+ not lost behind a time cursor. The Agent chooses whether to retry existing work.
146
+ Persistent native connection location and dedicated process custody make recovery
147
+ independent of the old Host. A genuinely live/unknown writer remains a resource
148
+ boundary, not a reason to withhold diagnosis or erase durable context.
149
+
150
+ See [Provider runtime](docs/provider-runtime.md) and
151
+ [Agent Drivers](docs/agent-runtime-drivers.md).
152
+
153
+ ## Capabilities, plugins and surfaces
154
+
155
+ Capabilities use authenticated `search / describe / call`. Descriptors declare
156
+ schemas, effects, permissions, scope and Provider identity. Ambiguity requires
157
+ explicit selection. Nested calls cannot amplify caller authority or effect;
158
+ original operation receipts survive a parent failure.
159
+
160
+ The Registry exposes context, messages, artifacts, environments, plugins and
161
+ selected Task/Job operations. Other CLI/Web operations share domain handlers
162
+ directly. There is no requirement to route every operation through a plugin.
163
+
164
+ Validated Task-local plugins preserve explicit enabled intent in the Store and
165
+ live instances in InstanceHost. Reading or restarting does not run author code.
166
+ Leader management is limited to its Task; executable code still requires exact
167
+ Operator-issued grants. Plugin validation is not a security certification.
168
+
169
+ CLI contributions and controlled Web panels are projections of the Registry.
170
+ Web is loopback-only and Controller-owned; browser credentials do not become
171
+ Operator authority. See [Plugin SDK](docs/plugin-sdk.md) and
172
+ [capabilities and resources](docs/architecture/capabilities-and-resources.md).
173
+
174
+ ## Persistence, completion and operation
175
+
176
+ The Home has one append-only storage migration chain. Ordinary runtime accepts
177
+ only current records. Explicit upgrade backs up and migrates valid supported
178
+ Homes; malformed state is diagnosed, not automatically repaired.
179
+
180
+ Completion freezes the delivery result and checks applicable acceptance,
181
+ integration and review contracts. It is distinct from publication, verified
182
+ remote merge, physical quiescence and archive. Archive requires settled work
183
+ and clean removable managed resources, preserves Task history, and cannot reopen.
184
+
185
+ Runtime health and cost are observations, not semantic verdicts. The Agent reads
186
+ exact faults and current intent to choose retry, repair or abandonment. Yui does
187
+ not automatically create rescue Workers or select another model.
188
+
189
+ The [documentation map](docs/architecture/README.md) links current contracts.
190
+ The [verification policy](docs/testing/verification-levels.md) separates core
191
+ smoke from temporary change-specific and explicitly authorized real-resource
192
+ evidence; documentation is not a claim of full production validation.