@zq-silk/yui 0.0.0

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 (95) hide show
  1. package/ARCHITECTURE.md +141 -0
  2. package/LICENSE +21 -0
  3. package/README.md +211 -0
  4. package/dist/agent/adapterCatalog.js +10 -0
  5. package/dist/agent/agent.js +89 -0
  6. package/dist/agent/agentRegistry.js +10 -0
  7. package/dist/agent/argumentPolicy.js +80 -0
  8. package/dist/brief/taskBrief.js +37 -0
  9. package/dist/cli/commandCatalog.js +647 -0
  10. package/dist/cli/completion.js +111 -0
  11. package/dist/cli/completionWizard.js +143 -0
  12. package/dist/cli/dynamicCompletion.js +48 -0
  13. package/dist/cli/helpRenderer.js +32 -0
  14. package/dist/cli/interactionCandidates.js +139 -0
  15. package/dist/cli/interactionPolicy.js +389 -0
  16. package/dist/cli/interactiveSelection.js +185 -0
  17. package/dist/cli/invocationRouter.js +51 -0
  18. package/dist/cli/roleOptionCatalog.js +67 -0
  19. package/dist/cli/roleWizard.js +546 -0
  20. package/dist/cli/selectionPorts.js +1 -0
  21. package/dist/cli/updateCommand.js +22 -0
  22. package/dist/cli.js +402 -0
  23. package/dist/commands/agentCommands.js +196 -0
  24. package/dist/commands/globalRoleCommands.js +367 -0
  25. package/dist/commands/jobCommands.js +100 -0
  26. package/dist/commands/operatorCommands.js +38 -0
  27. package/dist/commands/repositoryCommands.js +86 -0
  28. package/dist/commands/roleConfiguration.js +201 -0
  29. package/dist/commands/taskCommands.js +1344 -0
  30. package/dist/commands/taskContextCommand.js +215 -0
  31. package/dist/commands/taskInputCommands.js +423 -0
  32. package/dist/commands/taskRoleRuntimeStatus.js +152 -0
  33. package/dist/completion/completionInstaller.js +168 -0
  34. package/dist/completion/completionPort.js +1 -0
  35. package/dist/completion/completionState.js +137 -0
  36. package/dist/completion/completionWizard.js +125 -0
  37. package/dist/completion/fileCompletionManager.js +51 -0
  38. package/dist/config/yuiConfig.js +17 -0
  39. package/dist/context/dispatchContext.js +74 -0
  40. package/dist/controller/clientRuntime.js +215 -0
  41. package/dist/controller/controller.js +158 -0
  42. package/dist/controller/controllerMain.js +37 -0
  43. package/dist/controller/fileSchedulerStoreAdapter.js +322 -0
  44. package/dist/controller/runtime.js +31 -0
  45. package/dist/controller/sessionNotify.js +136 -0
  46. package/dist/core/controllerClient.js +127 -0
  47. package/dist/core/controllerServer.js +269 -0
  48. package/dist/core/protocol.js +169 -0
  49. package/dist/decision/decision.js +42 -0
  50. package/dist/doctor/doctor.js +229 -0
  51. package/dist/errors/cliError.js +38 -0
  52. package/dist/event/taskEvent.js +44 -0
  53. package/dist/executor/agentAdapter.js +338 -0
  54. package/dist/executor/agentExecutor.js +144 -0
  55. package/dist/executor/executorRegistry.js +101 -0
  56. package/dist/executor/fileRoleLaunchPlanner.js +156 -0
  57. package/dist/executor/launchPlan.js +16 -0
  58. package/dist/input/inputRequest.js +326 -0
  59. package/dist/message/message.js +69 -0
  60. package/dist/milestone/milestone.js +27 -0
  61. package/dist/operator/operatorContext.js +66 -0
  62. package/dist/output/rolePresentation.js +82 -0
  63. package/dist/output/table.js +77 -0
  64. package/dist/output/terminal.js +198 -0
  65. package/dist/repository/gitWorkspace.js +210 -0
  66. package/dist/repository/repository.js +55 -0
  67. package/dist/repository/taskWorkspacePreparer.js +256 -0
  68. package/dist/role/role.js +246 -0
  69. package/dist/role/systemRoles.js +20 -0
  70. package/dist/run/agentRun.js +102 -0
  71. package/dist/scheduler/activeRoleRunDelivery.js +94 -0
  72. package/dist/scheduler/archivedTaskRuntime.js +12 -0
  73. package/dist/scheduler/leaderFailure.js +18 -0
  74. package/dist/scheduler/leaderWakeupProcessor.js +143 -0
  75. package/dist/scheduler/operatorInputNotificationProcessor.js +85 -0
  76. package/dist/scheduler/operatorNotification.js +17 -0
  77. package/dist/scheduler/pendingWakeup.js +33 -0
  78. package/dist/scheduler/ports.js +1 -0
  79. package/dist/scheduler/roleRunLiveness.js +41 -0
  80. package/dist/scheduler/wakeupQueue.js +13 -0
  81. package/dist/setup/setupCommand.js +317 -0
  82. package/dist/storage/durableFile.js +38 -0
  83. package/dist/storage/storageSchema.js +259 -0
  84. package/dist/storage/taskStore.js +1032 -0
  85. package/dist/task/task.js +216 -0
  86. package/dist/tmux/commandExecutor.js +69 -0
  87. package/dist/tmux/terminalHandoff.js +17 -0
  88. package/dist/tmux/tmuxManager.js +408 -0
  89. package/dist/workItem/workItem.js +45 -0
  90. package/dist/worktree/roleWorkspace.js +62 -0
  91. package/i18n/README.zh-CN.md +205 -0
  92. package/package.json +47 -0
  93. package/skills/yui-leader/SKILL.md +72 -0
  94. package/skills/yui-operator/SKILL.md +57 -0
  95. package/skills/yui-worker/SKILL.md +31 -0
@@ -0,0 +1,205 @@
1
+ <p align="right"><a href="../README.md">English</a> | <strong>简体中文</strong></p>
2
+
3
+ # Yui
4
+
5
+ Yui 是一个用于长期 Codex/Claude 工作的本地编排器。控制状态保存在可检查的 JSON 文件中,所有 Agent 终端完全由 tmux 主导,带 Repository 的 Task 使用确定性的 Git worktree。
6
+
7
+ 当前实现恢复了实用的 Role/Agent/session 模型和 CLI 框架,但没有恢复后期膨胀的数据维护、租约、定时调度和恢复账本体系。
8
+
9
+ ## 环境要求
10
+
11
+ - Node.js 20.17+、22.9+ 或 24.x
12
+ - Git
13
+ - tmux
14
+ - Codex CLI 或 Claude Code CLI
15
+
16
+ ## 初始化
17
+
18
+ ```sh
19
+ npm install -g @zq-silk/yui
20
+ yui setup
21
+ yui doctor
22
+ ```
23
+
24
+ `setup` 是交互式的:检测已安装的 Agent CLI、选择要配置的 Agent、默认 Agent 和 Operator Agent、确认 Operator workspace,并询问 shell completion。再次运行不会删除已有 Task/Role,可用于调整配置。
25
+
26
+ `completion` 无论是否指定 shell,都会进入确认流程:
27
+
28
+ ```sh
29
+ yui completion
30
+ yui completion zsh
31
+ ```
32
+
33
+ 流程会确认生成脚本、安装路径和 shell 启动文件修改。补全脚本直接由命令目录生成,支持二级及更深层子命令。
34
+
35
+ 默认 home 是 `~/.yui`。隔离环境可设置:
36
+
37
+ ```sh
38
+ export YUI_HOME=/absolute/path/to/yui-home
39
+ yui setup
40
+ ```
41
+
42
+ home 中包含 `schema.json`、权威 `state.json`、Controller 发现文件和受管理 worktree。当前存储版本严格匹配且 fresh-only;代码保留了未来版本的迁移注册表,但本版不迁移旧格式。
43
+
44
+ ## 快速开始
45
+
46
+ ```sh
47
+ yui repository add app /absolute/path/to/app --base main
48
+ yui repository list
49
+
50
+ yui task create "交付 CSV 导出" --repository <repository-id> --base main
51
+ yui task update <task-id> --priority high --tags release,csv --due-at 2026-08-01T00:00:00Z
52
+ yui task update <task-id> --clear-priority --clear-tags --clear-due-at
53
+ yui task show <task-id>
54
+ yui task context <task-id>
55
+ yui task activate <task-id>
56
+ ```
57
+
58
+ 查看已有 Task 的详细状态时,优先使用 `task context`。它一次聚合 Task、Brief、Active Decision、最近的 Milestone、Role、当前及最近的 WorkItem 与关联 Run、最近的 Message、Open/Resolved InputRequest 和 Event。终端输出会精简历史和长文本;`yui --json task context <task-id>` 会在顶层 `data` 中返回完整记录。
59
+
60
+ 新 Task 是 Draft,并已创建 Leader。激活时会排入第一次持久 Leader wake。带 Repository 的 Task 会先为每个 Role 创建 `<YUI_HOME>/worktrees/<task-id>/<role-name>`,对应分支为 `yui/<task-id>/<role-name>`,然后才启动 Leader;后续新增 Role 也会在执行前获得独立 worktree。
61
+
62
+ 通过 Operator 提交消息:
63
+
64
+ ```sh
65
+ yui operator submit "比较 CSV 与 JSON 的兼容性" --task <task-id>
66
+ yui operator submit "研究更小的缓存设计"
67
+ yui operator enter
68
+ ```
69
+
70
+ 不带 `--task` 时会创建新 Draft。Draft 可以继续规划,但激活前不会执行 Agent 工作。
71
+
72
+ 添加 Worker 并派发 WorkItem:
73
+
74
+ ```sh
75
+ yui task role add <task-id> implementer --agent codex
76
+ yui task role list <task-id>
77
+
78
+ yui task work create <task-id> "实现导出器" --role implementer
79
+ yui task work dispatch <work-item-id> --input "完成实现并运行聚焦测试"
80
+ ```
81
+
82
+ Worker 显式结束当前 Run:
83
+
84
+ ```sh
85
+ yui task run yield <run-id> --summary "导出器已完成,聚焦测试通过"
86
+ ```
87
+
88
+ yield 会原子完成 Run 和 WorkItem、追加结果消息并唤醒 Leader。Leader 不会自唤醒;Leader 忙碌时,Operator/Worker 的 pending wake 会一直保留到 Leader 空闲。
89
+
90
+ 当活动 Leader Run 必须获得用户决定才能继续时,可以创建持久 InputRequest,并 yield 当前 Run:
91
+
92
+ ```sh
93
+ yui task input request <task-id> --question "默认使用哪种格式?" \
94
+ --choice csv="CSV" --choice json="JSON" --blocks work-item:<work-item-id>
95
+ yui task input list
96
+ yui task input show <input-id>
97
+ yui task input answer <input-id> --choice csv
98
+ ```
99
+
100
+ 请求默认必须由用户回答,并保持开放直到回答或取消。当 Agent 存在安全的推荐方案时,可以为选项设置明确的超时回退:
101
+
102
+ ```sh
103
+ yui task input request <task-id> --question "默认使用哪种格式?" \
104
+ --choice csv="CSV" --choice json="JSON" \
105
+ --recommend csv --timeout-seconds 300
106
+ ```
107
+
108
+ 推荐项会明确展示给用户;如果截止时间前没有回答,第一轮到期后的 Controller 扫描会原子采用这个确定选项,并排队恢复固定的 Leader session。自由文本和必须由用户回答的请求永远不会自动解决。
109
+
110
+ `task input list` 是权威的全局开放输入 Inbox;可附加 Task ID 限定范围,或使用 `--all` 查看已回答和已取消的请求。Controller 还会尝试向已经运行且处于输入状态的 Operator composer 投递一次带回执的提示;它不会为了通知而启动或打断 Operator。Operator 不在线或正忙时,请求仍保留在 Inbox,并在后续 Controller 扫描时重新尝试。用户和 Operator 都可回答。存在开放请求时,无关的 pending wake 不会绕过等待,Task 也不能 complete 或 archive。原 Leader 也可执行 `yui task input cancel <task-id> <input-id> --reason "..."`,取消不会使 Leader 自唤醒。
111
+
112
+ ```sh
113
+ yui task context <task-id>
114
+ ```
115
+
116
+ 需要查看单个集合或记录时,再使用 `task work`、`task message`、`task run` 和 Task Knowledge 下的细分命令。
117
+
118
+ 完成目标后,可将 Task 标记为 completed,从而停止自动唤醒,同时保留 session 和各 Role worktree:
119
+
120
+ ```sh
121
+ yui task complete <task-id> --summary "CSV 导出已交付并验证"
122
+ yui task reopen <task-id>
123
+ ```
124
+
125
+ completed Task 在显式 reopen 前会拒绝消息、派发、进入 session、重试和迟到的 yield。archive 仍是终态,并负责 tmux/worktree 清理。
126
+ Task 生命周期的交互选择只展示有效来源状态:activate 只展示 Draft,complete 只展示 active,reopen 只展示 completed。
127
+
128
+ ## Session 与 tmux
129
+
130
+ Yui 不代理交互式 Agent 终端。执行 `operator enter`、`role enter` 或 `task enter` 前,Yui 会关闭 readline、退出 raw mode、暂停自身 stdin,再同步把终端交给 tmux。因此 Codex 原生的 `/model`、斜杠命令提示、全屏渲染和按键处理都可正常工作。
131
+
132
+ ```sh
133
+ yui role enter <global-role>
134
+ yui task enter <task-id> [role]
135
+ yui task role enter <task-id> <role>
136
+ ```
137
+
138
+ 每个 Role 可绑定多个 Agent,有一个 active Agent,并为每个 Agent binding 独立保存 native session。切换 Agent 会保留休眠 session;Role 有活动 Run 或 native process 时禁止切换。
139
+
140
+ Claude 的 session ID 在启动前分配。受管理的 Codex 启动使用 Codex 结构化 `notify` 回调,在 turn 完成后记录 thread ID,不再向模型对话注入 session-bind prompt。
141
+
142
+ ## Controller 与失败处理
143
+
144
+ 每个 `YUI_HOME` 有一个后台 Controller:
145
+
146
+ ```sh
147
+ yui controller status
148
+ yui controller stop
149
+ yui controller restart
150
+ ```
151
+
152
+ `controller restart` 会用当前安装的 Yui 版本替换 Controller 进程及其调度循环、socket 服务,不会停止或重启已受管的 tmux/Agent 会话。
153
+
154
+ 完整 reconciliation 默认每 30 秒执行一次;持久状态变化仍会立即请求一次扫描。保留的闭环为:
155
+
156
+ 1. 准备 active Task 的 repository workspace;
157
+ 2. 停止 archived Task 的 tmux,并只清理干净 worktree;
158
+ 3. 投递排队的 Worker Run;
159
+ 4. 检测活动 Role 进程退出;
160
+ 5. Leader 空闲时投递 pending wake。
161
+
162
+ 自动输入只通过 tmux 投递,并先进行 Agent 专属 readiness 检查。pane 内 receipt 可避免 Controller 重试时重复输入同一 Run。
163
+
164
+ Role 在 yield 前退出时,Controller 会失败对应 Run 和 running WorkItem,并唤醒 Leader。恢复状态通过精简的 Jobs 兼容视图呈现:
165
+
166
+ ```sh
167
+ yui jobs list
168
+ yui jobs retry leader-recovery:<task-id>
169
+ yui task reconcile <task-id>
170
+ yui task run retry <failed-run-id>
171
+ ```
172
+
173
+ `jobs` 不是旧版通用队列,只展示持久 Leader wake 和 Leader recovery failure。
174
+
175
+ completion 是可逆的执行屏障。归档是终态:失败活动 Run、停止 Task 的 tmux session,并逐个移除干净的 Role worktree;脏 Role worktree 会保留,供人工确认处理。
176
+
177
+ ## 管理命令
178
+
179
+ ```sh
180
+ yui update
181
+ yui agent add|list|show|update|remove
182
+ yui role add|list|show|update|remove|bind|enter
183
+ yui role session record|replace
184
+ yui repository add|list
185
+ ```
186
+
187
+ Agent 环境变量绑定只保存进程环境变量名,不保存 secret 值;raw args 不能覆盖 adapter 管理的生命周期参数。
188
+
189
+ ## 范围
190
+
191
+ Yui 面向一台机器上的一个受信任本地用户。它不包含 Web/API、多用户协调、backup/import/export、trash/restore、derived index、recovery journal、runtime lease、inactivity TTL、cooldown 或 recurring schedule。
192
+
193
+ 持久化和调度细节见 [ARCHITECTURE.md](../ARCHITECTURE.md)。
194
+
195
+ ## 本地开发
196
+
197
+ ```sh
198
+ npm run build
199
+ npm test
200
+ npm run lint
201
+ ```
202
+
203
+ ## 许可证
204
+
205
+ [MIT](../LICENSE)
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@zq-silk/yui",
3
+ "version": "0.0.0",
4
+ "description": "Local control plane for long-running native agent CLI sessions backed by tmux.",
5
+ "license": "MIT",
6
+ "private": false,
7
+ "type": "module",
8
+ "bin": {
9
+ "yui": "./dist/cli.js"
10
+ },
11
+ "files": [
12
+ "dist",
13
+ "skills",
14
+ "README.md",
15
+ "ARCHITECTURE.md",
16
+ "i18n/README.zh-CN.md",
17
+ "LICENSE"
18
+ ],
19
+ "engines": {
20
+ "node": "^20.17.0 || ^22.9.0 || ^24.0.0"
21
+ },
22
+ "os": [
23
+ "linux"
24
+ ],
25
+ "cpu": [
26
+ "x64"
27
+ ],
28
+ "libc": [
29
+ "glibc"
30
+ ],
31
+ "keywords": [
32
+ "yui",
33
+ "tmux",
34
+ "cli",
35
+ "agents",
36
+ "codex",
37
+ "claude"
38
+ ],
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/zhangqian-silk/Yui.git"
42
+ },
43
+ "bugs": {
44
+ "url": "https://github.com/zhangqian-silk/Yui/issues"
45
+ },
46
+ "homepage": "https://github.com/zhangqian-silk/Yui#readme"
47
+ }
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: yui-leader
3
+ description: Lead one lean Yui Task by reading messages, creating Worker roles and WorkItems, dispatching Runs, and collecting yielded summaries.
4
+ ---
5
+
6
+ # Yui Leader
7
+
8
+ Own the direction of the Task identified in the launch context. Decompose the mission into finite WorkItems, dispatch the right Worker, and synthesize the yielded summaries for the user.
9
+
10
+ ## Recover current state
11
+
12
+ Use only the public current commands:
13
+
14
+ ```sh
15
+ yui task show <task-id>
16
+ yui task message list <task-id>
17
+ yui task input list <task-id> --all
18
+ yui task role list <task-id>
19
+ yui task work list <task-id>
20
+ yui task run list <work-item-id>
21
+ ```
22
+
23
+ Use the Task, WorkItem, Role, and Run IDs supplied by Yui output or the launch prompt. Do not infer IDs from tmux names or edit Yui storage directly.
24
+
25
+ ## Decompose and dispatch
26
+
27
+ 1. Add a Worker only when the Task needs a separate execution role:
28
+
29
+ ```sh
30
+ yui task role add <task-id> <role-name> --agent <codex-or-claude>
31
+ ```
32
+
33
+ 2. Create a finite WorkItem and assign it by Role name:
34
+
35
+ ```sh
36
+ yui task work create <task-id> "<clear outcome>" --role <role-name>
37
+ ```
38
+
39
+ 3. Read the WorkItem ID from the response, then dispatch one bounded round:
40
+
41
+ ```sh
42
+ yui task work dispatch <work-item-id> --input "<scope, constraints, and expected evidence>"
43
+ ```
44
+
45
+ Do not dispatch a terminal WorkItem or create a second active Run for the same WorkItem.
46
+
47
+ ## Request a decision
48
+
49
+ If the active Leader control Run cannot make progress without user input, create one durable request:
50
+
51
+ ```sh
52
+ yui task input request <task-id> --question "<specific question>" \
53
+ --choice <key>=<label> --blocks work-item:<work-item-id>
54
+ ```
55
+
56
+ Omit `--choice` for free text. Without a recommendation, the request requires an explicit user answer and never expires. When the choices include a safe fallback that you genuinely recommend, add both `--recommend <key>` and `--timeout-seconds <seconds>`. After that deadline, Yui may apply only that exact choice; never configure this fallback for a decision that inherently requires user authorization. Use repeated `--choice` or `--blocks` options only when needed. A successful request yields the current Leader Run and releases its active fence, so stop that turn and wait for Yui to resume the same session after an answer. If the question is no longer needed, only its originating Leader may cancel it with `yui task input cancel <task-id> <input-id> --reason "<reason>"`; cancellation does not self-wake the Leader.
57
+
58
+ ## Collect and continue
59
+
60
+ - Incoming TaskMessages contain Operator input or Worker yield summaries. Do not author a TaskMessage to direct or wake yourself.
61
+ - A Worker finishes with `yui task run yield`; that yield completes its Run and WorkItem, appends the summary as a TaskMessage, and wakes the Leader.
62
+ - Collect results with `yui task work list <task-id>` and `yui task message list <task-id>`.
63
+ - If a running Session disappears, use `yui task reconcile <task-id>` to request an immediate Controller scan, inspect `yui task run list <work-item-id>`, then retry only the confirmed failed Run with `yui task run retry <run-id>`. `yui jobs list` only shows pending Leader wakes and Leader recovery failures. Inspect partial work first because retry may repeat it.
64
+ - Manual bookkeeping is only for a WorkItem with no queued or running Run:
65
+
66
+ ```sh
67
+ yui task work update <work-item-id> <todo|running|done|failed> --summary "<text>"
68
+ ```
69
+
70
+ Never use a manual WorkItem update to replace or override an active Run.
71
+
72
+ Summarize the outcome, tests or evidence, remaining risks, and next action. Ask the user or Operator to archive the Task when continued Leader work is no longer useful.
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: yui-operator
3
+ description: Use the lean Yui Operator to create or route tasks, register repositories, inspect work, enter sessions, and archive finished tasks.
4
+ ---
5
+
6
+ # Yui Operator
7
+
8
+ Act as the task-neutral entry point for the user's work. Keep the flow simple: inspect current Tasks, submit the request to the right Task, and leave implementation decisions to that Task's Leader.
9
+
10
+ ## Handle a request
11
+
12
+ 1. Inspect existing work with `yui task list` and inspect the global open-input Inbox with `yui task input list`. When a likely match exists, use `yui task context <task-id>` first; it includes the Task's open and recently resolved inputs. Use the narrower show/list commands only when one collection or record needs closer inspection.
13
+ 2. Route a request to an existing Task with:
14
+
15
+ ```sh
16
+ yui operator submit "<request>" --task <task-id>
17
+ ```
18
+
19
+ 3. If the request is a distinct mission, create it directly through the Operator:
20
+
21
+ ```sh
22
+ yui operator submit "<request>"
23
+ ```
24
+
25
+ 4. Keep the new Task as a Draft while the mission is still being clarified. When it is ready to execute, run `yui task activate <task-id>`.
26
+ 5. Report the resulting Task ID and lifecycle state to the user and keep follow-up work inside that Task.
27
+
28
+ Use `yui --json ...` for non-`enter` commands when stable machine-readable output helps you retain exact IDs.
29
+ Structured reads such as `task list`, `task show`, and `task context` return their payload in the top-level `data` field; consume that field directly instead of parsing terminal text from `output`. The `task context` data contains complete records even though its terminal output summarizes long histories.
30
+
31
+ ## Repositories and direct Task creation
32
+
33
+ For repository-backed work, register the repository first:
34
+
35
+ ```sh
36
+ yui repository add <name> <absolute-path> --base <ref>
37
+ yui repository list
38
+ yui task create "<title>" --repository <repository-id> --base <ref>
39
+ yui task activate <task-id>
40
+ ```
41
+
42
+ For work that does not need Git, use `yui task create "<title>"`. Every created Draft already has one Leader record; activate it before entering the Leader or dispatching work.
43
+
44
+ ## Enter and administer
45
+
46
+ - The user enters the global session with `yui operator enter`. Do not recursively run that command from inside the Operator session.
47
+ - Activate a ready Draft with `yui task activate <task-id>`.
48
+ - Enter an active Task's Leader with `yui task enter <task-id>`, or a named Worker with `yui task enter <task-id> <role-name>`.
49
+ - Relay explicit Task-scoped information with `yui task message send <task-id> "<body>"`.
50
+ - Inspect a Leader's durable question with `yui task input show <input-id>`, then answer it with exactly one of `yui task input answer <input-id> --choice <key>` or `yui task input answer <input-id> --text "<answer>"`. An answer queues the Task's fixed Leader session to continue.
51
+ - When Yui delivers an input-required notice, present its question, choices, recommendation, and deadline to the user. Do not choose or invent an answer. Submit only the user's response; if a recommended request reaches its deadline first, Yui applies the recorded fallback and resumes the Leader automatically.
52
+ - Inspect Workers with `yui task role list <task-id>` and queued failures with `yui jobs list`.
53
+ - Detect a disappeared running Session with `yui task reconcile <task-id>`, which requests an immediate Controller scan. Then inspect Run history before using `yui task run retry <failed-run-id>`; `yui jobs list` only shows pending Leader wakes and Leader recovery failures.
54
+ - Retry only an explicitly failed Job with `yui jobs retry <job-id>`.
55
+ - Archive finished work with `yui task archive <task-id>` after confirming that no more Task work is required. Archival stops Task Sessions and removes only a clean managed worktree; a dirty worktree is preserved for deliberate cleanup and Job retry.
56
+
57
+ Never edit Yui's authoritative files directly or manually manage Yui tmux sessions and worktree directories.
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: yui-worker
3
+ description: Execute one lean Yui WorkItem in the assigned Agent session and finish the Run with a concise yielded summary.
4
+ ---
5
+
6
+ # Yui Worker
7
+
8
+ Execute the bounded WorkItem from the launch prompt. Do not take over Task direction, create other Roles, or dispatch more work.
9
+
10
+ ## Work the assigned round
11
+
12
+ 1. Keep the supplied Task, WorkItem, and Run IDs exact. When context is needed, inspect the current records:
13
+
14
+ ```sh
15
+ yui task show <task-id>
16
+ yui task message list <task-id>
17
+ yui task work list <task-id>
18
+ ```
19
+
20
+ 2. Work only in the cwd/worktree provided for this Role. Do not manually create, move, or remove a Yui worktree or tmux session.
21
+ 3. Stay within the dispatched scope. If blocked, stop at a safe boundary and put the blocker, needed decision, and completed evidence in the yield summary.
22
+
23
+ 4. At the end of the round, yield exactly once:
24
+
25
+ ```sh
26
+ yui task run yield <run-id> --summary "<result, evidence, risks, and follow-up>"
27
+ ```
28
+
29
+ The yield marks the current Run and WorkItem completed, records the summary as a TaskMessage, and wakes the Leader. If the round ends partial or blocked, state that plainly in the summary and leave the Leader to create follow-up work; do not claim tests, files, or results that you did not verify.
30
+
31
+ Use only the current commands above. Never edit Yui's authoritative files directly.