@yaks/harness 0.0.0-stage → 0.2.36

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 (230) hide show
  1. package/FRONTEND.md +170 -0
  2. package/LICENSE +202 -0
  3. package/MCPAuthPanel.js +166 -0
  4. package/MCPAuthPanel.js.map +1 -0
  5. package/MCPAuthPanel.ts +184 -0
  6. package/ModelPanel.js +124 -0
  7. package/ModelPanel.js.map +1 -0
  8. package/ModelPanel.ts +143 -0
  9. package/PersonaPanel.js +106 -0
  10. package/PersonaPanel.js.map +1 -0
  11. package/PersonaPanel.ts +110 -0
  12. package/README.md +1570 -2
  13. package/RuntimePanel.js +180 -0
  14. package/RuntimePanel.js.map +1 -0
  15. package/RuntimePanel.ts +205 -0
  16. package/STREAMING.md +101 -0
  17. package/WINDOWS.md +78 -0
  18. package/WORKER.md +221 -0
  19. package/_dist/agent.d.ts +197 -0
  20. package/_dist/agent.d.ts.map +1 -0
  21. package/_dist/cli.d.ts +10 -0
  22. package/_dist/cli.d.ts.map +1 -0
  23. package/_dist/conversations.d.ts +45 -0
  24. package/_dist/conversations.d.ts.map +1 -0
  25. package/_dist/default.d.ts +32 -0
  26. package/_dist/default.d.ts.map +1 -0
  27. package/_dist/detail.d.ts +16 -0
  28. package/_dist/detail.d.ts.map +1 -0
  29. package/_dist/diagnostics.d.ts +5 -0
  30. package/_dist/diagnostics.d.ts.map +1 -0
  31. package/_dist/effects.d.ts +35 -0
  32. package/_dist/effects.d.ts.map +1 -0
  33. package/_dist/http.d.ts +12 -0
  34. package/_dist/http.d.ts.map +1 -0
  35. package/_dist/isolated.d.ts +6 -0
  36. package/_dist/isolated.d.ts.map +1 -0
  37. package/_dist/local.d.ts +74 -0
  38. package/_dist/local.d.ts.map +1 -0
  39. package/_dist/machine.d.ts +3 -0
  40. package/_dist/machine.d.ts.map +1 -0
  41. package/_dist/mcp_auth.d.ts +8 -0
  42. package/_dist/mcp_auth.d.ts.map +1 -0
  43. package/_dist/mod.d.ts +43 -0
  44. package/_dist/mod.d.ts.map +1 -0
  45. package/_dist/model_selection.d.ts +8 -0
  46. package/_dist/model_selection.d.ts.map +1 -0
  47. package/_dist/routes.d.ts +11 -0
  48. package/_dist/routes.d.ts.map +1 -0
  49. package/_dist/runs.d.ts +7 -0
  50. package/_dist/runs.d.ts.map +1 -0
  51. package/_dist/runtime.d.ts +2 -0
  52. package/_dist/runtime.d.ts.map +1 -0
  53. package/_dist/session_machines.d.ts +18 -0
  54. package/_dist/session_machines.d.ts.map +1 -0
  55. package/_dist/skills.d.ts +11 -0
  56. package/_dist/skills.d.ts.map +1 -0
  57. package/_dist/store.d.ts +38 -0
  58. package/_dist/store.d.ts.map +1 -0
  59. package/_dist/tools.d.ts +28 -0
  60. package/_dist/tools.d.ts.map +1 -0
  61. package/_dist/view.d.ts +5 -0
  62. package/_dist/view.d.ts.map +1 -0
  63. package/_dist/vocab.d.ts +7 -0
  64. package/_dist/vocab.d.ts.map +1 -0
  65. package/_dist/worn.d.ts +52 -0
  66. package/_dist/worn.d.ts.map +1 -0
  67. package/agent.js +773 -0
  68. package/agent.js.map +1 -0
  69. package/agent.ts +959 -0
  70. package/app.js +811 -0
  71. package/app.js.map +1 -0
  72. package/app.ts +868 -0
  73. package/artifact_tools.js +186 -0
  74. package/artifact_tools.js.map +1 -0
  75. package/artifact_tools.ts +190 -0
  76. package/backend_worker.ts +286 -0
  77. package/cli.js +43 -0
  78. package/cli.js.map +1 -0
  79. package/cli.ts +48 -0
  80. package/conversations.js +526 -0
  81. package/conversations.js.map +1 -0
  82. package/conversations.ts +576 -0
  83. package/conversations_testing.ts +162 -0
  84. package/default.js +162 -0
  85. package/default.js.map +1 -0
  86. package/default.ts +168 -0
  87. package/deferred_model.ts +1 -0
  88. package/deno.json +1 -0
  89. package/detail.js +50 -0
  90. package/detail.js.map +1 -0
  91. package/detail.ts +75 -0
  92. package/diagnostics.js +132 -0
  93. package/diagnostics.js.map +1 -0
  94. package/diagnostics.ts +150 -0
  95. package/draft_vault.js +149 -0
  96. package/draft_vault.js.map +1 -0
  97. package/draft_vault.ts +176 -0
  98. package/effects.js +233 -0
  99. package/effects.js.map +1 -0
  100. package/effects.ts +250 -0
  101. package/frontend/vocab.json +376 -0
  102. package/frontend.js +511 -0
  103. package/frontend.js.map +1 -0
  104. package/frontend.ts +389 -0
  105. package/http.js +107 -0
  106. package/http.js.map +1 -0
  107. package/http.ts +105 -0
  108. package/input_text.js +91 -0
  109. package/input_text.js.map +1 -0
  110. package/input_text.ts +99 -0
  111. package/instructions.js +111 -0
  112. package/instructions.js.map +1 -0
  113. package/instructions.ts +145 -0
  114. package/isolated.js +512 -0
  115. package/isolated.js.map +1 -0
  116. package/isolated.ts +502 -0
  117. package/keyboard.js +544 -0
  118. package/keyboard.js.map +1 -0
  119. package/keyboard.ts +403 -0
  120. package/legacy_instructions.js +3 -0
  121. package/legacy_instructions.js.map +1 -0
  122. package/legacy_instructions.ts +13 -0
  123. package/local.js +181 -0
  124. package/local.js.map +1 -0
  125. package/local.ts +282 -0
  126. package/machine.js +3 -0
  127. package/machine.js.map +1 -0
  128. package/machine.ts +8 -0
  129. package/mcp.js +123 -0
  130. package/mcp.js.map +1 -0
  131. package/mcp.ts +141 -0
  132. package/mcp_auth.js +63 -0
  133. package/mcp_auth.js.map +1 -0
  134. package/mcp_auth.ts +91 -0
  135. package/mcp_authorize.js +17 -0
  136. package/mcp_authorize.js.map +1 -0
  137. package/mcp_authorize.ts +18 -0
  138. package/mcp_registry.js +178 -0
  139. package/mcp_registry.js.map +1 -0
  140. package/mcp_registry.ts +193 -0
  141. package/mod.js +43 -0
  142. package/mod.js.map +1 -0
  143. package/mod.ts +45 -0
  144. package/model_selection.js +72 -0
  145. package/model_selection.js.map +1 -0
  146. package/model_selection.ts +86 -0
  147. package/numbers.js +6 -0
  148. package/numbers.js.map +1 -0
  149. package/numbers.ts +8 -0
  150. package/package.json +106 -4
  151. package/panels.js +119 -0
  152. package/panels.js.map +1 -0
  153. package/panels.ts +259 -0
  154. package/patch.js +329 -0
  155. package/patch.js.map +1 -0
  156. package/patch.ts +325 -0
  157. package/perf.ts +65 -0
  158. package/providers.js +36 -0
  159. package/providers.js.map +1 -0
  160. package/providers.ts +53 -0
  161. package/remote.js +441 -0
  162. package/remote.js.map +1 -0
  163. package/remote.ts +446 -0
  164. package/results.js +49 -0
  165. package/results.js.map +1 -0
  166. package/results.ts +39 -0
  167. package/routes.js +64 -0
  168. package/routes.js.map +1 -0
  169. package/routes.ts +87 -0
  170. package/runs.js +478 -0
  171. package/runs.js.map +1 -0
  172. package/runs.ts +479 -0
  173. package/runtime/vocab.json +36 -0
  174. package/runtime.js +105 -0
  175. package/runtime.js.map +1 -0
  176. package/runtime.ts +112 -0
  177. package/session_machines.js +203 -0
  178. package/session_machines.js.map +1 -0
  179. package/session_machines.ts +216 -0
  180. package/sheet.js +55 -0
  181. package/sheet.js.map +1 -0
  182. package/sheet.ts +31 -0
  183. package/shutdown.js +7 -0
  184. package/shutdown.js.map +1 -0
  185. package/shutdown.ts +7 -0
  186. package/skills.js +116 -0
  187. package/skills.js.map +1 -0
  188. package/skills.ts +114 -0
  189. package/startup_bench.ts +140 -0
  190. package/status.js +82 -0
  191. package/status.js.map +1 -0
  192. package/status.ts +97 -0
  193. package/steps.baseline.json +28 -0
  194. package/steps_bench.ts +155 -0
  195. package/store.js +31 -0
  196. package/store.js.map +1 -0
  197. package/store.ts +82 -0
  198. package/streaming.js +3 -0
  199. package/streaming.js.map +1 -0
  200. package/streaming.ts +8 -0
  201. package/streaming_bench.ts +76 -0
  202. package/switch_bench.ts +97 -0
  203. package/testing.ts +177 -0
  204. package/tools.js +287 -0
  205. package/tools.js.map +1 -0
  206. package/tools.ts +313 -0
  207. package/transcript.js +149 -0
  208. package/transcript.js.map +1 -0
  209. package/transcript.ts +187 -0
  210. package/tree.js +97 -0
  211. package/tree.js.map +1 -0
  212. package/tree.ts +114 -0
  213. package/unfinished.js +186 -0
  214. package/unfinished.js.map +1 -0
  215. package/unfinished.ts +198 -0
  216. package/view.js +92 -0
  217. package/view.js.map +1 -0
  218. package/view.ts +102 -0
  219. package/vocab.js +23 -0
  220. package/vocab.js.map +1 -0
  221. package/vocab.json +494 -0
  222. package/vocab.ts +22 -0
  223. package/window_bench.ts +114 -0
  224. package/worker_bench.ts +72 -0
  225. package/workspace.js +21 -0
  226. package/workspace.js.map +1 -0
  227. package/workspace.ts +17 -0
  228. package/worn.js +194 -0
  229. package/worn.js.map +1 -0
  230. package/worn.ts +246 -0
package/README.md CHANGED
@@ -1,3 +1,1571 @@
1
- # Temporary Holding Version
1
+ # @yaks/harness
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ An agent runner over a graph, with provider-backed machine tools and a terminal
4
+ interface. It is a `yak` plugin: its verbs are tools the `yak` command runs, and
5
+ its terminal app is how `yak --tui` draws a session. The runner composes
6
+ `@yaks/session` for model execution over graph-backed task and transcript
7
+ storage. A host lends the graph, models, files and workspace bindings; the
8
+ runner does not assume that a session's commands run beside the graph.
9
+
10
+ - `agent()` lends a graph the session runner (@yaks/session `running`), works
11
+ the runs its commits owe, and exposes session methods. Whatever touches a
12
+ machine is an option its host lends: tools, remote tools, what a new session
13
+ opens with, defect reports, and what to release on close. `lend()` is that
14
+ runner alone.
15
+ - `local()` is `agent()` over a graph a `yak` config composed: it lends
16
+ provider-backed machine tools, images, MCP and the OpenRouter sign-in
17
+ (`here()`), and adds the terminal's entry rendering.
18
+ - `@yaks/harness/effects` handles `session_run` where a `yak` host lists the
19
+ harness: the same runner and configured workspace bindings, wherever that
20
+ host's effects are worked.
21
+ - `hosted()` is a graph a `yak` config composed (@yaks/cli `compose`), as the
22
+ runner and its tools use it. The harness opens no graph of its own: which
23
+ packages a graph is made of, and so what a write means, is the config's.
24
+ - `harnessTools()` combines machine, delegation and graph tools.
25
+ - `@yaks/harness/vocab` and `/tools` are its facets as a plugin (@yaks/cli
26
+ `compose`): its own words and the functions behind its tools. `/tui` is its
27
+ terminal view.
28
+
29
+ The graph stores sessions, transcript entries, tasks, machine records and
30
+ configuration. Its host chooses the graph's storage, text and binary blob
31
+ backends, and credential storage. Frontend selection and navigation state are
32
+ local, with draft recovery files described below. A **bundle** is one entity's
33
+ components as a JSON object. A **batch** is a list of bundles applied in one
34
+ transaction. The **host** composes the graph and lends capabilities to plugins.
35
+ An **ask** is a recorded model request; a **settled** session has finished its
36
+ current turn without more calls to execute and can accept new input.
37
+
38
+ ## Asynchronous native tools
39
+
40
+ Native tool calls run as independent `session_tool` effects, not under the
41
+ transcript's lease. The completed model response writes each `call` with a
42
+ `tool_async` mark, and a request answers it with a Pending derived from that
43
+ mark (@yaks/session's `PENDING`). The Pending is a model-facing result, not
44
+ `result{call}`: only the ordinary tools runner's final result completes
45
+ execution. Calls overlap and a person can steer while they run. A final result,
46
+ an input, or the Pending entry of a call that outlasted its patience
47
+ (`patience`, default @yaks/session's `PATIENCE`) wakes `session_run`; there is
48
+ no model polling loop, and a call that answers sooner starts no turn of its own.
49
+ If nothing independent remains, the model ends its current response and the
50
+ graph asks it again when a result arrives.
51
+
52
+ The transcript stays running while tool finals are outstanding, even after
53
+ assistant prose. Stop prevents unstarted calls; already admitted tool effects
54
+ finish recording their outcomes. Outstanding calls prevent machine release.
55
+ Execution claims and restart inspection are still owned by `@yaks/tools`;
56
+ recovery never blindly repeats an uncertain side effect.
57
+
58
+ Tool effects share the configured effects-pool concurrency bound (64 by
59
+ default). Input is admitted immediately, but provider work can be delayed when
60
+ all effect slots are occupied; a tool that waits on work queued in the same
61
+ saturated pool is not guaranteed immediate progress. This is not unbounded
62
+ background concurrency or a reserved steering lane.
63
+
64
+ Submitted progress is never replaced by final text. Model replies are projected
65
+ immediately after their frozen `ask.through` boundary, before updates which
66
+ arrived during that request. Thus full-context replay extends the submitted
67
+ prefix instead of inserting a final result into its middle. OpenAI receives two
68
+ `function_call_output` items with the same call ID (progress, then final). Other
69
+ provider routes conservatively receive the final as a labeled user notification
70
+ after the first tool output. This preserves both outcomes without assuming every
71
+ Responses-compatible endpoint accepts duplicate tool outputs. The configured
72
+ Codex route was live-tested with `gpt-6.1-sol`: full-context progress/final
73
+ works; `previous_response_id` and `store: true` are refused there. This says
74
+ nothing about public OpenAI API continuation support. Prefix stability preserves
75
+ cache eligibility, not a guarantee of a cache hit.
76
+
77
+ ## Native steps
78
+
79
+ Synthetic tool progress acknowledges the provider protocol and owes one model
80
+ turn so the model can keep working while the call runs. Once that progress is
81
+ consumed, the transcript waits without repeating the turn. Actual input and
82
+ final results also owe model requests immediately, including while another tool
83
+ is still running. Submitted progress stays in the transcript and provider
84
+ continuation prefix unchanged.
85
+
86
+ When a native session settles with an open claim, the harness gives it one
87
+ recovery input per claim. The session can finish the task, record what remains
88
+ and release its claim, or record what the task is waiting on. If the claim is
89
+ still open when the session settles again, the harness records its latest reply
90
+ on the task, releases the claim, and reports the fallback to the tracker.
91
+ Blocked work, dependencies, pending child or tool results, answered comment
92
+ sessions, and work owned by Heal keep their existing paths.
93
+
94
+ The `harness-steps` benchmark measures native step CPU time with an instantly
95
+ answered scripted model over an isolated graph. It compares that work with the
96
+ committed `steps.baseline.json` reference and the slack its noise measured. Live
97
+ dispatch wall time also includes other sessions' event-loop work and storage
98
+ waits, even after subtracting time waiting for a CPU. It cannot be compared with
99
+ this isolated CPU reference, so live timings do not file bugs. Deterministic
100
+ read-cost tests in `@yaks/session` check that long transcripts do not amplify a
101
+ step's reads.
102
+
103
+ ```sh
104
+ deno task bench harness-steps
105
+ deno task bench:check harness-steps
106
+ ```
107
+
108
+ ## Skills
109
+
110
+ A native session receives skill titles and descriptions before each model ask,
111
+ only when its exact tool offer includes `skill_read`. A session working in a
112
+ repository is offered that repository's skills; one with none, as every session
113
+ on yaks.app, is offered every skill its store keeps. `@yaks/harness/skills`
114
+ reads only the graph, so a space's Operator takes the same `skillItems` and
115
+ `skillRead` as the box, which adapts the loader through `skillTools`. The single
116
+ read-only loader accepts `{skill: '<title>'}` and returns the exact instructions
117
+ plus the supporting-file base path through the attributed graph runner. It does
118
+ not execute scripts or start a fork from metadata.
119
+
120
+ Catalogue and instructions come from graph skills through @yaks/persona. Reading
121
+ skills never provisions a machine or scans a checkout. Graph edits appear on the
122
+ next request; repository files are synchronized separately by the persona skill
123
+ mirror (`{skills: true}`). Supporting-file paths are repository-relative.
124
+ User-only skills are not model-discovered or loaded.
125
+
126
+ Explicit tool registries and transcript allowlists remain exact: they do not
127
+ gain a loader implicitly. Source-bound images remain beside their transcript
128
+ entries; dynamic catalogue items are separate and count toward compaction
129
+ budgets.
130
+
131
+ ## Exports
132
+
133
+ | Import | Main exports |
134
+ | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
135
+ | `@yaks/harness` | `agent`, `seed`, `sessionTitle`, `titleOf`, and their types; web platform only |
136
+ | `@yaks/harness/default` | `defaultUsing(graph)`, `usingFor(graph, work)`, `routing(graph)`, `pin(graph, name)` and `HARNESS`, alone, for packages that request sessions |
137
+ | `@yaks/harness/local` | `local`, `hosted`, `harnessTools`, `graphTools`, and their types |
138
+ | `@yaks/harness/tui` | `views`: a lone session or entry, drawn as the terminal app |
139
+ | `@yaks/harness/vocab` | `docs`, the harness's own words |
140
+ | `@yaks/harness/tools` | `runs(host)`, the functions behind the tools `vocab.json` declares |
141
+ | `@yaks/harness/cli` | `commands`, the session terminal control |
142
+ | `@yaks/harness/routes` | `routes(host, options)`: `POST /model/step`, answered from this machine's providers |
143
+
144
+ ## Use
145
+
146
+ List `@yaks/harness` among a `yak` config's plugins, beside the packages whose
147
+ words it runs over: `@yaks/session`, `@yaks/tools`, `@yaks/context`,
148
+ `@yaks/model` and the providers it may ask, `@yaks/blob`, `@yaks/machine`,
149
+ `@yaks/process`, `@yaks/secrets`, `@yaks/key`, `@yaks/alias`,
150
+ `@yaks/connections`, `@yaks/mcp-client`, `@yaks/git`, `@yaks/effects`, and the
151
+ work (`@yaks/doc`, `@yaks/edge`, `@yaks/task`, `@yaks/project`). `PLUGINS` in
152
+ `testing.ts` is such a list, in a config's order. Then:
153
+
154
+ ```sh
155
+ yak session new 'reply with the word pong'
156
+ yak session new 'inspect the task graph' --persona N-15
157
+ yak session new 'what is an entity?' --topic Q-9
158
+ yak session tui
159
+ yak session send <session> 'and again'
160
+ yak session send <session> 'continue here' --provider openai --model gpt-6.2-sol
161
+ yak session list
162
+ yak session peek <session>
163
+ yak task list
164
+ yak model list
165
+ yak auth openai
166
+ ```
167
+
168
+ `session new` and `session send` write the input, wait while the transcript runs
169
+ wherever the graph's effects are worked, and answer with the entry it settled
170
+ on, so a command line prints the reply. `session send` can select another
171
+ provider and model on the same session. `yak session new '…' --tui` opens the
172
+ terminal app selected on that session. `yak session tui` opens it without
173
+ creating a session; `yak session` still lists its subcommands. The transcript
174
+ scrolls and word-wraps beside the Sessions and Context usage panels. Enter
175
+ starts a session (or sends to the selected one); Shift+Enter inserts a newline.
176
+ In NORMAL mode, `b` opens a 20-row session browser, `>` and `<` change pages,
177
+ and Ctrl+N / Ctrl+P or Alt+Down / Alt+Up select roots on the visible page.
178
+ Ctrl+O selects a new session, PgUp / PgDn scroll, and Ctrl+C quits. Shift+Enter
179
+ needs a terminal supporting kitty keyboard sequences (Alt+Enter also inserts a
180
+ newline). On a new session, NORMAL `P` chooses a persona from the graph for that
181
+ session. `--persona` accepts a persona id or registered name; the session keeps
182
+ that choice, and each of its asks is told the persona as it reads then.
183
+
184
+ `--topic` opens the session on a topic ([@yaks/topic](../topic)): it keeps the
185
+ topic as `session.topic`, wears the oracle persona (`ORACLE`) unless `--persona`
186
+ names another, and each of its asks is told the topic tree compiled from it
187
+ (what `yak topic read` prints) after the persona's text. A question the topic
188
+ already answers is answered with no tool call.
189
+
190
+ What a session is offered is its work's to say: a persona that contains
191
+ registered tools, itself or through a persona it includes (@yaks/persona
192
+ `offer`), offers exactly those tools to every session wearing it, chosen or
193
+ common, from whatever door opened it, and to the helpers and forks it starts.
194
+ The names are any the host can run: the runner's own (`shell`, `read`, `fork`)
195
+ and the host's others (`task_new`, `decision_new`, `search`, `spend_show`,
196
+ `session_new`). The runner reads them from the persona for each ask, with its
197
+ text (`wear`, below), and the ask records them as its `sending.tools`: a tool
198
+ the persona gains or loses reaches a session on its next ask, however long it
199
+ has run. Each turn is offered those and nothing else, and no skill catalogue
200
+ unless `skill_read` is among them. A persona containing no tool leaves the
201
+ runner's own set, and a line that selected its own (`sending.tools` on an input,
202
+ as a trial's or a builder's does) keeps them whatever the persona contains. A
203
+ tool is the `tool{name}` row its host registers (`.tool.name=topic_find`), and a
204
+ persona offers it by a `contains` edge to that row.
205
+
206
+ The harness names no provider. A provider is a plugin that exports `./provider`
207
+ (@yaks/model `ProviderFacet`): `@yaks/openai`, `@yaks/openrouter`,
208
+ `@yaks/anthropic` and `@yaks/claude` each do, and a session may ask exactly the
209
+ ones its config lists (./providers.ts). Listed, `@yaks/claude` serves
210
+ `--provider claude --model haiku|sonnet|opus`: a signed-in `claude -p` supplies
211
+ one model turn while this harness alone executes tools and records
212
+ calls/results. See `packages/claude/README.md` for the CLI/graph boundary. New
213
+ native transcripts carry `native`; outside managed Claude sessions remain on
214
+ `@yaks/spawn`. HTTP fixer requests (for example `openai`) are marked `native`
215
+ before their first turn. The host cuts their own worktree from the configured
216
+ spawn `cwd` under `worktrees`, attaches it through its workspace binding, and
217
+ admits its instruction files and repository persona. Existing managed fixers
218
+ keep their original runner; changing heal config does not migrate or stop them.
219
+
220
+ ### Sessions outside words start
221
+
222
+ Anyone can write the words a fixer starts from (a tracker bug's title, stack and
223
+ breadcrumbs) and the letters a project's helper takes. Such a session is
224
+ **exposed** ([`isolated.ts`](./isolated.ts) `exposed`): it carries `fixer{bug}`
225
+ or `helping{project}`, or descends from one through `spawned{parent}`. Each of
226
+ its steps, background calls and results is answered with its own registry, in
227
+ place of the host's tools, persona tool lists and MCP servers:
228
+
229
+ - the machine tools over a sandbox of its own, holding a committed snapshot of
230
+ the configured source, without network, with no host home or keys;
231
+ - `submit_patch`, which hands the sandbox's changes to a **lander**: a native
232
+ session of the host's own (`lands{from}`), wearing the same persona and taking
233
+ the task's claim, whose first input is the patch, to be read as untrusted
234
+ code, applied, landed and seen live. A session holding no task (a helper)
235
+ names the one its work is for, such as the task a letter it took filed, and
236
+ with a task named it may hand over no patch, leaving the lander only what
237
+ needs the box, such as an answer to send. The lander's first input names the
238
+ tools it is offered (`sending.tools`), whatever its persona's own list holds:
239
+ the isolation's `landing`, by default a checkout's machine tools, the graph
240
+ and task tools, `land`, `admin_support`, `mail_reply` and the bug tools;
241
+ - the host tools the isolation names, by default reads (`graph_show`,
242
+ `graph_query`, `graph_schema`, `search`, `bug_show`) and `session_handup`.
243
+
244
+ A sandbox lasts one run (each input carrying `using`, as heal's and a helper's
245
+ do). The harness saves the workspace diff in the graph after write and command
246
+ tools return. A later run starts from a fresh snapshot and can submit the saved
247
+ patch if the checkout is empty. Submission queues the handoff for the current
248
+ claim holder when another session holds the task. When the fixer holds it, the
249
+ new lander takes the claim in the same write as the handoff. Landers record
250
+ their reason when rejecting a patch and release the claim if they are done
251
+ working on the task.
252
+
253
+ The sandbox is disposed when the transcript ends or hands off its patch. Its
254
+ instructions are the runner's with a note on where it works. An exposed fixer
255
+ gets no host checkout. The plugin's `isolation` option says what the sandbox is:
256
+
257
+ ```json
258
+ {
259
+ "use": "@yaks/harness",
260
+ "with": {
261
+ "isolation": {
262
+ "dir": "/home/yaks/.yak/isolated",
263
+ "limits": { "cpuQuota": 200, "memoryMax": 4294967296, "tasksMax": 512 },
264
+ "binds": ["/home/linuxbrew", "/home/yaks/.cache/deno"],
265
+ "env": {
266
+ "PATH": "/usr/bin:/bin:/home/linuxbrew/.linuxbrew/bin",
267
+ "DENO_DIR": "/home/yaks/.cache/deno"
268
+ },
269
+ "source": "/home/yaks/code/tasks",
270
+ "setup": {
271
+ "install": "deno task deps:install --cached-only --quiet",
272
+ "warm": "deno task deps:install --node-modules-dir=none --quiet"
273
+ },
274
+ "tools": ["graph_show", "graph_query", "search", "session_handup"]
275
+ }
276
+ }
277
+ }
278
+ ```
279
+
280
+ `dir`, `limits`, `binds` and `env` are the bubblewrap provider's
281
+ ([@yaks/sandbox](../sandbox/README.md#bubblewrap-sandboxes)); `binds` are
282
+ read-only. A sandbox is ready in a few seconds and holds little more than the
283
+ checked-out source ([`isolated.ts`](./isolated.ts) `snapshot`). Its layers are
284
+ made on the host under `dir`'s `.layers`, and every sandbox shares them
285
+ read-only:
286
+
287
+ - the commit's objects, fetched at depth one, once for each commit; the
288
+ workspace is a repository of that commit borrowing them;
289
+ - what `setup` made of the commit, run with `env` once for each set of manifests
290
+ (`deno.json`, `package.json`, `deno.lock`), each `node_modules` it made bound
291
+ at its place in the workspace. On the host's disk an install hardlinks its
292
+ cache.
293
+
294
+ `setup` takes a shell command or an object with `install` and `warm` commands.
295
+ If `install` fails, the host runs `warm` against the same committed manifests
296
+ and cache, then retries `install`. The Deno example downloads workspace
297
+ dependencies into `DENO_DIR` during `warm` and builds `node_modules` during the
298
+ offline `install`. This repository's `deps:install` task uses
299
+ `deno install --frozen=false` so these explicit installs can update the
300
+ snapshot's private lockfile. Run `deno task test:sandbox-install` to check the
301
+ committed lockfile and the install in a fresh worktree.
302
+
303
+ The commit is the host's own code, and nothing a sandbox writes reaches the
304
+ host. A layer no sandbox was made from for a day is removed. Without `dir`,
305
+ `limits` and `source`, an exposed session has the named host tools alone. A
306
+ sandbox that cannot be built is reported, and exposed sessions keep those tools;
307
+ no other session is affected.
308
+
309
+ A graph-only model opening needs no workspace and does not borrow the server's
310
+ current directory or filesystem. The local `yak session new` command defaults to
311
+ the checkout where it was started, retaining a nested command directory
312
+ separately from the checkout root. With no workspace selected, the first file or
313
+ command call records an intention through the configured default sandbox
314
+ binding; no adapter means a refusal. `--workspace <workspace-id>` names a
315
+ file-and-command target; `--cwd` selects its command directory.
316
+ `--work <task-or-project>` admits that work's common graph persona and files the
317
+ session under its project; `--persona` chooses a persona explicitly. The session
318
+ records the persona it wears as `session.persona`: the one chosen, else its
319
+ work's, else the one its checkout carries, else the persona of the session that
320
+ started it (a Claude Code subagent's run of `yak session new` wears its
321
+ parent's). One wearing none records that session's actor as `session.actor`, so
322
+ what it writes names an actor (@yaks/session `actorOf`). A missing instruction
323
+ projection without graph context refuses opening. See
324
+ [Session workspaces](#session-workspaces).
325
+
326
+ Frontend drafts are local to the terminal's machine. `HARNESS_DRAFT_DIR`
327
+ relocates them; [Draft recovery](#draft-recovery) describes their lifetime.
328
+ Process-provider state belongs to its configured host: `TASKS_HOME` moves the
329
+ process supervisor's files unless `PROCESS_DIR` is set. Probes use their own
330
+ provider directory and process state, while leaving `HOME` unchanged so Deno
331
+ reuses its module cache.
332
+
333
+ Name a model with `--model` and its provider with `--provider`. A model named
334
+ alone is asked wherever it is served. What a session asks when neither is named
335
+ is the default (`defaultUsing`): the `using{provider, model}` on this package's
336
+ row, `package{name: "@yaks/harness"}`, whose eid is derived from that name. One
337
+ write changes it:
338
+
339
+ ```sh
340
+ yak graph apply --bundles '[{"entity": {"eid": "8b429c76-beb1-8dcf-82fc-c68f7f0e5c73"}, "using": {"provider": "openrouter", "model": "z-ai/glm-5.3"}}]'
341
+ ```
342
+
343
+ A host that keeps its default elsewhere lends `lend` its own reader as
344
+ `defaultUsing`, which compaction reads before every ask where the agent is lent
345
+ no `name`; yaks.app's Operator reads the model its directory's persona names
346
+ (@yaks/platform/operator-model).
347
+
348
+ The default may be routed instead. Each `routes` edge from that row to an
349
+ offering (the `serves` edge of a provider and a model) is one model the default
350
+ may run on, and the router (@yaks/model `route`) chooses among them by the
351
+ plans' newest readings
352
+ (`rate_limit{provider, window, account, model, used, resets,
353
+ at}`): the offering
354
+ whose plan has the most of its week left, or whose plan's limit on its model
355
+ has, where that is less. A provider that spends another's plan says so
356
+ (`provider{plan}`): `openai`, signed in with a ChatGPT grant, spends the plan
357
+ `codex` reports. Every request a native session's provider answers renews the
358
+ readings: Claude Code's stream and the Codex backend's headers say how much of
359
+ the plan is used, and the step that records the reply keeps it. The session's
360
+ first input records the choice and its reason, `using{provider, model, why}`,
361
+ and keeps that model whatever the plans read later. The row's own `using`
362
+ answers while no routed plan has a reading. This routes the default between
363
+ GPT-6.2 Sol on the ChatGPT subscription and Opus 5.5 on Claude's:
364
+
365
+ ```sh
366
+ yak graph apply --bundles '[
367
+ {"entity": {"eid": "c7d76166-84c6-8e59-b1f0-ceedeb443c37"}, "provider": {"plan": "codex"}},
368
+ {"edge": {"from": "8b429c76-beb1-8dcf-82fc-c68f7f0e5c73", "to": "d0577d0c-2ad8-8862-8b11-9aa5796cebd8"}, "routes": {}},
369
+ {"edge": {"from": "8b429c76-beb1-8dcf-82fc-c68f7f0e5c73", "to": "b032077b-4a75-83d0-8580-7a1782959d1a"}, "routes": {}}]'
370
+ ```
371
+
372
+ A session whose plan runs out goes on with the next one. When a request fails
373
+ because the plan it spends is used up (@yaks/model `spent`: the Codex backend's
374
+ `usage_limit_reached`, a billing quota, or a window Claude Code read full), the
375
+ runner asks the harness where to go (`Deps.onward`, ./default.ts `movedOn`): of
376
+ the offerings the default routes, one on another plan whose readings leave room
377
+ (@yaks/model `onward`). The session records the move as a passive line,
378
+ `Moved on: <why>.` with `using{provider, model, why}`, and asks again at once
379
+ with the same conversation; every later turn stays there until a person chooses
380
+ another model. Where the default routes nothing else, or every other plan is
381
+ spent too, the request waits for its plan to reset as before.
382
+
383
+ Grok Build and Google Antigravity are subscription-backed providers on a local
384
+ effects host. Configure `grok` and `antigravity` and add their offerings to this
385
+ default as shown in [@yaks/model-cli](../model-cli/README.md). A host can move
386
+ onto the provider implementations it has configured.
387
+
388
+ Deleting a `routes` edge takes its model out, and with none left the row's
389
+ `using` is the default again. A project routes its own work the same way, by
390
+ `routes` edges from the project.
391
+
392
+ `yak model pin <model>` pins the default to one of the models it routes,
393
+ whatever the plans read, and `yak model pin --clear` resumes routing; alone,
394
+ `yak model pin` says what the default is now and which models it routes
395
+ (`model_pin` through MCP). A pin is the mark `routes{pinned}` on that model's
396
+ `routes` edge, which the router reads with the rest, and a pinned session's
397
+ first input says so (`using.why`: "gpt-6-astra is pinned"). Only a routed model
398
+ can be pinned, so GPT-6 Astra is routed beside Sol, on the same ChatGPT plan;
399
+ offerings that weigh alike keep the order of their edges (`edge.ord`, then the
400
+ earliest routed), so Sol still answers for that plan unless Astra is pinned. A
401
+ pin moves everything that asks the default, @yaks/heal's fixers among them. A
402
+ session that names its model, or has already started, keeps its own.
403
+
404
+ A session started on a person's comment (@yaks/session
405
+ [A comment starts a session](../session/README.md#a-comment-starts-a-session))
406
+ asks what the task's project says its work runs on (`usingFor`): the offering
407
+ the project routes, else the `using{provider, model}` on the project, and the
408
+ default where the project says neither. A project whose `using` names the
409
+ `claude` provider has such a session answered by the signed-in `claude -p`
410
+ (@yaks/claude), on its owner's subscription.
411
+
412
+ Each provider signs in its own way (OpenAI: `$OPENAI_API_KEY` or the OpenAI
413
+ connection), over the sign-ins this machine lends it. `yak auth` belongs to
414
+ [@yaks/connections](../connections). It lists integrations; pass a name or title
415
+ to sign in. It prints an authorization link and reads the complete return URL
416
+ with terminal echo disabled. The return URL is never a command argument or
417
+ transcript entry. `yak model list --provider <name>` lists the names a
418
+ configured provider offers, the default model's provider when none is named.
419
+
420
+ ```ts
421
+ import { compose } from '@yaks/cli/host'
422
+ import { hosted, local } from '@yaks/harness/local'
423
+ import type { Model } from '@yaks/model'
424
+
425
+ // A local model for this example; replace it with a provider adapter.
426
+ let model: Model = async (request) => ({
427
+ id: crypto.randomUUID(),
428
+ model: request.model,
429
+ items: [{ kind: 'assistant', text: 'pong' }],
430
+ })
431
+ // A config naming a graph in memory, made of the packages listed above.
432
+ let words = ['kernel', 'id', 'secrets', 'edge', 'blob', 'doc', 'effects']
433
+ let work = ['task', 'project', 'session', 'tools', 'model', 'openai']
434
+ let more = [
435
+ 'openrouter',
436
+ 'machine',
437
+ 'process',
438
+ 'context',
439
+ 'connections',
440
+ 'mcp-client',
441
+ ]
442
+ let plugins = [...words, ...work, ...more, 'git', 'harness']
443
+ .map((p) => `@yaks/${p}`)
444
+ let host = await compose({ db: ':memory:', plugins }, ['graph'])
445
+ let a = await local({
446
+ name: 'example-model',
447
+ h: hosted(host, () => host.close()),
448
+ model,
449
+ tools: [],
450
+ })
451
+ try {
452
+ let s = await a.start('reply with the word pong')
453
+ await a.idle(s)
454
+ for (let e of await a.transcript(s)) console.log(a.line(e))
455
+ } finally {
456
+ await a.close()
457
+ }
458
+ ```
459
+
460
+ Pass the graph as `h`; closing the agent runs its `close`. Do not spread it into
461
+ the options: `local({ ...hosted(host) })` is rejected by both the type contract
462
+ and a runtime check.
463
+
464
+ Settled subagents are hidden by default regardless of their assigned tasks. The
465
+ sidebar shows the selected session and its direct children; `b` opens a paged
466
+ session browser. **Ctrl+S** toggles **Show settled**; NORMAL mode also provides
467
+ `s`. Root sessions on the visible page, the selected child, and its visible
468
+ ancestors stay reachable. Explicit archival remains separate. This filter
469
+ changes display/navigation only; completion messages and child transcripts
470
+ remain available. Failed and stopped children remain visible.
471
+
472
+ ## Keyboard modes
473
+
474
+ **Ctrl+U cuts the entire draft in INSERT or VISUAL mode:** it saves the exact
475
+ source (including newlines) in the frontend's private `visual.yank`, requests an
476
+ OSC52 clipboard write, then clears the draft and resets its cursor. It does not
477
+ send a message. Empty drafts leave the clipboard alone. If the clipboard writer
478
+ throws, the draft is retained. If no writer is available, the draft is cut to
479
+ the local clipboard copy only. The status line reports the outcome; terminal
480
+ clipboard permissions can prevent OSC52 delivery, which cannot be acknowledged.
481
+ The local clipboard copy remains recoverable until replaced or its saved
482
+ recovery copy is removed. `Alt+p` inserts it into the draft. The standalone
483
+ textarea's Ctrl+U editing behavior is unchanged.
484
+
485
+ The composer starts in **INSERT** mode. Escape enters **NORMAL**, and `i`
486
+ returns to editing without changing the draft or cursor. NORMAL commands never
487
+ submit or type into the composer. `?` opens help; `?` or Escape dismisses it.
488
+ There is no permanent shortcut panel.
489
+
490
+ | NORMAL key | Action |
491
+ | ---------------------------- | ------------------------------------------------------- |
492
+ | `j` / `k` | Move transcript cursor down / up |
493
+ | `h` / `l` | Move transcript cursor left / right |
494
+ | `gg` / `G` | Transcript start / end; `G` resumes bottom-follow |
495
+ | Tab | Switch transcript / sidebar focus |
496
+ | `Ctrl+w h` / `Ctrl+w l` | Focus transcript / sidebar |
497
+ | `j` / `k` with sidebar focus | Select visible rows |
498
+ | `n` / `p` | Next / previous root |
499
+ | `b` / `>` / `<` | Browse sessions / next page / previous page |
500
+ | `o` | New session |
501
+ | `t` | Toggle message / task composer |
502
+ | `a` / `z` / `s` | Archive selected session / show archived / show settled |
503
+ | `v` | VISUAL selection of rendered transcript text |
504
+ | Ctrl+U / Ctrl+D | Move selection half a page up / down |
505
+ | Ctrl+B / Ctrl+F | Move transcript selection a page up / down |
506
+ | `i` | Return to INSERT |
507
+
508
+ In VISUAL, `hjkl` extend selection, `y` copies and returns to NORMAL, and Escape
509
+ cancels to NORMAL. Tab cycles selectable surfaces. In INSERT, Alt+v starts draft
510
+ selection. Draft selection uses source text; transcript selection uses rendered
511
+ text and can span retained entries. Enter opens the selected entry's source.
512
+ This is not a full Vim editor. Normal `gg` is a two-key sequence, canceled by
513
+ any intervening command or leaving the mode, with no timing requirement.
514
+ Bracketed paste in NORMAL is ignored rather than interpreted as commands.
515
+
516
+ Existing modified navigation shortcuts remain available for compatibility.
517
+ Ctrl+C always quits; Ctrl+End follows the transcript end. Plain `?`, `hjkl`, and
518
+ `y` still type normally in INSERT. Mode/focus/help state belongs to the
519
+ frontend's private graph, while the TUI key-routing and text-surface APIs are
520
+ graph-independent.
521
+
522
+ In INSERT mode, Tab toggles the visible composer mode between **message** (the
523
+ default) and **task**, without changing the draft. Task mode requires a selected
524
+ session; Enter calls `a.taskEntry(session, text)` to create a `doc` and a bare
525
+ `task{}` (no filing metadata), contain it under the session's claimed tasks, and
526
+ spawn a child that claims it. With no claimed tasks, containment is under the
527
+ session itself. The first line (up to 120 characters) is the title; the entire
528
+ text is the body. The queued execution request, task, edges, child and claim are
529
+ one atomic write through `taskEntry(graph, session, text, limits?)` from
530
+ `@yaks/session`. A rejected submission creates nothing and appears by the
531
+ composer. The parent stays selected and available for messages; the child and
532
+ its completion arrives in the parent transcript without a keypress.
533
+
534
+ Typing only touches the editor. Post-commit graph effects refresh the content,
535
+ including model replies arriving while stdin is idle; there is no polling loop
536
+ for transcript refresh. The sidebar is `Opts.panels` in `app.ts`: each
537
+ contribution in `panels.ts` is `{title, read, Render}`, with `read` returning
538
+ bundles from graph-backed interfaces. To embed the app, mount `App` with
539
+ `{agent: a, subscribe: changes(a), panels}`; use
540
+ `run(() => h(App, opts), {backend})` to choose a terminal backend.
541
+
542
+ ## What it is made of
543
+
544
+ - **Persistent state.** A transcript is `entry` entities, what it ran is
545
+ `process` entities, the work is `task` entities — @yaks/session, @yaks/process
546
+ and @yaks/task over @yaks/sqlite. Storage initialization and migrations use
547
+ SQL; normal agent operations use the graph API. Session state is persisted;
548
+ running sessions can be queried with `.session.status=running`.
549
+ - **Two statuses are computed, never stored.** `@yaks/harness/vocab` registers
550
+ the computed session status through `@yaks/session/vocab`. A task's status is
551
+ the ladder @yaks/task declares, with @yaks/session's rung added:
552
+ completed/cancelled win, then a claim means wip, otherwise open. `blocked`
553
+ stays a component of its own, never a status. Queries filter in the database,
554
+ and the sidebar reads that same status.
555
+ - **Work need not be filed.** `doc` + bare `task{}` is a task without project
556
+ metadata; optional `filed{project, priority, domain, assignee}` adds project
557
+ and assignment metadata. `a.tasks()` reads a page of open/wip work, newest
558
+ first, without requiring filing or a project. The session sidebar does not
559
+ query that graph-wide list.
560
+ - **Tools use the session's graph.** `harnessTools()` combines machine,
561
+ delegation, artifact, text-inspection, and generic graph tools (`graph_apply`,
562
+ `graph_query`, `graph_show`, `graph_schema`). Their JSON Schemas are sent to
563
+ the model as declared.
564
+ - **Restart recovery.** @yaks/session's service releases execution leases whose
565
+ holders are absent from the graph; a worker joining the effects pool sweeps up
566
+ the runs a restart left owed, and `resume()` delivers what ended children left
567
+ undelivered and answers the transcripts still live.
568
+
569
+ ## The machine
570
+
571
+ ./machine.ts declares the machine tools once: `shell`, `wait`, `stop`, `read`
572
+ and `write`, over a [Machine](../machine/README.md#machine) the host lends
573
+ (`@yaks/machine`, runtime neutral). The
574
+ [process provider](../process/README.md#machines) lends directory-separated
575
+ sandboxes or explicitly attached local machines; the yaks.app Worker lends its
576
+ sandbox container (workers/yak/sandbox.ts).
577
+
578
+ `shell` runs `bash -c`, starting each command in the session's home command
579
+ directory. To work in a subdirectory within a command, use `cd sub && …` in its
580
+ `command`; the next shell call starts in the home command directory again. If
581
+ the command outlives the call's timeout, it keeps running and the answer names
582
+ its process id; `wait` looks for its exit and answers recent output, and `stop`
583
+ sends SIGTERM and then SIGKILL if necessary. On a box, a command runs with the
584
+ host environment, including `PATH` and `HOME`, and is a process entity written
585
+ before the child starts; `wait` and `stop` read its persisted exit, so they also
586
+ work for processes that `watch()` adopted after a restart. `read` and `write`
587
+ take a path from the session's directory unless it is rooted.
588
+
589
+ ## Not here
590
+
591
+ The standalone harness does not run a sync service or HTTP server. It does not
592
+ keep a separate persisted log of pending effects; `resume()` restarts work from
593
+ the session records. The terminal renderer and its widgets come from @yaks/tui.
594
+
595
+ ## Compatibility
596
+
597
+ The executable and main module require Deno with filesystem, environment, and
598
+ subprocess permissions. SQLite comes from `jsr:@db/sqlite`. Vocabulary exports
599
+ can also be loaded by a browser.
600
+
601
+ ## Forks and subagents
602
+
603
+ The default tool table includes `fork`, `spawn`, and `wait`:
604
+
605
+ - `fork({prompt, instructions?, model?, effort?})` continues the caller's
606
+ transcript prefix **before the current tool turn**, then adds the prompt.
607
+ Unanswered calls are not inherited. It returns a concurrent child session id.
608
+ A fork is offered `spawn` for fresh helpers.
609
+ - `spawn({prompt, instructions?, model?, effort?})` returns a fresh child
610
+ session id. It inherits the serving configuration, not the transcript. `model`
611
+ accepts a model name or an existing model entity id; the inherited provider
612
+ stays while it serves that model, and otherwise the provider that serves it
613
+ answers. A name no model has yet becomes a model the inherited provider serves
614
+ under that name.
615
+ - `spawn({task, instructions?, model?, effort?})` instead accepts a task eid or
616
+ `T-<number>`. The child's first input records its title and body when
617
+ submitted; its claim commits with the child, so the task is wip as soon as it
618
+ is created. Choose exactly one of `prompt` and `task`. Independent subtasks
619
+ can run in parallel; tree ordering is through `requires`/`contains`, not
620
+ priority.
621
+ - `wait({children: [id, ...], timeout?: milliseconds})` waits on direct children
622
+ and returns their statuses and output. The default timeout is 60 seconds;
623
+ timing out leaves the children running.
624
+ - `wait({tasks: [id, ...], timeout?: milliseconds})` returns each task's
625
+ `{task, status, done}`. Shared @yaks/task `done()` requires a settled task
626
+ (completed or cancelled) with no unfinished tasks directly referenced by
627
+ `requires` or `contains` edges. Timeout returns the current state without
628
+ cancelling work.
629
+ - `wait({process, timeout?})` still waits on a shell process. The tool table
630
+ exposes one merged `wait`: choose exactly one of process, children, or tasks.
631
+
632
+ A host that sets `forkLatest: true` in `sessionTools` offers `fork({title?})`.
633
+ It inherits the prefix through the request that called the tool and starts with
634
+ a single harness instruction. The hosted Operator uses this form when delegating
635
+ the work the person just asked for.
636
+
637
+ A child carries `spawned{parent, call}`; a fork additionally has `fork{from}`.
638
+ `a.children(session)` reads that structure. When a child settles, the run that
639
+ ended it writes a completion receipt into the parent: a result if the
640
+ originating call is still open, otherwise an input carrying the parent's
641
+ `using`, which asks for another parent turn. Failed/stopped children also report
642
+ their terminal outcome. A stopped parent is not revived. When its claimed task
643
+ is done, a child with no active work delivers `task T-<number> <status>` plus
644
+ its final message, with the idempotent receipt id
645
+ `delivery:<child>:task:<task>:<status>`. A child settling before the task is
646
+ done still reports its outcome, using a receipt id derived from its final entry.
647
+ `resume()` reconciles missed receipts without repeating ones already received.
648
+ Fork/spawn calls themselves are idempotent by call id.
649
+
650
+ `local({maxChildren: 32, maxSessions: 64})` sets the defaults explicitly. Child
651
+ submissions return an ID and a persisted `dispatch.state=queued` record;
652
+ `session.status=queued` distinguishes waiting children from active or settled
653
+ ones. At most `maxChildren` children are `active` at once across all parents (32
654
+ by default); the bound is kept in the graph, so it holds across every process
655
+ running the graph's effects. FIFO submission order is durable; a nested wait
656
+ queues again for a place before returning. Root sessions do not consume child
657
+ places; `maxSessions` remains a limit checked when starting a root session. A
658
+ waiting delegated parent gives up its place (`dispatch.state:
659
+ waiting`), so
660
+ capacity one supports nested delegation. Child preparation records its machine
661
+ home; provisioning waits for its first machine call. Preparation failures and
662
+ queued cancellation terminate with a completion message. A worker coming up
663
+ sweeps up what a restart left owed; spawn replay preserves ID and fork boundary.
664
+ `await a.close()` stops admission, lets the step in flight finish, leaves the
665
+ pool and closes the harness database; it does not empty the persisted queue or
666
+ complete assigned tasks. Independent supervised processes are untouched. A
667
+ transcript is run under a lease named for it, renewed while it runs: one process
668
+ runs it at a time. A holder known to be over (its pid gone, or its `exit`
669
+ written, as a backend Worker ended where it stood writes its own) is passed at
670
+ once; one nobody can tell is over holds it up until the take runs out (`hold`).
671
+ The lease is not a security boundary against arbitrary graph writes. Provider
672
+ limits still constrain model throughput.
673
+
674
+ `tools` replaces the default table when supplied. `sessionTools(graph, limits)`
675
+ from `@yaks/session` is the standalone delegation table (its scheduling queries
676
+ use the registered `session.status` derived property).
677
+
678
+ ## Performance probe
679
+
680
+ ```sh
681
+ deno run -A packages/harness/perf.ts
682
+ ```
683
+
684
+ This reports warmed median/p95 fresh-entry apply time and the subsequent
685
+ `react()` step's model-dispatch overhead with a fixed 1,000-entry SQLite
686
+ transcript. It uses a fake model and measures no network time. The SQLite/runner
687
+ integration suite lives under `packages/`, outside the repository's fast test
688
+ tier.
689
+
690
+ ### Auto-task lifecycle context
691
+
692
+ Task-mode submission writes a passive `notice` entry into the parent transcript
693
+ in the same batch as the task and child. It records the original request and
694
+ user-created origin. A notice neither wakes the parent nor changes its derived
695
+ status; the next model request includes it. Completion still wakes the parent,
696
+ with the original context, factual child/task status, and child result. Receipt
697
+ identity remains durable and idempotent across resume/reconciliation. Ordinary
698
+ model delegation keeps its existing receipt behavior.
699
+
700
+ ### Sidebar status indicators
701
+
702
+ Session and task indicators use query-matched `@yaks/render` registrations, in
703
+ the theme's tones: `●` positive = completed task / settled session; `●` active =
704
+ active work; `◐` active = task still claimed by a settled worker; `○` info =
705
+ open; `●` negative = failed session / unfinished task whose worker failed.
706
+ Stopped sessions and cancelled tasks use a muted open circle. A stopped or
707
+ unknown/missing task worker uses a muted half-circle rather than claiming the
708
+ work is active or complete. Completed tasks outrank their worker's state. The
709
+ task panel joins already-read session state only for rendering; nothing is
710
+ persisted twice. Completed tasks still follow the existing open-task filtering.
711
+
712
+ <a id="subagent-git-homes"></a>
713
+
714
+ ### Session workspaces
715
+
716
+ A session carries `home{workspace, cwd}`, a default target for file-and-command
717
+ tools, not the session's location or permissions. `machine{address}` records an
718
+ actual computer; directories and sandboxes are separate workspace records.
719
+
720
+ The local `yak session new` command selects the checkout containing its launch
721
+ directory by default. Its `workspace.root` is the checkout root and `home.cwd`
722
+ is the launch directory. An explicit `--workspace` wins over that default.
723
+ Remote graph-only openings do not select the server directory.
724
+
725
+ A selected workspace admits its instruction files at opening. With no checkout
726
+ or explicit workspace selected, the first file or command call of a session
727
+ holding a task gets a worktree of its own, cut as a spawned run's is from the
728
+ checkout @yaks/spawn's config names (`cwd`, under `worktrees`); a session
729
+ started on a comment works in one. Any other session's first such call requests
730
+ a sandbox intention using the host's configured default adapter. Provisioning is
731
+ the sandbox effect's work, not a local directory provider. Missing configuration
732
+ refuses rather than borrowing the host's disk. A pending sandbox has no files to
733
+ admit.
734
+
735
+ Prompt children and forks share the parent's workspace unless given `workspace`
736
+ or a separate `sandbox: {provider?, from?, image?}` request. Task children
737
+ request a separate sandbox by default. An explicit `workspace` selects existing
738
+ files; `from` is provenance for initial sandbox creation, not a backup of later
739
+ edits.
740
+
741
+ Changing `home.workspace` neither moves files nor stops commands. Each process
742
+ keeps its original launch workspace for recovery. Stopping a session or
743
+ finishing a task does not dispose its workspace. Sandbox disposal is explicit.
744
+
745
+ See [workspace tools](../machine/README.md#workspace-tools-and-session-defaults)
746
+ and [sandbox lifecycle](../sandbox/README.md).
747
+
748
+ ### Who sent an input, and when
749
+
750
+ The native runner renders each timed input as
751
+ `[From <sender>; sent <UTC time>; previous reply ended <UTC time>]` followed by
752
+ its unchanged prose, so a session knows who it is talking to. The sender comes
753
+ from the input's `created{by, via}`: the session it came through when that is
754
+ another session (`S-12 wearing Oracle of topics (N-8)`), else its writer, a
755
+ person or a persona by title and id (`Jeff (U-1)`). A transcript's own inputs
756
+ come through itself, so they are named by their writer. An input whose writer is
757
+ none of those starts `[Sent …`. The second time is the completion of the model
758
+ reply to an earlier input, not its streaming start: a sent time before that end
759
+ means the person may not have read the reply yet. The runner follows
760
+ `output.source` → `ask.through`, so an input sent during a reply has the same
761
+ comparison whether its entry precedes or follows the streamed output entry. Each
762
+ input carries its own comparison, including in a fork or a bounded/anchored
763
+ request.
764
+
765
+ Times come from the input's `created.at` and the completed ask's `updated.at`;
766
+ no clock is guessed for imported history. The first input says `none` for its
767
+ previous reply, a reply without a known completion says `unknown`, and an input
768
+ without a sent time keeps its original prose. Passive notices are not stamped as
769
+ a person's messages. Stored content and UI transcript text stay unchanged.
770
+
771
+ ### Instruction files and prompt history
772
+
773
+ `prompt{scope,source,revision}` on an entry explicitly marks its `content.body`
774
+ as instructions for model requests. Ordinary file reads and tool results never
775
+ gain instruction status. `agent.instruct(session, text, source)` appends local
776
+ instructions; it is an explicit wake-producing operation, not a passive notice.
777
+ OpenAI receives ordered developer messages, including instructions added during
778
+ the conversation.
779
+
780
+ Root sessions record the persona they wear through `@yaks/persona`, along with
781
+ any prompt snapshots their caller supplies: the instruction files of the machine
782
+ their home names. The persona's text and the topic's tree are never among those
783
+ snapshots, since every ask is told both afresh (`wear`, below), and a file that
784
+ is exactly the worn persona's projection is left out with them (@yaks/persona
785
+ `unsaid`). A session any other door writes as data, wearing a persona and
786
+ holding no instructions (browse's chat on a persona writes
787
+ `session{operator, persona}`, `native{}` and its first entry; on a topic,
788
+ `session{operator, persona, topic}`), opens with nothing admitted, on no machine
789
+ unless its home names a workspace, whose instruction files the runner then
790
+ admits before its first turn (./effects.ts). Starting one does not read the CLI
791
+ host's instruction files. Reading a machine file through a tool does not make it
792
+ instructions: the caller must explicitly admit it through the prompt channel.
793
+ Existing `opts.instructions` and `sending.instructions` remain the base
794
+ instruction channel; delegated `instructions` append local guidance rather than
795
+ replacing that base.
796
+
797
+ A host whose transcripts run for weeks lends `wear` instead of opening them with
798
+ a snapshot, as the box does (./local.ts `here`) and the yaks.app Operator does:
799
+ every ask's system prompt is the persona the transcript wears
800
+ (`session.persona`, or that of the session that started it, so a fork or a
801
+ helper wears its parent's), said by @yaks/persona `voice`, and then whatever
802
+ `opts.instructions` adds. One that is the common persona of the session's
803
+ project or checkout is said with each common persona above it, as @yaks/persona
804
+ `wearing` resolves it. `wear.topic` says the tree of the topic the transcript is
805
+ opened on (`session.topic`, @yaks/topic `compile`) after the persona; the box
806
+ sets it, and the Operator compiles its own. `wear.tools` offers each ask exactly
807
+ the tools that persona contains (./worn.ts `offeredTo`); the box sets it, and
808
+ the Operator is lent its tools by its Worker. A transcript that wears nothing
809
+ keeps the instructions its first line chose (a builder's contract). All of it is
810
+ read again for an ask once the prefix the transcript's last ask cached has
811
+ expired at the provider, so an edit to the persona, or to the base it is worn on
812
+ (`persona.base`), reaches the transcript on its first turn after a pause, never
813
+ rewriting a prefix still in the cache (@yaks/session `cachedInstructions`).
814
+ `opts.opens` is what every system prompt the agent composes opens with, ahead of
815
+ the persona; the box opens each with the kinds index of its vocabulary
816
+ (@yaks/vocab `kindsIndex`), as an MCP connection's instructions end with it.
817
+ Instructions a transcript inherited are sent as they were.
818
+ `sending.instructions` records the text each ask was sent. `wear.bases` is where
819
+ those bases are kept when this graph does not keep them; the yaks.app Operator
820
+ wears each space's persona on the platform's, which the directory keeps.
821
+
822
+ Fresh children copy shared prompt snapshots from their parent, and are told the
823
+ persona and topic of the session that started them. Forks copy no files: their
824
+ exact inherited prefix is followed by a local fork-execution note, optional
825
+ child guidance, and the assignment. Fresh children intentionally inherit the
826
+ parent's file snapshots even when assigned a different home; loading instruction
827
+ files from the new directory requires an explicit action. A renamed/deleted
828
+ source doesn't alter history. There are no UI controls for choosing instruction
829
+ files or prompt supersession. Prompt entries have a query-matched transcript
830
+ renderer that shows one clipped line with sequence, scope, and source name.
831
+ Instruction text remains stored and is sent to the provider unchanged; compact
832
+ display does not remove it from context. Fork notes are guidance, not a
833
+ prohibition on useful delegation. Provider cache hits are not guaranteed.
834
+
835
+ #### Prompt history and cache limits
836
+
837
+ `prompt.revision` is the file content SHA-256, not an identity for a full model
838
+ request. Ordered snapshots, the fork boundary and recorded base instructions
839
+ preserve instruction history. There is no aggregate request-prefix identity,
840
+ cache-retention registry, automatic prompt refresh or supersession. Provider
841
+ cached-token counts do not guarantee that a particular prefix remains cached.
842
+
843
+ Task completion receipts use `completed.by`, the author of the completion. Graph
844
+ tools sign writes with their calling session; `@yaks/kernel` fills a missing
845
+ `by` from that actor on the first completion mark. A named completion author is
846
+ preserved, including when recording a completion after the fact. If the
847
+ receiving parent authored the completion, its previously delivered child result
848
+ is not echoed back or used to wake it again. New child responses still arrive.
849
+ Child, other session, and anonymous/external completions retain their normal
850
+ receipts. The author survives restart; marks without `by` are treated as
851
+ external. Removing and recreating a completion mark records the new author;
852
+ editing an existing mark preserves its original author.
853
+
854
+ ### Session tree
855
+
856
+ The selected session is shown with its assignment title and compact ID. `b`
857
+ opens a 20-row browser; `>` and `<` move between pages. `Ctrl+j/k` traverse
858
+ visible sidebar rows, including New session and the browser controls. `Ctrl+h/l`
859
+ focus the transcript/sidebar. Panels expose selectable contributions alongside
860
+ their renderers, so navigation follows the same panel order as rendering.
861
+ `Ctrl+N/P` (also Alt+Down/Up) switch roots on the visible page, skipping
862
+ descendants. The selected row has a subtle background; tree connectors show
863
+ relationships without selection or expansion arrows. `Ctrl+S` reveals settled
864
+ children.
865
+
866
+ Ctrl+h and Ctrl+j require extended keyboard reporting to distinguish them from
867
+ Backspace and Enter. Legacy Backspace/Enter continue editing/submitting; they
868
+ are never reinterpreted as navigation. Ctrl+k is reserved for navigation in the
869
+ harness (the standalone textarea retains its kill-to-end binding). Plain hjkl
870
+ still types; VISUAL mode retains priority.
871
+
872
+ Context usage is last at the bottom; the session browser receives remaining
873
+ height and scrolls.
874
+
875
+ `Alt+a` archives/unarchives only the selected session, never its root. `Alt+z`
876
+ shows archived roots so they can be selected and restored. Archiving writes a
877
+ persistent `archived` component: it neither stops execution nor removes history.
878
+ Archiving a session hides its subtree; descendants receive no additional archive
879
+ marks. Selection and visibility preferences live only in the frontend graph. The
880
+ tree supports both keyboard navigation and mouse row selection.
881
+
882
+ Session titles are read from original local input, excluding inherited fork
883
+ history and instruction/notice entries. This adds transcript reads when graph
884
+ data is refreshed, rather than on each keystroke. The asynchronous frontend data
885
+ adapter and its performance limits are documented in
886
+ [Frontend implementation](FRONTEND.md).
887
+
888
+ ### Provider HTTP connections
889
+
890
+ The native host lends its HTTP providers a shared connection pool. A transport
891
+ failure before response headers retires that pool and retries a replayable
892
+ request once on a fresh pool. Requests already streaming from the retired pool
893
+ can finish; the pool closes when their bodies finish or are cancelled. HTTP
894
+ refusals, caller cancellation and streaming uploads are not replayed. A response
895
+ body failure retires the pool for the next request without replaying output.
896
+ This is transport resilience, not a remedy for an overloaded event loop.
897
+
898
+ ### Defect diagnostics
899
+
900
+ Unexpected failures at the executable boundary (including global errors and
901
+ unhandled rejections), runner steps, effects and frontend
902
+ projections/submissions reach the host's reporter. The tracker keeps their
903
+ stack, recursive cause chain, timestamp, process ID, phase and session when
904
+ known. Exhausted provider transport failures and provider stalls reach the
905
+ reporter even when their messages contain network or timeout wording; internal
906
+ retry attempts do not create reports. Reports include process CPU user/system
907
+ milliseconds and CPU percentage over the stated sample interval. These are
908
+ process-wide counters, not a main-thread profile or a socket queue measurement.
909
+ Expected tool refusals use `refusal{code}`. A transcript's
910
+ `exception{type, value}` keeps what happened in the conversation and does not
911
+ create another defect report.
912
+
913
+ There is no second journal. With no reporter, a record is written to stderr as
914
+ one JSON line. A failed delivery includes the original failure without
915
+ recursively reporting itself. Deliveries drain for at most 250ms at executable
916
+ shutdown.
917
+
918
+ Global handlers observe rather than suppress fatal runtime defaults, restoring
919
+ the terminal on the fatal path. Embedded users of `local()` get runner
920
+ diagnostics; the global hooks belong only to the executable lifetime. Known
921
+ API-key values, Bearer credentials and recognizable OpenAI keys are redacted;
922
+ arbitrary secrets embedded in third-party exception messages cannot be
923
+ exhaustively identified. No environment dumps or transcript snapshots are
924
+ captured. Treat logs as private. This cannot capture SIGKILL, power loss, or
925
+ errors before the executable loads, and OOM may prevent capture. Existing
926
+ model/tool exception entries remain governed by session execution; the reporter
927
+ does not reinterpret ordinary tool results. Transcript entries use `eid` and
928
+ session-local `entry.seq`, not human `entity.num`. Opening a database clears
929
+ historical entry numbers without renumbering tasks or other entities. The SQLite
930
+ allocator retains its pre-migration high-water mark, so old task/other human
931
+ identifiers cannot be reassigned. This storage upgrade is idempotent.
932
+
933
+ Transcript positions are retained per session, including detached item anchors,
934
+ while asynchronous session reads are pending. **Ctrl+End** jumps to the
935
+ transcript end and resumes following; plain End still moves the input cursor.
936
+ Sidebar panels share the available height instead of letting a large session
937
+ tree hide Context usage. Wheel over a panel to scroll its contents; tree
938
+ keyboard selection is automatically revealed. Long tree labels are clipped to
939
+ one row.
940
+
941
+ ### Inspecting large tool results
942
+
943
+ The harness supplies `result_query` for jq inspection and `graph_value_read` and
944
+ `graph_value_search` from `@yaks/blob`, including with custom tool sets. Tool
945
+ results over 16,384 UTF-8 bytes are replaced in model requests by a summary with
946
+ an id, size, shape and preview. The full result remains in the transcript and
947
+ blob-backed storage. This applies equally to shell output, graph tools and
948
+ third-party MCP tools. Programs and connector clients receive complete answers.
949
+ User messages and instruction snapshots are unchanged. Set `outputLimit` on
950
+ `agent()` or `local()` to change the threshold.
951
+
952
+ Read accepts `entity`, `component`, `property`, `start`, `count`, and optional
953
+ `revision`. Search accepts the same address with a literal `query` and bounded
954
+ `limit`. These tools inspect any authorized text property, including `doc.body`,
955
+ not only tool results. They don't open files or grant access through a raw hash.
956
+ See [`@yaks/blob`](../blob/README.md#bounded-text-inspection-for-tools) for
957
+ range units and [`@yaks/context`](../context/README.md#large-tool-results) for
958
+ policy limits.
959
+
960
+ ## Worker runtime
961
+
962
+ The TUI runs the backend in a Web Worker and communicates using `postMessage` by
963
+ default. See [the worker runtime](WORKER.md) for ownership, measurements,
964
+ shutdown behavior, and unresolved subscription/backpressure issues.
965
+
966
+ ## Generated images
967
+
968
+ Native image generation is enabled by default on Responses requests, including
969
+ Codex OAuth, unknown models, and custom endpoints. The server decides support;
970
+ there is no model allowlist or startup capability probe.
971
+
972
+ Set `HARNESS_IMAGES=0` or pass `images: false` to disable it. `HARNESS_IMAGES=1`
973
+ explicitly enables the default behavior. Programmatic image settings override
974
+ the environment. Worker mode uses the same configuration.
975
+
976
+ An unsupported tool can cause the entire request to be rejected. The adapter
977
+ preserves the provider error instead of silently retrying without the tool.
978
+ Current provider errors do not reliably distinguish unsupported image tools from
979
+ other invalid requests, so there is no negative capability cache or speculative
980
+ fallback. Disable images explicitly if your endpoint rejects them.
981
+
982
+ Generated media are `@yaks/blob` artifacts: each is an entity named by its
983
+ bytes' SHA-256, and the bytes are kept in the graph's byte store
984
+ (`h.artifacts`), shared with the graph's `/blob` door. By default this is the
985
+ `images` directory beside the database (`~/.yak/images`), or memory for an
986
+ in-memory graph. The `@yaks/blob` plugin's `store` option chooses another
987
+ backend for both. Keep a file store with database backups.
988
+
989
+ OpenRouter audio and image models use the same store. Set their model row's
990
+ `modalities` to the outputs they produce; the local provider passes that to
991
+ OpenRouter and registers the returned artifact in the graph.
992
+
993
+ Configure it in code with:
994
+
995
+ ```ts ignore
996
+ local({
997
+ h,
998
+ name: 'gpt-4.1',
999
+ images: { tool: { output_format: 'png' }, maxBytes: 33554432 },
1000
+ })
1001
+ ```
1002
+
1003
+ `remote` accepts the same cloneable `images` options; storage callbacks are
1004
+ constructed inside the worker. Custom model implementations own their own
1005
+ artifact storage configuration.
1006
+
1007
+ Images are persisted before their graph references, with content-derived
1008
+ artifact IDs and attachment entries associated with the original ask and
1009
+ session. The transcript shows an artifact label rather than base64. Generated
1010
+ images are replayed as textual artifact references unless explicitly inspected
1011
+ with `image_view`. Optional Kitty graphics display and explicit image inputs are
1012
+ described below. Automatic blob cleanup and an image-editing tool are not
1013
+ implemented.
1014
+
1015
+ For example, with `OPENAI_API_KEY` configured:
1016
+
1017
+ ```sh
1018
+ yak session new --model gpt-4.1 'Generate an image of a small garden'
1019
+ ```
1020
+
1021
+ This is a paid provider operation, not a test command. No live generation is
1022
+ performed merely by enabling the option; the model decides whether to invoke it.
1023
+
1024
+ ### Inline generated images (experimental)
1025
+
1026
+ Set `HARNESS_GRAPHICS=kitty` to display fully visible PNG attachments using the
1027
+ Kitty graphics protocol. This is separate from image-generation enablement. The
1028
+ default remains a text artifact label. Both inline and worker modes resolve
1029
+ registered artifact entities through the configured external image store;
1030
+ neither accepts arbitrary file paths. Reads check the artifact's size and
1031
+ SHA-256 hash. Back up the image directory with the graph database.
1032
+
1033
+ Attachments reserve eight terminal rows. Their bytes load only when the complete
1034
+ rectangle is on screen; partially visible attachments show a label. PNG files
1035
+ above 4 MiB, other image formats, unavailable files, and load failures also
1036
+ retain the label. Scrolling, resizing, and session changes remove old
1037
+ placements. VISUAL mode continues to select the artifact's textual label, not
1038
+ image pixels.
1039
+
1040
+ In tmux, enable `allow-passthrough`; the harness wraps graphics commands when
1041
+ `TMUX` is set. SSH requires no server-side display. This renderer does not
1042
+ negotiate terminal support: only enable it on terminals supporting Kitty
1043
+ graphics. Visual placement in iTerm2 still needs user verification.
1044
+
1045
+ The worker's image read uses a bounded `Uint8Array` postMessage result; it is
1046
+ structured-cloned, not transferred. This copies up to 4 MiB per cache miss. No
1047
+ base64 enters the replicated graph or transcript. The renderer keeps eight
1048
+ images and does not re-upload bytes on each keystroke. Partial clipping,
1049
+ JPEG/WebP display, progress/error indicators, and terminal capability discovery
1050
+ are future work.
1051
+
1052
+ Transcript appends now allocate integer positions transactionally. On first
1053
+ startup after this upgrade, the harness repairs legacy fractional positions in
1054
+ one transaction, preserving entry identities and fork boundaries. This is an
1055
+ O(history) one-time operation; subsequent startups use a migration marker. Do
1056
+ not run an older harness writer concurrently during the upgrade. Normal appends
1057
+ query the latest local entry, not the entire transcript.
1058
+
1059
+ ## Importing, attaching, and inspecting files
1060
+
1061
+ The default tools include:
1062
+
1063
+ - `artifact_import({path})`: exports a file (up to 20 MiB) from the calling
1064
+ session's machine into artifact storage. Relative paths use its command
1065
+ directory; the provider supplies binary bytes within its export root. Later
1066
+ changes to the source file do not change the stored snapshot. Importing does
1067
+ not attach the file or expose its contents to the model.
1068
+ - `artifact_attach({artifact})`: attaches an existing artifact to the current
1069
+ tool-call entry for the user. Images can use the configured terminal renderer;
1070
+ other formats retain a reference label. This does not enable model vision.
1071
+ - `image_view({artifact})`: explicitly supplies a registered PNG, JPEG, or WebP
1072
+ to the model following the inspection result. This requires a vision-capable
1073
+ provider/model. There is no automatic retry with the image removed.
1074
+
1075
+ The tools use the same artifact backend as generated images. Image bytes are
1076
+ verified against the registered hash and size. The graph stores the reference,
1077
+ audience, and inspected revision, not base64. The OpenAI adapter adds an
1078
+ `input_image` user message after the tool results. Only the outgoing provider
1079
+ request contains a data URL. The original tool call/result pair remains intact.
1080
+
1081
+ A replay, including inherited fork history, includes explicitly viewed images
1082
+ again; continuation requests include only inspection results in their new
1083
+ window. User-only attachments never become model image inputs. Changing an
1084
+ artifact reference after inspection fails the revision check instead of sending
1085
+ new bytes under the previously approved revision. Requests are limited to 20 MiB
1086
+ of inspected images. These tools currently inspect signatures rather than fully
1087
+ decoding images; animated GIF, SVG, remote URL import, and video are
1088
+ unsupported. Unknown imported files receive `application/octet-stream`.
1089
+
1090
+ Responses stream by default. Set `HARNESS_STREAM=0` or pass `streaming: false`
1091
+ to disable streaming. See [STREAMING.md](STREAMING.md) for lifecycle and
1092
+ limitations.
1093
+
1094
+ ### Provider web access
1095
+
1096
+ Native OpenAI web search is enabled by default, including OAuth configurations.
1097
+ Supported models can search, open pages, and find text within pages. Disable it
1098
+ with `HARNESS_WEB=0`, or pass `web: false` to `local()` or `remote()`. Explicit
1099
+ programmatic configuration takes precedence over the environment. The worker
1100
+ receives the same configuration. Final response citations appear as source
1101
+ links. This is provider-hosted browsing, not an unrestricted filesystem/network
1102
+ fetch function; provider compatibility errors remain visible.
1103
+
1104
+ Transcript selection is controlled by the frontend graph. The generic TUI
1105
+ `VirtualList` accepts `selected` and `onSelect`; navigation reveals the selected
1106
+ item without measuring the full history. Key routing and help share a binding
1107
+ registry in `keyboard.ts`. Ctrl+U cuts the draft in INSERT/VISUAL, but moves
1108
+ half a page in NORMAL. Tab remains a compatibility focus shortcut.
1109
+
1110
+ ## Runtime inspection
1111
+
1112
+ In NORMAL mode, press `r` to open a runtime panel for the selected session and
1113
+ its direct children. `j`/`k` select a row; `r` or Escape closes it. The panel
1114
+ shows queued, generating, waiting-for-tool, interrupted, and terminal states.
1115
+ Durations are time since the displayed request or last activity, not provider
1116
+ billing time. Only the visible panel updates its clock (once a second); clock
1117
+ updates do not query the backend unless a domain change is pending. Domain
1118
+ notifications are coalesced to at most one read per second while visible.
1119
+
1120
+ - `x` requests cancellation of the selected model request, or cancels a queued
1121
+ session before execution. Cancellation uses `AbortSignal`; a custom model must
1122
+ honor it. It does not terminate independent processes or cancel tasks.
1123
+ - `c` submits an explicit continuation instruction to an idle or interrupted
1124
+ session. It does not resend an interrupted HTTP request. Running and stopped
1125
+ sessions are not resumed through this action.
1126
+
1127
+ The read API is `agent.runtime(session)`; actions use
1128
+ `agent.control(session, 'interrupt' | 'cancel-queued' | 'resume')`. The worker
1129
+ frontend exposes the same operations. Queued cancellation uses a graph
1130
+ precondition, so a stale panel cannot cancel work that has already started.
1131
+ Provider cancellation has no remote completion acknowledgment: the panel reports
1132
+ that cancellation was requested, not that the server stopped billing or that an
1133
+ external operation was undone. Process termination remains the separate,
1134
+ explicit process tool; this panel intentionally does not offer a kill-all
1135
+ action.
1136
+
1137
+ ### Draft recovery
1138
+
1139
+ Draft text, cursor, and message/task mode are restored per session, including
1140
+ unsent new-session text. Recovery stays on the frontend machine, not the backend
1141
+ or model. `Ctrl+U` cuts to the clipboard and saved local copy; `Alt+p` restores
1142
+ that copy. Failed or interrupted submissions restore editable text rather than
1143
+ automatically resending it.
1144
+
1145
+ Local unencrypted recovery files use private permissions under `~/.yak/drafts`.
1146
+ Removed local draft components and cleared profiles keep their previous bytes in
1147
+ that profile's private `.trash` directory, without automatic expiry.
1148
+ `draftVault(directory).trash()` lists snapshots and `restore(id)` restores
1149
+ missing fields without overwriting newer draft edits. Reopen the frontend to
1150
+ load restored values. Acknowledged submissions already live in their session;
1151
+ active drafts and recovery copies never pass through the backend worker. Set
1152
+ `HARNESS_FRONTEND` for a stable named profile and `HARNESS_DRAFT_DIR` to
1153
+ relocate storage. See [frontend state](FRONTEND.md#local-draft-recovery) for
1154
+ isolation, retention, and crash-recovery limits.
1155
+
1156
+ The CLI and terminal frontend do not add a built-in agent description or style
1157
+ instruction. Callers can supply explicit `instructions` and recorded prompt
1158
+ snapshots through `@yaks/context`. Existing sessions retain their recorded
1159
+ request history; no filesystem reload rewrites it.
1160
+
1161
+ ## Transcript loading
1162
+
1163
+ The UI loads a 64-entry window around the bottom or saved entry position, then
1164
+ loads overlapping ranges on navigation. Context usage reads only the newest
1165
+ reported usage fields. Full model history is unchanged. See
1166
+ [WINDOWS.md](WINDOWS.md) for the subscription design, benchmark, and entry-size
1167
+ limits.
1168
+
1169
+ ### Cooperative migration announcements
1170
+
1171
+ The harness checks the SQLite migration control table before installing its
1172
+ application schema. A pending/failed announcement refuses startup. While
1173
+ running, it polls that table once per second. A new announcement or completed
1174
+ generation stops new execution, drains active work, and closes the database;
1175
+ subsequent commands report that a restart is required. It does not automatically
1176
+ restart the worker. `migrationPollMs` can configure the interval in
1177
+ `agent`/`remote` options; `local()` polls on its `clock` option (an @yaks/fp
1178
+ `Clock`, the runtime's by default).
1179
+
1180
+ The harness observes `h.migrations` when storage offers a migration monitor.
1181
+ Migration tooling uses `migrations(driver)` on a dedicated adapter connection.
1182
+ The migrator must allow at least the longest participating polling interval. See
1183
+ [@yaks/sqlite migration announcements](../sqlite/README.md#preannounced-migrations)
1184
+ for failure recovery and timing limitations. In particular, the grace period is
1185
+ not a guarantee that all active callbacks finished.
1186
+
1187
+ This version protects only **explicitly announced migrations**. Existing schema
1188
+ installation when a graph is composed and legacy startup conversions have not
1189
+ been converted to asynchronous preannounced migrations. Do not assume opening a
1190
+ new harness version is coordinated with older running connections. Stop those
1191
+ connections before such upgrades. Already-completed migrations are not a version
1192
+ compatibility check when an older binary first opens the file.
1193
+
1194
+ ## The harness as a plugin module
1195
+
1196
+ A `yak` config lists `@yaks/harness` as one plugin among the packages it runs
1197
+ over, and `@yaks/cli`'s `compose` takes four facets from it: `/vocab`, whose
1198
+ `docs` are the harness's own words (`home` and its tools), `/tools`, the
1199
+ functions behind them, `/effects`, the runner lent this machine, and `/routes`,
1200
+ where it answers another host's model steps. Every other word a harness graph
1201
+ speaks is its own package's plugin. The terminal app's worker composes the graph
1202
+ its command's config names, for the graph role, and lends it the runner itself.
1203
+ Importing the facets does not run a session, open a database, or start a server.
1204
+
1205
+ `session_new` and `session_send` are offered through MCP and the command line.
1206
+ Pass `wait: false` to either tool to return the session immediately; the runner
1207
+ continues independently. For example, `session_new` with
1208
+ `{ "prompt": "Reply with ok", "wait": false }` returns the new session id. What
1209
+ `session_send` says to a session holding one task (or to the `task` it names) is
1210
+ also a comment on that task: for a running outside session the one row is both
1211
+ the knock and the comment, and for a run it starts again the comment is marked
1212
+ said. The task keeps every ask in order, and a run that later starts, resumes or
1213
+ compacts on it reads them all with its brief (@yaks/session `asks.ts`).
1214
+ `model_list` is offered on a command line only (`surfaces`), because it reads
1215
+ that machine's model credentials; `model_pin` is offered on both. `session_list`
1216
+ is offered everywhere. With no arguments it answers the 20 newest live sessions
1217
+ (no `session.ended` mark), each with its status, and, when more match, a last
1218
+ row saying how to read on; `query` and `limit` ask for others (`.session` is
1219
+ every status). A row carries `session`, `created`, `spawned`, `doc` and `exit`;
1220
+ a session's command line and context sizes are kilobytes each, read with
1221
+ `graph_show` or a query naming `*`. Both word orders (`session list`,
1222
+ `list
1223
+ session`) derive from the same noun and verb, without alias declarations.
1224
+ See [the command-line entry point and the export shape](../cli/README.md).
1225
+
1226
+ ### Answering another host's model steps
1227
+
1228
+ A machine can serve its providers to another host
1229
+ ([@yaks/model](../model/README.md#a-provider-served-by-a-machine)). Where the
1230
+ config names providers to `serve`, a process serving `web` takes
1231
+ `@yaks/harness/routes` and answers `POST /model/step` from them, streaming each
1232
+ reply as it arrives:
1233
+
1234
+ ```json
1235
+ { "use": "@yaks/harness", "with": { "serve": ["claude", "openai"] } }
1236
+ ```
1237
+
1238
+ `serve` lists providers by `provider.name`, each one a provider plugin the same
1239
+ config names. Without it there is no route, so listing the harness lends no
1240
+ subscription, and a model only an unlisted provider serves is refused
1241
+ (`provider`). The providers load at the first step. The route does not say who
1242
+ may ask: the machine opens the path to the other host as it opens any other, for
1243
+ example in [@yaks/tunnel](../tunnel/README.md)'s `routes`.
1244
+
1245
+ Mouse clicks select session rows, **New session**, and browser controls.
1246
+ Clicking a row focuses the sidebar without changing the current mode or
1247
+ submitting the draft. In INSERT mode, typing continues in the composer. The
1248
+ whole painted row, including its trailing background, is clickable. Mouse
1249
+ reporting must reach the application through the terminal/multiplexer.
1250
+
1251
+ ### Transcript previews
1252
+
1253
+ Shell calls show the command from their arguments. Tool results remain literal
1254
+ and dim, with previews limited to five displayed rows (and 2,000 source code
1255
+ points). Truncated previews are labeled; stored text and provider context are
1256
+ unchanged. Explicit source selection and graph-value inspection still use the
1257
+ full text. User input is rendered as normal-brightness Markdown inside its
1258
+ dim-bordered box.
1259
+
1260
+ ## Remote MCP tools
1261
+
1262
+ Optional MCP server configuration is shared by sessions and connects through
1263
+ `@yaks/mcp-client`. No servers are enabled implicitly.
1264
+
1265
+ MCP server definitions live in the harness graph, shared by all sessions. Add a
1266
+ server with `graph_apply` (or ask an agent to add it):
1267
+
1268
+ ```json
1269
+ [
1270
+ {
1271
+ "entity": { "eid": "$server" },
1272
+ "mcp_server": { "name": "yaks.app", "url": "https://yaks.app/mcp" }
1273
+ }
1274
+ ]
1275
+ ```
1276
+
1277
+ Press **Esc**, **A** to authorize the server, or run
1278
+ `yak connection authorize <server>` on the command line. Server rows persist
1279
+ across restarts; configuration changes take effect on the next model request,
1280
+ without restarting. The panel identifies each server by display name and EID and
1281
+ reports invalid definitions. Query `.mcp_server` to list them. Set
1282
+ `mcp_server.enabled` to `false` to disable a server, patch its URL or options to
1283
+ edit it, or remove its `mcp_server` component to remove it. The `$server` alias
1284
+ in the write above asks the graph to generate a UUID; use the returned EID for
1285
+ later edits. The server name supplies a readable tool namespace: `yaks.app`
1286
+ exposes `app_list` as `yaks_app__app_list`. Renaming changes future exposed
1287
+ names, not the server entity or its OAuth credentials. Distinct configuration
1288
+ revisions have derived UUID tool entities, so changing an endpoint cannot
1289
+ retarget already-issued calls even when their exposed names are identical. Names
1290
+ that normalize to the same namespace are rejected. Remote names are passed
1291
+ unchanged to `tools/call`; names that cannot fit the provider's 64-character
1292
+ alphanumeric/underscore/hyphen format are reported rather than hashed.
1293
+
1294
+ Optional fields are `allow` (a JSON-encoded array of exact remote tool names),
1295
+ and `redirect_url`, `client_id`, `client_metadata_url`, `scope` for OAuth
1296
+ settings. Omitting `allow` exposes all discovered tools; `"[]"` exposes none.
1297
+ The graph's current vocabulary stores this list as JSON text. Token values,
1298
+ callback codes, and verifiers never belong in these fields. A sign-in is a
1299
+ connection the server entity owns; changing the endpoint signs in anew, and
1300
+ renaming a server does not invalidate its sign-in.
1301
+
1302
+ A server is signed in to only through its connection (below), independent of
1303
+ model-provider credentials. No other agent's configuration is discovered
1304
+ automatically.
1305
+
1306
+ Disabled/removed/reconfigured servers disappear from subsequent model requests.
1307
+ Handlers already offered to a request keep their original connection so their
1308
+ results can still be delivered. Retired connections close when the harness
1309
+ drains and shuts down; repeated edits can therefore retain transports until
1310
+ shutdown. Invalid or unavailable optional servers do not block other servers or
1311
+ ordinary chat; open the authorization panel to inspect their errors. Treat
1312
+ descriptions/results as data, not instruction files.
1313
+
1314
+ The backend worker owns these connections; sessions share configuration, not new
1315
+ connection definitions. Discovery occurs at execution boundaries, never while
1316
+ typing. List-change notifications affect later tool snapshots, not requests
1317
+ already dispatched. Remote tools use deterministic namespaced names;
1318
+ descriptions and metadata identify their source. The existing session executor
1319
+ writes normal call/result entries—there is no second MCP executor.
1320
+
1321
+ Text and structured output use ordinary transcript storage and large-output
1322
+ references. Image/audio/embedded binary resource blocks are stored through
1323
+ external blob storage and attached as artifact references; they are not
1324
+ automatically sent back as model vision inputs. Binary blocks are limited to 20
1325
+ MiB each. Transport failures and `isError` tool replies are expected tool
1326
+ errors, not silent success. The client never automatically retries a remote
1327
+ mutation. Re-sign in and restart after an authentication/connection failure.
1328
+
1329
+ This integration is tools-only Streamable HTTP. It does not implement stdio or
1330
+ resources/prompts selection. Browser OAuth and reconnect after sign-in are
1331
+ described below; failed tool mutations are not automatically retried. The local
1332
+ mock publish flow is tested; no public mockup is published during tests.
1333
+
1334
+ In-flight tool handlers are retained locally when a later discovery snapshot
1335
+ changes; a server withdrawing a tool does not silently substitute a different
1336
+ handler for an already-issued call. This is not durable remote capability
1337
+ versioning: after restart, removed tools cannot be reconstructed from their old
1338
+ schema alone. The server remains responsible for validating current invocation
1339
+ arguments and permissions. The retained handler map is process-lifetime state.
1340
+
1341
+ ### Transcript cursor and source detail
1342
+
1343
+ In NORMAL, `hjkl` moves a block cursor over the rendered transcript. The entry
1344
+ containing the cursor retains a subtle background. `v` extends an in-place text
1345
+ selection, `y` copies it, and Escape cancels it; Markdown stays rendered
1346
+ throughout. `i` returns to the composer and hides the transcript
1347
+ cursor/highlight. Use `Ctrl+w h` / `Ctrl+w l` to focus transcript/sidebar; Tab
1348
+ remains an alias. Sidebar `j/k` still selects its rows. Half/full-page and
1349
+ `gg/G` navigation remain.
1350
+
1351
+ Enter explicitly opens the current entry's source, including compact prompts and
1352
+ clipped tool output, in a bounded detail panel. `j/k` scroll the chunk, `[` /
1353
+ `]` fetch adjacent chunks, and Escape returns to the transcript. Source reads
1354
+ are authorized through the session's fork ancestry and revision-checked, with at
1355
+ most 4,096 Unicode code points per read. This does not restore transcript
1356
+ search. A source change while paging requires closing and reopening the detail.
1357
+
1358
+ Rendered copies omit box/table borders and generated padding and join ordinary
1359
+ soft wraps. They are bounded to retained measured entries and 65,536 UTF-16
1360
+ units; a larger or evicted range reports an error instead of silently copying
1361
+ less. Viewport reflow retains the entry identity and clamps row/column, rather
1362
+ than promising stable character identity through arbitrary live Markdown
1363
+ changes. The composer keeps its existing explicit source-text selection
1364
+ behavior.
1365
+
1366
+ ### Sign in to an MCP server
1367
+
1368
+ Add an `mcp_server` entity as above, then press **Esc**, **A** in the TUI or run
1369
+ `yak auth` to list it and sign in on the command line. In the TUI, choose a
1370
+ server with j/k and Enter. On the command line, pass its listed title or graph
1371
+ alias to `yak auth`. `yak connection authorize` uses the same path. Open the
1372
+ displayed authorization link in your browser. After approval, copy the complete
1373
+ return URL from the address bar and paste it into the authorization panel or
1374
+ command prompt. The return URL is masked and never sent to the model or a
1375
+ transcript. A refused paste can be retried while the attempt is open. Esc
1376
+ cancels in the TUI; Ctrl+C cancels the command prompt.
1377
+
1378
+ The default callback is `http://localhost:8765/oauth/callback`. No listener is
1379
+ started, so a browser connection error at that address is expected; copy the
1380
+ address bar anyway. If a server requires pre-registration, add the `client_id`
1381
+ and `redirect_url` fields to its `mcp_server` component, with `scope` or
1382
+ `client_metadata_url` when required. The callback must match the registered
1383
+ redirect. Browser and provider policies can restrict this copy-address-bar
1384
+ workflow.
1385
+
1386
+ A sign-in is a connection ([@yaks/connections](../connections)) the server
1387
+ entity owns, through an integration discovered from the server
1388
+ (`@yaks/mcp-client/oauth`) that also keeps the client registered there. The
1389
+ graph holds the connection's handle, and the vault beside the database
1390
+ (`~/.yak/secrets`, private files) holds the tokens. Pending logins do not
1391
+ survive restart. Successful OAuth connects the shared server and makes its tools
1392
+ available on the next model request. Unauthorized optional servers are omitted
1393
+ until signed in; other discovery failures remain errors. Tokens refresh through
1394
+ the connection, not a model tool.
1395
+
1396
+ A program embedding the harness can call `authorizeMCP` on the agent, passing an
1397
+ action — `'list'`, `'begin'`, `'complete'` or `'cancel'` — and optionally a
1398
+ server name and a return URL. These calls are controls for the embedding
1399
+ program, not agent instructions. Never paste a return URL into the ordinary
1400
+ conversation input.
1401
+
1402
+ ## Anthropic
1403
+
1404
+ `anthropic` is Claude through the Messages API
1405
+ ([@yaks/anthropic](../anthropic)), on a key the person pastes with
1406
+ `yak auth anthropic`; the key is a connection like OpenRouter's, in the vault.
1407
+ Name a model as data, a provider and model row with a `serves` edge as below
1408
+ (`claude-sonnet-5-5`, `claude-opus-5-5`), or
1409
+ `spawn({prompt, model: 'claude-opus-5-5'})` from a session already on Anthropic.
1410
+ Without a connection a request is refused with "Anthropic is not connected".
1411
+
1412
+ ## OpenRouter
1413
+
1414
+ OpenAI remains the default. OpenRouter is a separate provider, selected through
1415
+ ordinary graph model configuration, with its own credentials. Add configuration
1416
+ (the `$` names create entities in this write):
1417
+
1418
+ ```json
1419
+ [
1420
+ { "entity": { "eid": "$router" }, "provider": { "name": "openrouter" } },
1421
+ { "entity": { "eid": "$model" }, "model": { "name": "claude-sonnet-4" } },
1422
+ {
1423
+ "entity": { "eid": "$offer" },
1424
+ "edge": { "from": "$router", "to": "$model" },
1425
+ "serves": { "name": "anthropic/claude-sonnet-4" }
1426
+ }
1427
+ ]
1428
+ ```
1429
+
1430
+ A provider and a model are each their name: the ids are derived from it, so
1431
+ writing this twice writes it once. The `serves` edge is the provider's offering
1432
+ of the model, and its `name` is what OpenRouter calls the model — what every
1433
+ request it serves asks for.
1434
+
1435
+ Choose a model identifier available to your OpenRouter account. Then press
1436
+ **Esc, A**, select **OpenRouter**, open the authorization URL, and paste the
1437
+ full return URL into the private authorization input. No callback listener runs:
1438
+ a browser connection-error page is expected; copy its address bar. The API key
1439
+ is kept as a connection the provider owns ([@yaks/connections](../connections)):
1440
+ its secret is in the vault, never in the graph, transcript, or draft. This is a
1441
+ separate account from MCP servers and OpenAI; existing credentials are never
1442
+ borrowed. No model request is sent merely by configuring or authorizing the
1443
+ provider.
1444
+
1445
+ To select that model for a session, append an entry containing `using` with the
1446
+ returned provider/model EIDs. This selects the next request intentionally:
1447
+
1448
+ ```json
1449
+ {
1450
+ "entity": { "eid": "$message" },
1451
+ "entry": { "session": "<session UUID>" },
1452
+ "using": { "provider": "<provider UUID>", "model": "<model UUID>" },
1453
+ "content": { "body": "Continue using the selected OpenRouter model." }
1454
+ }
1455
+ ```
1456
+
1457
+ An existing model entity ID (EID) can also be passed to `fork` or `spawn`. The
1458
+ parent's provider stays while it serves that model; otherwise the one provider
1459
+ this harness can reach that serves it answers, and a model two reachable
1460
+ providers serve needs the provider named in `using`. The command
1461
+ `yak session new 'message' --provider openrouter --model vendor/model` creates a
1462
+ new session under that provider; authorize beforehand in the TUI or with
1463
+ `yak auth openrouter`. Embedding applications can use
1464
+ `local({provider: 'openrouter', name: 'vendor/model'})`; configuration is
1465
+ recorded in the graph. Tests can inject `providers: {openrouter: fakeModel}`.
1466
+
1467
+ OpenRouter Responses is stateless: full applicable context is sent on every
1468
+ request, including forks. Provider/model switches don't reuse another model's
1469
+ stored response ID for continuation. Native OpenAI image generation and web
1470
+ search are omitted; regular function tools and explicit image inputs remain
1471
+ model-dependent.
1472
+
1473
+ The model selector below lists configured models; it does not fetch the
1474
+ OpenRouter catalog or expose OpenRouter provider-routing options. The shared
1475
+ graph `provider`/`model` records are the configuration source. Credential files
1476
+ are private plaintext, not encrypted; PKCE completion has been tested against
1477
+ mocks, not a live account.
1478
+
1479
+ ### Choosing a model in the TUI
1480
+
1481
+ Press **Esc, m** to open the model selector. It lists every offering in the
1482
+ graph — each `serves` edge, shown as model and provider. Use **j/k** or arrows
1483
+ and **Enter**, or click a row. **Esc** cancels without changing the draft. The
1484
+ choice records both the model and the provider that serves it.
1485
+
1486
+ A session another harness ran until now (a Claude Code, Codex, Grok or
1487
+ Antigravity transcript read into the graph) is taken over in place: the choice
1488
+ line also carries a note telling the model where the conversation ran, that the
1489
+ tool calls in it were that harness's, and which files it worked on
1490
+ (@yaks/session `handoffOf`), and the next message asks the chosen model with the
1491
+ whole conversation. From a shell,
1492
+ `yak session send S-<n> '<text>' --provider <p>
1493
+ --model <m>` does the same, even
1494
+ while that harness's process is still open: a send naming a model this graph
1495
+ asks is never a knock.
1496
+
1497
+ With **New session** selected, the choice applies when that draft is submitted;
1498
+ it does not change the harness default or another session. For an existing
1499
+ session, the choice appends a passive `notice` + `using` configuration entry. It
1500
+ does not send an invented chat message or start a model request. The
1501
+ `Model (next)` label shows the choice for future requests; any request already
1502
+ running keeps its original model. Historical request configuration remains
1503
+ unchanged. Forks inherit the effective configuration.
1504
+
1505
+ The selector reads the configured catalog when opened; it does not fetch a
1506
+ provider's model catalog or prices. Authorize the provider with **A** first.
1507
+ Selection itself neither performs authentication nor contacts the model; an
1508
+ unauthorized request reports the provider error rather than falling back to a
1509
+ different provider. This is a local selection UI, not automatic model routing.
1510
+
1511
+ ## Human conversations over MCP
1512
+
1513
+ `conversation_projects` returns the owner and active projects. The MCP-only
1514
+ `conversation_start({project,prompt})` and
1515
+ `conversation_send({project,session,text})` acknowledge persisted input without
1516
+ waiting for the model. The ordinary native runner serves the transcript. Start
1517
+ snapshots the project's lineage persona, goals, recent work and up to 24 recent
1518
+ human inputs across project-linked doors, separately from the exact first input.
1519
+ No caller-supplied actor, machine or model is accepted.
1520
+
1521
+ `conversation_read({project,session,limit?,before?})` returns a chronological
1522
+ page of visible user/assistant messages, status, and `nextBefore` for older
1523
+ entries. Poll the current tail to receive same-id text revisions; preserve older
1524
+ loaded pages. With `lines` it returns every line instead, tool calls and results
1525
+ included (snapshots only with `context`), paged back from `beforeLine` with
1526
+ `earlier{count, before}`, through every conversation a fork goes on from. Its
1527
+ `session` may be a conversation, a helper or fork under one, a task, or any line
1528
+ of one: the owner reads a session when they talk in it or in one above it, and a
1529
+ task, read whole with its comments and conversations, when they may read one of
1530
+ those. `conversation_recent({project,limit?})` reopens owned project sessions,
1531
+ newest first: operator sessions holding the owner's words that work for the
1532
+ project by filing, by `session.actor` or by the persona they wear.
1533
+ `conversation_inbox({limit?})` uses the shared inbox reader for that owner.
1534
+
1535
+ Another host answers the same tools over its own store by giving
1536
+ `conversations(host)` what it makes of a conversation (`Conversing`,
1537
+ `@yaks/harness/conversations`): who a call speaks for (`owner`), the project it
1538
+ talks in (`project`), what the owner may read (`reads`), the words as it takes
1539
+ them with the rows it writes beside them (`given`), and how a conversation
1540
+ begins (`start`). yaks.app gives a space's Operator: the person its door vouched
1541
+ for, in the space, reading what is theirs (anything, for the platform's admin),
1542
+ with the model it chooses and the files that are theirs, and a fork of their own
1543
+ conversation under a private task.
1544
+
1545
+ These tools require an authenticated human principal. An owner-only box that
1546
+ already trusts its network perimeter may resolve only its **exact host process**
1547
+ fallback identity through the server's configured `person`. That setting is not
1548
+ OAuth subject mapping: public deployments still need the existing owner-only
1549
+ Access policy, and tailnet access remains trusted.
1550
+ Agent/anonymous/foreign-process calls cannot use this fallback. A multi-user or
1551
+ unprotected deployment must supply real request authentication, not rely on
1552
+ `person`.
1553
+
1554
+ ### Model metadata discovery and transient failures
1555
+
1556
+ A native turn does not refresh the model catalog merely because its model has no
1557
+ price. OpenAI's catalog has no pricing, so that condition would otherwise list
1558
+ `/models` before every request. Unconfirmed models may need discovery; the
1559
+ runner shares that in-flight request across resumed sessions and retains
1560
+ metadata (including an empty result) for five minutes. Providers with a
1561
+ per-model metadata API can use that instead of a full catalog listing.
1562
+
1563
+ The OpenAI listing retries transient HTTP errors and dropped connections at the
1564
+ provider fetch boundary, honoring `Retry-After` before another attempt. If
1565
+ metadata discovery still fails transiently, the ask continues without that
1566
+ optional enrichment and discovery cools down for at least a minute. The harness
1567
+ reports the exhausted failure through its reporter with phase `model-metadata`
1568
+ (the native host wires this to the tracker). Successful recovery within the
1569
+ provider's retry budget is not a terminal session failure. Previously a listing
1570
+ 429 became a terminal `ModelError`, which the session treated as a provider
1571
+ refusal and did **not** send to the defect reporter.