Keybase Channel Plugin — E2E encrypted team chat for cobot #87
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Competitor
Kind/Documentation
Kind/Enhancement
Kind/Epic
Kind/Feature
Kind/Security
Kind/Story
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Scope/Core
Scope/Cross-Plugin
Scope/Plugin-System
Scope/Single-Plugin
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ultanio/cobot#87
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Add a Keybase channel plugin so cobot can send/receive messages in Keybase team channels, using the same extension point architecture as the Telegram plugin.
Architecture Analysis
Cobot's communication stack has three layers of extension points:
The session plugin polls all channels via
session.receive, aggregates messages, and routes outgoing messages bychannel_type. The loop plugin polls communication, feeds messages to the LLM, and sends responses back.A new channel plugin just needs to:
session.receive→ returnlist[IncomingMessage]session.send→ acceptOutgoingMessage, returnboolsession.typing→ send typing indicatorsession.presence→ set online/offline statusThe session plugin auto-discovers all implementations and routes by
channel_type. Zero changes needed to session, communication, or loop plugins.How Keybase Chat API Works
Keybase exposes a JSON API via the
keybaseCLI binary:Send a message:
Listen for messages (streaming):
Read recent messages:
Auth (headless):
No Python dependencies needed — just subprocess calls to
keybase chat api.Implementation Plan
File structure
Plugin skeleton
Config
Phase 1: Send messages (~0.5 day)
start()→ runkeybase oneshotto authenticatesend_message(OutgoingMessage)→keybase chat api -m '{"method": "send", ...}'get_default_channel_id()→ returns configured default channel#generalon startupPhase 2: Receive messages (~1 day)
Two strategies (config:
poll_mode):A)
listenmode (recommended):start()spawnskeybase chat api-listenas async subprocessIncomingMessagepoll_updates()drains the queue and returns messagesB)
readmode (simpler fallback):poll_updates()callskeybase chat api -m '{"method": "read", ...}'Both return
list[IncomingMessage]with:channel_type = "keybase"channel_id = "teamname#channelname"sender_id = keybase_usernamesender_name = keybase_usernamePhase 3: Session spawning (~1 day)
This is the interesting part. When a message arrives from Keybase, it flows through the same pipeline as Telegram:
For multi-channel awareness, the loop needs to know which channel a message came from. This already works —
IncomingMessage.channel_typeandchannel_idflow through the entire pipeline. The LLM sees the channel context and responds back to the same channel.For spawning sub-sessions (e.g. a Keybase thread becomes its own conversation context):
subagentplugin already handles isolated sessionssubagent.spawn()withchannel_type="keybase"+channel_id="user:alice"as the reply channelKey decision: Should each Keybase channel get its own conversation history (separate sessions), or share one? Recommendation: separate session per channel_id —
#devdiscussions shouldn't bleed into#generalcontext.This might need a small enhancement to the loop/session layer: a session registry that maps
(channel_type, channel_id)→ conversation history. Currently the loop has one shared history. This is the same problem that would arise with any multi-channel setup (Telegram groups + Keybase + DMs).Phase 4: Encrypted KV store + KBFS (~1 day)
Bonus capabilities unique to Keybase:
keybase kvstore api→ encrypted team-scoped key-value store (agent state, shared secrets)/keybase/team/cobotdev/→ encrypted filesystem (shared files, private plugins)kv_get,kv_put,kbfs_read,kbfs_writeDependencies
keybaseCLI binary installed on the hostEffort
Open Questions
Session-per-channel vs shared session — the current loop has one conversation history. Multi-channel support (Keybase, Telegram, DMs) needs a session registry. Should this be part of this ticket or a separate "multi-session support" epic?
Bot account — create a new Keybase user (e.g.
cobotai) or run as an existing user?Team name —
cobotdev?cobot?ultanio?References
cobot/plugins/telegram/plugin.py— direct template to followcobot/plugins/session/plugin.py— routing layer