@markusylisiurunen/tau 0.3.101 → 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 (97) hide show
  1. package/README.md +18 -23
  2. package/dist/core/config/ownership.js +3 -1
  3. package/dist/core/config/ownership.js.map +1 -1
  4. package/dist/core/config/schema.js +3 -1
  5. package/dist/core/config/schema.js.map +1 -1
  6. package/dist/core/history/migrations.js +46 -1
  7. package/dist/core/history/migrations.js.map +1 -1
  8. package/dist/core/history/setup.js +24 -7
  9. package/dist/core/history/setup.js.map +1 -1
  10. package/dist/core/mcp/cli.js +1 -1
  11. package/dist/core/mcp/cli.js.map +1 -1
  12. package/dist/core/static/tau_docs/client-tools.md +46 -385
  13. package/dist/core/static/tau_docs/code-mode.md +104 -43
  14. package/dist/core/static/tau_docs/configuration.md +77 -171
  15. package/dist/core/static/tau_docs/getting-started.md +25 -96
  16. package/dist/core/static/tau_docs/history.md +30 -228
  17. package/dist/core/static/tau_docs/how-tau-works.md +53 -0
  18. package/dist/core/static/tau_docs/image-generation.md +15 -107
  19. package/dist/core/static/tau_docs/index.md +46 -45
  20. package/dist/core/static/tau_docs/instructions-and-skills.md +81 -0
  21. package/dist/core/static/tau_docs/manifest.json +15 -20
  22. package/dist/core/static/tau_docs/mcp.md +77 -0
  23. package/dist/core/static/tau_docs/models-and-credentials.md +67 -0
  24. package/dist/core/static/tau_docs/openrouter.md +31 -129
  25. package/dist/core/static/tau_docs/pdf-unpacking.md +8 -21
  26. package/dist/core/static/tau_docs/personas.md +48 -144
  27. package/dist/core/static/tau_docs/remote-sessions.md +33 -170
  28. package/dist/core/static/tau_docs/sdk.md +150 -0
  29. package/dist/core/static/tau_docs/security.md +6 -193
  30. package/dist/core/static/tau_docs/session-protocol.md +84 -246
  31. package/dist/core/static/tau_docs/sessions.md +41 -205
  32. package/dist/core/static/tau_docs/speech-generation.md +16 -129
  33. package/dist/core/static/tau_docs/subagents.md +57 -229
  34. package/dist/core/static/tau_docs/telegram.md +152 -220
  35. package/dist/core/static/tau_docs/tools.md +44 -167
  36. package/dist/core/static/tau_docs/troubleshooting.md +23 -217
  37. package/dist/core/static/tau_docs/tui.md +42 -276
  38. package/dist/core/subagents/claude_code_runner.mjs +65 -65
  39. package/dist/core/telegram/adapter.js +178 -61
  40. package/dist/core/telegram/adapter.js.map +1 -1
  41. package/dist/core/telegram/cli.js +1 -3
  42. package/dist/core/telegram/cli.js.map +1 -1
  43. package/dist/core/telegram/config.js +3 -1
  44. package/dist/core/telegram/config.js.map +1 -1
  45. package/dist/core/telegram/runtime.js +1 -1
  46. package/dist/core/telegram/runtime.js.map +1 -1
  47. package/dist/core/utils/scribe_transcription.js +283 -0
  48. package/dist/core/utils/scribe_transcription.js.map +1 -0
  49. package/dist/core/utils/speech_cleanup.js +198 -0
  50. package/dist/core/utils/speech_cleanup.js.map +1 -0
  51. package/dist/core/utils/speech_to_text.js +3 -3
  52. package/dist/core/utils/speech_to_text_keywords.js +5 -4
  53. package/dist/core/utils/speech_to_text_keywords.js.map +1 -1
  54. package/dist/core/version.js +1 -1
  55. package/dist/diff_tool/app/dist/assets/{core-CXVpaOO1.js → core-Cnp6wBC7.js} +1 -1
  56. package/dist/diff_tool/app/dist/assets/engine-oniguruma-ConHyUk6.js +1 -0
  57. package/dist/diff_tool/app/dist/assets/{highlights-DuJNYjEh.js → highlights-DeO0fGqQ.js} +1 -1
  58. package/dist/diff_tool/app/dist/assets/index-BDuQ2wXS.js +221 -0
  59. package/dist/diff_tool/app/dist/assets/langs-DDFHLNuJ.js +1 -0
  60. package/dist/diff_tool/app/dist/assets/{loader-bi21_x0K.js → loader-DrwOwtvp.js} +1 -1
  61. package/dist/diff_tool/app/dist/assets/{preload-helper-CRzLMJPS.js → preload-helper-DclECHGd.js} +1 -1
  62. package/dist/diff_tool/app/dist/assets/{shiki-D6ZyrNQD.js → shiki-CwKGJZFi.js} +2 -2
  63. package/dist/diff_tool/app/dist/assets/{stream-tokenizer-BdsyU_yB.js → stream-tokenizer-D4-m26wx.js} +1 -1
  64. package/dist/diff_tool/app/dist/assets/{themes-9lpTYI_i.js → themes-Do3waJhf.js} +2 -2
  65. package/dist/diff_tool/app/dist/index.html +2 -2
  66. package/dist/history/worker/index.js +83 -63
  67. package/dist/history/worker/index.js.map +1 -1
  68. package/dist/history/worker/migrations/0003_digest_schedule.sql +36 -0
  69. package/dist/history/worker/migrations/0004_recent_sessions.sql +1 -0
  70. package/dist/history/worker/migrations/0005_external_content.sql +58 -0
  71. package/dist/history/worker/migrations/0006_external_content_cutover.sql +44 -0
  72. package/dist/store/session_snapshot_migrations.js +14 -1
  73. package/dist/store/session_snapshot_migrations.js.map +1 -1
  74. package/dist/tui/chat_view.js +3 -1
  75. package/dist/tui/chat_view.js.map +1 -1
  76. package/dist/tui/listen_capture.js +7 -5
  77. package/dist/tui/listen_capture.js.map +1 -1
  78. package/dist/tui/session_chat_controller.js +93 -15
  79. package/dist/tui/session_chat_controller.js.map +1 -1
  80. package/dist/tui/ui/custom_editor.js +3 -0
  81. package/dist/tui/ui/custom_editor.js.map +1 -1
  82. package/package.json +8 -7
  83. package/dist/core/static/tau_docs/config-reference.md +0 -355
  84. package/dist/core/static/tau_docs/credentials.md +0 -165
  85. package/dist/core/static/tau_docs/models.md +0 -57
  86. package/dist/core/static/tau_docs/node-sdk.md +0 -430
  87. package/dist/core/static/tau_docs/ownership-and-scope.md +0 -107
  88. package/dist/core/static/tau_docs/prompts-and-project-context.md +0 -147
  89. package/dist/core/static/tau_docs/sdk-diff-review.md +0 -92
  90. package/dist/core/static/tau_docs/session-protocol-methods.md +0 -655
  91. package/dist/core/static/tau_docs/skills.md +0 -135
  92. package/dist/core/static/tau_docs/telegram-projects.md +0 -197
  93. package/dist/core/utils/gemini_transcription.js +0 -566
  94. package/dist/core/utils/gemini_transcription.js.map +0 -1
  95. package/dist/diff_tool/app/dist/assets/engine-oniguruma-Rz_7DPcV.js +0 -1
  96. package/dist/diff_tool/app/dist/assets/index-F9is7PUw.js +0 -221
  97. package/dist/diff_tool/app/dist/assets/langs-CTftvgbb.js +0 -1
@@ -1,28 +1,12 @@
1
1
  # Telegram
2
2
 
3
- Tau's Telegram runner connects one or more Telegram bots to Tau sessions that run in the same process. On the runner machine, it polls Telegram, routes chats, handles attachments, and prepares project workspaces. Each workspace is an ordinary local execution environment, with normal Tau configuration, personas, tools, project context, saved sessions, and history.
3
+ The Telegram runner connects Telegram bots to Tau sessions on the runner machine. Each session is an ordinary local session in a project workspace, with normal Tau configuration, personas, skills, and tools.
4
4
 
5
- Anyone who can use a bot can cause model calls, file changes, and repository changes. Set up chat, user, and project limits before adding a bot to a group.
5
+ Anyone who can use a bot can cause model calls, file changes, and repository changes. Set up the access lists before adding a bot to a group.
6
6
 
7
7
  ## Start the runner
8
8
 
9
- Run the standalone process with one dedicated JSON file:
10
-
11
- ```sh
12
- tau telegram --config-file /etc/tau/telegram.json
13
- ```
14
-
15
- The process stays in the foreground until `SIGINT` or `SIGTERM`. Relative `--config-file` paths resolve from the process working directory. Paths inside that file resolve as described below, usually from the config file's directory.
16
-
17
- Add `--check-config` to validate the file and exit without starting the runner. It does not check tokens, directories, or repository access.
18
-
19
- The Telegram file is **not** one of Tau's `config.json` levels. It configures the runner: bot tokens, startup settings, presets, projects, workspace roots, and routing. Tau still loads normal configuration from the runner's startup directory and from each session's workspace. See [configuration](configuration.md) and [ownership and scope](ownership-and-scope.md).
20
-
21
- Run at most one runner per configuration and workspace root. Two runners would compete for Telegram updates, runner state, and workspace cleanup.
22
-
23
- ## Minimal configuration
24
-
25
- A useful configuration defines at least one bot and one project:
9
+ Create a config file. It is separate from `config.json`:
26
10
 
27
11
  ```json
28
12
  {
@@ -31,260 +15,208 @@ A useful configuration defines at least one bot and one project:
31
15
  "engineering": {
32
16
  "botToken": "<telegram-bot-token>",
33
17
  "startup": { "source": "workspace" },
34
- "allowedProjectIds": ["ledger"],
35
18
  "allowedUserIds": [18422031],
36
19
  "allowedChatIds": [18422031],
37
20
  "defaultProjectId": "ledger"
38
21
  }
39
22
  },
40
23
  "projects": {
41
- "ledger": {
42
- "repo": "acme/ledger",
43
- "ref": "main"
44
- }
24
+ "ledger": { "repo": "acme/ledger", "ref": "main" }
45
25
  }
46
26
  }
47
27
  ```
48
28
 
49
- The bot token must be written in the file; it cannot come from an environment variable. Protect the file, never commit it, and rotate an exposed token through BotFather. Never print the config into a session or shared log.
50
-
51
- The runner refuses to start if the file contains an unknown field, and the error names that field.
52
-
53
- ## Top-level fields
54
-
55
- | Field | Required | Behavior |
56
- | --- | --- | --- |
57
- | `bots` | Yes | Non-empty object keyed by a bot ID you choose. |
58
- | `projects` | Yes | Object keyed by project ID. Bots select from these definitions. |
59
- | `workspaceRoot` | No | Base for managed workspaces; defaults to `.tau/telegram-workspaces` beside the Telegram config file. |
60
- | `maxSessions` | No | Positive integer cap on active sessions across the whole runner. |
61
-
62
- A relative `workspaceRoot` resolves from the config file's directory. Tau saves runner session records in `<workspaceRoot>-sessions.json` and per-chat preferences in `<workspaceRoot>-project-preferences.json`. These are the runner's own state files; do not edit them. Sessions are saved in the usual place in the runner user's Tau home.
63
-
64
- `maxSessions` counts queued, preparing, running, and waiting sessions across all bots. Failed sessions do not count, but stay visible to their chat until replaced or closed.
65
-
66
- ## Bots and access control
67
-
68
- Each `bots.<id>` object supports:
69
-
70
- | Field | Required | Behavior |
71
- | --- | --- | --- |
72
- | `botToken` | Yes | Telegram Bot API token. |
73
- | `env` | No | Environment variables for this bot's workspace preparation and new sessions. See [bot environments](telegram-projects.md#bot-environments). |
74
- | `allowedProjectIds` | No | Non-empty unique subset of configured project IDs; omission exposes all projects. |
75
- | `autoCompactThresholdTokens` | No | Default automatic-compaction threshold for this bot's sessions. See [compaction thresholds](#compaction-thresholds). |
76
- | `startup` | Yes | `{ "source": "workspace" }` or `{ "source": "preset", "preset": "<key>" }`. See [startup and presets](#startup-and-presets). |
77
- | `presets` | No | Named choices that `/persona` offers. Omission offers all workspace personas, and `{}` offers none. |
78
- | `allowedUserIds` | No | Integer user IDs allowed to trigger turns, commands, and callbacks. |
79
- | `allowedChatIds` | No | Integer chat IDs allowed to interact with the bot; also opts groups in. |
80
- | `defaultProjectId` | No | Initial project preference, and must be allowed for this bot. |
81
- | `systemMessage` | No | Additional instruction for turns from this bot. |
82
-
83
- The runner retries failed polling after 1,000 ms and uses a 30-second Telegram long-poll timeout.
84
-
85
- A missing or empty `allowedUserIds` allows every user. A missing or empty `allowedChatIds` allows all DMs and no groups. A non-empty `allowedChatIds` allows only the listed DMs and groups. Group IDs are usually negative.
86
-
87
- Use both lists for a private bot. `allowedUserIds` decides who can start work, but in an allowed group, messages from other users can still become context, labeled with their sender. Add the bot only to groups whose conversation is fine to send to the model.
88
-
89
- A bot sees only its `allowedProjectIds`, or every project if the field is missing. If only one project is allowed, it is selected automatically and the command palette omits `/use_<project>` commands. The command still works when typed directly. Otherwise the palette includes project-switch commands, and a chat needs `defaultProjectId` or a `/use_<project>` choice before `/new`. Each startup replaces the palette, removing switch commands if the bot now has only one available project.
90
-
91
- Telegram allows 100 commands per bot: thirteen built-ins and up to 87 `/use_<projectId>` commands. With `presets: {}`, `/persona` is hidden, which leaves room for one more project command.
92
-
93
- ## Projects
94
-
95
- Each project tells the runner where a session works. There are three kinds:
96
-
97
- - A **repository project** clones one GitHub repository into a new workspace for each session.
98
- - A **persistent-directory project** reuses one existing directory for all of its sessions.
99
- - A **composite project** combines several repository projects in one workspace.
100
-
101
- [Telegram projects and workspaces](telegram-projects.md) describes project fields, workspace preparation, provision hooks, and recovery.
102
-
103
- **Important:** at startup, the runner deletes everything under its managed workspace roots that no saved session uses. Give Tau a dedicated `workspaceRoot`; never use a home directory, a collection of repositories, or any directory with other content.
104
-
105
- ## Normal Tau configuration inside workspaces
106
-
107
- After preparation, Tau creates an ordinary local session in the workspace. It reads `~/.config/tau` and the `.tau` directories above the workspace as usual, so personas, prompts, skills, project context, host tools, [MCP servers](config-reference.md#mcpservers), and other settings work as in the TUI.
108
-
109
- The bot's `startup` selects a new session's settings, as described in [startup and presets](#startup-and-presets).
110
-
111
- Every Telegram turn starts with a hidden `<system>` block saying the message comes from Telegram and the reply goes there. It asks for direct answers to simple questions, and for short acknowledgements or useful progress updates during longer work, because users cannot see tool activity.
112
-
113
- Each message also carries its sender, as reported by Telegram. A DM turn gets a hidden block with the sender. In a group, the trigger message and each context message are labeled with their sender. Each queued attachment keeps the sender of the message that carried it. The sender is a JSON object with the numeric Telegram user ID and, when available, the display name and the username without the `@`, or `null` when Telegram does not identify one:
114
-
115
- ```json
116
- { "user-id": 123456789, "name": "Ada Lovelace", "username": "ada" }
29
+ ```sh
30
+ tau telegram --config-file /etc/tau/telegram.json --check-config
31
+ tau telegram --config-file /etc/tau/telegram.json
117
32
  ```
118
33
 
119
- The agent is told that names and usernames are chosen by the sender and do not prove identity or grant permission. Only `allowedChatIds` and `allowedUserIds` control who can use the bot.
120
-
121
- A per-bot `systemMessage` goes in a second hidden block. Audio transcripts get another block warning that they may contain noise or errors. Hidden blocks are saved with the user's message and can appear in history, so never put credentials in configured messages.
122
-
123
- The runner loads its speech credentials and `speech.voiceId` at startup, from its environment and from the Tau config for its startup directory. Restart the runner after changing them.
124
-
125
- ## Chat commands
126
-
127
- | Command | Behavior |
128
- | --- | --- |
129
- | `/use_<projectId>` | Selects the project for future `/new` sessions. |
130
- | `/new` | Replaces the active session using the preferred project. |
131
- | `/status` | Reports session state, project, model, reasoning, context usage, and cost. |
132
- | `/persona` | Applies a persona or preset from a menu while idle, without losing history or starting a turn. |
133
- | `/effort_low` | Selects low reasoning for future turns. |
134
- | `/effort_medium` | Selects medium reasoning for future turns. |
135
- | `/effort_high` | Selects high reasoning for future turns. |
136
- | `/effort_xhigh` | Selects xhigh reasoning for future turns. |
137
- | `/prompt` | [Records a saved prompt](prompts-and-project-context.md#telegram-prompt-picker) while idle, without starting a turn. |
138
- | `/auto_compact [tokens\|default]` | Shows the automatic-compaction threshold. Pass `50k` or `50000` to set it (minimum 50,000 tokens), or `default` to remove the session override and use the default. |
139
- | `/compact` | Runs summary-only compaction while idle. |
140
- | `/interrupt` | Interrupts the active Tau turn. |
141
- | `/tts_on` | Sends a voice note after each final assistant response. |
142
- | `/tts_off` | Disables voice responses. |
143
-
144
- Changes to the auto-compaction threshold apply from the next turn and survive session recovery. `/status` shows context usage as a percentage of the full model window. When a session override is set, or the default threshold is below the model-based threshold, it also shows the effective threshold in parentheses. See [compaction thresholds](#compaction-thresholds) for bot defaults and [automatic compaction](sessions.md#automatic-compaction) for limits and costs.
145
-
146
- A [persona](personas.md) or preset choice applies to the current session only. `/new` starts from the bot's `startup`.
147
-
148
- Preferences are saved per bot and chat, and survive restarts and new sessions. A project change applies at the next `/new`, not to the current session.
149
-
150
- In groups, commands must explicitly mention the bot. Accepted forms include:
151
-
152
- ```text
153
- /status@tau_engineering_bot
154
- /status @tau_engineering_bot
155
- @tau_engineering_bot /status
34
+ `--check-config` validates the file without checking tokens or repository access. The file holds bot tokens, so protect it and never commit it. The runner stays in the foreground and refuses unknown fields. Run one runner per configuration and workspace root, and restart it after changing the file.
35
+
36
+ The runner needs `tau`, `git`, and a signed-in `gh` on its login-shell `PATH`, and model credentials like any [host](models-and-credentials.md). To check that it works, send `/status` and then `/new` in an allowed DM.
37
+
38
+ **Give the runner a dedicated `workspaceRoot`.** At startup, it deletes everything under that root that no saved session uses, so never point it at a home directory or a directory with other content.
39
+
40
+ ## Configuration
41
+
42
+ ```ts
43
+ type TelegramConfig = {
44
+ bots: Record<string, Bot>;
45
+ projects: Record<string, Project>; // IDs: lowercase, digits, "_", at most 28 characters
46
+ workspaceRoot?: string; // default .tau/telegram-workspaces beside this file
47
+ maxSessions?: number; // active sessions across all bots
48
+ };
49
+
50
+ type Bot = {
51
+ botToken: string;
52
+ startup: { source: "workspace" } | { source: "preset"; preset: string };
53
+ presets?: Record<string, Preset>; // what /persona offers, {} hides it
54
+ allowedUserIds?: number[]; // empty or missing: every user
55
+ allowedChatIds?: number[]; // empty or missing: all DMs and no groups
56
+ allowedProjectIds?: string[]; // missing: all projects
57
+ defaultProjectId?: string;
58
+ systemMessage?: string; // added to each turn from this bot
59
+ speechCleanupStyle?: "off" | "default"; // clean up voice transcripts, default "off"
60
+ autoCompactThresholdTokens?: number;
61
+ env?: Record<string, string>; // see Bot environments
62
+ };
63
+
64
+ type Preset =
65
+ | { source: "workspace"; label: string }
66
+ | {
67
+ source: "persona";
68
+ label: string;
69
+ persona: string;
70
+ reasoning?: Reasoning;
71
+ autoCompactThresholdTokens?: number;
72
+ };
73
+
74
+ type Project = { description?: string } & (
75
+ | { repo: string; ref?: string; workingDirectory?: string } // repo is GitHub "owner/name"
76
+ | { directory: string }
77
+ | {
78
+ projectIds: string[];
79
+ instructions?: string;
80
+ subagents?: { launchModels?: string[] };
81
+ }
82
+ );
156
83
  ```
157
84
 
158
- Commands addressed to other bots are ignored.
159
-
160
- ## Startup and presets
161
-
162
- `startup` decides how a bot's new sessions start, and `presets` decides what `/persona` offers. `startup` does not add a menu entry.
163
-
164
- `startup` is required. `{ "source": "workspace" }` uses the workspace's `defaultPersona`, found through the same configuration layers as the TUI, including any effort suffix. To start with a named preset instead:
85
+ `startup` selects how a new session starts. `{ "source": "workspace" }` uses the workspace's `defaultPersona`, and a preset applies its persona and settings:
165
86
 
166
87
  ```json
167
- "startup": { "source": "preset", "preset": "astra" },
168
- "presets": {
169
- "workspace": { "source": "workspace", "label": "Workspace default" },
170
- "astra": {
171
- "source": "persona",
172
- "label": "Astra",
173
- "persona": "gpt-6-astra-chat",
174
- "reasoning": "low",
175
- "autoCompactThresholdTokens": 120000
88
+ {
89
+ "startup": { "source": "preset", "preset": "astra" },
90
+ "presets": {
91
+ "workspace": { "source": "workspace", "label": "Workspace default" },
92
+ "astra": {
93
+ "source": "persona",
94
+ "label": "Astra",
95
+ "persona": "gpt-6-astra-chat",
96
+ "reasoning": "low"
97
+ }
176
98
  }
177
99
  }
178
100
  ```
179
101
 
180
- `startup.preset` must name a key in `presets`. There are two kinds of preset:
181
-
182
- - A `workspace` preset resolves the workspace's `defaultPersona` each time it is applied.
183
- - A `persona` preset names a persona ID without an effort suffix. Its optional `reasoning` is one of `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max`, and defaults to the persona's own setting. Its optional `autoCompactThresholdTokens` is [described below](#compaction-thresholds).
184
-
185
- Every preset needs a non-empty `label`. Keys must be non-empty, without surrounding whitespace.
186
-
187
- The `/persona` menu depends on `presets`:
188
-
189
- - Omitted: all personas available in the session's workspace, with their own labels and default settings.
190
- - `{}`: nothing, and `/persona` is hidden from the command palette. Typing it replies that no presets are configured.
191
- - With entries: exactly those entries, in the object's order. Integer-like keys sort first, so use non-numeric keys to keep the order you wrote.
192
-
193
- Buttons show only labels, because a session does not record which preset was applied. `/status` reports the session's actual settings.
194
-
195
- Applying a preset changes the prompt, model, tools, reasoning, and other persona settings together, and keeps the conversation. It applies them once, so effort commands then change only reasoning, and applying the preset again restores its settings.
196
-
197
- An unavailable persona stays in the menu. Applying it, or a `reasoning` value the persona does not support, reports an error and changes no settings. The value must be in the persona's `allowedReasoningLevels` when that list is non-empty, and a model without reasoning accepts only `none`. A failing preset at `startup` fails the new session.
198
-
199
- A workspace selection works as in the TUI: an unavailable `defaultPersona` falls back to the first available persona, and its effort suffix skips these checks.
200
-
201
- Restart the runner after editing `startup` or `presets`. Recovery keeps a session's saved settings and does not reapply them. Reload keeps the session's settings if its persona still exists.
202
-
203
- ## Compaction thresholds
204
-
205
- A bot's optional `autoCompactThresholdTokens` sets a default for its sessions. A persona preset's optional field of the same name sets a saved session override when the preset is applied, including at startup. Both take a safe integer of at least 50,000 tokens.
102
+ If you omit `presets`, `/persona` offers every persona in the workspace. A preset changes model, tools, and reasoning together and keeps the conversation. `/new` returns to `startup`.
206
103
 
207
- A session uses its saved override first, then the bot default, the persona default, and finally the model's context window minus 16,384 tokens. The effective threshold is capped at that model-based limit. `/auto_compact` changes the saved override. Applying a persona or preset clears the previous override unless the preset sets a threshold, even when the persona stays the same.
104
+ ## Access
208
105
 
209
- The runner reads the bot default at startup and does not save it with the session. Recovered sessions use the current bot default and keep their saved override.
106
+ For a private bot, use both lists. `allowedUserIds` decides who can start work, and `allowedChatIds` decides which DMs and groups the bot talks in. Group IDs are usually negative. Telegram display names do not grant anything.
210
107
 
211
- Native subagents launched without a model use the session's effective threshold, as described in [subagents](subagents.md#automatic-compaction). Ephemeral threads use the persona's own default and ignore both the bot default and the session override.
108
+ In an allowed group, a message starts a turn only when it mentions the bot. The last 50 other messages are kept as context for the next turn, labeled with their sender, so add the bot only to groups whose conversation can be sent to the model.
212
109
 
213
- ## DMs, groups, and active work
214
-
215
- In a DM, ordinary text goes to the active session. If none is selected but the chat has exactly one session, Tau selects it. Otherwise the bot asks for `/new`.
216
-
217
- In an allowed group, a message starts a turn only when it mentions the bot's username. Other text and captions are kept as background context, labeled with their sender. At the next mention, Tau includes up to the 50 most recent kept messages since the last turn, and clears them once the turn is submitted.
218
-
219
- Group context can include attachment paths, audio transcripts, and processing errors. The model receives it as untrusted input.
110
+ ## Projects
220
111
 
221
- Text and transcribed audio either start or steer a turn. When the session is idle, the message starts a normal turn. When Tau is working, the message steers the running turn: the turn stops at its next safe point and continues with the new message. Further steering is batched as usual. Telegram has no command to queue a separate turn. Use `/interrupt` to stop instead of steering.
112
+ Each session works in a project:
222
113
 
223
- Tau does not report tool activity or lifecycle events. It sends assistant text, including several messages from one run, and keeps the typing indicator on during work. Long replies are split into parts. Notifications about failed, blocked, and unaccepted turns are kept until Telegram confirms delivery.
114
+ - A **repository project** clones one GitHub repository into a new workspace for each session. `workingDirectory` sets a subdirectory as the session's working directory.
115
+ - A **directory project** reuses one existing directory for all its sessions, so sessions from different chats can edit the same files at once. Tau never creates or removes the directory. Use an absolute path, because `~` is not expanded. Changing `directory` makes recovery of existing sessions fail.
116
+ - A **composite project** places two or more repository projects in one workspace, under a directory per project ID. Tau writes an `AGENTS.md` listing the members and any `instructions`. Configuration comes from the workspace root, and members' `.tau/config.json` files are not merged.
224
117
 
225
- ## Attachments and audio
118
+ ```json
119
+ {
120
+ "projects": {
121
+ "web": { "repo": "acme/web", "ref": "main" },
122
+ "api": { "repo": "acme/api" },
123
+ "notes": { "directory": "/srv/tau/notes" },
124
+ "platform": {
125
+ "projectIds": ["web", "api"],
126
+ "instructions": "Keep shared contracts synchronized."
127
+ }
128
+ }
129
+ }
130
+ ```
226
131
 
227
- The bot accepts any documents, photos, videos, animations, video notes, audio files, and voice notes. The agent receives the file paths in the execution environment, cleaned-up filenames, MIME types, sizes, and captions. Files are never run on receipt.
132
+ If a bot allows one project, Tau selects it automatically. Otherwise the chat picks one with `/use_<projectId>` or gets `defaultProjectId`. Telegram allows 100 commands per bot, which leaves room for 90 project commands. Relative `workspaceRoot` and `directory` paths resolve from the config file's directory.
228
133
 
229
- Limits are 32 attachments per turn, 20 MiB per file, and 100 MiB per turn. Downloads are limited even when Telegram does not report a size. Files that are too large or fail to download are skipped with a warning.
134
+ Sessions read `~/.config/tau` and the `.tau` directories above the workspace as usual. A project's `.tau/config.json` can start [MCP servers](mcp.md) on the runner machine, so review what you add as a project.
230
135
 
231
- Sending a file only queues it, and its caption is kept as metadata. The next text or voice message starts or steers a turn, with one hidden `<system>` block per attachment. Only voice notes are transcribed, up to 20 minutes long. Audio files and audio documents arrive without a transcript. The original voice file stays available even if transcription fails. Transcripts of DMs, and of group messages that mention the bot, are echoed before submission.
136
+ ### Workspace lifecycle
232
137
 
233
- Files are stored in the execution environment's temporary directory, so system cleanup can remove them. Queued files and group context are cleared on shutdown. Treat file contents and metadata as untrusted.
138
+ Tau prepares a repository or composite workspace once per session, using a bare cache in `<workspaceRoot>-repo-cache`. Restarting the runner reuses the workspace as it is, so configuration changes apply only to workspaces prepared later. `/new` and closing a session delete the workspace, and Tau does not commit or push anything first. If a workspace is missing at recovery, Tau rebuilds it from the current configuration.
234
139
 
235
- Voice transcription uses Gemini with `GEMINI_API_KEY`, or else `apiKeys.google`. Optional spelling hints use GPT-6 Luna (reasoning disabled) with OpenAI credentials. The session's [`speech.vocabulary`](config-reference.md#speech) terms, then the runner's global terms, precede extracted hints and work without OpenAI credentials or conversation context. Without a selected session, Tau does not download or transcribe audio. Transcription fails if the session is not ready. Gemini transcribes verbatim with `gemini-3.5-transcribe`, using English (`en-US`) and Finnish (`fi-FI`) hints, and Tau tries to delete the uploaded file afterward. Receiving files needs no Google key. See [credentials](credentials.md).
140
+ ### Provision hooks
236
141
 
237
- `/tts_on` rewrites text with `gpt-6-luna` (reasoning disabled) and generates speech with Eleven v4 Turbo. It requires both OpenAI and ElevenLabs credentials and runner `ffmpeg` with Opus. Voice notes use brisk delivery and 1.15× speed. See [`speech` configuration](config-reference.md#speech) for default and custom voice selection. Source and rewritten text are limited to 10,000 Unicode characters each, and audio to 32 MiB. Rewriting times out after one minute and the whole job after five. Jobs are not saved. On failure, the bot sends `voice response failed. please try again.`; the text reply is unaffected and details go to the logs.
142
+ A repository can include an executable `.tau/scripts/provision` with a shebang. Tau runs it in the session's working directory in new and rebuilt workspaces, without blocking chat. A failure is reported to the chat and leaves the session usable. Directory projects do not run hooks.
238
143
 
239
- ## Command client tools
144
+ ## Chat commands
240
145
 
241
- Telegram offers [photo, video, audio, and document delivery tools](tools.md#sending-files-to-telegram), plus the command tools selected by the workspace. Global `clientTools` define the commands, and the workspace's nearest `enabledClientTools` selects which ones are offered. An empty list turns off configured tools, but not the delivery tools.
146
+ | Command | Behavior |
147
+ | --- | --- |
148
+ | `/new` | Replace the active session using the preferred project. |
149
+ | `/use_<projectId>` | Select the project for future `/new` sessions. |
150
+ | `/status` | Show session state, project, model, reasoning, context use, and cost. |
151
+ | `/persona [key]` | Apply a persona or preset while idle, keeping the conversation. |
152
+ | `/effort [level]` | Set reasoning for future turns, also during a turn. |
153
+ | `/prompt [id]` | Add a saved prompt to the conversation without starting a turn. |
154
+ | `/auto_compact [tokens\|default]` | Show or set the compaction threshold. |
155
+ | `/compact` | Compact while idle. |
156
+ | `/interrupt` | Interrupt the running turn. |
157
+ | `/tts_on`, `/tts_off` | Turn voice replies on or off. |
242
158
 
243
- Command processes run on the runner machine with the runner's environment. Even though the workspace is on the same machine, they reach it only through the execution-environment API. Telegram does not offer the TUI's `diff_review` or `prefill_input`.
159
+ `/persona`, `/effort`, and `/prompt` show buttons when sent alone. With a value they apply it directly, as in `/persona astra`, `/effort low`, or `/prompt release-summary`. A persona value is the preset key when the bot has `presets`, and otherwise the persona ID, never the button label. Values are case-sensitive.
244
160
 
245
- Tools are selected when the runner creates or reconnects a session's client. `/reload` does not change them. Restart the runner, or start a new session, after changing which command tools are selected. See [client tools](client-tools.md).
161
+ In groups, commands must mention the bot, as in `/status@tau_engineering_bot`.
246
162
 
247
- ## Persistence and restart behavior
163
+ A message sent while Tau is working steers the running turn. Telegram has no way to queue a separate turn, so wait or use `/interrupt` before starting something unrelated. Users do not see tool activity, and only the agent's text is sent. Tau tells the agent this at the start of each turn.
248
164
 
249
- Normal shutdown interrupts running work, waits for it to finish, and disconnects sessions. On restart, sessions reconnect with their conversation. A session interrupted while its workspace or Tau session was being created starts preparation again. A persistent-directory workspace is never reconstructed and must stay at its original path.
165
+ ## Files and voice
250
166
 
251
- If the connection drops after a message was sent to Tau, startup checks whether Tau accepted and finished it. Work still running can be interrupted until it finishes. If Tau never accepted the message, the user is asked to resend it. Failed or blocked results stay queued until they are delivered.
167
+ The bot accepts documents, photos, videos, and audio, up to 20 MiB per file, 100 MiB per turn, and 32 files per turn. Sending a file only queues it, and the next text or voice message starts a turn with the file paths. Files go to a temporary directory on the runner machine, where system cleanup can remove them.
252
168
 
253
- Restart does not resend earlier replies. It clears voice jobs and pending retries, but keeps pending notifications.
169
+ Voice notes up to 20 minutes are transcribed with `ELEVENLABS_API_KEY`. With `speechCleanupStyle: "default"`, the transcript is also cleaned up as in the [TUI](tui.md#speech), which needs OpenAI credentials, and the raw transcript is used if cleanup fails. `/tts_on` needs OpenAI and ElevenLabs keys and `ffmpeg` with Opus on the runner. See [models and credentials](models-and-credentials.md).
254
170
 
255
- If a failed session still has submitted work with an unknown result, Tau can reconnect to find out. Other failed sessions stay visible with their original error until their chat replaces or closes them. Do not edit runner state files to force recovery.
171
+ The agent can send files back with these tools, which take `{ path, caption? }`:
256
172
 
257
- ## Verify a runner safely
173
+ | Tool | Delivery | Files | Maximum size |
174
+ | --------------------------- | --------------- | --------- | ------------ |
175
+ | `send_photo_to_telegram` | In-chat photo | JPEG, PNG | 10 MB |
176
+ | `send_video_to_telegram` | Playable video | MPEG4 | 50 MB |
177
+ | `send_audio_to_telegram` | Audio player | MP3, M4A | 50 MB |
178
+ | `send_document_to_telegram` | File attachment | Any | 50 MB |
258
179
 
259
- 1. Run `--check-config`, without showing the file in a shared terminal.
260
- 2. Confirm the runner user can execute `tau`, `git`, and `gh`, and that `gh` can access each repository.
261
- 3. Start the runner and watch for config, polling, command-sync, cache, checkout, and recovery errors. Successful startup prints `tau telegram running`.
262
- 4. In an allowed DM, run `/status`, select a project if needed, then run `/new`.
263
- 5. Send a small, non-sensitive prompt and confirm the reply.
264
- 6. If groups are enabled, check that a message without a mention gets no reply and a command with a mention works.
265
- 7. If there is a provision hook, wait for it to finish or report a failure before relying on what it installs.
266
- 8. Restart the runner normally and use `/status` to confirm the session recovered without resending old replies.
180
+ Calls are not retried, because an interrupted upload may already have arrived. Tau does not convert files, so send unsupported media as a document. The workspace's `enabledClientTools` selects any configured [command tools](client-tools.md), and these run on the runner machine.
267
181
 
268
- Do not verify bot tokens, provider keys, Access secrets, transcript contents, or runner state by printing them.
182
+ ## Bot environments
269
183
 
270
- ## Troubleshooting
184
+ Bots in one runner can use different environment variables, for example to give each bot its own GitHub account:
271
185
 
272
- **The runner rejects its config.** Startup errors name every invalid bot or project field. Check the required `bots` and `projects` objects, exact project IDs, positive numbers, allowed project IDs, startup sources, preset references, and that each project defines exactly one of `repo`, `directory`, or `projectIds`. Check the JSON syntax without printing the file, which contains bot tokens, and restart the runner after fixing it. Relative paths in the file resolve from its directory.
186
+ ```json
187
+ {
188
+ "env": {
189
+ "GH_CONFIG_DIR": "/var/lib/assistant-github/gh",
190
+ "GIT_CONFIG_GLOBAL": "/var/lib/assistant-github/gitconfig",
191
+ "GH_TOKEN": "",
192
+ "GITHUB_TOKEN": ""
193
+ }
194
+ }
195
+ ```
273
196
 
274
- **The bot ignores a DM.** If `allowedChatIds` is set, the DM's chat ID must be listed. If `allowedUserIds` is set, the sender's user ID must be listed too.
197
+ Sign in with `GH_CONFIG_DIR=/var/lib/assistant-github/gh gh auth login`. The Git config needs a commit identity and the credential helper:
275
198
 
276
- **The bot ignores a group.** The group must be in `allowedChatIds`, the message must mention the bot (commands in one of the accepted forms), and the sender must be in `allowedUserIds` when that list is set. Messages that do not mention the bot can still become context for the next turn, so make sure that is acceptable before allowing more groups.
199
+ ```ini
200
+ [credential "https://github.com"]
201
+ helper =
202
+ helper = !gh auth git-credential
203
+ [user]
204
+ name = Assistant
205
+ email = assistant@example.com
206
+ ```
277
207
 
278
- **`/new` asks for a project, or uses the wrong one.** Set `defaultProjectId`, allow only one project, or run `/use_<projectId>` first. `/use_<projectId>` affects only future `/new` sessions; `/status` shows the current session's project and the saved choice separately.
208
+ The empty tokens stop `gh` from using a token in the runner's environment. The map applies to the bot's repository commands and to new sessions, and values are used literally, so use absolute paths. Tau saves the map in each session, so keep secrets out of it. It does not isolate bots from each other, because they share one OS user. Use separate runners under separate accounts when bots must be isolated.
279
209
 
280
- **A message sent during work changes direction.** While a turn is running, a new message steers it instead of waiting in a queue. Wait for the turn to finish before sending an unrelated task, or use `/interrupt` first.
210
+ A saved session whose map differs from the bot's current `env` fails recovery. Restore the old `env`, or start over with `/new`, which deletes a repository workspace, so save unfinished work first.
281
211
 
282
- **Audio or an attachment fails.** The reply or runner log names the step that failed: download, saving, format, or transcription. Check that Telegram can deliver the file to the bot, the type is supported, the runner can write to its temporary directory, and Gemini accepts the media type. Transcription needs `GEMINI_API_KEY` or `apiKeys.google` for the runner process; restart the runner after setting it. Changing a workspace's environment does not affect the runner. Do not log media or transcripts to debug this.
212
+ ## Restarts
283
213
 
284
- **Voice replies fail.** `/tts_on` needs OpenAI and ElevenLabs credentials and `ffmpeg` with Opus on the runner. Check [`speech.voiceId`](config-reference.md#speech) if a configured voice is unavailable.
214
+ A normal shutdown interrupts running work and disconnects sessions. After a restart, sessions reconnect with their conversation, and unsent failure notices are delivered. A message that Tau never accepted is reported so you can resend it. Do not edit the runner's state files, `<workspaceRoot>-sessions.json` and `<workspaceRoot>-project-preferences.json`.
285
215
 
286
- **Replies or notifications arrive late or not at all.** Each outgoing message part has a deadline and is retried twice on retryable errors. Tau honors Telegram's `retry_after`, and later notifications in a chat wait for earlier ones. Long replies are split, so only a later part may have failed. The runner log shows the method, status, retry class, attempt, chat, session, and message. Fix network, rate-limit, token, or chat permission problems on the runner. Before resending by hand, check which parts arrived. A delivery failure is not a failed turn, and notifications about failed or blocked turns are sent again after a restart. Never fix delivery by editing runner state.
216
+ ## When the bot ignores you
287
217
 
288
- **A command client tool is missing.** Check global `clientTools`, the workspace's `enabledClientTools`, and whether the session's client was created after the change. Telegram never offers the TUI's tools.
218
+ - **In a DM:** check that the chat and the sender are in the allowlists that are set.
219
+ - **In a group:** the group must be in `allowedChatIds`, the message must mention the bot, and the sender must be in `allowedUserIds` when that is set.
220
+ - **`/new` asks for a project:** set `defaultProjectId` or run `/use_<projectId>`.
289
221
 
290
- For workspace preparation, provisioning, and recovery problems, see [Telegram projects and workspaces](telegram-projects.md#troubleshooting).
222
+ The runner log names the failing step for repository preparation, attachments, and delivery.