@markusylisiurunen/tau 0.3.102 → 0.3.103

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 (50) hide show
  1. package/README.md +18 -23
  2. package/dist/core/history/migrations.js +40 -0
  3. package/dist/core/history/migrations.js.map +1 -1
  4. package/dist/core/history/setup.js +24 -7
  5. package/dist/core/history/setup.js.map +1 -1
  6. package/dist/core/mcp/cli.js +1 -1
  7. package/dist/core/mcp/cli.js.map +1 -1
  8. package/dist/core/static/tau_docs/client-tools.md +46 -385
  9. package/dist/core/static/tau_docs/code-mode.md +104 -43
  10. package/dist/core/static/tau_docs/configuration.md +77 -171
  11. package/dist/core/static/tau_docs/getting-started.md +25 -96
  12. package/dist/core/static/tau_docs/history.md +30 -228
  13. package/dist/core/static/tau_docs/how-tau-works.md +53 -0
  14. package/dist/core/static/tau_docs/image-generation.md +15 -107
  15. package/dist/core/static/tau_docs/index.md +46 -46
  16. package/dist/core/static/tau_docs/instructions-and-skills.md +81 -0
  17. package/dist/core/static/tau_docs/manifest.json +15 -21
  18. package/dist/core/static/tau_docs/mcp.md +77 -0
  19. package/dist/core/static/tau_docs/models-and-credentials.md +67 -0
  20. package/dist/core/static/tau_docs/openrouter.md +31 -129
  21. package/dist/core/static/tau_docs/pdf-unpacking.md +8 -21
  22. package/dist/core/static/tau_docs/personas.md +48 -144
  23. package/dist/core/static/tau_docs/remote-sessions.md +33 -170
  24. package/dist/core/static/tau_docs/sdk.md +150 -0
  25. package/dist/core/static/tau_docs/security.md +6 -193
  26. package/dist/core/static/tau_docs/session-protocol.md +84 -246
  27. package/dist/core/static/tau_docs/sessions.md +41 -205
  28. package/dist/core/static/tau_docs/speech-generation.md +16 -129
  29. package/dist/core/static/tau_docs/subagents.md +57 -229
  30. package/dist/core/static/tau_docs/telegram.md +152 -192
  31. package/dist/core/static/tau_docs/tools.md +44 -167
  32. package/dist/core/static/tau_docs/troubleshooting.md +23 -217
  33. package/dist/core/static/tau_docs/tui.md +42 -282
  34. package/dist/core/version.js +1 -1
  35. package/dist/history/worker/index.js +16 -22
  36. package/dist/history/worker/index.js.map +1 -1
  37. package/dist/history/worker/migrations/0005_external_content.sql +58 -0
  38. package/dist/history/worker/migrations/0006_external_content_cutover.sql +44 -0
  39. package/package.json +2 -2
  40. package/dist/core/static/tau_docs/config-reference.md +0 -367
  41. package/dist/core/static/tau_docs/credentials.md +0 -165
  42. package/dist/core/static/tau_docs/models.md +0 -57
  43. package/dist/core/static/tau_docs/node-sdk.md +0 -430
  44. package/dist/core/static/tau_docs/ownership-and-scope.md +0 -107
  45. package/dist/core/static/tau_docs/prompts-and-project-context.md +0 -147
  46. package/dist/core/static/tau_docs/sdk-diff-review.md +0 -92
  47. package/dist/core/static/tau_docs/session-protocol-methods.md +0 -655
  48. package/dist/core/static/tau_docs/skills.md +0 -135
  49. package/dist/core/static/tau_docs/telegram-commands.md +0 -55
  50. package/dist/core/static/tau_docs/telegram-projects.md +0 -197
@@ -1,246 +1,82 @@
1
1
  # Sessions
2
2
 
3
- A Tau session holds one conversation and the execution environment it works in. It saves enough state to continue after you detach or the host restarts. Short-lived client and process state is not saved. This page explains what is kept, so interruption, recovery, compaction, and remote work behave as you expect.
3
+ A session is one conversation and the execution environment it works in. The host saves it as it goes, so it can continue after you detach or the host restarts.
4
4
 
5
- ## Create a session
5
+ ## Turns
6
6
 
7
- Running `tau` creates a new local session whose working directory is the current directory. Before the first turn, the host loads [configuration](configuration.md), models, [personas](personas.md), [skills](skills.md), prompts, and project context from that execution environment.
7
+ A submitted message is saved before model work starts. Only one turn runs at a time. Further input is either queued as a new turn or steers the running one at its next safe point. A turn keeps its model, tools, and settings until it ends, so reasoning changes and reloads apply from the next turn. Pending input is shared by attached clients and is lost if the host restarts.
8
8
 
9
- A session also gets creation attributes, which never change. They are short string pairs that record where the session came from and are used by [history](history.md). They are not settings. Common attributes are:
9
+ Interrupting stops the running turn, but subagents keep running. Retry continues from the current history without repeating the last message, so completed tools do not run again.
10
10
 
11
- - `source`: the client that created the session, such as `tui` or `sdk`.
12
- - `repository`: a normalized `host/owner/repository` value. Composite workspaces use a comma-separated list.
13
- - `machine`: the hostname of the execution environment, which may differ from the machine that runs the client or host.
14
- - `cwd`: the session's working directory in that execution environment.
11
+ Exiting a local TUI shuts down its host and interrupts running work. Detaching from `tau serve` leaves work running.
15
12
 
16
- Tau sets `machine` and `cwd` on every new session and replaces any values the client sends for those two keys. Recovering a saved session keeps its attributes unchanged, so older saved sessions may lack these two attributes.
13
+ ## Compaction
17
14
 
18
- Clients set all other attributes. A local TUI can fill in `repository` before creating the session, because it manages the local execution environment directly. A remote host never inspects a path to work out `repository`. The remote TUI sends `source: "tui"`. SDK and protocol clients should send the other attributes they need themselves.
15
+ Compaction replaces what the model sees with a summary that the model writes, so a session can continue past the context window. Searchable [history](history.md) keeps the original entries. Summaries lose detail over time.
19
16
 
20
- A session's execution environment and working directory are fixed when it is created. `/new` creates another session in the same environment, with the current persona and reasoning settings. The existing session is kept, unchanged.
17
+ **Automatic compaction** runs when context exceeds a threshold, and Tau keeps recent messages (up to 20,000 estimated tokens). The threshold is the first of these that is set:
21
18
 
22
- ## Know what owns the session
19
+ 1. the session override, set with `/auto-compact 50k`
20
+ 2. a Telegram bot's `autoCompactThresholdTokens`
21
+ 3. the persona's `autoCompactThresholdTokens`
22
+ 4. the model's context window minus 16,384 tokens
23
23
 
24
- Three parts can run on one machine but stay separate:
24
+ The minimum is 50,000 tokens, and the last value is also the maximum. Applying a persona clears the session override. A lower threshold can reduce the cost of later requests, but each summary also costs tokens.
25
25
 
26
- - The TUI or SDK client sends input, receives updates, and may offer client tools.
27
- - The session host runs turns, resolves credentials, saves sessions, and manages execution environments.
28
- - The execution environment holds the agent's working directory, files, repository, project configuration, commands, platform, and tools.
26
+ Before an automatic compaction, Tau tries to save the old context to an archive in the execution environment's temporary directory and tells the agent where it is. The files are temporary and can be removed by system cleanup.
29
27
 
30
- The host saves sessions under `~/.config/tau/sessions` in the host user's home. These are versioned files that Tau manages. Never edit them directly. Use Tau's session operations, project configuration, and recovery instead.
31
-
32
- [Background Bash jobs](tools.md#bash) and [background code jobs](code-mode.md#background-code-jobs) belong to the agent that started them, and other agents in the session cannot see them. They survive turns, interruption, and clients detaching. A running job keeps a session loaded even when no client is attached, and does not block new turns. Every agent's jobs stop when the session is closed normally or the host shuts down, and are not restored after a restart. Cleanup after a crash or forced kill is not guaranteed.
33
-
34
- ## Submit, queue, and steer
35
-
36
- A submitted message is accepted and saved before any model work starts. Tau then runs model calls and tool calls until the turn completes, fails, is blocked, or is interrupted. The model decides when its response is complete, and Tau does not start another turn by itself after a final response. Automatic compaction can continue an unfinished turn in a new context window.
37
-
38
- Only one turn runs at a time. While work is running, there are two ways to send more input:
39
-
40
- - A queued message waits until the session is idle, then starts its own turn.
41
- - Steering joins the running turn at the next safe point.
42
-
43
- In the TUI, Enter steers and Ctrl+Enter queues while work is running. When idle, both start a normal turn. Pending messages are visible to every client attached to the same live session. Alt+Up cancels queued messages and steering that has not been applied yet, and puts the text back in the editor.
44
-
45
- A turn fixes its model, persona, reasoning, system prompt, tools, retry policy, and compaction policy when it starts. Tool calls and steering within the turn keep these, even if reasoning or host configuration changes meanwhile. A queued turn uses the settings current when it actually starts.
46
-
47
- Queued and steering messages survive a client detaching only while the session stays loaded on the host. They are not saved and are empty after a host restart.
48
-
49
- ## Interrupt and retry
50
-
51
- Interruption asks work to stop. It cancels the main session's running turn, direct commands, standalone model calls, and maintenance work. An interrupted turn records an interrupted assistant result where there is one. Interruption does not stop subagents: select one with Alt+Down and press Ctrl+G to stop it without its children, or call `session.interruptSubagent` from a protocol client. Host shutdown or session disposal stops subagents. In the TUI, Escape first stops local work such as diff review, recording, or speech playback, and only then asks the host to interrupt the session.
52
-
53
- Retry runs another assistant turn from the current history. It does not remove the interrupted or failed result, rewind context, or send the previous user text again. Tau can therefore continue from completed tool results without running those tools again. In the TUI, press Enter twice on an empty editor while idle.
54
-
55
- Retry is unavailable when there is no earlier user turn.
56
-
57
- Detaching is not interrupting. Closing one client of a long-running host leaves the turn running. A local TUI, however, owns its in-process host, so closing it shuts that host down and interrupts running work. See [remote sessions](remote-sessions.md).
58
-
59
- ## Change persona and reasoning
60
-
61
- The persona and reasoning level are saved session settings.
62
-
63
- A persona change requires an idle session, because it rebuilds the model, system instructions, skills, and tools from the execution environment's current configuration. In the TUI, use `/persona:<id>` or Ctrl+P.
64
-
65
- Reasoning can change while work is running. The running turn keeps its reasoning, and the next turn uses the new setting. In the TUI, use Shift+Tab.
66
-
67
- After a host restart, recovery loads the current configuration so providers and models work, then reapplies the session's saved persona and reasoning where possible. The result can differ from before if the installation or model catalog has changed. The saved conversation stays the same.
68
-
69
- ## Detach, reattach, and recover
70
-
71
- A session is saved throughout its life, not only when the TUI exits. Reattaching to a running host returns the current state and continues with live updates. Reattaching after a host restart loads the saved session and reconnects its execution environment, using the host's configuration for that environment type.
72
-
73
- After the last client detaches, the host unloads the session from memory once its work has finished. The session stays saved, but its subagents are gone. Protocol and SDK clients can keep an unattached session and its idle subagents loaded for a limited time with [retention](session-protocol.md#keep-a-session-loaded-without-clients).
74
-
75
- Recovery keeps:
76
-
77
- - the conversation messages and finished tool results
78
- - the persona and reasoning settings
79
- - the total cost so far, and the context accounting needed to continue
80
- - the execution environment, working directory, and creation attributes
81
- - the results of compaction and rewind
82
-
83
- Recovery does not restart live processes. The session comes back idle. A turn that was accepted but not finished is recorded as aborted, running maintenance is cancelled, and tools whose outcome is unknown are marked as such. Subagents and their activity do not survive a restart.
84
-
85
- The host lists or recovers a saved session only if it can reconnect that session's execution environment type and target. Recovery can therefore fail for a valid session, for example when a Fly Sprite connection is no longer configured, or when the Sprite, directory, or credentials are no longer available.
86
-
87
- Newer Tau versions can open saved sessions from supported older versions. The conversation and other important data stay available, but the files may be rewritten and old content may display differently. Tau rejects corrupted sessions, and sessions saved by a newer Tau version that it does not support.
88
-
89
- ## Compact model context
90
-
91
- Compaction replaces the conversation the model sees with a summary, called a checkpoint, so the session can continue within the model's context window. It changes only what the model sees. Searchable history is not affected.
92
-
93
- The session's model writes the checkpoint from its own view of the conversation, including the base instructions, any earlier checkpoint, and reasoning state where the provider supports it. The checkpoint covers the whole context and does not depend on which recent messages will be kept. It is written in a separate maintenance request that runs no tools and is not a user turn. How much reasoning carries over depends on the provider. The checkpoint records useful conclusions and their reasons instead of reproducing the model's internal thinking.
94
-
95
- The summary aims both to let work continue right away and to keep earlier work recognizable. Recent and unfinished work gets the most detail. Older work is reduced to its purpose, results, and important decisions. Across repeated compactions, the model merges the previous summary with the newer conversation, and does not drop topics just because they are old or finished. Important constraints stay precise however old they are. Compaction still loses information: over time, not every topic or detail survives.
96
-
97
- ### Automatic compaction
98
-
99
- Automatic compaction runs before a model call when the provider's latest token count, plus an estimate for content added since, exceeds the threshold. The threshold comes from the first of these that is set:
100
-
101
- 1. the session override;
102
- 2. in Telegram sessions, the bot's `autoCompactThresholdTokens` (see [Telegram](telegram.md#compaction-thresholds));
103
- 3. the persona's `autoCompactThresholdTokens`;
104
- 4. the model's context window minus a fixed reserve of 16,384 tokens.
105
-
106
- Every threshold is capped at that model-based limit. Writing the checkpoint uses the normal model settings, with no special output limit.
107
-
108
- To compact earlier, set a token threshold for the session. The effective threshold is the smaller of this setting and the model's context window minus 16,384 tokens.
109
-
110
- - In the TUI, use `/auto-compact 50000` or `/auto-compact 50k`.
111
- - In Telegram, use `/auto_compact 50000` or `/auto_compact 50k`.
112
- - With either command, use `default` to remove the session override and use the configured default again. Omit the argument to show the configured and effective thresholds.
113
- - SDK and protocol inputs accept a safe integer of at least 50,000, or `null` for the default. They do not accept strings such as `50k`.
114
-
115
- The minimum configured threshold is 50,000 tokens. The setting applies to the main conversation. It survives recovery, reloads, and reasoning changes. Applying a persona clears it, even when reapplying the same persona, unless the request supplies a new threshold. Native Tau subagents launched without a model override inherit the parent launching turn's effective threshold, including its session override. Native launches with an explicit model use the persona's model-keyed subagent threshold or that model's default (see [subagents](subagents.md)). Claude Code subagents manage their own compaction. Ephemeral threads use the persona default, without the main session override; forks retain their source thread's threshold.
116
-
117
- Changing the setting does not start compaction. The new threshold applies from the next logical turn. A running turn and its steering continuations keep their original threshold.
118
-
119
- The threshold controls when compaction starts; it does not limit request size. Tau does not truncate the input to this threshold before summarizing it. Large base instructions and summaries can leave context above the threshold even after compaction. Earlier compaction may reduce the cost of later requests, but generating a summary also costs tokens, can disrupt caching, and loses detail.
120
-
121
- For both automatic and manual compaction, Tau checks that the request fits, using a valid token count from the provider plus estimates for new content and the summary instruction. Without a valid count, it estimates the whole request. If the request cannot fit, compaction fails; Tau never falls back to sending a flattened transcript. Compaction can run several times during one long turn.
122
-
123
- The summary describes the conversation, completed work, findings, and remaining work, without copying long user messages or tool output word for word. It can point to details worth looking up in the transcript archive and say why they matter.
124
-
125
- Tau keeps the most recent messages, without gaps, within a budget of 20,000 estimated tokens, and never more than the compaction threshold:
126
-
127
- - The cut can fall inside a user turn, but messages are kept whole, and an assistant message with tool calls stays together with all its results.
128
- - Kept messages, including tool-recovery messages, are never truncated.
129
- - Tau does not skip a large exchange to fit earlier messages into the remaining budget.
130
- - If the latest exchange does not fit, only the checkpoint remains.
131
-
132
- Tau records the compaction as the start of a new context segment.
133
-
134
- Before replacing the context, Tau tries to save a transcript archive in the execution environment's temporary directory. Each automatic compaction adds a numbered `.txt` and `.json` pair, in a directory specific to the agent. The text file is meant for searching, with large tool results shortened. The JSON file keeps the full tool results, but not assistant thinking. A `README.md` in the same directory describes both formats, with example lookups. When archiving succeeds, the continuation message includes all three paths.
135
-
136
- These files hold details removed from the session's model context. The `history` tool is different: it searches a separate collection on the host, which may be copied to a remote service, out of date, truncated, or unavailable, and its entry IDs do not match archive records. The continuation message names the archive as the place to recover compacted details.
137
-
138
- The continuation message includes the full archive guide, so the agent can continue without reading the file first. The guide also stays on disk. It recommends looking up entries by known ID or distinctive text, with a short chronological overview as an optional first step. Earlier numbered pairs can hold details from before the current compaction.
139
-
140
- Archives are temporary recovery aids, not backups. If archiving fails, compaction still runs, and the execution environment may delete archives during cleanup.
141
-
142
- ### Intermediate system instructions
143
-
144
- Besides the persona's base prompt, the conversation history can contain plain-text system instructions. The TUI hides them. They are saved with the session, recorded as system entries in searchable history, and sent to the model in conversation order. The persona's base prompt is never recorded in history. Providers that do not support system messages in the middle of a conversation may receive these instructions merged into the leading prompt.
145
-
146
- Compaction treats these instructions as part of the history: what they caused can enter the summary, and instructions among the kept recent messages stay unchanged. The base prompt is sent separately and is never replaced by the summary. Instructions that only guided an earlier compaction are left out of both the summary and the kept messages. An instruction that must survive exactly for a long time cannot rely on being a system message; the feature that added it must add it again or keep it some other way. Rewind removes these instructions along with everything after the rewind point.
147
-
148
- A `<system>` block written by a user never becomes a system instruction (see [prompts and project context](prompts-and-project-context.md)).
149
-
150
- ### Manual compaction
151
-
152
- Manual compaction requires an idle session. It summarizes the whole conversation and keeps no recent messages.
28
+ **Manual compaction** runs with `/compact-all` or `/compact-keep-last` while idle. It keeps no recent messages and saves no archive. Text after the command guides the summary:
153
29
 
154
30
  ```text
155
31
  /compact-all preserve the deployment constraints
156
32
  ```
157
33
 
158
- `/compact-all` replaces the context with the summary. `/compact-keep-last` also asks the summary to include the last assistant response word for word, when there is one. Text after either command is optional guidance for the summary, not a new message in the conversation.
159
-
160
- If compaction fails, is skipped, or is interrupted, the previous context stays. Manual compaction does not save a transcript archive.
161
-
162
- ## Rewind deliberately
34
+ ## Rewind
163
35
 
164
- `/rewind` opens a list of user messages you can return to. Selecting one removes that message and everything after it from the session, and puts the selected text back in the editor so you can change and resend it.
36
+ `/rewind` removes a chosen user message and everything after it, then puts the text back in the editor. It also removes those entries from history and cannot be undone. It needs an idle session with no pending messages and no running subagents.
165
37
 
166
- Rewind requires an idle session with no pending messages. It removes messages, tool state, turn results, and searchable history entries from that point on. It cannot be undone. To change direction without deleting anything, send a new message or steer the running turn instead.
38
+ ## Reload
167
39
 
168
- Compaction keeps searchable history, while rewind cuts it back to the rewind point.
40
+ `/reload` reads configuration, personas, prompts, skills, and `AGENTS.md` again from the working directory, reports warnings, and applies them to later turns. It keeps the current persona if it still exists. It does not change MCP servers, the execution environment, running subagents, or anything owned by the client. See [how Tau works](how-tau-works.md) for what needs a restart.
169
41
 
170
- ## Reload session content
42
+ ## Background jobs
171
43
 
172
- Run `/reload` in the TUI while the session is idle. The host reads configuration, personas, prompts, skills, and `AGENTS.md` context again from the session's working directory. It keeps the current persona if its ID still exists, and otherwise selects the first available persona. Warnings appear in the transcript.
44
+ Background [Bash and code jobs](tools.md) belong to the agent that started them and survive turns, interruption, and detaching. A running job keeps the session loaded. Jobs stop when the session closes or the host shuts down.
173
45
 
174
- Reload affects later turns. It never changes the saved conversation or the execution environment. It does not change the session's MCP servers, which stay as loaded; see [`mcpServers`](config-reference.md#mcpservers). It does not reload anything owned by the client, such as themes, voice, or client tools; restart the TUI for those. Codex auth storage is read again on every new request. Restart the host after changing its environment variables, `apiKeys`, listener settings, hosted environment settings, or the Tau version. [Credentials](credentials.md) and [remote sessions](remote-sessions.md) describe where each setting belongs.
46
+ ## What survives
175
47
 
176
- Protocol clients can request changes directly, but should still wait for an idle session. Some changes interrupt running work and reject pending messages, so the session ends up with one consistent configuration.
48
+ | Event | Saved session | Pending messages | Running work and subagents |
49
+ | --- | --- | --- | --- |
50
+ | Client detaches from `tau serve` | Kept | Kept | Continue |
51
+ | TUI restarts, host keeps running | Kept | Kept | Continue |
52
+ | Local TUI exits | Saved | Lost | Interrupted |
53
+ | Host restarts | Recovered | Lost | Stopped, session returns idle |
177
54
 
178
- ## Session state and searchable history
55
+ After a restart, unfinished turns are marked as aborted and subagents are gone. Conversation, persona, reasoning, cost, and the execution environment are restored. The host can list and recover a session only if it can reconnect its environment. A missing directory or Sprite connection makes recovery fail, so restore it and try again.
179
56
 
180
- Tau keeps two separate records for different purposes:
57
+ Once the last client detaches and work has finished, the host unloads the session from memory and its subagents are gone. The session stays saved. Newer Tau versions open sessions saved by older ones, but older versions cannot read newer sessions, so do not downgrade a host.
181
58
 
182
- - The saved session is what Tau uses to continue one conversation. It contains the model's current context and the session state you see.
183
- - Searchable history is a flat list of user messages, intermediate system instructions, assistant text, and finished tool calls, used to search and read across sessions. It is stored in the host's history database and can also be copied to a configured history service.
59
+ ## Reopen a saved session
184
60
 
185
- Compaction changes the saved session's model context but leaves searchable history as it was. Rewind cuts both back to the rewind point, but subagent sessions in history stay. History cannot rebuild a session and is never used to recover one. See [history](history.md) for storage, replication, and the history tool.
186
-
187
- ## Inspect model usage
188
-
189
- Tau writes usage records on the host to daily files, `~/.config/tau/logs/usage-YYYY-MM-DD.jsonl`, in the host user's home. Each record is one finished model response from a main session, subagent, or ephemeral thread. Records include the time, the session, persona, provider, model, reasoning, and agent, and the input, output, cache-read, cache-write, and total tokens with Tau's cost estimate. They do not contain prompt or response text, and they are separate from saved sessions and searchable history.
190
-
191
- Run the summary command as the user that runs the host:
192
-
193
- ```sh
194
- tau usage
195
- ```
196
-
197
- By default it groups by day and prints the request count, each token category, total tokens, cost, and an overall total. The options are:
198
-
199
- | Option | Behavior |
200
- | --- | --- |
201
- | `--since <date>` | Include entries on or after a `YYYY-MM-DD` or ISO date. |
202
- | `--persona <id>` | Match an exact persona id, case-insensitively. |
203
- | `--provider <name>` | Match an exact provider, case-insensitively. |
204
- | `--model <id>` | Match an exact model id, case-insensitively. |
205
- | `--group-by day\|model` | Group by calendar day or by `provider/model`. The default is `day`. |
206
- | `--help`, `-h` | Show the command help. |
207
-
208
- Filters can be combined:
61
+ Reattach through a running host. To reopen a local session, start one as the same user:
209
62
 
210
63
  ```sh
211
- tau usage --since 2026-08-01 --provider openai-codex --group-by model
64
+ tau serve
65
+ tau attach --session 0195d6e4-4cf9-7f44-a2d8-f8f7f49ee9d3 ws://127.0.0.1:8787
212
66
  ```
213
67
 
214
- There is no `--until`, `--session`, or `--agent` filter. For a remote session, run `tau usage` on the host as the user that runs `tau serve`. Running it on an attached client reads that client user's logs instead. The command only reads, but the raw files still show times, session IDs, model choices, token volumes, and costs. Share the filtered summary instead of raw JSONL, and treat Tau's costs as estimates, not an invoice.
215
-
216
- ## What survives each event
217
-
218
- | Event | Saved session | Pending messages | Running turns and subagents | Client state |
219
- | --- | --- | --- | --- | --- |
220
- | Another client detaches from a running WebSocket host | Kept | Kept in host memory | Continue | That client's tools, themes, drafts, and local tasks are gone |
221
- | Local TUI exits | Saved as its host shuts down | Cancelled | Interrupted and recorded where possible | Lost |
222
- | WebSocket host restarts | Recovered from storage | Lost | Session returns idle; subagents are not restored | Each client reconnects on its own |
223
- | TUI restarts while the host keeps running | Kept | Kept in host memory | Continue | Loaded again by the new client process |
224
- | `/new` | Old session stays saved | Not copied | New idle session | Same TUI process continues |
68
+ Without `--session`, `tau attach` opens a selector.
225
69
 
226
- An unsent draft exists only in the TUI. Press Ctrl+S to copy it to the clipboard before restarting a client.
70
+ ## Session attributes
227
71
 
228
- ## Check a recovered session
72
+ Each session has creation attributes that never change and are used to filter [history](history.md). Tau sets `machine` and `cwd`. Clients set the others, such as `source` and `repository`.
229
73
 
230
- Use normal Tau operations, not the session files.
74
+ ## Usage and cost
231
75
 
232
- 1. Wait for running work to finish, or interrupt it.
233
- 2. Note the session ID shown at the top of the TUI.
234
- 3. Exit cleanly and reattach through the same host.
235
- 4. Confirm the messages, persona, and reasoning level.
236
- 5. Check the environment without adding to the context using `!!`, for example `!!pwd` and `!!git status --short`.
237
- 6. Send a small read-only request before continuing with work that changes things.
238
-
239
- To reopen a saved local session, start a WebSocket host as the same user and attach from another terminal:
76
+ `tau usage` summarizes token use and estimated cost from the logs in the host user's `~/.config/tau/logs`, so run it on the host:
240
77
 
241
78
  ```sh
242
- tau serve
243
- tau attach --session 0195d6e4-4cf9-7f44-a2d8-f8f7f49ee9d3 ws://127.0.0.1:8787
79
+ tau usage --since 2026-08-01 --provider openai-codex --group-by model
244
80
  ```
245
81
 
246
- If recovery fails, check the host version, the hosted environment configuration, whether the target is available, and credentials before assuming the session is damaged. [Remote sessions](remote-sessions.md) covers those checks.
82
+ Other filters are `--persona` and `--model`. Costs are estimates, and they do not include calls made through `tau.models` or command-line tools.
@@ -1,181 +1,68 @@
1
1
  # Speech generation
2
2
 
3
- `tau tool speech-generate` turns a caller-chunked script into one WAV using ElevenLabs Eleven v4 Turbo (`eleven_v4_turbo`) or Eleven v4 (`eleven_v4`). It supports single-speaker narration and multi-speaker dialogue.
4
-
5
- ```bash
6
- tau tool speech-generate --help
7
- ```
3
+ `tau tool speech-generate` turns a script into one WAV file using ElevenLabs. It supports narration and multi-speaker dialogue.
8
4
 
9
5
  ## Credentials and requirements
10
6
 
11
- Requires an ElevenLabs API key. See [feature-specific credentials](credentials.md#feature-specific-keys) for setup.
7
+ Needs `ELEVENLABS_API_KEY` or `apiKeys.elevenlabs`. List voices, printed as one JSON object each with `voice_id` and `name`:
12
8
 
13
9
  ```bash
14
10
  tau tool speech-generate --list-voices
15
11
  ```
16
12
 
17
- Voice listing prints one JSON object per voice, containing `voice_id` and `name`. Use those IDs in the script.
18
-
19
- ## Models
20
-
21
- `--model` is required; there is no default. Use `eleven_v4_turbo` for lower-latency speech, as shown in the examples. Use `eleven_v4` when maximum quality matters more than latency. Both support narration and multi-speaker dialogue.
22
-
23
13
  ## Input and examples
24
14
 
25
- Give a UTF-8 JSON document with exactly two fields, `voices` and `chunks`. `voices` maps speaker names to voice IDs; `chunks` is an ordered, nonempty array of nonempty arrays of speaker turns. Each turn contains exactly `speaker` and nonblank `text`.
15
+ `--model` is required. Use `eleven_v4_turbo` for lower latency and `eleven_v4` for the highest quality.
26
16
 
27
17
  ```json
28
18
  {
29
- "voices": {
30
- "host": "VOICE_ID_A",
31
- "guest": "VOICE_ID_B"
32
- },
19
+ "voices": { "host": "VOICE_ID_A", "guest": "VOICE_ID_B" },
33
20
  "chunks": [
34
21
  [
35
- {
36
- "speaker": "host",
37
- "text": "[calm] Welcome. What are we exploring today?"
38
- },
22
+ { "speaker": "host", "text": "[calm] What are we exploring today?" },
39
23
  {
40
24
  "speaker": "guest",
41
25
  "text": "How a forest changes through the seasons."
42
26
  }
43
27
  ],
44
- [
45
- { "speaker": "host", "text": "Let's begin with spring." },
46
- {
47
- "speaker": "guest",
48
- "text": "The first changes happen before the leaves appear."
49
- }
50
- ]
28
+ [{ "speaker": "host", "text": "Let's begin with spring." }]
51
29
  ]
52
30
  }
53
31
  ```
54
32
 
55
- Save as `dialogue.json`, replacing the placeholder voice IDs:
56
-
57
33
  ```bash
58
34
  tau tool speech-generate --model eleven_v4_turbo \
59
35
  --input ./dialogue.json --output ./dialogue.wav
60
-
61
- # Alternatively, use Eleven v4 for maximum quality.
62
- tau tool speech-generate --model eleven_v4 \
63
- --input ./dialogue.json --output ./dialogue-v4.wav
64
36
  ```
65
37
 
66
- Single-speaker narration uses the same shape with one voice. All chunks are validated before generation:
67
-
68
- - Each chunk contains at most 2,000 Unicode code points across its text, including whitespace and delivery tags.
69
- - Every speaker must resolve to a voice. At most 10 distinct voices may be used.
38
+ Each chunk holds at most 2,000 characters, including tags, and a script uses at most 10 voices. You choose where chunks break, and Tau keeps the text and order.
70
39
 
71
- Tau combines consecutive whole chunks into requests of at most 2,000 characters, as the [dialogue endpoint documentation](https://elevenlabs.io/docs/api-reference/text-to-dialogue/convert) recommends for reliability. You choose where chunks break; text and turn order are kept.
40
+ ## Delivery tags
72
41
 
73
- ## Conversational assistant replies
42
+ Tags in square brackets guide how text is spoken and are not read aloud. Results vary by voice and language.
74
43
 
75
- For conversational assistant replies with Eleven v4 Turbo or Eleven v4, use `[Brisk but relaxed, speaking naturally to a colleague]` as a starting point. Put the tag at the beginning of the turn's `text`, followed by the words to speak. Tags guide delivery; they are not intended to be spoken aloud.
76
-
77
- Choose a delivery that fits the content:
78
-
79
- | Use case | Suggested tag |
44
+ | Use | Tag |
80
45
  | --- | --- |
81
46
  | Everyday assistant reply | `[Brisk but relaxed, speaking naturally to a colleague]` |
82
47
  | Faster update | `[Brisk but relaxed, slightly faster, brief natural pauses]` |
83
48
  | Step-by-step explanation | `[Calm and clear, measured pace, brief pauses between steps]` |
84
49
  | Story narration | `[Warm, expressive storytelling, unhurried pace]` |
85
- | Quiet aside in dialogue | `[whispering]` |
86
-
87
- These are custom prompting suggestions, not official named presets or guaranteed speed controls. Each speaker turn can use a different tag; place a tag before a phrase when the delivery should change within a turn.
88
-
89
- ElevenLabs documents open-ended audio tags in its [v4 prompting guide](https://elevenlabs.io/docs/overview/capabilities/text-to-speech/best-practices#prompting-eleven-v4), also available as [plain Markdown](https://elevenlabs.io/docs/overview/capabilities/text-to-speech/best-practices.md#prompting-eleven-v4). Its [documentation index](https://elevenlabs.io/docs/llms.txt) lists other guides in an agent-friendly format.
90
-
91
- Documented tags include `[curious]`, `[excited]`, `[sarcastic]`, `[whispering]`, `[laughs]`, `[sighs]`, and `[short pause]`. For example, a turn's `text` can contain:
92
-
93
- ```text
94
- [curious] What happens if we try the other route?
95
-
96
- [excited] That worked! [short pause] Here's what changed.
97
-
98
- [Warm, conversational tone, faint amusement] You always did choose the longest way home.
99
- ```
100
-
101
- Tags describe audible delivery or vocal actions, not visual actions such as smiling or standing. Clear descriptions reduce ambiguity between a delivery instruction and a sound effect. Results vary by voice and language; neither Eleven v4 Turbo nor Eleven v4 treats tags as deterministic controls.
102
-
103
- Save this as `assistant-reply.json`, replacing `VOICE_ID` with an ID from `--list-voices`:
104
-
105
- ```json
106
- {
107
- "voices": { "assistant": "VOICE_ID" },
108
- "chunks": [
109
- [
110
- {
111
- "speaker": "assistant",
112
- "text": "[Brisk but relaxed, speaking naturally to a colleague] I found the issue. The app was using an old setting, so your changes never reached the server. I've fixed that and checked the result. You don't need to reinstall anything. Try saving once more. If the warning comes back, send me the exact message and I'll trace it from there."
113
- }
114
- ]
115
- ]
116
- }
117
- ```
118
50
 
119
- ```bash
120
- tau tool speech-generate --model eleven_v4_turbo \
121
- --input ./assistant-reply.json --output ./assistant-reply.wav
122
-
123
- # Alternatively, use Eleven v4 for maximum quality.
124
- tau tool speech-generate --model eleven_v4 \
125
- --input ./assistant-reply.json --output ./assistant-reply-v4.wav
126
- ```
127
-
128
- For a Finnish reply, replace the turn's `text` with:
129
-
130
- ```text
131
- [Brisk but relaxed, speaking naturally to a colleague] Löysin ongelman. Sovellus käytti vanhaa asetusta, joten muutoksesi eivät päätyneet palvelimelle. Korjasin asetuksen ja tarkistin, että tallennus toimii. Sinun ei tarvitse asentaa mitään uudelleen. Kokeile tallentaa vielä kerran. Jos varoitus palaa, lähetä minulle sen tarkka teksti, niin selvitän syyn.
132
- ```
133
-
134
- To compare pacing, replace the leading tag with `[Brisk but relaxed, slightly faster, brief natural pauses]` and generate to a fresh output path, keeping the voice and spoken text fixed.
135
-
136
- [Eleven v4 Turbo and Eleven v4](https://elevenlabs.io/docs/overview/capabilities/text-to-speech/eleven-v4) control delivery through audio tags rather than a numeric speed setting. Results vary by voice and language.
137
-
138
- ## Long recordings and assembly
139
-
140
- Responses are streamed to disk as mono 24 kHz, signed 16-bit little-endian PCM. Batches are concatenated in order into one WAV. Approximately 30 minutes occupies 86.4 MB of PCM. Each batch is capped at 128 MiB and the assembled file must fit standard RIFF/WAV's roughly 4 GiB limit. Provider requests have a ten-minute deadline.
141
-
142
- Each request receives up to three previous completed request IDs for ElevenLabs request stitching. A missing ID stops subsequent generation. Stitching uses normal ElevenLabs request logging.
51
+ Short tags such as `[curious]`, `[whispering]`, `[laughs]`, and `[short pause]` also work. Tags describe sound, so avoid visual actions. See the [ElevenLabs prompting guide](https://elevenlabs.io/docs/overview/capabilities/text-to-speech/best-practices#prompting-eleven-v4).
143
52
 
144
53
  ## Outputs and recovery
145
54
 
146
- The output parent directory must exist. Neither the requested WAV nor `<output>.parts` may exist. The `.parts` directory contains:
147
-
148
- - `manifest.json`: model, PCM format, output path, request plan, text and voice IDs, one-based chunk indices, completion flags, and byte counts. `requestId` and `characterCost` retain the provider's `request-id` and `character-cost` headers, including when a subsequent audio download fails.
149
- - `batch-0001.pcm`, etc.: completed raw PCM batches in request order.
150
- - `.partial` files: interrupted downloads.
151
- - `assembled.wav`: the assembled output.
55
+ The output is mono 24 kHz 16-bit WAV. Neither the output nor `<output>.parts` may exist yet. Stdout is one JSON object with `output`, `artifacts`, and `batches`.
152
56
 
153
- Stdout on success is one JSON object with absolute `output`, `artifacts`, and the number of `batches`. The manifest contains the script text; keep artifacts private for sensitive scripts.
57
+ `.parts` holds `manifest.json`, the completed `batch-0001.pcm` files, and `assembled.wav`. The manifest contains the script text, so keep it private if the script is sensitive.
154
58
 
155
- Failures exit nonzero. Before generation, the error names the invalid field, chunk, or turn. After it starts, the error names the failed batch and step. If the output or `.parts` path already exists, choose a new `--output` path, and keep the existing files in case you need them. Errors after the output directory is created give its path; it may be incomplete. If only the final copy fails, copy the finished `assembled.wav` to a new path instead of generating again. Requests are never retried automatically, because a failed request may already have been charged, and a new request may be charged again.
156
-
157
- To recover after a later batch fails, inspect the manifest's `completed` flags and chunk mapping. Generate only the unfinished chunks to a fresh output path, then assemble the completed PCM files from both runs in script order. Request stitching does not carry over between invocations.
158
-
159
- For example, with FFmpeg installed:
59
+ Requests are never retried, because a failed request may already have been charged. If a later batch fails, check the manifest's `completed` flags and generate only the unfinished chunks to a new path. Then join the PCM files in order, leaving out `.partial` files:
160
60
 
161
61
  ```bash
162
- cat ./first.wav.parts/batch-0001.pcm \
163
- ./first.wav.parts/batch-0002.pcm \
164
- ./remaining.wav.parts/batch-0001.pcm > ./complete.pcm
62
+ cat ./first.wav.parts/batch-0001.pcm ./remaining.wav.parts/batch-0001.pcm > ./complete.pcm
165
63
  ffmpeg -n -f s16le -ar 24000 -ac 1 -i ./complete.pcm -c:a pcm_s16le ./complete.wav
166
64
  ```
167
65
 
168
- Use only completed `.pcm` batches, not `.partial` files.
169
-
170
66
  ## Approximate cost
171
67
 
172
- Standard rates from the [ElevenLabs API pricing page](https://elevenlabs.io/pricing/api):
173
-
174
- | Model | Per 1,000 characters | 2,000 characters | 27,000 characters (roughly 30 minutes) |
175
- | --- | --- | --- | --- |
176
- | `eleven_v4_turbo` | $0.04 | $0.08 | $1.08 |
177
- | `eleven_v4` | $0.08 | $0.16 | $2.16 |
178
-
179
- Check current API pricing for plan and voice-specific rates. The manifest's `characterCost` preserves the provider's billing header verbatim.
180
-
181
- See [command-line tools](tools.md) for the other tools and where commands run.
68
+ Per 1,000 characters, `eleven_v4_turbo` costs about $0.04 and `eleven_v4` about $0.08. Thirty minutes is roughly 27,000 characters. The manifest records the provider's `characterCost`.