Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
00f1f7c
MCP addons: direct commands, watches and an outbox, plus the GeoGuess…
claude Nov 20, 2026
831434a
Signal: the bot's commands work in groups without a mention
claude Nov 20, 2026
072afeb
Untagged commands: tests for the reader's choice, doc fixes
claude Nov 20, 2026
418f0b8
GeoGuess: Signal's location button is +, not 📎
claude Nov 20, 2026
f66f276
GeoGuess: tell players to zoom out before dragging the pin
claude Nov 20, 2026
dd55483
Addons learn the chat network; GeoGuess's caption names only its steps
claude Nov 20, 2026
b34fee8
GeoGuess: Signal's location picker needs a confirm before send
claude Nov 20, 2026
ada1cd6
GeoGuess: 40 more Australian seed areas
claude Nov 20, 2026
36a32c8
GeoGuess keeps a photo ready per GEO_KEEP region and waits longer
claude Nov 20, 2026
2a3dadc
Move GeoGuess to robdevops/chat-plugin-geoguess
claude Nov 20, 2026
833209f
One callback shape for sent messages; OnSent alone claims nothing
claude Nov 20, 2026
d523464
Ports: one OnSent contract, failed sends count as dropped, docs match
claude Nov 20, 2026
3d04bb7
addon: a public package for signalbot's MCP addon extension
claude Nov 21, 2026
a776459
addon: pages fit the bot's line, Run stops cleanly; fix a test race
claude Nov 21, 2026
8e661eb
docs: GeoGuess is built on the addon package
claude Nov 21, 2026
ddcc90d
addon: a JSON Schema of the extension, for addons in other languages
claude Nov 21, 2026
588ced5
addon schema: fixes from review; an addon's merged posts are never cut
claude Nov 21, 2026
673606b
addon: a watch's ID and pattern limits are characters, as the schema …
claude Nov 21, 2026
7e5ff71
Addons can use the bot's model (MCP sampling), and watch replies
claude Nov 21, 2026
ad732c1
docs: give addons their full path in the MCP file
claude Nov 21, 2026
f5a542f
Addons get a state directory by default, and can reply to their own p…
claude Nov 21, 2026
a9aa407
Guard an addon's later pictures too
claude Nov 21, 2026
a500bfe
Posts can carry an audio clip, and addons can send one
claude Nov 22, 2026
fe51891
Watches can take reactions to the addon's own messages
claude Nov 22, 2026
f84f64a
In a DM, a reply watch takes every message
claude Nov 22, 2026
ec18ac9
A watch's over text answers replies to a finished game
claude Nov 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ internal/bot/ the decision, the prompt, the hooks; wires the core, and
internal/feature/ the ports and shared types, command parsing, featuretest
internal/features/* one package per feature
internal/kit/* code with two or more users and no bot knowledge
addon/ signalbot's MCP addon extension, for the bot and any addon written in Go: its wire format, a ready stdio server, and schema.json for addons in other languages; public, standard library only
cmd/signalctl/ a small client for signal-cli's daemon socket, for one-off chores such as blocking; not part of the bot
```

Expand All @@ -24,11 +25,12 @@ Features reach the core only through the ports in `internal/feature`, one per st

| Stage | Port |
|---|---|
| A message arrives | `OnMessage`: carry on, answer without the model, choose a tool, or keep text as context |
| The model is asked | `OnTurn` (a note on the message, images) and `Tools` (a `ToolGroup`) |
| A message arrives | `OnMessage`: carry on, answer without the model (text or pictures), choose a tool, keep text as context, or mark it done |
| The model is asked | `OnTurn` (a note on the message, images) and `OfferTools` (a `ToolGroup`) |
| Time arrives | `At`: a one-shot timer |
| Something besides a message happens | `OnEvent`: a reaction or a member change, answered without the model |

and the host's services: `Env`, `Info`, `Media`, `CallAPI`, `Deliver`, `Groups`, `Redact` and `Go`. Hooks run in `features.go` order. An `OnMessage` hook for an unaddressed message runs on the reader goroutine, so it must not block or call the network.
and the host's services, among them `Env`, `Store`, `Info`, `Media`, `CallAPI`, `Deliver`, `Post`, `React`, `Groups`, `Redact` and `Go` ([TECHNICAL.md](TECHNICAL.md#lifecycle-and-ports) lists them all). Hooks run in `features.go` order. An `OnMessage` hook for an unaddressed message runs on the reader goroutine, so it must not block or call the network.

If a feature can't be built on these, that's a design finding. Either a port becomes more generic, and stays tied to its stage, or the feature takes on more of the work. A feature-shaped field in the core is never the answer: delete any feature and the core doesn't change.

Expand All @@ -53,7 +55,7 @@ Give a feature a tag only for a real saving, such as a dependency; a runtime set

Tests in `internal/arch` enforce these:

- **Imports:** only the main package, at the module root, imports features and `internal/signal`; a feature imports only `internal/feature`, `internal/kit` and its own packages; `internal/signal` imports only `internal/feature`, kit, `internal/config` and `internal/bot` (network to core, never the reverse); `internal/config` and kit import no other internal package.
- **Imports:** only the main package, at the module root, imports features and `internal/signal`; a feature imports only `internal/feature`, `internal/kit` and its own packages; `internal/signal` imports only `internal/feature`, kit, `internal/config` and `internal/bot` (network to core, never the reverse); `internal/config` and kit import no other internal package; a feature may also import `addon`, and `addon` imports only the standard library, since every addon builds it.
- **No feature names in the core:** the core's source mentions no feature name or feature-only word (chart, MCP, group context, `/intro`, `/schedule`, …).
- **Docs:** every setting read, the core's or a feature's (`h.Env("NAME", …)`), is in the table in [docs/CONFIGURATION.md](docs/CONFIGURATION.md).

Expand Down
43 changes: 39 additions & 4 deletions PRIVACY.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ When asked for a picture, the model writes a prompt for the image model, which c

With MCP tools configured, the model may call them. A call sends the arguments the model wrote, which can quote anything above, to that tool's MCP server, and the tool's result goes to the model's API with the next request.

With an [addon](#addons) configured, the bot sends that program, on the same machine, what its permissions allow: see below. Whatever the addon then sends elsewhere is up to it.

Every request to OpenRouter tells it to use only model providers that do not collect data (`data_collection: deny`). That is a request the bot cannot check or enforce, so read OpenRouter's policy and the model provider's. Other APIs get no such request, since it is OpenRouter's own; read their data policy. A local server, such as Ollama on the same machine, keeps everything on it.

## What the bot keeps
Expand All @@ -34,8 +36,9 @@ Every request to OpenRouter tells it to use only model providers that do not col
- **No swap or core dumps.** The included systemd unit and Docker command forbid both, so history cannot reach disk that way.
- **Memory is freed, not wiped.** An expired message is dropped and Go's garbage collector reclaims its memory, but the bytes may linger until overwritten, and someone with root access to the host could read them from the running process.
- **What features save, on disk.** Features save state only through the core, one file each in the state directory (`/var/lib/private/signalbot`), so everything the bot keeps on disk is listed here.
- **Schedules are kept on disk.** Each `/schedule` saves, in `schedules.json` in the state directory (`/var/lib/private/signalbot`), the scheduling user's ID, the group's ID and its name when scheduled (if it's for a group), the time and repeat, and the text to post, until the user deletes it with `/schedule del`. The file also keeps, for each user who has scheduled, the last schedule number they were given, so numbers are never reused; it stays after their schedules are deleted. A one-off dropped because the bot was down is deleted, and its user is told in their DM, with the first 80 characters of its text. Besides today's spending (below), nothing else the bot keeps is written to disk.
- **Schedules are kept on disk.** Each `/schedule` saves, in `schedules.json` in the state directory (`/var/lib/private/signalbot`), the scheduling user's ID, the group's ID and its name when scheduled (if it's for a group), the time and repeat, and the text to post, until the user deletes it with `/schedule del`. The file also keeps, for each user who has scheduled, the last schedule number they were given, so numbers are never reused; it stays after their schedules are deleted. A one-off dropped because the bot was down is deleted, and its user is told in their DM, with the first 80 characters of its text. Besides today's spending and, with an addon, `mcp.json` (both below), nothing else the bot keeps is written to disk; an addon's own `addons/<name>` directory is the addon's (below).
- **Today's spending, on disk.** With a daily budget (`DAILY_BUDGET`, on by default), `budget.json` in the state directory holds today's date and, for each chat that used the model today, what it spent and whether it was told it reached the limit. Chats are stored under a SHA-256 hash of their ID, so the file holds no phone numbers, account IDs or group IDs as such. A hash of a phone number could be matched by trying every number, so treat the file as you would the schedules. Each day's file replaces the last.
- **Addon state, on disk.** With an MCP server configured as an addon, `mcp.json` in the state directory holds what is listed under [Addons](#addons). Without one, the file is never written.
- **Recent attachments, in memory only.** So that "@bot summarise this" in reply to someone's file can fetch the original, the bot remembers, for each group message and each DM from an allowed sender with attachments, the attachments' IDs, file names, types and sizes, never their content, under the chat, sender and time. Each is forgotten after a day, or sooner when 2,000 newer messages are remembered, and a restart clears them all. On Signal the bot also keeps a copy of each picture it sent (a chart, a picture it made), content and all, for at most a day and 32 MB in all, since signal-cli keeps none: a reply quoting it then shows the model the picture rather than Signal's small thumbnail. A delete of that message from the account's linked device drops it, and a restart clears them all.
- **Names.** The bot keeps a copy of signal-cli's contact list (names and IDs) in memory, so it can show and mention people by name. It reloads the list at startup, after reconnecting, when a group changes, and at least daily when in use, replacing what it had, so people who leave a group are forgotten. It also keeps the name of anyone who sends it an addressed message. It never keeps what anyone wrote.

Expand All @@ -48,17 +51,17 @@ Every level, debug included, is always written; there is no setting to turn any
- **A message not addressed to the bot:** nothing, not even a note that it arrived.
- **Reactions and changes in a group's members:** nothing. They are passed to features that ask for them (who reacted, with what, to whose message; who joined or left), never logged, kept or shown to the model. With no such feature, they are dropped as they arrive.
- **A DM from someone not in `SIGNAL_DM_USER_IDS`:** their ID, every time, never a name or text. The same goes for a scheduled run in the DM of a user since removed from the list.
- **A tool call:** the tool's name and how long it took; never the arguments or the result.
- **A tool call:** the tool's name and how long it took; never the arguments or the result. An addon's calls, made by the bot itself, are logged the same way, with the result's size and code, as are counts of what it had dropped; never what was said, nor the addon's own error text.
- **A link, file, photo or sticker in a message addressed to the bot:** one line each with what the bot did with it and, once it was fetched, its size (how much text was read, a PDF or audio attached, an image shrunk, or why it failed); one line when a link wasn't fetched (it looked private or one-time, it wasn't on port 80 or 443, the chat's 20 an hour were used, or it was past the second in a message) or when the model can't see the images or sticker; never the link, not even its host, the file's name or the type it was sent as (a file the bot can't read is logged with the type sniffed from its content), the page's title, a sticker's emoji or pack title, or any text.
- **Schedules:** how many were loaded at startup, a run skipped or dropped, and how long each run took; never the text or who made it. A run dropped because its user left the group is logged without content.
- **Names and IDs:** never anyone's name, and never anyone's ID except as above for a DM from someone not in `SIGNAL_DM_USER_IDS`. The bot logs its own account ID at startup.
- **Debug lines:** the number of contacts loaded, that a repeated message was dropped, and a local MCP server's own error output, which the bot doesn't control, so each line has every name and ID the bot knows replaced with "redacted" ("Alice's" becomes "redacted's"), along with any UUID or phone number, before it is written.
- **Debug lines:** the number of contacts loaded, that a repeated message was dropped, and a local MCP server's own error output, which the bot doesn't control, so each line has every name and ID the bot knows replaced with "redacted" ("Alice's" becomes "redacted's"), along with any UUID or phone number, before it is written. An addon's error output is never written at all, only counted ("addon geo wrote 3 lines (210 bytes) to stderr", at most once a minute, and once more when it exits), since it may repeat what it was sent.

Logs go to the journal or Docker's log driver and are kept as long as your settings keep them.

## What the bot can see

In a group, signal-cli passes every message to the bot, which checks each one for whether it is addressed to it. Messages not addressed to it are never logged and never answered. Their text, with the sender's display name, is kept in that group's history as context, the same way and for the same time as everything else there, unless `GROUP_CONTEXT=false`, in which case they are dropped on the spot. In DMs, the bot answers only the IDs listed in `SIGNAL_DM_USER_IDS`.
In a group, signal-cli passes every message to the bot, which checks each one for whether it is addressed to it: it mentions the bot, replies to it, or starts with one of its commands, such as `/intro`. Messages not addressed to it are never logged and never answered. Their text, with the sender's display name, is kept in that group's history as context, the same way and for the same time as everything else there, unless `GROUP_CONTEXT=false`, in which case they are dropped on the spot. In DMs, the bot answers only the IDs listed in `SIGNAL_DM_USER_IDS`. A message an addon's watch takes (see below) is neither answered nor kept, even as context.

## Telegram

Expand All @@ -71,8 +74,40 @@ On Telegram (`TELEGRAM_BOT_TOKEN` set) the above holds, with these differences:
- **Photos and files** are fetched from Telegram's servers by file ID, only while answering the message that has them.
- **Who it answers in groups.** Anyone can add a Telegram bot to a group, so the bot answers in a group only while someone in `TELEGRAM_DM_USER_IDS` is a member, and leaves one where no one is. Until it has checked, a stranger's group can briefly reach it: such messages are never answered, and chatter is dropped once the check is done.
- **Topics.** In a group with topics, each topic keeps its own history.
- **Locations.** A shared location or venue reaches the bot as a map link with its coordinates, as on Signal, so it is kept, and sent to the model, like any text. A live location, which follows its sender, is left out.
- **The token** is in every request's URL; the bot takes it out of every error before logging it.

## Addons

An addon is a program the bot runs on its own machine, as an [MCP server](docs/FILES_LINKS_TOOLS_MCP.md#addons), that answers its own commands, reads the messages it asks for and posts on its own, such as the [GeoGuess](https://github.com/robdevops/chat-plugin-geoguess) game. With none configured, none of this applies.

- **It is trusted code.** It runs as the bot's user, in the same sandbox, and could read what the bot's user can, the state directory included. What follows limits what the bot hands it; it guards against mistakes and leaks, not against a hostile program. Install only addons you would let run as the bot.
- **What it never gets:** phone numbers, account IDs or group IDs. Chats and people are pseudonyms, made from a secret in `mcp.json` and different for each addon; by default the same person has a different one in each chat, so an addon can't follow them between groups. It gets none of the bot's settings or keys either: only `PATH`, `HOME`, the time zone and proxy settings (`TZ`, `HTTPS_PROXY`, `HTTP_PROXY`, `NO_PROXY`, `SSL_CERT_FILE`, `SSL_CERT_DIR`) if set, and the variables named for it (such as `GEO_…`).
- **Where it works:** only in the groups its `chats` lists (or all, if set to `all`), and in DMs only with `dms`.
- **What each permission sends:**
- a command (`/geo …`) sends the text after it, and who sent it, as a pseudonym, and when the bot got it, never the sender's own clock;
- `watch` sends the messages its watch matches (GeoGuess: map links and coordinates during a round), with the same; nothing else said in the chat. A pattern that would match ordinary chat is refused, so there is no feed of everything. A reply watch sends replies to the addon's own messages that ask the bot, such as answers to a quiz, whatever they say;
- `names` adds each sender's display name. Without it, the addon writes a pseudonym where a name goes, and the bot puts in the name it last saw that person use in that chat, kept in memory for a day;
- `global_ids` gives a person the same pseudonym in every chat, so the addon can link them across groups;
- `post` and `react` send nothing: they let it post and react, only in a chat where it was used in the last day;
- `model` lets it ask the bot's model, with the bot's key: the addon's prompts, and whatever it put in them from the chat, go to the model provider, as chat with the bot does, and what they cost counts toward that chat's `DAILY_BUDGET`. The bot logs only each request's outcome, time, size and cost, never the prompt or the answer.
- **What the addon keeps** is its own, outside what this page lists for the bot, in the directory its `…_STATE_DIR` names (GeoGuess: `GEO_STATE_DIR`): by default `addons/<server name>` in the state directory (`/var/lib/private/signalbot/addons/geo`), which the addon creates and writes, never the bot. Read its own documentation.
- **Deletes and edits are not passed on.** A message an addon took stays with the addon if its sender later deletes it for everyone. An edit of one is passed on, as a new version.
- **Taken messages are kept nowhere by the bot:** not in history, not as context (so `GROUP_CONTEXT=false` makes no difference to them), not in the log. The addon still gets them.
- **What it posts** is kept in history as the bot's own words, labelled with the addon's name (`[GeoGuess] …`) and cut to 500 characters, so later model requests can see it but it never poses as a person.
- **`mcp.json`,** in the state directory, written only when some MCP server is an addon:

| Item | Kept for |
|---|---|
| The pseudonym secret | Until `mcp.json` is deleted, which gives everyone new pseudonyms |
| Chats an addon may post in: the chat's pseudonym and its real ID | 24 hours after the addon was last used there |
| Live watches: the chat's pseudonym, the pattern, and the times of the bot's messages with the command's pictures, and for a reply watch of the addon's messages | Until the watch ends, at most `watch_max` (24 hours at most) |
| Messages a watch took: the chat's ID, the sender's pseudonym and the message's time, never its text | 48 hours, so a later edit is taken too |
| How far the bot has read each addon's outbox, and the last 1,000 outbox entries' IDs | Replaced on each save; dropped once the server is no longer an addon |
| An addon's last 256 posts, for a later post to reply to: the post's ID, the chat's pseudonym and the time (on Telegram, the ID) of the bot's message, never its text | 24 hours |

Refs to messages (for reactions, a day), display names (a day) and posts waiting to go out are kept in memory only.

## What this does not cover

- **The provider.** Once a message is sent, the model provider's retention, logging and sub-processors apply.
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ A small, [privacy-conscious](PRIVACY.md) chat bot for Signal, through a running

## Features

- Responds to @mentions, replies to its messages, and DMs from whitelisted contacts
- Responds to @mentions, replies to its messages, its commands (such as `/intro`) without a mention, and DMs from whitelisted contacts
- Tools: web search, line and pie charts, [pictures](docs/FILES_LINKS_TOOLS_MCP.md#images) (drawings, art, diagrams) with GPT Image 2, and your own [MCP connectors](docs/FILES_LINKS_TOOLS_MCP.md#mcp-connectors)
- [`/schedule`](docs/SCHEDULING.md) a message or command, once or repeating
- [Addons](docs/FILES_LINKS_TOOLS_MCP.md#addons): MCP servers that run their own commands and games in chosen groups, without the model, such as [GeoGuess](https://github.com/robdevops/chat-plugin-geoguess), seeing only pseudonyms
- Understands [files](docs/FILES_LINKS_TOOLS_MCP.md#files) (PDFs, text and code, Word, Excel and PowerPoint) and the [pages you link to](docs/FILES_LINKS_TOOLS_MCP.md#links), and if the model supports it, images, stickers, voice notes and other audio
- Typing indicators, reactions, stickers, @mentions and replies
- In-memory conversation context (Default: 10 messages). Never logged to disk, forgotten after 24 hours, or sooner if _disappearing messages_ requires.
Expand Down
Loading
Loading