Forum teuk.org

πŸ§ πŸ—οΈ Mediabot v3 β€” The Pensieve Can Read Another Room

in Mediabot Β· started by TeuK Β· 1w ago

TeuK Β· 1w ago

Development chronicle β€” mb636 to mb637 Β· Cross-channel AI summaries, privacy-aware publishing and canonical channel identity

Mediabot’s AI summary command can now read a channel other than the one where the operator is standing.

The new syntax is simple:

ai #35+ans summary

but internally it changes an important assumption: the channel being read no longer has to be the channel where Mediabot is speaking.

No database schema change was required.


🧠 mb636 β€” ai [#channel] summary

The canonical syntax becomes:

ai [#channel] summary [period] [nick] [options]

Existing forms remain unchanged:

ai summary
ai summary public
ai summary today
ai summary 7d

A named source channel can now be used:

ai #35+ans summary

By default, the result is sent privately as a notice.

To publish the result on the current channel:

ai #35+ans summary public

The #channel token is recognized only immediately before summary.

That is deliberate: a normal Claude prompt such as:

ai #linux c'est mieux que quoi ?

must remain a normal AI prompt.


πŸšͺ Reading and publishing use different keys

Reading the current channel requires:

Administrator

Reading another channel privately also requires:

Administrator

But publishing the summary of another channel into the current room requires:

Master

The difference is the audience.

Inspecting another channel privately and reproducing its conversation in front of people who were not there are not the same action.

A denied cross-channel publication is rejected before any summary database query is executed.


🧭 Source and destination are now separate

The command now carries two channel identities:

source channel
    = conversation being read

destination channel
    = place where "public" output is sent

For:

ai summary public

both are the current channel.

For:

ai #35+ans summary public

they are different.

The source channel owns the database queries, exact message count, period slicing, nickname filtering, last timestamp, language selection and summary label.

The destination channel only determines where public output is sent.


🌍 Language follows the conversation

Without an explicit language option, the summary language now follows the source channel.

So a French source channel remains French even if the operator launches the command from another room.

An explicit language still wins:

ai #canal-fr summary en

❓ Unknown channels are reported honestly

A channel that Mediabot does not know is now reported as unknown.

It no longer falls through to a misleading:

no messages found

An unknown room and an empty room are two different conditions.


🧩 mb637 β€” One channel, one identity

The final pre-commit audit found one IRC-specific edge case.

Channel lookup was already case-insensitive, so:

#35+ANS

could correctly find:

#35+ans

But the rest of the summary code still kept the spelling supplied by the operator.

That could create two state keys:

summary_last:#35+ANS
summary_last:#35+ans

for the same IRC channel.

A later:

ai #35+ans summary last

could therefore behave as though no previous summary existed.


🧭 Resolve first, then use the canonical name

After mb637:

#35+ANS
    ↓
case-insensitive lookup
    ↓
Channel object
    ↓
canonical name
    ↓
#35+ans

From that point onward, SQL, language resolution, labels and summary_last all use the canonical channel identity.

So:

#35+ANS
#35+ans
#35+AnS

all share exactly one summary history.


πŸ§ͺ Regression coverage

Test 817 protects the complete cross-channel contract:

historical summary forms
explicit source channel
Administrator access
Master-only cross-channel publication
denial before DB access
unknown-channel handling
source/destination separation
normal AI prompt non-capture
canonical channel identity
case-independent "last" history

The final targeted validation completed green before commit.


🏰 Final parchment

The Pensieve is no longer bolted to the room where the Headmaster happens to be standing.

An Administrator can open the memory of another hall and study it privately.

Carrying that memory into the Great Hall and reading it aloud requires a stronger key.

And whether someone writes the room name in capitals, lowercase or a mixture of both, Mediabot now remembers one important rule:

a room has one identity, even when IRC lets people spell its name more than one way. ::: ​​

You must be logged in to reply.