@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/README.md CHANGED
@@ -2,1213 +2,191 @@
2
2
 
3
3
  # Yui
4
4
 
5
- Yui is a local control plane for intelligent Codex and Claude Agents. It keeps
6
- user intent, Project knowledge, Tasks, handoffs, and results durable and
7
- inspectable, while exposing small atomic capabilities for context, messaging,
8
- delegation, workspaces, Sessions, review, and integration. Agents compose those
9
- capabilities and decide how to plan, sequence, delegate, retry, and recover.
5
+ Give your Agents work to carry forward, not just another chat to answer.
10
6
 
11
- Yui deliberately does not turn Agent judgment into a deterministic workflow
12
- engine. Its core owns durable identity, user authority, workspace isolation,
13
- and atomic state changes. Provider Sessions and runtime observations support
14
- execution and continuity, but they are not competing sources of Task truth.
7
+ Yui helps you turn requests into organized tasks and coordinate Agents to solve
8
+ them. Describe what you want in conversation: an Agent identifies the relevant
9
+ Project, distinguishes new work from a follow-up, and keeps related requirements
10
+ together. Each Task has a Leader that plans the work, uses other configured
11
+ Agents when useful, and brings results and decisions back to you.
15
12
 
16
- The current implementation restores the useful Role/Agent/session and CLI framework without restoring the later data-maintenance, lease, schedule, and recovery-ledger systems.
13
+ You do not need to manually create a ticket for every step, carry context between
14
+ terminal windows, or remember which Agent was working on which requirement.
15
+ Yui keeps the intent, progress and results outside any one conversation, so
16
+ continuing work starts from the Task rather than from your memory.
17
17
 
18
- The [target architecture handbook](docs/architecture/README.md) preserves the
19
- 2026-09-06 design baseline for the upcoming refactor; it does not describe
20
- already implemented behavior.
21
-
22
- ## Requirements
23
-
24
- - Node.js 20.17+, 22.9+, or 24.x
25
- - Git
26
- - tmux
27
- - Codex CLI or Claude Code CLI
28
-
29
- ## Setup
30
-
31
- ```sh
32
- npm install -g @zq-silk/yui
33
- yui setup
34
- yui doctor
35
- ```
36
-
37
- `setup` is intentionally minimal. It verifies tmux, reuses or creates one
38
- available Agent, creates the default workspace outside Yui home, and configures
39
- both Operator and Leader so the user can start Yui and execute Tasks. It does
40
- not create Worker, Reviewer, Profile, or review-policy configuration, and does
41
- not ask for model/effort, permission, or shell completion. The required
42
- Operator and Leader bindings use Yui's adapter default permission strategy
43
- (`bypass`); further changes belong under `config role`. Running setup again
44
- preserves already usable Operator and Leader Roles. A successful setup starts
45
- the current Home's detached Controller before it returns.
46
-
47
- All persistent configuration is under `yui config`. `config show` reports the
48
- complete effective state, while `config --help` introduces each domain and
49
- shows examples. The Operator can read the same structured catalog with
50
- `config describe`, explain current values, effects, choices, and activation
51
- behavior, then apply only changes the user confirms.
52
-
53
- Durable settings are grouped by responsibility: `config system` for Home
54
- defaults and presentation, `config runtime` for Controller health, concurrency,
55
- launch, and delivery mechanics, `config workflow` for Leader/context/review
56
- policy, `config resources` for quarantine and GC, and `config tools` for tmux
57
- and diagnostic telemetry. Configured Agents, global Roles, Profiles, and shell
58
- completion remain the sibling `config agent|role|profile|completion` domains.
59
- Use `show`, `set`, and `clear` consistently within each durable-settings domain.
60
-
61
- Runtime catalogs are refreshed per command and cached under Yui home. If a live probe times out or fails, Yui shows the last cache for the same Agent launch context and clearly marks it as potentially stale; without a matching cache, it offers CLI defaults and custom values. `yui config agent capabilities <id>` exposes the same one-pass catalog, including models, model-specific efforts, and other runtime choices such as permissions, search availability, profiles, settings sources, and service tiers.
62
-
63
- `completion` is also interactive, with or without an explicit shell:
64
-
65
- ```sh
66
- yui config completion
67
- yui config completion zsh
68
- ```
69
-
70
- Both forms confirm the generated script, installation path, and shell startup-file change. The installed completion is generated from the command catalog, including nested subcommands.
71
-
72
- Yui uses `~/.yui` by default. Set `YUI_HOME` to use an isolated home:
73
-
74
- ```sh
75
- export YUI_HOME=/absolute/path/to/yui-home
76
- yui setup
77
- ```
78
-
79
- The home contains the authoritative SQLite database `yui.db`, Project Catalog
80
- and knowledge, and Controller discovery files. Stable Project checkouts and
81
- managed worktrees live under the configured workspace, outside Yui home.
82
- Legacy `schema.json` and `state.json` files are evidence only. Runtime storage
83
- accepts only the exact current contract; supported earlier storage versions
84
- enter only through the explicit upgrade boundary.
85
-
86
- Every Task-owned record family allocates a monotonically increasing local ID
87
- inside its Task. Different Tasks may therefore both contain `work-item-1`,
88
- `turn-1`, or `input-1`. A managed Task session may use that short local ID
89
- because `YUI_TASK_ID` supplies the scope. Outside a Task session, use the
90
- qualified form `<task-id>/<local-id>`; Yui never searches every Task for a bare
91
- ID. Commands that already take a Task explicitly, such as `task work create`
92
- and `task integration start`, keep their subordinate IDs local to that Task.
93
- Candidate IDs are local to their WorkItem and carry both Task and WorkItem
94
- provenance.
95
-
96
- Yui has one Home storage version, recorded by the append-only SQLite migration
97
- ledger. Every CLI reports both its current storage version and its minimum
98
- supported migration version. Runtime admission still has only two outcomes:
99
- exact current, or rejected; a Controller never migrates storage while serving
100
- work. `yui upgrade --dry-run` is read-only. `yui upgrade` quiesces a running
101
- Controller, creates a consistent backup, applies every missing migration in
102
- one transaction, validates the current contract, and then restarts the
103
- Controller when it was running before the upgrade.
104
-
105
- `yui update` stages and pins one exact package, runs that staged binary's
106
- storage preflight, stops the exact old Controller, activates the same artifact,
107
- applies the staged release's migration chain when required, verifies the
108
- installed binary and current Home, and starts the replacement Controller. A
109
- Home inside the staged release's supported range can upgrade directly across
110
- multiple versions without installing intermediate releases. A newer Home, a
111
- Home below the migration floor, an incomplete migration ledger, or malformed
112
- data fails closed without a guessed repair.
113
-
114
- Yui 0.15.0 establishes storage version 1 and the migration floor. Homes created
115
- by earlier releases, including 0.14.2, are not on this compatibility line:
116
- preserve them for inspection with their matching Yui release or initialize a
117
- new Home. From 0.15.0 onward, each release retains the complete chain, so later
118
- `yui update` invocations can cross versions directly.
119
-
120
- See [Task-local identity](docs/task-local-identity.md) for the current reference
121
- contract.
122
-
123
- Schema work across Tasks is not serialized: any Task may propose the next
124
- storage migration on its own isolated branch without waiting for another Task's
125
- schema change to land. The later-integrating branch owns the reconciliation:
126
- rebase onto the latest project head, preserve every already released migration
127
- unchanged, allocate the next contiguous storage version, resolve schema and code
128
- conflicts, and re-run the bounded validation. A migration may update physical
129
- tables and current record payloads together; it must not introduce another
130
- writable compatibility axis.
131
-
132
- Yui provides four reusable Worker Profile definitions through
133
- `yui config profile reset`; minimum setup makes each one inherit the current
134
- Global Worker runtime:
135
-
136
- ```text
137
- worker explorer implementer reviewer
138
- ```
139
-
140
- Profiles are versioned Worker templates with two independent parts: portable
141
- behavior (prompt instructions, Skills, and access intent) and runtime intent.
142
- Runtime either follows the current Global Worker binding dynamically, or names
143
- one explicit Agent with optional model and effort. `profile list` and `profile
144
- show` resolve the effective Agent from current configuration and display the
145
- Global Worker launch revision when inherited; that read does not rewrite or
146
- revise the Profile. Profiles do not own Sessions or workspaces.
147
- When an explicit Profile's Agent has a Global Worker binding, active or
148
- dormant, its other binding settings come from that binding; an unbound Agent
149
- uses provider defaults. A Worker binding referenced this way cannot be unbound
150
- until the Profile is updated, changed to inheritance, or removed. The Profile
151
- still owns model and effort, and omitting either means the provider default
152
- rather than the Worker's value.
153
-
154
- Creating a Task Role from a Profile freezes the Profile behavior and its fully
155
- resolved runtime binding into the Role. Later Profile or Global Worker changes
156
- do not rewrite existing Task Roles. On `task role add`, model, effort, and
157
- other Agent settings require `--agent` so Yui can validate and persist one
158
- complete explicit binding atomically. When `--profile` and `--agent` are both
159
- present during creation, the Agent must match the Profile's resolved Agent;
160
- the Profile runtime remains the base binding and explicit Agent settings
161
- override corresponding fields. On `task role update`, omitted `--agent`
162
- updates the active binding, while a provided `--agent` updates that binding
163
- without activating it; only `task role bind` switches the active Agent. An
164
- explicit Profile must resolve to that update target, where its runtime is the
165
- base binding and explicit Agent settings override corresponding fields. An
166
- inherited Worker Profile used by itself may update portable Role behavior
167
- without retargeting a differently bound Agent; if `--agent` or Agent settings
168
- are also present, its currently resolved Worker Agent must match the target.
169
- Applying a Profile replaces the portable fields owned by AgentProfile
170
- (`defaultAccess`, description, instructions, skills, and access-derived
171
- constraints); explicit Role options in the same command apply afterward.
172
- This Yui Agent Profile is separate from a Codex native config profile also
173
- named `--profile`.
18
+ [Quick start](#quick-start) · [Working through conversation](#working-through-conversation) · [Core design](#core-design)
174
19
 
175
20
  ## Quick start
176
21
 
177
- Bind a Project and create a Draft Task:
178
-
179
- ```sh
180
- yui project add app /absolute/workspace/app \
181
- --remote git@example.com:team/app.git --stable main --development main
182
- yui project update app --alias app-cli
183
- yui project refresh app
184
- yui project list
185
-
186
- yui task create "Fix CSV escaping" --project app --type bugfix
187
- yui task create "Ship CSV export" --project app --type feature
188
- yui task update <task-id> --priority high --tags release,csv --due-at 2026-08-01T00:00:00Z
189
- yui task update <task-id> --clear-priority --clear-tags --clear-due-at
190
- yui task message update <task-id>/<message-id> --body-file updated-message.md --wake-policy none
191
- yui task work edit <task-id>/<work-item-id> --objective "Revised outcome" \
192
- --accept "New observable criterion"
193
- yui task work retire <task-id>/<work-item-id> --summary "Removed from the current Draft"
194
- yui task show <task-id>
195
- yui task context <task-id>
196
- yui task activate <task-id>
197
- ```
198
-
199
- A Draft stores planning state and Project bindings only; it does not adopt a
200
- writable managed Workspace. `task activate` prepares every bound Project first,
201
- then commits the Task's `active` status and Task-owned Workspace together. A
202
- preparation or consistency failure leaves the Task Draft and reports the
203
- workspace diagnosis instead of exposing a partially adopted execution root.
204
- Draft Message and WorkItem edits replace only the named mutable fields while
205
- preserving record identity and audit history. Repeated options replace the
206
- whole collection; matching `--clear-*` flags make an empty collection explicit.
207
- Retired records remain visible in history but leave the current Draft. A
208
- retired WorkItem never satisfies a dependency and does not redirect downstream
209
- dependencies through its optional replacement; fix the remaining Draft before
210
- activation. These Draft-only mutations do not create, stop, or clean runtime
211
- resources, and activation validates the current dependency graph, Roles, and
212
- Project scope before any Workspace is adopted.
213
-
214
- Task type describes intent rather than selecting an execution protocol.
215
- Software Projects use `bugfix` or `feature`: a bugfix is Leader-owned; if it
216
- grows into independently owned delivery requirements, reclassify it as a
217
- feature before creating WorkItems. The Leader decides whether a feature is
218
- small enough to deliver on Task main or large enough for independently owned WorkItems. A WorkItem is
219
- one substantial requirement for one Worker, not a development step, test run,
220
- review finding, or local fix. Multiple WorkItems are useful only when distinct
221
- Workers can advance meaningful requirements independently. A WorkItem's
222
- governing Candidate defines its delivery obligation: each writable Project's
223
- exact start and result commits must be represented by a committed Integration
224
- before Task-final Review or completion. Older Candidate, ChangeSet, and queue
225
- records remain audit evidence without keeping the Task open.
226
-
227
- `project refresh` is the explicit network operation for a stable Project checkout. It fetches the
228
- configured stable branch directly from the Project remote URL and advances only through a clean,
229
- verified fast-forward. Refresh requires matching stable and development branches, treats untracked
230
- files as dirty, preserves ignored files, and refuses missing remotes or refs and diverged checkouts.
231
- When the configured branch is `HEAD`, refresh resolves the remote's symbolic default branch for that
232
- operation and requires the checkout to be on that branch; detached or mismatched checkouts fail.
233
-
234
- ### Project lifecycle
235
-
236
- Divergence and end-of-life are explicit, Operator-authority operations with fail-closed gates.
237
- Every destructive command refuses a managed Task Session (run it from an Operator or user
238
- terminal), an active Task binding, a dirty checkout, and an unreachable or unverified remote.
239
-
240
- ```sh
241
- yui project diagnose app
242
- yui project reset app
243
- yui project reset app --discard-local
244
- yui project replace app --discard-local
245
- yui project retire app --reason "superseded by app-ng"
246
- yui project delete app --confirm app
247
- yui project delete app --checkout --confirm app
248
- ```
249
-
250
- `project reset` handles the divergence `project refresh` refuses. Without `--discard-local` it is
251
- a dry run: it fetches and verifies the remote baseline, and when the checkout has diverged it
252
- refuses while listing the exact local commits that would be discarded. With `--discard-local` it
253
- hard-resets the clean checkout to the verified remote commit (a plain fast-forward when the
254
- checkout is merely behind). `project replace` goes further for Home-managed checkouts: it clones
255
- the remote into a staging directory, verifies both branches, copies the Yui-local refs
256
- (`refs/heads/yui/`, `refs/yui/archive/`) so historical evidence keeps resolving, then swaps the
257
- checkout on disk while the catalog record keeps its path. Replace refuses linked worktrees (Task
258
- or Integration workspaces) and dirty checkouts, and requires `--discard-local`. The swap is
259
- recoverable: the previous checkout is parked at a backup path and restored on any failure, a
260
- catalog refusal rolls the swap back, and a crash mid-swap is healed on the next run (a crash
261
- before the swap leaves only a removable staging clone).
262
-
263
- `project retire` is the auditable soft deprecation: it records who retired the Project, when, and
264
- why, while retaining the catalog record, checkout, and every historical
265
- Task/Turn/Review/Integration/Publication reference. A retired Project cannot be refreshed,
266
- updated, migrated, reset, replaced, maintained through Knowledge writes (add/retire/propose/
267
- accept/reject), or bound to new Tasks, WorkItems, or Integrations; Knowledge reads (`list`,
268
- `show`, `proposals list/show`) stay open so the evidence stays auditable.
269
- `project delete` is the separate hard-removal decision: it requires a retired Project, an exact
270
- `--confirm <project-id>` acknowledgment, and fails closed while any Task record references the
271
- Project. `--checkout` additionally removes the Home-managed checkout (external checkouts are
272
- user-owned and must be removed manually): it first refuses linked worktrees and dirty checkouts,
273
- then moves the checkout to a tombstone before removing the catalog record, restoring it on any
274
- failure so the catalog and checkout never disagree unrecoverably. `project show` and
275
- `project list` display the lifecycle status and retirement record.
276
-
277
- Use `task context` as the first detailed read of an existing Task. It combines the Task, Brief, active Decisions, recent Milestones, Roles, current and recent WorkItems with their Turns, recent Messages, open and resolved InputRequests, and recent Events. Terminal output keeps histories and long text compact; `yui --json task context <task-id>` returns the complete records in the top-level `data` field.
278
-
279
- Leader wakeups stay deliberately small: the wake envelope carries only the
280
- aggregated wake reasons, a delta window, and read pointers. The durable wake
281
- ledger is the on-demand read for what changed:
282
-
283
- ```sh
284
- yui task wake list <task-id>
285
- yui task wake show <task-id> <wake-id>
286
- ```
287
-
288
- `wake list` shows the dispatch history with status, reasons, and consuming
289
- Turn; `wake show` renders one wake's delta window — the Events, Messages, and
290
- Turns recorded between its cursors. A human or Agent can still force a wake
291
- with `yui task wake <task-id> --force --reason "<text>"`.
292
-
293
- Human-facing timestamps default to Beijing time (`Asia/Shanghai`) while durable
294
- records and `--json` data remain UTC/RFC 3339. Inspect or change the IANA
295
- timezone with:
296
-
297
- ```sh
298
- yui config show
299
- yui config system set time-zone Europe/London
300
- ```
301
-
302
- WorkItem review is one global, optional rule that reuses an existing Global
303
- Role's Agent, model, permissions, prompt, and Skills:
22
+ You need Linux x64 with glibc, Git, tmux, and Node.js `^20.17.0`, `^22.9.0` or
23
+ `^24.0.0`. For the simplest setup, have Codex CLI or Claude Code CLI installed
24
+ and ready to use with your own account. Yui coordinates those Agents; it does
25
+ not supply model access.
304
26
 
305
- ```sh
306
- yui config workflow set review --role reviewer --trigger always
307
- yui config show
308
- yui config workflow clear review
309
- ```
27
+ For Claude, Yui passes through your authentication environment and native
28
+ configuration directory; Claude selects the API key or login method using its
29
+ own settings. Replacing a Session does not reset your login or initialization.
30
+ Native first-run confirmations may still require your input.
310
31
 
311
- For Project-backed software delivery, use `--trigger final` to supply the
312
- default Reviewer Role when the Leader decides the complete frozen Task result
313
- needs an independent Review:
32
+ ### 1. Install
314
33
 
315
34
  ```sh
316
- yui config workflow set review --role reviewer --trigger final
317
- ```
318
-
319
- Every result entering Leader acceptance is one explicit candidate on its
320
- existing WorkItem. The current global rule applies to the next candidate in
321
- every existing or new Task; that candidate snapshots the rule, so later
322
- `set`/`clear` changes do not rewrite an in-flight decision.
323
- `always` starts a ReviewRound for every candidate, including a completed Role Turn
324
- or a Leader-managed direct result; `leader` leaves the candidate awaiting
325
- acceptance so the Leader can accept it directly or run
326
- `yui task work review <task-id>/<work-item-id>`. A configured review rule therefore keeps
327
- Leader-managed candidates awaiting a decision instead of marking them done.
328
- `final` does not create WorkItem ReviewRounds or decide Task topology. The
329
- Leader explicitly requests a Task-scoped Review, unless an immutable Task
330
- contract requires one. The Round snapshots the exact Task-main Project heads
331
- directly, so even a Leader-owned Task with no WorkItem can be reviewed without
332
- locking the mutable Task workspace. A changed frozen head needs a new semantic
333
- Round; the same Reviewer Session continues in its
334
- stable workspace, while every Turn remains bound to its exact Round and head.
335
- The Reviewer follows Project Policy/Knowledge and reports reachable, material,
336
- actionable findings across the complete Task.
337
- A ReviewRound freezes the Candidate's exact Git commit and updates the
338
- Reviewer Role's stable writable workspace to that head while recording exact
339
- Round-owned workspace evidence. Its Turn may edit,
340
- test, and optionally commit diagnostic evidence there, but never changes the
341
- Candidate or Worker workspace and never creates another WorkItem, Candidate,
342
- ChangeSet, or recursive review. The result wakes the Leader, who decides whether
343
- to route evidence to the original Worker, accept, reject and redispatch that
344
- Worker in its existing Session, review again, or request user input.
345
- A failed review remains visible evidence and wakes the Leader, but does not
346
- take that decision away from the Leader.
347
-
348
- An explicit WorkItem Candidate or Task-final Review is direct unless the
349
- Leader names Producer Roles. Policy-triggered WorkItem Review remains direct
350
- by default:
351
-
352
- ```sh
353
- yui task work review <task-id>/<work-item-id>
354
- yui task work review <task-id>/<work-item-id> \
355
- --lane-role security-reviewer --lane-role correctness-reviewer
356
-
357
- yui task review request <task-id> --role reviewer
358
- yui task review request <task-id> --role reviewer \
359
- --lane-role security-reviewer --lane-role correctness-reviewer
360
- ```
361
-
362
- Direct Review creates one main Reviewer Turn with no ExecutionGroup or Lane.
363
- Replicated Review requires at least two distinct Producer Roles, all inspecting
364
- the identical frozen Assignment in isolated Lane workspaces. Yui waits for
365
- every Lane to settle and requires at least two successful Producer results
366
- before creating one idempotent main Reviewer synthesis Turn. Successful
367
- Producers are never rerun during Lane or main retry. Producer output is durable
368
- non-authoritative evidence; only the exact completed main Reviewer Turn
369
- completes the Round. The Leader reads that Turn's original result and decides
370
- what it means.
371
-
372
- Task context and next-action expose the Review shape, every frozen Project
373
- commit, its relation to the current candidate, Producer and main Turns, and
374
- their owned workspaces. A request that fails after Round creation retains the ReviewRound
375
- and reports its exact reason; the Leader opens that Round and decides whether
376
- to retry, inspect or clean the workspace, use another Reviewer, or continue
377
- other work.
378
- An active Task-final Review freezes only its own candidate; it does not prevent
379
- the Leader from processing new input or advancing a later candidate. Delta
380
- Recheck is always available when Yui can prove an accepted contiguous baseline
381
- and exact diff. Yui does not select a mode from generic size thresholds;
382
- `requires-full-review` returns to the Leader without creating another Round.
383
- Candidate history, every ReviewRound, and the Leader decision remain grouped
384
- under the original WorkItem. A rejected result creates a new Candidate on the
385
- next dispatch while reusing the original execution Role, Session, and
386
- workspace.
387
-
388
- Yui Core supplies lifecycle and exact-scope safety; generic role Skills supply
389
- portable collaboration behavior; Project Policy/Knowledge supplies
390
- project-specific build, test, migration, release, and review rules; the Task
391
- Contract supplies the current objective and acceptance. Project-backed Workers
392
- commit and leave the Develop workspace clean before ending the Provider Turn.
393
- Yui stores the final Turn result and freezes each writable Project's HEAD in the Candidate
394
- snapshot; ReviewRound worktrees are recreated from those exact commits even if
395
- Develop later advances during repair.
396
-
397
- Task identity follows one bounded outcome, not the number of repositories
398
- involved. A repository-backed Task may bind multiple Projects, each with its
399
- own base ref. Yui exposes them under one Task workspace root:
400
-
401
- ```text
402
- <workspace>/tasks/<task-id>/main/
403
- ├── backend/
404
- ├── frontend/
405
- └── shared-sdk/
35
+ npm install -g @zq-silk/yui
406
36
  ```
407
37
 
408
- `<workspace>/tasks/<task-id>/main` is a logical multi-Project container, not a
409
- Git repository. Each Project child is the supported Git cwd (for example
410
- `<workspace>/tasks/<task-id>/main/yui`) and points to that Project's managed
411
- worktree at `<workspace>/worktree/<project>/<task-id>/main`. Run Git commands
412
- inside the relevant Project child. With one bound Project, the native Agent
413
- starts in its managed worktree so Agent-native project configuration and Skills
414
- are discovered normally. With multiple Projects, it starts at the logical root
415
- and receives every Project worktree through the provider's native
416
- additional-directory mechanism. Create all known
417
- bindings together, or let the active Task Leader add one when the same outcome
418
- expands:
38
+ ### 2. Set up, yourself or with an Agent
419
39
 
420
- ```sh
421
- yui task create "Update authentication" \
422
- --project backend --project frontend \
423
- --base backend=develop --base frontend=main \
424
- --type feature
425
- yui task project add <task-id> shared-sdk --base main
426
- ```
427
-
428
- Project-backed Tasks record the local baseline, redacted remote identity, and
429
- the remote-tracking commit observed when their main workspace is created.
430
- Inspect delivery freshness with:
40
+ Run the interactive setup:
431
41
 
432
42
  ```sh
433
- yui task base status <task-id>
434
- yui task base status <task-id> --refresh
43
+ yui setup
435
44
  ```
436
45
 
437
- The default check is offline and uses local remote-tracking refs. `--refresh`
438
- is the explicit authorization to query the configured remote; Yui never
439
- fetches, rebases, merges, or force-pushes as a hidden side effect of Task
440
- completion. Behind, diverged, or unavailable remote state is reported as
441
- delivery-risk evidence for the Leader; it does not replace the Leader's choice
442
- of delivery base. A dirty Task workspace remains a completion blocker.
443
-
444
- Implementation WorkItems declare the Projects they may modify. Their workspace
445
- keeps the same relative layout, creates isolated worktrees only for that write
446
- scope, and exposes the other Task Projects as context from Task main. Yui puts
447
- the exact writable and context-only Project lists into the managed dispatch and
448
- the `yui-worker` Skill requires the Agent to honor that boundary. Native Agent
449
- permissions remain session-wide, while Profile `access` is a behavior hint,
450
- not a provider sandbox or write grant. Every managed Role binding defaults to
451
- `permission.strategy=bypass`, including `explorer`, so provider prompts do not
452
- block normal work. Profiles and Skills constrain behavior; exact WorkItem or
453
- ReviewRound scope and the matching managed workspace are the only authority to
454
- modify Project files. A Role may instead choose `default` or `configured` and
455
- retain any supported subset of the provider's native permission options.
46
+ Or ask the coding Agent you already use:
456
47
 
457
- Workspace ownership is independent from the executor Role. Yui persists one
458
- owner-keyed `ManagedWorkspace` for Task main, each WorkItem Develop checkout,
459
- each ReviewRound, and each IntegrationAttempt; dispatch attaches a snapshot.
460
- The delivery chain is `isolate -> Candidate -> ReviewRound -> ChangeSet capture
461
- -> Integration -> accept -> cleanup`. Review worktrees start at the frozen
462
- Candidate commit and never become a Develop ChangeSet source.
48
+ > Yui is installed. Help me run `yui setup` in an interactive terminal,
49
+ > choose an available Agent, and check the result with `yui doctor`.
50
+ > Ask me about any account or setup choices you need.
463
51
 
464
- Write scope may only expand. The Leader supplies the complete old-plus-new set
465
- after a Worker reports that another repository is required; an
466
- existing writable Project cannot be removed:
52
+ Setup establishes the Operator—the Agent you talk to—and a default Task Leader,
53
+ then starts the local Controller. You can begin with those two roles and
54
+ configure Workers or Reviewers later. If your Agent cannot operate an interactive
55
+ terminal, run setup yourself; it only handles the initial configuration.
467
56
 
468
- ```sh
469
- yui task work create <task-id> "Update contract" \
470
- --project backend --project frontend --role implementer
471
- yui task work scope <task-id>/<work-item-id> \
472
- --project backend --project frontend --project shared-sdk
473
- yui task work isolate <task-id>/<work-item-id>
474
- yui task work reject <task-id>/<work-item-id> \
475
- --summary "Write scope expanded; continue in the refreshed workspace."
476
- yui task work dispatch <task-id>/<work-item-id>
477
- yui task integration start <task-id> --work-item <work-item-id> \
478
- --project backend --strategy cherry-pick --check "<validation command>"
479
- yui task integration cleanup <task-id>/<integration-id>
480
- yui task work cleanup <task-id>/<work-item-id> --integrated
481
- ```
482
-
483
- The WorkItem Candidate records its exact start and result commits. Integration
484
- remains a single-Project Git transaction, so the Leader integrates each Project
485
- independently and chooses fast-forward, cherry-pick, merge, or manual
486
- application. Acceptance succeeds only after every writable Project result has
487
- a committed Integration, including an explicit successful no-op when the
488
- result is already represented. Use `--abandon` only for deliberate discard.
489
- Dirty worktrees are retained. Native Agent Sessions may be scoped to their
490
- launch directory, so Yui retires a stopped Role Session whenever the Role moves
491
- between Task main and an isolated WorkItem worktree. The next dispatch starts a
492
- Session in the new workspace while durable Yui records preserve context.
493
-
494
- Submit information through Operator:
57
+ ### 3. Start a conversation
495
58
 
496
59
  ```sh
497
- yui operator submit "Compare CSV and JSON compatibility" --task <task-id>
498
- yui operator submit "Investigate a smaller cache design"
499
- yui operator status
500
- yui operator list
501
- yui operator resume
502
- yui operator resume --last
503
- yui operator new
504
60
  yui operator enter
505
61
  ```
506
62
 
507
- If current execution cannot be settled normally, fence the Task and restart
508
- from its durable progress:
509
-
510
- ```sh
511
- yui task execution stop <task-id> --force --reason "<why execution must be fenced>"
512
- yui task execution start <task-id>
513
- ```
514
-
515
- `stop` terminates disposable Turns and Sessions while preserving WorkItems,
516
- repository changes, Messages, reviews, and other Task progress. `start` admits
517
- one new Leader attempt from those durable records; it does not recover an old
518
- Agent conversation.
519
-
520
- Without `--task`, `operator submit` creates a new Draft. Drafts accept planning changes but must be activated before Agent execution.
521
- Operator resolves every request against the Project catalog and existing Task
522
- context. Follow-up requirements, fixes, reviews, and questions for the same
523
- bounded outcome stay in that Task even when they involve multiple Projects.
524
- A distinct outcome, ownership boundary, or lifecycle creates a separate Task.
525
- Features, bugs, and questions use the same
526
- Task/WorkItem model rather than separate workflow types.
527
- `operator status` shows exactly one GlobalRole-selected writer separately from
528
- retained historical conversations. `operator list` shows recent conversations in fixed most-recently-updated order using
529
- their Agent and readable title or preview; native provider session IDs remain
530
- internal. Until an adapter supplies that metadata, Yui shows the provider plus
531
- a stable short Yui reference so untitled conversations remain distinguishable.
532
- `operator resume` opens the lightweight numbered history list, while `--last`
533
- resumes the newest entry directly. Starting a conversation is never a resume
534
- choice: the explicit `operator new` command starts a clean conversation and
535
- preserves the previous one in history.
536
-
537
- Create a Task-bound Worker instance from a Profile's resolved runtime and
538
- dispatch a WorkItem:
539
-
540
- ```sh
541
- yui config role show worker
542
- yui config profile show implementer
543
- yui task role add <task-id> implementer --profile implementer
544
- yui task role show <task-id> implementer
545
-
546
- yui task work create <task-id> "Implement the exporter" \
547
- --project app --role implementer
548
- yui task work isolate <task-id>/<work-item-id>
549
- yui task work dispatch <task-id>/<work-item-id> --input "Implement and run focused tests"
550
- ```
551
-
552
- Without `--lane-role`, the assignee performs the WorkItem directly in its main
553
- workspace. To request independent production attempts over exactly the same
554
- frozen Assignment, provide at least two distinct Task Roles; one role is
555
- rejected, roles cannot repeat, and the assignee cannot be a Lane:
556
-
557
- ```sh
558
- yui task work dispatch <task-id>/<work-item-id> \
559
- --input "Implement and run focused tests" \
560
- --lane-role producer-a --lane-role producer-b
561
- ```
562
-
563
- Each Lane is a recoverable logical slot. A successful Lane points to its
564
- immutable Producer Turn result; a failed Turn leaves the Lane open and visible
565
- as `needs-attention`. The Leader retries or explicitly settles that exact Turn:
566
-
567
- ```sh
568
- yui task turn retry <task-id>/<failed-turn-id>
569
- yui task turn settle <task-id>/<failed-turn-id>
570
- ```
571
-
572
- Yui waits until every Lane is settled. At least two successful Producer results
573
- create one idempotent main Turn for the WorkItem assignee; fewer results fail
574
- the WorkItem attempt without falling back to a single result. A main Turn retry
575
- keeps the same source Group and never reruns successful Lanes. Only a successful
576
- main Turn can become the Candidate used by Review and Integration. `task work
577
- show`, `task work list`, Task context, and the Web control room derive execution
578
- shape, recovery targets, synthesis eligibility, main Turn, Candidate provenance,
579
- next action, and owner from the same persisted facts. Missing facts stay
580
- `unknown` or `unobserved`; token, duration, and tool-call totals are display-only.
581
-
582
- Permission is one adapter-specific enum configuration on each Agent binding:
583
- `default` follows the provider, `bypass` compiles the provider's supported
584
- bypass flag, and `configured` retains whichever native options are explicitly
585
- set. Codex options are `sandbox` and `approval`; Claude options are `mode`,
586
- `allowedTools`, and `disallowedTools`. Provider permission is independent from
587
- Profile behavior and Project write authority: only an exact WorkItem scope and
588
- matching managed workspace grant normal Project writes. A ReviewRound is the only non-WorkItem write
589
- purpose and must match its Turn, reviewRoundId, frozen base, and
590
- ReviewRound-owned main workspace or exact isolated Producer Lane workspace;
591
- every mismatch fails closed. Its diagnostic commit
592
- is visible history but is
593
- explicitly rejected by capture, ChangeSet, Integration, and acceptance paths.
594
- The Reviewer's final Provider response is its complete free-form Markdown or
595
- JSON result. Yui stores that text unchanged and does not parse headings, field
596
- names, checks, severities, findings, or verdicts. Core-owned workspace and Git
597
- evidence remains separate from Agent prose. Dirty uncommitted diagnosis may end
598
- without a commit; the worktree is retained and cleanup refuses it until it is
599
- clean.
600
-
601
- Every Role desired launch change increments its revision and applies only to a
602
- future launch. Each Turn and native Role Session stores the complete actual
603
- agent, adapter, model, effort, Profile access intent, exact writable Projects,
604
- permission strategy and native options, workspace, context, and source desired revision. Updating,
605
- switching, or clearing Role overrides never
606
- hot-mutates an existing process. When the Role has a live Session,
607
- `task role update`, `config role update`, and `config agent update` report that
608
- Session once and require `--yes`, so the change is recorded in the knowledge
609
- that it applies to the next activation; stopping the Session applies it
610
- immediately instead. `task context`, Role views, Turn history,
611
- Events, and Web show desired/effective revisions, Profile intent, permission, and
612
- pending next-launch drift.
613
-
614
- Both Codex and Claude deliver a managed Turn through the Provider's native Turn
615
- terminal. Yui stores the final assistant response as the exact Turn result,
616
- submits the WorkItem for Leader review, and queues the Leader. It does not
617
- accept the WorkItem. A Leader never wakes itself; any pending Operator or Worker
618
- wake remains durable until the Leader is idle.
619
-
620
- If the outcome cannot be determined, label the handoff `uncertain`,
621
- `incomplete`, `blocked`, or `requiring Leader judgment` and submit the most
622
- complete truthful identities, actions, repository state, checks and errors,
623
- lifecycle boundary, unfinished work, open decisions, risks, confidence, and
624
- bounded next options. The Turn result is immutable execution evidence only; it
625
- does not imply acceptance, WorkItem completion, ChangeSet capture,
626
- Integration, or Task completion.
627
-
628
- For one substantial feature requirement, the Leader may create a WorkItem and
629
- give it to a native subagent or Task Role Worker. A small Task or bugfix stays
630
- on Task main. Do not create a WorkItem merely to record implementation steps,
631
- tests, review, or follow-up fixes:
632
-
633
- ```sh
634
- yui task work create <task-id> "Implement the export API" \
635
- --objective "Deliver the independently acceptable export API requirement" \
636
- --accept "The API contract and focused validation are complete"
637
- yui task work update <task-id>/<work-item-id> running
638
- yui config profile show reviewer
639
- ```
640
-
641
- Subagent creation and result delivery happen inside the Leader's native Agent
642
- runtime; there is no Yui subagent launch command and Yui does not manage the
643
- child Session. The Leader must select and read an explicit Worker Profile,
644
- using `worker` when no specialist fits, and include its revision, instructions,
645
- Skills, access expectations, validation, and supported model/effort hints in
646
- the child brief. Agent bindings on Task Roles are ignored: the child inherits
647
- the Leader Agent, credentials, and conversation context. The Leader reviews the
648
- returned result and records the actual execution facts:
649
-
650
- ```sh
651
- yui task work update <task-id>/<work-item-id> done \
652
- --summary "executor=subagent; profile=reviewer@3; model=inherited; round=1; result=reviewed; checks=npm test passed"
653
- ```
654
-
655
- Use `inherited` or `unknown` when the native runtime does not expose an actual
656
- model or effort; do not guess. The three supported paths remain deliberately
657
- small: Leader direct execution, a conversation-native subagent, or a Task Role
658
- Turn when work needs its own provider, credentials, interaction, or durable
659
- Session.
660
-
661
- For an isolated Task Role result, the Leader first reviews the stored Turn result.
662
- An insufficient result is rejected with feedback and redispatched in the same
663
- workspace. An acceptable result is captured and integrated in a candidate
664
- worktree. Checks run there, and the target advances only if its recorded HEAD
665
- still matches:
666
-
667
- ```sh
668
- yui task integration start <task-id> \
669
- --work-item <work-item-id> \
670
- --strategy cherry-pick \
671
- --check "npm test"
672
- ```
673
-
674
- Integration state stores compact check outcomes and failure diagnoses. Full stdout and stderr are streamed without truncation to `YUI_HOME/artifacts/integration-checks/...`; `task integration show` exposes the relative log path, and `task integration cleanup` removes both the candidate worktree and those logs.
675
-
676
- Code or semantic conflicts remain blocked until that Task's Leader records a decision:
677
-
678
- ```sh
679
- yui task integration resolve <task-id>/<integration-id> \
680
- --option manual-resolution \
681
- --rationale "Preserve the public contract while combining both implementations"
682
- yui task integration continue <task-id>/<integration-id>
683
- ```
684
-
685
- Worker Turn completion is not WorkItem completion. The Leader accepts only after reviewing
686
- the result, validations, and the latest ChangeSet integration:
687
-
688
- ```sh
689
- yui task work accept <task-id>/<work-item-id> --summary "Acceptance criteria met."
690
- ```
691
-
692
- Use `task work reject` to return an awaiting result for repair and redispatch,
693
- and `task work retire <task>/<work> --summary "..."` to retire obsolete work,
694
- optionally naming a replacement. WorkItem and Integration
695
- worktrees and check logs remain available as evidence until explicit cleanup.
696
-
697
- Incorrect historical directives and execution attempts can be removed from
698
- operational projections without deleting their audit records:
699
-
700
- ```sh
701
- yui task message retire <task>/<message> --reason "Superseded instruction"
702
- yui task turn retire <task>/<turn> --reason "Invalid launch record"
703
- ```
704
-
705
- These commands append a retirement fact. Lists and audit views retain the
706
- original Message, WorkItem, or Turn and mark it retired; managed Turn context,
707
- actionability, recovery, review evidence, and scheduling ignore it. Retiring
708
- an active Turn first terminalizes that exact Turn, and retirement is
709
- idempotent. Only the user or global Operator may retire Messages or Turns;
710
- WorkItems may also be retired by their Task Leader.
711
-
712
- For long-running Tasks, the Leader keeps Yui—not a native transcript—as the
713
- recovery authority. The Task Brief owns the overall technical approach,
714
- including how coordinated Project changes fit together. WorkItems own the
715
- executable per-Project modifications and acceptance checks. The Leader updates
716
- Brief focus and Leader summary before ending each Provider Turn, records material choices as
717
- Decisions, adds phase outcomes as Milestones, and promotes only cross-Task
718
- stable facts to Project Knowledge.
719
-
720
- When an active Leader Turn cannot continue without a user decision, it creates a durable InputRequest and ends its Provider Turn with a truthful blocked result:
721
-
722
- ```sh
723
- yui task input request <task-id> --question "Which format should be the default?" \
724
- --choice csv="CSV" --choice json="JSON" --blocks work-item:<work-item-id>
725
- yui task input list
726
- yui task input show <task-id>/<input-id>
727
- yui task input answer <task-id>/<input-id> --choice csv
728
- ```
729
-
730
- Requests are user-required by default and remain open until answered or cancelled. When the Agent has a safe recommendation, it may attach a choice fallback and explicit timeout:
731
-
732
- ```sh
733
- yui task input request <task-id> --question "Which format should be the default?" \
734
- --choice csv="CSV" --choice json="JSON" \
735
- --recommend csv --timeout-seconds 300
736
- ```
737
-
738
- The recommendation is shown to the user. If no answer arrives, the nearest-deadline timer wakes the Controller to atomically apply that exact choice and queue the fixed Leader session to resume. Free-text and user-required requests never auto-resolve.
739
-
740
- `task input list` is the authoritative global open-input Inbox; add a Task ID to scope it, or `--all` to include answered and cancelled requests. Task completion, retirement, Leader attention, stalls, and open input are queued to the global Operator mailbox only as immutable TaskEvent or InputRequest references. The Controller merges one pending mailbox batch into one receipt-backed `[Yui updates]` user message for an existing ready Operator; the Operator reads the referenced records through the CLI and decides what is worth presenting. A running or unavailable Operator is never started or interrupted: the whole batch remains durable and is retried after native turn completion or a later Controller pass. This path is a user message, not a tool call, and it never inspects or classifies Agent terminal text. Answers may be submitted by the user or Operator. An open request prevents unrelated pending wakes and Task completion or archival. The originating Leader may instead run `yui task input cancel <task-id> <input-id> --reason "..."`; cancellation queues that fixed Leader session to resume.
741
-
742
- Inspect the result:
743
-
744
- ```sh
745
- yui task context <task-id>
746
- ```
747
-
748
- Use the narrower `task work`, `task message`, `task turn`, and Task Knowledge commands when you need one collection or record.
749
-
750
- Record a Task's confirmed PR/MR delivery state with one idempotent command:
751
-
752
- ```sh
753
- yui task publication upsert <task-id> --project <project> \
754
- --provider github --repository <owner/name> --kind pull-request --id <number> \
755
- --url <url> --state open --reported
756
- ```
757
-
758
- The required provider/repository/external ID selects the current Publication.
759
- The first upsert creates it. Later upserts inherit omitted metadata and omitted
760
- merge evidence only while the full evidence context remains unchanged. That
761
- context is the local commit, PR/MR state, remote commit, evidence text, and
762
- merge time. If any explicitly supplied context value differs, omitted
763
- verification resets to `reported` and omitted merge-evidence fields are
764
- cleared; changing the local commit without an explicit state also resets the
765
- Publication to `open`. Resupplying identical values remains idempotent. Each
766
- semantic change appends a new immutable record linked to the previous version,
767
- while identical input creates no event. `list`, `show`, and `task context`
768
- retain the complete history. This records facts already known to the caller;
769
- it does not query a provider or replace Review, Integration, or Task completion
770
- gates.
771
-
772
- Verify one current GitHub or GitLab Publication against the real PR/MR state:
773
-
774
- ```sh
775
- yui task publication verify <task-id>/<publication-id>
776
- ```
777
-
778
- Verification is an explicit external read. GitHub uses a trusted, PATH-pinned
779
- local `gh` executable; GitLab uses a trusted, PATH-pinned local `glab`
780
- executable. Both reuse the CLI's existing authentication, and Yui stores no
781
- provider token. The command requires the current unsuperseded Publication to
782
- record the exact Task delivery head, then requires the provider to report the
783
- same PR/MR head as merged and expose the integrated remote commit. It rechecks
784
- the Task head and Publication after the remote call before appending a new
785
- immutable `verified` record. Missing provider CLIs, unavailable
786
- authentication, ambiguous provider output, open/closed PRs or MRs, moved
787
- heads, and concurrent local changes fail without recording verification.
788
- GitLab repositories may use nested namespaces; a recorded self-hosted MR URL
789
- selects that GitLab host.
790
-
791
- Query whether every delivered Project head is represented by a current merged
792
- Publication:
793
-
794
- ```sh
795
- yui task remote-delivery <task-id>
796
- yui task remote-delivery <task-id> --json
797
- ```
798
-
799
- This is a read-only derived projection, not a Task status or writable `merged`
800
- flag. Active and reopened Tasks use the current clean Task-main heads and mark
801
- them provisional; completed and archived Tasks use the latest frozen
802
- `task.completed` heads. For each Project, Yui reports the expected local
803
- commit, the matching current unsuperseded Publication, PR/MR state,
804
- verification, and remote commit. Aggregate coverage is `none`, `unavailable`,
805
- `pending`, `partial`, or `merged`, with independent `allMerged` and
806
- `allVerified` values.
807
- Only a current Publication whose `localCommit` exactly matches the expected
808
- head and whose state is `merged` contributes merged coverage. Missing commits,
809
- open/closed records, stale heads, and superseded Publications never imply
810
- remote delivery. Projects whose Task head equals their managed base need no
811
- Publication. `task show`, `task context`, `task next-action`, and the Web detail
812
- projection use this same selector.
813
- `Archive --integrated coverage` requires both `allMerged=true` and
814
- `allVerified=true`.
815
-
816
- When a valid older completed Task has no frozen completion heads, Yui reports
817
- `unavailable` and keeps integrated archive fail-closed. Reopen and complete the
818
- Task again to record exact heads, then retry archive. Yui does not guess the
819
- missing head from a Publication or worktree, and `--force` never overrides
820
- missing head evidence.
821
-
822
- When the requested outcome is finished, complete the Task to stop automatic Leader wakes without deleting its sessions or Task main worktree:
823
-
824
- ```sh
825
- yui task complete <task-id> --summary "CSV export shipped and verified"
826
- yui task complete <task-id> --summary-file delivery.txt --refresh-remote
827
- yui task reopen <task-id>
828
- ```
829
-
830
- When a verified squash-merge Publication records a remote commit that is
831
- ancestry-divergent from the unchanged local Task head, a user or global Operator
832
- may explicitly authorize completion against its identical Git tree:
63
+ Tell the Operator what you want to work on:
833
64
 
834
- ```sh
835
- yui task complete <task-id> --summary-file delivery.txt \
836
- --accept-published-tree <publication-id>
837
- ```
65
+ > My project is at `/absolute/path/to/app`. Help me add CSV export.
66
+ > First clarify the scope, then implement and verify it. Don't publish anything.
838
67
 
839
- This is an independent exact-tree authorization. Yui requires the current,
840
- unsuperseded Publication to be merged and verified, its local commit to equal
841
- the physical Task head, its remote commit to be ancestry-divergent, and both
842
- commits to resolve to the same exact tree. When a Task-final Review obligation
843
- exists, completion also requires the latest semantic Round to attest the
844
- accepted Task head; otherwise completion does not invent a ReviewRound.
845
- `--refresh-remote` fetches
846
- the remote object graph before resolving that Publication commit. For a Task
847
- governed by a durable final-review contract, the stored contract continues to
848
- require its Reviewer policy, but compatible CLI and Controller updates do not
849
- need to reproduce its historical control-plane digest. Tasks without that
850
- contract retain the one-step explicit completion path. The Task event
851
- audit records the authorization and, on completion, the accepted Project,
852
- Publication, optional ReviewRound, both commits, and tree.
68
+ The Operator can register the Project and organize the request into a Task.
69
+ Its Leader handles planning and execution within your instructions. You can
70
+ ask questions, refine the requirement, or bring another request to the same
71
+ Operator without learning Task IDs or internal commands.
853
72
 
854
- Completed Tasks reject messages, dispatch, Provider authority changes, retry,
855
- and late Turn delivery until explicitly reopened, while retaining Task main for
856
- inspection or integration. Terminal WorkItem, Review, Integration, and Lane
857
- worktrees are non-blocking completion advisories, but they must be settled
858
- before archive. Every isolated WorkItem worktree is explicitly cleaned as
859
- integrated or abandoned; that cleanup also removes its managed branch. Archive
860
- requires `--integrated` or `--abandon` to state the Task main outcome and is
861
- allowed only after Task main is clean. `--integrated` additionally requires
862
- remote-delivery `allMerged=true` and `allVerified=true`; Task completion or a
863
- reported merge alone is never treated as verified remote delivery. When every
864
- exact Task head is merged but one or more Publications remain `reported`, the
865
- command identifies those Publications and refuses archive. An explicitly
866
- authorized `task archive <task-id> --integrated --force` may override only that
867
- verification gap and records the override in the archive event; it never
868
- bypasses missing, stale, open, or closed merge evidence. An intentional
869
- non-merge uses the existing explicit `--abandon` path. Archive removes managed
870
- worktrees but retains Task and WorkItem records. The Task main branch is
871
- retained as a recovery artifact instead of being silently deleted.
872
- Task lifecycle completion/selection only suggests valid source states: Draft for activate, active for complete, and completed for reopen.
73
+ ## Working through conversation
873
74
 
874
- ## Sessions and tmux
75
+ ### Let the Agent organize the work
875
76
 
876
- Managed Task Agents use the [hybrid Provider runtime](docs/provider-runtime.md).
877
- Provider conversations remain ordinary user conversations. Yui adds the Role
878
- Skill and Session Manifest pointer, then sends Task work through provider-native
879
- structured requests. Managed prompts are never delivered as terminal bytes.
77
+ You can bring a mixture of new requests, corrections and questions:
880
78
 
881
- Codex establishes the App Server WebSocket protocol through `app-server proxy`
882
- to create or resume an ordinary thread on the shared native daemon. The thread
883
- remains visible and directly usable in Desktop. Task execution stop terminates
884
- Yui's Agent Host and proxy while leaving the daemon and thread untouched; start
885
- creates a fresh proxy attachment.
886
- If the proxy disconnects, the Host may attach a bounded replacement client and
887
- reconcile the exact owned Turn from native history. A failed fresh attachment
888
- is released instead of becoming a cleanup prerequisite for later Turns.
889
- Claude Code keeps its independent stream-json process. Agent Host is the sole
890
- writer to that process, so a completed stream write accepts the Turn; the
891
- later provider `result` event settles it. An uncertain write becomes
892
- `delivery-unknown` and is never automatically retried.
79
+ > The CSV export also needs to preserve leading zeros in account numbers.
80
+ > Separately, investigate why login is slow. Prioritize the export first.
893
81
 
894
- Task Role observation and takeover are explicit:
82
+ The Operator uses existing Task context to decide what belongs together and
83
+ what deserves an independent Task. It can organize work by Project, type,
84
+ priority and tags. A follow-up need not become a new Task, and a Task need not
85
+ be split into a WorkItem for every implementation step.
895
86
 
896
- ```sh
897
- yui task role view <task-id> <role>
898
- yui task role takeover <task-id> <role>
899
- yui task role release <task-id> <role>
900
- ```
87
+ The Leader owns delivery: small work can stay with the Leader; independent
88
+ requirements can go to configured Workers; a Reviewer can inspect the result
89
+ when appropriate. Agents choose the plan and delegation. The Controller
90
+ delivers the scheduled work, observes execution and returns results to the
91
+ responsible Agent—without requiring you to relay messages between sessions.
901
92
 
902
- For an independently hosted Provider such as Claude, these commands are the
903
- supported human-control boundary. A Codex Role uses an ordinary shared thread
904
- and may be operated directly in Desktop; an active Desktop Turn creates bounded
905
- backpressure for Yui rather than a failed Turn.
93
+ ### Configure by asking
906
94
 
907
- Turn is the only durable Role scheduling state. Conversation state does not
908
- carry a second current-Turn pointer. A Yui-dispatched Provider Turn carries the
909
- durable Turn id that correlates its visible input and terminal result; a direct
910
- Provider Turn is recorded as direct conversation history without entering the
911
- scheduling pointer. A native Turn terminal completes that Turn, after which Yui
912
- may claim the next Turn and submit it through the same Session.
913
- TaskRole itself stores identity and desired launch configuration, not runtime
914
- status; Role status shown by CLI/Web is derived from the active Turn plus
915
- Session/Driver lifecycle facts.
95
+ Stay in the Operator conversation to change how Yui works:
916
96
 
917
- Global Operator and global Role sessions remain native interactive CLIs. Codex
918
- connects that TUI to the default shared App Server, so the same thread can move
919
- between Yui and Desktop without transferring a rollout writer or losing its
920
- Global Context entry. A thin Host in the same pane transparently forwards the
921
- native TUI's App Server connection and acknowledges its exact `thread/start`
922
- or `thread/resume` response. Yui records that Thread ID before the first user
923
- Turn, without depending on `notify`, scanning history, or creating a bootstrap
924
- message. The attachment outlives Controller restarts but exits with the TUI:
97
+ > Show me the available Agents and models. Suggest a setup for planning,
98
+ > implementation and review, then apply it after I confirm.
925
99
 
926
- ```sh
927
- yui session enter <global-role>
928
- ```
100
+ The Operator reads the actual configuration and supported choices before
101
+ making changes. You can ask it to change a model, bind another Agent, adjust
102
+ review preferences or explain a setting. It should tell you what changes,
103
+ whether it affects future launches or a live Session, and which choices need
104
+ your confirmation. You do not need to hand-edit configuration files.
929
105
 
930
- `yui update` accepts either the current Home contract or any valid historical
931
- contract at or above the staged CLI's minimum supported migration version.
932
- Unsupported newer Homes and Homes below that floor remain untouched.
106
+ ### Pick up where you left off
933
107
 
934
- tmux fixes a pane's history capacity when that pane is created. Existing panes
935
- retain their configured capacity; managed runtime output remains observable in
936
- the Agent Host pane without becoming lifecycle or acknowledgement evidence.
108
+ > What is still active? Which tasks need my decision? Continue the CSV task
109
+ > from its saved state and summarize what remains.
937
110
 
938
- Each Role, including Operator and a Task-bound Worker instance, can bind multiple
939
- configured Agents, has one active Agent, and keeps a separate native session per
940
- Agent binding. Multiple bindings may use the same adapter for different accounts,
941
- models, profiles, or environment sources. They are ready-to-switch configurations,
942
- not parallel writers: the active binding remains the unique authority. Operator can
943
- keep multiple conversations for each binding. `operator new` and
944
- `operator resume` reuse the single Operator tmux pane: when a process is
945
- running, Yui asks before stopping it and switching the conversation. On a
946
- cross-Agent switch, the saved model and effort are reused unless the user
947
- explicitly chooses to update them.
111
+ Tasks retain requirements, decisions and results independently of the native
112
+ chat history. Yui delivers durable updates to the Operator; the Agent can
113
+ recover context and continue compatible sessions, or choose a new execution
114
+ when necessary. A failed process does not erase the Task, and an uncertain
115
+ submission is not silently repeated.
948
116
 
949
- Window existence does not imply a running Agent: `pane_dead=0` is live and
950
- `pane_dead=1` is an exited, retained diagnostic pane. Status reads never delete
951
- that evidence, and unreadable state is an error rather than proof of exit.
952
- An explicit launch can rebuild the exact dead window; tmux refuses to replace
953
- a live pane. An unidentified live Operator still cannot be overwritten.
117
+ For a visual overview, run `yui web` in another terminal. The local Web view
118
+ shows the same tasks and pending questions; it is not a separate task system.
954
119
 
955
- The Role's active binding is desired state for the next launch. A
956
- running Turn and its native Session continue under their immutable
957
- effective snapshot even if the Role is edited or switched. Resume is refused
958
- only when continuation is impossible: no recoverable native Session, a
959
- different Agent or adapter, or a different physical workspace. Desired launch
960
- configuration such as model, effort, permission, Role context, Skills, or
961
- declared write scope shapes the next activation instead of ending the Session,
962
- and Turn-scoped facts such as ReviewRound identity or candidate commits never
963
- affect reuse. When continuation is impossible Yui starts a new Session after
964
- the old process has stopped and keeps the terminal Session's immutable
965
- effective snapshot in history. Managed
966
- Sessions invoke the ordinary `yui` command; their Manifest and durable
967
- Role/Turn fences authenticate scope while protocol and storage compatibility
968
- allow a CLI package or Controller upgrade in place. Exact internal callbacks
969
- remain fenced to their originating runtime snapshot.
120
+ ## Core design
970
121
 
971
- Use `yui config role unbind <global-role> <agent-id>` or `yui task role unbind <task-id> <role> <agent-id>` to retire a dormant binding. The active binding and any non-stopped native session are rejected; a stopped session record is removed atomically with the binding.
122
+ ### Agents make decisions; Yui makes work durable
972
123
 
973
- Claude session IDs are preallocated at launch. Codex discovers its native
974
- thread identity from App Server responses. Managed Task Turns use structured
975
- Provider observations for both CLIs. Global Codex uses the native TUI's exact
976
- App Server startup response and the existing Host acknowledgement. Legacy
977
- global `notify` callbacks cannot register a Session or change its lifecycle.
124
+ Yui is a local control plane and context API, not a fixed workflow engine.
125
+ The Operator recognizes and routes requests. A Leader owns each Task's outcome
126
+ and chooses planning, delegation, review and recovery. The Controller handles
127
+ delivery and runtime facts; it does not decide whether an Agent's answer is
128
+ good enough.
978
129
 
979
- Automated lifecycle and delivery decisions use structured Provider events or
980
- supported Hook payloads, persisted identities, usage snapshots, tmux process state, receipts, and pane
981
- fences. Yui never
982
- parses prompt glyphs, progress text, trust dialogs, or other Agent terminal
983
- output to infer readiness or success. `captureRole()` remains an explicit
984
- human-facing transcript read and has no lifecycle authority.
130
+ Tasks, messages, decisions, original execution results and Project Knowledge
131
+ are durable context. Agents read and update that context through small,
132
+ scoped CLI operations. Session and process state support execution, but do not
133
+ replace the record of what the user asked for.
985
134
 
986
- The [AgentRuntime Driver architecture](docs/agent-runtime-drivers.md) keeps
987
- native Codex/Claude event names at the edge. Core consumes exact-fenced
988
- Session, Turn, operation, waiting, host, and activity observations. A positive
989
- token delta is evidence of recent runtime activity; an unchanged counter is
990
- not. A live tmux pane proves only that the host exists. Runtime activity and
991
- durable workflow progress use independent clocks, so token/tool/resource
992
- movement cannot conceal a workflow that is not advancing.
135
+ ### Separate the task from the conversation
993
136
 
994
- Stable Role context never creates a separate bootstrap Turn. Task execution Turns use the generic Leader or Worker Skill, while review Turns use the generic Reviewer Skill based on durable Turn purpose rather than a configured Role name. The provider either carries the Skill through a safe additive native context channel or points to it from the ordinary Task delivery. These Yui-owned Role Skills define portable orchestration only. Project Skills remain ordinary versioned files in the Project and are discovered, selected, and loaded by the Agent through its native project mechanism; Yui does not scan, parse, copy, or inject them.
137
+ A Task is the outcome; a WorkItem is an independently acceptable requirement;
138
+ a Session is a native conversation; an AgentRun is an explicitly requested
139
+ execution. Keeping them separate lets you discuss a Task without starting work,
140
+ continue a requirement across executions, and inspect the original result
141
+ without confusing “the Agent finished speaking” with “the work was accepted.”
995
142
 
996
- Managed Codex keeps the user's native developer instructions unchanged. The ordinary Task message includes a compact absolute Session Manifest pointer, and the manifest identifies the matching Yui-owned Role Skill for Codex to read on demand. Model, effort, permission, workspace, and shell settings are supplied to `thread/start` or `thread/resume` through the shared App Server daemon; a Codex native config profile is rejected because it cannot be isolated to one shared-daemon thread. The underlying Codex config file is never mutated. App Server notifications are the managed thread's lifecycle authority; Yui installs no managed Codex Hook and does not claim `notify`. Interactive Codex Sessions may still use Yui's structured `notify` callback, and Doctor reports any effective configuration conflict. `skills.config` is not misused because it only enables or disables already-discovered Skills. Claude receives the same Yui-owned Role Skill content from a private `0600` managed context file rather than a large or sensitive argv value; retries and resumes reuse the purpose-specific Role path. Non-Operator global Roles stay neutral and receive no Task orchestration Skill. Operator therefore opens at an empty native composer, so the user's text remains its first user message. Leader wakeups and Worker or Reviewer Turn assignments remain real mailbox-delivered work messages.
143
+ A Draft can hold planning before adopting a delivery workspace. For repository
144
+ work, changes happen in managed worktrees rather than the stable Project
145
+ checkout. The Leader evaluates results and coordinates review and integration
146
+ against the actual scope.
997
147
 
998
- ## Controller and failure handling
148
+ ### Keep execution replaceable and authority explicit
999
149
 
1000
- One background Controller runs per `YUI_HOME`:
150
+ Codex CLI, Claude Code CLI and ACP connections—including a Claude Agent SDK
151
+ bridge—share an execution boundary while retaining their native capabilities
152
+ and conversations. Configured intent and what the running Agent actually reports
153
+ are distinct facts; Yui does not pretend every integration behaves identically.
1001
154
 
1002
- ```sh
1003
- yui controller status
1004
- yui controller status --all
1005
- yui controller status --all --verbose
1006
- yui controller cleanup
1007
- yui controller cleanup --all
1008
- yui controller stop
1009
- yui controller restart
1010
- ```
155
+ When a Task needs an additional capability, its Leader can create and validate a
156
+ Task-local plugin and explicitly activate it within existing authority.
157
+ Executable plugins need specific execution grants. Results can be saved
158
+ independently of the plugin or Session that produced them.
1011
159
 
1012
- `controller status` scans the current `YUI_HOME` without starting a Controller. It
1013
- shows a bounded summary of the current Controller, owned Agent sessions, residual
1014
- resources, and live anomalies. `--all` also discovers other same-user Yui homes
1015
- from running processes; `--verbose` expands the resource details. `--json`
1016
- returns the complete typed snapshot even when the human view is abbreviated.
160
+ Yui is designed for one trusted local user. It is not an OS sandbox or a remote
161
+ multi-user service. Publishing, granting new access and other external effects
162
+ still require the corresponding authority.
1017
163
 
1018
- `controller cleanup` is interactive and never selects active Task or Role
1019
- resources. It separates safe and review-required candidates, confirms live
1020
- process cleanup explicitly, and revalidates process, tmux pane, and socket
1021
- identity immediately before acting. Partial failures are reported without
1022
- hiding the resources that remain. Use `--all` to include discovered Yui homes.
164
+ ## Learn more
1023
165
 
1024
- `controller restart` replaces the Controller process and its scheduler/socket services with the currently installed Yui version. It can recover a lost discovery record only when the old process still matches the current UID, Controller entrypoint, physical Home, PID, and process-start identity. It does not stop or restart managed tmux/Agent sessions.
166
+ The [architecture overview](ARCHITECTURE.md) explains the end-to-end design.
167
+ The [documentation map](docs/architecture/README.md) links the current contracts
168
+ for configuration, execution, delivery, storage and plugins. Use `yui --help`
169
+ when you want to operate the CLI directly.
1025
170
 
1026
- Successful `setup` and `update` commands ensure that the current Home has a
1027
- running Controller, starting one when the Home was previously idle. A
1028
- successful `upgrade` restores a Controller only when it stopped one for the
1029
- migration. `update` starts the replacement only after migration and health
1030
- checks pass.
1031
-
1032
- Its recovery reconciliation runs every 120 seconds by default. Normal durable state changes enqueue a Task, Role, or Operator key and return immediately; keys received in the same fixed 100 ms window trigger one non-overlapping targeted pass. Operator presentation has an independent lane, so a blocked Task workspace operation cannot delay a user question. Periodic Git/worktree work is limited to Tasks with durable Task-mailbox work, while active Role liveness uses one tmux inventory. Structured Agent Driver observations, whether received from native provider events or supported Hooks, are exact-fenced before they reach the durable runtime inbox. A terminal Turn observation atomically records the exact Turn result. Durable mailboxes freeze the current batch while new signals merge into the next batch. Task-orchestration failures retain the exact Controller-owned processing batch for two bounded fast retries and later periodic recovery; a successful retry completes that batch before newer pending work is claimed. Recommended InputRequest and pending Turn deadlines share one nearest-deadline selector and therefore do not wait for the recovery interval. Explicit `task reconcile` still requests an immediate recovery pass. The retained loop is:
1033
-
1034
- 1. dispatch pending Leader wakes whose Task workspaces are already ready;
1035
- 2. prepare active Project Task main worktrees with durable orchestration work;
1036
- 3. deliver active Role Turns from durable active-Turn state, using ordinary
1037
- Role mailboxes only as optional delivery hints;
1038
- 4. resolve due Turn completions and reconcile Role liveness;
1039
- 5. dispatch Leader work created or unblocked by the later recovery phases.
1040
-
1041
- Automated input is sent only through tmux. Each pass performs one non-blocking process-state readiness check; a busy startup is retried through a small bounded mailbox timer, while later busy sessions are woken by canonical Agent Driver terminal observations. A pane-local receipt prevents the same Turn input from being typed twice after a Controller retry.
1042
-
1043
- If a Role process exits without a terminal Provider result, the Controller fails that Turn and queues the Leader. A replicated WorkItem or Review Producer Lane remains open for exact retry or explicit settlement; completed sibling results remain reusable. Recovery failures are exposed through the small Jobs view:
1044
-
1045
- ```sh
1046
- yui jobs list
1047
- yui jobs retry leader-recovery:<task-id>
1048
- yui task reconcile <task-id>
1049
- yui task turn retry <failed-turn-id>
1050
- yui task turn settle <failed-turn-id>
1051
- ```
171
+ Yui stores its control-plane data under `~/.yui` by default; `YUI_HOME` selects
172
+ another instance. See [storage and upgrades](docs/sqlite-control-plane-design.md)
173
+ before moving between builds or updating an existing Home.
1052
174
 
1053
- `jobs` is not a restored generic queue: it presents durable pending Leader wakes and Leader recovery failures only.
175
+ ## Contributing
1054
176
 
1055
- `task turn settle` records that the Leader will no longer recover the exact
1056
- current failed Producer Lane Turn. Only then does the Lane become failed and the
1057
- settled Group become eligible for WorkItem or Review synthesis when at least
1058
- two Producer results succeeded. The same command retains its narrow repair for an obsolete failed
1059
- Reviewer Turn whose Task-final ReviewRound is stranded on an old frozen
1060
- candidate; that repair never creates a retry Round.
1061
-
1062
- Completion is the reversible execution fence. Archiving is terminal and is accepted only after active work is settled: it stops the Task's tmux session and removes clean managed worktrees. Dirty worktrees keep the Task completed and are preserved for deliberate resolution.
1063
-
1064
- ## Local web control room
1065
-
1066
- Run the local control room on the default loopback address:
1067
-
1068
- ```sh
1069
- yui web
1070
- # Yui web control room: http://127.0.0.1:4173
1071
- ```
1072
-
1073
- Use `--port <port>` or `--host 127.0.0.1|::1|localhost` to change the
1074
- listener. Yui rejects non-loopback hosts because the control room exposes Task
1075
- metadata, Briefs, Roles, WorkItems, Turns, messages, Decisions, Milestones, and
1076
- InputRequests. A random token embedded in the served page protects its write
1077
- and terminal endpoints.
1078
-
1079
- The Web surface can answer an open InputRequest through the same durable CLI
1080
- mutation used by Terminal users. It can also attach to the existing Operator,
1081
- Leader, or Worker tmux pane through a native xterm client. Closing the browser
1082
- terminal detaches only that tmux client; the Agent process and conversation
1083
- continue running in tmux. The Web surface does not duplicate transcripts or
1084
- maintain another session state.
1085
-
1086
- The dashboard opens on an overview cockpit: four operational metrics (active
1087
- tasks, open inputs waiting on you, completed tasks, and the total), a
1088
- cross-task attention inbox that surfaces every open InputRequest with its
1089
- question and urgency so you can answer without drilling in, and the list of
1090
- currently active tasks. Each task row carries a derived execution status
1091
- (progressing, needs attention, blocked, recovering) so stalled or failed
1092
- work is visible before you open a task. Selecting a task opens an anchored
1093
- detail view (Summary, Focus, Work items, Turns, Roles, History, Messages)
1094
- with a sticky tab bar that tracks the visible section. The Summary tab leads
1095
- with an execution band that consolidates the Task's owner, current action,
1096
- attention list, blockers, and fail-closed indicators; Work items surface
1097
- their current ExecutionGroup with per-lane status, Candidates, and
1098
- retirement disposition; Turns show purpose, execution lineage, final result,
1099
- and Leader disposition; Reviews show direct or replicated shape, frozen
1100
- Assignment, Producer Lane state, main synthesis Turn, and authoritative result.
1101
-
1102
- The control room supports English and Simplified Chinese, selecting an initial locale from the browser and remembering manual changes. The theme selector switches between the dark Control Room, the light Paper Ledger, and the dark-blue Atlas themes. Both choices are stored only in browser `localStorage`; they do not modify `YUI_HOME`.
1103
-
1104
- ## Management commands
1105
-
1106
- The restored management surface includes:
1107
-
1108
- ```sh
1109
- yui update
1110
- yui upgrade [--dry-run]
1111
- yui config agent add|list|show|capabilities|update|remove
1112
- yui config role add|list|show|update|remove|bind|unbind
1113
- yui config profile add|list|show|update|remove|reset
1114
- yui config completion [bash|zsh|fish]
1115
- yui session enter|record|replace|reconcile
1116
- yui session stop --all
1117
- yui project add|clone|refresh|update|discover|list|show|knowledge
1118
- yui project reset|replace|retire|delete
1119
- ```
1120
-
1121
- `yui update` stages the newly published package side by side and asks that exact
1122
- binary to classify the Home. Only then does it stop the exact old Controller,
1123
- activate the same concrete package version, apply the complete missing
1124
- migration chain when needed, validate the actually installed binary and Home,
1125
- and start the replacement Controller. Unsupported Homes block preflight and
1126
- remain untouched.
1127
-
1128
- `yui upgrade --dry-run` prints the ordered migration plan without writing.
1129
- `yui upgrade` creates a timestamped SQLite backup and upgrades any valid Home
1130
- from the CLI's minimum supported storage version to its current version. Yui
1131
- 0.15.0 is storage version 1; pre-0.15.0 Homes remain outside that migration
1132
- line and are never rewritten.
1133
-
1134
- Agent environment bindings store process-environment variable names, never secret values. Adapter-owned lifecycle arguments cannot be overridden through raw arguments.
1135
-
1136
- ## Scope
1137
-
1138
- Yui targets one trusted local user on one machine. Its Web/API surface is
1139
- loopback-only and intentionally omits remote or multi-user Web access,
1140
- distributed coordination, backup/import/export commands, trash/restore,
1141
- derived indexes, recovery journals, runtime leases, inactivity TTLs,
1142
- cooldowns, and recurring schedules.
1143
-
1144
- See [ARCHITECTURE.md](./ARCHITECTURE.md) for persistence and scheduling details.
1145
- ## Development
1146
-
1147
- ```sh
1148
- npm ci
1149
- npm test
1150
- ```
1151
-
1152
- The permanent suite is intentionally one seconds-scale core smoke. It checks
1153
- CLI startup, a normal SQLite Task path, exact-current storage admission, and the
1154
- built-in Agent Drivers. Change-specific TDD fixtures and abnormal-data repros
1155
- are temporary development evidence and are removed when the change is complete;
1156
- they do not accumulate as permanent regression tests. See
1157
- [the verification policy](./docs/testing/verification-levels.md).
1158
-
1159
- To make user terminals use this checkout, reversibly link the user-level `yui` command:
1160
-
1161
- ```sh
1162
- make link
1163
- command -v yui
1164
- yui doctor
1165
- ```
1166
-
1167
- The first `make link` saves the original `yui` entry in the same user-level bin directory and replaces it with a managed symlink to this checkout. A later `make link` from another checkout only moves that managed symlink; the last checkout wins and development links never form a backup chain. Run `make link` and `make unlink` serially—do not invoke them concurrently from multiple environments or checkouts. The launcher defaults `YUI_HOME` to the active checkout's `output/dev/home`; an explicit `YUI_HOME` remains authoritative. Managed Agent launches do not depend on this global link: the Controller prepends a private launcher for its own Yui CLI and `YUI_HOME`. Run `yui controller restart` if an already-running Controller must load the new build. `make unlink` from any checkout using this implementation verifies the shared managed state and restores the one original `yui` entry.
1168
-
1169
- ```sh
1170
- make unlink
1171
- ```
1172
-
1173
- To run this checkout in isolation without changing the global `yui`, build only
1174
- its local launcher instead of linking:
1175
-
1176
- ```sh
1177
- make install-local
1178
- ./output/dev/bin/yui doctor
1179
- ```
1180
-
1181
- `make install-local` writes a self-contained launcher at `output/dev/bin/yui`
1182
- and never touches the user-level `yui` command. The launcher resolves its own
1183
- checkout and defaults `YUI_HOME` to this checkout's `output/dev/home`. The
1184
- Controller socket is derived from that Home's durable `homeId` at the fixed
1185
- Linux path `/tmp/yui-<uid>/<homeId>.sock`; discovery also binds the physical
1186
- Home directory, so caller `TMPDIR`, path aliases, and copied runtime records
1187
- cannot redirect control requests. The tmux server namespace and state remain
1188
- scoped to the selected Home, so the checkout stays separate from other
1189
- checkouts and the global install.
1190
- It is idempotent, so re-run it after pulling new code (then run
1191
- `./output/dev/bin/yui controller restart` if a Controller is already running).
1192
- Call the launcher by its absolute path for a stable per-checkout entry point;
1193
- exporting `output/dev/bin` onto `PATH` is a per-shell convenience only.
1194
-
1195
- `make install-local` builds `dist/` and writes exactly one file—the launcher
1196
- itself. It does not modify `PATH` and does not create the data home, so run
1197
- `./output/dev/bin/yui setup` once before commands that need state. Because a
1198
- bare `yui` is resolved through `PATH` and not by the current directory, working
1199
- inside this checkout does not make a bare `yui` use the local launcher; it still
1200
- runs whatever `PATH` finds. Select this instance with the absolute launcher
1201
- path, or, for one interactive shell only, prepend it to `PATH`:
1202
-
1203
- ```sh
1204
- export PATH="$PWD/output/dev/bin:$PATH" # this shell only; not for automation
1205
- ```
177
+ In a source checkout, start with `npm ci` and `npm test`. Read
178
+ `.agents/skills/develop-yui/SKILL.md` and the
179
+ [verification policy](docs/testing/verification-levels.md).
180
+ Source builds also need a Linux C compiler and static libc development libraries
181
+ for the Claude process owner. Published packages include that executable;
182
+ npm users do not need to compile it.
1206
183
 
1207
- This is the recommended entry point for agents and scripts: run
1208
- `make install-local` once, then call `<checkout>/output/dev/bin/yui ...` by
1209
- absolute path from any working directory. Avoid relying on `export` persisting,
1210
- since each command runs in a fresh process.
184
+ To exercise your checkout, run `make install-local`, then use the absolute
185
+ `<checkout>/output/dev/bin/yui` launcher. It defaults to an isolated Home under
186
+ that checkout; run its `setup` before stateful use. Do not use the global `yui`
187
+ or `make link` to validate local changes. Live-model, paid or shared-resource
188
+ tests require an explicit request for those resources.
1211
189
 
1212
190
  ## License
1213
191
 
1214
- [MIT](./LICENSE)
192
+ [MIT](LICENSE)