telecoder 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/.env.example +142 -130
  2. package/CHANGELOG.md +683 -2
  3. package/README.md +36 -32
  4. package/dist/audio/transcribe.js +0 -9
  5. package/dist/bin/mcp-server.js +46 -61
  6. package/dist/bot/bot.js +162 -181
  7. package/dist/bot/command-catalog.js +263 -0
  8. package/dist/bot/deleted-threads.js +103 -0
  9. package/dist/bot/file-access.js +35 -26
  10. package/dist/bot/handlers/album.handler.js +128 -0
  11. package/dist/bot/handlers/{fork.handler.js → branch.handler.js} +267 -280
  12. package/dist/bot/handlers/command/access.js +1 -1
  13. package/dist/bot/handlers/command/admin.js +86 -110
  14. package/dist/bot/handlers/command/all-view.js +33 -0
  15. package/dist/bot/handlers/command/auto-approve.js +3 -3
  16. package/dist/bot/handlers/command/background.js +37 -0
  17. package/dist/bot/handlers/command/botname.js +76 -0
  18. package/dist/bot/handlers/command/btw.js +20 -69
  19. package/dist/bot/handlers/command/cleanup.js +329 -0
  20. package/dist/bot/handlers/command/model.js +40 -119
  21. package/dist/bot/handlers/command/prefs-scope.js +255 -90
  22. package/dist/bot/handlers/command/project.js +31 -109
  23. package/dist/bot/handlers/command/resume.js +8 -4
  24. package/dist/bot/handlers/command/session.js +74 -213
  25. package/dist/bot/handlers/command/settings.js +92 -447
  26. package/dist/bot/handlers/command/shared.js +32 -35
  27. package/dist/bot/handlers/command/tasks.js +263 -95
  28. package/dist/bot/handlers/command/thread.js +128 -0
  29. package/dist/bot/handlers/command/topic-store.js +14 -53
  30. package/dist/bot/handlers/command/topic.js +8 -61
  31. package/dist/bot/handlers/command/{cost.js → usage.js} +32 -59
  32. package/dist/bot/handlers/command-fallback.js +179 -0
  33. package/dist/bot/handlers/command.handler.js +96 -422
  34. package/dist/bot/handlers/{schedule.handler.js → loop.handler.js} +159 -73
  35. package/dist/bot/handlers/media-fallback.js +12 -7
  36. package/dist/bot/handlers/message/replies.js +10 -87
  37. package/dist/bot/handlers/message/shared.js +9 -31
  38. package/dist/bot/handlers/message/turn-notify.js +15 -49
  39. package/dist/bot/handlers/message/turn-runner.js +18 -103
  40. package/dist/bot/handlers/message.handler.js +59 -52
  41. package/dist/bot/handlers/newbot.handler.js +13 -4
  42. package/dist/bot/handlers/photo.handler.js +88 -129
  43. package/dist/bot/handlers/prompts.handler.js +11 -11
  44. package/dist/bot/handlers/running-note.js +2 -2
  45. package/dist/bot/handlers/session-guard.js +4 -4
  46. package/dist/bot/handlers/suggestion.handler.js +2 -2
  47. package/dist/bot/handlers/tree.handler.js +20 -20
  48. package/dist/bot/handlers/voice.handler.js +23 -85
  49. package/dist/bot/kept-threads.js +51 -0
  50. package/dist/bot/middleware/album-collector.js +69 -0
  51. package/dist/bot/middleware/auth.middleware.js +1 -1
  52. package/dist/bot/middleware/group-mention.middleware.js +11 -5
  53. package/dist/bot/middleware/queued-messages.js +143 -32
  54. package/dist/bot/middleware/stale-filter.js +0 -22
  55. package/dist/build-info.json +5 -5
  56. package/dist/claude/ask-user-form.js +517 -0
  57. package/dist/claude/ask-user.js +94 -26
  58. package/dist/claude/auto-topic-haiku.js +17 -0
  59. package/dist/claude/available-commands.js +22 -19
  60. package/dist/claude/background-hint.js +91 -0
  61. package/dist/claude/{fork-tree.js → branch-tree.js} +9 -9
  62. package/dist/claude/carry-over.js +0 -2
  63. package/dist/claude/ccr-shim.js +12 -10
  64. package/dist/claude/claude-auth.js +6 -10
  65. package/dist/claude/command-parser.js +49 -43
  66. package/dist/claude/cost-overlay-scraper.js +7 -2
  67. package/dist/claude/effort-level.js +5 -0
  68. package/dist/claude/enabled-plugins.js +12 -16
  69. package/dist/claude/in-flight-tracker.js +21 -0
  70. package/dist/claude/mcp-bridge.js +86 -58
  71. package/dist/claude/memory-guard.js +400 -0
  72. package/dist/claude/message-offsets.js +5 -5
  73. package/dist/claude/modal-relay.js +401 -34
  74. package/dist/claude/model-catalog.js +20 -3
  75. package/dist/claude/monitor-relay.js +130 -15
  76. package/dist/claude/native-commands.js +40 -0
  77. package/dist/claude/{pending-forks.js → pending-branches.js} +26 -26
  78. package/dist/claude/permission-gate.js +11 -10
  79. package/dist/claude/permission-mode.js +19 -45
  80. package/dist/claude/prewarm.js +70 -0
  81. package/dist/claude/pty-idle-reaper.js +96 -0
  82. package/dist/claude/pty-provider.js +473 -188
  83. package/dist/claude/pty-spawn-config.js +79 -32
  84. package/dist/claude/pty-watch.js +201 -0
  85. package/dist/claude/request-queue.js +7 -35
  86. package/dist/claude/rewind.js +111 -0
  87. package/dist/claude/scheduled-runner.js +1 -3
  88. package/dist/claude/scheduler.js +6 -2
  89. package/dist/claude/scope-guard.js +8 -3
  90. package/dist/claude/screen-marks.js +83 -0
  91. package/dist/claude/screen-render.js +96 -0
  92. package/dist/claude/session-history.js +4 -2
  93. package/dist/claude/session-jsonl.js +162 -15
  94. package/dist/claude/session-manager.js +29 -8
  95. package/dist/claude/session-move.js +70 -0
  96. package/dist/claude/shell-mode-gate.js +60 -0
  97. package/dist/claude/side-question.js +20 -17
  98. package/dist/claude/stage-images.js +5 -5
  99. package/dist/claude/tasks-overlay-scraper.js +143 -20
  100. package/dist/claude/thread-judge-haiku.js +88 -0
  101. package/dist/claude/tip-scraper.js +3 -4
  102. package/dist/claude/tui-modal.js +272 -27
  103. package/dist/claude/tui-state.js +74 -2
  104. package/dist/claude/turn-end.js +15 -1
  105. package/dist/claude/turn-prose.js +1 -1
  106. package/dist/claude/typed-answer.js +104 -0
  107. package/dist/claude/update-banner-relay.js +1 -1
  108. package/dist/cli/commands/doctor.js +48 -15
  109. package/dist/cli/commands/help.js +11 -2
  110. package/dist/cli/commands/init.js +16 -13
  111. package/dist/cli/commands/service.js +40 -8
  112. package/dist/cli/commands/start.js +10 -0
  113. package/dist/cli/commands/watch.js +322 -0
  114. package/dist/cli/dispatch.js +5 -0
  115. package/dist/cli/init/env-file.js +1 -1
  116. package/dist/cli/init/flow.js +114 -47
  117. package/dist/cli/init/prompter.js +8 -0
  118. package/dist/cli/init/telegram.js +35 -9
  119. package/dist/cli/service/render.js +3 -3
  120. package/dist/config.js +156 -131
  121. package/dist/index.js +107 -31
  122. package/dist/launcher.js +34 -7
  123. package/dist/providers/ccr-introspect.js +1 -8
  124. package/dist/providers/ccr-provider.js +19 -20
  125. package/dist/providers/claude-provider.js +4 -57
  126. package/dist/providers/prefs-sync.js +16 -59
  127. package/dist/providers/provider-router.js +24 -23
  128. package/dist/providers/spawn-settings.js +45 -0
  129. package/dist/providers/user-preferences.js +127 -19
  130. package/dist/restart-when-idle.js +27 -7
  131. package/dist/startup/auto-continue.js +2 -2
  132. package/dist/startup/auto-resume.js +3 -15
  133. package/dist/startup/notices.js +1 -1
  134. package/dist/startup/verify-token.js +4 -4
  135. package/dist/telegram/action-logger.js +3 -165
  136. package/dist/telegram/background-activity-card.js +1 -1
  137. package/dist/telegram/botname-settings.js +71 -125
  138. package/dist/telegram/client-options.js +6 -7
  139. package/dist/telegram/force-reply-tracker.js +55 -16
  140. package/dist/telegram/message-sender.js +92 -360
  141. package/dist/telegram/prompt-label.js +11 -5
  142. package/dist/telegram/streaming-turn.js +5 -7
  143. package/dist/telegram/table-lists.js +56 -0
  144. package/dist/telegram/task-list.js +4 -4
  145. package/dist/telegram/task-tracker.js +45 -126
  146. package/dist/telegram/terminal-renderer.js +1 -5
  147. package/dist/telegram/thread-titles.js +74 -2
  148. package/dist/telegram/threads-setup.js +1 -1
  149. package/dist/utils/admins.js +2 -2
  150. package/dist/utils/bot-icon.js +248 -0
  151. package/dist/utils/bot-token.js +8 -5
  152. package/dist/utils/build-info.js +3 -3
  153. package/dist/utils/caffeinate.js +6 -3
  154. package/dist/utils/claude-env.js +0 -1
  155. package/dist/utils/claude-version.js +2 -2
  156. package/dist/utils/config-home.js +3 -3
  157. package/dist/utils/download.js +41 -15
  158. package/dist/utils/exit-codes.js +11 -0
  159. package/dist/utils/format.js +3 -6
  160. package/dist/utils/home-project.js +1 -1
  161. package/dist/utils/idle-restart.js +1 -1
  162. package/dist/utils/install-mode.js +1 -1
  163. package/dist/utils/instance-config.js +1 -1
  164. package/dist/utils/instances.js +1 -1
  165. package/dist/utils/keyed-settings.js +2 -2
  166. package/dist/utils/memory-pressure.js +60 -0
  167. package/dist/utils/npm-version.js +2 -2
  168. package/dist/utils/resolve-claude-bin.js +13 -24
  169. package/dist/utils/respawn-backoff.js +9 -0
  170. package/dist/utils/stale-launcher.js +1 -1
  171. package/dist/utils/systemd.js +8 -8
  172. package/dist/utils/telegram-proxy.js +72 -0
  173. package/dist/utils/uploads-dir.js +27 -0
  174. package/dist/utils/verbosity.js +8 -8
  175. package/dist/utils/version-check.js +5 -5
  176. package/package.json +3 -4
  177. package/dist/bot/handlers/command/media.js +0 -197
  178. package/dist/bot/handlers/command/streaming-mode.js +0 -16
  179. package/dist/bot/handlers/message/throttle.js +0 -49
  180. package/dist/claude/agent-watchdog.js +0 -162
  181. package/dist/claude/agent.js +0 -1458
  182. package/dist/claude/held-query.js +0 -190
  183. package/dist/claude/mcp-tools.js +0 -354
  184. package/dist/claude/sdk-permission-gate.js +0 -77
  185. package/dist/claude/session-cost.js +0 -41
  186. package/dist/claude/system-prompt.js +0 -162
  187. package/dist/providers/sdk-provider.js +0 -37
  188. package/dist/telegram/telegraph-settings.js +0 -31
  189. package/dist/telegram/telegraph.js +0 -453
  190. package/dist/telegram/terminal-settings.js +0 -25
  191. package/dist/tts/tts-settings.js +0 -62
  192. package/dist/tts/tts.js +0 -245
  193. package/dist/tts/voice-reply.js +0 -78
  194. package/dist/utils/debug-agent.js +0 -117
  195. package/dist/utils/debug-watchdog.js +0 -121
  196. package/dist/utils/project-data-dir.js +0 -33
  197. package/dist/utils/reasoning-summary.js +0 -12
package/.env.example CHANGED
@@ -24,8 +24,8 @@ ALLOWED_USER_IDS=123456789
24
24
  # none of it and behaves exactly the same whether or not you read this section.
25
25
  #
26
26
  # ADMIN_USER_IDS is the subset of ALLOWED_USER_IDS that may approve permission
27
- # prompts and run bot-lifecycle commands (/update, /restartbot, /rebuildbot)
28
- # and transport ones (/method, /provider, /ccr). Everyone else is a "guest":
27
+ # prompts and run bot-lifecycle commands (/botupdate, /botrestart, /botrebuild)
28
+ # and the backend one (/ccr). Everyone else is a "guest":
29
29
  # they can use the agent normally, but guarded commands wait on an admin.
30
30
  # Unset = every allowed user is an admin. Admins must also be in
31
31
  # ALLOWED_USER_IDS — the auth check runs first and would turn them away, so the
@@ -35,7 +35,7 @@ ALLOWED_USER_IDS=123456789
35
35
  # APPROVER_USER_IDS is the subset of ALLOWED_USER_IDS that may answer a
36
36
  # permission prompt without owning the bot. An approver is a guest everywhere
37
37
  # else — the charter judge still reads their messages, the gate still stops
38
- # their tool calls, /restartbot and /method still refuse them. They just stop
38
+ # their tool calls, /botrestart and /ccr still refuse them. They just stop
39
39
  # you being the only person who can unblock a prompt. Nobody approves their own
40
40
  # request: the buttons go to the admins plus every approver except whoever
41
41
  # asked. Needs ADMIN_USER_IDS set — without it everyone is already an admin.
@@ -78,7 +78,7 @@ ALLOWED_USER_IDS=123456789
78
78
  # Treat any reply to one of the bot's messages as addressing it, as it worked
79
79
  # before mentions were required. Off by default: replying is also how you quote
80
80
  # a message, so it is a poor signal of intent. Answers to the bot's own
81
- # ForceReply prompts (/project, /plan, /file, ...) always get through, since
81
+ # ForceReply prompts (/dir, /file) always get through, since
82
82
  # Telegram leaves nowhere to put a mention in those.
83
83
  # GROUP_REPLY_IS_MENTION=false
84
84
 
@@ -119,14 +119,14 @@ ALLOWED_USER_IDS=123456789
119
119
  # that file exists, and to a generated one naming the allowed roots otherwise.
120
120
  # CHARTER_FILE=/srv/shared/CHARTER.md
121
121
 
122
- # The gate is a PreToolUse hook on the `claude` CLI, so it only runs on the
123
- # PTY transport. Make PTY the default for chats that haven't picked one.
124
- # CLAUDE_METHOD_DEFAULT=pty
125
-
126
122
  # ── Claude ────────────────────────────────────────────────────
127
123
  # Anthropic API key (optional — leave empty to use Claude Max subscription)
128
124
  # ANTHROPIC_API_KEY=sk-ant-...
129
125
 
126
+ # A long-lived Claude token from `claude setup-token`, for a machine you won't
127
+ # sign in on. Used in place of the `claude` login.
128
+ # CLAUDE_CODE_OAUTH_TOKEN=sk-ant-oat01-...
129
+
130
130
  # Optional: explicit .env path (useful if you start the bot from another directory)
131
131
  # TELECODER_ENV_PATH=/absolute/path/to/telecoder/.env
132
132
 
@@ -136,50 +136,60 @@ ALLOWED_USER_IDS=123456789
136
136
  # TELECODER_ENV_PATH, TELECODER_INSTANCES_CONFIG, TELECODER_IPC_PORT,
137
137
  # TELECODER_PERMISSION_PROMPTS, TELECODER_ALLOW_NATIVE_SCHEDULING
138
138
 
139
- # Path to the Claude Code CLI executable
140
- # Default: "claude" (assumes it's in your PATH)
141
- # CLAUDE_EXECUTABLE_PATH=/home/username/.local/bin/claude
139
+ # The `claude` your chats run: CLAUDE_BIN, else the one on PATH (~/.local/bin
140
+ # is searched first). Set it when the CLI lives where the service can't see it.
141
+ # CLAUDE_BIN=/home/username/.local/bin/claude
142
142
 
143
- # Use SDK bundled executable for agent queries (true/false)
143
+ # The `claude` the quick Haiku side calls (topic names, the charter judge) run
144
+ # through: the copy bundled with the agent SDK, or CLAUDE_EXECUTABLE_PATH when
145
+ # the flag is false.
144
146
  # CLAUDE_USE_BUNDLED_EXECUTABLE=true
147
+ # CLAUDE_EXECUTABLE_PATH=/home/username/.local/bin/claude
145
148
 
146
- # SDK log level: off | basic | verbose | trace
147
- # CLAUDE_SDK_LOG_LEVEL=basic
148
-
149
- # Load user-level Claude settings (~/.claude/settings.json) into the bot's SDK
150
- # subprocess. Default false: bot runs in an isolated env, so your interactive
151
- # Claude Code plugins/MCP servers/hooks don't leak into the bot. Enable only if
152
- # you know what you're doing — extra MCP tools can trigger SDK tool-deferral
153
- # and break proactive MCP tool calls (e.g. auto-topic, send_file).
154
- # CLAUDE_SDK_LOAD_USER_SETTINGS=false
149
+ # Whether Claude starts with your own Claude Code setup, as it does in your
150
+ # terminal: ~/.claude (CLAUDE.md, skills, commands, agents, settings.json), your
151
+ # MCP servers, your plugins and your claude.ai connectors.
152
+ # auto yes, unless the bot has guests: they would otherwise work with your
153
+ # instructions, and with connectors signed in as you (default)
154
+ # on always
155
+ # off never: Claude knows the project and what the two settings below name
156
+ # CLAUDE_USER_SETUP=auto
155
157
 
156
158
  # Extra MCP servers for the bot's agent, as a path to a JSON file holding
157
159
  # {"mcpServers": {...}} in the same shape as ~/.claude.json. Merged into the
158
160
  # spawn config; the bot's own telecoder-tools always wins a name clash.
159
161
  #
160
- # This is the ONLY way to add one: the spawn passes --strict-mcp-config, so a
161
- # `claude mcp add` entry is stored and then ignored. Keep the file outside the
162
- # repo if it carries a token.
162
+ # Your own servers come with your setup (CLAUDE_USER_SETUP). This is for a
163
+ # server only the bot should have, and it is the only way to add one while your
164
+ # setup stays out: a `claude mcp add` entry is then stored and ignored. Keep
165
+ # the file outside the repo if it carries a token.
163
166
  # EXTRA_MCP_CONFIG=/home/you/.config/telecoder-mcp.json
164
167
 
165
168
  # Marketplace plugins to enable inside the bot's agent, comma-separated, as the
166
- # plugin@marketplace ids `claude plugin list` prints. Enabling a plugin in the
167
- # terminal is not enough on its own: that lands in ~/.claude/settings.json,
168
- # which neither transport reads, so the plugin's skills and commands are simply
169
- # missing in Telegram. Naming it here is what brings it across.
169
+ # plugin@marketplace ids `claude plugin list` prints. A plugin you enabled in
170
+ # the terminal sits in ~/.claude/settings.json and comes with your setup
171
+ # (CLAUDE_USER_SETUP). This is for a plugin only the bot should have, or for
172
+ # bringing one across while your setup stays out.
170
173
  # CLAUDE_PLUGINS=frontend-design@claude-plugins-official
171
174
 
172
- # Append a safe reasoning summary to each response (true/false)
173
- # CLAUDE_REASONING_SUMMARY=true
175
+ # Claude Code's own scheduling tools (CronCreate, ScheduleWakeup, RemoteTrigger)
176
+ # are blocked: what they schedule fires outside the chat and never reaches
177
+ # Telegram. /loop and the bot's own tools take their place. 1 leaves the
178
+ # built-ins enabled.
179
+ # TELECODER_ALLOW_NATIVE_SCHEDULING=1
174
180
 
175
- # Bot personality name used in the system prompt
176
- # BOT_NAME=TeleCoder
181
+ # The port on 127.0.0.1 where the bot listens for Claude Code's hooks and its
182
+ # own MCP tools. Unset, a free port is picked; leave it that way unless
183
+ # something has to know the port. Several bots in one launcher can't share one.
184
+ # TELECODER_IPC_PORT=47821
177
185
 
178
- # Bot run mode (used by /restartbot and /botstatus)
179
- # BOT_MODE=prod
186
+ # The bot's name: what it calls itself in the system prompt and its messages,
187
+ # and the display name it sets in Telegram at startup when this is given.
188
+ # Unset, the name chosen in BotFather is kept. /botname in the chat wins over this.
189
+ # BOT_NAME=TeleCoder
180
190
 
181
191
  # ── Workspace ─────────────────────────────────────────────────
182
- # Root directory shown in /project picker
192
+ # Root directory shown in /dir picker
183
193
  # Default: $HOME
184
194
  # WORKSPACE_DIR=/home/username/projects
185
195
 
@@ -188,33 +198,20 @@ ALLOWED_USER_IDS=123456789
188
198
  # instances.json, which /newbot does. Absolute, or relative to WORKSPACE_DIR.
189
199
  # HOME_PROJECT=my-project
190
200
 
191
- # ── Response Behavior ─────────────────────────────────────────
192
- # "streaming" = live-updating messages, "wait" = send when complete
193
- STREAMING_MODE=streaming
194
-
195
- # Debounce interval (ms) for streaming message edits
196
- STREAMING_DEBOUNCE_MS=500
197
-
198
- # Max characters per message chunk (Telegram limit is 4096)
199
- MAX_MESSAGE_LENGTH=4096
200
-
201
- # ── Telegraph (Instant View) ─────────────────────────────────
202
- # Off by default. When enabled, long responses (>2500 chars) are also
203
- # published to telegra.ph and linked as an Instant View page, as are /handoff
204
- # notes, the full action log, and files sent with /telegraph <path>.
205
- # Telegraph pages are PUBLIC: anyone with the link can read them, and they
206
- # can't be deleted. Leave this off if replies may contain anything private.
207
- # When disabled, long responses are sent in full as chunked messages.
208
- TELEGRAPH_ENABLED=false
209
-
210
- # ── Dangerous Mode ────────────────────────────────────────────
211
- # Auto-approve all Claude tool permissions (use with caution!)
212
- DANGEROUS_MODE=false
201
+ # ── Network ───────────────────────────────────────────────────
202
+ # An HTTP or HTTPS proxy for the bot's requests to Telegram, for a network
203
+ # where Telegram is blocked. SOCKS proxies aren't supported. Unset, HTTPS_PROXY
204
+ # or HTTP_PROXY is used when the environment has one. Files you send the bot
205
+ # are fetched through it too, and `telecoder init` and `telecoder doctor --live`
206
+ # reach Telegram through it.
207
+ # TELEGRAM_PROXY_URL=http://127.0.0.1:8080
213
208
 
214
- # Max iterations for /loop command
215
- MAX_LOOP_ITERATIONS=5
209
+ # ── Response Behavior ─────────────────────────────────────────
210
+ # The longest one message of a reply may be, in characters; a longer reply is
211
+ # split into several (default: 4000, Telegram's own limit is 4096)
212
+ MAX_MESSAGE_LENGTH=4000
216
213
 
217
- # Auto-restore session on /restartbot and /rebuildbot (true/false)
214
+ # Auto-restore session on /botrestart and /botrebuild (true/false)
218
215
  # Default: false (shows manual Continue/Resume buttons instead)
219
216
  AUTO_RESTORE_SESSION=false
220
217
 
@@ -224,6 +221,45 @@ AUTO_RESTORE_SESSION=false
224
221
  # Raise it if intensive turns legitimately hit the cap.
225
222
  # CLAUDE_PTY_HARD_TIMEOUT_MS=7200000
226
223
 
224
+ # ── PTY idle timeout ──────────────────────────────────────────
225
+ # A PTY session keeps its claude process (a few hundred MB) between turns.
226
+ # One idle this long is ended; the next message resumes the conversation in
227
+ # a new one. Never while a turn, background task or background shell runs.
228
+ # Also cleans up after threads deleted by hand. Default 3600000 = 1 h; 0 keeps
229
+ # them until a restart.
230
+ # CLAUDE_PTY_IDLE_TIMEOUT_MS=3600000
231
+
232
+ # ── telecoder watch ───────────────────────────────────────────
233
+ # Serve each chat's live Claude Code screen, read-only, for the
234
+ # "telecoder watch" command. The socket is in ~/.telecoder/watch and only this
235
+ # user can open it. false turns it off.
236
+ # PTY_WATCH=true
237
+
238
+ # ── Early start ───────────────────────────────────────────────
239
+ # Start a chat's claude as soon as its conversation is chosen (/dir,
240
+ # /clear, /resume), so the first message doesn't wait for Claude Code to
241
+ # start. Skipped silently when memory is under the guard's floor below; one
242
+ # nobody uses is ended by the idle timeout. false starts it on the first
243
+ # message instead.
244
+ # PREWARM_CLAUDE=true
245
+
246
+ # ── Memory guard ──────────────────────────────────────────────
247
+ # Before a message starts a new claude for a chat (a new chat or thread,
248
+ # or one whose claude was ended), the machine's available memory is checked.
249
+ # Under MEMORY_GUARD_MIN_AVAILABLE_MB, claudes idle longer than
250
+ # MEMORY_GUARD_REAP_IDLE_MS are ended first; if that still leaves too little,
251
+ # the chat is asked: start anyway, end the longest-idle claude first, or drop
252
+ # the message. A message to a running claude never asks. A claude let through
253
+ # in the last half minute counts as a few hundred MB spent, so two threads
254
+ # started together can't both slip past. "auto" is a quarter of RAM, at least
255
+ # 1024 MB. 0 turns it off.
256
+ # MEMORY_GUARD_MIN_AVAILABLE_MB=auto
257
+ # MEMORY_GUARD_REAP_IDLE_MS=300000
258
+ # Swap in use above this many MB also counts as tight. Off (0) by default:
259
+ # swap stays occupied long after the pressure passes, so this nags on a box
260
+ # that swaps at all.
261
+ # MEMORY_GUARD_MAX_SWAP_USED_MB=0
262
+
227
263
  # ── Question timeout ──────────────────────────────────────────
228
264
  # How long a question the agent asks in the chat waits for an answer: the
229
265
  # buttons of telecoder_ask_user, a telecoder_poll_user poll, a Claude Code
@@ -239,7 +275,7 @@ AUTO_RESTORE_SESSION=false
239
275
  # Requires: a Groq API key
240
276
  # Leave empty to disable voice message support
241
277
 
242
- # Enable voice transcription + /transcribe (set false to disable)
278
+ # Enable voice notes (set false to disable)
243
279
  TRANSCRIBE_ENABLED=true
244
280
 
245
281
  # Groq API key for Whisper transcription
@@ -258,50 +294,42 @@ VOICE_LANGUAGE=en
258
294
  # Transcription timeout (ms)
259
295
  VOICE_TIMEOUT_MS=60000
260
296
 
261
- # /transcribe: send .txt file if transcript exceeds this many characters
262
- # TRANSCRIBE_FILE_THRESHOLD_CHARS=4000
263
-
264
- # ── Text-to-Speech ───────────────────────────────────────────
265
- # Toggle per-chat with /tts command
266
-
267
- # Enable /tts voice replies (set false to disable)
268
- TTS_ENABLED=true
269
-
270
- # TTS provider: "groq" (Groq Orpheus, default) or "openai" (OpenAI TTS)
271
- # Groq reuses GROQ_API_KEY above; OpenAI requires OPENAI_API_KEY below
272
- TTS_PROVIDER=groq
273
-
274
- # OpenAI API key (only needed when TTS_PROVIDER=openai)
275
- # OPENAI_API_KEY=sk-...
276
-
277
- # OpenAI TTS model (only used with TTS_PROVIDER=openai):
278
- # gpt-4o-mini-tts (newest, supports instructions), tts-1, tts-1-hd
279
- TTS_MODEL=gpt-4o-mini-tts
280
-
281
- # Voice name:
282
- # groq voices: autumn, diana, hannah, austin, daniel, troy
283
- # openai voices: alloy, ash, ballad, coral, echo, fable, nova, onyx, sage, shimmer, verse, marin, cedar
284
- # Default: troy (groq) or coral (openai)
285
- TTS_VOICE=troy
286
-
287
- # Tone instructions (gpt-4o-mini-tts only)
288
- TTS_INSTRUCTIONS="Speak in a friendly, natural conversational tone."
289
-
290
- # Speech speed (0.25 to 4.0)
291
- TTS_SPEED=1.5
292
-
293
- # Max characters to send to TTS (longer responses skip voice reply)
294
- TTS_MAX_CHARS=4096
295
-
296
- # Audio format: opus (recommended for Telegram voice notes), mp3, wav, flac, aac
297
- TTS_RESPONSE_FORMAT=opus
298
-
299
- # Enable terminal-style UI by default (animated spinners, tool status)
300
- TERMINAL_UI_DEFAULT=false
301
-
302
- # Terminal UI verbose: show full commands, file paths, and URLs without truncation.
303
- # Also increases session restore previews from 100/200 to 1000 chars.
304
- # TERMINAL_UI_VERBOSE=true
297
+ # ── Replies and notifications ─────────────────────────────────
298
+ # The /verbosity tier for chats that haven't picked one: quiet, normal,
299
+ # verbose or debug.
300
+ # VERBOSITY_DEFAULT=normal
301
+
302
+ # The footer that closes every reply (project, effort, model, context and
303
+ # the topic), for chats that haven't used /footer. Sent silently. The
304
+ # last-prompts and claude --resume lines stay opt-in through /footer.
305
+ STATUS_LINE_DEFAULT=true
306
+
307
+ # Show a tool's full input in the live status message — the whole Bash command,
308
+ # the full file path or URL — instead of a shortened one, whatever the
309
+ # /verbosity tier (which turns it on from verbose up). Was TERMINAL_UI_VERBOSE.
310
+ # FULL_TOOL_INPUTS=true
311
+
312
+ # Show the context-use line after each turn (a bar, the percentage, tokens used
313
+ # and turns), whatever the /verbosity tier. Unset, the tier decides, and shows
314
+ # it from verbose up. It closes the footer when that's on.
315
+ # CONTEXT_SHOW_USAGE=true
316
+
317
+ # Say so in the chat when Claude Code compacts the conversation by itself.
318
+ # Unset, the tier decides, and every tier says so; false turns the notice off.
319
+ # CONTEXT_NOTIFY_COMPACTION=false
320
+
321
+ # Predicted next-prompt buttons under each reply, for chats that haven't used
322
+ # /suggestions. Off by default: each suggestion is an extra, speculative call,
323
+ # and Claude Code doesn't offer them on every account. Takes effect when a
324
+ # chat's claude next starts.
325
+ # PROMPT_SUGGESTIONS_DEFAULT=false
326
+
327
+ # After a turn that took at least NOTIFICATION_THRESHOLD_SECONDS, send a short
328
+ # "Done (1m 12s)" message, so that Telegram notifies you. The quiet /verbosity
329
+ # tier leaves it out. A background task that ran at least that long also
330
+ # notifies when it ends; a shorter one is noted silently, unless it failed.
331
+ # NOTIFICATION_ENABLED=true
332
+ # NOTIFICATION_THRESHOLD_SECONDS=60
305
333
 
306
334
  # ── Message Batching ──────────────────────────────────────────
307
335
  # Telegram splits a long paste into several messages; combine them back into a
@@ -310,35 +338,23 @@ TERMINAL_UI_DEFAULT=false
310
338
  # 0 = disabled.
311
339
  # MESSAGE_BATCH_TIMEOUT_MS=1500
312
340
 
313
- # ── Cancel Behaviour ──────────────────────────────────────────
314
- # Auto-cancel the running query when a new message arrives, instead of
315
- # queueing it behind the turn already in flight.
316
- # CANCEL_ON_NEW_MESSAGE=false
317
-
318
- # ── Agent Watchdog ────────────────────────────────────────────
319
- # Auto-abort queries that appear stuck. Set to 0 to disable.
320
- # Silence timeout: no messages at all from the agent (default: 180000 = 3 min)
321
- # AGENT_SILENCE_TIMEOUT_MS=180000
322
- # Stale tool timeout: heartbeats arrive but no meaningful progress (default: 180000 = 3 min)
323
- # AGENT_STALE_TOOL_TIMEOUT_MS=180000
324
-
325
- # Update the Telegram bot display name to include the active project (true/false)
326
- # e.g. "TeleCoder | myproject" — useful when running multiple bot instances
327
- DYNAMIC_BOT_NAME=false
328
-
329
341
  # Fire a parallel Haiku side-call on every user message to derive a 1-4 word
330
- # topic label, independent of the main agent. Deferral-immune (bypasses
331
- # settingSources and tools entirely). Only takes effect when DYNAMIC_BOT_NAME
332
- # is enabled and the per-chat /botname toggle is on. Auth piggybacks on the
333
- # same Claude executable, so no extra API key is needed under Max.
342
+ # topic label for the footer and the thread name, independent of the main
343
+ # agent. Deferral-immune (bypasses settingSources and tools entirely). Off, the
344
+ # agent is asked to keep the topic itself with telecoder_set_topic. Auth
345
+ # piggybacks on the same Claude executable, so no extra API key is needed under Max.
334
346
  AUTO_TOPIC_HAIKU=true
335
347
 
336
348
  # Image Uploads
337
349
  # Max image file size in MB (Telegram limit ~20MB for downloads)
338
350
  IMAGE_MAX_FILE_SIZE_MB=20
339
351
 
352
+ # Max size in MB for any other file sent to the bot. Telegram won't let a bot
353
+ # download a file over 20 MB, so raising either limit past that doesn't help.
354
+ # DOCUMENT_MAX_FILE_SIZE_MB=19
355
+
340
356
  # ── Claude Code Router (CCR) Provider ────────────────────────
341
- # Enable /ccr and /provider toggling between Claude (Max) and CCR (true/false).
357
+ # Enable /ccr, the switch between Claude (Max) and CCR (true/false).
342
358
  # Redirects the spawned `claude` binary through a local CCR proxy so it can
343
359
  # be backed by non-Anthropic models — useful as a fallback when Max runs out.
344
360
  # Requires CCR installed and running: https://github.com/musistudio/claude-code-router
@@ -350,10 +366,6 @@ IMAGE_MAX_FILE_SIZE_MB=20
350
366
  # CCR's local auth token (see ccr config — usually any non-empty string).
351
367
  # CCR_AUTH_TOKEN=
352
368
 
353
- # Auto-prompt the user with an inline keyboard when a Max usage-limit
354
- # throttle is detected. Lets them switch to CCR and retry with one tap.
355
- # CCR_AUTO_PROMPT_ON_THROTTLE=true
356
-
357
369
  # When the CCR proxy isn't reachable, automatically run `ccr start` in the
358
370
  # background instead of letting the request hang on ConnectionRefused.
359
371
  # CCR_AUTOSTART=false