@zq-silk/yui 0.15.7 → 0.15.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (308) hide show
  1. package/ARCHITECTURE.md +194 -399
  2. package/ARCHITECTURE.zh-CN.md +151 -0
  3. package/README.md +306 -1131
  4. package/dist/agent/adapterCatalog.js +15 -2
  5. package/dist/agent/agent.js +23 -3
  6. package/dist/agent/argumentPolicy.js +7 -1
  7. package/dist/agent/connectionPlan.js +62 -0
  8. package/dist/agent/executionComponents.js +158 -0
  9. package/dist/agent/launchEnvironment.js +31 -3
  10. package/dist/agent/managedRuntimeEnvironment.js +3 -5
  11. package/dist/{turn/turn.js → agentRun/agentRun.js} +166 -109
  12. package/dist/{turn/turnIdentity.js → agentRun/runIdentity.js} +4 -4
  13. package/dist/artifacts/artifactCapability.js +74 -0
  14. package/dist/artifacts/artifactCommitLock.js +249 -0
  15. package/dist/artifacts/artifactPaths.js +151 -0
  16. package/dist/artifacts/gitArtifactRef.js +146 -0
  17. package/dist/artifacts/managedGit.js +332 -0
  18. package/dist/artifacts/taskArtifactRepository.js +277 -0
  19. package/dist/brief/taskBrief.js +12 -0
  20. package/dist/cli/agentConfigurationPicker.js +13 -0
  21. package/dist/cli/commandCatalog.js +165 -74
  22. package/dist/cli/interactionCandidates.js +5 -5
  23. package/dist/cli/interactionPolicy.js +38 -8
  24. package/dist/cli/invocationRouter.js +1 -1
  25. package/dist/cli/managedDiagnostics.js +28 -0
  26. package/dist/cli/operatorWizard.js +1 -7
  27. package/dist/cli/roleOptionOrder.js +27 -0
  28. package/dist/cli/roleWizard.js +50 -14
  29. package/dist/cli/updateOrchestrator.js +1 -1
  30. package/dist/cli/updatePorts.js +3 -4
  31. package/dist/cli.js +245 -95
  32. package/dist/commands/agentCommands.js +72 -14
  33. package/dist/commands/capabilityCommands.js +9 -6
  34. package/dist/commands/configCommands.js +20 -20
  35. package/dist/commands/deliveryGuardPreflight.js +2 -2
  36. package/dist/commands/executionAuditCommands.js +24 -24
  37. package/dist/commands/globalRoleCommands.js +1 -1
  38. package/dist/commands/grantCommands.js +4 -4
  39. package/dist/commands/operatorCommands.js +34 -9
  40. package/dist/commands/projectCommands.js +4 -4
  41. package/dist/commands/resourcesCommands.js +2 -2
  42. package/dist/commands/roleConfiguration.js +25 -5
  43. package/dist/commands/roleRuntimeGuard.js +4 -5
  44. package/dist/commands/sessionCommands.js +3 -7
  45. package/dist/commands/taskActivationCommands.js +281 -0
  46. package/dist/commands/taskActor.js +28 -49
  47. package/dist/commands/taskCommands.js +1461 -720
  48. package/dist/commands/taskContextCommand.js +39 -583
  49. package/dist/commands/taskExecutionCommands.js +32 -32
  50. package/dist/commands/taskInputCommands.js +40 -104
  51. package/dist/commands/taskIntegrationCommands.js +3 -2
  52. package/dist/commands/taskIntegrationQueueCommands.js +1 -1
  53. package/dist/commands/taskNextActionCommand.js +8 -8
  54. package/dist/commands/taskOverviewCommand.js +33 -45
  55. package/dist/commands/taskRemoteDeliveryCommand.js +2 -2
  56. package/dist/commands/taskRoleRuntimeStatus.js +133 -102
  57. package/dist/commands/telemetryCommands.js +36 -38
  58. package/dist/config/configCatalog.js +4 -4
  59. package/dist/config/yuiConfig.js +8 -8
  60. package/dist/context/contextSnapshot.js +10 -10
  61. package/dist/context/dispatchContext.js +11 -11
  62. package/dist/context/roleSessionContext.js +6 -3
  63. package/dist/context/{turnContextPack.js → runContextPack.js} +158 -81
  64. package/dist/context/{turnInputContract.js → runInputContract.js} +73 -60
  65. package/dist/context/sessionBootstrapManifest.js +21 -2
  66. package/dist/context/sourceRunContext.js +30 -0
  67. package/dist/context/taskContext.js +481 -0
  68. package/dist/context/wakeNotification.js +27 -27
  69. package/dist/controller/agentRuntimeObserver.js +21 -24
  70. package/dist/controller/capabilityBridge.js +17 -6
  71. package/dist/controller/clientRuntime.js +65 -92
  72. package/dist/controller/controller.js +120 -188
  73. package/dist/controller/fileSchedulerStoreAdapter.js +787 -887
  74. package/dist/controller/jobControl.js +54 -85
  75. package/dist/controller/resourceInventory.js +8 -27
  76. package/dist/controller/resourceInventoryLinux.js +12 -13
  77. package/dist/controller/runtime.js +529 -479
  78. package/dist/controller/runtimeEventInbox.js +55 -25
  79. package/dist/controller/runtimeEventProcessor.js +22 -31
  80. package/dist/controller/{runtimeHookTurnFence.js → runtimeHookRunFence.js} +91 -115
  81. package/dist/controller/runtimeLaunchCoordinator.js +80 -426
  82. package/dist/controller/runtimeObservationHook.js +14 -18
  83. package/dist/controller/sessionNotify.js +16 -24
  84. package/dist/controller/sessionOwnerReconciliation.js +168 -50
  85. package/dist/controller/structuredProviderObservation.js +138 -99
  86. package/dist/coordination/workMailbox.js +3 -3
  87. package/dist/coordination/workMailboxQueue.js +36 -33
  88. package/dist/core/boundedRpc.js +8 -1
  89. package/dist/core/controllerClient.js +20 -1
  90. package/dist/core/controllerServer.js +4 -4
  91. package/dist/doctor/doctor.js +13 -2
  92. package/dist/domain/agentResultTransport.js +9 -9
  93. package/dist/execution/codexThreadNaming.js +2 -8
  94. package/dist/execution/executionHealth.js +51 -63
  95. package/dist/execution/reviewMainRun.js +137 -0
  96. package/dist/execution/workItemExecution.js +28 -29
  97. package/dist/execution/workItemExecutionProjection.js +99 -107
  98. package/dist/execution/workItemMainRun.js +141 -0
  99. package/dist/executor/agentAdapter.js +227 -20
  100. package/dist/executor/agentConfigurationCatalog.js +126 -4
  101. package/dist/executor/agentConfigurationProbe.js +162 -4
  102. package/dist/executor/agentExecutor.js +79 -78
  103. package/dist/executor/effectiveLaunch.js +105 -18
  104. package/dist/executor/executorRegistry.js +29 -44
  105. package/dist/executor/fileRoleLaunchPlanner.js +229 -154
  106. package/dist/executor/workspacePreflightClassification.js +16 -16
  107. package/dist/grant/capabilityGrant.js +6 -3
  108. package/dist/input/inputRequest.js +12 -10
  109. package/dist/integration/gitIntegrationService.js +4 -11
  110. package/dist/integration/integrationQueueService.js +4 -4
  111. package/dist/interaction/operatorPresentation.js +1 -1
  112. package/dist/kernel/builtinCapabilities.js +255 -12
  113. package/dist/kernel/capabilityRegistry.js +64 -18
  114. package/dist/kernel/instanceHost.js +12 -1
  115. package/dist/kernel/kernelPorts.js +2 -2
  116. package/dist/lifecycle/canonicalLifecycleEvent.js +44 -49
  117. package/dist/lifecycle/exactRunTerminalization.js +449 -0
  118. package/dist/message/message.js +118 -6
  119. package/dist/message/messageContinuation.js +204 -0
  120. package/dist/observability/executionAudit.js +70 -72
  121. package/dist/observability/faultClassification.js +2 -2
  122. package/dist/observability/orchestrationMetrics.js +8 -8
  123. package/dist/operator/operatorSessionHistory.js +1 -7
  124. package/dist/output/agentConfigurationPresentation.js +8 -3
  125. package/dist/output/agentRunConfigurationPresentation.js +128 -0
  126. package/dist/output/rolePresentation.js +54 -3
  127. package/dist/plugins/pluginChild.js +104 -0
  128. package/dist/plugins/pluginIntent.js +26 -0
  129. package/dist/plugins/pluginInterpreter.js +43 -0
  130. package/dist/plugins/pluginPackage.js +101 -0
  131. package/dist/plugins/pluginProcess.js +112 -0
  132. package/dist/plugins/pluginService.js +388 -0
  133. package/dist/profile/agentProfile.js +1 -1
  134. package/dist/repository/gitWorkspace.js +26 -4
  135. package/dist/repository/project.js +19 -4
  136. package/dist/repository/taskBaseFreshness.js +13 -13
  137. package/dist/repository/taskWorkspaceCoordinator.js +20 -27
  138. package/dist/repository/taskWorkspacePreparer.js +344 -83
  139. package/dist/resources/autoResourceGc.js +3 -3
  140. package/dist/resources/liveReferences.js +3 -3
  141. package/dist/resources/projectResource.js +75 -0
  142. package/dist/resources/projectResourceService.js +343 -0
  143. package/dist/resources/resourceDiscovery.js +6 -6
  144. package/dist/resources/resourceGc.js +1 -1
  145. package/dist/resources/resourceRegistrar.js +1 -1
  146. package/dist/resources/resourceTypes.js +1 -1
  147. package/dist/review/deltaRecheck.js +3 -3
  148. package/dist/review/reviewAcceptance.js +16 -16
  149. package/dist/review/reviewDecision.js +7 -7
  150. package/dist/review/reviewRound.js +21 -20
  151. package/dist/review/reviewerAvailability.js +2 -2
  152. package/dist/role/role.js +51 -7
  153. package/dist/role/taskRoleUpdate.js +30 -0
  154. package/dist/runtime/acpProtocol.js +425 -0
  155. package/dist/runtime/acpSession.js +731 -0
  156. package/dist/runtime/acpSessionConfiguration.js +260 -0
  157. package/dist/runtime/agentDriver.js +30 -11
  158. package/dist/runtime/agentEndpoint.js +278 -0
  159. package/dist/runtime/agentEndpointIdentity.js +86 -0
  160. package/dist/runtime/agentEndpointOwnership.js +239 -0
  161. package/dist/runtime/agentError.js +2 -10
  162. package/dist/runtime/agentHost.js +565 -314
  163. package/dist/runtime/agentRunConfiguration.js +258 -0
  164. package/dist/runtime/builtinAgentDrivers.js +134 -18
  165. package/dist/runtime/builtinAgentErrorMappers.js +55 -3
  166. package/dist/runtime/builtinTranscriptUsage.js +1 -1
  167. package/dist/runtime/claude-process-owner +0 -0
  168. package/dist/runtime/codexAppServerRuntime.js +38 -30
  169. package/dist/runtime/codexInteractiveHost.js +41 -6
  170. package/dist/runtime/continuationManager.js +2 -6
  171. package/dist/runtime/executionEnvironment.js +30 -0
  172. package/dist/runtime/firstProgressAdvisory.js +11 -11
  173. package/dist/runtime/index.js +4 -3
  174. package/dist/runtime/jsonLineChannel.js +109 -0
  175. package/dist/runtime/launchBroker.js +91 -16
  176. package/dist/runtime/launchDiagnostics.js +2 -2
  177. package/dist/runtime/lifecycleReservation.js +10 -18
  178. package/dist/runtime/managedCaller.js +61 -17
  179. package/dist/runtime/nativeSessionControl.js +102 -0
  180. package/dist/runtime/ports.js +6 -21
  181. package/dist/runtime/processExitObservation.js +8 -7
  182. package/dist/runtime/promptEnvelope.js +17 -6
  183. package/dist/runtime/providerContinuation.js +3 -9
  184. package/dist/runtime/providerContinuationReconciliationService.js +4 -13
  185. package/dist/runtime/providerControl.js +2 -7
  186. package/dist/runtime/providerRuntimeIdentity.js +110 -222
  187. package/dist/runtime/providerRuntimeReconciler.js +5 -9
  188. package/dist/runtime/runtimeBinding.js +0 -1
  189. package/dist/runtime/runtimeContinuationProjection.js +4 -7
  190. package/dist/runtime/runtimeDeadlines.js +9 -0
  191. package/dist/runtime/runtimeHealthPolicy.js +1 -1
  192. package/dist/runtime/runtimeObservation.js +29 -65
  193. package/dist/runtime/runtimeProjection.js +43 -51
  194. package/dist/runtime/runtimeSessionCandidate.js +1 -3
  195. package/dist/runtime/sessionLaunchRequest.js +3 -7
  196. package/dist/runtime/sessionOwnerIdentity.js +7 -54
  197. package/dist/runtime/sessionOwnerRegistry.js +22 -17
  198. package/dist/runtime/sessionReconciliation.js +4 -8
  199. package/dist/runtime/sessionTerminationGuard.js +70 -259
  200. package/dist/runtime/sessionTokenMetrics.js +5 -16
  201. package/dist/runtime/structuredProviderHost.js +237 -117
  202. package/dist/runtime/taskRuntimeIsolation.js +39 -122
  203. package/dist/runtime/tmuxAdapters.js +39 -86
  204. package/dist/scheduler/activeRoleRunDelivery.js +354 -0
  205. package/dist/scheduler/leaderWakeupProcessor.js +75 -266
  206. package/dist/scheduler/operatorInputNotificationProcessor.js +1 -1
  207. package/dist/scheduler/ports.js +80 -9
  208. package/dist/scheduler/{roleTurnLiveness.js → roleRunLiveness.js} +26 -30
  209. package/dist/scheduler/{roleTurnStall.js → roleRunStall.js} +128 -139
  210. package/dist/scheduler/taskExecutionProjection.js +120 -124
  211. package/dist/scheduler/taskObservabilityProjection.js +29 -29
  212. package/dist/scheduler/taskWake.js +11 -4
  213. package/dist/scheduler/wakeReason.js +9 -1
  214. package/dist/setup/setupCommand.js +3 -7
  215. package/dist/storage/migrations/agentRunContract.js +159 -0
  216. package/dist/storage/migrations/artifactsToGit.js +338 -0
  217. package/dist/storage/migrations/removeRuntimeGeneration.js +207 -0
  218. package/dist/storage/migrations/submitIntent.js +126 -0
  219. package/dist/storage/sqliteSchema.js +467 -7
  220. package/dist/storage/sqliteStore.js +355 -220
  221. package/dist/storage/storageVersions.js +1 -1
  222. package/dist/storage/storeRpc.js +10 -5
  223. package/dist/storage/taskStore.js +13 -11
  224. package/dist/storage/upgrade/upgradeOrchestrator.js +5 -7
  225. package/dist/surface/surfaceContributions.js +102 -0
  226. package/dist/task/completionReadiness.js +32 -6
  227. package/dist/task/deliveryGuard.js +16 -16
  228. package/dist/task/draftPlan.js +72 -12
  229. package/dist/task/nextAction.js +144 -128
  230. package/dist/task/remoteDelivery.js +6 -6
  231. package/dist/task/task.js +184 -18
  232. package/dist/task/taskActivation.js +327 -0
  233. package/dist/task/taskActivationService.js +408 -0
  234. package/dist/task/taskRecordReference.js +5 -4
  235. package/dist/task/taskRecordRetirement.js +1 -1
  236. package/dist/task/taskSubmission.js +236 -0
  237. package/dist/telemetry/sqliteTelemetryStore.js +55 -68
  238. package/dist/telemetry/telemetryConfig.js +14 -14
  239. package/dist/telemetry/telemetryWiring.js +2 -2
  240. package/dist/web/assets/assetManifest.js +2 -0
  241. package/dist/web/assets/client/app.js +121 -20
  242. package/dist/web/assets/client/components.js +87 -54
  243. package/dist/web/assets/client/i18n.js +83 -41
  244. package/dist/web/assets/client/markdown.js +1 -1
  245. package/dist/web/assets/client/taskSurface.js +442 -0
  246. package/dist/web/assets/client/view.js +49 -44
  247. package/dist/web/assets/shell.js +1 -1
  248. package/dist/web/assets/styles/cards.js +22 -4
  249. package/dist/web/controllerWeb.js +60 -0
  250. package/dist/web/webMutation.js +28 -0
  251. package/dist/web/webServer.js +133 -8
  252. package/dist/web/webSnapshot.js +81 -74
  253. package/dist/web/webTaskSurface.js +64 -0
  254. package/dist/workItem/dependencyGate.js +1 -1
  255. package/dist/workItem/workItem.js +84 -48
  256. package/dist/workspace/workItemChangeSetManager.js +16 -9
  257. package/docs/agent-result-consumption.md +96 -0
  258. package/docs/agent-result-consumption.zh-CN.md +81 -0
  259. package/docs/agent-runtime-drivers.md +93 -0
  260. package/docs/agent-runtime-drivers.zh-CN.md +77 -0
  261. package/docs/architecture/README.md +50 -0
  262. package/docs/architecture/README.zh-CN.md +43 -0
  263. package/docs/architecture/capabilities-and-resources.md +118 -0
  264. package/docs/architecture/capabilities-and-resources.zh-CN.md +83 -0
  265. package/docs/managed-turn-and-session-runtime.md +224 -0
  266. package/docs/managed-turn-and-session-runtime.zh-CN.md +180 -0
  267. package/docs/observability/README.md +83 -0
  268. package/docs/observability/README.zh-CN.md +71 -0
  269. package/docs/plugin-sdk.md +393 -0
  270. package/docs/plugin-sdk.zh-CN.md +293 -0
  271. package/docs/provider-runtime.md +165 -0
  272. package/docs/provider-runtime.zh-CN.md +132 -0
  273. package/docs/release-workflow.md +305 -0
  274. package/docs/release-workflow.zh-CN.md +237 -0
  275. package/docs/roles-and-configuration.md +115 -0
  276. package/docs/roles-and-configuration.zh-CN.md +96 -0
  277. package/docs/sqlite-control-plane-design.md +78 -0
  278. package/docs/sqlite-control-plane-design.zh-CN.md +62 -0
  279. package/docs/task-dag-semantics.md +80 -0
  280. package/docs/task-dag-semantics.zh-CN.md +59 -0
  281. package/docs/task-delivery.md +105 -0
  282. package/docs/task-delivery.zh-CN.md +82 -0
  283. package/docs/task-local-identity.md +8 -6
  284. package/docs/task-local-identity.zh-CN.md +58 -0
  285. package/docs/testing/verification-levels.md +88 -0
  286. package/docs/testing/verification-levels.zh-CN.md +69 -0
  287. package/i18n/README.zh-CN.md +270 -722
  288. package/package.json +3 -2
  289. package/skills/yui-leader/SKILL.md +88 -304
  290. package/skills/yui-leader/references/execution.md +303 -0
  291. package/skills/yui-leader/references/integration.md +39 -0
  292. package/skills/yui-leader/references/planning.md +109 -0
  293. package/skills/yui-leader/references/replicated-execution.md +42 -0
  294. package/skills/yui-leader/references/task-plugins.md +37 -0
  295. package/skills/yui-operator/SKILL.md +46 -62
  296. package/skills/yui-reviewer/SKILL.md +35 -36
  297. package/skills/yui-runtime/SKILL.md +88 -24
  298. package/skills/yui-runtime/references/publication.md +22 -0
  299. package/skills/yui-runtime/references/recovery.md +64 -0
  300. package/skills/yui-worker/SKILL.md +37 -39
  301. package/dist/cli/roleOptionCatalog.js +0 -68
  302. package/dist/context/sourceTurnContext.js +0 -30
  303. package/dist/execution/reviewMainTurn.js +0 -161
  304. package/dist/execution/workItemMainTurn.js +0 -164
  305. package/dist/lifecycle/exactTurnTerminalization.js +0 -407
  306. package/dist/runtime/preallocatedNativeSession.js +0 -13
  307. package/dist/runtime/runtimeStopReceipt.js +0 -42
  308. package/dist/scheduler/activeRoleTurnDelivery.js +0 -315
package/README.md CHANGED
@@ -2,1213 +2,388 @@
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
+ [![Core CI](https://github.com/zhangqian-silk/yui/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/zhangqian-silk/yui/actions/workflows/ci.yml)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
7
+ ![Node](https://img.shields.io/badge/node-20%20%7C%2022%20%7C%2024-brightgreen.svg)
8
+ ![Platform](https://img.shields.io/badge/platform-Linux%20x64%20%28glibc%29-blue.svg)
9
+ [![PRs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](#contributing)
10
+
11
+ Give your Agents work to carry forward, not just another chat to answer.
12
+
13
+ Yui is a local control plane for coding Agents. Describe what you want to an
14
+ Operator in plain language: it identifies the relevant Project, tells new work
15
+ from a follow-up, and turns each request into a Task owned by a Leader that
16
+ plans, delegates and brings results and decisions back. Intent, progress and
17
+ results live outside any single conversation, so work continues from the Task —
18
+ not from terminal windows you juggle or details you have to remember.
19
+
20
+ **Highlights**
21
+
22
+ - **Durable by design** — Tasks, decisions and results live in one local SQLite
23
+ store, so work survives crashes and restarts and continues from the Task, not
24
+ a chat log.
25
+ - **One conversation, many Tasks** — the Operator turns plain-language requests
26
+ into new Tasks or follow-ups; no ticket IDs or terminal-window juggling.
27
+ - **A Leader owns each outcome** — it plans, splits work into WorkItems,
28
+ delegates to Workers and Reviewers, and closes the loop; you can talk to it
29
+ directly anytime.
30
+ - **Bring your own Agent** — Codex CLI, Claude Code CLI and ACP peers run behind
31
+ one boundary and stay replaceable without losing the Task.
32
+ - **Local-first and private** — everything runs on your machine for one trusted
33
+ user; the Web view is loopback and read-only.
34
+ - **Isolated by default** — repository work happens in managed Git worktrees;
35
+ the stable checkout stays read-only.
36
+
37
+ > **Status:** pre-1.0 (0.15.x). CLI surfaces and configuration may still change
38
+ > between releases; each upgrade migrates valid existing Homes.
39
+
40
+ [Quick start](#quick-start) · [Working through conversation](#working-through-conversation) · [Architecture](#architecture) · [Design principles](#design-principles)
10
41
 
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.
15
-
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.
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.
42
+ ## Quick start
21
43
 
22
- ## Requirements
44
+ You need Linux x64 with glibc, Git, tmux, and Node.js `^20.17.0`, `^22.9.0` or
45
+ `^24.0.0`. For the simplest setup, have Codex CLI or Claude Code CLI installed
46
+ and ready to use with your own account. Yui coordinates those Agents; it does
47
+ not supply model access.
23
48
 
24
- - Node.js 20.17+, 22.9+, or 24.x
25
- - Git
26
- - tmux
27
- - Codex CLI or Claude Code CLI
49
+ For Claude, Yui passes through your authentication environment and native
50
+ configuration directory; Claude selects the API key or login method using its
51
+ own settings. Replacing a Session does not reset your login or initialization.
52
+ Native first-run confirmations may still require your input.
28
53
 
29
- ## Setup
54
+ ### 1. Install
30
55
 
31
56
  ```sh
32
57
  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
58
  ```
69
59
 
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.
60
+ ### 2. Set up, yourself or with an Agent
71
61
 
72
- Yui uses `~/.yui` by default. Set `YUI_HOME` to use an isolated home:
62
+ Run the interactive setup:
73
63
 
74
64
  ```sh
75
- export YUI_HOME=/absolute/path/to/yui-home
76
65
  yui setup
77
66
  ```
78
67
 
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`.
174
-
175
- ## Quick start
176
-
177
- Bind a Project and create a Draft Task:
68
+ Or ask the coding Agent you already use:
178
69
 
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.
70
+ > Yui is installed. Help me run `yui setup` in an interactive terminal,
71
+ > choose an available Agent, and check the result with `yui doctor`.
72
+ > Ask me about any account or setup choices you need.
239
73
 
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
- ```
74
+ Setup establishes the Operator—the Agent you talk to—and a default Task Leader,
75
+ then starts the local Controller. You can begin with those two roles and
76
+ configure Workers or Reviewers later. If your Agent cannot operate an interactive
77
+ terminal, run setup yourself; it only handles the initial configuration.
249
78
 
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:
79
+ ### 3. Start a conversation
282
80
 
283
81
  ```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:
304
-
305
- ```sh
306
- yui config workflow set review --role reviewer --trigger always
307
- yui config show
308
- yui config workflow clear review
309
- ```
310
-
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:
314
-
315
- ```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/
406
- ```
407
-
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:
419
-
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:
431
-
432
- ```sh
433
- yui task base status <task-id>
434
- yui task base status <task-id> --refresh
435
- ```
436
-
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.
456
-
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.
463
-
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:
467
-
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:
495
-
496
- ```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
82
  yui operator enter
505
83
  ```
506
84
 
507
- If current execution cannot be settled normally, fence the Task and restart
508
- from its durable progress:
85
+ Tell the Operator what you want to work on:
509
86
 
510
- ```sh
511
- yui task execution stop <task-id> --force --reason "<why execution must be fenced>"
512
- yui task execution start <task-id>
513
- ```
87
+ > My project is at `/absolute/path/to/app`. Help me add CSV export.
88
+ > First clarify the scope, then implement and verify it. Don't publish anything.
514
89
 
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:
90
+ The Operator can register the Project and organize the request into a Task.
91
+ Its Leader handles planning and execution within your instructions. You can
92
+ ask questions, refine the requirement, or bring another request to the same
93
+ Operator without learning Task IDs or internal commands.
539
94
 
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
- ```
95
+ ## Working through conversation
551
96
 
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:
97
+ ### Let the Agent organize the work
556
98
 
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
- ```
99
+ You can bring a mixture of new requests, corrections and questions:
562
100
 
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:
101
+ > The CSV export also needs to preserve leading zeros in account numbers.
102
+ > Separately, investigate why login is slow. Prioritize the export first.
566
103
 
567
- ```sh
568
- yui task turn retry <task-id>/<failed-turn-id>
569
- yui task turn settle <task-id>/<failed-turn-id>
570
- ```
104
+ The Operator uses existing Task context to decide what belongs together and
105
+ what deserves an independent Task. It can organize work by Project, type,
106
+ priority and tags. A follow-up need not become a new Task, and a Task need not
107
+ be split into a WorkItem for every implementation step.
571
108
 
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:
109
+ The Leader owns delivery: small work can stay with the Leader; independent
110
+ requirements can go to configured Workers; a Reviewer can inspect the result
111
+ when appropriate. Agents choose the plan and delegation. The Controller
112
+ delivers the scheduled work, observes execution and returns results to the
113
+ responsible Agent—without requiring you to relay messages between sessions.
632
114
 
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
- ```
115
+ ### Configure by asking
640
116
 
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:
117
+ Stay in the Operator conversation to change how Yui works:
649
118
 
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
- ```
119
+ > Show me the available Agents and models. Suggest a setup for planning,
120
+ > implementation and review, then apply it after I confirm.
654
121
 
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.
122
+ The Operator reads the actual configuration and supported choices before
123
+ making changes. You can ask it to change a model, bind another Agent, adjust
124
+ review preferences or explain a setting. It should tell you what changes,
125
+ whether it affects future launches or a live Session, and which choices need
126
+ your confirmation. You do not need to hand-edit configuration files.
660
127
 
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:
128
+ ### Pick up where you left off
666
129
 
667
- ```sh
668
- yui task integration start <task-id> \
669
- --work-item <work-item-id> \
670
- --strategy cherry-pick \
671
- --check "npm test"
672
- ```
130
+ > What is still active? Which tasks need my decision? Continue the CSV task
131
+ > from its saved state and summarize what remains.
673
132
 
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.
133
+ Tasks retain requirements, decisions and results independently of the native
134
+ chat history. Yui delivers durable updates to the Operator; the Agent can
135
+ recover context and continue compatible sessions, or choose a new execution
136
+ when necessary. A failed process does not erase the Task, and an uncertain
137
+ submission is not silently repeated.
675
138
 
676
- Code or semantic conflicts remain blocked until that Task's Leader records a decision:
139
+ For a visual overview, run `yui web` in another terminal. The local Web view
140
+ shows the same tasks and pending questions; it is not a separate task system.
677
141
 
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
- ```
142
+ ## Architecture
684
143
 
685
- Worker Turn completion is not WorkItem completion. The Leader accepts only after reviewing
686
- the result, validations, and the latest ChangeSet integration:
144
+ Under the hood, Yui keeps every durable fact in one local SQLite store and lets
145
+ Agents act on it through small, explicit operations. Here is the same system
146
+ from a few different angles:
687
147
 
688
- ```sh
689
- yui task work accept <task-id>/<work-item-id> --summary "Acceptance criteria met."
690
- ```
148
+ - [Product structure](#product-structure) — the durable objects you work with
149
+ - [How work flows](#how-work-flows) the closed loop around a Task
150
+ - [User message flow](#user-message-flow) — what happens when you send a message
151
+ - [Core modules](#core-modules) — the long-lived runtime pieces
152
+ - [Layered design](#layered-design) — responsibilities, top to bottom
153
+ - [Lifecycle](#lifecycle) — states a Task and WorkItem move through
691
154
 
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.
155
+ ### Product structure
696
156
 
697
- Incorrect historical directives and execution attempts can be removed from
698
- operational projections without deleting their audit records:
157
+ What Yui organizes for you durable objects, not processes:
699
158
 
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:
833
-
834
- ```sh
835
- yui task complete <task-id> --summary-file delivery.txt \
836
- --accept-published-tree <publication-id>
837
- ```
838
-
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.
853
-
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.
873
-
874
- ## Sessions and tmux
875
-
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.
880
-
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.
893
-
894
- Task Role observation and takeover are explicit:
895
-
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
- ```
901
-
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.
906
-
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.
916
-
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:
925
-
926
- ```sh
927
- yui session enter <global-role>
928
- ```
929
-
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.
933
-
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.
937
-
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.
948
-
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.
954
-
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.
970
-
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.
972
-
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.
978
-
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.
985
-
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.
993
-
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.
995
-
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.
997
-
998
- ## Controller and failure handling
999
-
1000
- One background Controller runs per `YUI_HOME`:
1001
-
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
159
+ ```text
160
+ Global
161
+ ├─ Operator ── the Agent you converse with; spans all Projects & Tasks
162
+ └─ Projects
163
+ └─ Project ── a managed codebase + its Project Knowledge
164
+ └─ Task ── one bounded outcome you asked for
165
+ ├─ Brief ......... objective · boundaries · approach
166
+ ├─ Roles ......... Leader (owns it) · Workers · Reviewers
167
+ ├─ WorkItems ..... independently acceptable requirements
168
+ │ └─ AgentRun .. one requested execution ─▶ Result
169
+ ├─ Messages ...... durable conversation + Decisions
170
+ └─ Review / Integration ─▶ accepted delivery
1010
171
  ```
1011
172
 
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.
173
+ ### How work flows
1017
174
 
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.
1023
-
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.
175
+ ```text
176
+ You
177
+ │ describe work · answer questions · refine scope
178
+
179
+ Operator ── reads your intent, then either:
180
+ │ • opens a NEW Task, or
181
+ │ • APPENDS to an existing Task (a follow-up)
182
+
183
+ Task ── owned by one Leader, who runs the closed loop:
184
+
185
+ │ plan ─▶ split into WorkItems ─▶ deliver ─▶ review ─▶ close
186
+
187
+ │ each WorkItem is advanced by the Leader itself, or delegated:
188
+ │ ├──▶ Worker another Agent implements it
189
+ │ └──▶ Reviewer checks the result before it is accepted
190
+
191
+
192
+ Results and decisions come back to you — and you can talk to the Leader
193
+ directly about a task's details anytime.
194
+ ```
195
+
196
+ ### User message flow
197
+
198
+ What happens when you send one message — the Controller only wakes Agents; the
199
+ durable record always lives in the store:
1025
200
 
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.
201
+ ```text
202
+ ── Inbound ────────────────────────────────────────────────────────────────
203
+ You ─▶ Operator ─▶ records a Task (new, or a follow-up) + a Message ─▶ yui.db
204
+
205
+ Controller wakes the Leader
206
+
207
+ ── Work ───────────────────────────────────────────────────────────────────
208
+ Leader reads Context ─▶ acts itself, or delegates to Workers / Reviewers
209
+ ─▶ writes results · decisions · messages ─▶ yui.db
210
+
211
+ Controller wakes the Operator
212
+
213
+ ── Outbound ───────────────────────────────────────────────────────────────
214
+ yui.db ─▶ Operator reads the updates ─▶ replies to You
215
+ ```
216
+
217
+ ### Core modules
218
+
219
+ The long-lived runtime pieces. You only ever talk to the Operator; Agents and
220
+ the Controller are what touch the store:
1031
221
 
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:
222
+ ```text
223
+ You
224
+ │ natural-language conversation with the Operator
225
+ │ (you never drive the Controller or the store yourself)
226
+
227
+ Agent sessions · in tmux
228
+ │ Operator ── the Agent you talk to; routes requests into Tasks
229
+ │ Leader · Workers · Reviewers ── plan, deliver and review the work
230
+ │ each drives a native Agent via AgentHost / AgentEndpoint / Driver:
231
+ │ Codex CLI (App Server) · Claude Code CLI (stream-json) · ACP peers
232
+
233
+ │ Agents read Context and make atomic changes (yui operations)
234
+
235
+ ┌─ yui.db — SQLite (WAL) · single source of truth · one txn per change
236
+ │ Tasks · WorkItems · AgentRuns · Messages · Decisions · Results
237
+ └─ Project Knowledge · configuration
238
+
239
+ │ reads & records runtime facts; wakes and delivers work to the sessions
240
+
241
+ Controller · one per Home
242
+ delivery · Scheduler · jobs · capability host · Web listener
243
+ it moves work and records facts — it never judges an answer
244
+
245
+ Agents work in Projects: read-only checkout + isolated worktrees.
246
+ Web view (yui web): a loopback, read-only projection of the store.
247
+ ```
248
+
249
+ ### Layered design
250
+
251
+ Each layer owns one responsibility and exposes small, explicit capabilities —
252
+ never a fixed workflow:
1033
253
 
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.
254
+ ```text
255
+ Experience — how you interact
256
+ CLI (Operator) · Web (loopback, read-only) · native Agent sessions
257
+ collect input · show facts · confirm actions · invoke capabilities
258
+
259
+ Intelligence — who decides
260
+ Operator: recognize requests, split Tasks
261
+ Leader: plan · delegate · judge · complete one Task
262
+ Workers · Reviewers (behavior comes from Roles & Skills)
263
+
264
+ Capability — the atomic operations Yui exposes
265
+ deliver: Task · WorkItem · Decision · Candidate · Review
266
+ context: Context · Message · InputRequest · Project Knowledge
267
+ config: Roles · Agent config · Project · Plugin
268
+ execute: dispatch · inspect · stop · resources · Artifact
269
+
270
+ Execution — how work actually runs
271
+ AgentHost / AgentEndpoint / Driver, each in a tmux session
272
+ Codex CLI (App Server) · Claude Code CLI (stream-json) · ACP peers
273
+ managed Git worktrees · adopted environments
274
+
275
+ Kernel — durable authority: yui.db (SQLite, WAL)
276
+ storage · identity · permissions · operation facts · instance host
277
+
278
+ ▲ plugins extend the Capability layer through the Capability Registry
279
+ ```
280
+
281
+ ### Lifecycle
282
+
283
+ Status is one authority per object; execution and waiting are runtime facts, not
284
+ extra states:
1040
285
 
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.
286
+ ```text
287
+ Task draft ─▶ active ─▶ completed ─▶ archived
288
+ └────▶ cancelled ─▶ archived
1042
289
 
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:
290
+ WorkItem open ─▶ accepted ─▶ retired
1044
291
 
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>
292
+ Draft holds planning only; activation adopts a delivery workspace.
293
+ Archive needs settled work and clean worktrees; it cannot reopen.
1051
294
  ```
1052
295
 
1053
- `jobs` is not a restored generic queue: it presents durable pending Leader wakes and Leader recovery failures only.
296
+ ## Design principles
1054
297
 
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.
298
+ ### Agents make decisions; Yui makes work durable
1061
299
 
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.
300
+ Yui is a local control plane and context API, not a fixed workflow engine.
301
+ The Operator recognizes and routes requests. A Leader owns each Task's outcome
302
+ and chooses planning, delegation, review and recovery. The Controller handles
303
+ delivery and runtime facts; it does not decide whether an Agent's answer is
304
+ good enough.
1063
305
 
1064
- ## Local web control room
306
+ Tasks, messages, decisions, original execution results and Project Knowledge
307
+ are durable context. Agents read and update that context through small,
308
+ scoped CLI operations. Session and process state support execution, but do not
309
+ replace the record of what the user asked for.
1065
310
 
1066
- Run the local control room on the default loopback address:
311
+ ### Separate the task from the conversation
1067
312
 
1068
- ```sh
1069
- yui web
1070
- # Yui web control room: http://127.0.0.1:4173
1071
- ```
313
+ A Task is the outcome; a WorkItem is an independently acceptable requirement;
314
+ a Session is a native conversation; an AgentRun is an explicitly requested
315
+ execution. Keeping them separate lets you discuss a Task without starting work,
316
+ continue a requirement across executions, and inspect the original result
317
+ without confusing “the Agent finished speaking” with “the work was accepted.”
1072
318
 
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:
319
+ A Draft can hold planning before adopting a delivery workspace. For repository
320
+ work, changes happen in managed worktrees rather than the stable Project
321
+ checkout. The Leader evaluates results and coordinates review and integration
322
+ against the actual scope.
1107
323
 
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
- ```
324
+ ### Keep execution replaceable and authority explicit
1120
325
 
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.
326
+ Codex CLI, Claude Code CLI and ACP connections—including a Claude Agent SDK
327
+ bridge—share an execution boundary while retaining their native capabilities
328
+ and conversations. Configured intent and what the running Agent actually reports
329
+ are distinct facts; Yui does not pretend every integration behaves identically.
1127
330
 
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.
331
+ When a Task needs an additional capability, its Leader can create and validate a
332
+ Task-local plugin and explicitly activate it within existing authority.
333
+ Executable plugins need specific execution grants. Results can be saved
334
+ independently of the plugin or Session that produced them.
1133
335
 
1134
- Agent environment bindings store process-environment variable names, never secret values. Adapter-owned lifecycle arguments cannot be overridden through raw arguments.
336
+ Yui is designed for one trusted local user. It is not an OS sandbox or a remote
337
+ multi-user service. Publishing, granting new access and other external effects
338
+ still require the corresponding authority.
1135
339
 
1136
- ## Scope
340
+ ## How Yui compares
1137
341
 
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.
342
+ | | Chat-only agent | Agent CLI + tmux, by hand | Yui |
343
+ | --- | --- | --- | --- |
344
+ | Work survives the session | no | your own notes | durable Tasks in one store |
345
+ | New request vs. follow-up | you decide | you decide | the Operator routes it |
346
+ | Multi-step delegation | manual | manual | Leader → WorkItems → Workers/Reviewers |
347
+ | Swap model/agent mid-task | context lost | manual re-setup | replaceable behind one boundary |
348
+ | Parallel work isolation | — | you manage branches | managed Git worktrees |
349
+ | Where the truth lives | the chat log | scattered | one SQLite source of truth |
1143
350
 
1144
- See [ARCHITECTURE.md](./ARCHITECTURE.md) for persistence and scheduling details.
1145
- ## Development
351
+ ## Learn more
1146
352
 
1147
- ```sh
1148
- npm ci
1149
- npm test
1150
- ```
353
+ The [architecture overview](ARCHITECTURE.md) explains the end-to-end design.
354
+ The [documentation map](docs/architecture/README.md) links the current contracts
355
+ for configuration, execution, delivery, storage and plugins. Use `yui --help`
356
+ when you want to operate the CLI directly.
1151
357
 
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).
358
+ Yui stores its control-plane data under `~/.yui` by default; `YUI_HOME` selects
359
+ another instance. See [storage and upgrades](docs/sqlite-control-plane-design.md)
360
+ before moving between builds or updating an existing Home.
1158
361
 
1159
- To make user terminals use this checkout, reversibly link the user-level `yui` command:
362
+ ## Contributing
1160
363
 
1161
- ```sh
1162
- make link
1163
- command -v yui
1164
- yui doctor
1165
- ```
364
+ Start with [CONTRIBUTING.md](CONTRIBUTING.md) for the full workflow, and please
365
+ follow our [Code of Conduct](CODE_OF_CONDUCT.md). In short: in a source
366
+ checkout, run `npm ci` and `npm test`. Read
367
+ `.agents/skills/develop-yui/SKILL.md` and the
368
+ [verification policy](docs/testing/verification-levels.md).
369
+ Source builds also need a Linux C compiler and static libc development libraries
370
+ for the Claude process owner. Published packages include that executable;
371
+ npm users do not need to compile it.
1166
372
 
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.
373
+ To exercise your checkout, run `make install-local`, then use the absolute
374
+ `<checkout>/output/dev/bin/yui` launcher. It defaults to an isolated Home under
375
+ that checkout; run its `setup` before stateful use. Do not use the global `yui`
376
+ or `make link` to validate local changes. Live-model, paid or shared-resource
377
+ tests require an explicit request for those resources.
1168
378
 
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
- ```
379
+ ## Community and support
1206
380
 
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.
381
+ - Questions, bugs and feature requests: open a
382
+ [GitHub issue](https://github.com/zhangqian-silk/yui/issues).
383
+ - Security: see the [security policy](SECURITY.md). Yui targets one trusted
384
+ local user and is not an OS sandbox or a remote service; please report
385
+ sensitive issues privately instead of opening a public issue.
1211
386
 
1212
387
  ## License
1213
388
 
1214
- [MIT](./LICENSE)
389
+ [MIT](LICENSE)