The Telegram chat agent returns only the final answer. The user cannot see which tools are being called, their parameters, or their results. This makes debugging agent behavior (hallucinations, wrong tool choices, footguns like systemctl stop vs restart) impossible from the chat side.
Desired behavior
After each tool call completes, the gateway sends a compact inline message showing the tool name and a one-line summary of the result, before the next tool call or final answer. Similar to how Hermes surfaces tool calls in Telegram.
Only onDelta (text streaming) is threaded through. Tool calls happen inside Generate but there's no callback back to the gateway.
What needs to change
Add a tool-call observer callback — either extend LLMStreamResponder signature or add a separate OnToolCall field to gateway.Router struct, plumbing it through TurnRunner → TurnModel/PreparedTurnModel.Generate so model providers can report tool invocations
Model provider integration — the chat turn model (cmd/archied/chat_turn_model.go) and any provider-specific Generate implementations need to call the observer when a tool is executed, passing tool name + result summary
Telegram gateway wiring — in submitTurn (internal/channels/telegram/telegram.go), if show_tool_calls config is true, wire the observer to send a compact inline message via sendMessage before the final reply
Config plumbing — add ShowToolCalls bool to the Telegram gateway config struct and read it from [chat.telegram] show_tool_calls in telegram_setup.go
Model provider Generate — where tool calls execute
internal/channels/telegram/telegram.go
submitTurn — wire observer + send messages
cmd/archied/telegram_setup.go
Config reading + gateway construction
Imported from beads archie-core-1786637501270-433-dc1a0bc2 · GitHub #467 · type feature · priority P2 · created 2026-08-12 · closed 2026-08-14
The Telegram chat agent returns only the final answer. The user cannot see which tools are being called, their parameters, or their results. This makes debugging agent behavior (hallucinations, wrong tool choices, footguns like `systemctl stop` vs `restart`) impossible from the chat side.
## Desired behavior
After each tool call completes, the gateway sends a compact inline message showing the tool name and a one-line summary of the result, before the next tool call or final answer. Similar to how Hermes surfaces tool calls in Telegram.
Example format:
```
🔧 memory_edit — added entry
🔧 terminal — systemctl --user stop archied (exit 0)
🔧 terminal — systemctl --user start archied (exit 0)
```
Then the final answer.
## Scope
`internal/channels/telegram/` only. Behind a config flag `[chat.telegram] show_tool_calls = true` so it can be toggled.
## Technical approach
Currently the call chain is:
```
submitTurn → router.RouteStream(turnCtx, gm, draft.onDelta)
→ r.LLMStream(ctx, msg, onDelta)
→ TurnRunner.Run(ctx, msg, onDelta)
→ prepared.Generate(ctx, req, onDelta)
```
Only `onDelta` (text streaming) is threaded through. Tool calls happen inside `Generate` but there's no callback back to the gateway.
### What needs to change
1. **Add a tool-call observer callback** — either extend `LLMStreamResponder` signature or add a separate `OnToolCall` field to `gateway.Router` struct, plumbing it through `TurnRunner` → `TurnModel`/`PreparedTurnModel.Generate` so model providers can report tool invocations
2. **Model provider integration** — the chat turn model (`cmd/archied/chat_turn_model.go`) and any provider-specific `Generate` implementations need to call the observer when a tool is executed, passing tool name + result summary
3. **Telegram gateway wiring** — in `submitTurn` (`internal/channels/telegram/telegram.go`), if `show_tool_calls` config is true, wire the observer to send a compact inline message via `sendMessage` before the final reply
4. **Config plumbing** — add `ShowToolCalls bool` to the Telegram gateway config struct and read it from `[chat.telegram] show_tool_calls` in `telegram_setup.go`
### Key files
| File | Role |
|------|------|
| `internal/gateway/gateway.go` | `RouteStream`, `Router` struct (add observer field) |
| `internal/gateway/turn.go` | `TurnRunner.Run`, `PreparedTurnModel.Generate` signature |
| `cmd/archied/chat_turn_model.go` | Model provider `Generate` — where tool calls execute |
| `internal/channels/telegram/telegram.go` | `submitTurn` — wire observer + send messages |
| `cmd/archied/telegram_setup.go` | Config reading + gateway construction |
---
_Imported from beads `archie-core-1786637501270-433-dc1a0bc2` · GitHub #467 · type feature · priority P2 · created 2026-08-12 · closed 2026-08-14_
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
The Telegram chat agent returns only the final answer. The user cannot see which tools are being called, their parameters, or their results. This makes debugging agent behavior (hallucinations, wrong tool choices, footguns like
systemctl stopvsrestart) impossible from the chat side.Desired behavior
After each tool call completes, the gateway sends a compact inline message showing the tool name and a one-line summary of the result, before the next tool call or final answer. Similar to how Hermes surfaces tool calls in Telegram.
Example format:
Then the final answer.
Scope
internal/channels/telegram/only. Behind a config flag[chat.telegram] show_tool_calls = trueso it can be toggled.Technical approach
Currently the call chain is:
Only
onDelta(text streaming) is threaded through. Tool calls happen insideGeneratebut there's no callback back to the gateway.What needs to change
Add a tool-call observer callback — either extend
LLMStreamRespondersignature or add a separateOnToolCallfield togateway.Routerstruct, plumbing it throughTurnRunner→TurnModel/PreparedTurnModel.Generateso model providers can report tool invocationsModel provider integration — the chat turn model (
cmd/archied/chat_turn_model.go) and any provider-specificGenerateimplementations need to call the observer when a tool is executed, passing tool name + result summaryTelegram gateway wiring — in
submitTurn(internal/channels/telegram/telegram.go), ifshow_tool_callsconfig is true, wire the observer to send a compact inline message viasendMessagebefore the final replyConfig plumbing — add
ShowToolCalls boolto the Telegram gateway config struct and read it from[chat.telegram] show_tool_callsintelegram_setup.goKey files
internal/gateway/gateway.goRouteStream,Routerstruct (add observer field)internal/gateway/turn.goTurnRunner.Run,PreparedTurnModel.Generatesignaturecmd/archied/chat_turn_model.goGenerate— where tool calls executeinternal/channels/telegram/telegram.gosubmitTurn— wire observer + send messagescmd/archied/telegram_setup.goImported from beads
archie-core-1786637501270-433-dc1a0bc2· GitHub #467 · type feature · priority P2 · created 2026-08-12 · closed 2026-08-14